mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/spirv: Correctly implement DTOI.
This commit is contained in:
parent
f416713608
commit
4130ce5bb9
Notes:
Henri Verbeet
2024-12-18 17:39:38 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1317
@ -7938,6 +7938,7 @@ static void spirv_compiler_emit_ftoi(struct spirv_compiler *compiler,
|
||||
uint32_t src_type_id, dst_type_id, condition_type_id;
|
||||
enum vkd3d_shader_component_type component_type;
|
||||
unsigned int component_count;
|
||||
uint32_t write_mask;
|
||||
|
||||
VKD3D_ASSERT(instruction->dst_count == 1);
|
||||
VKD3D_ASSERT(instruction->src_count == 1);
|
||||
@ -7947,21 +7948,23 @@ static void spirv_compiler_emit_ftoi(struct spirv_compiler *compiler,
|
||||
* and for NaN to yield zero. */
|
||||
|
||||
component_count = vsir_write_mask_component_count(dst->write_mask);
|
||||
src_type_id = spirv_compiler_get_type_id_for_reg(compiler, &src->reg, dst->write_mask);
|
||||
dst_type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);
|
||||
src_id = spirv_compiler_emit_load_src(compiler, src, dst->write_mask);
|
||||
|
||||
if (src->reg.data_type == VKD3D_DATA_DOUBLE)
|
||||
{
|
||||
write_mask = vkd3d_write_mask_from_component_count(component_count);
|
||||
int_min_id = spirv_compiler_get_constant_double_vector(compiler, -2147483648.0, component_count);
|
||||
float_max_id = spirv_compiler_get_constant_double_vector(compiler, 2147483648.0, component_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_mask = dst->write_mask;
|
||||
int_min_id = spirv_compiler_get_constant_float_vector(compiler, -2147483648.0f, component_count);
|
||||
float_max_id = spirv_compiler_get_constant_float_vector(compiler, 2147483648.0f, component_count);
|
||||
}
|
||||
|
||||
src_type_id = spirv_compiler_get_type_id_for_reg(compiler, &src->reg, write_mask);
|
||||
dst_type_id = spirv_compiler_get_type_id_for_dst(compiler, dst);
|
||||
src_id = spirv_compiler_emit_load_src(compiler, src, write_mask);
|
||||
val_id = vkd3d_spirv_build_op_glsl_std450_max(builder, src_type_id, src_id, int_min_id);
|
||||
|
||||
/* VSIR allows the destination of a signed conversion to be unsigned. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user