{
}
-void testDecompress (CompressedTexFormat format, size_t numBlocks, const deUint8* data)
+void testDecompress (CompressedTexFormat format, TexDecompressionParams::AstcMode mode, size_t numBlocks, const deUint8* data)
{
- const IVec3 blockPixelSize = getBlockPixelSize(format);
+ const IVec3 blockPixelSize = getBlockPixelSize(format);
+ const TexDecompressionParams decompressionParams (mode);
+ const TextureFormat uncompressedFormat = getUncompressedFormat(format);
+ TextureLevel texture (uncompressedFormat, blockPixelSize.x()*(int)numBlocks, blockPixelSize.y());
- for (int astcModeNdx = 0; astcModeNdx < TexDecompressionParams::ASTCMODE_LAST; astcModeNdx++)
- {
- const TexDecompressionParams decompressionParams ((TexDecompressionParams::AstcMode)astcModeNdx);
- const TextureFormat uncompressedFormat = getUncompressedFormat(format);
- TextureLevel texture (uncompressedFormat, blockPixelSize.x()*(int)numBlocks, blockPixelSize.y());
+ decompress(texture.getAccess(), format, data, decompressionParams);
+}
- decompress(texture.getAccess(), format, data, decompressionParams);
- }
+void testDecompress (CompressedTexFormat format, size_t numBlocks, const deUint8* data)
+{
+ testDecompress(format, TexDecompressionParams::ASTCMODE_LDR, numBlocks, data);
+
+ if (!isAstcSRGBFormat(format))
+ testDecompress(format, TexDecompressionParams::ASTCMODE_HDR, numBlocks, data);
}
void verifyBlocksValid (CompressedTexFormat format, TexDecompressionParams::AstcMode mode, size_t numBlocks, const deUint8* data)
{
for (size_t blockNdx = 0; blockNdx < numBlocks; blockNdx++)
- TCU_CHECK(astc::isValidBlock(data + blockNdx*astc::BLOCK_SIZE_BYTES, format, mode));
+ {
+ if (!astc::isValidBlock(data + blockNdx*astc::BLOCK_SIZE_BYTES, format, mode))
+ TCU_FAIL("Invalid ASTC block was generated");
+ }
}
inline size_t getNumBlocksFromBytes (size_t numBytes)
generatedData.clear();
astc::generateBlockCaseTestData(generatedData, m_format, blockTestType);
- testDecompress(m_format, getNumBlocksFromBytes(generatedData.size()), &generatedData[0]);
+ // testDecompress(m_format, getNumBlocksFromBytes(generatedData.size()), &generatedData[0]);
// All but random case should generate only valid blocks
if (blockTestType != astc::BLOCK_TEST_TYPE_RANDOM)
{
- verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_HDR, getNumBlocksFromBytes(generatedData.size()), &generatedData[0]);
-
// \note CEMS generates HDR blocks as well
if (!astc::isBlockTestTypeHDROnly(blockTestType) &&
(blockTestType != astc::BLOCK_TEST_TYPE_CEMS))
verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_LDR, getNumBlocksFromBytes(generatedData.size()), &generatedData[0]);
+
+ if (!isAstcSRGBFormat(m_format))
+ verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_HDR, getNumBlocksFromBytes(generatedData.size()), &generatedData[0]);
}
}
testDecompress(m_format, numBlocks, &generatedData[0]);
verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_LDR, numBlocks, &generatedData[0]);
- verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_HDR, numBlocks, &generatedData[0]);
+
+ if (!isAstcSRGBFormat(m_format))
+ verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_HDR, numBlocks, &generatedData[0]);
}
// Verify generating dummy normal blocks
testDecompress(m_format, numBlocks, &generatedData[0]);
verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_LDR, numBlocks, &generatedData[0]);
- verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_HDR, numBlocks, &generatedData[0]);
+
+ if (!isAstcSRGBFormat(m_format))
+ verifyBlocksValid(m_format, TexDecompressionParams::ASTCMODE_HDR, numBlocks, &generatedData[0]);
}
// Verify generating random valid blocks
const TexDecompressionParams::AstcMode mode = (TexDecompressionParams::AstcMode)astcModeNdx;
const size_t numBlocks = 1024;
+ if (mode == tcu::TexDecompressionParams::ASTCMODE_HDR && isAstcFormat(m_format))
+ continue; // sRGB is not supported in HDR mode
+
generatedData.resize(numBlocks*astc::BLOCK_SIZE_BYTES);
astc::generateRandomValidBlocks(&generatedData[0], numBlocks, m_format, mode, deInt32Hash(m_format) ^ deInt32Hash(mode));