vkd3d-shader/spirv: Emit a vector bitcast if necessary in spirv_compiler_emit_load_ssa_reg().

This commit is contained in:
Conor McCarthy 2024-01-25 13:32:29 +10:00 committed by Alexandre Julliard
parent ebec0aa434
commit 95e4222cc6
Notes: Alexandre Julliard 2024-02-01 23:07:26 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/601
2 changed files with 11 additions and 2 deletions

View File

@ -3884,9 +3884,10 @@ static uint32_t spirv_compiler_emit_load_ssa_reg(struct spirv_compiler *compiler
}
assert(vkd3d_swizzle_is_scalar(swizzle, reg));
reg_component_type = vkd3d_component_type_from_data_type(ssa->data_type);
if (reg->dimension == VSIR_DIMENSION_SCALAR)
{
reg_component_type = vkd3d_component_type_from_data_type(ssa->data_type);
if (component_type != reg_component_type)
{
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
@ -3896,6 +3897,14 @@ static uint32_t spirv_compiler_emit_load_ssa_reg(struct spirv_compiler *compiler
return val_id;
}
if (component_type != reg_component_type)
{
/* Required for resource loads with sampled type int, because DXIL has no signedness.
* Only 128-bit vector sizes are used. */
type_id = vkd3d_spirv_get_type_id(builder, component_type, VKD3D_VEC4_SIZE);
val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
}
type_id = vkd3d_spirv_get_type_id(builder, component_type, 1);
component_idx = vsir_swizzle_get_component(swizzle, 0);
return vkd3d_spirv_build_op_composite_extract1(builder, type_id, val_id, component_idx);

View File

@ -48,7 +48,7 @@ float4 main() : sv_target
}
[test]
todo(sm>=6) draw quad
draw quad
probe all rgba (0.8, -3.0, 4294967295.0, 123.0)
% lowercase 'texture2D'