Conor McCarthy : vkd3d-shader/spirv: Shift the private variable destination mask instead of the source mask.

Alexandre Julliard julliard at winehq.org
Wed Nov 17 16:25:41 CST 2021


Module: vkd3d
Branch: master
Commit: dbd7e18364cededf51ec2bcc8fdca8b2b06f3371
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=dbd7e18364cededf51ec2bcc8fdca8b2b06f3371

Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date:   Wed Nov 17 13:06:03 2021 +0100

vkd3d-shader/spirv: Shift the private variable destination mask instead of the source mask.

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_domain_shader_inputs().

Based on a vkd3d-proton patch by Hans-Kristian Arntzen.

Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/spirv.c | 4 ++--
 tests/d3d12.c             | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 5a7e561..b7e7428 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -4672,8 +4672,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 670fbf4..3b0c424 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -29506,7 +29506,6 @@ static void test_domain_shader_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 unsigned int is_todo[] = {0x00110000, 0x00110000, 0x00110000, 0x00110000};
     static const unsigned int stride = sizeof(*reference);
 
     memset(&desc, 0, sizeof(desc));
@@ -29556,9 +29555,8 @@ static void test_domain_shader_inputs(void)
         const float *elems = get_readback_data(&rb, y, 0, 0, stride);
         for (x = 0; x < ARRAY_SIZE(*reference); ++x)
         {
-            todo_if(is_todo[y] & (1u << (x * 4)))
-                ok(compare_float(reference[y][x], elems[x], 0),
-                        "Got unexpected value %.8e for [%u][%u], expected %.8e.\n", elems[x], y, x, reference[y][x]);
+            ok(compare_float(reference[y][x], elems[x], 0),
+                    "Got unexpected value %.8e for [%u][%u], expected %.8e.\n", elems[x], y, x, reference[y][x]);
         }
     }
     release_resource_readback(&rb);




More information about the wine-cvs mailing list