Add has{Depth/Stencil)Component() utilities for TextureFormat.
authorMika Isojärvi <misojarvi@google.com>
Fri, 7 Aug 2015 22:08:28 +0000 (15:08 -0700)
committerPyry Haulos <phaulos@google.com>
Thu, 20 Aug 2015 22:19:14 +0000 (22:19 +0000)
Change-Id: Idbe5636ee882eb4917b740d9b8ff8e2e77b8ddb9
(cherry picked from commit 0644e3c835273f5c26836ef94f6fed8811d37944)

framework/common/tcuTextureUtil.cpp
framework/common/tcuTextureUtil.hpp

index 3fdfc0b..72a9a12 100644 (file)
@@ -87,6 +87,36 @@ bool isCombinedDepthStencilType (TextureFormat::ChannelType type)
                        type == TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV;
 }
 
+bool hasStencilComponent (TextureFormat::ChannelOrder order)
+{
+       DE_STATIC_ASSERT(TextureFormat::CHANNELORDER_LAST == 18);
+
+       switch (order)
+       {
+               case TextureFormat::S:
+               case TextureFormat::DS:
+                       return true;
+
+               default:
+                       return false;
+       }
+}
+
+bool hasDepthComponent (TextureFormat::ChannelOrder order)
+{
+       DE_STATIC_ASSERT(TextureFormat::CHANNELORDER_LAST == 18);
+
+       switch (order)
+       {
+               case TextureFormat::D:
+               case TextureFormat::DS:
+                       return true;
+
+               default:
+                       return false;
+       }
+}
+
 //! Get texture channel class for format
 TextureChannelClass getTextureChannelClass (TextureFormat::ChannelType channelType)
 {
index b714a70..b31f2d0 100644 (file)
@@ -40,6 +40,8 @@ PixelBufferAccess             flipYAccess                                     (const PixelBufferAccess& access);
 ConstPixelBufferAccess flipYAccess                                     (const ConstPixelBufferAccess& access);
 
 bool                                   isCombinedDepthStencilType      (TextureFormat::ChannelType type);
+bool                                   hasStencilComponent                     (TextureFormat::ChannelOrder order);
+bool                                   hasDepthComponent                       (TextureFormat::ChannelOrder order);
 
 // sRGB - linear conversion.
 Vec4                                   sRGBToLinear                            (const Vec4& cs);