From: Francisco Casas fcasas@codeweavers.com
Currently, HLSL_RESOURCE_SAMPLE_LOD is not implemented for d3dbc, but we are incorrectly writting a texld instruction to handle it. This causes SM1 tests with the vulkan backend (in following patches) to fail if VKD3D_SHADER_CONFIG="force_validation" is enabled.
For now a fixme is emited in these cases. --- libs/vkd3d-shader/d3dbc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 8fec1e637..cdb85b9da 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -2340,8 +2340,6 @@ static void write_sm1_resource_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_
sm1_instr = (struct sm1_instruction) { - .opcode = D3DSIO_TEX, - .dst.type = D3DSPR_TEMP, .dst.reg = instr->reg.id, .dst.writemask = instr->reg.writemask, @@ -2357,8 +2355,22 @@ static void write_sm1_resource_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_
.src_count = 2, }; - if (load->load_type == HLSL_RESOURCE_SAMPLE_PROJ) - sm1_instr.opcode |= VKD3DSI_TEXLD_PROJECT << VKD3D_SM1_INSTRUCTION_FLAGS_SHIFT; + + switch (load->load_type) + { + case HLSL_RESOURCE_SAMPLE: + sm1_instr.opcode = D3DSIO_TEX; + break; + + case HLSL_RESOURCE_SAMPLE_PROJ: + sm1_instr.opcode = D3DSIO_TEX; + sm1_instr.opcode |= VKD3DSI_TEXLD_PROJECT << VKD3D_SM1_INSTRUCTION_FLAGS_SHIFT; + break; + + default: + hlsl_fixme(ctx, &instr->loc, "Resource load type %u\n", load->load_type); + return; + }
assert(instr->reg.allocated);