[Mesa-dev] [PATCH 07/11] swr: [rasterizer] Add support for X24_TYPELESS_G8_UINT format

Tim Rowley timothy.o.rowley at intel.com
Tue May 3 16:13:29 UTC 2016


---
 .../drivers/swr/rasterizer/common/formats.cpp      | 25 ++++++++++++++++------
 .../drivers/swr/rasterizer/common/formats.h        |  1 +
 .../drivers/swr/rasterizer/core/format_traits.h    | 22 +++++++++++++++++++
 3 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/common/formats.cpp b/src/gallium/drivers/swr/rasterizer/common/formats.cpp
index ed8ce7e..21ee50b 100644
--- a/src/gallium/drivers/swr/rasterizer/common/formats.cpp
+++ b/src/gallium/drivers/swr/rasterizer/common/formats.cpp
@@ -2380,14 +2380,25 @@ const SWR_FORMAT_INFO gFormatInfo[] = {
         1, // bcHeight
         false, // isLuminance
     },
-    // 0xda (Padding)
+    // X24_TYPELESS_G8_UINT (0xda)
     {
-        "UNKNOWN",
-        { SWR_TYPE_UNKNOWN, SWR_TYPE_UNKNOWN, SWR_TYPE_UNKNOWN, SWR_TYPE_UNKNOWN },
-        { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, false, false, false,
-        { false, false, false, false },
-        { 0.0f, 0.0f, 0.0f, 0.0f },
-        1, 1, false    },
+        "X24_TYPELESS_G8_UINT",
+        { SWR_TYPE_UINT, SWR_TYPE_UNKNOWN, SWR_TYPE_UNKNOWN, SWR_TYPE_UNKNOWN },
+        { 0, 0, 0, 0x1 }, // Defaults for missing components
+        { 1, 0, 0, 0 }, // Swizzle
+        { 32, 0, 0, 0 }, // Bits per component
+        32, // Bits per element
+        4, // Bytes per element
+        1, // Num components
+        false, // isSRGB
+        false, // isBC
+        false, // isSubsampled
+        { false, false, false, false }, // Is normalized?
+        { 1.0f, 0, 0, 0 }, // To float scale factor
+        1, // bcWidth
+        1, // bcHeight
+        false, // isLuminance
+    },
     // 0xdb (Padding)
     {
         "UNKNOWN",
diff --git a/src/gallium/drivers/swr/rasterizer/common/formats.h b/src/gallium/drivers/swr/rasterizer/common/formats.h
index b9dd53e..c7108c5 100644
--- a/src/gallium/drivers/swr/rasterizer/common/formats.h
+++ b/src/gallium/drivers/swr/rasterizer/common/formats.h
@@ -106,6 +106,7 @@ enum SWR_FORMAT
     R32_UINT = 0xD7,
     R32_FLOAT = 0xD8,
     R24_UNORM_X8_TYPELESS = 0xD9,
+    X24_TYPELESS_G8_UINT = 0xDA,
     R24_UNORM_X8_TYPELESS_LD = 0xDC,
     L32_UNORM = 0xDD,
     L16A16_UNORM = 0xDF,
diff --git a/src/gallium/drivers/swr/rasterizer/core/format_traits.h b/src/gallium/drivers/swr/rasterizer/core/format_traits.h
index 52340f4..ba36498 100644
--- a/src/gallium/drivers/swr/rasterizer/core/format_traits.h
+++ b/src/gallium/drivers/swr/rasterizer/core/format_traits.h
@@ -1237,6 +1237,28 @@ template<> struct FormatTraits<R24_UNORM_X8_TYPELESS> :
 };
 
 //////////////////////////////////////////////////////////////////////////
+/// FormatTraits<X24_TYPELESS_G8_UINT> - Format traits specialization for X24_TYPELESS_G8_UINT
+//////////////////////////////////////////////////////////////////////////
+template<> struct FormatTraits<X24_TYPELESS_G8_UINT> :
+    ComponentTraits<SWR_TYPE_UINT, 32>,
+    FormatSwizzle<1>,
+    Defaults<0, 0, 0, 0x1>
+{
+    static const uint32_t bpp{ 32 };
+    static const uint32_t numComps{ 1 };
+    static const bool hasAlpha{ false };
+    static const uint32_t alphaComp{ 3 };
+    static const bool isSRGB{ false };
+    static const bool isBC{ false };
+    static const bool isSubsampled{ false };
+    static const uint32_t bcWidth{ 1 };
+    static const uint32_t bcHeight{ 1 };
+
+    typedef TransposeSingleComponent<32> TransposeT;
+    typedef Format1<32> FormatT;
+};
+
+//////////////////////////////////////////////////////////////////////////
 /// FormatTraits<R24_UNORM_X8_TYPELESS_LD> - Format traits specialization for R24_UNORM_X8_TYPELESS_LD
 //////////////////////////////////////////////////////////////////////////
 template<> struct FormatTraits<R24_UNORM_X8_TYPELESS_LD> :
-- 
1.9.1



More information about the mesa-dev mailing list