mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/tpf: Write out comparison mode sampler declarations and corresponding sampling instruction.
This commit is contained in:
parent
2fd3550ba6
commit
c33219c97b
Notes:
Alexandre Julliard
2023-05-29 22:32:35 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/206
@ -3680,23 +3680,24 @@ static void write_sm4_dcl_constant_buffer(struct vkd3d_bytecode_buffer *buffer,
|
|||||||
static void write_sm4_dcl_samplers(struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_var *var)
|
static void write_sm4_dcl_samplers(struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_var *var)
|
||||||
{
|
{
|
||||||
unsigned int i, count = var->data_type->reg_size[HLSL_REGSET_SAMPLERS];
|
unsigned int i, count = var->data_type->reg_size[HLSL_REGSET_SAMPLERS];
|
||||||
struct sm4_instruction instr;
|
struct sm4_instruction instr =
|
||||||
|
{
|
||||||
|
.opcode = VKD3D_SM4_OP_DCL_SAMPLER,
|
||||||
|
|
||||||
|
.dsts[0].reg.type = VKD3D_SM4_RT_SAMPLER,
|
||||||
|
.dsts[0].reg.idx_count = 1,
|
||||||
|
.dst_count = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (var->data_type->sampler_dim == HLSL_SAMPLER_DIM_COMPARISON)
|
||||||
|
instr.opcode |= VKD3D_SM4_SAMPLER_COMPARISON << VKD3D_SM4_SAMPLER_MODE_SHIFT;
|
||||||
|
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (!var->objects_usage[HLSL_REGSET_SAMPLERS][i].used)
|
if (!var->objects_usage[HLSL_REGSET_SAMPLERS][i].used)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
instr = (struct sm4_instruction)
|
instr.dsts[0].reg.idx[0] = var->regs[HLSL_REGSET_SAMPLERS].id + i;
|
||||||
{
|
|
||||||
.opcode = VKD3D_SM4_OP_DCL_SAMPLER,
|
|
||||||
|
|
||||||
.dsts[0].reg.type = VKD3D_SM4_RT_SAMPLER,
|
|
||||||
.dsts[0].reg.idx = {var->regs[HLSL_REGSET_SAMPLERS].id + i},
|
|
||||||
.dsts[0].reg.idx_count = 1,
|
|
||||||
.dst_count = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
write_sm4_instruction(buffer, &instr);
|
write_sm4_instruction(buffer, &instr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4108,6 +4109,10 @@ static void write_sm4_sample(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer
|
|||||||
instr.opcode = VKD3D_SM4_OP_SAMPLE;
|
instr.opcode = VKD3D_SM4_OP_SAMPLE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HLSL_RESOURCE_SAMPLE_CMP:
|
||||||
|
instr.opcode = VKD3D_SM4_OP_SAMPLE_C;
|
||||||
|
break;
|
||||||
|
|
||||||
case HLSL_RESOURCE_SAMPLE_LOD:
|
case HLSL_RESOURCE_SAMPLE_LOD:
|
||||||
instr.opcode = VKD3D_SM4_OP_SAMPLE_LOD;
|
instr.opcode = VKD3D_SM4_OP_SAMPLE_LOD;
|
||||||
break;
|
break;
|
||||||
@ -4154,6 +4159,11 @@ static void write_sm4_sample(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer
|
|||||||
sm4_src_from_node(&instr.srcs[4], load->ddy.node, VKD3DSP_WRITEMASK_ALL);
|
sm4_src_from_node(&instr.srcs[4], load->ddy.node, VKD3DSP_WRITEMASK_ALL);
|
||||||
instr.src_count += 2;
|
instr.src_count += 2;
|
||||||
}
|
}
|
||||||
|
else if (load->load_type == HLSL_RESOURCE_SAMPLE_CMP)
|
||||||
|
{
|
||||||
|
sm4_src_from_node(&instr.srcs[3], load->cmp.node, VKD3DSP_WRITEMASK_ALL);
|
||||||
|
++instr.src_count;
|
||||||
|
}
|
||||||
|
|
||||||
write_sm4_instruction(buffer, &instr);
|
write_sm4_instruction(buffer, &instr);
|
||||||
}
|
}
|
||||||
@ -4952,6 +4962,7 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HLSL_RESOURCE_SAMPLE:
|
case HLSL_RESOURCE_SAMPLE:
|
||||||
|
case HLSL_RESOURCE_SAMPLE_CMP:
|
||||||
case HLSL_RESOURCE_SAMPLE_LOD:
|
case HLSL_RESOURCE_SAMPLE_LOD:
|
||||||
case HLSL_RESOURCE_SAMPLE_LOD_BIAS:
|
case HLSL_RESOURCE_SAMPLE_LOD_BIAS:
|
||||||
case HLSL_RESOURCE_SAMPLE_GRAD:
|
case HLSL_RESOURCE_SAMPLE_GRAD:
|
||||||
@ -4982,10 +4993,6 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx,
|
|||||||
write_sm4_gather(ctx, buffer, resource_type, &load->node, &load->resource,
|
write_sm4_gather(ctx, buffer, resource_type, &load->node, &load->resource,
|
||||||
&load->sampler, coords, HLSL_SWIZZLE(W, W, W, W), texel_offset);
|
&load->sampler, coords, HLSL_SWIZZLE(W, W, W, W), texel_offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HLSL_RESOURCE_SAMPLE_CMP:
|
|
||||||
hlsl_fixme(ctx, &load->node.loc, "SM4 sample-comparison expression.");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user