Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3dcompiler_43/tests/hlsl_d3d11.c | 4 ++-- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c index 0dbbcc8d029..72b64eb81d7 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d11.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d11.c @@ -564,7 +564,7 @@ static void test_reflection(void) " float b;\n" " float c;\n" " } s;\n" - " float g;\n" + " bool g;\n" " float h[2];\n" " int i;\n" " uint_t j;\n" @@ -605,7 +605,7 @@ static void test_reflection(void) {{"c", 16, 16}, {D3D_SVC_VECTOR, D3D_SVT_FLOAT, 1, 4, 0, 0, 0, "float4"}}, {{"d", 32, 4}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 0, "float"}}, {{"s", 48, 24}, {D3D_SVC_STRUCT, D3D_SVT_VOID, 1, 6, 0, 3, 0, "<unnamed>"}}, - {{"g", 72, 4}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 0, 0, "float"}}, + {{"g", 72, 4}, {D3D_SVC_SCALAR, D3D_SVT_BOOL, 1, 1, 0, 0, 0, "bool"}}, {{"h", 80, 20}, {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 2, 0, 0, "float"}}, {{"i", 100, 4}, {D3D_SVC_SCALAR, D3D_SVT_INT, 1, 1, 0, 0, 0, "int"}}, {{"j", 104, 4}, {D3D_SVC_SCALAR, D3D_SVT_UINT, 1, 1, 0, 0, 0, "uint_t"}}, diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index 83f5b7bdd56..ed148ff112a 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -1025,7 +1025,7 @@ static void test_constant_table(void) "#pragma pack_matrix(row_major)\n" " float2x2 d;\n" "} f;\n" - "uniform float2 g[5];\n" + "uniform bool2 g[5];\n" "uniform matrix_t i;\n" "uniform struct matrix_record j;\n" "uniform matrix<float,3,1> k;\n" @@ -1052,7 +1052,7 @@ static void test_constant_table(void) {"d", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12}, {"e", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4}, {"f", D3DXRS_FLOAT4, 0, 7, D3DXPC_STRUCT, D3DXPT_VOID, 1, 11, 1, 4, 44}, - {"g", D3DXRS_FLOAT4, 0, 5, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 5, 0, 40}, + {"g", D3DXRS_FLOAT4, 0, 5, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 2, 5, 0, 40}, {"i", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 1, 0, 36}, {"j", D3DXRS_FLOAT4, 0, 3, D3DXPC_STRUCT, D3DXPT_VOID, 1, 9, 1, 1, 36}, {"k", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12},
We only emit scalar constants at parse time, and while there's certainly an advantage to vectorizing constant instructions, there's not much point in having hlsl_ir_constant hold matrices. Matrices should be lowered to vector operations first.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3dcompiler_43/d3dcompiler_private.h | 10 ++--- dlls/d3dcompiler_43/utils.c | 51 ++++++++++------------- 2 files changed, 27 insertions(+), 34 deletions(-)
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 23eff210940..3e91f746459 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -874,11 +874,11 @@ struct hlsl_ir_constant struct hlsl_ir_node node; union { - unsigned u[16]; - int i[16]; - float f[16]; - double d[16]; - BOOL b[16]; + unsigned u[4]; + int i[4]; + float f[4]; + double d[4]; + BOOL b[4]; } value; };
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 4bc3b9b0a64..7f0c451ce9c 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -1823,41 +1823,34 @@ static void debug_dump_deref(const struct hlsl_deref *deref) static void debug_dump_ir_constant(const struct hlsl_ir_constant *constant) { struct hlsl_type *type = constant->node.data_type; - unsigned int x, y; + unsigned int x;
- if (type->dimy != 1) + if (type->dimx != 1) wine_dbg_printf("{"); - for (y = 0; y < type->dimy; ++y) + for (x = 0; x < type->dimx; ++x) { - if (type->dimx != 1) - wine_dbg_printf("{"); - for (x = 0; x < type->dimx; ++x) + switch (type->base_type) { - switch (type->base_type) - { - case HLSL_TYPE_FLOAT: - wine_dbg_printf("%.8e ", constant->value.f[y * type->dimx + x]); - break; - case HLSL_TYPE_DOUBLE: - wine_dbg_printf("%.16e ", constant->value.d[y * type->dimx + x]); - break; - case HLSL_TYPE_INT: - wine_dbg_printf("%d ", constant->value.i[y * type->dimx + x]); - break; - case HLSL_TYPE_UINT: - wine_dbg_printf("%u ", constant->value.u[y * type->dimx + x]); - break; - case HLSL_TYPE_BOOL: - wine_dbg_printf("%s ", constant->value.b[y * type->dimx + x] == FALSE ? "false" : "true"); - break; - default: - wine_dbg_printf("Constants of type %s not supported\n", debug_base_type(type)); - } + case HLSL_TYPE_FLOAT: + wine_dbg_printf("%.8e ", constant->value.f[x]); + break; + case HLSL_TYPE_DOUBLE: + wine_dbg_printf("%.16e ", constant->value.d[x]); + break; + case HLSL_TYPE_INT: + wine_dbg_printf("%d ", constant->value.i[x]); + break; + case HLSL_TYPE_UINT: + wine_dbg_printf("%u ", constant->value.u[x]); + break; + case HLSL_TYPE_BOOL: + wine_dbg_printf("%s ", constant->value.b[x] ? "true" : "false"); + break; + default: + wine_dbg_printf("Constants of type %s not supported\n", debug_base_type(type)); } - if (type->dimx != 1) - wine_dbg_printf("}"); } - if (type->dimy != 1) + if (type->dimx != 1) wine_dbg_printf("}"); }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Indeed. Nice!
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Drop a now redundant init_node() in the selection_statement rule, fix patch subject.
dlls/d3dcompiler_43/d3dcompiler_private.h | 4 +- dlls/d3dcompiler_43/hlsl.y | 51 +++++++++++------------ dlls/d3dcompiler_43/utils.c | 18 ++++---- 3 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 3e91f7464598..4bf1ce8f1b1b 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -742,8 +742,8 @@ struct hlsl_ir_if { struct hlsl_ir_node node; struct hlsl_src condition; - struct list *then_instrs; - struct list *else_instrs; + struct list then_instrs; + struct list else_instrs; };
struct hlsl_ir_loop diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 475fd414fd7d..3c9f1bd6048c 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -284,6 +284,19 @@ static BOOL type_is_void(const struct hlsl_type *type) return type->type == HLSL_CLASS_OBJECT && type->base_type == HLSL_TYPE_VOID; }
+static struct hlsl_ir_if *new_if(struct hlsl_ir_node *condition, struct source_location loc) +{ + struct hlsl_ir_if *iff; + + if (!(iff = d3dcompiler_alloc(sizeof(*iff)))) + return NULL; + init_node(&iff->node, HLSL_IR_IF, NULL, loc); + hlsl_src_from_node(&iff->condition, condition); + list_init(&iff->then_instrs); + list_init(&iff->else_instrs); + return iff; +} + static BOOL append_conditional_break(struct list *cond_list) { struct hlsl_ir_node *condition, *not; @@ -302,22 +315,13 @@ static BOOL append_conditional_break(struct list *cond_list) } list_add_tail(cond_list, ¬->entry);
- if (!(iff = d3dcompiler_alloc(sizeof(*iff)))) + if (!(iff = new_if(not, condition->loc))) { ERR("Out of memory.\n"); return FALSE; } - init_node(&iff->node, HLSL_IR_IF, NULL, condition->loc); - hlsl_src_from_node(&iff->condition, not); list_add_tail(cond_list, &iff->node.entry);
- if (!(iff->then_instrs = d3dcompiler_alloc(sizeof(*iff->then_instrs)))) - { - ERR("Out of memory.\n"); - return FALSE; - } - list_init(iff->then_instrs); - if (!(jump = d3dcompiler_alloc(sizeof(*jump)))) { ERR("Out of memory.\n"); @@ -325,7 +329,7 @@ static BOOL append_conditional_break(struct list *cond_list) } init_node(&jump->node, HLSL_IR_JUMP, NULL, condition->loc); jump->type = HLSL_IR_JUMP_BREAK; - list_add_head(iff->then_instrs, &jump->node.entry); + list_add_head(&iff->then_instrs, &jump->node.entry); return TRUE; }
@@ -2211,18 +2215,15 @@ jump_statement:
selection_statement: KW_IF '(' expr ')' if_body { - struct hlsl_ir_if *instr = d3dcompiler_alloc(sizeof(*instr)); struct hlsl_ir_node *condition = node_from_list($3); + struct hlsl_ir_if *instr;
- if (!instr) - { - ERR("Out of memory\n"); + if (!(instr = new_if(condition, get_location(&@1)))) YYABORT; - } - init_node(&instr->node, HLSL_IR_IF, NULL, get_location(&@1)); - hlsl_src_from_node(&instr->condition, condition); - instr->then_instrs = $5.then_instrs; - instr->else_instrs = $5.else_instrs; + list_move_tail(&instr->then_instrs, $5.then_instrs); + list_move_tail(&instr->else_instrs, $5.else_instrs); + d3dcompiler_free($5.then_instrs); + d3dcompiler_free($5.else_instrs); if (condition->data_type->dimx > 1 || condition->data_type->dimy > 1) { hlsl_report_message(instr->node.loc, HLSL_LEVEL_ERROR, @@ -2851,9 +2852,8 @@ static unsigned int index_instructions(struct list *instrs, unsigned int index) if (instr->type == HLSL_IR_IF) { struct hlsl_ir_if *iff = if_from_node(instr); - index = index_instructions(iff->then_instrs, index); - if (iff->else_instrs) - index = index_instructions(iff->else_instrs, index); + index = index_instructions(&iff->then_instrs, index); + index = index_instructions(&iff->else_instrs, index); } else if (instr->type == HLSL_IR_LOOP) { @@ -2902,9 +2902,8 @@ static void compute_liveness_recurse(struct list *instrs, unsigned int loop_firs case HLSL_IR_IF: { struct hlsl_ir_if *iff = if_from_node(instr); - compute_liveness_recurse(iff->then_instrs, loop_first, loop_last); - if (iff->else_instrs) - compute_liveness_recurse(iff->else_instrs, loop_first, loop_last); + compute_liveness_recurse(&iff->then_instrs, loop_first, loop_last); + compute_liveness_recurse(&iff->else_instrs, loop_first, loop_last); iff->condition.node->last_read = instr->index; break; } diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 7f0c451ce9ca..8599ffe69ade 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -2018,14 +2018,10 @@ static void debug_dump_ir_if(const struct hlsl_ir_if *if_node) wine_dbg_printf("if ("); debug_dump_src(&if_node->condition); wine_dbg_printf(")\n{\n"); - debug_dump_instr_list(if_node->then_instrs); + debug_dump_instr_list(&if_node->then_instrs); + wine_dbg_printf("}\nelse\n{\n"); + debug_dump_instr_list(&if_node->else_instrs); wine_dbg_printf("}\n"); - if (if_node->else_instrs) - { - wine_dbg_printf("else\n{\n"); - debug_dump_instr_list(if_node->else_instrs); - wine_dbg_printf("}\n"); - } }
static void debug_dump_ir_loop(const struct hlsl_ir_loop *loop) @@ -2157,8 +2153,12 @@ static void free_ir_assignment(struct hlsl_ir_assignment *assignment)
static void free_ir_if(struct hlsl_ir_if *if_node) { - free_instr_list(if_node->then_instrs); - free_instr_list(if_node->else_instrs); + struct hlsl_ir_node *node, *next_node; + + LIST_FOR_EACH_ENTRY_SAFE(node, next_node, &if_node->then_instrs, struct hlsl_ir_node, entry) + free_instr(node); + LIST_FOR_EACH_ENTRY_SAFE(node, next_node, &if_node->else_instrs, struct hlsl_ir_node, entry) + free_instr(node); hlsl_src_remove(&if_node->condition); d3dcompiler_free(if_node); }
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3dcompiler_43/d3dcompiler_private.h | 4 +- dlls/d3dcompiler_43/hlsl.y | 50 +++++++++++------------ dlls/d3dcompiler_43/utils.c | 18 ++++---- 3 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 3e91f746459..4bf1ce8f1b1 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -742,8 +742,8 @@ struct hlsl_ir_if { struct hlsl_ir_node node; struct hlsl_src condition; - struct list *then_instrs; - struct list *else_instrs; + struct list then_instrs; + struct list else_instrs; };
struct hlsl_ir_loop diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 475fd414fd7..6c6ace12dba 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -284,6 +284,19 @@ static BOOL type_is_void(const struct hlsl_type *type) return type->type == HLSL_CLASS_OBJECT && type->base_type == HLSL_TYPE_VOID; }
+static struct hlsl_ir_if *new_if(struct hlsl_ir_node *condition, struct source_location loc) +{ + struct hlsl_ir_if *iff; + + if (!(iff = d3dcompiler_alloc(sizeof(*iff)))) + return NULL; + init_node(&iff->node, HLSL_IR_IF, NULL, loc); + hlsl_src_from_node(&iff->condition, condition); + list_init(&iff->then_instrs); + list_init(&iff->else_instrs); + return iff; +} + static BOOL append_conditional_break(struct list *cond_list) { struct hlsl_ir_node *condition, *not; @@ -302,22 +315,13 @@ static BOOL append_conditional_break(struct list *cond_list) } list_add_tail(cond_list, ¬->entry);
- if (!(iff = d3dcompiler_alloc(sizeof(*iff)))) + if (!(iff = new_if(not, condition->loc))) { ERR("Out of memory.\n"); return FALSE; } - init_node(&iff->node, HLSL_IR_IF, NULL, condition->loc); - hlsl_src_from_node(&iff->condition, not); list_add_tail(cond_list, &iff->node.entry);
- if (!(iff->then_instrs = d3dcompiler_alloc(sizeof(*iff->then_instrs)))) - { - ERR("Out of memory.\n"); - return FALSE; - } - list_init(iff->then_instrs); - if (!(jump = d3dcompiler_alloc(sizeof(*jump)))) { ERR("Out of memory.\n"); @@ -325,7 +329,7 @@ static BOOL append_conditional_break(struct list *cond_list) } init_node(&jump->node, HLSL_IR_JUMP, NULL, condition->loc); jump->type = HLSL_IR_JUMP_BREAK; - list_add_head(iff->then_instrs, &jump->node.entry); + list_add_head(&iff->then_instrs, &jump->node.entry); return TRUE; }
@@ -2211,18 +2215,16 @@ jump_statement:
selection_statement: KW_IF '(' expr ')' if_body { - struct hlsl_ir_if *instr = d3dcompiler_alloc(sizeof(*instr)); struct hlsl_ir_node *condition = node_from_list($3); + struct hlsl_ir_if *instr;
- if (!instr) - { - ERR("Out of memory\n"); + if (!(instr = new_if(condition, get_location(&@1)))) YYABORT; - } init_node(&instr->node, HLSL_IR_IF, NULL, get_location(&@1)); - hlsl_src_from_node(&instr->condition, condition); - instr->then_instrs = $5.then_instrs; - instr->else_instrs = $5.else_instrs; + list_move_tail(&instr->then_instrs, $5.then_instrs); + list_move_tail(&instr->else_instrs, $5.else_instrs); + d3dcompiler_free($5.then_instrs); + d3dcompiler_free($5.else_instrs); if (condition->data_type->dimx > 1 || condition->data_type->dimy > 1) { hlsl_report_message(instr->node.loc, HLSL_LEVEL_ERROR, @@ -2851,9 +2853,8 @@ static unsigned int index_instructions(struct list *instrs, unsigned int index) if (instr->type == HLSL_IR_IF) { struct hlsl_ir_if *iff = if_from_node(instr); - index = index_instructions(iff->then_instrs, index); - if (iff->else_instrs) - index = index_instructions(iff->else_instrs, index); + index = index_instructions(&iff->then_instrs, index); + index = index_instructions(&iff->else_instrs, index); } else if (instr->type == HLSL_IR_LOOP) { @@ -2902,9 +2903,8 @@ static void compute_liveness_recurse(struct list *instrs, unsigned int loop_firs case HLSL_IR_IF: { struct hlsl_ir_if *iff = if_from_node(instr); - compute_liveness_recurse(iff->then_instrs, loop_first, loop_last); - if (iff->else_instrs) - compute_liveness_recurse(iff->else_instrs, loop_first, loop_last); + compute_liveness_recurse(&iff->then_instrs, loop_first, loop_last); + compute_liveness_recurse(&iff->else_instrs, loop_first, loop_last); iff->condition.node->last_read = instr->index; break; } diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 7f0c451ce9c..8599ffe69ad 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -2018,14 +2018,10 @@ static void debug_dump_ir_if(const struct hlsl_ir_if *if_node) wine_dbg_printf("if ("); debug_dump_src(&if_node->condition); wine_dbg_printf(")\n{\n"); - debug_dump_instr_list(if_node->then_instrs); + debug_dump_instr_list(&if_node->then_instrs); + wine_dbg_printf("}\nelse\n{\n"); + debug_dump_instr_list(&if_node->else_instrs); wine_dbg_printf("}\n"); - if (if_node->else_instrs) - { - wine_dbg_printf("else\n{\n"); - debug_dump_instr_list(if_node->else_instrs); - wine_dbg_printf("}\n"); - } }
static void debug_dump_ir_loop(const struct hlsl_ir_loop *loop) @@ -2157,8 +2153,12 @@ static void free_ir_assignment(struct hlsl_ir_assignment *assignment)
static void free_ir_if(struct hlsl_ir_if *if_node) { - free_instr_list(if_node->then_instrs); - free_instr_list(if_node->else_instrs); + struct hlsl_ir_node *node, *next_node; + + LIST_FOR_EACH_ENTRY_SAFE(node, next_node, &if_node->then_instrs, struct hlsl_ir_node, entry) + free_instr(node); + LIST_FOR_EACH_ENTRY_SAFE(node, next_node, &if_node->else_instrs, struct hlsl_ir_node, entry) + free_instr(node); hlsl_src_remove(&if_node->condition); d3dcompiler_free(if_node); }
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3dcompiler_43/d3dcompiler_private.h | 2 +- dlls/d3dcompiler_43/hlsl.y | 19 +++++++------------ dlls/d3dcompiler_43/utils.c | 7 +++++-- 3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 4bf1ce8f1b1..34e89170696 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -750,7 +750,7 @@ struct hlsl_ir_loop { struct hlsl_ir_node node; /* loop condition is stored in the body (as "if (!condition) break;") */ - struct list *body; + struct list body; unsigned int next_index; /* liveness index of the end of the loop */ };
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 6c6ace12dba..a83794f6570 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -360,24 +360,21 @@ static struct list *create_loop(enum loop_type type, struct list *init, struct l goto oom; init_node(&loop->node, HLSL_IR_LOOP, NULL, loc); list_add_tail(list, &loop->node.entry); - loop->body = d3dcompiler_alloc(sizeof(*loop->body)); - if (!loop->body) - goto oom; - list_init(loop->body); + list_init(&loop->body);
if (!append_conditional_break(cond)) goto oom;
if (type != LOOP_DO_WHILE) - list_move_tail(loop->body, cond); + list_move_tail(&loop->body, cond);
- list_move_tail(loop->body, body); + list_move_tail(&loop->body, body);
if (iter) - list_move_tail(loop->body, iter); + list_move_tail(&loop->body, iter);
if (type == LOOP_DO_WHILE) - list_move_tail(loop->body, cond); + list_move_tail(&loop->body, cond);
d3dcompiler_free(init); d3dcompiler_free(cond); @@ -386,8 +383,6 @@ static struct list *create_loop(enum loop_type type, struct list *init, struct l
oom: ERR("Out of memory.\n"); - if (loop) - d3dcompiler_free(loop->body); d3dcompiler_free(loop); d3dcompiler_free(cond_jump); d3dcompiler_free(list); @@ -2858,7 +2853,7 @@ static unsigned int index_instructions(struct list *instrs, unsigned int index) } else if (instr->type == HLSL_IR_LOOP) { - index = index_instructions(loop_from_node(instr)->body, index); + index = index_instructions(&loop_from_node(instr)->body, index); loop_from_node(instr)->next_index = index; } } @@ -2920,7 +2915,7 @@ static void compute_liveness_recurse(struct list *instrs, unsigned int loop_firs case HLSL_IR_LOOP: { struct hlsl_ir_loop *loop = loop_from_node(instr); - compute_liveness_recurse(loop->body, loop_first ? loop_first : instr->index, + compute_liveness_recurse(&loop->body, loop_first ? loop_first : instr->index, loop_last ? loop_last : loop->next_index); break; } diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 8599ffe69ad..336bf0d9bcf 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -2027,7 +2027,7 @@ static void debug_dump_ir_if(const struct hlsl_ir_if *if_node) static void debug_dump_ir_loop(const struct hlsl_ir_loop *loop) { wine_dbg_printf("for (;;)\n{\n"); - debug_dump_instr_list(loop->body); + debug_dump_instr_list(&loop->body); wine_dbg_printf("}\n"); }
@@ -2165,7 +2165,10 @@ static void free_ir_if(struct hlsl_ir_if *if_node)
static void free_ir_loop(struct hlsl_ir_loop *loop) { - free_instr_list(loop->body); + struct hlsl_ir_node *node, *next_node; + + LIST_FOR_EACH_ENTRY_SAFE(node, next_node, &loop->body, struct hlsl_ir_node, entry) + free_instr(node); d3dcompiler_free(loop); }
This one also has a typo in the subject (s/hlsr/hlsl/). With that fixed up:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com