d3dcompiler: Store the arguments to a hlsl_ir_constructor as a fixed array.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f9f1e99099
commit
c22f64bceb
|
@ -952,7 +952,8 @@ struct hlsl_ir_constant
|
|||
struct hlsl_ir_constructor
|
||||
{
|
||||
struct hlsl_ir_node node;
|
||||
struct list *arguments;
|
||||
struct hlsl_ir_node *args[16];
|
||||
unsigned int args_count;
|
||||
};
|
||||
|
||||
struct hlsl_scope
|
||||
|
|
|
@ -2092,6 +2092,7 @@ postfix_expr: primary_expr
|
|||
| var_modifiers type '(' initializer_expr_list ')'
|
||||
{
|
||||
struct hlsl_ir_constructor *constructor;
|
||||
struct hlsl_ir_node *instr;
|
||||
|
||||
TRACE("%s constructor.\n", debug_hlsl_type($2));
|
||||
if ($1)
|
||||
|
@ -2120,7 +2121,12 @@ postfix_expr: primary_expr
|
|||
constructor->node.type = HLSL_IR_CONSTRUCTOR;
|
||||
set_location(&constructor->node.loc, &@3);
|
||||
constructor->node.data_type = $2;
|
||||
constructor->arguments = $4;
|
||||
constructor->args_count = 0;
|
||||
LIST_FOR_EACH_ENTRY(instr, $4, struct hlsl_ir_node, entry)
|
||||
{
|
||||
constructor->args[constructor->args_count++] = instr;
|
||||
}
|
||||
d3dcompiler_free($4);
|
||||
|
||||
$$ = &constructor->node;
|
||||
}
|
||||
|
|
|
@ -2122,12 +2122,12 @@ static void debug_dump_ir_expr(const struct hlsl_ir_expr *expr)
|
|||
|
||||
static void debug_dump_ir_constructor(const struct hlsl_ir_constructor *constructor)
|
||||
{
|
||||
struct hlsl_ir_node *arg;
|
||||
unsigned int i;
|
||||
|
||||
TRACE("%s (", debug_hlsl_type(constructor->node.data_type));
|
||||
LIST_FOR_EACH_ENTRY(arg, constructor->arguments, struct hlsl_ir_node, entry)
|
||||
for (i = 0; i < constructor->args_count; ++i)
|
||||
{
|
||||
debug_dump_instr(arg);
|
||||
debug_dump_instr(constructor->args[i]);
|
||||
TRACE(" ");
|
||||
}
|
||||
TRACE(")");
|
||||
|
@ -2349,7 +2349,9 @@ static void free_ir_swizzle(struct hlsl_ir_swizzle *swizzle)
|
|||
|
||||
static void free_ir_constructor(struct hlsl_ir_constructor *constructor)
|
||||
{
|
||||
free_instr_list(constructor->arguments);
|
||||
unsigned int i;
|
||||
for (i = 0; i < constructor->args_count; ++i)
|
||||
free_instr(constructor->args[i]);
|
||||
d3dcompiler_free(constructor);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue