format.order == TextureFormat::sBGRA;
}
+tcu::Vec4 linearToSRGBIfNeeded (const TextureFormat& format, const tcu::Vec4& color)
+{
+ return isSRGB(format) ? linearToSRGB(color) : color;
+}
+
bool isCombinedDepthStencilType (TextureFormat::ChannelType type)
{
// make sure to update this if type table is updated
{
for (int y = 0; y < dst.getHeight(); y++)
for (int x = 0; x < dst.getWidth(); x++)
- dst.setPixel(src.sample2D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, 0), x, y);
+ dst.setPixel(linearToSRGBIfNeeded(dst.getFormat(), src.sample2D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, 0)), x, y);
}
else
{
for (int z = 0; z < dst.getDepth(); z++)
for (int y = 0; y < dst.getHeight(); y++)
for (int x = 0; x < dst.getWidth(); x++)
- dst.setPixel(src.sample3D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, ((float)z+0.5f)*sZ), x, y, z);
+ dst.setPixel(linearToSRGBIfNeeded(dst.getFormat(), src.sample3D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, ((float)z+0.5f)*sZ)), x, y, z);
}
}
static tcu::Vec4 getTextureBorderColorFloat (const TextureFormat& format, const Sampler& sampler)
{
- const tcu::TextureChannelClass channelClass = getTextureChannelClass(format.type);
+ const tcu::TextureChannelClass channelClass = getTextureChannelClass(format.type);
const TextureSwizzle::Channel* channelMap = getBorderColorReadSwizzle(format.order).components;
const bool isFloat = channelClass == tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
const bool isSigned = channelClass != tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
static tcu::IVec4 getTextureBorderColorInt (const TextureFormat& format, const Sampler& sampler)
{
- const tcu::TextureChannelClass channelClass = getTextureChannelClass(format.type);
+ const tcu::TextureChannelClass channelClass = getTextureChannelClass(format.type);
const TextureSwizzle::Channel* channelMap = getBorderColorReadSwizzle(format.order).components;
const IVec4 channelBits = getChannelBitDepth(format.type);
const IVec4 valueMin = getNBitSignedIntegerVec4MinValue(channelBits);
static tcu::UVec4 getTextureBorderColorUint (const TextureFormat& format, const Sampler& sampler)
{
- const tcu::TextureChannelClass channelClass = getTextureChannelClass(format.type);
+ const tcu::TextureChannelClass channelClass = getTextureChannelClass(format.type);
const TextureSwizzle::Channel* channelMap = getBorderColorReadSwizzle(format.order).components;
const IVec4 channelBits = getChannelBitDepth(format.type);
const UVec4 valueMax = getNBitUnsignedIntegerVec4MaxValue(channelBits);