From: Jan Zielinski Date: Tue, 28 Apr 2020 19:05:46 +0000 (+0200) Subject: gallium/swr: Fix crashes and failures in vertex fetch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a93b728bc61e263b9188a66df501bf108c9b3050;p=mesa.git 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 Reviewed-by: Bruce Cherniak Part-of: --- 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) {