-- v3: vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from add_conditional(). vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_uint_constant(). vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_swizzle(). vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_store_index(). vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_simple_store(). vkd3d-shader/hlsl: Return bool from hlsl_new_store_component().
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.c | 8 ++++---- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 19 +++++++------------ 3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 253437a7..54bfd3ba 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1105,7 +1105,7 @@ struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hl return store; }
-struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, +bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs) { struct hlsl_block comp_path_block; @@ -1114,13 +1114,13 @@ struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl hlsl_block_init(block);
if (!(store = hlsl_alloc(ctx, sizeof(*store)))) - return NULL; + return false; init_node(&store->node, HLSL_IR_STORE, NULL, &rhs->loc);
if (!init_deref_from_component_index(ctx, &comp_path_block, &store->lhs, lhs, comp, &rhs->loc)) { vkd3d_free(store); - return NULL; + return false; } hlsl_block_add_block(block, &comp_path_block); hlsl_src_from_node(&store->rhs, rhs); @@ -1130,7 +1130,7 @@ struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl
hlsl_block_add_instr(block, &store->node);
- return store; + return true; }
struct hlsl_ir_node *hlsl_new_call(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *decl, diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index a3453538..fc410e26 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1125,7 +1125,7 @@ struct hlsl_ir_node *hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_b struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs); struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc); -struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, +bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs);
bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index a3ddae51..58aef12e 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -313,7 +313,6 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs, { struct hlsl_ir_node *component_load; struct hlsl_type *dst_comp_type; - struct hlsl_ir_store *store; struct hlsl_block block; unsigned int src_idx;
@@ -341,7 +340,7 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs, return NULL; list_add_tail(instrs, &cast->entry);
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, dst_idx, cast))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, dst_idx, cast)) return NULL; list_move_tail(instrs, &block.instrs); } @@ -1276,7 +1275,6 @@ static struct hlsl_ir_node *add_expr(struct hlsl_ctx *ctx, struct list *instrs, for (i = 0; i < type->dimy * type->dimx; ++i) { struct hlsl_ir_node *value, *cell_operands[HLSL_MAX_OPERANDS] = { NULL }; - struct hlsl_ir_store *store; struct hlsl_block block; unsigned int j;
@@ -1294,7 +1292,7 @@ static struct hlsl_ir_node *add_expr(struct hlsl_ctx *ctx, struct list *instrs, if (!(value = add_expr(ctx, instrs, op, cell_operands, scalar_type, loc))) return NULL;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, i, value))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, i, value)) return NULL; list_move_tail(instrs, &block.instrs); } @@ -1860,7 +1858,6 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct list *instrs, { struct hlsl_ir_node *conv, *load; struct hlsl_type *dst_comp_type; - struct hlsl_ir_store *store; struct hlsl_block block;
if (!(load = add_load_component(ctx, instrs, src, k, &src->loc))) @@ -1871,7 +1868,7 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct list *instrs, if (!(conv = add_implicit_conversion(ctx, instrs, load, dst_comp_type, &src->loc))) return;
- if (!(store = hlsl_new_store_component(ctx, &block, &dst_deref, *store_index, conv))) + if (!hlsl_new_store_component(ctx, &block, &dst_deref, *store_index, conv)) return; list_move_tail(instrs, &block.instrs);
@@ -2881,7 +2878,7 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx, if (!(diffuse = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MAX, n_l, zero, loc))) return false;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, 1, diffuse))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, 1, diffuse)) return false; list_move_tail(params->instrs, &block.instrs);
@@ -2901,7 +2898,7 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx, if (!(load = hlsl_add_conditional(ctx, params->instrs, specular_or, zero, specular_pow))) return false;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, 2, &load->node))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, 2, &load->node)) return false; list_move_tail(params->instrs, &block.instrs);
@@ -3034,7 +3031,6 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx, for (j = 0; j < matrix_type->dimy; ++j) { struct hlsl_ir_node *instr = NULL; - struct hlsl_ir_store *store; struct hlsl_block block;
for (k = 0; k < cast_type1->dimx && k < cast_type2->dimy; ++k) @@ -3061,7 +3057,7 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx, } }
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, j * matrix_type->dimx + i, instr))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, j * matrix_type->dimx + i, instr)) return false; list_move_tail(params->instrs, &block.instrs); } @@ -3398,13 +3394,12 @@ static bool intrinsic_transpose(struct hlsl_ctx *ctx, { for (j = 0; j < arg_type->dimy; ++j) { - struct hlsl_ir_store *store; struct hlsl_block block;
if (!(load = add_load_component(ctx, params->instrs, arg, j * arg->data_type->dimx + i, loc))) return false;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, i * var->data_type->dimx + j, load))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, i * var->data_type->dimx + j, load)) return false; list_move_tail(params->instrs, &block.instrs); }
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.c | 12 +++++++----- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 30 +++++++++++++----------------- libs/vkd3d-shader/hlsl_codegen.c | 26 ++++++++++++-------------- 4 files changed, 33 insertions(+), 37 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 54bfd3ba..58d5c514 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1065,12 +1065,15 @@ static void init_node(struct hlsl_ir_node *node, enum hlsl_ir_node_type type, list_init(&node->uses); }
-struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs) +struct hlsl_ir_node *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs) { + struct hlsl_ir_store *store; struct hlsl_deref lhs_deref;
hlsl_init_simple_deref_from_var(&lhs_deref, lhs); - return hlsl_new_store_index(ctx, &lhs_deref, NULL, rhs, 0, &rhs->loc); + if (!(store = hlsl_new_store_index(ctx, &lhs_deref, NULL, rhs, 0, &rhs->loc))) + return NULL; + return &store->node; }
struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, @@ -1765,9 +1768,8 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type, const struct hlsl_func_parameters *parameters, const struct hlsl_semantic *semantic, const struct vkd3d_shader_location *loc) { + struct hlsl_ir_node *constant, *store; struct hlsl_ir_function_decl *decl; - struct hlsl_ir_node *constant; - struct hlsl_ir_store *store;
if (!(decl = hlsl_alloc(ctx, sizeof(*decl)))) return NULL; @@ -1796,7 +1798,7 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx,
if (!(store = hlsl_new_simple_store(ctx, decl->early_return_var, constant))) return decl; - hlsl_block_add_instr(&decl->body, &store->node); + hlsl_block_add_instr(&decl->body, store);
return decl; } diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index fc410e26..f5d73d48 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1122,7 +1122,7 @@ struct hlsl_ir_load *hlsl_new_load_index(struct hlsl_ctx *ctx, const struct hlsl struct hlsl_ir_node *hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *deref, unsigned int comp, const struct vkd3d_shader_location *loc);
-struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs); +struct hlsl_ir_node *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs); struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc); bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 58aef12e..e3c0a831 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -635,14 +635,14 @@ static bool add_return(struct hlsl_ctx *ctx, struct list *instrs, { if (return_value) { - struct hlsl_ir_store *store; + struct hlsl_ir_node *store;
if (!(return_value = add_implicit_conversion(ctx, instrs, return_value, return_type, loc))) return false;
if (!(store = hlsl_new_simple_store(ctx, ctx->cur_function->return_var, return_value))) return false; - list_add_after(&return_value->entry, &store->node.entry); + list_add_after(&return_value->entry, &store->entry); } else { @@ -666,22 +666,20 @@ static bool add_return(struct hlsl_ctx *ctx, struct list *instrs, static struct hlsl_ir_node *add_load_component(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *var_instr, unsigned int comp, const struct vkd3d_shader_location *loc) { - const struct hlsl_deref *src; - struct hlsl_ir_store *store; - struct hlsl_ir_node *load; + struct hlsl_ir_node *load, *store; struct hlsl_block block; struct hlsl_ir_var *var; + struct hlsl_deref src;
if (!(var = hlsl_new_synthetic_var(ctx, "deref", var_instr->data_type, &var_instr->loc))) return NULL;
if (!(store = hlsl_new_simple_store(ctx, var, var_instr))) return NULL; - list_add_tail(instrs, &store->node.entry); + list_add_tail(instrs, &store->entry);
- src = &store->lhs; - - if (!(load = hlsl_new_load_component(ctx, &block, src, comp, loc))) + hlsl_init_simple_deref_from_var(&src, var); + if (!(load = hlsl_new_load_component(ctx, &block, &src, comp, loc))) return NULL; list_move_tail(instrs, &block.instrs);
@@ -2164,9 +2162,8 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t } else if (var->storage_modifiers & HLSL_STORAGE_STATIC) { + struct hlsl_ir_node *cast, *store; struct hlsl_ir_constant *zero; - struct hlsl_ir_store *store; - struct hlsl_ir_node *cast;
/* Initialize statics to zero by default. */
@@ -2194,7 +2191,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t vkd3d_free(v); continue; } - list_add_tail(&ctx->static_initializers, &store->node.entry); + list_add_tail(&ctx->static_initializers, &store->entry); } vkd3d_free(v); } @@ -2826,9 +2823,8 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { struct hlsl_ir_node *n_l_neg, *n_h_neg, *specular_or, *specular_pow; - struct hlsl_ir_node *n_l, *n_h, *m, *diffuse, *zero; + struct hlsl_ir_node *n_l, *n_h, *m, *diffuse, *zero, *store; struct hlsl_ir_constant *init; - struct hlsl_ir_store *store; struct hlsl_deref var_deref; struct hlsl_type *ret_type; struct hlsl_ir_load *load; @@ -2868,7 +2864,7 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx,
if (!(store = hlsl_new_simple_store(ctx, var, &init->node))) return false; - list_add_tail(params->instrs, &store->node.entry); + list_add_tail(params->instrs, &store->entry);
if (!(zero = hlsl_new_float_constant(ctx, 0.0f, loc))) return false; @@ -3561,11 +3557,11 @@ static struct list *add_call(struct hlsl_ctx *ctx, const char *name,
if (param->storage_modifiers & HLSL_STORAGE_IN) { - struct hlsl_ir_store *store; + struct hlsl_ir_node *store;
if (!(store = hlsl_new_simple_store(ctx, param, arg))) goto fail; - list_add_tail(args->instrs, &store->node.entry); + list_add_tail(args->instrs, &store->entry); } }
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 078e87a2..40d19eed 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -191,7 +191,7 @@ static void prepend_uniform_copy(struct hlsl_ctx *ctx, struct list *instrs, stru { struct vkd3d_string_buffer *name; struct hlsl_ir_var *uniform; - struct hlsl_ir_store *store; + struct hlsl_ir_node *store; struct hlsl_ir_load *load;
/* Use the synthetic name for the temp, rather than the uniform, so that we @@ -218,7 +218,7 @@ static void prepend_uniform_copy(struct hlsl_ctx *ctx, struct list *instrs, stru
if (!(store = hlsl_new_simple_store(ctx, temp, &load->node))) return; - list_add_after(&load->node.entry, &store->node.entry); + list_add_after(&load->node.entry, &store->entry); }
static void validate_field_semantic(struct hlsl_ctx *ctx, struct hlsl_struct_field *field) @@ -480,7 +480,7 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
for (i = 0; i < hlsl_type_major_size(type); ++i) { - struct hlsl_ir_store *store; + struct hlsl_ir_node *store; struct hlsl_ir_var *output; struct hlsl_ir_load *load;
@@ -508,7 +508,7 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
if (!(store = hlsl_new_simple_store(ctx, output, &load->node))) return; - list_add_tail(instrs, &store->node.entry); + list_add_tail(instrs, &store->entry); } }
@@ -760,8 +760,7 @@ static bool lower_return(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *fun else if (instr->type == HLSL_IR_JUMP) { struct hlsl_ir_jump *jump = hlsl_ir_jump(instr); - struct hlsl_ir_node *constant; - struct hlsl_ir_store *store; + struct hlsl_ir_node *constant, *store;
if (jump->type == HLSL_IR_JUMP_RETURN) { @@ -771,7 +770,7 @@ static bool lower_return(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *fun
if (!(store = hlsl_new_simple_store(ctx, func->early_return_var, constant))) return false; - list_add_after(&constant->entry, &store->node.entry); + list_add_after(&constant->entry, &store->entry);
has_early_return = true; if (in_loop) @@ -906,11 +905,10 @@ static struct hlsl_ir_node *add_zero_mipmap_level(struct hlsl_ctx *ctx, struct h * resource access. */ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { + struct hlsl_ir_node *val, *store; struct hlsl_deref var_deref; struct hlsl_ir_index *index; - struct hlsl_ir_store *store; struct hlsl_ir_load *load; - struct hlsl_ir_node *val; struct hlsl_ir_var *var;
if (instr->type != HLSL_IR_INDEX) @@ -950,7 +948,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
if (!(store = hlsl_new_simple_store(ctx, var, val))) return false; - list_add_before(&instr->entry, &store->node.entry); + list_add_before(&instr->entry, &store->entry);
if (hlsl_index_is_noncontiguous(index)) { @@ -966,6 +964,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
for (i = 0; i < mat->data_type->dimx; ++i) { + struct hlsl_ir_store *store; struct hlsl_ir_constant *c;
if (!(c = hlsl_new_uint_constant(ctx, i, &instr->loc))) @@ -2192,9 +2191,8 @@ struct hlsl_ir_load *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *ins struct hlsl_ir_node *condition, struct hlsl_ir_node *if_true, struct hlsl_ir_node *if_false) { struct hlsl_block then_block, else_block; - struct hlsl_ir_store *store; + struct hlsl_ir_node *iff, *store; struct hlsl_ir_load *load; - struct hlsl_ir_node *iff; struct hlsl_ir_var *var;
assert(hlsl_types_are_equal(if_true->data_type, if_false->data_type)); @@ -2207,11 +2205,11 @@ struct hlsl_ir_load *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *ins
if (!(store = hlsl_new_simple_store(ctx, var, if_true))) return NULL; - hlsl_block_add_instr(&then_block, &store->node); + hlsl_block_add_instr(&then_block, store);
if (!(store = hlsl_new_simple_store(ctx, var, if_false))) return NULL; - hlsl_block_add_instr(&else_block, &store->node); + hlsl_block_add_instr(&else_block, store);
if (!(iff = hlsl_new_if(ctx, condition, &then_block, &else_block, &condition->loc))) return NULL;
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.c | 9 +++------ libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 9 ++++----- libs/vkd3d-shader/hlsl_codegen.c | 24 +++++++++++------------- 4 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 58d5c514..e57e26c0 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1067,16 +1067,13 @@ static void init_node(struct hlsl_ir_node *node, enum hlsl_ir_node_type type,
struct hlsl_ir_node *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs) { - struct hlsl_ir_store *store; struct hlsl_deref lhs_deref;
hlsl_init_simple_deref_from_var(&lhs_deref, lhs); - if (!(store = hlsl_new_store_index(ctx, &lhs_deref, NULL, rhs, 0, &rhs->loc))) - return NULL; - return &store->node; + return hlsl_new_store_index(ctx, &lhs_deref, NULL, rhs, 0, &rhs->loc); }
-struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, +struct hlsl_ir_node *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc) { struct hlsl_ir_store *store; @@ -1105,7 +1102,7 @@ struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hl writemask = (1 << rhs->data_type->dimx) - 1; store->writemask = writemask;
- return store; + return &store->node; }
bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index f5d73d48..6693d43e 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1123,7 +1123,7 @@ struct hlsl_ir_node *hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_b const struct hlsl_deref *deref, unsigned int comp, const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs); -struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, +struct hlsl_ir_node *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc); bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index e3c0a831..3a9ad33d 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1753,8 +1753,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
for (i = 0; i < mat->data_type->dimx; ++i) { - struct hlsl_ir_node *cell, *load; - struct hlsl_ir_store *store; + struct hlsl_ir_node *cell, *load, *store; struct hlsl_ir_constant *c; struct hlsl_deref deref;
@@ -1780,13 +1779,13 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in hlsl_cleanup_deref(&deref); return NULL; } - list_add_tail(instrs, &store->node.entry); + list_add_tail(instrs, &store->entry); hlsl_cleanup_deref(&deref); } } else { - struct hlsl_ir_store *store; + struct hlsl_ir_node *store; struct hlsl_deref deref;
if (!hlsl_init_deref_from_index_chain(ctx, &deref, lhs)) @@ -1797,7 +1796,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in hlsl_cleanup_deref(&deref); return NULL; } - list_add_tail(instrs, &store->node.entry); + list_add_tail(instrs, &store->entry); hlsl_cleanup_deref(&deref); }
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 40d19eed..3254739b 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -353,10 +353,9 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
for (i = 0; i < hlsl_type_major_size(type); ++i) { - struct hlsl_ir_store *store; + struct hlsl_ir_node *store, *cast; struct hlsl_ir_var *input; struct hlsl_ir_load *load; - struct hlsl_ir_node *cast;
if (!(input = add_semantic_var(ctx, var, vector_type_src, modifiers, semantic, semantic_index + i, false, loc))) @@ -378,7 +377,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
if (!(store = hlsl_new_store_index(ctx, &lhs->src, &c->node, cast, 0, &var->loc))) return; - list_add_after(&c->node.entry, &store->node.entry); + list_add_after(&c->node.entry, &store->entry); } else { @@ -386,7 +385,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
if (!(store = hlsl_new_store_index(ctx, &lhs->src, NULL, cast, 0, &var->loc))) return; - list_add_after(&cast->entry, &store->node.entry); + list_add_after(&cast->entry, &store->entry); } } } @@ -868,7 +867,7 @@ static struct hlsl_ir_node *add_zero_mipmap_level(struct hlsl_ctx *ctx, struct h struct hlsl_ir_load *coords_load; struct hlsl_deref coords_deref; struct hlsl_ir_constant *zero; - struct hlsl_ir_store *store; + struct hlsl_ir_node *store; struct hlsl_ir_var *coords;
assert(dim_count < 4); @@ -880,19 +879,19 @@ static struct hlsl_ir_node *add_zero_mipmap_level(struct hlsl_ctx *ctx, struct h hlsl_init_simple_deref_from_var(&coords_deref, coords); if (!(store = hlsl_new_store_index(ctx, &coords_deref, NULL, index, (1u << dim_count) - 1, loc))) return NULL; - list_add_after(&index->entry, &store->node.entry); + list_add_after(&index->entry, &store->entry);
if (!(zero = hlsl_new_uint_constant(ctx, 0, loc))) return NULL; - list_add_after(&store->node.entry, &zero->node.entry); + list_add_after(&store->entry, &zero->node.entry);
if (!(store = hlsl_new_store_index(ctx, &coords_deref, NULL, &zero->node, 1u << dim_count, loc))) return NULL; - list_add_after(&zero->node.entry, &store->node.entry); + list_add_after(&zero->node.entry, &store->entry);
if (!(coords_load = hlsl_new_var_load(ctx, coords, loc))) return NULL; - list_add_after(&store->node.entry, &coords_load->node.entry); + list_add_after(&store->entry, &coords_load->node.entry);
return &coords_load->node; } @@ -964,7 +963,6 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
for (i = 0; i < mat->data_type->dimx; ++i) { - struct hlsl_ir_store *store; struct hlsl_ir_constant *c;
if (!(c = hlsl_new_uint_constant(ctx, i, &instr->loc))) @@ -981,7 +979,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
if (!(store = hlsl_new_store_index(ctx, &row_deref, &c->node, &load->node, 0, &instr->loc))) return false; - list_add_before(&instr->entry, &store->node.entry); + list_add_before(&instr->entry, &store->entry); }
if (!(load = hlsl_new_var_load(ctx, var, &instr->loc))) @@ -1769,7 +1767,7 @@ static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store, const struct hlsl_ir_load *load, const unsigned int idx, struct hlsl_type *type) { - struct hlsl_ir_store *split_store; + struct hlsl_ir_node *split_store; struct hlsl_ir_load *split_load; struct hlsl_ir_constant *c;
@@ -1783,7 +1781,7 @@ static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store,
if (!(split_store = hlsl_new_store_index(ctx, &store->lhs, &c->node, &split_load->node, 0, &store->node.loc))) return false; - list_add_before(&store->node.entry, &split_store->node.entry); + list_add_before(&store->node.entry, &split_store->entry);
return true; }
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.c | 12 ++++------- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 36 +++++++++++++++---------------- libs/vkd3d-shader/hlsl_codegen.c | 37 ++++++++++++++------------------ 4 files changed, 38 insertions(+), 49 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index e57e26c0..78dc10ef 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1373,7 +1373,7 @@ struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct return &store->node; }
-struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components, +struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components, struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc) { struct hlsl_ir_swizzle *swizzle; @@ -1388,7 +1388,7 @@ struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned init_node(&swizzle->node, HLSL_IR_SWIZZLE, type, loc); hlsl_src_from_node(&swizzle->val, val); swizzle->swizzle = s; - return swizzle; + return &swizzle->node; }
bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index) @@ -1687,12 +1687,8 @@ static struct hlsl_ir_node *clone_store(struct hlsl_ctx *ctx, struct clone_instr static struct hlsl_ir_node *clone_swizzle(struct hlsl_ctx *ctx, struct clone_instr_map *map, struct hlsl_ir_swizzle *src) { - struct hlsl_ir_swizzle *dst; - - if (!(dst = hlsl_new_swizzle(ctx, src->swizzle, src->node.data_type->dimx, - map_instr(map, src->val.node), &src->node.loc))) - return NULL; - return &dst->node; + return hlsl_new_swizzle(ctx, src->swizzle, src->node.data_type->dimx, + map_instr(map, src->val.node), &src->node.loc); }
static struct hlsl_ir_node *clone_index(struct hlsl_ctx *ctx, struct clone_instr_map *map, diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 6693d43e..9242c839 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1141,7 +1141,7 @@ struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct struct hlsl_ir_node *coords, struct hlsl_ir_node *value, const struct vkd3d_shader_location *loc); struct hlsl_type *hlsl_new_struct_type(struct hlsl_ctx *ctx, const char *name, struct hlsl_struct_field *fields, size_t field_count); -struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components, +struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components, struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc); struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *template, struct hlsl_type *type, const struct vkd3d_shader_location *loc); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 3a9ad33d..cd2c7fa1 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -543,7 +543,7 @@ static void free_parse_initializer(struct parse_initializer *initializer) vkd3d_free(initializer->args); }
-static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ctx *ctx, struct hlsl_ir_node *value, const char *swizzle, +static struct hlsl_ir_node *get_swizzle(struct hlsl_ctx *ctx, struct hlsl_ir_node *value, const char *swizzle, struct vkd3d_shader_location *loc) { unsigned int len = strlen(swizzle), component = 0; @@ -1680,8 +1680,9 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in } else if (lhs->type == HLSL_IR_SWIZZLE) { - struct hlsl_ir_swizzle *swizzle = hlsl_ir_swizzle(lhs), *new_swizzle; + struct hlsl_ir_swizzle *swizzle = hlsl_ir_swizzle(lhs); unsigned int width, s = swizzle->swizzle; + struct hlsl_ir_node *new_swizzle;
if (lhs->data_type->class == HLSL_CLASS_MATRIX) hlsl_fixme(ctx, &lhs->loc, "Matrix assignment with a writemask."); @@ -1696,10 +1697,10 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in { return NULL; } - list_add_tail(instrs, &new_swizzle->node.entry); + list_add_tail(instrs, &new_swizzle->entry);
lhs = swizzle->val.node; - rhs = &new_swizzle->node; + rhs = new_swizzle; } else { @@ -2548,7 +2549,7 @@ static bool intrinsic_cos(struct hlsl_ctx *ctx, static bool intrinsic_cross(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { - struct hlsl_ir_swizzle *arg1_swzl1, *arg1_swzl2, *arg2_swzl1, *arg2_swzl2; + struct hlsl_ir_node *arg1_swzl1, *arg1_swzl2, *arg2_swzl1, *arg2_swzl2; struct hlsl_ir_node *arg1 = params->args[0], *arg2 = params->args[1]; struct hlsl_ir_node *arg1_cast, *arg2_cast, *mul1_neg, *mul1, *mul2; struct hlsl_type *cast_type; @@ -2569,14 +2570,13 @@ static bool intrinsic_cross(struct hlsl_ctx *ctx,
if (!(arg1_swzl1 = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(Z, X, Y, Z), 3, arg1_cast, loc))) return false; - list_add_tail(params->instrs, &arg1_swzl1->node.entry); + list_add_tail(params->instrs, &arg1_swzl1->entry);
if (!(arg2_swzl1 = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(Y, Z, X, Y), 3, arg2_cast, loc))) return false; - list_add_tail(params->instrs, &arg2_swzl1->node.entry); + list_add_tail(params->instrs, &arg2_swzl1->entry);
- if (!(mul1 = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, - &arg1_swzl1->node, &arg2_swzl1->node, loc))) + if (!(mul1 = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg1_swzl1, arg2_swzl1, loc))) return false;
if (!(mul1_neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, mul1, loc))) @@ -2585,14 +2585,13 @@ static bool intrinsic_cross(struct hlsl_ctx *ctx,
if (!(arg1_swzl2 = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(Y, Z, X, Y), 3, arg1_cast, loc))) return false; - list_add_tail(params->instrs, &arg1_swzl2->node.entry); + list_add_tail(params->instrs, &arg1_swzl2->entry);
if (!(arg2_swzl2 = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(Z, X, Y, Z), 3, arg2_cast, loc))) return false; - list_add_tail(params->instrs, &arg2_swzl2->node.entry); + list_add_tail(params->instrs, &arg2_swzl2->entry);
- if (!(mul2 = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, - &arg1_swzl2->node, &arg2_swzl2->node, loc))) + if (!(mul2 = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg1_swzl2, arg2_swzl2, loc))) return false;
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, mul2, mul1_neg, loc); @@ -3421,9 +3420,8 @@ static bool intrinsic_trunc(struct hlsl_ctx *ctx, static bool intrinsic_d3dcolor_to_ubyte4(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { - struct hlsl_ir_node *arg = params->args[0], *ret, *c; + struct hlsl_ir_node *arg = params->args[0], *ret, *c, *swizzle; struct hlsl_type *arg_type = arg->data_type; - struct hlsl_ir_swizzle *swizzle;
if (arg_type->class != HLSL_CLASS_SCALAR && !(arg_type->class == HLSL_CLASS_VECTOR && arg_type->dimx == 4)) { @@ -3449,9 +3447,9 @@ static bool intrinsic_d3dcolor_to_ubyte4(struct hlsl_ctx *ctx, { if (!(swizzle = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(Z, Y, X, W), 4, arg, loc))) return false; - list_add_tail(params->instrs, &swizzle->node.entry); + list_add_tail(params->instrs, &swizzle->entry);
- arg = &swizzle->node; + arg = swizzle; }
if (!(ret = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg, c, loc))) @@ -5732,14 +5730,14 @@ postfix_expr: } else if (node->data_type->class <= HLSL_CLASS_LAST_NUMERIC) { - struct hlsl_ir_swizzle *swizzle; + struct hlsl_ir_node *swizzle;
if (!(swizzle = get_swizzle(ctx, node, $3, &@3))) { hlsl_error(ctx, &@3, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Invalid swizzle "%s".", $3); YYABORT; } - list_add_tail($1, &swizzle->node.entry); + list_add_tail($1, &swizzle->entry); $$ = $1; } else diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 3254739b..60f56461 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -1014,8 +1014,7 @@ static bool lower_broadcasts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, v
if (src_type->class <= HLSL_CLASS_VECTOR && dst_type->class <= HLSL_CLASS_VECTOR && src_type->dimx == 1) { - struct hlsl_ir_node *replacement, *new_cast; - struct hlsl_ir_swizzle *swizzle; + struct hlsl_ir_node *replacement, *new_cast, *swizzle;
dst_scalar_type = hlsl_get_scalar_type(ctx, dst_type->base_type); /* We need to preserve the cast since it might be doing more than just @@ -1029,8 +1028,8 @@ static bool lower_broadcasts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, v { if (!(swizzle = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(X, X, X, X), dst_type->dimx, replacement, &cast->node.loc))) return false; - list_add_after(&new_cast->entry, &swizzle->node.entry); - replacement = &swizzle->node; + list_add_after(&new_cast->entry, &swizzle->entry); + replacement = swizzle; }
hlsl_replace_node(&cast->node, replacement); @@ -1308,12 +1307,12 @@ static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx,
if (instr->data_type->class != HLSL_CLASS_OBJECT) { - struct hlsl_ir_swizzle *swizzle_node; + struct hlsl_ir_node *swizzle_node;
if (!(swizzle_node = hlsl_new_swizzle(ctx, ret_swizzle, instr_component_count, new_instr, &instr->loc))) return false; - list_add_before(&instr->entry, &swizzle_node->node.entry); - new_instr = &swizzle_node->node; + list_add_before(&instr->entry, &swizzle_node->entry); + new_instr = swizzle_node; }
hlsl_replace_node(instr, new_instr); @@ -1913,8 +1912,7 @@ static bool lower_narrowing_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *ins
if (src_type->class <= HLSL_CLASS_VECTOR && dst_type->class <= HLSL_CLASS_VECTOR && dst_type->dimx < src_type->dimx) { - struct hlsl_ir_swizzle *swizzle; - struct hlsl_ir_node *new_cast; + struct hlsl_ir_node *new_cast, *swizzle;
dst_vector_type = hlsl_get_vector_type(ctx, dst_type->base_type, src_type->dimx); /* We need to preserve the cast since it might be doing more than just @@ -1924,9 +1922,9 @@ static bool lower_narrowing_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *ins list_add_after(&cast->node.entry, &new_cast->entry); if (!(swizzle = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(X, Y, Z, W), dst_type->dimx, new_cast, &cast->node.loc))) return false; - list_add_after(&new_cast->entry, &swizzle->node.entry); + list_add_after(&new_cast->entry, &swizzle->entry);
- hlsl_replace_node(&cast->node, &swizzle->node); + hlsl_replace_node(&cast->node, swizzle); return true; }
@@ -1946,8 +1944,7 @@ static bool fold_swizzle_chains(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
if (next_instr->type == HLSL_IR_SWIZZLE) { - struct hlsl_ir_swizzle *new_swizzle; - struct hlsl_ir_node *new_instr; + struct hlsl_ir_node *new_swizzle; unsigned int combined_swizzle;
combined_swizzle = hlsl_combine_swizzles(hlsl_ir_swizzle(next_instr)->swizzle, @@ -1957,9 +1954,8 @@ static bool fold_swizzle_chains(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr if (!(new_swizzle = hlsl_new_swizzle(ctx, combined_swizzle, instr->data_type->dimx, next_instr, &instr->loc))) return false;
- new_instr = &new_swizzle->node; - list_add_before(&instr->entry, &new_instr->entry); - hlsl_replace_node(instr, new_instr); + list_add_before(&instr->entry, &new_swizzle->entry); + hlsl_replace_node(instr, new_swizzle); return true; }
@@ -2032,8 +2028,7 @@ static bool lower_sqrt(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *c /* Lower DP2 to MUL + ADD */ static bool lower_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { - struct hlsl_ir_node *arg1, *arg2, *mul, *replacement, *zero; - struct hlsl_ir_swizzle *add_x, *add_y; + struct hlsl_ir_node *arg1, *arg2, *mul, *replacement, *zero, *add_x, *add_y; struct hlsl_ir_expr *expr;
if (instr->type != HLSL_IR_EXPR) @@ -2069,13 +2064,13 @@ static bool lower_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *co
if (!(add_x = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(X, X, X, X), instr->data_type->dimx, mul, &expr->node.loc))) return false; - list_add_before(&instr->entry, &add_x->node.entry); + list_add_before(&instr->entry, &add_x->entry);
if (!(add_y = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(Y, Y, Y, Y), instr->data_type->dimx, mul, &expr->node.loc))) return false; - list_add_before(&instr->entry, &add_y->node.entry); + list_add_before(&instr->entry, &add_y->entry);
- if (!(replacement = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, &add_x->node, &add_y->node))) + if (!(replacement = hlsl_new_binary_expr(ctx, HLSL_OP2_ADD, add_x, add_y))) return false; } list_add_before(&instr->entry, &replacement->entry);
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.c | 10 ++--- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 21 +++++----- libs/vkd3d-shader/hlsl_codegen.c | 68 ++++++++++++++++---------------- 4 files changed, 48 insertions(+), 53 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 78dc10ef..617aef30 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -540,7 +540,7 @@ static bool init_deref_from_component_index(struct hlsl_ctx *ctx, struct hlsl_bl { unsigned int path_len, path_index, deref_path_len, i; struct hlsl_type *path_type; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *c;
hlsl_block_init(block);
@@ -571,9 +571,9 @@ static bool init_deref_from_component_index(struct hlsl_ctx *ctx, struct hlsl_bl hlsl_block_cleanup(block); return false; } - hlsl_block_add_instr(block, &c->node); + hlsl_block_add_instr(block, c);
- hlsl_src_from_node(&deref->path[deref_path_len++], &c->node); + hlsl_src_from_node(&deref->path[deref_path_len++], c); }
assert(deref_path_len == deref->path_len); @@ -1194,7 +1194,7 @@ struct hlsl_ir_node *hlsl_new_int_constant(struct hlsl_ctx *ctx, int32_t n, cons return &c->node; }
-struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n, +struct hlsl_ir_node *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n, const struct vkd3d_shader_location *loc) { struct hlsl_ir_constant *c; @@ -1204,7 +1204,7 @@ struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned i if (c) c->value.u[0].u = n;
- return c; + return &c->node; }
struct hlsl_ir_node *hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 9242c839..e6745052 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1148,7 +1148,7 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *tem struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format, unsigned int sample_count); struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format); -struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n, +struct hlsl_ir_node *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n, const struct vkd3d_shader_location *loc); struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg, const struct vkd3d_shader_location *loc); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index cd2c7fa1..a7d780ae 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -689,16 +689,15 @@ static struct hlsl_ir_node *add_load_component(struct hlsl_ctx *ctx, struct list static bool add_record_access(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *record, unsigned int idx, const struct vkd3d_shader_location *loc) { - struct hlsl_ir_node *index; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *index, *c;
assert(idx < record->data_type->e.record.field_count);
if (!(c = hlsl_new_uint_constant(ctx, idx, loc))) return false; - list_add_tail(instrs, &c->node.entry); + list_add_tail(instrs, &c->entry);
- if (!(index = hlsl_new_index(ctx, record, &c->node, loc))) + if (!(index = hlsl_new_index(ctx, record, c, loc))) return false; list_add_tail(instrs, &index->entry);
@@ -1754,8 +1753,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
for (i = 0; i < mat->data_type->dimx; ++i) { - struct hlsl_ir_node *cell, *load, *store; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *cell, *load, *store, *c; struct hlsl_deref deref;
if (!(writemask & (1 << i))) @@ -1763,9 +1761,9 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
if (!(c = hlsl_new_uint_constant(ctx, i, &lhs->loc))) return NULL; - list_add_tail(instrs, &c->node.entry); + list_add_tail(instrs, &c->entry);
- if (!(cell = hlsl_new_index(ctx, &row->node, &c->node, &lhs->loc))) + if (!(cell = hlsl_new_index(ctx, &row->node, c, &lhs->loc))) return NULL; list_add_tail(instrs, &cell->entry);
@@ -2162,8 +2160,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t } else if (var->storage_modifiers & HLSL_STORAGE_STATIC) { - struct hlsl_ir_node *cast, *store; - struct hlsl_ir_constant *zero; + struct hlsl_ir_node *cast, *store, *zero;
/* Initialize statics to zero by default. */
@@ -2178,9 +2175,9 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t vkd3d_free(v); continue; } - list_add_tail(&ctx->static_initializers, &zero->node.entry); + list_add_tail(&ctx->static_initializers, &zero->entry);
- if (!(cast = add_cast(ctx, &ctx->static_initializers, &zero->node, var->data_type, &var->loc))) + if (!(cast = add_cast(ctx, &ctx->static_initializers, zero, var->data_type, &var->loc))) { vkd3d_free(v); continue; diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 60f56461..79608b1e 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -27,7 +27,7 @@ static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, str enum hlsl_regset regset, const struct vkd3d_shader_location *loc) { struct hlsl_ir_node *idx_offset = NULL; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *c;
hlsl_block_init(block);
@@ -41,9 +41,9 @@ static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, str { if (!(c = hlsl_new_uint_constant(ctx, 4, loc))) return NULL; - hlsl_block_add_instr(block, &c->node); + hlsl_block_add_instr(block, c);
- if (!(idx_offset = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, &c->node, idx))) + if (!(idx_offset = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, c, idx))) return NULL; hlsl_block_add_instr(block, idx_offset);
@@ -56,9 +56,9 @@ static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, str
if (!(c = hlsl_new_uint_constant(ctx, size, loc))) return NULL; - hlsl_block_add_instr(block, &c->node); + hlsl_block_add_instr(block, c);
- if (!(idx_offset = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, &c->node, idx))) + if (!(idx_offset = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, c, idx))) return NULL; hlsl_block_add_instr(block, idx_offset);
@@ -72,9 +72,9 @@ static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, str
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset[regset], loc))) return NULL; - hlsl_block_add_instr(block, &c->node); + hlsl_block_add_instr(block, c);
- idx_offset = &c->node; + idx_offset = c;
break; } @@ -333,7 +333,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct struct hlsl_type *type = lhs->node.data_type, *vector_type_src, *vector_type_dst; struct vkd3d_shader_location *loc = &lhs->node.loc; struct hlsl_ir_var *var = lhs->src.var; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *c; unsigned int i;
if (type->class > HLSL_CLASS_LAST_NUMERIC) @@ -373,11 +373,11 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct { if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc))) return; - list_add_after(&cast->entry, &c->node.entry); + list_add_after(&cast->entry, &c->entry);
- if (!(store = hlsl_new_store_index(ctx, &lhs->src, &c->node, cast, 0, &var->loc))) + if (!(store = hlsl_new_store_index(ctx, &lhs->src, c, cast, 0, &var->loc))) return; - list_add_after(&c->node.entry, &store->entry); + list_add_after(&c->entry, &store->entry); } else { @@ -396,7 +396,7 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct list *instrs struct vkd3d_shader_location *loc = &lhs->node.loc; struct hlsl_type *type = lhs->node.data_type; struct hlsl_ir_var *var = lhs->src.var; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *c; unsigned int i;
if (type->class == HLSL_CLASS_ARRAY || type->class == HLSL_CLASS_STRUCT) @@ -425,12 +425,12 @@ static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct list *instrs
if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc))) return; - list_add_after(&lhs->node.entry, &c->node.entry); + list_add_after(&lhs->node.entry, &c->entry);
/* This redundant load is expected to be deleted later by DCE. */ - if (!(element_load = hlsl_new_load_index(ctx, &lhs->src, &c->node, loc))) + if (!(element_load = hlsl_new_load_index(ctx, &lhs->src, c, loc))) return; - list_add_after(&c->node.entry, &element_load->node.entry); + list_add_after(&c->entry, &element_load->node.entry);
prepend_input_copy_recurse(ctx, instrs, element_load, modifiers, semantic, elem_semantic_index); } @@ -461,7 +461,7 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct struct hlsl_type *type = rhs->node.data_type, *vector_type; struct vkd3d_shader_location *loc = &rhs->node.loc; struct hlsl_ir_var *var = rhs->src.var; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *c; unsigned int i;
if (type->class > HLSL_CLASS_LAST_NUMERIC) @@ -490,9 +490,9 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct { if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc))) return; - list_add_tail(instrs, &c->node.entry); + list_add_tail(instrs, &c->entry);
- if (!(load = hlsl_new_load_index(ctx, &rhs->src, &c->node, &var->loc))) + if (!(load = hlsl_new_load_index(ctx, &rhs->src, c, &var->loc))) return; list_add_tail(instrs, &load->node.entry); } @@ -517,7 +517,7 @@ static void append_output_copy_recurse(struct hlsl_ctx *ctx, struct list *instrs struct vkd3d_shader_location *loc = &rhs->node.loc; struct hlsl_type *type = rhs->node.data_type; struct hlsl_ir_var *var = rhs->src.var; - struct hlsl_ir_constant *c; + struct hlsl_ir_node *c; unsigned int i;
if (type->class == HLSL_CLASS_ARRAY || type->class == HLSL_CLASS_STRUCT) @@ -546,9 +546,9 @@ static void append_output_copy_recurse(struct hlsl_ctx *ctx, struct list *instrs
if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc))) return; - list_add_tail(instrs, &c->node.entry); + list_add_tail(instrs, &c->entry);
- if (!(element_load = hlsl_new_load_index(ctx, &rhs->src, &c->node, loc))) + if (!(element_load = hlsl_new_load_index(ctx, &rhs->src, c, loc))) return; list_add_tail(instrs, &element_load->node.entry);
@@ -864,10 +864,9 @@ static struct hlsl_ir_node *add_zero_mipmap_level(struct hlsl_ctx *ctx, struct h const struct vkd3d_shader_location *loc) { unsigned int dim_count = index->data_type->dimx; + struct hlsl_ir_node *store, *zero; struct hlsl_ir_load *coords_load; struct hlsl_deref coords_deref; - struct hlsl_ir_constant *zero; - struct hlsl_ir_node *store; struct hlsl_ir_var *coords;
assert(dim_count < 4); @@ -883,11 +882,11 @@ static struct hlsl_ir_node *add_zero_mipmap_level(struct hlsl_ctx *ctx, struct h
if (!(zero = hlsl_new_uint_constant(ctx, 0, loc))) return NULL; - list_add_after(&store->entry, &zero->node.entry); + list_add_after(&store->entry, &zero->entry);
- if (!(store = hlsl_new_store_index(ctx, &coords_deref, NULL, &zero->node, 1u << dim_count, loc))) + if (!(store = hlsl_new_store_index(ctx, &coords_deref, NULL, zero, 1u << dim_count, loc))) return NULL; - list_add_after(&zero->node.entry, &store->entry); + list_add_after(&zero->entry, &store->entry);
if (!(coords_load = hlsl_new_var_load(ctx, coords, loc))) return NULL; @@ -963,13 +962,13 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
for (i = 0; i < mat->data_type->dimx; ++i) { - struct hlsl_ir_constant *c; + struct hlsl_ir_node *c;
if (!(c = hlsl_new_uint_constant(ctx, i, &instr->loc))) return false; - list_add_before(&instr->entry, &c->node.entry); + list_add_before(&instr->entry, &c->entry);
- if (!(load = hlsl_new_load_index(ctx, &var_deref, &c->node, &instr->loc))) + if (!(load = hlsl_new_load_index(ctx, &var_deref, c, &instr->loc))) return false; list_add_before(&instr->entry, &load->node.entry);
@@ -977,7 +976,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, return false; list_add_before(&instr->entry, &load->node.entry);
- if (!(store = hlsl_new_store_index(ctx, &row_deref, &c->node, &load->node, 0, &instr->loc))) + if (!(store = hlsl_new_store_index(ctx, &row_deref, c, &load->node, 0, &instr->loc))) return false; list_add_before(&instr->entry, &store->entry); } @@ -1766,19 +1765,18 @@ static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store, const struct hlsl_ir_load *load, const unsigned int idx, struct hlsl_type *type) { - struct hlsl_ir_node *split_store; + struct hlsl_ir_node *split_store, *c; struct hlsl_ir_load *split_load; - struct hlsl_ir_constant *c;
if (!(c = hlsl_new_uint_constant(ctx, idx, &store->node.loc))) return false; - list_add_before(&store->node.entry, &c->node.entry); + list_add_before(&store->node.entry, &c->entry);
- if (!(split_load = hlsl_new_load_index(ctx, &load->src, &c->node, &store->node.loc))) + if (!(split_load = hlsl_new_load_index(ctx, &load->src, c, &store->node.loc))) return false; list_add_before(&store->node.entry, &split_load->node.entry);
- if (!(split_store = hlsl_new_store_index(ctx, &store->lhs, &c->node, &split_load->node, 0, &store->node.loc))) + if (!(split_store = hlsl_new_store_index(ctx, &store->lhs, c, &split_load->node, 0, &store->node.loc))) return false; list_add_before(&store->node.entry, &split_store->entry);
From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 15 +++++++-------- libs/vkd3d-shader/hlsl_codegen.c | 21 +++++++++------------ 3 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index e6745052..6a4e314d 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1049,7 +1049,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsigned int modifiers); const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type);
-struct hlsl_ir_load *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *instrs, +struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *condition, struct hlsl_ir_node *if_true, struct hlsl_ir_node *if_false); void hlsl_add_function(struct hlsl_ctx *ctx, char *name, struct hlsl_ir_function_decl *decl); bool hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl, bool local_var); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index a7d780ae..90e2face 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -2689,9 +2689,8 @@ static bool intrinsic_floor(struct hlsl_ctx *ctx, static bool intrinsic_fmod(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { - struct hlsl_ir_node *x, *y, *div, *abs, *frac, *neg_frac, *ge; + struct hlsl_ir_node *x, *y, *div, *abs, *frac, *neg_frac, *ge, *select; struct hlsl_ir_constant *zero; - struct hlsl_ir_load *select; unsigned int count, i;
if (!(x = intrinsic_float_convert_arg(ctx, params, params->args[0], loc))) @@ -2726,7 +2725,7 @@ static bool intrinsic_fmod(struct hlsl_ctx *ctx, const struct parse_initializer if (!(select = hlsl_add_conditional(ctx, params->instrs, ge, frac, neg_frac))) return false;
- return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, &select->node, y, loc); + return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, select, y, loc); }
static bool intrinsic_frac(struct hlsl_ctx *ctx, @@ -2817,12 +2816,12 @@ static struct hlsl_ir_node * add_pow_expr(struct hlsl_ctx *ctx, static bool intrinsic_lit(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { - struct hlsl_ir_node *n_l_neg, *n_h_neg, *specular_or, *specular_pow; + struct hlsl_ir_node *n_l_neg, *n_h_neg, *specular_or, *specular_pow, *load; struct hlsl_ir_node *n_l, *n_h, *m, *diffuse, *zero, *store; struct hlsl_ir_constant *init; + struct hlsl_ir_load *var_load; struct hlsl_deref var_deref; struct hlsl_type *ret_type; - struct hlsl_ir_load *load; struct hlsl_ir_var *var; struct hlsl_block block;
@@ -2889,13 +2888,13 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx, if (!(load = hlsl_add_conditional(ctx, params->instrs, specular_or, zero, specular_pow))) return false;
- if (!hlsl_new_store_component(ctx, &block, &var_deref, 2, &load->node)) + if (!hlsl_new_store_component(ctx, &block, &var_deref, 2, load)) return false; list_move_tail(params->instrs, &block.instrs);
- if (!(load = hlsl_new_var_load(ctx, var, loc))) + if (!(var_load = hlsl_new_var_load(ctx, var, loc))) return false; - list_add_tail(params->instrs, &load->node.entry); + list_add_tail(params->instrs, &var_load->node.entry);
return true; } diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 79608b1e..638dab6e 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -2178,7 +2178,7 @@ static bool lower_casts_to_bool(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr return true; }
-struct hlsl_ir_load *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *instrs, +struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *condition, struct hlsl_ir_node *if_true, struct hlsl_ir_node *if_false) { struct hlsl_block then_block, else_block; @@ -2210,16 +2210,15 @@ struct hlsl_ir_load *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *ins return NULL; list_add_tail(instrs, &load->node.entry);
- return load; + return &load->node; }
static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { - struct hlsl_ir_node *arg1, *arg2, *xor, *and, *abs1, *abs2, *div, *neg, *cast1, *cast2, *cast3; + struct hlsl_ir_node *arg1, *arg2, *xor, *and, *abs1, *abs2, *div, *neg, *cast1, *cast2, *cast3, *cond; struct hlsl_type *type = instr->data_type, *utype; struct hlsl_ir_constant *high_bit; struct hlsl_ir_expr *expr; - struct hlsl_ir_load *cond; unsigned int i;
if (instr->type != HLSL_IR_EXPR) @@ -2279,18 +2278,17 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
if (!(cond = hlsl_add_conditional(ctx, &instr->entry, and, neg, cast3))) return false; - hlsl_replace_node(instr, &cond->node); + hlsl_replace_node(instr, cond);
return true; }
static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { - struct hlsl_ir_node *arg1, *arg2, *and, *abs1, *abs2, *div, *neg, *cast1, *cast2, *cast3; + struct hlsl_ir_node *arg1, *arg2, *and, *abs1, *abs2, *div, *neg, *cast1, *cast2, *cast3, *cond; struct hlsl_type *type = instr->data_type, *utype; struct hlsl_ir_constant *high_bit; struct hlsl_ir_expr *expr; - struct hlsl_ir_load *cond; unsigned int i;
if (instr->type != HLSL_IR_EXPR) @@ -2346,7 +2344,7 @@ static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
if (!(cond = hlsl_add_conditional(ctx, &instr->entry, and, neg, cast3))) return false; - hlsl_replace_node(instr, &cond->node); + hlsl_replace_node(instr, cond);
return true; } @@ -2382,10 +2380,9 @@ static bool lower_int_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void
static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { - struct hlsl_ir_node *arg1, *arg2, *mul1, *neg1, *ge, *neg2, *div, *mul2, *frc; + struct hlsl_ir_node *arg1, *arg2, *mul1, *neg1, *ge, *neg2, *div, *mul2, *frc, *cond; struct hlsl_type *type = instr->data_type, *btype; struct hlsl_ir_constant *one; - struct hlsl_ir_load *cond; struct hlsl_ir_expr *expr; unsigned int i;
@@ -2428,7 +2425,7 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr one->value.u[i].f = 1.0f; list_add_before(&instr->entry, &one->node.entry);
- if (!(div = hlsl_new_binary_expr(ctx, HLSL_OP2_DIV, &one->node, &cond->node))) + if (!(div = hlsl_new_binary_expr(ctx, HLSL_OP2_DIV, &one->node, cond))) return false; list_add_before(&instr->entry, &div->entry);
@@ -2444,7 +2441,7 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr hlsl_src_remove(&expr->operands[0]); hlsl_src_remove(&expr->operands[1]); hlsl_src_from_node(&expr->operands[0], frc); - hlsl_src_from_node(&expr->operands[1], &cond->node); + hlsl_src_from_node(&expr->operands[1], cond);
return true; }
This merge request was approved by Henri Verbeet.