nir_to_tgsi: Allow SSA defs to include swizzles, abs, and neg.

This will let some copy prop happen automatically, avoiding MOVs to temps.
Most importantly, though, it means that virgl won't see (unused channel)
swizzles from channels beyond the bounds of sysvals, which trigger shader
compile failures on the host.

softpipe shader-db:

total instructions in shared programs: 2946336 -> 2934777 (-0.39%)
instructions in affected programs: 374676 -> 363117 (-3.09%)
total temps in shared programs: 565552 -> 564139 (-0.25%)
temps in affected programs: 18138 -> 16725 (-7.79%)

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12781>
This commit is contained in:
Emma Anholt 2021-09-08 15:14:47 -07:00 committed by Marge Bot
parent bd8de16803
commit db930bd91b
1 changed files with 1 additions and 5 deletions

View File

@ -738,11 +738,7 @@ ntt_get_dest(struct ntt_compile *c, nir_dest *dest)
static void
ntt_store_def(struct ntt_compile *c, nir_ssa_def *def, struct ureg_src src)
{
if (!src.Negate && !src.Absolute && !src.Indirect && !src.DimIndirect &&
src.SwizzleX == TGSI_SWIZZLE_X &&
(src.SwizzleY == TGSI_SWIZZLE_Y || def->num_components < 2) &&
(src.SwizzleZ == TGSI_SWIZZLE_Z || def->num_components < 3) &&
(src.SwizzleW == TGSI_SWIZZLE_W || def->num_components < 4)) {
if (!src.Indirect && !src.DimIndirect) {
switch (src.File) {
case TGSI_FILE_IMMEDIATE:
case TGSI_FILE_INPUT: