From: Francisco Casas fcasas@codeweavers.com
The assumption that sampler registers never have a swizzle is not totally correct.
For instance, for the following shader:
Texture2D tex; sampler sam;
float4 main() : sv_target { return tex.GatherGreen(sam, float2(0, 0)); }
the gather instruction is being disassembled as
gather4_indexable(texture2d) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0
instead of
gather4_indexable(texture2d)(float,float,float,float) o0.xyzw, l(0.0, 0.0, 0.0, 0.0), t0.xyzw, s0.y
(notice the missing swizzle in the last parameter s0).
This is because the Gather instructions give the sampler register a vec4 dimension (and scalar swizzle type) to indicate the channel for the gather operation.
The solution is using the new vkd3d_shader_register.dimension instead of checking the swizzle type. --- libs/vkd3d-shader/d3d_asm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/d3d_asm.c b/libs/vkd3d-shader/d3d_asm.c index 4582b22a7..7df2f1634 100644 --- a/libs/vkd3d-shader/d3d_asm.c +++ b/libs/vkd3d-shader/d3d_asm.c @@ -1330,7 +1330,7 @@ static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler, }
if (param->reg.type != VKD3DSPR_IMMCONST && param->reg.type != VKD3DSPR_IMMCONST64 - && param->reg.type != VKD3DSPR_SAMPLER) + && param->reg.dimension == VSIR_DIMENSION_VEC4) { unsigned int swizzle_x = vkd3d_swizzle_get_component(swizzle, 0); unsigned int swizzle_y = vkd3d_swizzle_get_component(swizzle, 1);