mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/ir: Consistently use VSIR_DATA_U32 for sample_info_uint destination operands.
The HLSL compiler already did this; the TPF and DXIL parsers did not. Previously spirv_compiler_emit_sample_info() was unable to correctly handle VSIR_DATA_U32 destinations; the new version is arguably simpler as well.
This commit is contained in:
Notes:
Henri Verbeet
2025-07-23 17:31:10 +02:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1641
@@ -6009,7 +6009,7 @@ static void sm6_parser_emit_dx_get_sample_count(struct sm6_parser *sm6, enum dx_
|
||||
src_param_init(src_param);
|
||||
|
||||
instruction_dst_param_init_ssa_scalar(ins, sm6);
|
||||
ins->dst->reg.data_type = VSIR_DATA_F32;
|
||||
ins->dst->reg.data_type = VSIR_DATA_U32;
|
||||
}
|
||||
|
||||
static void sm6_parser_emit_dx_get_sample_pos(struct sm6_parser *sm6, enum dx_intrinsic_opcode op,
|
||||
|
@@ -10015,6 +10015,7 @@ static uint32_t spirv_compiler_emit_query_sample_count(struct spirv_compiler *co
|
||||
static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
enum vkd3d_shader_component_type component_type = VKD3D_SHADER_COMPONENT_UINT;
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
const struct vkd3d_shader_dst_param *dst = instruction->dst;
|
||||
const struct vkd3d_shader_src_param *src = instruction->src;
|
||||
@@ -10034,14 +10035,14 @@ static void spirv_compiler_emit_sample_info(struct spirv_compiler *compiler,
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_UINT, VKD3D_VEC4_SIZE);
|
||||
val_id = vkd3d_spirv_build_op_composite_construct(builder, type_id, constituents, VKD3D_VEC4_SIZE);
|
||||
|
||||
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE);
|
||||
if (instruction->flags == VKD3DSI_SAMPLE_INFO_UINT)
|
||||
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
|
||||
else
|
||||
if (!(instruction->flags & VKD3DSI_SAMPLE_INFO_UINT))
|
||||
{
|
||||
component_type = VKD3D_SHADER_COMPONENT_FLOAT;
|
||||
type_id = vkd3d_spirv_get_type_id(builder, component_type, VKD3D_VEC4_SIZE);
|
||||
val_id = vkd3d_spirv_build_op_convert_utof(builder, type_id, val_id);
|
||||
|
||||
}
|
||||
val_id = spirv_compiler_emit_swizzle(compiler, val_id, VKD3DSP_WRITEMASK_ALL,
|
||||
VKD3D_SHADER_COMPONENT_FLOAT, src->swizzle, dst->write_mask);
|
||||
component_type, src->swizzle, dst->write_mask);
|
||||
|
||||
spirv_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
}
|
||||
|
@@ -2742,6 +2742,9 @@ static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, str
|
||||
}
|
||||
}
|
||||
|
||||
if (ins->opcode == VSIR_OP_SAMPLE_INFO && ins->flags & VKD3DSI_SAMPLE_INFO_UINT)
|
||||
ins->dst[0].reg.data_type = VSIR_DATA_U32;
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
|
Reference in New Issue
Block a user