From 66ff4f4209ef24ee7216925c15c4acc5ced88c3e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jarkko=20P=C3=B6yry?= Date: Thu, 9 Apr 2015 18:31:44 -0700 Subject: [PATCH] Add getTextureFormatChannelMask. Change-Id: I282ff43e628c9400a572163baa0e90bde30d460a --- framework/common/tcuTextureUtil.cpp | 9 +++++++++ framework/common/tcuTextureUtil.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp index cf5475f..c521c49 100644 --- a/framework/common/tcuTextureUtil.cpp +++ b/framework/common/tcuTextureUtil.cpp @@ -422,6 +422,15 @@ IVec4 getTextureFormatMantissaBitDepth (const TextureFormat& format) return select(chnBits.swizzle(chnSwz.x(), chnSwz.y(), chnSwz.z(), chnSwz.w()), IVec4(0), chnMask); } +BVec4 getTextureFormatChannelMask (const TextureFormat& format) +{ + const TextureSwizzle::Channel* const map = getChannelReadSwizzle(format.order).components; + return BVec4(deInRange32(map[0], TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_3) == DE_TRUE, + deInRange32(map[1], TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_3) == DE_TRUE, + deInRange32(map[2], TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_3) == DE_TRUE, + deInRange32(map[3], TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_3) == DE_TRUE); +} + static inline float linearInterpolate (float t, float minVal, float maxVal) { return minVal + (maxVal - minVal) * t; diff --git a/framework/common/tcuTextureUtil.hpp b/framework/common/tcuTextureUtil.hpp index 643a567..cd67e0f 100644 --- a/framework/common/tcuTextureUtil.hpp +++ b/framework/common/tcuTextureUtil.hpp @@ -82,6 +82,7 @@ struct TextureFormatInfo TextureFormatInfo getTextureFormatInfo (const TextureFormat& format); IVec4 getTextureFormatBitDepth (const TextureFormat& format); IVec4 getTextureFormatMantissaBitDepth (const TextureFormat& format); +BVec4 getTextureFormatChannelMask (const TextureFormat& format); // Texture fill. void clear (const PixelBufferAccess& access, const Vec4& color); -- 2.7.4