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:
Henri Verbeet
2025-07-22 20:49:15 +02:00
parent b8c73e4a2c
commit b88be5b92b
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
3 changed files with 11 additions and 7 deletions

View File

@@ -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);
}