summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h')
-rw-r--r--src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
index 9b412f8b344..0694a99808f 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
+++ b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
@@ -153,6 +153,107 @@ struct SimdTile <R8_UINT,R8_UINT>
}
};
+#if ENABLE_AVX512_SIMD16
+//////////////////////////////////////////////////////////////////////////
+/// SimdTile 8x2 for AVX-512
+//////////////////////////////////////////////////////////////////////////
+
+template<SWR_FORMAT HotTileFormat, SWR_FORMAT SrcOrDstFormat>
+struct SimdTile_16
+{
+ // SimdTile is SOA (e.g. rrrrrrrrrrrrrrrr gggggggggggggggg bbbbbbbbbbbbbbbb aaaaaaaaaaaaaaaa )
+ float color[FormatTraits<HotTileFormat>::numComps][KNOB_SIMD16_WIDTH];
+
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Retrieve color from simd.
+ /// @param index - linear index to color within simd.
+ /// @param outputColor - output color
+ INLINE void GetSwizzledColor(
+ uint32_t index,
+ float outputColor[4])
+ {
+ // SOA pattern for 8x2..
+ // 0 1 4 5 8 9 C D
+ // 2 3 6 7 A B E F
+ // The offset converts pattern to linear
+ static const uint32_t offset[KNOB_SIMD16_WIDTH] = { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15 };
+
+ for (uint32_t i = 0; i < FormatTraits<SrcOrDstFormat>::numComps; ++i)
+ {
+ outputColor[i] = this->color[FormatTraits<SrcOrDstFormat>::swizzle(i)][offset[index]];
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Retrieve color from simd.
+ /// @param index - linear index to color within simd.
+ /// @param outputColor - output color
+ INLINE void SetSwizzledColor(
+ uint32_t index,
+ const float src[4])
+ {
+ // SOA pattern for 8x2..
+ // 0 1 4 5 8 9 C D
+ // 2 3 6 7 A B E F
+ // The offset converts pattern to linear
+ static const uint32_t offset[KNOB_SIMD16_WIDTH] = { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15 };
+
+ for (uint32_t i = 0; i < FormatTraits<SrcOrDstFormat>::numComps; ++i)
+ {
+ this->color[i][offset[index]] = src[i];
+ }
+ }
+};
+
+template<>
+struct SimdTile_16 <R8_UINT, R8_UINT>
+{
+ // SimdTile is SOA (e.g. rrrrrrrrrrrrrrrr gggggggggggggggg bbbbbbbbbbbbbbbb aaaaaaaaaaaaaaaa )
+ uint8_t color[FormatTraits<R8_UINT>::numComps][KNOB_SIMD16_WIDTH];
+
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Retrieve color from simd.
+ /// @param index - linear index to color within simd.
+ /// @param outputColor - output color
+ INLINE void GetSwizzledColor(
+ uint32_t index,
+ float outputColor[4])
+ {
+ // SOA pattern for 8x2..
+ // 0 1 4 5 8 9 C D
+ // 2 3 6 7 A B E F
+ // The offset converts pattern to linear
+ static const uint32_t offset[KNOB_SIMD16_WIDTH] = { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15 };
+
+ for (uint32_t i = 0; i < FormatTraits<R8_UINT>::numComps; ++i)
+ {
+ uint32_t src = this->color[FormatTraits<R8_UINT>::swizzle(i)][offset[index]];
+ outputColor[i] = *(float*)&src;
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ /// @brief Retrieve color from simd.
+ /// @param index - linear index to color within simd.
+ /// @param outputColor - output color
+ INLINE void SetSwizzledColor(
+ uint32_t index,
+ const float src[4])
+ {
+ // SOA pattern for 8x2..
+ // 0 1 4 5 8 9 C D
+ // 2 3 6 7 A B E F
+ // The offset converts pattern to linear
+ static const uint32_t offset[KNOB_SIMD16_WIDTH] = { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15 };
+
+ for (uint32_t i = 0; i < FormatTraits<R8_UINT>::numComps; ++i)
+ {
+ this->color[i][offset[index]] = *(uint8_t*)&src[i];
+ }
+ }
+};
+
+#endif
//////////////////////////////////////////////////////////////////////////
/// @brief Computes lod offset for 1D surface at specified lod.
/// @param baseWidth - width of basemip (mip 0).