Skip to content

Commit 7082a63

Browse files
Fix PushConstant padding to 16 bytes (#292)
1 parent 4c6d3f3 commit 7082a63

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

spirv_reflect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4016,7 +4016,7 @@ static SpvReflectResult ParsePushConstantBlocks(SpvReflectPrvParser* p_parser, S
40164016
}
40174017

40184018
p_push_constant->name = p_node->name;
4019-
result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, false, p_push_constant);
4019+
result = ParseDescriptorBlockVariableSizes(p_parser, p_module, true, false, true, p_push_constant);
40204020
if (result != SPV_REFLECT_RESULT_SUCCESS) {
40214021
return result;
40224022
}

tests/glsl/buffer_handle_5.spv.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ all_block_variables:
164164
offset: 0
165165
absolute_offset: 0
166166
size: 8
167-
padded_size: 16
167+
padded_size: 8
168168
decorations: 0x00000080 # NON_WRITABLE
169169
numeric:
170170
scalar: { width: 0, signedness: 0 }

tests/glsl/buffer_handle_7.spv.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ all_block_variables:
253253
offset: 0
254254
absolute_offset: 0
255255
size: 8
256-
padded_size: 16
256+
padded_size: 8
257257
decorations: 0x00000080 # NON_WRITABLE
258258
numeric:
259259
scalar: { width: 0, signedness: 0 }
@@ -285,7 +285,7 @@ all_block_variables:
285285
offset: 0
286286
absolute_offset: 0
287287
size: 8
288-
padded_size: 16
288+
padded_size: 8
289289
decorations: 0x00000000 # NONE
290290
numeric:
291291
scalar: { width: 0, signedness: 0 }
@@ -301,8 +301,8 @@ all_block_variables:
301301
name: "params"
302302
offset: 0
303303
absolute_offset: 0
304-
size: 16
305-
padded_size: 16
304+
size: 8
305+
padded_size: 8
306306
decorations: 0x00000000 # NONE
307307
numeric:
308308
scalar: { width: 0, signedness: 0 }

tests/glsl/buffer_handle_uvec2_pc.spv.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ all_block_variables:
4242
offset: 0
4343
absolute_offset: 0
4444
size: 8
45-
padded_size: 16
45+
padded_size: 8
4646
decorations: 0x00000000 # NONE
4747
numeric:
4848
scalar: { width: 32, signedness: 0 }
@@ -56,8 +56,8 @@ all_block_variables:
5656
name: "pc"
5757
offset: 0
5858
absolute_offset: 0
59-
size: 16
60-
padded_size: 16
59+
size: 8
60+
padded_size: 8
6161
decorations: 0x00000000 # NONE
6262
numeric:
6363
scalar: { width: 0, signedness: 0 }

tests/glsl/buffer_pointer.spv.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ all_block_variables:
194194
offset: 8
195195
absolute_offset: 8
196196
size: 4
197-
padded_size: 8
197+
padded_size: 4
198198
decorations: 0x00000000 # NONE
199199
numeric:
200200
scalar: { width: 32, signedness: 0 }
@@ -209,7 +209,7 @@ all_block_variables:
209209
offset: 0
210210
absolute_offset: 0
211211
size: 8
212-
padded_size: 16
212+
padded_size: 8
213213
decorations: 0x00000000 # NONE
214214
numeric:
215215
scalar: { width: 0, signedness: 0 }
@@ -226,8 +226,8 @@ all_block_variables:
226226
name: "push"
227227
offset: 0
228228
absolute_offset: 0
229-
size: 16
230-
padded_size: 16
229+
size: 8
230+
padded_size: 8
231231
decorations: 0x00000000 # NONE
232232
numeric:
233233
scalar: { width: 0, signedness: 0 }

tests/hlsl/pushconstant.spv.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ all_block_variables:
125125
offset: 16
126126
absolute_offset: 16
127127
size: 8
128-
padded_size: 16
128+
padded_size: 8
129129
decorations: 0x00000000 # NONE
130130
numeric:
131131
scalar: { width: 32, signedness: 0 }
@@ -139,8 +139,8 @@ all_block_variables:
139139
name: "g_PushConstants"
140140
offset: 0
141141
absolute_offset: 0
142-
size: 32
143-
padded_size: 32
142+
size: 24
143+
padded_size: 24
144144
decorations: 0x00000000 # NONE
145145
numeric:
146146
scalar: { width: 0, signedness: 0 }

tests/multi_entrypoint/multi_entrypoint.spv.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ all_block_variables:
244244
offset: 0
245245
absolute_offset: 0
246246
size: 4
247-
padded_size: 16
247+
padded_size: 4
248248
decorations: 0x00000000 # NONE
249249
numeric:
250250
scalar: { width: 32, signedness: 0 }
@@ -258,8 +258,8 @@ all_block_variables:
258258
name: "push_constant_vert"
259259
offset: 0
260260
absolute_offset: 0
261-
size: 16
262-
padded_size: 16
261+
size: 4
262+
padded_size: 4
263263
decorations: 0x00000000 # NONE
264264
numeric:
265265
scalar: { width: 0, signedness: 0 }
@@ -275,7 +275,7 @@ all_block_variables:
275275
offset: 0
276276
absolute_offset: 0
277277
size: 4
278-
padded_size: 16
278+
padded_size: 4
279279
decorations: 0x00000000 # NONE
280280
numeric:
281281
scalar: { width: 32, signedness: 0 }
@@ -289,8 +289,8 @@ all_block_variables:
289289
name: "push_constant_frag"
290290
offset: 0
291291
absolute_offset: 0
292-
size: 16
293-
padded_size: 16
292+
size: 4
293+
padded_size: 4
294294
decorations: 0x00000000 # NONE
295295
numeric:
296296
scalar: { width: 0, signedness: 0 }

tests/push_constants/non_zero_block_offset.spv.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ all_block_variables:
182182
offset: 16
183183
absolute_offset: 16
184184
size: 4
185-
padded_size: 16
185+
padded_size: 4
186186
decorations: 0x00000000 # NONE
187187
numeric:
188188
scalar: { width: 32, signedness: 0 }
@@ -211,8 +211,8 @@ all_block_variables:
211211
name: "pc"
212212
offset: 4
213213
absolute_offset: 0
214-
size: 32
215-
padded_size: 32
214+
size: 20
215+
padded_size: 20
216216
decorations: 0x00000000 # NONE
217217
numeric:
218218
scalar: { width: 0, signedness: 0 }

0 commit comments

Comments
 (0)