diff --git a/framework/generated/dx12_generators/dx12_CppHeaderParser.py b/framework/generated/dx12_generators/dx12_CppHeaderParser.py index 2a2c3a5a3..2dac80331 100644 --- a/framework/generated/dx12_generators/dx12_CppHeaderParser.py +++ b/framework/generated/dx12_generators/dx12_CppHeaderParser.py @@ -117,11 +117,14 @@ def preprocess_file(self, lines): if 'DEFINE_ENUM_FLAG_OPERATORS(' in line: continue - + if interface_scope == 0: source += line enum_scope = line.startswith('typedef enum ') - if (line.startswith('#if') and ('!defined(CINTERFACE)' in line)) or enum_scope: + if ( + line.startswith('#if') and + ('!defined(CINTERFACE)' in line) + ) or enum_scope: interface_scope = 1 else: if enum_scope: @@ -131,7 +134,7 @@ def preprocess_file(self, lines): else: if line.startswith('#if'): interface_scope += 1 - + if 'defined(_MSC_VER) || !defined(_WIN32)' in line: retval_param = True diff --git a/framework/generated/dx12_generators/dx12_api_call_encoders_body_generator.py b/framework/generated/dx12_generators/dx12_api_call_encoders_body_generator.py index be8b486ad..361c441de 100644 --- a/framework/generated/dx12_generators/dx12_api_call_encoders_body_generator.py +++ b/framework/generated/dx12_generators/dx12_api_call_encoders_body_generator.py @@ -153,8 +153,8 @@ def get_encode_struct(self, value, is_generating_struct, is_result): return '' def get_encode_value( - self, value, caller_values, function_name, function_value, is_generating_struct, - is_result + self, value, caller_values, function_name, function_value, + is_generating_struct, is_result ): """Method override.""" write_parameter_value = '' @@ -174,7 +174,9 @@ def get_encode_value( # This is a void** pointer to a memory allocation with a size defined by value.array_length, # not a void* array. For this case, we will encode the content of the memory allocation, and # need to dereference the void** pointer. - dereference_expr = '({prefix}{param} != nullptr) ? *{prefix}{param} : nullptr'.format(prefix=write_parameter_value, param=value.name) + dereference_expr = '({prefix}{param} != nullptr) ? *{prefix}{param} : nullptr'.format( + prefix=write_parameter_value, param=value.name + ) return 'encoder->Encode{}Array({}, {}{});'.format( function_name, dereference_expr, self.get_encode_str_array_length( @@ -183,9 +185,12 @@ def get_encode_value( ) elif value.pointer_count == 2: method_call = 'Encode{}Array2D'.format(function_name) - make_array_2d = ', '.join(self.make_array2d_length_expression(value, caller_values)) + make_array_2d = ', '.join( + self.make_array2d_length_expression(value, caller_values) + ) return 'encoder->{}({}{}, {});'.format( - method_call, write_parameter_value, value.name, make_array_2d + method_call, write_parameter_value, value.name, + make_array_2d ) else: return 'encoder->Encode{}Array({}{}, {}{});'.format( @@ -235,7 +240,9 @@ def get_encode_value( ) return '' - def get_encode_parameter(self, value, caller_values, is_generating_struct, is_result): + def get_encode_parameter( + self, value, caller_values, is_generating_struct, is_result + ): rtn = '' omit_output_data = '' if is_result and self.is_output(value): @@ -301,8 +308,8 @@ def get_encode_parameter(self, value, caller_values, is_generating_struct, is_re if encode_type: rtn = self.get_encode_value( - value, caller_values, encode_type, function_value, is_generating_struct, - is_result + value, caller_values, encode_type, function_value, + is_generating_struct, is_result ) if not rtn: @@ -449,7 +456,9 @@ def get_encode_function_body(self, class_name, method_info, is_result): ' }\n' for value in param_values: - encode = self.get_encode_parameter(value, param_values, False, is_result) + encode = self.get_encode_parameter( + value, param_values, False, is_result + ) body += ' {}\n'.format(encode) rtn_type = method_info['rtnType'] diff --git a/framework/generated/dx12_generators/dx12_base_decoder_body_generator.py b/framework/generated/dx12_generators/dx12_base_decoder_body_generator.py index de7e747a7..e6d4eab50 100644 --- a/framework/generated/dx12_generators/dx12_base_decoder_body_generator.py +++ b/framework/generated/dx12_generators/dx12_base_decoder_body_generator.py @@ -214,7 +214,7 @@ def make_decode_invocation(self, value): body += ' bytes_read += ValueDecoder::DecodeHandleIdValue({}, &{});\n'.format( buffer_args, value.name ) - elif self.has_basetype(type_name) : + elif self.has_basetype(type_name): base_type = self.get_basetype(type_name) body += ' bytes_read += ValueDecoder::Decode{}Value({}, &{});\n'.format( self.encode_types[base_type], buffer_args, value.name diff --git a/framework/generated/dx12_generators/dx12_base_generator.py b/framework/generated/dx12_generators/dx12_base_generator.py index 705747a04..d20ec9191 100644 --- a/framework/generated/dx12_generators/dx12_base_generator.py +++ b/framework/generated/dx12_generators/dx12_base_generator.py @@ -22,7 +22,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -import json,os,re,shutil,sys,tempfile +import json, os, re, shutil, sys, tempfile from collections import OrderedDict @@ -32,12 +32,14 @@ # For limited python 2 compat as used by some Vulkan consumers from pathlib2 import Path # type: ignore + def write(*args, **kwargs): file = kwargs.pop('file', sys.stdout) end = kwargs.pop('end', '\n') file.write(' '.join(str(arg) for arg in args)) file.write(end) + def make_re_string(list, default=None): """Turn a list of strings into a regexp string matching exactly those strings. Pulled from Khronos genvk.py @@ -47,6 +49,7 @@ def make_re_string(list, default=None): else: return default + def remove_suffix(self: str, suffix: str, /) -> str: # suffix='' should not call self[:-0]. if suffix and self.endswith(suffix): @@ -54,6 +57,7 @@ def remove_suffix(self: str, suffix: str, /) -> str: else: return self[:] + def noneStr(s): """Return string argument, or "" if argument is None. @@ -143,6 +147,7 @@ def __init__( self.is_const = is_const self.is_com_outptr = is_com_outptr + class Dx12GeneratorOptions(): """Options for generating C++ function declarations for Dx12 API. @@ -306,8 +311,7 @@ class Dx12BaseGenerator(): # ID3D23CommandList is top parent class for all ID3D12GraphicsCommandList[n] FAMILY_CLASSES_EXECPTION = { - 'ID3D12GraphicsCommandList': - 'ID3D12CommandList' + 'ID3D12GraphicsCommandList': 'ID3D12CommandList' } ADD_RV_ANNOTATION_METHODS = [ @@ -317,19 +321,21 @@ class Dx12BaseGenerator(): ] REMOVE_RV_ANNOTATION_TYPES = { - 'D3D12_GPU_VIRTUAL_ADDRESS':'', - 'D3D12_GPU_DESCRIPTOR_HANDLE':'', - 'D3D12_INDEX_BUFFER_VIEW':'', - 'D3D12_VERTEX_BUFFER_VIEW':'', - 'D3D12_STREAM_OUTPUT_BUFFER_VIEW':'', - 'D3D12_CONSTANT_BUFFER_VIEW_DESC':'', - 'D3D12_SHADER_RESOURCE_VIEW_DESC':'', - 'D3D12_WRITEBUFFERIMMEDIATE_PARAMETER':'', - 'D3D12_DISPATCH_RAYS_DESC':'', - 'D3D12_RAYTRACING_GEOMETRY_DESC':'', - 'D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC':'D3D12_RAYTRACING_GEOMETRY_DESC[]', - 'D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS':'D3D12_RAYTRACING_GEOMETRY_DESC[]', - 'D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC':'', + 'D3D12_GPU_VIRTUAL_ADDRESS': '', + 'D3D12_GPU_DESCRIPTOR_HANDLE': '', + 'D3D12_INDEX_BUFFER_VIEW': '', + 'D3D12_VERTEX_BUFFER_VIEW': '', + 'D3D12_STREAM_OUTPUT_BUFFER_VIEW': '', + 'D3D12_CONSTANT_BUFFER_VIEW_DESC': '', + 'D3D12_SHADER_RESOURCE_VIEW_DESC': '', + 'D3D12_WRITEBUFFERIMMEDIATE_PARAMETER': '', + 'D3D12_DISPATCH_RAYS_DESC': '', + 'D3D12_RAYTRACING_GEOMETRY_DESC': '', + 'D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC': + 'D3D12_RAYTRACING_GEOMETRY_DESC[]', + 'D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS': + 'D3D12_RAYTRACING_GEOMETRY_DESC[]', + 'D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC': '', } def __init__( @@ -471,7 +477,9 @@ def beginFile(self, gen_opts): # Open a temporary file for accumulating output. if self.genOpts.filename is not None: - self.outFile = tempfile.NamedTemporaryFile(mode='w', encoding='utf-8', newline='\n', delete=False) + self.outFile = tempfile.NamedTemporaryFile( + mode='w', encoding='utf-8', newline='\n', delete=False + ) else: self.outFile = sys.stdout @@ -491,7 +499,9 @@ def beginFile(self, gen_opts): # Multiple inclusion protection & C++ wrappers. if (gen_opts.protect_file and self.genOpts.filename): - header_sym = 'GFXRECON_' + os.path.basename(self.genOpts.filename).replace('.h', '_H').upper() + header_sym = 'GFXRECON_' + os.path.basename( + self.genOpts.filename + ).replace('.h', '_H').upper() write('#ifndef ', header_sym, file=self.outFile) write('#define ', header_sym, file=self.outFile) self.newline() @@ -523,7 +533,9 @@ def endFile(self): if sys.platform == 'win32': if not Path.exists(directory): os.makedirs(directory) - shutil.copy(self.outFile.name, directory / self.genOpts.filename) + shutil.copy( + self.outFile.name, directory / self.genOpts.filename + ) os.remove(self.outFile.name) self.genOpts = None @@ -943,9 +955,7 @@ def make_consumer_func_decl( if return_type != 'void': method_name = name[name.find('::Process_') + 10:] - return_value = self.get_return_value_info( - return_type, method_name - ) + return_value = self.get_return_value_info(return_type, method_name) rtn_type1 = self.make_decoded_param_type(return_value) if rtn_type1.find('Decoder') != -1: rtn_type1 += '*' @@ -1012,7 +1022,9 @@ def make_dump_resources_func_decl( if count == 1: param_type = type_name[2:] + 'Info*' else: - param_type = 'HandlePointerDecoder<{}*>'.format(type_name) + param_type = 'HandlePointerDecoder<{}*>'.format( + type_name + ) else: param_type = 'const ' + type_name + '*' else: @@ -1047,7 +1059,9 @@ def get_wrapper_prefix_from_type(self): return 'object_wrappers' def is_resource_dump_class(self): - return True if ('ReplayDumpResources' in self.__class__.__name__) else False + return True if ( + 'ReplayDumpResources' in self.__class__.__name__ + ) else False def is_dump_resources_api_call(self, call_name): return False @@ -1203,7 +1217,8 @@ def get_array_len(self, param): if 'null-terminated' in len: if len == 'null-terminated': paramname = param.find('name') - if (paramname.tail is not None) and ('[' in paramname.tail): + if (paramname.tail + is not None) and ('[' in paramname.tail): paramenumsizes = param.findall('enum') for paramenumsize in paramenumsizes: result = paramenumsize.text @@ -1235,7 +1250,7 @@ def get_array_len(self, param): first = False result = paramenumsize.text else: - result +=', ' + result += ', ' result += paramenumsize.text else: paramsizes = paramname.tail[1:-1].split('][') @@ -1548,8 +1563,7 @@ def make_invocation_type_name(self, base_type): elif type.endswith('_t'): if type[0] == 'u': # For unsigned types, capitalize the first two characters. - return type[0].upper() + type[1].upper( - ) + type[2:-2] + return type[0].upper() + type[1].upper() + type[2:-2] else: return type[:-2].title() elif type[0].islower(): @@ -1576,9 +1590,8 @@ def is_required_struct_data(self, struct_type, struct_source_data): if struct_source_data['declaration_method'] == 'struct' and ( not self.check_blacklist or not struct_source_data['name'] in self.STRUCT_BLACKLIST - ) and struct_type[-4:] != 'Vtbl' and struct_type.find( - "::({})'.format(type_list, arg_list)] diff --git a/framework/generated/dx12_generators/dx12_base_replay_consumer_body_generator.py b/framework/generated/dx12_generators/dx12_base_replay_consumer_body_generator.py index bc10b0886..78fad9842 100644 --- a/framework/generated/dx12_generators/dx12_base_replay_consumer_body_generator.py +++ b/framework/generated/dx12_generators/dx12_base_replay_consumer_body_generator.py @@ -34,7 +34,8 @@ def generate_feature(self): first = True for cmd in self.get_filtered_cmd_names(): - if self.is_resource_dump_class() and self.is_dump_resources_api_call(cmd) == False: + if self.is_resource_dump_class( + ) and self.is_dump_resources_api_call(cmd) == False: continue info = self.feature_cmd_params[cmd] @@ -45,8 +46,8 @@ def generate_feature(self): if self.is_resource_dump_class(): cmddef += self.make_dump_resources_func_decl( return_type, - '{}ReplayDumpResources::Process_'.format(platform_type) + cmd, - values, cmd in self.DUMP_RESOURCES_OVERRIDES + '{}ReplayDumpResources::Process_'.format(platform_type) + + cmd, values, cmd in self.DUMP_RESOURCES_OVERRIDES ) + '\n' else: cmddef += self.make_consumer_func_decl( diff --git a/framework/generated/dx12_generators/dx12_base_struct_decoders_body_generator.py b/framework/generated/dx12_generators/dx12_base_struct_decoders_body_generator.py index 5b5ebe858..21388703b 100644 --- a/framework/generated/dx12_generators/dx12_base_struct_decoders_body_generator.py +++ b/framework/generated/dx12_generators/dx12_base_struct_decoders_body_generator.py @@ -119,7 +119,7 @@ def make_decode_invocation(self, name, value): if is_static_array: array_dimension = '' - # dx12 treats 2d array as 1d array. EX: [8][2] -> [16], so dx12's 2d array needs *. + # dx12 treats 2d array as 1d array. EX: [8][2] -> [16], so dx12's 2d array needs *. # But vk keeps 2d array. if value.array_dimension and value.array_dimension > 0: array_dimension = '*' diff --git a/framework/generated/dx12_generators/dx12_call_id_to_string_header_generator.py b/framework/generated/dx12_generators/dx12_call_id_to_string_header_generator.py index 3702de5ba..12a8b4300 100644 --- a/framework/generated/dx12_generators/dx12_call_id_to_string_header_generator.py +++ b/framework/generated/dx12_generators/dx12_call_id_to_string_header_generator.py @@ -26,7 +26,6 @@ class Dx12CallIdToStringHeaderGenerator(Dx12BaseGenerator): - """Generates C++ function responsible for converting Dx12 ApiCallId to string.""" def __init__( @@ -55,19 +54,18 @@ def generate_feature(self): self.write_function_call() def write_include(self): - code = ("\n" - "#include \"format/api_call_id.h\"\n" - "#include \n" - "\n") + code = ( + "\n" + "#include \"format/api_call_id.h\"\n" + "#include \n" + "\n" + ) write(code, file=self.outFile) def write_function_call(self): code = ( "inline std::wstring GetDx12CallIdString(format::ApiCallId call_id){}\n" - "\n" - .format( - self.get_function_call_body() - ) + "\n".format(self.get_function_call_body()) ) write(code, file=self.outFile) @@ -94,9 +92,7 @@ def get_function_call_body(self): code += ( " case format::ApiCallId::ApiCall_{0}_{1}:\n" " out = L\"{0}_{1}\";\n" - " break;\n".format( - class_name, m['name'] - ) + " break;\n".format(class_name, m['name']) ) @@ -108,7 +104,6 @@ def get_function_call_body(self): return code - def endFile(self): write('GFXRECON_END_NAMESPACE(util)', file=self.outFile) write('GFXRECON_END_NAMESPACE(gfxrecon)', file=self.outFile) diff --git a/framework/generated/dx12_generators/dx12_consumer_header_generator.py b/framework/generated/dx12_generators/dx12_consumer_header_generator.py index 04044a815..44ca0a4fe 100644 --- a/framework/generated/dx12_generators/dx12_consumer_header_generator.py +++ b/framework/generated/dx12_generators/dx12_consumer_header_generator.py @@ -89,7 +89,9 @@ def write_include(self): ) write(code, file=self.outFile) - def get_consumer_function_body(self, class_name, method_info, return_type, return_value): + def get_consumer_function_body( + self, class_name, method_info, return_type, return_value + ): return '{}' def change_param_type(self, param): diff --git a/framework/generated/dx12_generators/dx12_decoder_header_generator.py b/framework/generated/dx12_generators/dx12_decoder_header_generator.py index e24d920f3..f770464fd 100644 --- a/framework/generated/dx12_generators/dx12_decoder_header_generator.py +++ b/framework/generated/dx12_generators/dx12_decoder_header_generator.py @@ -59,7 +59,9 @@ def generate_feature(self): def write_include(self): """Method override.""" - code = ("\n" "#include \"decode/dx12_decoder_base.h\"\n" "\n") + code = ("\n" + "#include \"decode/dx12_decoder_base.h\"\n" + "\n") write(code, file=self.outFile) def get_decoder_method_body(self, params): diff --git a/framework/generated/dx12_generators/dx12_enum_to_json_header_generator.py b/framework/generated/dx12_generators/dx12_enum_to_json_header_generator.py index c820097a4..172e29bfa 100644 --- a/framework/generated/dx12_generators/dx12_enum_to_json_header_generator.py +++ b/framework/generated/dx12_generators/dx12_enum_to_json_header_generator.py @@ -26,6 +26,7 @@ from dx12_enum_to_string_header_generator import Dx12EnumToStringHeaderGenerator from reformat_code import format_cpp_code + class Dx12EnumToJsonHeaderGenerator(Dx12BaseGenerator): """Generates C++ functions which build JSON representations of enums.""" @@ -48,7 +49,8 @@ def beginFile(self, gen_opts): """Method override.""" Dx12BaseGenerator.beginFile(self, gen_opts) - code = format_cpp_code(''' + code = format_cpp_code( + ''' /// @file Functions to convert enums to JSON. While trivial these do tidy up /// the FieldToJsons of structs which use them and the JSON consumer too. /// They also mean that generators don't need separate cases for enums. @@ -61,7 +63,8 @@ def beginFile(self, gen_opts): GFXRECON_BEGIN_NAMESPACE(gfxrecon) GFXRECON_BEGIN_NAMESPACE(util) - ''') + ''' + ) write(code, file=self.outFile) self.newline() @@ -72,7 +75,8 @@ def generate_feature(self): for k, v in enum_dict.items(): # Generate enum handler for all enums - enum_prototypes += format_cpp_code('''inline void FieldToJson(nlohmann::ordered_json& jdata, const {0} value, const JsonOptions& options = JsonOptions()) + enum_prototypes += format_cpp_code( + '''inline void FieldToJson(nlohmann::ordered_json& jdata, const {0} value, const JsonOptions& options = JsonOptions()) {{ FieldToJson(jdata, ToString(value), options); }} @@ -80,13 +84,15 @@ def generate_feature(self): {{ FieldToJson(jdata, *pEnum, options); }} - '''.format(k)) + '''.format(k) + ) enum_prototypes += '\n\n' # Generate flags handler for enums identified as bitmasks for bits in self.BITS_LIST: if k.find(bits) >= 0: - flag_prototypes += format_cpp_code('''inline void FieldToJson_{0}(nlohmann::ordered_json& jdata, const uint32_t flags, const JsonOptions& options = JsonOptions()) + flag_prototypes += format_cpp_code( + '''inline void FieldToJson_{0}(nlohmann::ordered_json& jdata, const uint32_t flags, const JsonOptions& options = JsonOptions()) {{ std::string representation; if (!options.expand_flags) @@ -99,19 +105,25 @@ def generate_feature(self): }} FieldToJson(jdata, representation, options); }} - \n'''.format(k)) + \n'''.format(k) + ) flag_prototypes += '\n' write(enum_prototypes, file=self.outFile) write(flag_prototypes, file=self.outFile) - write(format_cpp_code(''' + write( + format_cpp_code( + ''' // IID struct-as-enum special case: inline void FieldToJson(nlohmann::ordered_json& jdata, const IID& value, const JsonOptions& options = JsonOptions()) { FieldToJson(jdata, ToString(value), options); } - '''), file=self.outFile) + ''' + ), + file=self.outFile + ) def endFile(self): """Method override.""" diff --git a/framework/generated/dx12_generators/dx12_enum_to_string_body_generator.py b/framework/generated/dx12_generators/dx12_enum_to_string_body_generator.py index 6db9813e8..e6c0b4e76 100644 --- a/framework/generated/dx12_generators/dx12_enum_to_string_body_generator.py +++ b/framework/generated/dx12_generators/dx12_enum_to_string_body_generator.py @@ -23,7 +23,8 @@ import sys from dx12_base_generator import Dx12BaseGenerator, write -from dx12_enum_to_string_header_generator import Dx12EnumToStringHeaderGenerator # For the list of substrings in bitflag +from dx12_enum_to_string_header_generator import Dx12EnumToStringHeaderGenerator # For the list of substrings in bitflag + class Dx12EnumToStringBodyGenerator(Dx12BaseGenerator): """TODO : Generates C++ functions responsible for Convert to texts.""" @@ -64,7 +65,9 @@ def generate_feature(self): processed_values = set() for value in v['values']: if not value['value'] in processed_values: - body += ' case {0}: ret = "{0}"; break;\n'.format(value['name']) + body += ' case {0}: ret = "{0}"; break;\n'.format( + value['name'] + ) processed_values.add(value['name']) processed_values.add(value['value']) body += ' }}\n' diff --git a/framework/generated/dx12_generators/dx12_enum_to_string_header_generator.py b/framework/generated/dx12_generators/dx12_enum_to_string_header_generator.py index 65e6bc5b3..de969675f 100644 --- a/framework/generated/dx12_generators/dx12_enum_to_string_header_generator.py +++ b/framework/generated/dx12_generators/dx12_enum_to_string_header_generator.py @@ -24,6 +24,7 @@ import sys, inspect from dx12_base_generator import Dx12BaseGenerator, write + class Dx12EnumToStringHeaderGenerator(Dx12BaseGenerator): """TODO : Generates C++ functions responsible for Convert to texts.""" diff --git a/framework/generated/dx12_generators/dx12_json_common_generator.py b/framework/generated/dx12_generators/dx12_json_common_generator.py index 92b3ccf69..95e253ede 100644 --- a/framework/generated/dx12_generators/dx12_json_common_generator.py +++ b/framework/generated/dx12_generators/dx12_json_common_generator.py @@ -22,7 +22,8 @@ # IN THE SOFTWARE. from dx12_base_generator import Dx12BaseGenerator, Dx12GeneratorOptions -from dx12_enum_to_string_header_generator import Dx12EnumToStringHeaderGenerator # For the list of substrings in bitflag enums. +from dx12_enum_to_string_header_generator import Dx12EnumToStringHeaderGenerator # For the list of substrings in bitflag enums. + # returns true if any of the strings in the list appear at the end of the string. def ends_with_any(string, suffixes): @@ -31,10 +32,11 @@ def ends_with_any(string, suffixes): return True return False + # Base class with features shared by multiple DX12 JSON Generators. class Dx12JsonCommonGenerator(Dx12BaseGenerator): - BIT_FLAG_SUFFIXES = Dx12EnumToStringHeaderGenerator.BITS_LIST; + BIT_FLAG_SUFFIXES = Dx12EnumToStringHeaderGenerator.BITS_LIST ## A set of strings which are the types of arguments and struct fields which should be output as hexadecimal. ## @todo Expand this to include more types. @@ -42,7 +44,9 @@ class Dx12JsonCommonGenerator(Dx12BaseGenerator): ## @param value_info A ValueInfo object from base_generator.py. def is_raw_bitflags(self, value_info): - if (not ends_with_any(value_info.base_type, self.BIT_FLAG_SUFFIXES)) and value_info.base_type.upper().startswith('UINT') and value_info.name.upper().endswith("MASK"): + if (not ends_with_any(value_info.base_type, self.BIT_FLAG_SUFFIXES) + ) and value_info.base_type.upper( + ).startswith('UINT') and value_info.name.upper().endswith("MASK"): return True return False @@ -55,12 +59,12 @@ def choose_field_to_json_name(self, value_info): return "Bool32ToJson" if self.is_handle(value_info.base_type): return "HandleToJson" - if("HRESULT" in value_info.base_type): + if ("HRESULT" in value_info.base_type): return "HresultToJson" if ends_with_any(value_info.base_type, self.BIT_FLAG_SUFFIXES): return "FieldToJson_" + value_info.base_type - if self.is_raw_bitflags(value_info): + if self.is_raw_bitflags(value_info): return "FieldToJsonAsFixedWidthBinary" return "FieldToJson" - pass + pass diff --git a/framework/generated/dx12_generators/dx12_json_consumer_body_generator.py b/framework/generated/dx12_generators/dx12_json_consumer_body_generator.py index 6eba08c2c..b22b6395d 100644 --- a/framework/generated/dx12_generators/dx12_json_consumer_body_generator.py +++ b/framework/generated/dx12_generators/dx12_json_consumer_body_generator.py @@ -52,7 +52,9 @@ def __init__( self.json_overrides = json_overrides -class Dx12JsonConsumerBodyGenerator(Dx12JsonConsumerHeaderGenerator, Dx12JsonCommonGenerator): +class Dx12JsonConsumerBodyGenerator( + Dx12JsonConsumerHeaderGenerator, Dx12JsonCommonGenerator +): JSON_OVERRIDES = {} @@ -63,7 +65,9 @@ def beginFile(self, genOpts): self.JSON_OVERRIDES = overrides def write_include(self): - write(format_cpp_code(''' + write( + format_cpp_code( + ''' #include "generated_dx12_json_consumer.h" #include "generated_dx12_enum_to_json.h" #include "generated_dx12_struct_decoders_to_json.h" @@ -72,7 +76,10 @@ def write_include(self): #include "decode/json_writer.h" #include "util/to_string.h" #include "format/format_json.h" - '''), file=self.outFile) + ''' + ), + file=self.outFile + ) self.newline() def generate_feature(self): @@ -86,16 +93,22 @@ def get_decoder_class_define(self, consumer_type): class_end = '' return (declaration, indent, function_class, class_end) - def get_consumer_function_body(self, class_name, method_info, return_type, return_value): + def get_consumer_function_body( + self, class_name, method_info, return_type, return_value + ): class_method_name = method_info['name'] code = ''' { using namespace gfxrecon::util; ''' - if(class_name == None or len(class_name) == 0): - code += self.make_consumer_func_body(method_info, return_type, return_value) + if (class_name == None or len(class_name) == 0): + code += self.make_consumer_func_body( + method_info, return_type, return_value + ) else: - code += self.make_consumer_method_body(class_name, method_info, return_type, return_value) + code += self.make_consumer_method_body( + class_name, method_info, return_type, return_value + ) code += "\n}" code = "\n" + format_cpp_code(code) @@ -104,7 +117,7 @@ def get_consumer_function_body(self, class_name, method_info, return_type, retur ## Generate a FieldToJson appropriate to the return type. ## @param func_type Either "function" or "method" for expected use. def make_return(self, func_type, return_value): - if(None == return_value): + if (None == return_value): return "" function_name = self.choose_field_to_json_name(return_value) ret_line = "{0}({1}[format::kNameReturn], return_value, options);\n" @@ -118,7 +131,7 @@ def make_return(self, func_type, return_value): def make_consumer_func_body(self, method_info, return_type, return_value): # Deal with the function's returned value: if return_type != 'HRESULT WINAPI': - print ("Warning - Unexpected return type:", return_type) + print("Warning - Unexpected return type:", return_type) ret_line = self.make_return("function", return_value) code = ''' @@ -132,16 +145,22 @@ def make_consumer_func_body(self, method_info, return_type, return_value): # Generate a correct FieldToJson for each argument: for parameter in method_info['parameters']: value = self.get_value_info(parameter) - code += " " + self.make_field_to_json("args", value, "options") + "\n" + code += " " + self.make_field_to_json( + "args", value, "options" + ) + "\n" - code += remove_leading_empty_lines(''' + code += remove_leading_empty_lines( + ''' }} writer_->WriteBlockEnd(); - ''') + ''' + ) code = code.format(method_info['name']) return code - def make_consumer_method_body(self, class_name, method_info, return_type, return_value): + def make_consumer_method_body( + self, class_name, method_info, return_type, return_value + ): code = ''' nlohmann::ordered_json& method = writer_->WriteApiCallStart(call_info, "{0}", object_id, "{1}"); const JsonOptions& options = writer_->GetOptions(); @@ -159,7 +178,9 @@ def make_consumer_method_body(self, class_name, method_info, return_type, return # Generate a correct FieldToJson for each argument: for parameter in method_info['parameters']: value = self.get_value_info(parameter) - code += " " + self.make_field_to_json("args", value, "options") + "\n" + code += " " + self.make_field_to_json( + "args", value, "options" + ) + "\n" code += "}}\n" code += "writer_->WriteBlockEnd();" @@ -174,9 +195,13 @@ def make_field_to_json(self, parent_name, value_info, options_name): ## (easier than having pointer decoder versions of each flagset type's FieldToString) if value_info.is_pointer and function_name.startswith("FieldToJson_"): src = "*" + src + "->GetPointer()" - field_to_json = '{0}({1}["{2}"], {3}, {4});'.format(function_name, parent_name, value_info.name, src, options_name) + field_to_json = '{0}({1}["{2}"], {3}, {4});'.format( + function_name, parent_name, value_info.name, src, options_name + ) if "anon-union" in value_info.base_type: field_to_json += "// [anon-union] " - print("ALERT: anon union " + value_info.name + " in " + parent_name) + print( + "ALERT: anon union " + value_info.name + " in " + parent_name + ) - return field_to_json \ No newline at end of file + return field_to_json diff --git a/framework/generated/dx12_generators/dx12_json_consumer_header_generator.py b/framework/generated/dx12_generators/dx12_json_consumer_header_generator.py index a37a090ba..283a3b906 100644 --- a/framework/generated/dx12_generators/dx12_json_consumer_header_generator.py +++ b/framework/generated/dx12_generators/dx12_json_consumer_header_generator.py @@ -59,10 +59,14 @@ def generate_feature(self): self.write_dx12_consumer_class('Json') def write_include(self): - code = ("\n" "#include \"decode/dx12_json_consumer_base.h\"\n" "\n") + code = ("\n" + "#include \"decode/dx12_json_consumer_base.h\"\n" + "\n") write(code, file=self.outFile) - def get_consumer_function_body(self, class_name, method_info, return_type, return_value): + def get_consumer_function_body( + self, class_name, method_info, return_type, return_value + ): # Marking functions as override helps to ensure the code gen for # base and derived classes never gets out of sync. return ' override;' diff --git a/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py b/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py index ce13807bb..c29146c8a 100644 --- a/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py +++ b/framework/generated/dx12_generators/dx12_replay_consumer_body_generator.py @@ -201,7 +201,7 @@ def make_consumer_func_body(self, return_type, name, values): is_resource_creation_methods = True else: is_override = name in self.REPLAY_OVERRIDES['functions'] - + code += ( " CustomReplayPreCall::Dispatch(\n" " this,\n" @@ -285,16 +285,16 @@ def make_consumer_func_body(self, return_type, name, values): if is_override: add_object_list.append( - 'AddObject({0}->GetPointer(), {0}->GetHandlePointer(), std::move(object_info_{0}), format::ApiCall_{1});\n'.format(value.name, name) + 'AddObject({0}->GetPointer(), {0}->GetHandlePointer(), std::move(object_info_{0}), format::ApiCall_{1});\n' + .format(value.name, name) ) else: add_object_list.append( - 'AddObject(out_p_{0}, out_hp_{0}, format::ApiCall_{1});\n'.format(value.name, name) + 'AddObject(out_p_{0}, out_hp_{0}, format::ApiCall_{1});\n' + .format(value.name, name) ) set_resource_dimension_layout_list.append( - 'SetResourceDesc({0}, pDesc);\n'.format( - value.name - ) + 'SetResourceDesc({0}, pDesc);\n'.format(value.name) ) else: if value.pointer_count == 2: @@ -479,7 +479,9 @@ def make_consumer_func_body(self, return_type, name, values): ) else: if is_output: - arg_list.append(value.name + '->GetOutputPointer()') + arg_list.append( + value.name + '->GetOutputPointer()' + ) else: arg_list.append(value.name + '->GetPointer()') @@ -495,8 +497,9 @@ def make_consumer_func_body(self, return_type, name, values): elif value.base_type == 'D3D12MessageFunc': arg_list.append( - 'reinterpret_cast({})'. - format(value.name) + 'reinterpret_cast({})'.format( + value.name + ) ) else: @@ -511,7 +514,9 @@ def make_consumer_func_body(self, return_type, name, values): code += 'auto replay_result = ' if is_object and not is_override: - code += 'reinterpret_cast<{}*>(replay_object->object)->'.format(class_name) + code += 'reinterpret_cast<{}*>(replay_object->object)->'.format( + class_name + ) first = True if is_override: @@ -545,7 +550,9 @@ def make_consumer_func_body(self, return_type, name, values): code += ');\n' - if is_object and not is_override and ('ID3D12GraphicsCommandList' in class_name): + if is_object and not is_override and ( + 'ID3D12GraphicsCommandList' in class_name + ): code += ( " if(options_.enable_dump_resources)\n" " {{\n" @@ -557,11 +564,12 @@ def make_consumer_func_body(self, return_type, name, values): if class_name != 'ID3D12GraphicsCommandList': code += ( " {0}* command_list{1};\n" - " command_set.list->QueryInterface(IID_PPV_ARGS(&command_list{1}));\n".format(class_name, class_name[-1]) + " command_set.list->QueryInterface(IID_PPV_ARGS(&command_list{1}));\n" + .format(class_name, class_name[-1]) ) indent_length = len(code) code += " command_list{}".format(class_name[-1]) - + else: indent_length = len(code) code += " command_set.list" @@ -575,12 +583,10 @@ def make_consumer_func_body(self, return_type, name, values): first = False code += arg - code += ( - ");\n" - " }\n" - " }\n" - ) - + code += (");\n" + " }\n" + " }\n") + for e in post_call_expr_list: code += ' {}'.format(e) @@ -618,7 +624,7 @@ def make_consumer_func_body(self, return_type, name, values): code += ('\n' + " " + value.name + ",") code = code[:-1] - code +=");\n" + code += ");\n" for e in post_extenal_object_list: code += ' {}'.format(e) diff --git a/framework/generated/dx12_generators/dx12_replay_consumer_header_generator.py b/framework/generated/dx12_generators/dx12_replay_consumer_header_generator.py index f176e5517..d7d3c8f2c 100644 --- a/framework/generated/dx12_generators/dx12_replay_consumer_header_generator.py +++ b/framework/generated/dx12_generators/dx12_replay_consumer_header_generator.py @@ -55,8 +55,12 @@ def generate_feature(self): self.write_dx12_consumer_class('Replay') def write_include(self): - code = ("\n" "#include \"decode/dx12_replay_consumer_base.h\"\n" "\n") + code = ("\n" + "#include \"decode/dx12_replay_consumer_base.h\"\n" + "\n") write(code, file=self.outFile) - def get_consumer_function_body(self, class_name, method_info, return_type, return_value): + def get_consumer_function_body( + self, class_name, method_info, return_type, return_value + ): return ' override;' diff --git a/framework/generated/dx12_generators/dx12_struct_decoders_to_json_body_generator.py b/framework/generated/dx12_generators/dx12_struct_decoders_to_json_body_generator.py index e540dc90d..d16de3b06 100644 --- a/framework/generated/dx12_generators/dx12_struct_decoders_to_json_body_generator.py +++ b/framework/generated/dx12_generators/dx12_struct_decoders_to_json_body_generator.py @@ -36,7 +36,7 @@ ## If the generated ouput for a struct is ever observed to be incorrect, the ## procedure for generating a custom function is as follows: ## 1. Add cases to makeUnionFieldToJson() if it is only union members -## that are causing the issue. +## that are causing the issue. ## If the issue is not just union members with determining type fields in the ## same struct: ## 2. Copy the generated function into the custom function section below. @@ -56,6 +56,7 @@ from dx12_json_common_generator import Dx12JsonCommonGenerator from reformat_code import format_cpp_code + class Dx12StructDecodersToJsonBodyGenerator(Dx12JsonCommonGenerator): """Generates C++ functions responsible for converting structs to JSON.""" @@ -78,13 +79,12 @@ def __init__( ## so add any field names here that you want to be output as a binary file. ## * If the JsonOptions::dump_binaries flag is set. ## The binary file will be named as follows: .-.bin - self.binary_blobs = { - ('D3D12_SHADER_BYTECODE', 'pShaderBytecode') - } + self.binary_blobs = {('D3D12_SHADER_BYTECODE', 'pShaderBytecode')} def beginFile(self, gen_opts): Dx12BaseGenerator.beginFile(self, gen_opts) - code = format_cpp_code(''' + code = format_cpp_code( + ''' #include "generated_dx12_struct_decoders_to_json.h" #include "generated_dx12_enum_to_json.h" #include "decode/custom_dx12_struct_decoders.h" @@ -130,7 +130,8 @@ def beginFile(self, gen_opts): { return RepresentBinaryFile(json_options, jdata, filename_base, instance_counter, data.GetLength(), data.GetPointer()); } - ''') + ''' + ) write(code, file=self.outFile) self.newline() @@ -138,7 +139,8 @@ def generate_feature(self): struct_dict = self.source_dict['struct_dict'] for k, v in struct_dict.items(): if not self.is_struct_black_listed(k): - body = format_cpp_code(''' + body = format_cpp_code( + ''' void FieldToJson(nlohmann::ordered_json& jdata, const Decoded_{0}* data, const JsonOptions& options) {{ using namespace util; @@ -146,13 +148,16 @@ def generate_feature(self): {{ const {0}& decoded_value = *data->decoded_value; const Decoded_{0}& meta_struct = *data; - '''.format(k)) + '''.format(k) + ) body += '\n' body += self.makeStructBody(k, v) - body += format_cpp_code(''' + body += format_cpp_code( + ''' } } - ''', 2) + ''', 2 + ) body += '\n' write(body, file=self.outFile) @@ -196,7 +201,9 @@ def makeStructBody(self, name, values): # provide a custom FieldToJson for the anon union to be injected into an # otherwise generated FieldtoJson implementation. def makeUnionFieldToJson(self, properties, struct_name, union_index): - message = "ALERT: Union member {0} of {1} needs special handling.".format(union_index, struct_name) + message = "ALERT: Union member {0} of {1} needs special handling.".format( + union_index, struct_name + ) field_to_json = ' ; ///< @todo ' + message match struct_name: @@ -813,7 +820,8 @@ def makeUnionFieldToJson(self, properties, struct_name, union_index): def endFile(self): """Method override.""" - custom_impls = format_cpp_code(''' + custom_impls = format_cpp_code( + ''' // TODO Move all these manual functions out of the generator and into a .cpp file. /// @defgroup custom_dx12_struct_decoders_to_json_bodies Custom implementations for @@ -951,7 +959,8 @@ def endFile(self): } /** @} */ - ''') + '\n' + ''' + ) + '\n' write(custom_impls, file=self.outFile) write('GFXRECON_END_NAMESPACE(decode)', file=self.outFile) write('GFXRECON_END_NAMESPACE(gfxrecon)', file=self.outFile) diff --git a/framework/generated/dx12_generators/dx12_struct_decoders_to_json_header_generator.py b/framework/generated/dx12_generators/dx12_struct_decoders_to_json_header_generator.py index 3595664d5..4cbc791a9 100644 --- a/framework/generated/dx12_generators/dx12_struct_decoders_to_json_header_generator.py +++ b/framework/generated/dx12_generators/dx12_struct_decoders_to_json_header_generator.py @@ -24,6 +24,7 @@ from dx12_base_generator import Dx12BaseGenerator, write from reformat_code import format_cpp_code, indent_cpp_code, remove_trailing_empty_lines + class Dx12StructDecodersToJsonHeaderGenerator(Dx12BaseGenerator): """Convert Struct Decoders to JSON.""" @@ -44,7 +45,8 @@ def beginFile(self, gen_opts): """Method override.""" Dx12BaseGenerator.beginFile(self, gen_opts) - code = inspect.cleandoc(''' + code = inspect.cleandoc( + ''' /// @file Functions to convert decoded structs to JSON. /// Note these Decoded_StructX versions have the pointer tree linking the /// structs set-up during decode, unlike the raw structs, which is why they @@ -62,19 +64,28 @@ def beginFile(self, gen_opts): struct JsonOptions; GFXRECON_END_NAMESPACE(util) GFXRECON_BEGIN_NAMESPACE(decode) - ''') + ''' + ) write(code, file=self.outFile) self.newline() def generate_feature(self): struct_dict = self.source_dict['struct_dict'] - ref_wrappers = remove_trailing_empty_lines(indent_cpp_code(''' + ref_wrappers = remove_trailing_empty_lines( + indent_cpp_code( + ''' // Reference versions of above which simply pipe through to the pointer versions. - ''')) + ''' + ) + ) for k, v in struct_dict.items(): if not self.is_struct_black_listed(k): - body = 'void FieldToJson(nlohmann::ordered_json& jdata, const Decoded_{0}* pObj, const util::JsonOptions& options);'.format(k) - ref_wrappers += 'inline void FieldToJson(nlohmann::ordered_json& jdata, const Decoded_{0}& obj, const util::JsonOptions& options){{ FieldToJson(jdata, &obj, options); }}\n'.format(k) + body = 'void FieldToJson(nlohmann::ordered_json& jdata, const Decoded_{0}* pObj, const util::JsonOptions& options);'.format( + k + ) + ref_wrappers += 'inline void FieldToJson(nlohmann::ordered_json& jdata, const Decoded_{0}& obj, const util::JsonOptions& options){{ FieldToJson(jdata, &obj, options); }}\n'.format( + k + ) write(body, file=self.outFile) write(ref_wrappers, file=self.outFile) @@ -96,4 +107,3 @@ def endFile(self): # Finish processing in superclass Dx12BaseGenerator.endFile(self) - diff --git a/framework/generated/dx12_generators/dx12_struct_object_mappers_body_generator.py b/framework/generated/dx12_generators/dx12_struct_object_mappers_body_generator.py index 22c5314c7..88c574fb2 100644 --- a/framework/generated/dx12_generators/dx12_struct_object_mappers_body_generator.py +++ b/framework/generated/dx12_generators/dx12_struct_object_mappers_body_generator.py @@ -147,9 +147,9 @@ def generate_feature(self): for struct in self.get_filtered_struct_names(): if ( - (struct in self.structs_with_handles) - or (struct in self.GENERIC_HANDLE_STRUCTS) - or (struct in self.structs_with_map_data) + (struct in self.structs_with_handles) or + (struct in self.GENERIC_HANDLE_STRUCTS) or + (struct in self.structs_with_map_data) ) and (struct not in self.STRUCT_MAPPERS_BLACKLIST): handle_members = list() generic_handle_members = dict() diff --git a/framework/generated/dx12_generators/dx12_struct_object_mappers_header_generator.py b/framework/generated/dx12_generators/dx12_struct_object_mappers_header_generator.py index 51fe83ad8..377e1aafa 100644 --- a/framework/generated/dx12_generators/dx12_struct_object_mappers_header_generator.py +++ b/framework/generated/dx12_generators/dx12_struct_object_mappers_header_generator.py @@ -79,9 +79,9 @@ def generate_feature(self): for struct in self.get_filtered_struct_names(): if ( - (struct in self.structs_with_handles) - or (struct in self.GENERIC_HANDLE_STRUCTS) - or (struct in self.structs_with_map_data) + (struct in self.structs_with_handles) or + (struct in self.GENERIC_HANDLE_STRUCTS) or + (struct in self.structs_with_map_data) ) and (struct not in self.STRUCT_MAPPERS_BLACKLIST): body = '\n' body += 'void MapStructObjects(Decoded_{}* wrapper, '.format( diff --git a/framework/generated/dx12_generators/dx12_wrapper_body_generator.py b/framework/generated/dx12_generators/dx12_wrapper_body_generator.py index 84d883b2a..4b3756b10 100644 --- a/framework/generated/dx12_generators/dx12_wrapper_body_generator.py +++ b/framework/generated/dx12_generators/dx12_wrapper_body_generator.py @@ -270,7 +270,11 @@ def get_object_creation_params(self, param_info): data = [] if not refiid_value: - if ((value.base_type == 'GUID') and (value.name != "rclsid") and (value.name != "CreatorID") and (value.name != "clsid")): + if ( + (value.base_type == 'GUID') and (value.name != "rclsid") + and (value.name != "CreatorID") + and (value.name != "clsid") + ): refiid_value = value elif ( self.is_class(value) @@ -393,7 +397,8 @@ def gen_method_pre_call( indent = self.increment_indent(indent) expr += indent + 'manager,\n' - if (class_name in self.PRECALL_TRIM_TRIGGERS) and (method_name in self.PRECALL_TRIM_TRIGGERS[class_name]): + if (class_name in self.PRECALL_TRIM_TRIGGERS + ) and (method_name in self.PRECALL_TRIM_TRIGGERS[class_name]): expr += indent + 'shared_api_call_lock,\n' expr += indent + 'this' @@ -463,7 +468,8 @@ def gen_method_post_call( indent = self.increment_indent(indent) expr += indent + 'manager,\n' - if (class_name in self.POSTCALL_TRIM_TRIGGERS) and (method_name in self.POSTCALL_TRIM_TRIGGERS[class_name]): + if (class_name in self.POSTCALL_TRIM_TRIGGERS + ) and (method_name in self.POSTCALL_TRIM_TRIGGERS[class_name]): expr += indent + 'shared_api_call_lock,\n' expr += indent + 'this' @@ -745,10 +751,16 @@ def write_class_member_def(self, class_info, indent=''): parameters, True, self.increment_indent(indent) ) trim_draw_calls_wrapped_args, unused = self.make_arg_list( - parameters, False, self.increment_indent(self.increment_indent(self.increment_indent(indent))) + parameters, False, + self.increment_indent( + self.increment_indent(self.increment_indent(indent)) + ) ) trim_draw_calls_unwrapped_args, need_unwrap_memory = self.make_arg_list( - parameters, True, self.increment_indent(self.increment_indent(self.increment_indent(indent))) + parameters, True, + self.increment_indent( + self.increment_indent(self.increment_indent(indent)) + ) ) # Add custom pre call action. @@ -776,9 +788,13 @@ def write_class_member_def(self, class_info, indent=''): self.CAPTURE_OVERRIDES['classmethods'][class_name] [method_name] ) - - if (class_name in self.OVERRIDECALL_TRIM_TRIGGERS) and (method_name in self.OVERRIDECALL_TRIM_TRIGGERS[class_name]): - expr += '\n'+ self.increment_indent(indent) + 'shared_api_call_lock,' + + if (class_name in self.OVERRIDECALL_TRIM_TRIGGERS) and ( + method_name in self.OVERRIDECALL_TRIM_TRIGGERS[class_name] + ): + expr += '\n' + self.increment_indent( + indent + ) + 'shared_api_call_lock,' if unwrapped_args: unwrapped_args = self.increment_indent( @@ -807,13 +823,17 @@ def write_class_member_def(self, class_info, indent=''): expr += indent + 'if(manager->GetTrimBoundary() == CaptureSettings::TrimBoundary::kDrawCalls)\n' expr += indent + '{\n' expr += indent1 + 'manager->DecrementCallScope();\n' - expr += indent1 + 'auto trim_draw_calls_command_sets = manager->GetCommandListsForTrimDrawCalls(this, format::ApiCall_{}_{});\n'.format(class_name, method_name) + expr += indent1 + 'auto trim_draw_calls_command_sets = manager->GetCommandListsForTrimDrawCalls(this, format::ApiCall_{}_{});\n'.format( + class_name, method_name + ) expr += indent1 + 'for(auto& command_set : trim_draw_calls_command_sets)\n' expr += indent1 + '{\n' if class_name != 'ID3D12GraphicsCommandList': expr += indent2 + 'auto* base_wrapper = reinterpret_cast(command_set.list.GetInterfacePtr());\n' - expr += indent2 + 'auto* wrapper = static_cast<{}_Wrapper*>(base_wrapper);\n'.format(class_name) + expr += indent2 + 'auto* wrapper = static_cast<{}_Wrapper*>(base_wrapper);\n'.format( + class_name + ) expr += indent2 + 'GFXRECON_ASSERT(wrapper != nullptr);\n' else: expr += indent2 + 'auto* wrapper = reinterpret_cast(command_set.list.GetInterfacePtr());\n' @@ -823,16 +843,18 @@ def write_class_member_def(self, class_info, indent=''): else: expr += indent2 + 'wrapper' - expr += "->{}(".format(method_name) + expr += "->{}(".format(method_name) if trim_draw_calls_wrapped_args: expr += "\n" expr += trim_draw_calls_wrapped_args expr += ");\n" - if return_type != 'void': + if return_type != 'void': expr += indent2 + 'if (result != result_trim_draw_calls)\n' expr += indent2 + '{\n' - expr += indent3 + 'GFXRECON_LOG_WARNING("Splitting commandlists of {}::{} get different results: %s and %s",\n'.format(class_name, method_name) + expr += indent3 + 'GFXRECON_LOG_WARNING("Splitting commandlists of {}::{} get different results: %s and %s",\n'.format( + class_name, method_name + ) expr += indent4 + 'decode::enumutil::GetResultValueString(result).c_str(),\n' expr += indent4 + 'decode::enumutil::GetResultValueString(result_trim_draw_calls).c_str());\n' expr += indent2 + '}\n' diff --git a/framework/generated/dx12_generators/gencode.py b/framework/generated/dx12_generators/gencode.py index 6bce8c05d..a8ecde7bb 100644 --- a/framework/generated/dx12_generators/gencode.py +++ b/framework/generated/dx12_generators/gencode.py @@ -92,7 +92,9 @@ def make_gen_opts(args): json_blocklists = os.path.join(args.configs, "json_blocklists.json") # Structs, functions etc. to exclude from codegen of the header files for conversion to JSON. # (we can codegen a lot more header content than body as the function signatures are not tricky) - json_headers_blocklists = os.path.join(args.configs, "json_headers_blocklists.json") + json_headers_blocklists = os.path.join( + args.configs, "json_headers_blocklists.json" + ) # Copyright text prefixing all headers (list of strings). prefix_strings = [ @@ -631,6 +633,7 @@ def make_gen_opts(args): ) ] + def gen_target(args, source_dict): """Generate a target based on the options in the matching gen_opts{} object. This is encapsulated in a function so it can be profiled and/or timed.