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)
committerMika Isojärvi <misojarvi@google.com>
Fri, 7 Aug 2015 22:08:28 +0000 (15:08 -0700)
Change-Id: Idbe5636ee882eb4917b740d9b8ff8e2e77b8ddb9

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

index 2591f10..778bc70 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 c51e303..35bb122 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);