[Mesa-dev] [PATCH 6/6] swr: [rasterizer] warning cleanup

Tim Rowley timothy.o.rowley at intel.com
Mon Apr 25 22:12:15 UTC 2016


---
 .../drivers/swr/rasterizer/common/swr_assert.h     | 17 ++++-----
 .../drivers/swr/rasterizer/core/backend.cpp        | 24 ------------
 .../drivers/swr/rasterizer/core/format_types.h     |  1 -
 .../drivers/swr/rasterizer/core/frontend.cpp       |  6 +--
 src/gallium/drivers/swr/rasterizer/core/pa.h       |  2 +-
 .../drivers/swr/rasterizer/core/rasterizer.cpp     | 43 +++++++---------------
 .../drivers/swr/rasterizer/core/ringbuffer.h       |  4 +-
 .../drivers/swr/rasterizer/jitter/fetch_jit.cpp    |  2 -
 .../drivers/swr/rasterizer/memory/Convert.h        |  2 +-
 9 files changed, 27 insertions(+), 74 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/common/swr_assert.h b/src/gallium/drivers/swr/rasterizer/common/swr_assert.h
index fecadb3..a805acc 100644
--- a/src/gallium/drivers/swr/rasterizer/common/swr_assert.h
+++ b/src/gallium/drivers/swr/rasterizer/common/swr_assert.h
@@ -59,13 +59,6 @@
 
 #else
 
-#if SWR_ENABLE_ASSERTS
-#if defined(assert)
-#undef assert
-#endif
-#define assert(exp) SWR_ASSERT(exp)
-#endif
-
 bool SwrAssert(
     bool        chkDebugger,
     bool&       enabled,
@@ -87,6 +80,12 @@ bool SwrAssert(
 
 #if SWR_ENABLE_ASSERTS
 #define SWR_ASSERT(e, ...) _SWR_ASSERT(true, e, ##__VA_ARGS__)
+
+#if defined(assert)
+#undef assert
+#endif
+#define assert(exp) SWR_ASSERT(exp)
+
 #endif
 
 #if SWR_ENABLE_REL_ASSERTS
@@ -97,11 +96,11 @@ bool SwrAssert(
 #endif // SWR_ENABLE_ASSERTS || SWR_ENABLE_REL_ASSERTS
 
 #if !SWR_ENABLE_ASSERTS
-#define SWR_ASSERT(e, ...)
+#define SWR_ASSERT(e, ...) (void)(0)
 #endif
 
 #if !SWR_ENABLE_REL_ASSERTS
-#define SWR_REL_ASSERT(e, ...)
+#define SWR_REL_ASSERT(e, ...) (void)(0)
 #endif
 
 #define SWR_NOT_IMPL SWR_ASSERT(0, "%s not implemented", __FUNCTION__)
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.cpp b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
index 1d923ea..d2547f3 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
@@ -37,30 +37,6 @@
 
 #include <algorithm>
 
-const __m128 vTileOffsetsX = {0.5, KNOB_TILE_X_DIM - 0.5, 0.5, KNOB_TILE_X_DIM - 0.5};
-const __m128 vTileOffsetsY = {0.5, 0.5, KNOB_TILE_Y_DIM - 0.5, KNOB_TILE_Y_DIM - 0.5};
-
-/// @todo move to common lib
-#define MASKTOVEC(i3,i2,i1,i0) {-i0,-i1,-i2,-i3}
-static const __m128 gMaskToVec[] = {
-    MASKTOVEC(0,0,0,0),
-    MASKTOVEC(0,0,0,1),
-    MASKTOVEC(0,0,1,0),
-    MASKTOVEC(0,0,1,1),
-    MASKTOVEC(0,1,0,0),
-    MASKTOVEC(0,1,0,1),
-    MASKTOVEC(0,1,1,0),
-    MASKTOVEC(0,1,1,1),
-    MASKTOVEC(1,0,0,0),
-    MASKTOVEC(1,0,0,1),
-    MASKTOVEC(1,0,1,0),
-    MASKTOVEC(1,0,1,1),
-    MASKTOVEC(1,1,0,0),
-    MASKTOVEC(1,1,0,1),
-    MASKTOVEC(1,1,1,0),
-    MASKTOVEC(1,1,1,1),
-};
-
 typedef void(*PFN_CLEAR_TILES)(DRAW_CONTEXT*, SWR_RENDERTARGET_ATTACHMENT rt, uint32_t, DWORD[4]);
 static PFN_CLEAR_TILES sClearTilesTable[NUM_SWR_FORMATS];
 
diff --git a/src/gallium/drivers/swr/rasterizer/core/format_types.h b/src/gallium/drivers/swr/rasterizer/core/format_types.h
index 9acf846..cb9fcef 100644
--- a/src/gallium/drivers/swr/rasterizer/core/format_types.h
+++ b/src/gallium/drivers/swr/rasterizer/core/format_types.h
@@ -620,7 +620,6 @@ template<> struct TypeTraits<SWR_TYPE_FLOAT, 16> : PackTraits<16>
 
         static const uint32_t HALF_EXP_BITS = 5;
         static const uint32_t HALF_MANTISSA_BITS = 10;
-        static const uint32_t HALF_MANTISSA_MASK = (1U << HALF_MANTISSA_BITS) - 1;
         static const uint32_t HALF_EXP_MASK = ((1U << HALF_EXP_BITS) - 1) << HALF_MANTISSA_BITS;
 
         // minimum exponent required, exponents below this are flushed to 0.
diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
index e6c77d8..4d5afea 100644
--- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp
@@ -1125,10 +1125,7 @@ static void TessellationStages(
                 {
                     simdvector prim[3]; // Only deal with triangles, lines, or points
                     RDTSC_START(FEPAAssemble);
-#if SWR_ENABLE_ASSERTS
-                    bool assemble =
-#endif
-                        tessPa.Assemble(VERTEX_POSITION_SLOT, prim);
+                    bool assemble = tessPa.Assemble(VERTEX_POSITION_SLOT, prim);
                     RDTSC_STOP(FEPAAssemble, 1, 0);
                     SWR_ASSERT(assemble);
 
@@ -1848,7 +1845,6 @@ void BinTriangles(
                 }
             }
         }
-nextPrimitive:
         triMask &= ~(1 << triIndex);
     }
 
diff --git a/src/gallium/drivers/swr/rasterizer/core/pa.h b/src/gallium/drivers/swr/rasterizer/core/pa.h
index 067deab..d3ed279 100644
--- a/src/gallium/drivers/swr/rasterizer/core/pa.h
+++ b/src/gallium/drivers/swr/rasterizer/core/pa.h
@@ -1009,7 +1009,7 @@ struct PA_TESS : PA_STATE
     simdvector& GetSimdVector(uint32_t index, uint32_t slot)
     {
         SWR_ASSERT(0, "%s NOT IMPLEMENTED", __FUNCTION__);
-        static simdvector junk = { 0 };
+        static simdvector junk;
         return junk;
     }
 
diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
index f7a462c..54c2904 100644
--- a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp
@@ -45,25 +45,6 @@ void StepRasterTileY(uint32_t MaxRT, RenderOutputBuffers &buffers, RenderOutputB
                      uint32_t colorRowStep, uint32_t depthRowStep, uint32_t stencilRowStep);
 
 #define MASKTOVEC(i3,i2,i1,i0) {-i0,-i1,-i2,-i3}
-const __m128 gMaskToVec[] = {
-    MASKTOVEC(0,0,0,0),
-    MASKTOVEC(0,0,0,1),
-    MASKTOVEC(0,0,1,0),
-    MASKTOVEC(0,0,1,1),
-    MASKTOVEC(0,1,0,0),
-    MASKTOVEC(0,1,0,1),
-    MASKTOVEC(0,1,1,0),
-    MASKTOVEC(0,1,1,1),
-    MASKTOVEC(1,0,0,0),
-    MASKTOVEC(1,0,0,1),
-    MASKTOVEC(1,0,1,0),
-    MASKTOVEC(1,0,1,1),
-    MASKTOVEC(1,1,0,0),
-    MASKTOVEC(1,1,0,1),
-    MASKTOVEC(1,1,1,0),
-    MASKTOVEC(1,1,1,1),
-};
-
 const __m256d gMaskToVecpd[] =
 {
     MASKTOVEC(0, 0, 0, 0),
@@ -1172,16 +1153,20 @@ void StepRasterTileY(uint32_t NumRT, RenderOutputBuffers &buffers, RenderOutputB
 // initialize rasterizer function table
 PFN_WORK_FUNC gRasterizerTable[2][SWR_MULTISAMPLE_TYPE_MAX] =
 {
-    RasterizeTriangle<false, SWR_MULTISAMPLE_1X>,
-    RasterizeTriangle<false, SWR_MULTISAMPLE_2X>,
-    RasterizeTriangle<false, SWR_MULTISAMPLE_4X>,
-    RasterizeTriangle<false, SWR_MULTISAMPLE_8X>,
-    RasterizeTriangle<false, SWR_MULTISAMPLE_16X>,
-    RasterizeTriangle<true, SWR_MULTISAMPLE_1X>,
-    RasterizeTriangle<true, SWR_MULTISAMPLE_2X>,
-    RasterizeTriangle<true, SWR_MULTISAMPLE_4X>,
-    RasterizeTriangle<true, SWR_MULTISAMPLE_8X>,
-    RasterizeTriangle<true, SWR_MULTISAMPLE_16X>
+    {
+        RasterizeTriangle<false, SWR_MULTISAMPLE_1X>,
+        RasterizeTriangle<false, SWR_MULTISAMPLE_2X>,
+        RasterizeTriangle<false, SWR_MULTISAMPLE_4X>,
+        RasterizeTriangle<false, SWR_MULTISAMPLE_8X>,
+        RasterizeTriangle<false, SWR_MULTISAMPLE_16X>
+    },
+    {
+        RasterizeTriangle<true, SWR_MULTISAMPLE_1X>,
+        RasterizeTriangle<true, SWR_MULTISAMPLE_2X>,
+        RasterizeTriangle<true, SWR_MULTISAMPLE_4X>,
+        RasterizeTriangle<true, SWR_MULTISAMPLE_8X>,
+        RasterizeTriangle<true, SWR_MULTISAMPLE_16X>
+    }
 };
 
 void RasterizeLine(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData)
diff --git a/src/gallium/drivers/swr/rasterizer/core/ringbuffer.h b/src/gallium/drivers/swr/rasterizer/core/ringbuffer.h
index 7ff109d..d8eb50a 100644
--- a/src/gallium/drivers/swr/rasterizer/core/ringbuffer.h
+++ b/src/gallium/drivers/swr/rasterizer/core/ringbuffer.h
@@ -90,8 +90,8 @@ public:
         return (numEnqueued == mNumEntries);
     }
 
-    INLINE volatile uint64_t GetTail() { return mRingTail; }
-    INLINE volatile uint64_t GetHead() { return mRingHead; }
+    INLINE uint64_t GetTail() volatile { return mRingTail; }
+    INLINE uint64_t GetHead() volatile { return mRingHead; }
 
 protected:
     T* mpRingBuffer;
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 74668a6..ba1096d 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -533,8 +533,6 @@ void FetchJit::CreateGatherOddFormats(SWR_FORMAT format, Value* pBase, Value* of
     // only works if pixel size is <= 32bits
     SWR_ASSERT(info.bpp <= 32);
 
-    uint32_t numComps = info.numComps;
-
     Value* gather = VUNDEF_I();
 
     // assign defaults
diff --git a/src/gallium/drivers/swr/rasterizer/memory/Convert.h b/src/gallium/drivers/swr/rasterizer/memory/Convert.h
index 7c185e5..4c4642f 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/Convert.h
+++ b/src/gallium/drivers/swr/rasterizer/memory/Convert.h
@@ -37,7 +37,7 @@
 ///        float
 /// @param val - 16-bit float
 /// @todo Maybe move this outside of this file into a header?
-static float ConvertSmallFloatTo32(UINT val)
+static INLINE float ConvertSmallFloatTo32(UINT val)
 {
     UINT result;
     if ((val & 0x7fff) == 0)
-- 
1.9.1



More information about the mesa-dev mailing list