From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d-shader/spirv.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index f2a1b1141e23..28cfb8977ea2 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2985,7 +2985,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi const struct vkd3d_shader_register *reg = &dst->reg; const struct vkd3d_spirv_builtin *builtin; enum vkd3d_component_type component_type; - uint32_t val_id = 0, input_id, var_id; + uint32_t val_id, input_id, var_id; uint32_t type_id, float_type_id; struct vkd3d_symbol reg_symbol; SpvStorageClass storage_class; @@ -3043,26 +3043,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi vkd3d_spirv_build_op_decorate1(builder, input_id, SpvDecorationComponent, component_idx); }
- if (component_type != VKD3D_TYPE_FLOAT || component_count != VKD3D_VEC4_SIZE) - { - type_id = vkd3d_spirv_get_type_id(builder, component_type, input_component_count); - val_id = vkd3d_spirv_build_op_load(builder, type_id, input_id, SpvMemoryAccessMaskNone); - - if (builtin && builtin->fixup_pfn) - val_id = builtin->fixup_pfn(compiler, val_id); - - if (component_type != VKD3D_TYPE_FLOAT) - { - float_type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, input_component_count); - val_id = vkd3d_spirv_build_op_bitcast(builder, float_type_id, val_id); - } - - use_private_var = true; - } - - if (val_id && input_component_count != component_count) - val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, - val_id, VKD3D_TYPE_FLOAT, VKD3D_NO_SWIZZLE, dst->write_mask); + use_private_var = component_type != VKD3D_TYPE_FLOAT || component_count != VKD3D_VEC4_SIZE;
vkd3d_symbol_make_register(®_symbol, reg);
@@ -3089,7 +3070,22 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
if (use_private_var) { - assert(val_id); + type_id = vkd3d_spirv_get_type_id(builder, component_type, input_component_count); + val_id = vkd3d_spirv_build_op_load(builder, type_id, input_id, SpvMemoryAccessMaskNone); + + if (builtin && builtin->fixup_pfn) + val_id = builtin->fixup_pfn(compiler, val_id); + + if (component_type != VKD3D_TYPE_FLOAT) + { + float_type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, input_component_count); + val_id = vkd3d_spirv_build_op_bitcast(builder, float_type_id, val_id); + } + + if (input_component_count != component_count) + val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, + val_id, VKD3D_TYPE_FLOAT, VKD3D_NO_SWIZZLE, dst->write_mask); + vkd3d_dxbc_compiler_emit_store_reg(compiler, reg, dst->write_mask, val_id); }