From 90a07ada8eae5aa5c1e94a5315783523dba11af6 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Mon, 4 Nov 2024 20:24:06 -0300 Subject: [PATCH] vkd3d-shader/tpf: Use SCALAR swizzle dimension for RASTERIZER registers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While we currently output instructions like this: sampleinfo_uint r0.x, rasterizer.xxxx > SAMPLE_INFO (111) 0 0000100[len:4] 0000000000001[1] 00001101111[opcode:111] └─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 01[idxs:1] 00000000[type:0] 0000[0] 0001[wmask:1] 00[swtype:0] 10[dim:2] └─ 00000000000000000000000000000000[0|0.0] └─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 00[idxs:0] 00001110[type:14] 00000000[sw:0] 01[swtype:1] 10[dim:2] FXC/d3dcompiler outputs instructions like this: sampleinfo o0.x, rasterizer.x > SAMPLE_INFO (111) 0 0000100[len:4] 0000000000000[0] 00001101111[opcode:111] └─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 01[idxs:1] 00000010[type:2] 0000[0] 0001[wmask:1] 00[swtype:0] 10[dim:2] └─ 00000000000000000000000000000000[0|0.0] └─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 00[idxs:0] 00001110[type:14] 000000[0] 00[swcomp:0] 10[swtype:2] 10[dim:2] Note the difference in swtype of the rasterizer src register. --- libs/vkd3d-shader/tpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 3691754a..76865751 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -1719,7 +1719,7 @@ static void init_sm4_lookup_tables(struct vkd3d_sm4_lookup_tables *lookup) {VKD3D_SM4_RT_PRIMID, VKD3DSPR_PRIMID, VKD3D_SM4_SWIZZLE_NONE}, {VKD3D_SM4_RT_DEPTHOUT, VKD3DSPR_DEPTHOUT, VKD3D_SM4_SWIZZLE_VEC4}, {VKD3D_SM4_RT_NULL, VKD3DSPR_NULL, VKD3D_SM4_SWIZZLE_INVALID}, - {VKD3D_SM4_RT_RASTERIZER, VKD3DSPR_RASTERIZER, VKD3D_SM4_SWIZZLE_VEC4}, + {VKD3D_SM4_RT_RASTERIZER, VKD3DSPR_RASTERIZER, VKD3D_SM4_SWIZZLE_SCALAR}, {VKD3D_SM4_RT_OMASK, VKD3DSPR_SAMPLEMASK, VKD3D_SM4_SWIZZLE_VEC4}, {VKD3D_SM5_RT_STREAM, VKD3DSPR_STREAM, VKD3D_SM4_SWIZZLE_VEC4}, {VKD3D_SM5_RT_FUNCTION_BODY, VKD3DSPR_FUNCTIONBODY, VKD3D_SM4_SWIZZLE_VEC4},