=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d-shader: Fix component decoration for shader IO variables.
Alexandre Julliard
julliard at winehq.org
Tue Jun 18 17:21:29 CDT 2019
Module: vkd3d
Branch: master
Commit: 0bde4c7dca5ca681f3e653bd953939a02708c702
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=0bde4c7dca5ca681f3e653bd953939a02708c702
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Mon Jun 17 15:43:27 2019 +0200
vkd3d-shader: Fix component decoration for shader IO variables.
This fixes a regression introduced by commit
91820630cb49ef645ca6251f63ce2ff63e0c568d.
We need to take into account the combined write mask returned from
needs_private_io_variable().
Signed-off-by: Józef Kucia <jkucia 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 | 8 ++++++
tests/d3d12.c | 65 ++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 25e3f8e..73d2661 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -3944,6 +3944,10 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
component_count = VKD3D_VEC4_SIZE;
write_mask = VKD3DSP_WRITEMASK_ALL;
}
+ else
+ {
+ component_idx = vkd3d_write_mask_get_component_idx(write_mask);
+ }
storage_class = SpvStorageClassInput;
@@ -4300,6 +4304,10 @@ static void vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *compiler
use_private_variable = true;
write_mask = VKD3DSP_WRITEMASK_ALL;
}
+ else
+ {
+ component_idx = vkd3d_write_mask_get_component_idx(write_mask);
+ }
vkd3d_symbol_make_register(®_symbol, reg);
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 473a347..dbced1a 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -10039,6 +10039,62 @@ static void test_shader_input_output_components(void)
0x0100003e,
};
static const D3D12_SHADER_BYTECODE ps4 = {ps4_code, sizeof(ps4_code)};
+#if 0
+ struct ps_data
+ {
+ float4 position : SV_Position;
+ float4 color : COLOR;
+ float3 color1 : COLOR1;
+ float color2 : COLOR2;
+ };
+
+ ps_data vs_main(float4 position : POSITION)
+ {
+ ps_data o;
+ o.position = position;
+ o.color = float4(0, 1, 0, 1);
+ o.color1 = (float3)0.5;
+ o.color2 = 0.25;
+ return o;
+ }
+
+ float4 ps_main(ps_data i) : SV_Target
+ {
+ return float4(i.color.rgb, i.color2);
+ }
+#endif
+ static const DWORD vs5_code[] =
+ {
+ 0x43425844, 0xc3e1b9fc, 0xb99e43ef, 0x9a2a6dfc, 0xad719e68, 0x00000001, 0x00000190, 0x00000003,
+ 0x0000002c, 0x00000060, 0x000000e4, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+ 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0xababab00,
+ 0x4e47534f, 0x0000007c, 0x00000004, 0x00000008, 0x00000068, 0x00000000, 0x00000001, 0x00000003,
+ 0x00000000, 0x0000000f, 0x00000074, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f,
+ 0x00000074, 0x00000001, 0x00000000, 0x00000003, 0x00000002, 0x00000807, 0x00000074, 0x00000002,
+ 0x00000000, 0x00000003, 0x00000002, 0x00000708, 0x505f5653, 0x7469736f, 0x006e6f69, 0x4f4c4f43,
+ 0xabab0052, 0x58454853, 0x000000a4, 0x00010050, 0x00000029, 0x0100086a, 0x0300005f, 0x001010f2,
+ 0x00000000, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001,
+ 0x03000065, 0x00102072, 0x00000002, 0x03000065, 0x00102082, 0x00000002, 0x05000036, 0x001020f2,
+ 0x00000000, 0x00101e46, 0x00000000, 0x08000036, 0x001020f2, 0x00000001, 0x00004002, 0x00000000,
+ 0x3f800000, 0x00000000, 0x3f800000, 0x08000036, 0x001020f2, 0x00000002, 0x00004002, 0x3f000000,
+ 0x3f000000, 0x3f000000, 0x3e800000, 0x0100003e,
+ };
+ static const D3D12_SHADER_BYTECODE vs5 = {vs5_code, sizeof(vs5_code)};
+ static const DWORD ps5_code[] =
+ {
+ 0x43425844, 0x285bf397, 0xbc07e078, 0xc4e528e3, 0x74efea4d, 0x00000001, 0x00000148, 0x00000003,
+ 0x0000002c, 0x000000b0, 0x000000e4, 0x4e475349, 0x0000007c, 0x00000004, 0x00000008, 0x00000068,
+ 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000074, 0x00000000, 0x00000000,
+ 0x00000003, 0x00000001, 0x0000070f, 0x00000074, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
+ 0x00000007, 0x00000074, 0x00000002, 0x00000000, 0x00000003, 0x00000002, 0x00000808, 0x505f5653,
+ 0x7469736f, 0x006e6f69, 0x4f4c4f43, 0xabab0052, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008,
+ 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261,
+ 0xabab0074, 0x58454853, 0x0000005c, 0x00000050, 0x00000017, 0x0100086a, 0x03001062, 0x00101072,
+ 0x00000001, 0x03001062, 0x00101082, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x05000036,
+ 0x00102072, 0x00000000, 0x00101246, 0x00000001, 0x05000036, 0x00102082, 0x00000000, 0x0010103a,
+ 0x00000002, 0x0100003e,
+ };
+ static const D3D12_SHADER_BYTECODE ps5 = {ps5_code, sizeof(ps5_code)};
static const D3D12_INPUT_ELEMENT_DESC layout_desc[] =
{
{"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0},
@@ -10071,10 +10127,11 @@ static void test_shader_input_output_components(void)
}
tests[] =
{
- {&vs1, &ps1, {1.0f, 2.0f, 3.0f, 0.0f}, {0xdeadbeef, 0, 2, 3}},
- {&vs2, &ps2, {6.0f, 4.0f, 7.0f, 8.0f}, { 9, 5, 0, 1}},
- {&vs2, &ps3, {3.0f, 8.0f, 7.0f, 7.0f}, { 9, 0, 0, 1}},
- {&vs2, &ps4, {0.0f, 1.0f, 0.0f, 1.0f}, { 0, 1, 0, 0}},
+ {&vs1, &ps1, {1.0f, 2.0f, 3.0f, 0.00f}, {0xdeadbeef, 0, 2, 3}},
+ {&vs2, &ps2, {6.0f, 4.0f, 7.0f, 8.00f}, { 9, 5, 0, 1}},
+ {&vs2, &ps3, {3.0f, 8.0f, 7.0f, 7.00f}, { 9, 0, 0, 1}},
+ {&vs2, &ps4, {0.0f, 1.0f, 0.0f, 1.00f}, { 0, 1, 0, 0}},
+ {&vs5, &ps5, {0.0f, 1.0f, 0.0f, 0.25f}, { 0, 1, 0, 0}},
};
memset(&desc, 0, sizeof(desc));
More information about the wine-cvs
mailing list