From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/spirv.c | 13 ------------- libs/vkd3d-shader/vkd3d_shader_private.h | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 2dab97cc..1df5d719 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2321,7 +2321,6 @@ struct spirv_compiler const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info; unsigned int input_control_point_count; unsigned int output_control_point_count; - bool use_vocp;
enum vkd3d_shader_opcode phase; bool emit_default_control_point_phase; @@ -6092,9 +6091,6 @@ static void spirv_compiler_emit_dcl_input(struct spirv_compiler *compiler, spirv_compiler_emit_input(compiler, dst, VKD3D_SIV_NONE, VKD3DSIM_NONE); else spirv_compiler_emit_input_register(compiler, dst); - - if (dst->reg.type == VKD3DSPR_OUTCONTROLPOINT) - compiler->use_vocp = true; }
static void spirv_compiler_emit_dcl_input_ps(struct spirv_compiler *compiler, @@ -6481,12 +6477,6 @@ static void spirv_compiler_emit_barrier(struct spirv_compiler *compiler, } }
-static void spirv_compiler_emit_hull_shader_barrier(struct spirv_compiler *compiler) -{ - spirv_compiler_emit_barrier(compiler, - SpvScopeWorkgroup, SpvScopeInvocation, SpvMemorySemanticsMaskNone); -} - static void spirv_compiler_emit_shader_epilogue_invocation(struct spirv_compiler *compiler) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -6537,9 +6527,6 @@ static void spirv_compiler_emit_hull_shader_main(struct spirv_compiler *compiler
vkd3d_spirv_build_op_function_call(builder, void_id, compiler->control_point_phase.function_id, NULL, 0);
- if (compiler->use_vocp) - spirv_compiler_emit_hull_shader_barrier(compiler); - /* TODO: only call the patch constant function for invocation 0. The simplest way * is to avoid use of private variables there, otherwise we would need a separate * patch constant epilogue also only called from invocation 0. */ diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index c9d2dec8..54f5ffce 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1082,7 +1082,7 @@ static inline bool vkd3d_shader_instruction_has_texel_offset(const struct vkd3d_
static inline bool vkd3d_shader_register_is_input(const struct vkd3d_shader_register *reg) { - return reg->type == VKD3DSPR_INPUT || reg->type == VKD3DSPR_INCONTROLPOINT || reg->type == VKD3DSPR_OUTCONTROLPOINT; + return reg->type == VKD3DSPR_INPUT || reg->type == VKD3DSPR_INCONTROLPOINT; }
static inline bool vkd3d_shader_register_is_output(const struct vkd3d_shader_register *reg)
From: Zebediah Figura zfigura@codeweavers.com
This is taken care of by prior I/O lowering. We no longer need to deal with this here. --- libs/vkd3d-shader/spirv.c | 53 ++++++++++++--------------------------- 1 file changed, 16 insertions(+), 37 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 1df5d719..fb05b558 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4600,18 +4600,17 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler, const struct signature_element *signature_element; const struct shader_signature *shader_signature; enum vkd3d_shader_component_type component_type; - uint32_t type_id, ptr_type_id, float_type_id; const struct vkd3d_spirv_builtin *builtin; unsigned int write_mask, reg_write_mask; struct vkd3d_symbol *symbol = NULL; uint32_t val_id, input_id, var_id; + uint32_t type_id, float_type_id; struct vkd3d_symbol reg_symbol; SpvStorageClass storage_class; struct rb_entry *entry = NULL; bool use_private_var = false; unsigned int array_sizes[2]; unsigned int element_idx; - uint32_t i, index;
assert(!reg->idx_count || !reg->idx[0].rel_addr); assert(reg->idx_count < 2 || !reg->idx[1].rel_addr); @@ -4714,47 +4713,27 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
if (use_private_var) { + struct vkd3d_shader_register dst_reg = *reg; + dst_reg.data_type = VKD3D_DATA_FLOAT; + type_id = vkd3d_spirv_get_type_id(builder, component_type, input_component_count); - for (i = 0; i < max(array_sizes[0], 1); ++i) - { - struct vkd3d_shader_register dst_reg = *reg; - dst_reg.data_type = VKD3D_DATA_FLOAT;
- val_id = input_id; - if (array_sizes[0]) - { - ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassInput, type_id); - index = spirv_compiler_get_constant_uint(compiler, i); - val_id = vkd3d_spirv_build_op_in_bounds_access_chain1(builder, ptr_type_id, input_id, index); - dst_reg.idx[0].offset = i; - } - else if (builtin && builtin->spirv_array_size) - { - /* The D3D builtin is not an array, but the SPIR-V builtin is, - * so we'll need to index into the SPIR-V builtin when loading - * it. This happens when reading TessLevel in domain shaders. */ - ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassInput, type_id); - index = spirv_compiler_get_constant_uint(compiler, builtin->member_idx); - val_id = vkd3d_spirv_build_op_in_bounds_access_chain1(builder, ptr_type_id, input_id, index); - dst_reg.idx[0].offset = element_idx + i; - } - val_id = vkd3d_spirv_build_op_load(builder, type_id, val_id, SpvMemoryAccessMaskNone); + 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 (builtin && builtin->fixup_pfn) + val_id = builtin->fixup_pfn(compiler, val_id);
- if (component_type != VKD3D_SHADER_COMPONENT_FLOAT) - { - float_type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, input_component_count); - val_id = vkd3d_spirv_build_op_bitcast(builder, float_type_id, val_id); - } + if (component_type != VKD3D_SHADER_COMPONENT_FLOAT) + { + float_type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, input_component_count); + val_id = vkd3d_spirv_build_op_bitcast(builder, float_type_id, val_id); + }
- val_id = spirv_compiler_emit_swizzle(compiler, val_id, - vkd3d_write_mask_from_component_count(input_component_count), - VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_SHADER_NO_SWIZZLE, dst->write_mask >> component_idx); + val_id = spirv_compiler_emit_swizzle(compiler, val_id, + vkd3d_write_mask_from_component_count(input_component_count), + VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_SHADER_NO_SWIZZLE, dst->write_mask >> component_idx);
- spirv_compiler_emit_store_reg(compiler, &dst_reg, dst->write_mask, val_id); - } + spirv_compiler_emit_store_reg(compiler, &dst_reg, dst->write_mask, val_id); }
return input_id;
Subject: [PATCH 1/2] vkd3d-shader/spirv: Remove the no longer used spirv_compiler_emit_hull_shader_barrier().
It's true that this is effectively unused now, but it's not clear to me that we have an equivalent barrier anywhere. I.e., does this being unused indicate a (potentially hard to debug) bug, instead of simply being some leftover code?