From 43b3c7468cee6a00bb75470ed5386b2c54b88874 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mika=20Isoj=C3=A4rvi?= Date: Fri, 7 Aug 2015 15:08:28 -0700 Subject: [PATCH] Add has{Depth/Stencil)Component() utilities for TextureFormat. Change-Id: Idbe5636ee882eb4917b740d9b8ff8e2e77b8ddb9 (cherry picked from commit 0644e3c835273f5c26836ef94f6fed8811d37944) --- framework/common/tcuTextureUtil.cpp | 30 ++++++++++++++++++++++++++++++ framework/common/tcuTextureUtil.hpp | 2 ++ 2 files changed, 32 insertions(+) diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp index 3fdfc0b..72a9a12 100644 --- a/framework/common/tcuTextureUtil.cpp +++ b/framework/common/tcuTextureUtil.cpp @@ -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) { diff --git a/framework/common/tcuTextureUtil.hpp b/framework/common/tcuTextureUtil.hpp index b714a70..b31f2d0 100644 --- a/framework/common/tcuTextureUtil.hpp +++ b/framework/common/tcuTextureUtil.hpp @@ -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); -- 2.7.4