Skip to content

Commit

Permalink
Fix PushConstant padding to 16 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Dec 5, 2024
1 parent 4c6d3f3 commit 600e61f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion spirv_reflect.c
Original file line number Diff line number Diff line change
Expand Up @@ -4016,7 +4016,7 @@ static SpvReflectResult ParsePushConstantBlocks(SpvReflectPrvParser* p_parser, S
}

p_push_constant->name = p_node->name;
result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, false, p_push_constant);
result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, true, p_push_constant);
if (result != SPV_REFLECT_RESULT_SUCCESS) {
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/glsl/buffer_handle_5.spv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ all_block_variables:
offset: 0
absolute_offset: 0
size: 8
padded_size: 16
padded_size: 8
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down
8 changes: 4 additions & 4 deletions tests/glsl/buffer_handle_7.spv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ all_block_variables:
offset: 0
absolute_offset: 0
size: 8
padded_size: 16
padded_size: 8
decorations: 0x00000080 # NON_WRITABLE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down Expand Up @@ -285,7 +285,7 @@ all_block_variables:
offset: 0
absolute_offset: 0
size: 8
padded_size: 16
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand All @@ -301,8 +301,8 @@ all_block_variables:
name: "params"
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down
6 changes: 3 additions & 3 deletions tests/glsl/buffer_handle_uvec2_pc.spv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ all_block_variables:
offset: 0
absolute_offset: 0
size: 8
padded_size: 16
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
Expand All @@ -56,8 +56,8 @@ all_block_variables:
name: "pc"
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down
8 changes: 4 additions & 4 deletions tests/glsl/buffer_pointer.spv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ all_block_variables:
offset: 8
absolute_offset: 8
size: 4
padded_size: 8
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
Expand All @@ -209,7 +209,7 @@ all_block_variables:
offset: 0
absolute_offset: 0
size: 8
padded_size: 16
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand All @@ -226,8 +226,8 @@ all_block_variables:
name: "push"
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
size: 8
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down
6 changes: 3 additions & 3 deletions tests/hlsl/pushconstant.spv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ all_block_variables:
offset: 16
absolute_offset: 16
size: 8
padded_size: 16
padded_size: 8
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
Expand All @@ -139,8 +139,8 @@ all_block_variables:
name: "g_PushConstants"
offset: 0
absolute_offset: 0
size: 32
padded_size: 32
size: 24
padded_size: 24
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down
12 changes: 6 additions & 6 deletions tests/multi_entrypoint/multi_entrypoint.spv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ all_block_variables:
offset: 0
absolute_offset: 0
size: 4
padded_size: 16
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
Expand All @@ -258,8 +258,8 @@ all_block_variables:
name: "push_constant_vert"
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand All @@ -275,7 +275,7 @@ all_block_variables:
offset: 0
absolute_offset: 0
size: 4
padded_size: 16
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
Expand All @@ -289,8 +289,8 @@ all_block_variables:
name: "push_constant_frag"
offset: 0
absolute_offset: 0
size: 16
padded_size: 16
size: 4
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down
6 changes: 3 additions & 3 deletions tests/push_constants/non_zero_block_offset.spv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ all_block_variables:
offset: 16
absolute_offset: 16
size: 4
padded_size: 16
padded_size: 4
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 32, signedness: 0 }
Expand Down Expand Up @@ -211,8 +211,8 @@ all_block_variables:
name: "pc"
offset: 4
absolute_offset: 0
size: 32
padded_size: 32
size: 20
padded_size: 20
decorations: 0x00000000 # NONE
numeric:
scalar: { width: 0, signedness: 0 }
Expand Down

0 comments on commit 600e61f

Please sign in to comment.