Mesa (master): gallium/swr: Fix crashes and failures in vertex fetch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 29 00:06:25 UTC 2020


Module: Mesa
Branch: master
Commit: a93b728bc61e263b9188a66df501bf108c9b3050
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a93b728bc61e263b9188a66df501bf108c9b3050

Author: Jan Zielinski <jan.zielinski at intel.com>
Date:   Tue Apr 28 21:05:46 2020 +0200

gallium/swr: Fix crashes and failures in vertex fetch

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 at intel.com>
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4788>

---

 src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp | 4 +---
 src/gallium/drivers/swr/swr_screen.cpp                  | 6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index abb16295e0d..a2d253183fe 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -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;
                         }
diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
index 5b7e5ab0f34..ef5b4524c1a 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -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)
    {



More information about the mesa-commit mailing list