vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.

Note that we still have to preempt the propagation to SM1 pixel shader
uniforms. Otherwise this will turn the many constant derefs that appear
from the <index-val> copy generated in lower_index_loads() into a single
non-constant deref, causing it to allocate all the registers instead of
up until the last one used.
This commit is contained in:
Francisco Casas
2025-03-17 21:35:00 -03:00
committed by Henri Verbeet
parent f65e6265e0
commit 3ead8d532b
Notes: Henri Verbeet 2025-04-02 19:43:14 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1434
3 changed files with 11 additions and 11 deletions

View File

@ -1916,12 +1916,6 @@ static bool copy_propagation_replace_with_deref(struct hlsl_ctx *ctx,
if (!nonconst_index_from_deref(ctx, deref, &nonconst_i, &base, &scale, &count))
return false;
if (hlsl_version_lt(ctx, 4, 0))
{
TRACE("Non-constant index propagation is not yet supported for SM1.\n");
return false;
}
VKD3D_ASSERT(count);
hlsl_block_init(&block);
@ -1950,6 +1944,12 @@ static bool copy_propagation_replace_with_deref(struct hlsl_ctx *ctx,
else if (x != idx->src.var)
goto done;
if (hlsl_version_lt(ctx, 4, 0) && x->is_uniform && ctx->profile->type != VKD3D_SHADER_TYPE_VERTEX)
{
TRACE("Skipping propagating non-constant deref to SM1 uniform %s.\n", var->name);
goto done;
}
if (i == 0)
{
path_len = idx->src.path_len;