[Mesa-dev] [PATCH 03/15] swr: [rasterizer core] Fix some MSVC errors with SIMD16 FE

Tim Rowley timothy.o.rowley at intel.com
Tue Apr 25 14:50:28 UTC 2017


- add SIMDAPI decorator to a few functions in the binner and clipper.
- disabling buffer overrun warning for Assemble(uint32_t slot,
  simdvector *verts) due to what looks like a compiler bug when
  compiling the 16 wide frontend.
---
 src/gallium/drivers/swr/rasterizer/core/binner.cpp | 6 +++---
 src/gallium/drivers/swr/rasterizer/core/clip.cpp   | 6 +++---
 src/gallium/drivers/swr/rasterizer/core/clip.h     | 4 ++--
 src/gallium/drivers/swr/rasterizer/core/pa.h       | 6 ++++--
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
index 9d36f21..3c94004 100644
--- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
@@ -1008,7 +1008,7 @@ endBinTriangles:
 
 #if USE_SIMD16_FRONTEND
 template <typename CT>
-void BinTriangles_simd16(
+void SIMDAPI BinTriangles_simd16(
     DRAW_CONTEXT *pDC,
     PA_STATE& pa,
     uint32_t workerId,
@@ -1838,7 +1838,7 @@ void BinPoints(
 }
 
 #if USE_SIMD16_FRONTEND
-void BinPoints_simd16(
+void SIMDAPI BinPoints_simd16(
     DRAW_CONTEXT *pDC,
     PA_STATE& pa,
     uint32_t workerId,
@@ -2691,7 +2691,7 @@ void BinLines(
 }
 
 #if USE_SIMD16_FRONTEND
-void BinLines_simd16(
+void SIMDAPI BinLines_simd16(
     DRAW_CONTEXT *pDC,
     PA_STATE& pa,
     uint32_t workerId,
diff --git a/src/gallium/drivers/swr/rasterizer/core/clip.cpp b/src/gallium/drivers/swr/rasterizer/core/clip.cpp
index 6a5bf6c..c93e0fb 100644
--- a/src/gallium/drivers/swr/rasterizer/core/clip.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/clip.cpp
@@ -188,7 +188,7 @@ void ClipPoints(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simdvector p
 }
 
 #if USE_SIMD16_FRONTEND
-void ClipTriangles_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simd16vector prims[], uint32_t primMask, simd16scalari primId, simd16scalari viewportIdx)
+void SIMDAPI ClipTriangles_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simd16vector prims[], uint32_t primMask, simd16scalari primId, simd16scalari viewportIdx)
 {
     SWR_CONTEXT *pContext = pDC->pContext;
     AR_BEGIN(FEClipTriangles, pDC->drawId);
@@ -203,7 +203,7 @@ void ClipTriangles_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, si
     AR_END(FEClipTriangles, 1);
 }
 
-void ClipLines_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simd16vector prims[], uint32_t primMask, simd16scalari primId, simd16scalari viewportIdx)
+void SIMDAPI ClipLines_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simd16vector prims[], uint32_t primMask, simd16scalari primId, simd16scalari viewportIdx)
 {
     SWR_CONTEXT *pContext = pDC->pContext;
     AR_BEGIN(FEClipLines, pDC->drawId);
@@ -218,7 +218,7 @@ void ClipLines_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simd16
     AR_END(FEClipLines, 1);
 }
 
-void ClipPoints_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simd16vector prims[], uint32_t primMask, simd16scalari primId, simd16scalari viewportIdx)
+void SIMDAPI ClipPoints_simd16(DRAW_CONTEXT *pDC, PA_STATE& pa, uint32_t workerId, simd16vector prims[], uint32_t primMask, simd16scalari primId, simd16scalari viewportIdx)
 {
     SWR_CONTEXT *pContext = pDC->pContext;
     AR_BEGIN(FEClipPoints, pDC->drawId);
diff --git a/src/gallium/drivers/swr/rasterizer/core/clip.h b/src/gallium/drivers/swr/rasterizer/core/clip.h
index 28042d5..ad2745b 100644
--- a/src/gallium/drivers/swr/rasterizer/core/clip.h
+++ b/src/gallium/drivers/swr/rasterizer/core/clip.h
@@ -610,7 +610,7 @@ public:
             uint8_t* pBase = (uint8_t*)(&vertices[0].attrib[VERTEX_POSITION_SLOT]) + sizeof(float) * inputPrim;
 
 #if USE_SIMD16_FRONTEND
-            // TEMPORARY WORKAROUND for bizarre VS2015 code-gen bug - use dx11_clipping_03-09 failures to check for existence of bug
+            // TEMPORARY WORKAROUND for bizarre VS2015 code-gen bug
             static const float *dummy = reinterpret_cast<const float *>(pBase);
 #endif
 
@@ -867,7 +867,7 @@ public:
             uint8_t* pBase = (uint8_t*)(&vertices[0].attrib[VERTEX_POSITION_SLOT]) + sizeof(float) * inputPrim;
 
 #if 0
-            // TEMPORARY WORKAROUND for bizarre VS2015 code-gen bug - use dx11_clipping_03-09 failures to check for existence of bug
+            // TEMPORARY WORKAROUND for bizarre VS2015 code-gen bug
             static const float *dummy = reinterpret_cast<const float *>(pBase);
 #endif
 
diff --git a/src/gallium/drivers/swr/rasterizer/core/pa.h b/src/gallium/drivers/swr/rasterizer/core/pa.h
index 781c094..10570f4 100644
--- a/src/gallium/drivers/swr/rasterizer/core/pa.h
+++ b/src/gallium/drivers/swr/rasterizer/core/pa.h
@@ -645,7 +645,9 @@ struct PA_STATE_CUT : public PA_STATE
         }
     }
 
-    bool Assemble(uint32_t slot, simdvector verts[])
+// disabling buffer overrun warning for this function for what appears to be a bug in MSVC 2017
+PRAGMA_WARNING_PUSH_DISABLE(4789)
+    bool Assemble(uint32_t slot, simdvector *verts)
     {
         // process any outstanding verts
         ProcessVerts();
@@ -689,9 +691,9 @@ struct PA_STATE_CUT : public PA_STATE
                 pBase += SIMD_WIDTH;
             }
         }
-
         return true;
     }
+PRAGMA_WARNING_POP()
 
 #if ENABLE_AVX512_SIMD16
     bool Assemble_simd16(uint32_t slot, simd16vector verts[])
-- 
2.7.4



More information about the mesa-dev mailing list