diff --git a/.gitignore b/.gitignore index e7f2106b..18a45db4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /build* -/bin/* \ No newline at end of file +/bin/* +/.vs +/.vscode diff --git a/spirv_reflect.c b/spirv_reflect.c index aad827cc..ddead177 100644 --- a/spirv_reflect.c +++ b/spirv_reflect.c @@ -2055,9 +2055,19 @@ static SpvReflectResult ParseDescriptorBlockVariable( return SPV_REFLECT_RESULT_SUCCESS; } +static int SortCompareMembersOffset(const void* a, const void* b) +{ + const SpvReflectBlockVariable* p_elem_a = (const SpvReflectBlockVariable*)a; + const SpvReflectBlockVariable* p_elem_b = (const SpvReflectBlockVariable*)b; + int value = (int)(p_elem_a->offset) - (int)(p_elem_b->offset); + assert(value != 0); + return value; +} + static SpvReflectResult ParseDescriptorBlockVariableSizes( Parser* p_parser, SpvReflectShaderModule* p_module, + uint32_t alignment, bool is_parent_root, bool is_parent_aos, bool is_parent_rta, @@ -2117,7 +2127,7 @@ static SpvReflectResult ParseDescriptorBlockVariableSizes( // If array of structs, parse members first... bool is_struct = (p_member_type->type_flags & SPV_REFLECT_TYPE_FLAG_STRUCT) == SPV_REFLECT_TYPE_FLAG_STRUCT; if (is_struct) { - SpvReflectResult result = ParseDescriptorBlockVariableSizes(p_parser, p_module, false, true, is_parent_rta, p_member_var); + SpvReflectResult result = ParseDescriptorBlockVariableSizes(p_parser, p_module, alignment, false, true, is_parent_rta, p_member_var); if (result != SPV_REFLECT_RESULT_SUCCESS) { return result; } @@ -2134,7 +2144,7 @@ static SpvReflectResult ParseDescriptorBlockVariableSizes( case SpvOpTypeRuntimeArray: { bool is_struct = (p_member_type->type_flags & SPV_REFLECT_TYPE_FLAG_STRUCT) == SPV_REFLECT_TYPE_FLAG_STRUCT; if (is_struct) { - SpvReflectResult result = ParseDescriptorBlockVariableSizes(p_parser, p_module, false, true, true, p_member_var); + SpvReflectResult result = ParseDescriptorBlockVariableSizes(p_parser, p_module, alignment, false, true, true, p_member_var); if (result != SPV_REFLECT_RESULT_SUCCESS) { return result; } @@ -2143,7 +2153,7 @@ static SpvReflectResult ParseDescriptorBlockVariableSizes( break; case SpvOpTypeStruct: { - SpvReflectResult result = ParseDescriptorBlockVariableSizes(p_parser, p_module, false, is_parent_aos, is_parent_rta, p_member_var); + SpvReflectResult result = ParseDescriptorBlockVariableSizes(p_parser, p_module, alignment, false, is_parent_aos, is_parent_rta, p_member_var); if (result != SPV_REFLECT_RESULT_SUCCESS) { return result; } @@ -2155,6 +2165,8 @@ static SpvReflectResult ParseDescriptorBlockVariableSizes( } } + qsort(p_var->members, p_var->member_count, sizeof(p_var->members[0]), SortCompareMembersOffset); + // Parse padded size using offset difference for all member except for the last entry... for (uint32_t member_index = 0; member_index < (p_var->member_count - 1); ++member_index) { SpvReflectBlockVariable* p_member_var = &p_var->members[member_index]; @@ -2167,11 +2179,10 @@ static SpvReflectResult ParseDescriptorBlockVariableSizes( p_member_var->padded_size = p_member_var->size; } } - // ...last entry just gets rounded up to near multiple of SPIRV_DATA_ALIGNMENT, which is 16 and - // subtract the offset. + // ...last entry just gets rounded up to near multiple of alignment and subtract the offset. if (p_var->member_count > 0) { SpvReflectBlockVariable* p_member_var = &p_var->members[p_var->member_count - 1]; - p_member_var->padded_size = RoundUp(p_member_var->offset + p_member_var->size, SPIRV_DATA_ALIGNMENT) - p_member_var->offset; + p_member_var->padded_size = RoundUp(p_member_var->offset + p_member_var->size, alignment) - p_member_var->offset; if (p_member_var->size > p_member_var->padded_size) { p_member_var->size = p_member_var->padded_size; } @@ -2322,7 +2333,7 @@ static SpvReflectResult ParseDescriptorBlocks(Parser* p_parser, SpvReflectShader p_descriptor->block.name = p_descriptor->name; bool is_parent_rta = (p_descriptor->descriptor_type == SPV_REFLECT_DESCRIPTOR_TYPE_STORAGE_BUFFER); - result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, is_parent_rta, &p_descriptor->block); + result = ParseDescriptorBlockVariableSizes(p_parser, p_module, SPIRV_DATA_ALIGNMENT, true, false, is_parent_rta, &p_descriptor->block); if (result != SPV_REFLECT_RESULT_SUCCESS) { return result; } @@ -3021,11 +3032,15 @@ static SpvReflectResult ParsePushConstantBlocks(Parser* p_parser, SpvReflectShad if (result != SPV_REFLECT_RESULT_SUCCESS) { return result; } - result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, false, p_push_constant); + result = ParseDescriptorBlockVariableSizes(p_parser, p_module, SPIRV_WORD_SIZE, true, false, false, p_push_constant); if (result != SPV_REFLECT_RESULT_SUCCESS) { return result; } + p_push_constant->offset = p_push_constant->members[0].offset; + p_push_constant->size -= p_push_constant->offset; + p_push_constant->padded_size -= p_push_constant->offset; + ++push_constant_index; } diff --git a/tests/build_all_shaders.py b/tests/build_all_shaders.py index d30c0cca..e8be421a 100644 --- a/tests/build_all_shaders.py +++ b/tests/build_all_shaders.py @@ -24,6 +24,7 @@ def my_which(cmd): {'source':"glsl/built_in_format.glsl", 'entry':"main", 'stage':'vert'}, {'source':"glsl/input_attachment.glsl", 'entry':"main", 'stage':'frag'}, {'source':"glsl/texel_buffer.glsl", 'entry':"main", 'stage':'vert'}, + {'source':"glsl/struct_offset.glsl", 'entry':"main", 'stage':'vert'}, {'source':"hlsl/append_consume.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'}, {'source':"hlsl/binding_array.hlsl", 'entry':"main", 'profile':'ps_6_0', 'stage':'frag'}, diff --git a/tests/glsl/struct_offset.glsl b/tests/glsl/struct_offset.glsl new file mode 100644 index 00000000..b08674b6 --- /dev/null +++ b/tests/glsl/struct_offset.glsl @@ -0,0 +1,24 @@ +#version 450 + +layout(location=0) in vec2 aPos; +layout(location=1) in vec2 aUV; + +struct S +{ + vec3 a; + vec2 b; +}; + +layout(push_constant) uniform uPushConstant { layout(offset = 8) vec2 uScale; float d2; layout(offset = 4) float d1;} vpc1; + +layout(set=0, binding=0, std140) uniform uBuffer { layout(offset = 4) float d0; layout(offset = 16) vec2 uTranslate; layout(offset = 8) float d1;} vpc2; + +out gl_PerVertex { vec4 gl_Position; }; +layout(location = 0) out struct { vec2 Pos; vec2 UV; } Out; + +void main(void) +{ + Out.UV = aUV; + Out.Pos = aPos; + gl_Position = vec4(aPos * vpc1.uScale + vpc2.uTranslate, 0, 1); +} diff --git a/tests/glsl/struct_offset.spv b/tests/glsl/struct_offset.spv new file mode 100644 index 00000000..93ce6b7a Binary files /dev/null and b/tests/glsl/struct_offset.spv differ diff --git a/tests/glsl/struct_offset.spv.yaml b/tests/glsl/struct_offset.spv.yaml new file mode 100644 index 00000000..2f43fe6e --- /dev/null +++ b/tests/glsl/struct_offset.spv.yaml @@ -0,0 +1,553 @@ +%YAML 1.0 +--- +all_type_descriptions: + - &td0 + id: 7 + op: 22 + type_name: + struct_member_name: "d0" + storage_class: 0 # UniformConstant + type_flags: 0x00000008 # 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: 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: 8 + op: 23 + type_name: + struct_member_name: "uTranslate" + storage_class: 0 # UniformConstant + type_flags: 0x00000108 # VECTOR FLOAT + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + 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: + - &td2 + id: 7 + op: 22 + type_name: + struct_member_name: "d1" + storage_class: 0 # UniformConstant + type_flags: 0x00000008 # 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: 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: + - &td3 + id: 35 + op: 30 + type_name: "uBuffer" + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK + decoration_flags: 0x00000001 # BLOCK + 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: 3 + members: + - *td0 + - *td1 + - *td2 + - &td4 + id: 8 + op: 23 + type_name: + struct_member_name: "uScale" + storage_class: 0 # UniformConstant + type_flags: 0x00000108 # VECTOR FLOAT + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + 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: + - &td5 + id: 7 + op: 22 + type_name: + struct_member_name: "d2" + storage_class: 0 # UniformConstant + type_flags: 0x00000008 # 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: 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: + - &td6 + id: 7 + op: 22 + type_name: + struct_member_name: "d1" + storage_class: 0 # UniformConstant + type_flags: 0x00000008 # 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: 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: + - &td7 + id: 28 + op: 30 + type_name: "uPushConstant" + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK + decoration_flags: 0x00000001 # BLOCK + 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: 3 + members: + - *td4 + - *td5 + - *td6 + - &td8 + id: 8 + 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: 2 } + 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: + - &td9 + id: 8 + op: 23 + type_name: + struct_member_name: "Pos" + storage_class: 0 # UniformConstant + type_flags: 0x00000108 # VECTOR FLOAT + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + 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: + - &td10 + id: 8 + op: 23 + type_name: + struct_member_name: "UV" + storage_class: 0 # UniformConstant + type_flags: 0x00000108 # VECTOR FLOAT + decoration_flags: 0x00000000 # NONE + traits: + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + 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: + - &td11 + id: 9 + op: 30 + type_name: "" + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK + 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: 2 + members: + - *td9 + - *td10 + - &td12 + id: 23 + op: 23 + type_name: + struct_member_name: "gl_Position" + storage_class: 0 # UniformConstant + 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: + - &td13 + id: 24 + op: 30 + type_name: "gl_PerVertex" + struct_member_name: + storage_class: -1 # NOT APPLICABLE + type_flags: 0x10080000 # STRUCT EXTERNAL_BLOCK + decoration_flags: 0x00000001 # BLOCK + 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: 1 + members: + - *td12 +all_block_variables: + - &bv0 + name: "d0" + offset: 4 + absolute_offset: 4 + size: 4 + padded_size: 4 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 32, 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: *td0 + - &bv1 + name: "d1" + offset: 8 + absolute_offset: 8 + size: 4 + padded_size: 8 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 32, 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: *td2 + - &bv2 + name: "uTranslate" + offset: 16 + absolute_offset: 16 + size: 8 + padded_size: 16 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: *td1 + - &bv3 + name: "vpc2" + offset: 0 + absolute_offset: 0 + size: 32 + padded_size: 32 + 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: 3 + members: + - *bv0 + - *bv1 + - *bv2 + type_description: *td3 + - &bv4 + name: "d1" + offset: 4 + absolute_offset: 4 + size: 4 + padded_size: 4 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 32, 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: *td6 + - &bv5 + name: "uScale" + offset: 8 + absolute_offset: 8 + size: 8 + padded_size: 8 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + type_description: *td4 + - &bv6 + name: "d2" + offset: 16 + absolute_offset: 16 + size: 4 + padded_size: 4 + decorations: 0x00000000 # NONE + numeric: + scalar: { width: 32, 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: *td5 + - &bv7 + name: "uPushConstant" + offset: 4 + absolute_offset: 0 + size: 16 + padded_size: 16 + 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: 3 + members: + - *bv4 + - *bv5 + - *bv6 + type_description: *td7 +all_descriptor_bindings: + - &db0 + spirv_id: 37 + name: "vpc2" + binding: 0 + input_attachment_index: 0 + set: 0 + descriptor_type: 6 # VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER + resource_type: 2 # CBV + image: { dim: 0, depth: 0, arrayed: 0, ms: 0, sampled: 0, image_format: 0 } # dim=1D image_format=Unknown + block: *bv3 # "vpc2" + array: { dims_count: 0, dims: [] } + accessed: 1 + uav_counter_id: 4294967295 + uav_counter_binding: + type_description: *td3 + word_offset: { binding: 401, set: 397 } +all_interface_variables: + - &iv0 + spirv_id: 15 + name: "aUV" + location: 1 + storage_class: 1 # Input + semantic: + decoration_flags: 0x00000000 # NONE + built_in: -1 # ??? + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + format: 103 # VK_FORMAT_R32G32_SFLOAT + type_description: *td8 + word_offset: { location: 345 } + - &iv1 + spirv_id: 20 + name: "aPos" + location: 0 + storage_class: 1 # Input + semantic: + decoration_flags: 0x00000000 # NONE + built_in: -1 # ??? + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + format: 103 # VK_FORMAT_R32G32_SFLOAT + type_description: *td8 + word_offset: { location: 349 } + - &iv2 + spirv_id: 0 + name: + location: 0 + storage_class: 0 # UniformConstant + semantic: + decoration_flags: 0x00000000 # NONE + built_in: 0 # Position + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + format: 103 # VK_FORMAT_R32G32_SFLOAT + type_description: *td9 + word_offset: { location: 0 } + - &iv3 + spirv_id: 0 + name: + location: 0 + storage_class: 0 # UniformConstant + semantic: + decoration_flags: 0x00000000 # NONE + built_in: 0 # Position + numeric: + scalar: { width: 32, signedness: 0 } + vector: { component_count: 2 } + matrix: { column_count: 0, row_count: 0, stride: 0 } + array: { dims_count: 0, dims: [], stride: 0 } + member_count: 0 + members: + format: 103 # VK_FORMAT_R32G32_SFLOAT + type_description: *td10 + word_offset: { location: 0 } + - &iv4 + spirv_id: 11 + name: "Out" + location: 0 + storage_class: 3 # Output + semantic: + decoration_flags: 0x00000000 # NONE + built_in: -1 # ??? + 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: 2 + members: + - *iv2 # + - *iv3 # + format: 0 # VK_FORMAT_UNDEFINED + type_description: *td11 + word_offset: { location: 341 } + - &iv5 + spirv_id: 0 + name: + location: 0 + storage_class: 0 # UniformConstant + semantic: + decoration_flags: 0x00000010 # BUILT_IN + built_in: 0 # Position + 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: *td12 + word_offset: { location: 0 } + - &iv6 + spirv_id: 26 + name: "" + location: 4294967295 + storage_class: 3 # Output + semantic: + decoration_flags: 0x00000011 # BUILT_IN BLOCK + built_in: -1 # ??? + 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: 1 + members: + - *iv5 # + format: 0 # VK_FORMAT_UNDEFINED + type_description: *td13 + word_offset: { location: 0 } +module: + generator: 13 # Google Shaderc over Glslang + entry_point_name: "main" + entry_point_id: 5 + source_language: 2 # GLSL + source_language_version: 450 + spirv_execution_model: 0 # Vertex + shader_stage: 0x00000001 # VS + descriptor_binding_count: 1 + descriptor_bindings: + - *db0 # "vpc2" + descriptor_set_count: 1 + descriptor_sets: + - set: 0 + binding_count: 1 + bindings: + - *db0 # "vpc2" + input_variable_count: 2, + input_variables: + - *iv0 # "aUV" + - *iv1 # "aPos" + output_variable_count: 2, + output_variables: + - *iv4 # "Out" + - *iv6 # "" + push_constant_count: 1, + push_constants: + - *bv7 # "uPushConstant" +... diff --git a/tests/test-spirv-reflect.cpp b/tests/test-spirv-reflect.cpp index da6b5b84..1b537fb7 100644 --- a/tests/test-spirv-reflect.cpp +++ b/tests/test-spirv-reflect.cpp @@ -761,6 +761,7 @@ const std::vector all_spirv_paths = { "../tests/glsl/built_in_format.spv", "../tests/glsl/input_attachment.spv", "../tests/glsl/texel_buffer.spv", + "../tests/glsl/struct_offset.spv", "../tests/hlsl/append_consume.spv", "../tests/hlsl/binding_array.spv", "../tests/hlsl/binding_types.spv",