gallium/swr: Fix crashes and failures in vertex fetch
authorJan Zielinski <jan.zielinski@intel.com>
Tue, 28 Apr 2020 19:05:46 +0000 (21:05 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 23:53:08 +0000 (23:53 +0000)
This commit fixes two problems:
- In some cases SWR does not correctly report to Gallium
  which formats are supported.
- Incorrect LLVM instructions are used in vertex fetch in some situations

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4788>

src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
src/gallium/drivers/swr/swr_screen.cpp

index abb16295e0dad72ac74c8eb2ae33240d91bb02d0..a2d253183fef9af074b2016f6f5daa67ac78ba13 100644 (file)
@@ -874,10 +874,8 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
                             Value* pGatherHi =
                                 GATHERPD(vZeroDouble, pStreamBaseGFX, vOffsetsHi, vMaskHi);
 
-                            pGatherLo = VCVTPD2PS(pGatherLo);
-                            pGatherHi = VCVTPD2PS(pGatherHi);
-
                             Value* pGather = VSHUFFLE(pGatherLo, pGatherHi, vShufAll);
+                            pGather        = FP_TRUNC(pGather, mSimdFP32Ty);
 
                             vVertexElements[currentVertexElement++] = pGather;
                         }
index 5b7e5ab0f348db5d440079792b61e27d54a47b63..ef5b4524c1a1b1784f18465d06b7f7e93723b4ef 100644 (file)
@@ -141,6 +141,12 @@ swr_is_format_supported(struct pipe_screen *_screen,
          return false;
    }
 
+   if (bind & PIPE_BIND_VERTEX_BUFFER) {
+      if (mesa_to_swr_format(format) == (SWR_FORMAT)-1) {
+         return false;
+      }
+   }
+
    if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC ||
        format_desc->layout == UTIL_FORMAT_LAYOUT_FXT1)
    {