vkd3d-shader/hlsl: Introduce hlsl_ir_vsir_instruction_ref, again.

This node type will be deleted (again) once the hlsl->vsir->tpf
translation is complete. It serves the purpose of allowing to keep
both real hlsl_ir_nodes and vsir_instructions in the hlsl_block,
until all the former can be translated into the latter.
This commit is contained in:
Francisco Casas
2024-05-22 14:10:42 -04:00
committed by Henri Verbeet
parent cf7fade580
commit 158bf794e6
Notes: Henri Verbeet 2024-10-24 21:02:04 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1210
4 changed files with 58 additions and 0 deletions

View File

@@ -328,6 +328,8 @@ enum hlsl_ir_node_type
HLSL_IR_COMPILE,
HLSL_IR_SAMPLER_STATE,
HLSL_IR_STATEBLOCK_CONSTANT,
HLSL_IR_VSIR_INSTRUCTION_REF,
};
/* Common data for every type of IR instruction node. */
@@ -930,6 +932,16 @@ struct hlsl_ir_stateblock_constant
char *name;
};
/* A vkd3d_shader_instruction that can be inserted in a hlsl_block.
* Only used for the HLSL IR to vsir translation, might be removed once this translation is complete. */
struct hlsl_ir_vsir_instruction_ref
{
struct hlsl_ir_node node;
/* Index to a vkd3d_shader_instruction within a vkd3d_shader_instruction_array in a vsir_program. */
unsigned int vsir_instr_idx;
};
struct hlsl_scope
{
/* Item entry for hlsl_ctx.scopes. */
@@ -1245,6 +1257,12 @@ static inline struct hlsl_ir_stateblock_constant *hlsl_ir_stateblock_constant(co
return CONTAINING_RECORD(node, struct hlsl_ir_stateblock_constant, node);
}
static inline struct hlsl_ir_vsir_instruction_ref *hlsl_ir_vsir_instruction_ref(const struct hlsl_ir_node *node)
{
VKD3D_ASSERT(node->type == HLSL_IR_VSIR_INSTRUCTION_REF);
return CONTAINING_RECORD(node, struct hlsl_ir_vsir_instruction_ref, node);
}
static inline void hlsl_block_init(struct hlsl_block *block)
{
list_init(&block->instrs);
@@ -1570,6 +1588,9 @@ struct hlsl_ir_switch_case *hlsl_new_switch_case(struct hlsl_ctx *ctx, unsigned
struct hlsl_ir_node *hlsl_new_switch(struct hlsl_ctx *ctx, struct hlsl_ir_node *selector,
struct list *cases, const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_vsir_instruction_ref(struct hlsl_ctx *ctx, unsigned int vsir_instr_idx,
struct hlsl_type *type, const struct hlsl_reg *reg, const struct vkd3d_shader_location *loc);
void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc,
enum vkd3d_shader_error error, const char *fmt, ...) VKD3D_PRINTF_FUNC(4, 5);
void hlsl_fixme(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc,