From 044cdcc8c124e9b75d36e6a62d8ff42086017037 Mon Sep 17 00:00:00 2001 From: Szilard Ledan Date: Fri, 18 Nov 2016 10:30:54 +0100 Subject: [PATCH] Add ETC compressed format texture tests Extended the 'updateTextureData' and 'updateTextureViewMipLevels' functions in vktTextureTestUtil.cpp with format mapping of compressed formats. New tests: - dEQP-VK.texture.compressed.* Affected tests: - dEQP-VK.texture.* Change-Id: I897e6523243acb7395a3660fee5797f6c0988bd4 --- android/cts/master/vk-master.txt | 20 +++ .../vulkancts/framework/vulkan/vkImageUtil.cpp | 64 +++++++- .../vulkancts/framework/vulkan/vkImageUtil.hpp | 1 + .../modules/vulkan/texture/CMakeLists.txt | 2 + .../texture/vktTextureCompressedFormatTests.cpp | 182 +++++++++++++++++++++ .../texture/vktTextureCompressedFormatTests.hpp | 40 +++++ .../modules/vulkan/texture/vktTextureTestUtil.cpp | 10 +- .../modules/vulkan/texture/vktTextureTests.cpp | 12 +- external/vulkancts/mustpass/1.0.2/vk-default.txt | 20 +++ 9 files changed, 338 insertions(+), 13 deletions(-) create mode 100644 external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.cpp create mode 100644 external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.hpp diff --git a/android/cts/master/vk-master.txt b/android/cts/master/vk-master.txt index fce11ff..8ee7c44 100644 --- a/android/cts/master/vk-master.txt +++ b/android/cts/master/vk-master.txt @@ -140182,6 +140182,26 @@ dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_nearest_min_linea dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_linear_min_linear_mipmap_nearest dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_nearest_min_linear_mipmap_linear dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_linear_min_linear_mipmap_linear +dEQP-VK.texture.compressed.etc2_r8g8b8_unorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8_srgb_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_unorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_srgb_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_unorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_srgb_block_2d_pot +dEQP-VK.texture.compressed.eac_r11_unorm_block_2d_pot +dEQP-VK.texture.compressed.eac_r11_snorm_block_2d_pot +dEQP-VK.texture.compressed.eac_r11g11_unorm_block_2d_pot +dEQP-VK.texture.compressed.eac_r11g11_snorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8_unorm_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8_srgb_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_unorm_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_srgb_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_unorm_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_srgb_block_2d_npot +dEQP-VK.texture.compressed.eac_r11_unorm_block_2d_npot +dEQP-VK.texture.compressed.eac_r11_snorm_block_2d_npot +dEQP-VK.texture.compressed.eac_r11g11_unorm_block_2d_npot +dEQP-VK.texture.compressed.eac_r11g11_snorm_block_2d_npot dEQP-VK.geometry.input.basic_primitive.points dEQP-VK.geometry.input.basic_primitive.lines dEQP-VK.geometry.input.basic_primitive.line_strip diff --git a/external/vulkancts/framework/vulkan/vkImageUtil.cpp b/external/vulkancts/framework/vulkan/vkImageUtil.cpp index 2d21450..5369d93 100644 --- a/external/vulkancts/framework/vulkan/vkImageUtil.cpp +++ b/external/vulkancts/framework/vulkan/vkImageUtil.cpp @@ -337,6 +337,60 @@ VkFormat mapTextureFormat (const tcu::TextureFormat& format) #undef FMT_CASE } +VkFormat mapCompressedTextureFormat (const tcu::CompressedTexFormat format) +{ + // update this mapping if CompressedTexFormat changes + DE_STATIC_ASSERT(tcu::COMPRESSEDTEXFORMAT_LAST == 39); + + switch (format) + { + case tcu::COMPRESSEDTEXFORMAT_ETC2_RGB8: return VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ETC2_SRGB8: return VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1: return VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: return VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ETC2_EAC_RGBA8: return VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ETC2_EAC_SRGB8_ALPHA8: return VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK; + + case tcu::COMPRESSEDTEXFORMAT_EAC_R11: return VK_FORMAT_EAC_R11_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_EAC_SIGNED_R11: return VK_FORMAT_EAC_R11_SNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_EAC_RG11: return VK_FORMAT_EAC_R11G11_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_EAC_SIGNED_RG11: return VK_FORMAT_EAC_R11G11_SNORM_BLOCK; + + case tcu::COMPRESSEDTEXFORMAT_ASTC_4x4_RGBA: return VK_FORMAT_ASTC_4x4_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_4x4_SRGB8_ALPHA8: return VK_FORMAT_ASTC_4x4_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_5x4_RGBA: return VK_FORMAT_ASTC_5x4_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_5x4_SRGB8_ALPHA8: return VK_FORMAT_ASTC_5x4_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_5x5_RGBA: return VK_FORMAT_ASTC_5x5_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_5x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_5x5_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_6x5_RGBA: return VK_FORMAT_ASTC_6x5_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_6x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_6x5_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_6x6_RGBA: return VK_FORMAT_ASTC_6x6_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_6x6_SRGB8_ALPHA8: return VK_FORMAT_ASTC_6x6_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_8x5_RGBA: return VK_FORMAT_ASTC_8x5_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_8x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_8x5_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_8x6_RGBA: return VK_FORMAT_ASTC_8x6_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_8x6_SRGB8_ALPHA8: return VK_FORMAT_ASTC_8x6_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_8x8_RGBA: return VK_FORMAT_ASTC_8x8_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_8x8_SRGB8_ALPHA8: return VK_FORMAT_ASTC_8x8_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x5_RGBA: return VK_FORMAT_ASTC_10x5_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x5_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x5_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x6_RGBA: return VK_FORMAT_ASTC_10x6_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x6_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x6_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x8_RGBA: return VK_FORMAT_ASTC_10x8_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x8_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x8_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x10_RGBA: return VK_FORMAT_ASTC_10x10_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_10x10_SRGB8_ALPHA8: return VK_FORMAT_ASTC_10x10_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_12x10_RGBA: return VK_FORMAT_ASTC_12x10_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_12x10_SRGB8_ALPHA8: return VK_FORMAT_ASTC_12x10_SRGB_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_12x12_RGBA: return VK_FORMAT_ASTC_12x12_UNORM_BLOCK; + case tcu::COMPRESSEDTEXFORMAT_ASTC_12x12_SRGB8_ALPHA8: return VK_FORMAT_ASTC_12x12_SRGB_BLOCK; + + default: + TCU_THROW(InternalError, "Unknown texture format"); + return VK_FORMAT_UNDEFINED; + } +} + tcu::TextureFormat mapVkFormat (VkFormat format) { using tcu::TextureFormat; @@ -499,7 +553,6 @@ tcu::TextureFormat mapVkFormat (VkFormat format) case VK_FORMAT_A2B10G10R10_UINT_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::UNSIGNED_INT_1010102_REV); case VK_FORMAT_A2B10G10R10_SINT_PACK32: return TextureFormat(TextureFormat::RGBA, TextureFormat::SIGNED_INT_1010102_REV); - default: TCU_THROW(InternalError, "Unknown image format"); } @@ -518,10 +571,12 @@ tcu::CompressedTexFormat mapVkCompressedFormat (VkFormat format) case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1; case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ETC2_EAC_RGBA8; case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ETC2_EAC_SRGB8_ALPHA8; + case VK_FORMAT_EAC_R11_UNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_EAC_R11; case VK_FORMAT_EAC_R11_SNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_EAC_SIGNED_R11; case VK_FORMAT_EAC_R11G11_UNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_EAC_RG11; case VK_FORMAT_EAC_R11G11_SNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_EAC_SIGNED_RG11; + case VK_FORMAT_ASTC_4x4_UNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ASTC_4x4_RGBA; case VK_FORMAT_ASTC_4x4_SRGB_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ASTC_4x4_SRGB8_ALPHA8; case VK_FORMAT_ASTC_5x4_UNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ASTC_5x4_RGBA; @@ -550,11 +605,11 @@ tcu::CompressedTexFormat mapVkCompressedFormat (VkFormat format) case VK_FORMAT_ASTC_12x10_SRGB_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ASTC_12x10_SRGB8_ALPHA8; case VK_FORMAT_ASTC_12x12_UNORM_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ASTC_12x12_RGBA; case VK_FORMAT_ASTC_12x12_SRGB_BLOCK: return tcu::COMPRESSEDTEXFORMAT_ASTC_12x12_SRGB8_ALPHA8; + default: - break; + TCU_THROW(InternalError, "Unknown image format"); + return tcu::COMPRESSEDTEXFORMAT_LAST; } - - return tcu::COMPRESSEDTEXFORMAT_LAST; } static bool isScaledFormat (VkFormat format) @@ -688,7 +743,6 @@ VkFilter mapFilterMode (tcu::Sampler::FilterMode filterMode) default: DE_FATAL("Illegal filter mode"); return (VkFilter)0; - } } diff --git a/external/vulkancts/framework/vulkan/vkImageUtil.hpp b/external/vulkancts/framework/vulkan/vkImageUtil.hpp index e4aa1e8..3e6f6bc 100644 --- a/external/vulkancts/framework/vulkan/vkImageUtil.hpp +++ b/external/vulkancts/framework/vulkan/vkImageUtil.hpp @@ -59,6 +59,7 @@ VkSamplerMipmapMode mapMipmapMode (tcu::Sampler::FilterMode filterMode); VkSamplerAddressMode mapWrapMode (tcu::Sampler::WrapMode wrapMode); VkCompareOp mapCompareMode (tcu::Sampler::CompareMode mode); VkFormat mapTextureFormat (const tcu::TextureFormat& format); +VkFormat mapCompressedTextureFormat (const tcu::CompressedTexFormat format); VkSamplerCreateInfo mapSampler (const tcu::Sampler& sampler, const tcu::TextureFormat& format, float minLod = 0.0f, float maxLod = 1000.0f); void imageUtilSelfTest (void); diff --git a/external/vulkancts/modules/vulkan/texture/CMakeLists.txt b/external/vulkancts/modules/vulkan/texture/CMakeLists.txt index 4c44cf3..092fb29 100644 --- a/external/vulkancts/modules/vulkan/texture/CMakeLists.txt +++ b/external/vulkancts/modules/vulkan/texture/CMakeLists.txt @@ -24,6 +24,8 @@ set(DEQP_VK_TEXTURE_SRCS vktTextureShadowTests.hpp vktTextureFilteringAnisotropyTests.cpp vktTextureFilteringAnisotropyTests.hpp + vktTextureCompressedFormatTests.cpp + vktTextureCompressedFormatTests.hpp ) set(DEQP_VK_TEXTURE_LIBS diff --git a/external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.cpp b/external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.cpp new file mode 100644 index 0000000..c46b8d0 --- /dev/null +++ b/external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.cpp @@ -0,0 +1,182 @@ +/*------------------------------------------------------------------------- + * Vulkan Conformance Tests + * ------------------------ + * + * Copyright (c) 2016 The Khronos Group Inc. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Compressed texture tests. + *//*--------------------------------------------------------------------*/ + +#include "vktTextureCompressedFormatTests.hpp" + +#include "deString.h" +#include "deStringUtil.hpp" +#include "tcuCompressedTexture.hpp" +#include "tcuTexture.hpp" +#include "tcuTextureUtil.hpp" +#include "vkImageUtil.hpp" +#include "vktTestGroupUtil.hpp" +#include "vktTextureTestUtil.hpp" +#include +#include + +namespace vkt +{ +namespace texture +{ +namespace +{ + +using namespace vk; +using namespace glu::TextureTestUtil; +using namespace texture::util; + +using std::string; +using std::vector; +using tcu::Sampler; +using tcu::TestLog; + +struct Compressed2DTestParameters : public Texture2DTestCaseParameters +{ +}; + +class Compressed2DTestInstance : public TestInstance +{ +public: + typedef Compressed2DTestParameters ParameterType; + + Compressed2DTestInstance (Context& context, + const ParameterType& testParameters); + tcu::TestStatus iterate (void); + +private: + Compressed2DTestInstance (const Compressed2DTestInstance& other); + Compressed2DTestInstance& operator= (const Compressed2DTestInstance& other); + + const ParameterType& m_testParameters; + const tcu::CompressedTexFormat m_compressedFormat; + TestTexture2DSp m_texture; + TextureRenderer m_renderer; +}; + +Compressed2DTestInstance::Compressed2DTestInstance (Context& context, + const ParameterType& testParameters) + : TestInstance (context) + , m_testParameters (testParameters) + , m_compressedFormat (mapVkCompressedFormat(testParameters.format)) + , m_texture (TestTexture2DSp(new pipeline::TestTexture2D(m_compressedFormat, testParameters.width, testParameters.height))) + , m_renderer (context, testParameters.sampleCount, testParameters.width, testParameters.height) +{ + m_renderer.add2DTexture(m_texture); +} + +tcu::TestStatus Compressed2DTestInstance::iterate (void) +{ + tcu::TestLog& log = m_context.getTestContext().getLog(); + const pipeline::TestTexture2D& texture = m_renderer.get2DTexture(0); + const tcu::TextureFormat textureFormat = texture.getTextureFormat(); + const tcu::TextureFormatInfo formatInfo = tcu::getTextureFormatInfo(textureFormat); + + ReferenceParams sampleParams (TEXTURETYPE_2D); + tcu::Surface rendered (m_renderer.getRenderWidth(), m_renderer.getRenderHeight()); + vector texCoord; + + // Setup params for reference. + sampleParams.sampler = util::createSampler(m_testParameters.wrapS, m_testParameters.wrapT, m_testParameters.minFilter, m_testParameters.magFilter); + sampleParams.samplerType = SAMPLERTYPE_FLOAT; + sampleParams.lodMode = LODMODE_EXACT; + sampleParams.colorBias = formatInfo.lookupBias; + sampleParams.colorScale = formatInfo.lookupScale; + + log << TestLog::Message << "Compare reference value = " << sampleParams.ref << TestLog::EndMessage; + + // Compute texture coordinates. + computeQuadTexCoord2D(texCoord, tcu::Vec2(0.0f, 0.0f), tcu::Vec2(1.0f, 1.0f)); + + m_renderer.renderQuad(rendered, 0, &texCoord[0], sampleParams); + + // Compute reference. + const tcu::IVec4 formatBitDepth = getTextureFormatBitDepth(vk::mapVkFormat(VK_FORMAT_R8G8B8A8_UNORM)); + const tcu::PixelFormat pixelFormat (formatBitDepth[0], formatBitDepth[1], formatBitDepth[2], formatBitDepth[3]); + tcu::Surface referenceFrame (m_renderer.getRenderWidth(), m_renderer.getRenderHeight()); + sampleTexture(tcu::SurfaceAccess(referenceFrame, pixelFormat), m_texture->getTexture(), &texCoord[0], sampleParams); + + // Compare and log. + const bool isOk = compareImages(log, referenceFrame, rendered, pixelFormat.getColorThreshold() + tcu::RGBA(1, 1, 1, 1)); + + return isOk ? tcu::TestStatus::pass("Pass") : tcu::TestStatus::fail("Image verification failed"); +} + +void populateTextureCompressedFormatTests (tcu::TestCaseGroup* compressedTextureTests) +{ + tcu::TestContext& testCtx = compressedTextureTests->getTestContext(); + + // ETC2 and EAC compressed formats. + const struct { + const VkFormat format; + } etc2Formats[] = + { + { VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK }, + { VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK }, + { VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK }, + { VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK }, + { VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK }, + { VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK }, + + { VK_FORMAT_EAC_R11_UNORM_BLOCK }, + { VK_FORMAT_EAC_R11_SNORM_BLOCK }, + { VK_FORMAT_EAC_R11G11_UNORM_BLOCK }, + { VK_FORMAT_EAC_R11G11_SNORM_BLOCK }, + }; + + const struct { + const int width; + const int height; + const char* name; + } sizes[] = + { + { 128, 64, "pot" }, + { 51, 65, "npot" }, + }; + + for (int sizeNdx = 0; sizeNdx < DE_LENGTH_OF_ARRAY(sizes); sizeNdx++) + for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(etc2Formats); formatNdx++) + { + const string formatStr = de::toString(getFormatStr(etc2Formats[formatNdx].format)); + const string nameBase = de::toLower(formatStr.substr(10)); + + Compressed2DTestParameters testParameters; + testParameters.format = etc2Formats[formatNdx].format; + testParameters.width = sizes[sizeNdx].width; + testParameters.height = sizes[sizeNdx].height; + testParameters.programs.push_back(PROGRAM_2D_FLOAT); + + compressedTextureTests->addChild(new TextureTestCase(testCtx, (nameBase + "_2d_" + sizes[sizeNdx].name).c_str(), (formatStr + ", TEXTURETYPE_2D").c_str(), testParameters)); + } +} + +} // anonymous + +tcu::TestCaseGroup* createTextureCompressedFormatTests (tcu::TestContext& testCtx) +{ + return createTestGroup(testCtx, "compressed", "Texture compressed format tests.", populateTextureCompressedFormatTests); +} + +} // texture +} // vkt diff --git a/external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.hpp b/external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.hpp new file mode 100644 index 0000000..378368d --- /dev/null +++ b/external/vulkancts/modules/vulkan/texture/vktTextureCompressedFormatTests.hpp @@ -0,0 +1,40 @@ +#ifndef _VKTTEXTURECOMPRESSEDFORMATTESTS_HPP +#define _VKTTEXTURECOMPRESSEDFORMATTESTS_HPP +/*------------------------------------------------------------------------- + * Vulkan Conformance Tests + * ------------------------ + * + * Copyright (c) 2016 The Khronos Group Inc. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *//*! + * \file + * \brief Compressed texture tests. + *//*--------------------------------------------------------------------*/ + +#include "tcuDefs.hpp" +#include "tcuTestCase.hpp" + +namespace vkt +{ +namespace texture +{ + +tcu::TestCaseGroup* createTextureCompressedFormatTests (tcu::TestContext& testCtx); + +} // texture +} // vkt + +#endif // _VKTTEXTURECOMPRESSEDFORMATTESTS_HPP diff --git a/external/vulkancts/modules/vulkan/texture/vktTextureTestUtil.cpp b/external/vulkancts/modules/vulkan/texture/vktTextureTestUtil.cpp index c459072..124b1c7 100644 --- a/external/vulkancts/modules/vulkan/texture/vktTextureTestUtil.cpp +++ b/external/vulkancts/modules/vulkan/texture/vktTextureTestUtil.cpp @@ -314,7 +314,7 @@ void TextureBinding::updateTextureData (const TestTextureSp& textureData, const const VkImageType imageType = imageViewTypeToImageType(imageViewType); const VkImageTiling imageTiling = VK_IMAGE_TILING_OPTIMAL; const VkImageUsageFlags imageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; - const VkFormat format = mapTextureFormat(textureData->getTextureFormat()); + const VkFormat format = textureData->isCompressed() ? mapCompressedTextureFormat(textureData->getCompressedLevel(0, 0).getFormat()) : mapTextureFormat(textureData->getTextureFormat()); const tcu::UVec3 textureDimension = textureData->getTextureDimension(); const deUint32 mipLevels = textureData->getNumLevels(); const deUint32 arraySize = textureData->getArraySize(); @@ -379,7 +379,7 @@ void TextureBinding::updateTextureViewMipLevels (deUint32 baseLevel, deUint32 ma const DeviceInterface& vkd = m_context.getDeviceInterface(); const VkDevice vkDevice = m_context.getDevice(); const vk::VkImageViewType imageViewType = textureTypeToImageViewType(m_type); - const vk::VkFormat format = mapTextureFormat(m_textureData->getTextureFormat()); + const vk::VkFormat format = m_textureData->isCompressed() ? mapCompressedTextureFormat(m_textureData->getCompressedLevel(0, 0).getFormat()) : mapTextureFormat(m_textureData->getTextureFormat()); const bool isShadowTexture = tcu::hasDepthComponent(m_textureData->getTextureFormat().order); const VkImageAspectFlags aspectMask = isShadowTexture ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT; const deUint32 layerCount = m_textureData->getArraySize(); @@ -1328,7 +1328,11 @@ void TextureRenderer::renderQuad (tcu::Surface& result, if (samplerCreateInfo.magFilter == VK_FILTER_LINEAR || samplerCreateInfo.minFilter == VK_FILTER_LINEAR || samplerCreateInfo.mipmapMode == VK_SAMPLER_MIPMAP_MODE_LINEAR) { - const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice(), mapTextureFormat(m_textureBindings[texUnit]->getTestTexture().getTextureFormat())); + const pipeline::TestTexture& testTexture = m_textureBindings[texUnit]->getTestTexture(); + const VkFormat textureFormat = testTexture.isCompressed() ? mapCompressedTextureFormat(testTexture.getCompressedLevel(0, 0).getFormat()) + : mapTextureFormat (testTexture.getTextureFormat()); + const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice(), textureFormat); + if (!(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) TCU_THROW(NotSupportedError, "Linear filtering for this image format is not supported"); } diff --git a/external/vulkancts/modules/vulkan/texture/vktTextureTests.cpp b/external/vulkancts/modules/vulkan/texture/vktTextureTests.cpp index 971edf2..e6e00dd 100644 --- a/external/vulkancts/modules/vulkan/texture/vktTextureTests.cpp +++ b/external/vulkancts/modules/vulkan/texture/vktTextureTests.cpp @@ -30,6 +30,7 @@ #include "vktTextureFilteringExplicitLodTests.hpp" #include "vktTextureShadowTests.hpp" #include "vktTextureFilteringAnisotropyTests.hpp" +#include "vktTextureCompressedFormatTests.hpp" namespace vkt { @@ -42,11 +43,12 @@ void createTextureTests (tcu::TestCaseGroup* textureTests) { tcu::TestContext& testCtx = textureTests->getTestContext(); - textureTests->addChild(createTextureFilteringTests (testCtx)); - textureTests->addChild(createTextureMipmappingTests (testCtx)); - textureTests->addChild(createExplicitLodTests (testCtx)); - textureTests->addChild(createTextureShadowTests (testCtx)); - textureTests->addChild(createFilteringAnisotropyTests (testCtx)); + textureTests->addChild(createTextureFilteringTests (testCtx)); + textureTests->addChild(createTextureMipmappingTests (testCtx)); + textureTests->addChild(createExplicitLodTests (testCtx)); + textureTests->addChild(createTextureShadowTests (testCtx)); + textureTests->addChild(createFilteringAnisotropyTests (testCtx)); + textureTests->addChild(createTextureCompressedFormatTests (testCtx)); } } // anonymous diff --git a/external/vulkancts/mustpass/1.0.2/vk-default.txt b/external/vulkancts/mustpass/1.0.2/vk-default.txt index 3c0acc5..bedf4c8 100644 --- a/external/vulkancts/mustpass/1.0.2/vk-default.txt +++ b/external/vulkancts/mustpass/1.0.2/vk-default.txt @@ -139884,6 +139884,26 @@ dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_nearest_min_linea dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_linear_min_linear_mipmap_nearest dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_nearest_min_linear_mipmap_linear dEQP-VK.texture.filtering_anisotropy.mipmap.anisotropy_max.mag_linear_min_linear_mipmap_linear +dEQP-VK.texture.compressed.etc2_r8g8b8_unorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8_srgb_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_unorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_srgb_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_unorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_srgb_block_2d_pot +dEQP-VK.texture.compressed.eac_r11_unorm_block_2d_pot +dEQP-VK.texture.compressed.eac_r11_snorm_block_2d_pot +dEQP-VK.texture.compressed.eac_r11g11_unorm_block_2d_pot +dEQP-VK.texture.compressed.eac_r11g11_snorm_block_2d_pot +dEQP-VK.texture.compressed.etc2_r8g8b8_unorm_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8_srgb_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_unorm_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a1_srgb_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_unorm_block_2d_npot +dEQP-VK.texture.compressed.etc2_r8g8b8a8_srgb_block_2d_npot +dEQP-VK.texture.compressed.eac_r11_unorm_block_2d_npot +dEQP-VK.texture.compressed.eac_r11_snorm_block_2d_npot +dEQP-VK.texture.compressed.eac_r11g11_unorm_block_2d_npot +dEQP-VK.texture.compressed.eac_r11g11_snorm_block_2d_npot dEQP-VK.geometry.input.basic_primitive.points dEQP-VK.geometry.input.basic_primitive.lines dEQP-VK.geometry.input.basic_primitive.line_strip -- 2.7.4