diff options
author | Tim Rowley <[email protected]> | 2017-08-10 16:11:35 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-09-06 11:02:29 -0500 |
commit | 1ebf6fc86556669fbb7b30e560119622497a5051 (patch) | |
tree | 58d4e814e8837528b6d1502fd70768c7884f2dcf /src/gallium/drivers | |
parent | 9df5691fffafdc31b82eb18f3cd5ce7d45eb83a2 (diff) |
swr/rast: Remove use of C++14 template variable
SWR rasterizer must remain C++11 compliant.
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/binner.cpp | 6 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/binner.h | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp index 832c47d6e4b..01c2f8f7a33 100644 --- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp @@ -502,7 +502,7 @@ void SIMDCALL BinTrianglesImpl( } // Adjust for pixel center location - typename SIMD_T::Float offset = g_pixelOffsets<SIMD_T>[rastState.pixelLocation]; + typename SIMD_T::Float offset = SwrPixelOffsets<SIMD_T>::GetOffset(rastState.pixelLocation); tri[0].x = SIMD_T::add_ps(tri[0].x, offset); tri[0].y = SIMD_T::add_ps(tri[0].y, offset); @@ -1332,7 +1332,7 @@ void BinPointsImpl( } } - typename SIMD_T::Float offset = g_pixelOffsets<SIMD_T>[rastState.pixelLocation]; + typename SIMD_T::Float offset = SwrPixelOffsets<SIMD_T>::GetOffset(rastState.pixelLocation); prim[0].x = SIMD_T::add_ps(prim[0].x, offset); prim[0].y = SIMD_T::add_ps(prim[0].y, offset); @@ -1666,7 +1666,7 @@ void SIMDCALL BinLinesImpl( } // adjust for pixel center location - typename SIMD_T::Float offset = g_pixelOffsets<SIMD_T>[rastState.pixelLocation]; + typename SIMD_T::Float offset = SwrPixelOffsets<SIMD_T>::GetOffset(rastState.pixelLocation); prim[0].x = SIMD_T::add_ps(prim[0].x, offset); prim[0].y = SIMD_T::add_ps(prim[0].y, offset); diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.h b/src/gallium/drivers/swr/rasterizer/core/binner.h index e842aa663b2..97e113f7f28 100644 --- a/src/gallium/drivers/swr/rasterizer/core/binner.h +++ b/src/gallium/drivers/swr/rasterizer/core/binner.h @@ -31,11 +31,19 @@ ////////////////////////////////////////////////////////////////////////// /// @brief Offsets added to post-viewport vertex positions based on /// raster state. +/// +/// Can't use templated variable because we must stick with C++11 features. +/// Template variables were introduced with C++14 template <typename SIMD_T> -static const typename SIMD_T::Float g_pixelOffsets[SWR_PIXEL_LOCATION_UL + 1] = +struct SwrPixelOffsets { - SIMD_T::set1_ps(0.0f), // SWR_PIXEL_LOCATION_CENTER - SIMD_T::set1_ps(0.5f), // SWR_PIXEL_LOCATION_UL +public: + INLINE static typename SIMD_T::Float GetOffset(uint32_t loc) + { + SWR_ASSERT(loc <= 1); + + return SIMD_T::set1_ps(loc ? 0.5f : 0.0f); + } }; ////////////////////////////////////////////////////////////////////////// |