From e7201bd31b4c7beb1a2d0c4659477946e263d5cf Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Fri, 22 Apr 2016 19:41:23 -0600 Subject: [PATCH] swr: [rasterizer] warning cleanup Reviewed-by: Bruce Cherniak --- .../swr/rasterizer/common/swr_assert.h | 17 ++++---- .../drivers/swr/rasterizer/core/backend.cpp | 24 ----------- .../swr/rasterizer/core/format_types.h | 1 - .../drivers/swr/rasterizer/core/frontend.cpp | 6 +-- src/gallium/drivers/swr/rasterizer/core/pa.h | 2 +- .../swr/rasterizer/core/rasterizer.cpp | 43 ++++++------------- .../drivers/swr/rasterizer/core/ringbuffer.h | 4 +- .../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 fecadb3d499..a805acc777c 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 1d923ead6f1..d2547f39888 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp @@ -37,30 +37,6 @@ #include -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 bffb9cc58f7..c68062609d8 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 : 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 e6c77d8f068..4d5afea5d32 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 067deabb411..d3ed279dedf 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 f7a462c3174..54c2904b5fb 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, - RasterizeTriangle, - RasterizeTriangle, - RasterizeTriangle, - RasterizeTriangle, - RasterizeTriangle, - RasterizeTriangle, - RasterizeTriangle, - RasterizeTriangle, - RasterizeTriangle + { + RasterizeTriangle, + RasterizeTriangle, + RasterizeTriangle, + RasterizeTriangle, + RasterizeTriangle + }, + { + RasterizeTriangle, + RasterizeTriangle, + RasterizeTriangle, + RasterizeTriangle, + RasterizeTriangle + } }; 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 7ff109d4fe8..d8eb50a8d83 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 74668a65bad..ba1096dc214 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 7c185e5e454..4c4642f6c64 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) -- 2.30.2