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_control_point_phase().
This commit is contained in:
committed by
Henri Verbeet
parent
59ba079ebb
commit
e00bc4b91b
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
@@ -3274,11 +3274,6 @@ struct control_point_normaliser
|
||||
struct vkd3d_shader_src_param *outpointid_param;
|
||||
};
|
||||
|
||||
static bool control_point_normaliser_is_in_control_point_phase(const struct control_point_normaliser *normaliser)
|
||||
{
|
||||
return normaliser->phase == VSIR_OP_HS_CONTROL_POINT_PHASE;
|
||||
}
|
||||
|
||||
struct vkd3d_shader_src_param *vsir_program_create_outpointid_param(struct vsir_program *program)
|
||||
{
|
||||
struct vkd3d_shader_src_param *rel_addr;
|
||||
@@ -3298,7 +3293,7 @@ static void shader_dst_param_normalise_outpointid(struct vkd3d_shader_dst_param
|
||||
{
|
||||
struct vkd3d_shader_register *reg = &dst_param->reg;
|
||||
|
||||
if (control_point_normaliser_is_in_control_point_phase(normaliser) && reg->type == VKD3DSPR_OUTPUT)
|
||||
if (vsir_opcode_is_control_point_phase(normaliser->phase) && reg->type == VKD3DSPR_OUTPUT)
|
||||
{
|
||||
/* The TPF reader validates idx_count. */
|
||||
VKD3D_ASSERT(reg->idx_count == 1);
|
||||
|
||||
@@ -3019,11 +3019,6 @@ static bool is_in_default_phase(const struct spirv_compiler *compiler)
|
||||
return compiler->phase == VSIR_OP_INVALID;
|
||||
}
|
||||
|
||||
static bool is_in_control_point_phase(const struct spirv_compiler *compiler)
|
||||
{
|
||||
return compiler->phase == VSIR_OP_HS_CONTROL_POINT_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);
|
||||
@@ -5457,7 +5452,8 @@ static const struct vkd3d_shader_phase *spirv_compiler_get_current_shader_phase(
|
||||
if (is_in_default_phase(compiler))
|
||||
return NULL;
|
||||
|
||||
return is_in_control_point_phase(compiler) ? &compiler->control_point_phase : &compiler->patch_constant_phase;
|
||||
return vsir_opcode_is_control_point_phase(compiler->phase)
|
||||
? &compiler->control_point_phase : &compiler->patch_constant_phase;
|
||||
}
|
||||
|
||||
static void spirv_compiler_decorate_xfb_output(struct spirv_compiler *compiler,
|
||||
@@ -6219,7 +6215,7 @@ static void spirv_compiler_emit_shader_epilogue_function(struct spirv_compiler *
|
||||
param_id[i] = vkd3d_spirv_build_op_load(builder, type_id, param_id[i], SpvMemoryAccessMaskNone);
|
||||
}
|
||||
|
||||
if (is_in_control_point_phase(compiler))
|
||||
if (vsir_opcode_is_control_point_phase(compiler->phase))
|
||||
output_index_id = spirv_compiler_emit_load_invocation_id(compiler);
|
||||
|
||||
for (i = 0; i < signature->element_count; ++i)
|
||||
@@ -7254,7 +7250,7 @@ static void spirv_compiler_leave_shader_phase(struct spirv_compiler *compiler)
|
||||
|
||||
vkd3d_spirv_build_op_function_end(builder);
|
||||
|
||||
if (is_in_control_point_phase(compiler))
|
||||
if (vsir_opcode_is_control_point_phase(compiler->phase))
|
||||
{
|
||||
if (compiler->epilogue_function_id)
|
||||
{
|
||||
@@ -7291,8 +7287,8 @@ static void spirv_compiler_enter_shader_phase(struct spirv_compiler *compiler,
|
||||
compiler->phase = instruction->opcode;
|
||||
spirv_compiler_emit_shader_phase_name(compiler, function_id, NULL);
|
||||
|
||||
phase = (instruction->opcode == VSIR_OP_HS_CONTROL_POINT_PHASE)
|
||||
? &compiler->control_point_phase : &compiler->patch_constant_phase;
|
||||
phase = vsir_opcode_is_control_point_phase(instruction->opcode)
|
||||
? &compiler->control_point_phase : &compiler->patch_constant_phase;
|
||||
phase->function_id = function_id;
|
||||
/* The insertion location must be set after the label is emitted. */
|
||||
phase->function_location = 0;
|
||||
@@ -7305,8 +7301,8 @@ static void spirv_compiler_initialise_block(struct spirv_compiler *compiler)
|
||||
/* Insertion locations must point immediately after the function's initial label. */
|
||||
if (compiler->shader_type == VKD3D_SHADER_TYPE_HULL)
|
||||
{
|
||||
struct vkd3d_shader_phase *phase = (compiler->phase == VSIR_OP_HS_CONTROL_POINT_PHASE)
|
||||
? &compiler->control_point_phase : &compiler->patch_constant_phase;
|
||||
struct vkd3d_shader_phase *phase = vsir_opcode_is_control_point_phase(compiler->phase)
|
||||
? &compiler->control_point_phase : &compiler->patch_constant_phase;
|
||||
if (!phase->function_location)
|
||||
phase->function_location = vkd3d_spirv_stream_current_location(&builder->function_stream);
|
||||
}
|
||||
@@ -8357,7 +8353,7 @@ static void spirv_compiler_emit_return(struct spirv_compiler *compiler,
|
||||
spirv_compiler_end_invocation_interlock(compiler);
|
||||
|
||||
if (compiler->shader_type != VKD3D_SHADER_TYPE_GEOMETRY && (is_in_default_phase(compiler)
|
||||
|| is_in_control_point_phase(compiler)))
|
||||
|| vsir_opcode_is_control_point_phase(compiler->phase)))
|
||||
spirv_compiler_emit_shader_epilogue_invocation(compiler);
|
||||
|
||||
vkd3d_spirv_build_op_return(builder);
|
||||
|
||||
@@ -2280,7 +2280,7 @@ static bool register_is_control_point_input(const struct vkd3d_shader_register *
|
||||
const struct vkd3d_shader_sm4_parser *priv)
|
||||
{
|
||||
return reg->type == VKD3DSPR_INCONTROLPOINT || reg->type == VKD3DSPR_OUTCONTROLPOINT
|
||||
|| (reg->type == VKD3DSPR_INPUT && (priv->phase == VSIR_OP_HS_CONTROL_POINT_PHASE
|
||||
|| (reg->type == VKD3DSPR_INPUT && (vsir_opcode_is_control_point_phase(priv->phase)
|
||||
|| priv->program->shader_version.type == VKD3D_SHADER_TYPE_GEOMETRY));
|
||||
}
|
||||
|
||||
@@ -2656,7 +2656,7 @@ static void shader_sm4_read_instruction(struct vkd3d_shader_sm4_parser *sm4, str
|
||||
if (ins->opcode == VSIR_OP_HS_CONTROL_POINT_PHASE || ins->opcode == VSIR_OP_HS_FORK_PHASE
|
||||
|| ins->opcode == VSIR_OP_HS_JOIN_PHASE)
|
||||
sm4->phase = ins->opcode;
|
||||
sm4->has_control_point_phase |= ins->opcode == VSIR_OP_HS_CONTROL_POINT_PHASE;
|
||||
sm4->has_control_point_phase |= vsir_opcode_is_control_point_phase(ins->opcode);
|
||||
ins->flags = 0;
|
||||
ins->coissue = false;
|
||||
ins->raw = false;
|
||||
|
||||
@@ -637,6 +637,11 @@ 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;
|
||||
}
|
||||
|
||||
static inline bool vsir_opcode_is_control_point_phase(enum vkd3d_shader_opcode op)
|
||||
{
|
||||
return op == VSIR_OP_HS_CONTROL_POINT_PHASE;
|
||||
}
|
||||
|
||||
enum vkd3d_shader_register_type
|
||||
{
|
||||
VKD3DSPR_TEMP,
|
||||
|
||||
Reference in New Issue
Block a user