vkd3d-shader/hlsl: Call copy_propagation_get_value() directly in copy_propagation_transform_object_load().

copy_propagation_compute_replacement() is not doing very much for us, and
conceptually is a bit of an odd fit anyway, since it's meant to deal with
multi-component types.
This commit is contained in:
Zebediah Figura 2023-01-12 17:28:44 -06:00 committed by Alexandre Julliard
parent 8fd30aa87d
commit 5d34790402
Notes: Alexandre Julliard 2023-01-24 22:27:58 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/51

View File

@ -805,15 +805,20 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
static bool copy_propagation_transform_object_load(struct hlsl_ctx *ctx,
struct hlsl_deref *deref, struct copy_propagation_state *state)
{
struct copy_propagation_value *value;
struct hlsl_ir_load *load;
struct hlsl_ir_node *instr;
unsigned int swizzle;
unsigned int start, count;
if (!(instr = copy_propagation_compute_replacement(ctx, state, deref, &swizzle)))
if (!hlsl_component_index_range_from_deref(ctx, deref, &start, &count))
return false;
assert(count == 1);
if (!(value = copy_propagation_get_value(state, deref->var, start)))
return false;
assert(value->component == 0);
/* Only HLSL_IR_LOAD can produce an object. */
load = hlsl_ir_load(instr);
load = hlsl_ir_load(value->node);
hlsl_cleanup_deref(deref);
hlsl_copy_deref(ctx, deref, &load->src);