From 9b64d04ed397168b358c5b505fda5b40cddaf5ca Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Fri, 6 Oct 2023 00:39:34 +1000 Subject: [PATCH] vkd3d-shader/spirv: Align constant buffer sizes to 16 bytes. DXIL constant buffer sizes are not aligned to 16 bytes. --- libs/vkd3d-shader/spirv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index bd9e7a33..2dab97cc 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -5639,7 +5639,8 @@ static void spirv_compiler_emit_cbv_declaration(struct spirv_compiler *compiler, reg.idx[1].offset = range->first; reg.idx[2].offset = range->last; - size = size_in_bytes / (VKD3D_VEC4_SIZE * sizeof(uint32_t)); + size = align(size_in_bytes, VKD3D_VEC4_SIZE * sizeof(uint32_t)); + size /= VKD3D_VEC4_SIZE * sizeof(uint32_t); if ((push_cb = spirv_compiler_find_push_constant_buffer(compiler, range))) {