return de::inBounds(x, 0, access.getWidth()) && de::inBounds(y, 0, access.getHeight()) && de::inBounds(z, 0, access.getDepth());
}
-static inline bool isSRGB (TextureFormat format)
-{
- return format.order == TextureFormat::sRGB || format.order == TextureFormat::sRGBA;
-}
-
template<typename ScalarType>
inline Vector<ScalarType, 4> lookup (const ConstPixelBufferAccess& access, const Sampler& sampler, int i, int j, int k)
{
}
}
-static inline bool isSRGB (TextureFormat format)
-{
- return format.order == TextureFormat::sRGB || format.order == TextureFormat::sRGBA;
-}
-
static bool isFixedPointDepthTextureFormat (const tcu::TextureFormat& format)
{
const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(format.type);
cl[3]);
}
+bool isSRGB (TextureFormat format)
+{
+ return format.order == TextureFormat::sRGB || format.order == TextureFormat::sRGBA;
+}
+
//! Get texture channel class for format
TextureChannelClass getTextureChannelClass (TextureFormat::ChannelType channelType)
{
// sRGB - linear conversion.
Vec4 sRGBToLinear (const Vec4& cs);
Vec4 linearToSRGB (const Vec4& cl);
+bool isSRGB (TextureFormat format);
/*--------------------------------------------------------------------*//*!
* \brief Color channel storage type
bool dstIsFloat = dstClass == tcu::TEXTURECHANNELCLASS_FLOATING_POINT ||
dstClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
dstClass == tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT;
- bool srcIsSRGB = src.raw().getFormat().order == tcu::TextureFormat::sRGB || src.raw().getFormat().order == tcu::TextureFormat::sRGBA;
- bool dstIsSRGB = dst.getFormat().order == tcu::TextureFormat::sRGB || dst.getFormat().order == tcu::TextureFormat::sRGBA;
+ bool srcIsSRGB = tcu::isSRGB(src.raw().getFormat());
+ bool dstIsSRGB = tcu::isSRGB(dst.getFormat());
const bool convertSRGB = m_sRGBUpdateEnabled && glu::isContextTypeES(getType());
if (!convertSRGB)
tcu::Sampler::FilterMode sFilter = (scale && filter == GL_LINEAR) ? tcu::Sampler::LINEAR : tcu::Sampler::NEAREST;
tcu::Sampler sampler (tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE,
sFilter, sFilter, 0.0f /* lod threshold */, false /* non-normalized coords */);
- bool srcIsSRGB = src.getFormat().order == tcu::TextureFormat::sRGB || src.getFormat().order == tcu::TextureFormat::sRGBA;
- bool dstIsSRGB = dst.getFormat().order == tcu::TextureFormat::sRGB || dst.getFormat().order == tcu::TextureFormat::sRGBA;
+ bool srcIsSRGB = tcu::isSRGB(src.getFormat());
+ bool dstIsSRGB = tcu::isSRGB(dst.getFormat());
const bool convertSRGB = m_sRGBUpdateEnabled && glu::isContextTypeES(getType());
if (!convertSRGB)
{
IVec4 colorArea = intersect(baseArea, getBufferRect(colorBuf0));
rr::MultisamplePixelBufferAccess access = rr::getSubregion(colorBuf0, colorArea.x(), colorArea.y(), colorArea.z(), colorArea.w());
- bool isSRGB = colorBuf0.raw().getFormat().order == tcu::TextureFormat::sRGB || colorBuf0.raw().getFormat().order == tcu::TextureFormat::sRGBA;
+ bool isSRGB = tcu::isSRGB(colorBuf0.raw().getFormat());
Vec4 c = (isSRGB && m_sRGBUpdateEnabled) ? tcu::linearToSRGB(m_clearColor) : m_clearColor;
bool maskUsed = !m_colorMask[0] || !m_colorMask[1] || !m_colorMask[2] || !m_colorMask[3];
bool maskZero = !m_colorMask[0] && !m_colorMask[1] && !m_colorMask[2] && !m_colorMask[3];
rr::MultisamplePixelBufferAccess access = rr::getSubregion(colorBuf, area.x(), area.y(), area.z(), area.w());
Vec4 color (value[0], value[1], value[2], value[3]);
- if (m_sRGBUpdateEnabled && (access.raw().getFormat().order == tcu::TextureFormat::sRGB ||
- access.raw().getFormat().order == tcu::TextureFormat::sRGBA))
+ if (m_sRGBUpdateEnabled && tcu::isSRGB(access.raw().getFormat()))
color = tcu::linearToSRGB(color);
if (!maskUsed)
const StencilState& stencilState = state.stencilStates[fragmentFacing];
Vec4 colorMaskFactor (state.colorMask[0] ? 1.0f : 0.0f, state.colorMask[1] ? 1.0f : 0.0f, state.colorMask[2] ? 1.0f : 0.0f, state.colorMask[3] ? 1.0f : 0.0f);
Vec4 colorMaskNegationFactor (state.colorMask[0] ? 0.0f : 1.0f, state.colorMask[1] ? 0.0f : 1.0f, state.colorMask[2] ? 0.0f : 1.0f, state.colorMask[3] ? 0.0f : 1.0f);
- bool sRGBTarget = state.sRGBEnabled && (colorBuffer.getFormat().order == tcu::TextureFormat::sRGBA ||
- colorBuffer.getFormat().order == tcu::TextureFormat::sRGB);
+ bool sRGBTarget = state.sRGBEnabled && tcu::isSRGB(colorBuffer.getFormat());
DE_ASSERT(SAMPLE_REGISTER_SIZE % numSamplesPerFragment == 0);
tcu::RGBA getToSRGBConversionThreshold (const tcu::TextureFormat& src, const tcu::TextureFormat& dst)
{
// Only SRGB8 and SRGB8_ALPHA8 formats are supported.
- DE_ASSERT(dst.type == tcu::TextureFormat::UNORM_INT8 && (dst.order == tcu::TextureFormat::sRGB || dst.order == tcu::TextureFormat::sRGBA));
+ DE_ASSERT(dst.type == tcu::TextureFormat::UNORM_INT8 && tcu::isSRGB(dst));
const tcu::IVec4 bits = tcu::getTextureFormatMantissaBitDepth(src);
const bool dstHasAlpha = dst.order == tcu::TextureFormat::sRGBA;
static void renderFloatReference (const tcu::PixelBufferAccess& dst, int gridWidth, int gridHeight, int numComponents, const float* vertices)
{
- const bool isSRGB = dst.getFormat().order == tcu::TextureFormat::sRGB ||dst.getFormat().order == tcu::TextureFormat::sRGBA;
+ const bool isSRGB = tcu::isSRGB(dst.getFormat());
const float cellW = (float)dst.getWidth() / (float)(gridWidth-1);
const float cellH = (float)dst.getHeight() / (float)(gridHeight-1);
{
const tcu::TextureFormat srcFormat = glu::mapGLInternalFormat(m_srcFormat);
const tcu::TextureFormat dstFormat = glu::mapGLInternalFormat(m_dstFormat);
- const bool srcIsSRGB = (srcFormat.order == tcu::TextureFormat::sRGBA);
- const bool dstIsSRGB = (dstFormat.order == tcu::TextureFormat::sRGBA);
+ const bool srcIsSRGB = tcu::isSRGB(srcFormat);
+ const bool dstIsSRGB = tcu::isSRGB(dstFormat);
tcu::RGBA threshold;
{
const tcu::ScopedLogSection section (log, string("Test") + de::toString(m_caseNdx), string("Test ") + de::toString(m_caseNdx));
const bool isNearestOnly = m_minFilter == GL_NEAREST && m_magFilter == GL_NEAREST;
- const bool isSRGB = texFormat.order == tcu::TextureFormat::sRGB || texFormat.order == tcu::TextureFormat::sRGBA;
+ const bool isSRGB = tcu::isSRGB(texFormat);
const tcu::PixelFormat pixelFormat = m_renderCtx.getRenderTarget().getPixelFormat();
const tcu::IVec4 colorBits = tcu::max(getBitsVec(pixelFormat) - (isNearestOnly && !isSRGB ? 1 : 2), tcu::IVec4(0));
tcu::LodPrecision lodPrecision;