vkd3d: Pad push constant ranges to 16 bytes.

Because that's the granularity of Constant Buffer accesses in SM4.
This commit requires using more push constants, but without it the
generated SPIR-V can be invalid.
This commit is contained in:
Giovanni Mascellani 2023-12-01 12:27:40 +01:00 committed by Alexandre Julliard
parent 1015cc952e
commit a6317e5f3b
Notes: Alexandre Julliard 2023-12-13 23:22:34 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/504

View File

@ -515,7 +515,7 @@ static HRESULT d3d12_root_signature_init_push_constants(struct d3d12_root_signat
assert(p->ShaderVisibility <= D3D12_SHADER_VISIBILITY_PIXEL); assert(p->ShaderVisibility <= D3D12_SHADER_VISIBILITY_PIXEL);
push_constants[p->ShaderVisibility].stageFlags = use_vk_heaps ? VK_SHADER_STAGE_ALL push_constants[p->ShaderVisibility].stageFlags = use_vk_heaps ? VK_SHADER_STAGE_ALL
: stage_flags_from_visibility(p->ShaderVisibility); : stage_flags_from_visibility(p->ShaderVisibility);
push_constants[p->ShaderVisibility].size += p->u.Constants.Num32BitValues * sizeof(uint32_t); push_constants[p->ShaderVisibility].size += align(p->u.Constants.Num32BitValues, 4) * sizeof(uint32_t);
} }
if (push_constants[D3D12_SHADER_VISIBILITY_ALL].size) if (push_constants[D3D12_SHADER_VISIBILITY_ALL].size)
{ {
@ -564,7 +564,7 @@ static HRESULT d3d12_root_signature_init_push_constants(struct d3d12_root_signat
idx = push_constant_count == 1 ? 0 : p->ShaderVisibility; idx = push_constant_count == 1 ? 0 : p->ShaderVisibility;
offset = push_constants_offset[idx]; offset = push_constants_offset[idx];
push_constants_offset[idx] += p->u.Constants.Num32BitValues * sizeof(uint32_t); push_constants_offset[idx] += align(p->u.Constants.Num32BitValues, 4) * sizeof(uint32_t);
root_signature->parameters[i].parameter_type = p->ParameterType; root_signature->parameters[i].parameter_type = p->ParameterType;
root_constant->stage_flags = push_constant_count == 1 root_constant->stage_flags = push_constant_count == 1