summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py')
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py49
1 files changed, 24 insertions, 25 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py
index 3c4b228e4..981a77f51 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py
@@ -19,7 +19,7 @@ sys.path.append('../..')
import angle_format
template_texture_format_table_autogen_cpp = """// GENERATED FILE - DO NOT EDIT.
-// Generated by {script_name} using data from {data_source_name}
+// Generated by gen_texture_format_table.py using data from texture_format_data.json
//
// Copyright {copyright_year} The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -60,7 +60,7 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
// clang-format on
UNREACHABLE();
- static constexpr Format defaultInfo;
+ static const Format defaultInfo;
return defaultInfo;
}}
@@ -216,7 +216,23 @@ def get_blit_srv_format(angle_format):
format_entry_template = """{space}{{
-{space} static constexpr Format info({internalFormat},
+{space} static const Format info({internalFormat},
+{space} angle::Format::ID::{formatName},
+{space} {texFormat},
+{space} {srvFormat},
+{space} {rtvFormat},
+{space} {dsvFormat},
+{space} {blitSRVFormat},
+{space} {swizzleFormat},
+{space} {initializer},
+{space} deviceCaps);
+{space} return info;
+{space}}}
+"""
+
+split_format_entry_template = """{space} {condition}
+{space} {{
+{space} static const Format info({internalFormat},
{space} angle::Format::ID::{formatName},
{space} {texFormat},
{space} {srvFormat},
@@ -224,22 +240,8 @@ format_entry_template = """{space}{{
{space} {dsvFormat},
{space} {blitSRVFormat},
{space} {swizzleFormat},
-{space} {initializer});
-{space} return info;
-{space}}}
-"""
-
-split_format_entry_template = """{space} {condition}
-{space} {{
-{space} static constexpr Format info({internalFormat},
-{space} angle::Format::ID::{formatName},
-{space} {texFormat},
-{space} {srvFormat},
-{space} {rtvFormat},
-{space} {dsvFormat},
-{space} {blitSRVFormat},
-{space} {swizzleFormat},
-{space} {initializer});
+{space} {initializer},
+{space} deviceCaps);
{space} return info;
{space} }}
"""
@@ -342,19 +344,16 @@ def reject_duplicate_keys(pairs):
return found_keys
json_map = angle_format.load_with_override(os.path.abspath('texture_format_map.json'))
-data_source_name = 'texture_format_data.json'
-with open(data_source_name) as texture_format_json_file:
+with open('texture_format_data.json') as texture_format_json_file:
texture_format_data = texture_format_json_file.read()
texture_format_json_file.close()
json_data = json.loads(texture_format_data, object_pairs_hook=angle_format.reject_duplicate_keys)
angle_format_cases = parse_json_into_switch_angle_format_string(json_map, json_data)
output_cpp = template_texture_format_table_autogen_cpp.format(
- script_name = sys.argv[0],
- copyright_year = date.today().year,
- angle_format_info_cases = angle_format_cases,
- data_source_name = data_source_name)
+ copyright_year=date.today().year,
+ angle_format_info_cases=angle_format_cases)
with open('texture_format_table_autogen.cpp', 'wt') as out_file:
out_file.write(output_cpp)
out_file.close()