gallivm: disable rgtc/latc SNORM accellerated fetches
authorRoland Scheidegger <sroland@vmware.com>
Tue, 24 Mar 2020 20:56:40 +0000 (21:56 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 25 Mar 2020 17:56:11 +0000 (17:56 +0000)
Unfortunately this appears to be bugged (it seems the piglit tests aren't
quite exhaustive enough). I'm almost certain it's the lerp
(lp_build_lerpdxta()) which doesn't handle signed numbers correctly, let's
disable for now.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4311>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4311>

src/gallium/auxiliary/gallivm/lp_bld_format_aos.c

index f8e1a963bb4264e5497b5897a55df6475b256092..781ceb8b03de1374466a25895844e5f06bd4e152 100644 (file)
@@ -770,19 +770,25 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
                        format_desc->format == PIPE_FORMAT_LATC1_SNORM ||
                        format_desc->format == PIPE_FORMAT_LATC2_SNORM);
 
-      tmp = lp_build_fetch_rgtc_rgba_aos(gallivm,
-                                         format_desc,
-                                         num_pixels,
-                                         base_ptr,
-                                         offset,
-                                         i, j,
-                                         cache);
-
-      lp_build_conv(gallivm,
-                    tmp_type, type,
-                    &tmp, 1, &tmp, 1);
-
-       return tmp;
+      if (!tmp_type.sign) {
+         /*
+          * FIXME: this is buggy for snorm formats, likely the lerp is
+          * busted.
+          */
+         tmp = lp_build_fetch_rgtc_rgba_aos(gallivm,
+                                            format_desc,
+                                            num_pixels,
+                                            base_ptr,
+                                            offset,
+                                            i, j,
+                                            cache);
+
+         lp_build_conv(gallivm,
+                       tmp_type, type,
+                       &tmp, 1, &tmp, 1);
+
+         return tmp;
+      }
    }
 
    /*