From: Francisco Casas fcasas@codeweavers.com
This field is now analogous to vkd3d_shader_register_index.rel_addr.
Also, it makes sense to rename it now because all the constant part of the offset is now handled to hlsl_deref.const_offset. Consequently, it may also be NULL now. --- libs/vkd3d-shader/hlsl.c | 12 +++++------ libs/vkd3d-shader/hlsl.h | 4 ++-- libs/vkd3d-shader/hlsl_codegen.c | 36 ++++++++++++++++---------------- 3 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 7a505a025..5df798ae9 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -512,7 +512,7 @@ static bool init_deref(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hl { deref->var = var; deref->path_len = path_len; - deref->offset.node = NULL; + deref->rel_offset.node = NULL; deref->const_offset = 0; deref->data_type = NULL;
@@ -541,7 +541,7 @@ bool hlsl_init_deref_from_index_chain(struct hlsl_ctx *ctx, struct hlsl_deref *d
deref->path = NULL; deref->path_len = 0; - deref->offset.node = NULL; + deref->rel_offset.node = NULL; deref->const_offset = 0;
assert(chain); @@ -1138,7 +1138,7 @@ void hlsl_cleanup_deref(struct hlsl_deref *deref) deref->path = NULL; deref->path_len = 0;
- hlsl_src_remove(&deref->offset); + hlsl_src_remove(&deref->rel_offset); deref->const_offset = 0; }
@@ -2338,12 +2338,12 @@ static void dump_deref(struct vkd3d_string_buffer *buffer, const struct hlsl_der { bool show_rel, show_const;
- show_rel = deref->offset.node; + show_rel = deref->rel_offset.node; show_const = deref->const_offset != 0 || !show_rel;
vkd3d_string_buffer_printf(buffer, "["); if (show_rel) - dump_src(buffer, &deref->offset); + dump_src(buffer, &deref->rel_offset); if (show_rel && show_const) vkd3d_string_buffer_printf(buffer, " + "); if (show_const) @@ -2883,7 +2883,7 @@ static void free_ir_resource_load(struct hlsl_ir_resource_load *load)
static void free_ir_resource_store(struct hlsl_ir_resource_store *store) { - hlsl_src_remove(&store->resource.offset); + hlsl_src_remove(&store->resource.rel_offset); hlsl_src_remove(&store->coords); hlsl_src_remove(&store->value); vkd3d_free(store); diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index e49e94e23..9aa81f32c 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -619,11 +619,11 @@ struct hlsl_deref * regset) from the start of the variable, to the part of the variable that is referenced. * This offset is stored using two fields, one for a variable part and other for a constant * part, which are added together: - * - offset: An offset given by an instruction node, in whole registers. + * - rel_offset: An offset given by an instruction node, in whole registers. * - const_offset: A constant number of register components. * Since the type information cannot longer be retrieved from the offset alone, the type is * stored in the data_type field, which remains NULL if the deref hasn't been lowered yet. */ - struct hlsl_src offset; + struct hlsl_src rel_offset; unsigned int const_offset; struct hlsl_type *data_type; }; diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 44f8cf814..07967cf37 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -168,7 +168,7 @@ static bool replace_deref_path_with_offset(struct hlsl_ctx *ctx, struct hlsl_der list_move_before(&instr->entry, &block.instrs);
hlsl_cleanup_deref(deref); - hlsl_src_from_node(&deref->offset, offset); + hlsl_src_from_node(&deref->rel_offset, offset); deref->const_offset = offset_component;
return true; @@ -177,15 +177,15 @@ static bool replace_deref_path_with_offset(struct hlsl_ctx *ctx, struct hlsl_der static bool clean_constant_deref_offset_srcs(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hlsl_ir_node *instr) { - if (deref->offset.node && deref->offset.node->type == HLSL_IR_CONSTANT) + if (deref->rel_offset.node && deref->rel_offset.node->type == HLSL_IR_CONSTANT) { enum hlsl_regset regset = hlsl_deref_get_regset(ctx, deref);
if (regset == HLSL_REGSET_NUMERIC) - deref->const_offset += 4 * hlsl_ir_constant(deref->offset.node)->value.u[0].u; + deref->const_offset += 4 * hlsl_ir_constant(deref->rel_offset.node)->value.u[0].u; else - deref->const_offset += hlsl_ir_constant(deref->offset.node)->value.u[0].u; - hlsl_src_remove(&deref->offset); + deref->const_offset += hlsl_ir_constant(deref->rel_offset.node)->value.u[0].u; + hlsl_src_remove(&deref->rel_offset); return true; } return false; @@ -3087,8 +3087,8 @@ static void compute_liveness_recurse(struct hlsl_block *block, unsigned int loop if (!var->first_write) var->first_write = loop_first ? min(instr->index, loop_first) : instr->index; store->rhs.node->last_read = last_read; - if (store->lhs.offset.node) - store->lhs.offset.node->last_read = last_read; + if (store->lhs.rel_offset.node) + store->lhs.rel_offset.node->last_read = last_read; break; } case HLSL_IR_EXPR: @@ -3115,8 +3115,8 @@ static void compute_liveness_recurse(struct hlsl_block *block, unsigned int loop
var = load->src.var; var->last_read = max(var->last_read, last_read); - if (load->src.offset.node) - load->src.offset.node->last_read = last_read; + if (load->src.rel_offset.node) + load->src.rel_offset.node->last_read = last_read; break; } case HLSL_IR_LOOP: @@ -3133,14 +3133,14 @@ static void compute_liveness_recurse(struct hlsl_block *block, unsigned int loop
var = load->resource.var; var->last_read = max(var->last_read, last_read); - if (load->resource.offset.node) - load->resource.offset.node->last_read = last_read; + if (load->resource.rel_offset.node) + load->resource.rel_offset.node->last_read = last_read;
if ((var = load->sampler.var)) { var->last_read = max(var->last_read, last_read); - if (load->sampler.offset.node) - load->sampler.offset.node->last_read = last_read; + if (load->sampler.rel_offset.node) + load->sampler.rel_offset.node->last_read = last_read; }
if (load->coords.node) @@ -3165,8 +3165,8 @@ static void compute_liveness_recurse(struct hlsl_block *block, unsigned int loop
var = store->resource.var; var->last_read = max(var->last_read, last_read); - if (store->resource.offset.node) - store->resource.offset.node->last_read = last_read; + if (store->resource.rel_offset.node) + store->resource.rel_offset.node->last_read = last_read; store->coords.node->last_read = last_read; store->value.node->last_read = last_read; break; @@ -4228,7 +4228,7 @@ bool hlsl_regset_index_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *offset) { enum hlsl_regset regset = hlsl_deref_get_regset(ctx, deref); - struct hlsl_ir_node *offset_node = deref->offset.node; + struct hlsl_ir_node *offset_node = deref->rel_offset.node; unsigned int size;
*offset = deref->const_offset; @@ -4260,8 +4260,8 @@ unsigned int hlsl_offset_from_deref_safe(struct hlsl_ctx *ctx, const struct hlsl if (hlsl_offset_from_deref(ctx, deref, &offset)) return offset;
- hlsl_fixme(ctx, &deref->offset.node->loc, "Dereference with non-constant offset of type %s.", - hlsl_node_type_to_string(deref->offset.node->type)); + hlsl_fixme(ctx, &deref->rel_offset.node->loc, "Dereference with non-constant offset of type %s.", + hlsl_node_type_to_string(deref->rel_offset.node->type));
return 0; }