From: Conor McCarthy Subject: [PATCH vkd3d resend 5/5] vkd3d-shader: Shift the private variable destination mask, not the source. Message-Id: <20210914020522.11264-1-cmccarthy@codeweavers.com> Date: Tue, 14 Sep 2021 12:05:22 +1000 Otherwise if the input is located above position 0 in the private array it will be swizzled incorrectly, e.g. a.yz instead of a.xy in test_tessellation_ds_inputs(). Based on a vkd3d-proton patch by Hans-Kristian Arntzen. Signed-off-by: Conor McCarthy --- libs/vkd3d-shader/spirv.c | 4 ++-- tests/d3d12.c | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 379746b7..6680551b 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4632,8 +4632,8 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi } val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, val_id, - vkd3d_write_mask_from_component_count(input_component_count) << component_idx, - VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_SHADER_NO_SWIZZLE, dst->write_mask); + vkd3d_write_mask_from_component_count(input_component_count), + VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_SHADER_NO_SWIZZLE, dst->write_mask >> component_idx); vkd3d_dxbc_compiler_emit_store_reg(compiler, &dst_reg, dst->write_mask, val_id); } diff --git a/tests/d3d12.c b/tests/d3d12.c index 3202c10b..be9017f5 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -29132,13 +29132,6 @@ static void test_tessellation_ds_inputs(void) {1.0f, 2.0f, 0.0f, 0.5f, 2.5f, 8.0f, 2.0f, 1.0f}, {1.0f, 2.0f, 1.0f, 0.5f, 2.5f, 8.0f, 2.0f, 1.0f}, }; - static const bool is_todo[4][8] = - { - {false, false, false, false, true, true, false, false}, - {false, false, false, false, true, true, false, false}, - {false, false, false, false, true, true, false, false}, - {false, false, false, false, true, true, false, false}, - }; static const unsigned int stride = sizeof(reference[0]); memset(&desc, 0, sizeof(desc)); @@ -29188,7 +29181,6 @@ static void test_tessellation_ds_inputs(void) float *elems = get_readback_data(&rb, y, 0, 0, stride); for (x = 0; x < 8; ++x) { - todo_if(is_todo[y][x]) ok(compare_float(reference[y][x], elems[x], 0), "Got unexpected value %f for [%u][%u], expected %f.\n", elems[x], y, x, reference[y][x]); } -- 2.32.0