st/nine: Fix ff has_aNrm computation
authorAxel Davy <davyaxel0@gmail.com>
Sat, 27 Mar 2021 12:45:17 +0000 (13:45 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Apr 2021 08:33:13 +0000 (08:33 +0000)
In some cases the wrong computation led the
normal to be zero instead of the correct value,
which led to artifacts.

Fixes: https://github.com/iXit/wine-nine-standalone/issues/105

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>

src/gallium/frontends/nine/nine_ff.c

index 8a16270..56e2f5a 100644 (file)
@@ -338,7 +338,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
     unsigned i, c;
     unsigned label[32], l = 0;
     boolean need_aNrm = key->lighting || key->passthrough & (1 << NINE_DECLUSAGE_NORMAL);
-    boolean has_aNrm = need_aNrm && key->has_normal;
+    boolean has_aNrm;
     boolean need_aVtx = key->lighting || key->fog_mode || key->pointscale || key->ucp;
     const unsigned texcoord_sn = get_texcoord_sn(device->screen);
 
@@ -364,6 +364,8 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
         }
     }
 
+    has_aNrm = need_aNrm && key->has_normal;
+
     /* Declare and record used inputs (needed for linkage with vertex format):
      * (texture coordinates handled later)
      */