summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-02-16 11:14:50 -0600
committerGeorge Kyriazis <[email protected]>2018-02-28 11:42:19 -0600
commit539de78633c45598e0b1e3b7763ea318f9200c32 (patch)
treea65a75e81f46177e8ec5e115155e9c558bbed9e0 /src/gallium/drivers/swr
parent26103487b54a1c1121132cc040927619cce45262 (diff)
swr/rast: Fix index buffer overfetch issue for non-indexed draws
Populate pLastIndex, even for the non-indexed case. An zero pLastIndex can cause the index offsets inside the fetcher to have non-sensical values that can be either very large positive or very large negative numbers. Reviewed-By: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/frontend.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
index 1c4b522e45e..c2be5d7bd11 100644
--- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
@@ -1719,6 +1719,21 @@ void ProcessDraw(
if (i < endVertex)
{
+ if (!IsIndexedT::value)
+ {
+ fetchInfo_lo.pLastIndex = fetchInfo_lo.pIndices;
+ uint32_t offset;
+ offset = std::min(endVertex-i, (uint32_t) KNOB_SIMD16_WIDTH);
+#if USE_SIMD16_SHADERS
+ fetchInfo_lo.pLastIndex += offset;
+#else
+ fetchInfo_lo.pLastIndex += std::min(offset, (uint32_t) KNOB_SIMD_WIDTH);
+ uint32_t offset2 = std::min(offset, (uint32_t) KNOB_SIMD16_WIDTH)-KNOB_SIMD_WIDTH;
+ assert(offset >= 0);
+ fetchInfo_hi.pLastIndex = fetchInfo_hi.pIndices;
+ fetchInfo_hi.pLastIndex += offset2;
+#endif
+ }
// 1. Execute FS/VS for a single SIMD.
RDTSC_BEGIN(FEFetchShader, pDC->drawId);
#if USE_SIMD16_SHADERS