Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- This patch looks fine, but it makes me wonder that where is probably something to fix in an earlier commit...
On 23/11/21 02:45, Zebediah Figura wrote:
@@ -1238,6 +1248,34 @@ static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf write_sm4_instruction(buffer, &instr); }
+static void write_sm4_sample(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer,
const struct hlsl_type *resource_type, const struct hlsl_ir_node *dst,
const struct hlsl_deref *resource, const struct hlsl_deref *sampler, const struct hlsl_ir_node *coords)
+{
- struct sm4_instruction instr;
- unsigned int writemask;
- memset(&instr, 0, sizeof(instr));
- instr.opcode = VKD3D_SM4_OP_SAMPLE;
- sm4_register_from_node(&instr.dsts[0].reg, &instr.dsts[0].writemask, NULL, dst);
- instr.dst_count = 1;
- sm4_register_from_node(&instr.srcs[0].reg, &writemask, &instr.srcs[0].swizzle_type, coords);
- instr.srcs[0].swizzle = hlsl_swizzle_from_writemask(writemask);
- sm4_register_from_deref(ctx, &instr.srcs[1].reg, &writemask,
&instr.srcs[1].swizzle_type, resource, resource_type);
- instr.srcs[1].swizzle = hlsl_map_swizzle(hlsl_swizzle_from_writemask(writemask), instr.dsts[0].writemask);
Here you pass the swizzle_type field to sm4_register_from_deref, as write_sm4_ld already does. However, it seems that sm4_register_from_deref currently ignores swizzle_type in its texture branch, so that's going to remain uninitialized (swizzle_type is also ignored in another branch of sm4_register_from_deref).
I guess the patch that introduced swizzle_type missed a few cases, I doubt there is a reason why textures should not have the swizzle_type field set, right?
Thanks, Giovanni.