From 541ee47f00d98bac52af359636428c60367fcc33 Mon Sep 17 00:00:00 2001 From: Awata Yuichi Date: Wed, 26 Jun 2024 11:27:03 -0700 Subject: [PATCH 1/3] =?UTF-8?q?=E9=96=A2=E6=95=B0=E3=81=AE=E5=BC=95?= =?UTF-8?q?=E6=95=B0=E3=81=AB=E6=B8=A1=E3=81=95=E3=82=8C=E3=81=9F=E5=A4=89?= =?UTF-8?q?=E6=95=B0=E3=81=AE=E3=82=A2=E3=82=AF=E3=82=BB=E3=82=B9=E7=8A=B6?= =?UTF-8?q?=E6=B3=81=E3=82=92=E8=A7=A3=E6=9E=90=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spirv_reflect.c | 95 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 88 insertions(+), 7 deletions(-) diff --git a/spirv_reflect.c b/spirv_reflect.c index b4f6bc1..18dca6d 100644 --- a/spirv_reflect.c +++ b/spirv_reflect.c @@ -160,10 +160,14 @@ typedef struct SpvReflectPrvAccessedVariable { SpvReflectPrvNode* p_node; uint32_t result_id; uint32_t variable_ptr; + uint32_t function_id; + uint32_t function_parameter_index; } SpvReflectPrvAccessedVariable; typedef struct SpvReflectPrvFunction { uint32_t id; + uint32_t parameter_count; + uint32_t* parameters; uint32_t callee_count; uint32_t* callees; struct SpvReflectPrvFunction** callee_ptrs; @@ -642,6 +646,7 @@ static void DestroyParser(SpvReflectPrvParser* p_parser) { // Free functions for (size_t i = 0; i < p_parser->function_count; ++i) { + SafeFree(p_parser->functions[i].parameters); SafeFree(p_parser->functions[i].callees); SafeFree(p_parser->functions[i].callee_ptrs); SafeFree(p_parser->functions[i].accessed_variables); @@ -1095,6 +1100,7 @@ static SpvReflectResult ParseFunction(SpvReflectPrvParser* p_parser, SpvReflectP size_t first_label_index) { p_func->id = p_func_node->result_id; + p_func->parameter_count = 0; p_func->callee_count = 0; p_func->accessed_variable_count = 0; @@ -1105,7 +1111,11 @@ static SpvReflectResult ParseFunction(SpvReflectPrvParser* p_parser, SpvReflectP break; } switch (p_node->op) { + case SpvOpFunctionParameter: { + ++(p_func->parameter_count); + } break; case SpvOpFunctionCall: { + p_func->accessed_variable_count += p_node->word_count - 4; ++(p_func->callee_count); } break; case SpvOpLoad: @@ -1128,6 +1138,13 @@ static SpvReflectResult ParseFunction(SpvReflectPrvParser* p_parser, SpvReflectP } } + if (p_func->parameter_count > 0) { + p_func->parameters = (uint32_t*)calloc(p_func->parameter_count, sizeof(*(p_func->parameters))); + if (IsNull(p_func->parameters)) { + return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED; + } + } + if (p_func->callee_count > 0) { p_func->callees = (uint32_t*)calloc(p_func->callee_count, sizeof(*(p_func->callees))); if (IsNull(p_func->callees)) { @@ -1143,6 +1160,7 @@ static SpvReflectResult ParseFunction(SpvReflectPrvParser* p_parser, SpvReflectP } } + p_func->parameter_count = 0; p_func->callee_count = 0; p_func->accessed_variable_count = 0; // Now have allocation, fill in values @@ -1152,8 +1170,25 @@ static SpvReflectResult ParseFunction(SpvReflectPrvParser* p_parser, SpvReflectP break; } switch (p_node->op) { + case SpvOpFunctionParameter: { + CHECKED_READU32(p_parser, p_node->word_offset + 2, p_func->parameters[p_func->parameter_count]); + (++p_func->parameter_count); + } break; case SpvOpFunctionCall: { CHECKED_READU32(p_parser, p_node->word_offset + 3, p_func->callees[p_func->callee_count]); + const uint32_t result_index = p_node->word_offset + 2; + for (uint32_t j = 0, parameter_count = p_node->word_count - 4; j < parameter_count; j++) { + const uint32_t ptr_index = p_node->word_offset + 4 + j; + SpvReflectPrvAccessedVariable* access_ptr = &p_func->accessed_variables[p_func->accessed_variable_count]; + + access_ptr->p_node = p_node; + // Need to track Result ID as not sure there has been any memory access through here yet + CHECKED_READU32(p_parser, result_index, access_ptr->result_id); + CHECKED_READU32(p_parser, ptr_index, access_ptr->variable_ptr); + access_ptr->function_id = p_func->callees[p_func->callee_count]; + access_ptr->function_parameter_index = j; + (++p_func->accessed_variable_count); + } (++p_func->callee_count); } break; case SpvOpLoad: @@ -1238,14 +1273,12 @@ static SpvReflectResult ParseFunctions(SpvReflectPrvParser* p_parser) { // Skip over function declarations that aren't definitions bool func_definition = false; - // Intentionally reuse i to avoid iterating over these nodes more than - // once - for (; i < p_parser->node_count; ++i) { - if (p_parser->nodes[i].op == SpvOpLabel) { + for (size_t j = i; j < p_parser->node_count; ++j) { + if (p_parser->nodes[j].op == SpvOpLabel) { func_definition = true; break; } - if (p_parser->nodes[i].op == SpvOpFunctionEnd) { + if (p_parser->nodes[j].op == SpvOpFunctionEnd) { break; } } @@ -3439,6 +3472,44 @@ static SpvReflectResult ParseByteAddressBuffer(SpvReflectPrvParser* p_parser, Sp return SPV_REFLECT_RESULT_SUCCESS; } +static SpvReflectResult ParseFunctionParameterAccess(SpvReflectPrvParser* p_parser, uint32_t callee_function_id, + uint32_t function_parameter_index, uint32_t* p_accessed) { + SpvReflectPrvFunction* p_func = NULL; + for (size_t i = 0; i < p_parser->function_count; ++i) { + if (p_parser->functions[i].id == callee_function_id) { + p_func = &(p_parser->functions[i]); + break; + } + } + if (p_func == NULL) { + return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE; + } + + assert(function_parameter_index < p_func->parameter_count); + + for (size_t i = 0; i < p_func->accessed_variable_count; ++i) { + if (p_func->parameters[function_parameter_index] == p_func->accessed_variables[i].variable_ptr) { + SpvReflectPrvAccessedVariable* p_var = &p_func->accessed_variables[i]; + if (p_var->function_id > 0) { + SpvReflectResult result = + ParseFunctionParameterAccess(p_parser, p_var->function_id, p_var->function_parameter_index, p_accessed); + if (result != SPV_REFLECT_RESULT_SUCCESS) { + return result; + } + } else { + *p_accessed = 1; + } + // Early out as soon as p_accessed is true + if (*p_accessed) { + return SPV_REFLECT_RESULT_SUCCESS; + } + } + } + + *p_accessed = 0; + return SPV_REFLECT_RESULT_SUCCESS; +} + static SpvReflectResult ParseStaticallyUsedResources(SpvReflectPrvParser* p_parser, SpvReflectShaderModule* p_module, SpvReflectEntryPoint* p_entry, size_t uniform_count, uint32_t* uniforms, size_t push_constant_count, uint32_t* push_constants) { @@ -3535,8 +3606,18 @@ static SpvReflectResult ParseStaticallyUsedResources(SpvReflectPrvParser* p_pars uint32_t byte_address_buffer_offset_count = 0; for (uint32_t j = 0; j < used_acessed_count; j++) { - if (p_used_accesses[j].variable_ptr == p_binding->spirv_id) { - p_binding->accessed = 1; + SpvReflectPrvAccessedVariable* p_var = &p_used_accesses[j]; + if (p_var->variable_ptr == p_binding->spirv_id) { + if (p_var->function_id > 0) { + result = + ParseFunctionParameterAccess(p_parser, p_var->function_id, p_var->function_parameter_index, &p_binding->accessed); + if (result != SPV_REFLECT_RESULT_SUCCESS) { + SafeFree(p_used_accesses); + return result; + } + } else { + p_binding->accessed = 1; + } if (HasByteAddressBufferOffset(p_used_accesses[j].p_node, p_binding)) { byte_address_buffer_offset_count++; From 5fac3086568742b676bc7eb5c37cc21c71f52f0b Mon Sep 17 00:00:00 2001 From: Daniel Story Date: Wed, 26 Jun 2024 11:27:03 -0700 Subject: [PATCH 2/3] Update golden YAML --- tests/user_type/byte_address_buffer_0.spv.yaml | 2 +- tests/user_type/byte_address_buffer_1.spv.yaml | 2 +- tests/user_type/rw_byte_address_buffer.spv.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/user_type/byte_address_buffer_0.spv.yaml b/tests/user_type/byte_address_buffer_0.spv.yaml index cffe883..a1eece7 100644 --- a/tests/user_type/byte_address_buffer_0.spv.yaml +++ b/tests/user_type/byte_address_buffer_0.spv.yaml @@ -101,7 +101,7 @@ all_descriptor_bindings: accessed: 1 uav_counter_id: 4294967295 uav_counter_binding: - ByteAddressBuffer offsets: [4, 5, 11, 13] + ByteAddressBuffer offsets: [13, 5, 11, 4] type_description: *td1 word_offset: { binding: 129, set: 125 } user_type: ByteAddressBuffer diff --git a/tests/user_type/byte_address_buffer_1.spv.yaml b/tests/user_type/byte_address_buffer_1.spv.yaml index df8306a..f48ad68 100644 --- a/tests/user_type/byte_address_buffer_1.spv.yaml +++ b/tests/user_type/byte_address_buffer_1.spv.yaml @@ -268,7 +268,7 @@ all_descriptor_bindings: accessed: 1 uav_counter_id: 4294967295 uav_counter_binding: - ByteAddressBuffer offsets: [1, 2] + ByteAddressBuffer offsets: [2, 1] type_description: *td5 word_offset: { binding: 112, set: 108 } user_type: ByteAddressBuffer diff --git a/tests/user_type/rw_byte_address_buffer.spv.yaml b/tests/user_type/rw_byte_address_buffer.spv.yaml index 319296d..9ff7aaa 100644 --- a/tests/user_type/rw_byte_address_buffer.spv.yaml +++ b/tests/user_type/rw_byte_address_buffer.spv.yaml @@ -101,7 +101,7 @@ all_descriptor_bindings: accessed: 1 uav_counter_id: 4294967295 uav_counter_binding: - ByteAddressBuffer offsets: [4, 5, 11, 13] + ByteAddressBuffer offsets: [13, 5, 11, 4] type_description: *td1 word_offset: { binding: 130, set: 126 } user_type: RWByteAddressBuffer From 16ac48967c8c6be55aeb06db8fa3143b465a9fec Mon Sep 17 00:00:00 2001 From: Daniel Story Date: Wed, 26 Jun 2024 11:27:04 -0700 Subject: [PATCH 3/3] Add function parameter access test --- .../issues/102/function_parameter_access.glsl | 51 +++ .../issues/102/function_parameter_access.spv | Bin 0 -> 2288 bytes .../102/function_parameter_access.spv.yaml | 321 ++++++++++++++++++ tests/test-spirv-reflect.cpp | 1 + 4 files changed, 373 insertions(+) create mode 100644 tests/issues/102/function_parameter_access.glsl create mode 100644 tests/issues/102/function_parameter_access.spv create mode 100644 tests/issues/102/function_parameter_access.spv.yaml diff --git a/tests/issues/102/function_parameter_access.glsl b/tests/issues/102/function_parameter_access.glsl new file mode 100644 index 0000000..8daa2fd --- /dev/null +++ b/tests/issues/102/function_parameter_access.glsl @@ -0,0 +1,51 @@ +/* +glslangValidator -V -S frag -g0 --ku -o function_parameter_access.spv function_parameter_access.glsl +*/ + +#version 450 + +layout(binding = 0) uniform sampler Sampler; +layout(binding = 1) uniform texture2D Texture; +layout(binding = 2) uniform sampler2D Sampler2D; + +layout(binding = 3) uniform sampler NeverAccessedSampler; +layout(binding = 4) uniform texture2D NeverAccessedTexture; +layout(binding = 5) uniform sampler2D NeverAccessedSampler2D; + +layout(location = 0) out vec4 color; + +vec4 access_sampler_and_texture(texture2D t, sampler s, vec2 coord) +{ + vec4 ret = texture(sampler2D(t, s), coord); + return vec4(5.0) * ret; +} + +vec4 access_combined_sampler(sampler2D s) +{ + vec2 coord = vec2(0.5, 0.5); + vec4 ret = texture(s, coord); + return vec4(1.0, 2.0, 3.0, 1.0) * ret; +} + +vec4 call_access_functions(texture2D t, sampler s) +{ + return access_combined_sampler(Sampler2D) + access_sampler_and_texture(t, s, vec2(0.25, 0.75)); +} + +vec4 never_called(texture2D t, sampler s, float u, float v) +{ + vec4 ret = texture(sampler2D(t, s), vec2(u, v)); + return vec4(-3.0) * ret; +} + +vec4 never_called_2(vec2 coord) +{ + vec4 ret = texture(sampler2D(NeverAccessedTexture, NeverAccessedSampler), coord); + ret *= texture(NeverAccessedSampler2D, coord); + return ret; +} + +void main() +{ + color = vec4(-1.0) * call_access_functions(Texture, Sampler); +} diff --git a/tests/issues/102/function_parameter_access.spv b/tests/issues/102/function_parameter_access.spv new file mode 100644 index 0000000000000000000000000000000000000000..7638142a8239ca88dd19b41f31818044406626af GIT binary patch literal 2288 zcmZ9M*HTnL5QYa(1TiB9FzlKYL<}e^0&A#R16oEfRf&jV!cxI-i5I?yZ=#Rojh5ec zoW@g5)nDCzcTcA?yDiPTSESUGI#OHuoc^BmsToVc)>_EM_^t8&`GuMO6N3XrtVu0J zpfPKSS%wsIk6*me@eZsbMjOdf1FeDF1w6s4=*^i=AeVE?dK?8W=?xlh)jt0M6 z@cL3eSK!8IkC=OZV}8VZ_u<;gu%0`f0v@^FY`S3o`kBq#UA{&4-MKU4<-TuiQTsi5 zN{ip4_B>2m8ByD}?}^&Jb#`{vRXGn_})7BgHx_xGUP z8RX>|{Kg*t7vekhWZmzy4LFbgu`$m$y7ScXUN54%iw3YK{r+xhM7h_i!1rKY^XdPR z?_NXqzA^SEFZZ_>?x}$2ubOrH+m&_ypLUn@J?Qqm4;g#Efo|XKN_i8QOYWPx1NdJD+KutQ?GCU`@CkHlU1uKO+$1nYdwjFI=;qSre(Xb=Io!_!pe?@HLv;UBw7U~| zc_#e~qrq*r=f`;^)wfcQ@+p<_~!ndfos4 literal 0 HcmV?d00001 diff --git a/tests/issues/102/function_parameter_access.spv.yaml b/tests/issues/102/function_parameter_access.spv.yaml new file mode 100644 index 0000000..93143d1 --- /dev/null +++ b/tests/issues/102/function_parameter_access.spv.yaml @@ -0,0 +1,321 @@ +%YAML 1.0 +--- +all_type_descriptions: + - &td0 + id: 9 + op: 26 + type_name: + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x00020000 # EXTERNAL_SAMPLER + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 0, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + - &td1 + id: 7 + op: 25 + type_name: + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x00010008 # EXTERNAL_IMAGE FLOAT + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 1, image_format: 0 } # dim=2D image_format=Unknown + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + - &td2 + id: 20 + op: 27 + type_name: + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x00050008 # EXTERNAL_SAMPLED_IMAGE EXTERNAL_IMAGE FLOAT + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 1, image_format: 0 } # dim=2D image_format=Unknown + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + - &td3 + id: 13 + op: 23 + type_name: + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x00000108 # VECTOR FLOAT + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 4 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: +all_block_variables: + - &bv0 + name: + offset: 0 + absolute_offset: 0 + size: 0 + padded_size: 0 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 0, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: + - &bv1 + name: + offset: 0 + absolute_offset: 0 + size: 0 + padded_size: 0 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 0, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: + - &bv2 + name: + offset: 0 + absolute_offset: 0 + size: 0 + padded_size: 0 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 0, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: + - &bv3 + name: + offset: 0 + absolute_offset: 0 + size: 0 + padded_size: 0 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 0, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: + - &bv4 + name: + offset: 0 + absolute_offset: 0 + size: 0 + padded_size: 0 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 0, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: + - &bv5 + name: + offset: 0 + absolute_offset: 0 + size: 0 + padded_size: 0 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 0, signedness: 0 } + vector: { component_count: 0 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: +all_descriptor_bindings: + - &db0 + spirv_id: 117 + name: + binding: 0 + input_attachment_index: 0 + set: 0 + decoration_flags: 0x00000000 # NONE + descriptor_type: 0 # VK_DESCRIPTOR_TYPE_SAMPLER + resource_type: 1 # SAMPLER + image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown + block: *bv0 # + array: { dims_count: 0, dims: [] } + accessed: 1 + uav_counter_id: 4294967295 + uav_counter_binding: + type_description: *td0 + word_offset: { binding: 76, set: 72 } + - &db1 + spirv_id: 116 + name: + binding: 1 + input_attachment_index: 0 + set: 0 + decoration_flags: 0x00000000 # NONE + descriptor_type: 2 # VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE + resource_type: 4 # SRV + image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 1, image_format: 0 } # dim=2D image_format=Unknown + block: *bv1 # + array: { dims_count: 0, dims: [] } + accessed: 1 + uav_counter_id: 4294967295 + uav_counter_binding: + type_description: *td1 + word_offset: { binding: 68, set: 64 } + - &db2 + spirv_id: 71 + name: + binding: 2 + input_attachment_index: 0 + set: 0 + decoration_flags: 0x00000000 # NONE + descriptor_type: 1 # VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER + resource_type: 5 # ??? + image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 1, image_format: 0 } # dim=2D image_format=Unknown + block: *bv2 # + array: { dims_count: 0, dims: [] } + accessed: 1 + uav_counter_id: 4294967295 + uav_counter_binding: + type_description: *td2 + word_offset: { binding: 32, set: 28 } + - &db3 + spirv_id: 98 + name: + binding: 3 + input_attachment_index: 0 + set: 0 + decoration_flags: 0x00000000 # NONE + descriptor_type: 0 # VK_DESCRIPTOR_TYPE_SAMPLER + resource_type: 1 # SAMPLER + image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown + block: *bv3 # + array: { dims_count: 0, dims: [] } + accessed: 0 + uav_counter_id: 4294967295 + uav_counter_binding: + type_description: *td0 + word_offset: { binding: 48, set: 44 } + - &db4 + spirv_id: 96 + name: + binding: 4 + input_attachment_index: 0 + set: 0 + decoration_flags: 0x00000000 # NONE + descriptor_type: 2 # VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE + resource_type: 4 # SRV + image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 1, image_format: 0 } # dim=2D image_format=Unknown + block: *bv4 # + array: { dims_count: 0, dims: [] } + accessed: 0 + uav_counter_id: 4294967295 + uav_counter_binding: + type_description: *td1 + word_offset: { binding: 40, set: 36 } + - &db5 + spirv_id: 103 + name: + binding: 5 + input_attachment_index: 0 + set: 0 + decoration_flags: 0x00000000 # NONE + descriptor_type: 1 # VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER + resource_type: 5 # ??? + image: { dim: 1, depth: 0, arrayed: 0, ms: 0, sampled: 1, image_format: 0 } # dim=2D image_format=Unknown + block: *bv5 # + array: { dims_count: 0, dims: [] } + accessed: 0 + uav_counter_id: 4294967295 + uav_counter_binding: + type_description: *td2 + word_offset: { binding: 56, set: 52 } +all_interface_variables: + - &iv0 + spirv_id: 113 + name: + location: 0 + storage_class: 3 # Output + semantic: + decoration_flags: 0x00000000 # NONE + built_in: -1 # ??? (-1) + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 4 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + format: 109 # VK_FORMAT_R32G32B32A32_SFLOAT + type_description: *td3 + word_offset: { location: 60 } +module: + generator: 8 # Khronos Glslang Reference Front End + entry_point_name: "main" + entry_point_id: 4 + source_language: 0 # Unknown + source_language_version: 0 + spirv_execution_model: 4 # Fragment + shader_stage: 0x00000010 # PS + descriptor_binding_count: 6 + descriptor_bindings: + - *db0 # + - *db1 # + - *db2 # + - *db3 # + - *db4 # + - *db5 # + descriptor_set_count: 1 + descriptor_sets: + - set: 0 + binding_count: 6 + bindings: + - *db0 # + - *db1 # + - *db2 # + - *db3 # + - *db4 # + - *db5 # + input_variable_count: 0, + input_variables: + output_variable_count: 1, + output_variables: + - *iv0 # + push_constant_count: 0, + push_constants: + specialization_constant_count: 0, + specialization_constants: +... diff --git a/tests/test-spirv-reflect.cpp b/tests/test-spirv-reflect.cpp index 1cc3b6a..1c062b9 100644 --- a/tests/test-spirv-reflect.cpp +++ b/tests/test-spirv-reflect.cpp @@ -821,6 +821,7 @@ const std::vector all_spirv_paths = { "../tests/issues/77/hlsl/array_from_ubo.spv", "../tests/issues/77/hlsl/array_from_ubo_with_O0.spv", "../tests/issues/77/hlsl/rocketz.spv", + "../tests/issues/102/function_parameter_access.spv", "../tests/issues/178/vertex_input_struct.spv", "../tests/issues/178/vertex_input_struct2.spv", "../tests/multi_entrypoint/multi_entrypoint.spv",