From: Conor McCarthy cmccarthy@codeweavers.com
There is no way to tell in spirv_compiler_emit_load_reg() if the write mask is 64-bit. All loads are 32-bit except for IMMCONST64 and SSA, and the latter ignores the mask, so the only issue lies in spirv_compiler_emit_load_constant64(). This is only a DXIL workaround and needs a more general solution. --- libs/vkd3d-shader/spirv.c | 8 ++++---- tests/hlsl/uav-rwbyteaddressbuffer.shader_test | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index a3baeea75..b60bb9ce6 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -3766,16 +3766,15 @@ static uint32_t spirv_compiler_emit_load_constant(struct spirv_compiler *compile static uint32_t spirv_compiler_emit_load_constant64(struct spirv_compiler *compiler, const struct vkd3d_shader_register *reg, uint32_t swizzle, uint32_t write_mask) { - unsigned int component_count = vsir_write_mask_component_count(write_mask); uint64_t values[VKD3D_DVEC2_SIZE] = {0}; - unsigned int i, j; + unsigned int i, j, component_count;
assert(reg->type == VKD3DSPR_IMMCONST64);
if (reg->dimension == VSIR_DIMENSION_SCALAR) { - for (i = 0; i < component_count; ++i) - values[i] = *reg->u.immconst_u64; + values[0] = reg->u.immconst_u64[0]; + component_count = 1; } else { @@ -3784,6 +3783,7 @@ static uint32_t spirv_compiler_emit_load_constant64(struct spirv_compiler *compi if (write_mask & (VKD3DSP_WRITEMASK_0 << i)) values[j++] = reg->u.immconst_u64[vsir_swizzle_get_component(swizzle, i)]; } + component_count = vsir_write_mask_component_count(write_mask); }
return spirv_compiler_get_constant64(compiler, diff --git a/tests/hlsl/uav-rwbyteaddressbuffer.shader_test b/tests/hlsl/uav-rwbyteaddressbuffer.shader_test index 723c0eb54..8b103fe98 100644 --- a/tests/hlsl/uav-rwbyteaddressbuffer.shader_test +++ b/tests/hlsl/uav-rwbyteaddressbuffer.shader_test @@ -19,7 +19,7 @@ float4 main() : sv_target }
[test] -todo draw quad +todo(sm<6) draw quad probe uav 1 (0) ri (11) probe uav 1 (1) r (11.1) probe uav 1 (1) rd (12.2)