mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
vkd3d-shader/ir: Introduce vsir_opcode_is_fork_or_join_phase().
This commit is contained in:
committed by
Henri Verbeet
parent
e23b3c84f6
commit
59ba079ebb
Notes:
Henri Verbeet
2025-11-25 20:40:54 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1816
@@ -3064,11 +3064,6 @@ struct hull_flattener
|
||||
unsigned int orig_ssa_count;
|
||||
};
|
||||
|
||||
static bool flattener_is_in_fork_or_join_phase(const struct hull_flattener *flattener)
|
||||
{
|
||||
return flattener->phase == VSIR_OP_HS_FORK_PHASE || flattener->phase == VSIR_OP_HS_JOIN_PHASE;
|
||||
}
|
||||
|
||||
static void flattener_fixup_ssa_register(struct hull_flattener *normaliser,
|
||||
struct vkd3d_shader_register *reg, unsigned int instance_id)
|
||||
{
|
||||
@@ -3190,9 +3185,9 @@ static enum vkd3d_result flattener_flatten_phases(struct hull_flattener *normali
|
||||
normaliser->phase = VSIR_OP_INVALID;
|
||||
for (ins = vsir_program_iterator_head(&it); ins; ins = vsir_program_iterator_next(&it))
|
||||
{
|
||||
if (ins->opcode == VSIR_OP_HS_FORK_PHASE || ins->opcode == VSIR_OP_HS_JOIN_PHASE)
|
||||
if (vsir_opcode_is_fork_or_join_phase(ins->opcode))
|
||||
{
|
||||
b = flattener_is_in_fork_or_join_phase(normaliser);
|
||||
b = vsir_opcode_is_fork_or_join_phase(normaliser->phase);
|
||||
/* Reset the phase info. */
|
||||
phase_body_it_valid = false;
|
||||
normaliser->phase = ins->opcode;
|
||||
@@ -3481,11 +3476,6 @@ struct io_normaliser
|
||||
bool use_vocp;
|
||||
};
|
||||
|
||||
static bool io_normaliser_is_in_fork_or_join_phase(const struct io_normaliser *normaliser)
|
||||
{
|
||||
return normaliser->phase == VSIR_OP_HS_FORK_PHASE || normaliser->phase == VSIR_OP_HS_JOIN_PHASE;
|
||||
}
|
||||
|
||||
static bool shader_signature_find_element_for_reg(const struct shader_signature *signature,
|
||||
unsigned int reg_idx, unsigned int write_mask, unsigned int *element_idx)
|
||||
{
|
||||
@@ -3603,7 +3593,7 @@ static enum vkd3d_result io_normaliser_add_index_range(struct io_normaliser *nor
|
||||
signature = normaliser->output_signature;
|
||||
break;
|
||||
case VKD3DSPR_OUTPUT:
|
||||
if (!io_normaliser_is_in_fork_or_join_phase(normaliser))
|
||||
if (!vsir_opcode_is_fork_or_join_phase(normaliser->phase))
|
||||
{
|
||||
range_map = normaliser->output_range_map;
|
||||
signature = normaliser->output_signature;
|
||||
@@ -3889,7 +3879,7 @@ static bool shader_dst_param_io_normalise(struct vkd3d_shader_dst_param *dst_par
|
||||
{
|
||||
case VKD3DSPR_OUTPUT:
|
||||
reg_idx = reg->idx[reg->idx_count - 1].offset;
|
||||
if (io_normaliser_is_in_fork_or_join_phase(normaliser))
|
||||
if (vsir_opcode_is_fork_or_join_phase(normaliser->phase))
|
||||
{
|
||||
signature = normaliser->patch_constant_signature;
|
||||
/* Convert patch constant outputs to the patch constant register type to avoid the need
|
||||
@@ -4005,7 +3995,7 @@ static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_par
|
||||
|
||||
case VKD3DSPR_OUTCONTROLPOINT:
|
||||
reg->type = VKD3DSPR_OUTPUT;
|
||||
if (io_normaliser_is_in_fork_or_join_phase(normaliser))
|
||||
if (vsir_opcode_is_fork_or_join_phase(normaliser->phase))
|
||||
normaliser->use_vocp = true;
|
||||
/* fall through */
|
||||
case VKD3DSPR_OUTPUT:
|
||||
|
||||
@@ -3024,11 +3024,6 @@ static bool is_in_control_point_phase(const struct spirv_compiler *compiler)
|
||||
return compiler->phase == VSIR_OP_HS_CONTROL_POINT_PHASE;
|
||||
}
|
||||
|
||||
static bool is_in_fork_or_join_phase(const struct spirv_compiler *compiler)
|
||||
{
|
||||
return compiler->phase == VSIR_OP_HS_FORK_PHASE || compiler->phase == VSIR_OP_HS_JOIN_PHASE;
|
||||
}
|
||||
|
||||
static void spirv_compiler_emit_initial_declarations(struct spirv_compiler *compiler);
|
||||
static size_t spirv_compiler_get_current_function_location(struct spirv_compiler *compiler);
|
||||
static void spirv_compiler_emit_main_prolog(struct spirv_compiler *compiler);
|
||||
@@ -5708,7 +5703,7 @@ static void spirv_compiler_emit_input(struct spirv_compiler *compiler,
|
||||
* duplicate declarations are: a single register split into multiple declarations having
|
||||
* different components, which should have been merged, and declarations in one phase
|
||||
* being repeated in another (i.e. vcp/vocp), which should have been deleted. */
|
||||
if (reg_type != VKD3DSPR_INPUT || !is_in_fork_or_join_phase(compiler))
|
||||
if (reg_type != VKD3DSPR_INPUT || !vsir_opcode_is_fork_or_join_phase(compiler->phase))
|
||||
FIXME("Duplicate input definition found.\n");
|
||||
return;
|
||||
}
|
||||
@@ -5902,7 +5897,7 @@ static uint32_t spirv_compiler_emit_shader_phase_builtin_variable(struct spirv_c
|
||||
return *variable_id;
|
||||
|
||||
id = spirv_compiler_emit_builtin_variable_v(compiler, builtin, SpvStorageClassOutput, array_sizes, size_count);
|
||||
if (is_in_fork_or_join_phase(compiler))
|
||||
if (vsir_opcode_is_fork_or_join_phase(compiler->phase))
|
||||
vkd3d_spirv_build_op_decorate(builder, id, SpvDecorationPatch, NULL, 0);
|
||||
|
||||
if (variable_id)
|
||||
@@ -6190,7 +6185,7 @@ static void spirv_compiler_emit_shader_epilogue_function(struct spirv_compiler *
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(param_type_id));
|
||||
STATIC_ASSERT(ARRAY_SIZE(compiler->private_output_variable) == ARRAY_SIZE(compiler->private_output_variable_write_mask));
|
||||
|
||||
is_patch_constant = is_in_fork_or_join_phase(compiler);
|
||||
is_patch_constant = vsir_opcode_is_fork_or_join_phase(compiler->phase);
|
||||
|
||||
signature = is_patch_constant ? &compiler->program->patch_constant_signature
|
||||
: &compiler->program->output_signature;
|
||||
|
||||
@@ -964,11 +964,6 @@ static void shader_sm4_read_dcl_sampler(struct vkd3d_shader_instruction *ins, ui
|
||||
shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.sampler.range.space);
|
||||
}
|
||||
|
||||
static bool sm4_parser_is_in_fork_or_join_phase(const struct vkd3d_shader_sm4_parser *sm4)
|
||||
{
|
||||
return sm4->phase == VSIR_OP_HS_FORK_PHASE || sm4->phase == VSIR_OP_HS_JOIN_PHASE;
|
||||
}
|
||||
|
||||
static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins, uint32_t opcode,
|
||||
uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv)
|
||||
{
|
||||
@@ -997,7 +992,7 @@ static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins
|
||||
signature = &program->input_signature;
|
||||
break;
|
||||
case VKD3DSPR_OUTPUT:
|
||||
if (sm4_parser_is_in_fork_or_join_phase(priv))
|
||||
if (vsir_opcode_is_fork_or_join_phase(priv->phase))
|
||||
{
|
||||
io_masks = priv->patch_constant_register_masks;
|
||||
ranges = &priv->patch_constant_index_ranges;
|
||||
@@ -2319,8 +2314,8 @@ static bool shader_sm4_validate_input_output_register(struct vkd3d_shader_sm4_pa
|
||||
masks = priv->input_register_masks;
|
||||
break;
|
||||
case VKD3DSPR_OUTPUT:
|
||||
masks = sm4_parser_is_in_fork_or_join_phase(priv) ? priv->patch_constant_register_masks
|
||||
: priv->output_register_masks;
|
||||
masks = vsir_opcode_is_fork_or_join_phase(priv->phase)
|
||||
? priv->patch_constant_register_masks : priv->output_register_masks;
|
||||
break;
|
||||
case VKD3DSPR_COLOROUT:
|
||||
case VKD3DSPR_OUTCONTROLPOINT:
|
||||
|
||||
@@ -632,6 +632,11 @@ enum vkd3d_shader_opcode
|
||||
|
||||
const char *vsir_opcode_get_name(enum vkd3d_shader_opcode op, const char *error);
|
||||
|
||||
static inline bool vsir_opcode_is_fork_or_join_phase(enum vkd3d_shader_opcode op)
|
||||
{
|
||||
return op == VSIR_OP_HS_FORK_PHASE || op == VSIR_OP_HS_JOIN_PHASE;
|
||||
}
|
||||
|
||||
enum vkd3d_shader_register_type
|
||||
{
|
||||
VKD3DSPR_TEMP,
|
||||
|
||||
Reference in New Issue
Block a user