mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Implement copy-propagation of derefs with a non-constant index.
We implement a transformation that propagates loads with a single non-constant index in its deref path. Consider a load of the form var[[a0][a1]...[i]...[an]], where ak are integral constants, and i is an arbitrary non-constant node. If, for all j, the following holds: var[[a0][a1]...[j]...[an]] = x[[c0*j + d0][c1*j + d1]...[cm*j + dm]], where ck, dk are constants, then we can replace the load with x[[c0*i + d0]...[cm*i + dm]]. This pass is implemented by copy_propagation_replace_with_deref().
This commit is contained in:
Notes:
Henri Verbeet
2025-03-12 22:20:19 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1388
@@ -739,8 +739,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
|
||||
return offset[*regset];
|
||||
}
|
||||
|
||||
static bool hlsl_init_deref(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hlsl_ir_var *var,
|
||||
unsigned int path_len)
|
||||
bool hlsl_init_deref(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hlsl_ir_var *var, unsigned int path_len)
|
||||
{
|
||||
deref->var = var;
|
||||
deref->path_len = path_len;
|
||||
|
Reference in New Issue
Block a user