From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/hlsl.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index b3bc4596..1ab6ae4c 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -214,6 +214,11 @@ struct hlsl_reg bool allocated; };
+/* Types of instruction nodes for the IR. + * Each type of instruction node is associated to a struct with the same name in lower case. + * e.g. for HLSL_IR_CONSTANT there exists struct hlsl_ir_constant. + * Each one of these structs start with a struct hlsl_ir_node field, so pointers to values of these + * types can be casted seamlessly to (struct hlsl_ir_node *) and vice-versa. */ enum hlsl_ir_node_type { HLSL_IR_CONSTANT, @@ -228,12 +233,21 @@ enum hlsl_ir_node_type HLSL_IR_SWIZZLE, };
+/* Common data for every type of IR instruction node. */ struct hlsl_ir_node { + /* Item entry for storing the instruction in a list of instructions. Usually hlsl_block.instrs, + * but also hlsl_ctx.static_initializers. */ struct list entry; + + /* Type of node, which means that a pointer to this struct hlsl_ir_node can be casted to a + * pointer to the struct with the same name. */ enum hlsl_ir_node_type type; + /* HLSL data type of the node, when used as an expression. */ struct hlsl_type *data_type;
+ /* Container entry for hlsl_src.entry fields, containing all the struct hlsl_srcĀ·s that point + * to this node. */ struct list uses;
struct vkd3d_shader_location loc; @@ -243,6 +257,7 @@ struct hlsl_ir_node * true even for loops, since currently we can't have a reference to a * value generated in an earlier iteration of the loop. */ unsigned int index, last_read; + /* Temp. register allocated to store the result of this instruction (if any). */ struct hlsl_reg reg; };