Skip shader compile on unsupported ycbcr tests
authorJari Komppa <jari.komppa@siru.fi>
Mon, 16 Apr 2018 12:19:38 +0000 (15:19 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Sun, 22 Apr 2018 19:02:56 +0000 (15:02 -0400)
Added a mechanism to check whether a test is supported before building
the shaders for the test. This also skips many of the tests earlier than
before.

This change also uses said mechanism to speed up the ycbcr tests.

Affects:

dEQP-VK.ycbcr.*

Components: Framework, Vulkan

VK-GL-CTS issue: 1066
VK-GL-CTS issue: 899

Change-Id: I477668e07a611349314f3eaf7ed741f28fb3ad0c

external/vulkancts/modules/vulkan/vktTestCase.cpp
external/vulkancts/modules/vulkan/vktTestCase.hpp
external/vulkancts/modules/vulkan/vktTestCaseUtil.hpp
external/vulkancts/modules/vulkan/vktTestPackage.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrConversionTests.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrFormatTests.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrImageQueryTests.cpp
external/vulkancts/modules/vulkan/ycbcr/vktYCbCrViewTests.cpp

index 9425ace..54ec64c 100644 (file)
@@ -524,4 +524,8 @@ void TestCase::initPrograms (SourceCollections&) const
 {
 }
 
+void TestCase::checkSupport (Context&) const
+{
+}
+
 } // vkt
index 9d079c2..51b0f8a 100644 (file)
@@ -113,6 +113,7 @@ public:
 
        virtual void                    initPrograms    (vk::SourceCollections& programCollection) const;
        virtual TestInstance*   createInstance  (Context& context) const = 0;
+       virtual void                    checkSupport    (Context& context) const;
 
        IterateResult                   iterate                 (void) { DE_ASSERT(false); return STOP; } // Deprecated in this module
 };
index 79d13e3..106e5b6 100644 (file)
@@ -51,14 +51,44 @@ public:
                                                , m_arg0        (arg0)
                                        {}
 
-       void                    initPrograms            (vk::SourceCollections& dst) const { m_progs.init(dst, m_arg0); }
-       TestInstance*   createInstance          (Context& context) const { return new Instance(context, m_arg0); }
+       void                    initPrograms    (vk::SourceCollections& dst)    const { m_progs.init(dst, m_arg0); }
+       TestInstance*   createInstance  (Context& context)                              const { return new Instance(context, m_arg0); }
+       void                    checkSupport    (Context&)                                              const { }
 
 private:
        const Programs  m_progs;
        const Arg0              m_arg0;
 };
 
+template<typename Instance, typename Arg0, typename Support, typename Programs = NoPrograms1<Arg0> >
+class InstanceFactory1WithSupport : public TestCase
+{
+public:
+
+                                       InstanceFactory1WithSupport     (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& desc, const Arg0& arg0, const Support& support)
+                                               : TestCase      (testCtx, type, name, desc)
+                                               , m_progs       ()
+                                               , m_arg0        (arg0)
+                                               , m_support     (support)
+                                       {}
+
+                                       InstanceFactory1WithSupport     (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& desc, const Programs& progs, const Arg0& arg0, const Support& support)
+                                               : TestCase      (testCtx, type, name, desc)
+                                               , m_progs       (progs)
+                                               , m_arg0        (arg0)
+                                               , m_support     (support)
+                                       {}
+
+       void                    initPrograms    (vk::SourceCollections& dst)    const { m_progs.init(dst, m_arg0); }
+       TestInstance*   createInstance  (Context& context)                              const { return new Instance(context, m_arg0); }
+       void                    checkSupport    (Context& context)                              const { m_support.checkSupport(context); }
+
+private:
+       const Programs  m_progs;
+       const Arg0              m_arg0;
+       const Support   m_support;
+};
+
 class FunctionInstance0 : public TestInstance
 {
 public:
@@ -115,6 +145,48 @@ private:
        const Function  m_func;
 };
 
+class FunctionSupport0
+{
+public:
+       typedef void    (*Function)     (Context& context);
+
+                                       FunctionSupport0 (Function function)
+                                               : m_function(function)
+                                       {}
+
+       void                    checkSupport (Context& context) const { m_function(context); }
+
+private:
+       const Function  m_function;
+};
+
+template<typename Arg0>
+class FunctionSupport1
+{
+public:
+       typedef void    (*Function)     (Context& context, Arg0 arg0);
+
+       struct Args
+       {
+               Args (Function func_, Arg0 arg0_)
+                       : func(func_)
+                       , arg0(arg0_)
+               {}
+
+               Function        func;
+               Arg0            arg0;
+       };
+
+                                       FunctionSupport1 (const Args& args)
+                                               : m_args(args)
+                                       {}
+
+       void                    checkSupport (Context& context) const { return m_args.func(context, m_args.arg0); }
+
+private:
+       const Args              m_args;
+};
+
 template<typename Arg0>
 class FunctionPrograms1
 {
@@ -153,6 +225,18 @@ inline TestCase* createFunctionCaseWithPrograms (tcu::TestContext&                         testCtx,
                testCtx, type, name, desc, FunctionPrograms0(initPrograms), testFunction);
 }
 
+inline TestCase* createFunctionCaseWithPrograms (tcu::TestContext&                             testCtx,
+                                                                                                tcu::TestNodeType                              type,
+                                                                                                const std::string&                             name,
+                                                                                                const std::string&                             desc,
+                                                                                                FunctionSupport0::Function             checkSupport,
+                                                                                                FunctionPrograms0::Function    initPrograms,
+                                                                                                FunctionInstance0::Function    testFunction)
+{
+       return new InstanceFactory1WithSupport<FunctionInstance0, FunctionInstance0::Function, FunctionSupport0, FunctionPrograms0>(
+               testCtx, type, name, desc, FunctionPrograms0(initPrograms), testFunction, checkSupport);
+}
+
 template<typename Arg0>
 TestCase* createFunctionCase (tcu::TestContext&                                                                testCtx,
                                                          tcu::TestNodeType                                                             type,
@@ -166,6 +250,19 @@ TestCase* createFunctionCase (tcu::TestContext&                                                            testCtx,
 }
 
 template<typename Arg0>
+TestCase* createFunctionCase (tcu::TestContext&                                                                testCtx,
+                                                         tcu::TestNodeType                                                             type,
+                                                         const std::string&                                                    name,
+                                                         const std::string&                                                    desc,
+                                                         typename FunctionSupport1<Arg0>::Function             checkSupport,
+                                                         typename FunctionInstance1<Arg0>::Function    testFunction,
+                                                         Arg0                                                                                  arg0)
+{
+       return new InstanceFactory1WithSupport<FunctionInstance1<Arg0>, typename FunctionInstance1<Arg0>::Args, FunctionSupport1<Arg0> >(
+               testCtx, type, name, desc, typename FunctionInstance1<Arg0>::Args(testFunction, arg0), typename FunctionSupport1<Arg0>::Args(checkSupport, arg0));
+}
+
+template<typename Arg0>
 TestCase* createFunctionCaseWithPrograms (tcu::TestContext&                                                            testCtx,
                                                                                  tcu::TestNodeType                                                             type,
                                                                                  const std::string&                                                    name,
@@ -178,6 +275,20 @@ TestCase* createFunctionCaseWithPrograms (tcu::TestContext&                                                                testCtx,
                testCtx, type, name, desc, FunctionPrograms1<Arg0>(initPrograms), typename FunctionInstance1<Arg0>::Args(testFunction, arg0));
 }
 
+template<typename Arg0>
+TestCase* createFunctionCaseWithPrograms (tcu::TestContext&                                                            testCtx,
+                                                                                 tcu::TestNodeType                                                             type,
+                                                                                 const std::string&                                                    name,
+                                                                                 const std::string&                                                    desc,
+                                                                                 typename FunctionSupport1<Arg0>::Function             checkSupport,
+                                                                                 typename FunctionPrograms1<Arg0>::Function    initPrograms,
+                                                                                 typename FunctionInstance1<Arg0>::Function    testFunction,
+                                                                                 Arg0                                                                                  arg0)
+{
+       return new InstanceFactory1WithSupport<FunctionInstance1<Arg0>, typename FunctionInstance1<Arg0>::Args, FunctionSupport1<Arg0>, FunctionPrograms1<Arg0> >(
+               testCtx, type, name, desc, FunctionPrograms1<Arg0>(initPrograms), typename FunctionInstance1<Arg0>::Args(testFunction, arg0), typename FunctionSupport1<Arg0>::Args(checkSupport, arg0));
+}
+
 // addFunctionCase
 
 inline void addFunctionCase (tcu::TestCaseGroup*                       group,
@@ -209,6 +320,17 @@ void addFunctionCase (tcu::TestCaseGroup*                                                  group,
 
 template<typename Arg0>
 void addFunctionCase (tcu::TestCaseGroup*                                                      group,
+                                         const std::string&                                                    name,
+                                         const std::string&                                                    desc,
+                                         typename FunctionSupport1<Arg0>::Function             checkSupport,
+                                         typename FunctionInstance1<Arg0>::Function    testFunc,
+                                         Arg0                                                                                  arg0)
+{
+       group->addChild(createFunctionCase<Arg0>(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, checkSupport, testFunc, arg0));
+}
+
+template<typename Arg0>
+void addFunctionCase (tcu::TestCaseGroup*                                                      group,
                                          tcu::TestNodeType                                                             type,
                                          const std::string&                                                    name,
                                          const std::string&                                                    desc,
@@ -231,6 +353,18 @@ void addFunctionCaseWithPrograms (tcu::TestCaseGroup*                                                      group,
 
 template<typename Arg0>
 void addFunctionCaseWithPrograms (tcu::TestCaseGroup*                                                  group,
+                                                                 const std::string&                                                    name,
+                                                                 const std::string&                                                    desc,
+                                                                 typename FunctionSupport1<Arg0>::Function             checkSupport,
+                                                                 typename FunctionPrograms1<Arg0>::Function    initPrograms,
+                                                                 typename FunctionInstance1<Arg0>::Function    testFunc,
+                                                                 Arg0                                                                                  arg0)
+{
+       group->addChild(createFunctionCaseWithPrograms<Arg0>(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, checkSupport, initPrograms, testFunc, arg0));
+}
+
+template<typename Arg0>
+void addFunctionCaseWithPrograms (tcu::TestCaseGroup*                                                  group,
                                                                  tcu::TestNodeType                                                             type,
                                                                  const std::string&                                                    name,
                                                                  const std::string&                                                    desc,
index e6edb3a..0ced701 100644 (file)
@@ -241,6 +241,8 @@ void TestCaseExecutor::init (tcu::TestCase* testCase, const std::string& casePat
        if (!vktCase)
                TCU_THROW(InternalError, "Test node not an instance of vkt::TestCase");
 
+       vktCase->checkSupport(m_context);
+
        m_progCollection.clear();
        vktCase->initPrograms(sourceProgs);
 
index b36f258..7e13158 100644 (file)
@@ -529,21 +529,8 @@ void logTestCaseInfo (TestLog& log, const TestConfig& config)
        log << TestLog::Message << "ComponentMapping: " << config.componentMapping << TestLog::EndMessage;
 }
 
-
-tcu::TestStatus textureConversionTest (Context& context, const TestConfig config)
+void checkSupport (Context& context, const TestConfig config)
 {
-       const FloatFormat       filteringPrecision              (getYCbCrFilteringPrecision(config.format));
-       const FloatFormat       conversionPrecision             (getYCbCrConversionPrecision(config.format));
-       const deUint32          subTexelPrecisionBits   (vk::getPhysicalDeviceProperties(context.getInstanceInterface(), context.getPhysicalDevice()).limits.subTexelPrecisionBits);
-       const tcu::UVec4        bitDepth                                (getYCbCrBitDepth(config.format));
-       TestLog&                        log                                             (context.getTestContext().getLog());
-       bool                            explicitReconstruction  = config.explicitReconstruction;
-       const UVec2                     srcSize                                 = config.srcSize;
-       const UVec2                     dstSize                                 = config.dstSize;
-       bool                            isOk                                    = true;
-
-       logTestCaseInfo(log, config);
-
 #if !defined(FAKE_COLOR_CONVERSION)
        if (!vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_sampler_ycbcr_conversion"))
                TCU_THROW(NotSupportedError, "Extension VK_KHR_sampler_ycbcr_conversion not supported");
@@ -552,8 +539,8 @@ tcu::TestStatus textureConversionTest (Context& context, const TestConfig config
        {
                const vk::VkFormatProperties    properties      (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), config.format));
                const vk::VkFormatFeatureFlags  features        (config.imageTiling == vk::VK_IMAGE_TILING_OPTIMAL
-                                                                                                       ? properties.optimalTilingFeatures
-                                                                                                       : properties.linearTilingFeatures);
+                       ? properties.optimalTilingFeatures
+                       : properties.linearTilingFeatures);
 
                if ((features & (vk::VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT | vk::VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT)) == 0)
                        TCU_THROW(NotSupportedError, "Format doesn't support YCbCr conversions");
@@ -587,6 +574,38 @@ tcu::TestStatus textureConversionTest (Context& context, const TestConfig config
 
                if (isYChromaSubsampled(config.format) && (config.yChromaOffset == vk::VK_CHROMA_LOCATION_MIDPOINT) && ((features & vk::VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT) == 0))
                        TCU_THROW(NotSupportedError, "Format doesn't support midpoint chroma samples");
+       }
+       catch (const vk::Error& err)
+       {
+               if (err.getError() == vk::VK_ERROR_FORMAT_NOT_SUPPORTED)
+                       TCU_THROW(NotSupportedError, "Format not supported");
+
+               throw;
+       }
+#endif
+}
+
+tcu::TestStatus textureConversionTest (Context& context, const TestConfig config)
+{
+       const FloatFormat       filteringPrecision              (getYCbCrFilteringPrecision(config.format));
+       const FloatFormat       conversionPrecision             (getYCbCrConversionPrecision(config.format));
+       const deUint32          subTexelPrecisionBits   (vk::getPhysicalDeviceProperties(context.getInstanceInterface(), context.getPhysicalDevice()).limits.subTexelPrecisionBits);
+       const tcu::UVec4        bitDepth                                (getYCbCrBitDepth(config.format));
+       TestLog&                        log                                             (context.getTestContext().getLog());
+       bool                            explicitReconstruction  = config.explicitReconstruction;
+       const UVec2                     srcSize                                 = config.srcSize;
+       const UVec2                     dstSize                                 = config.dstSize;
+       bool                            isOk                                    = true;
+
+       logTestCaseInfo(log, config);
+
+#if !defined(FAKE_COLOR_CONVERSION)
+       try
+       {
+               const vk::VkFormatProperties    properties      (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), config.format));
+               const vk::VkFormatFeatureFlags  features        (config.imageTiling == vk::VK_IMAGE_TILING_OPTIMAL
+                                                                                                       ? properties.optimalTilingFeatures
+                                                                                                       : properties.linearTilingFeatures);
 
                if ((features & vk::VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT) != 0)
                        explicitReconstruction = true;
@@ -1182,7 +1201,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                textureFilter, chromaLocation, chromaLocation, false, false,
                                                                                                                                                                colorRange, colorModel, identitySwizzle, srcSize, dstSize);
 
-                                               addFunctionCaseWithPrograms(colorModelGroup.get(), std::string(textureFilterName) + "_" + tilingName, "", createTestShaders, textureConversionTest, config);
+                                               addFunctionCaseWithPrograms(colorModelGroup.get(), std::string(textureFilterName) + "_" + tilingName, "", checkSupport, createTestShaders, textureConversionTest, config);
                                        }
                                }
                        }
@@ -1219,7 +1238,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                textureFilter, chromaLocation, chromaLocation, false, false,
                                                                                                                                                                colorRange, colorModel, identitySwizzle, srcSize, dstSize);
 
-                                                       addFunctionCaseWithPrograms(colorRangeGroup.get(), std::string(textureFilterName) + "_" + tilingName, "", createTestShaders, textureConversionTest, config);
+                                                       addFunctionCaseWithPrograms(colorRangeGroup.get(), std::string(textureFilterName) + "_" + tilingName, "", checkSupport, createTestShaders, textureConversionTest, config);
                                                }
                                        }
 
@@ -1275,7 +1294,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                         vk::VK_FILTER_NEAREST, xChromaOffset, yChromaOffset, false, false,
                                                                                                                                                         colorRange, colorModel, identitySwizzle, srcSize, dstSize);
 
-                                                       addFunctionCaseWithPrograms(conversionGroup.get(), std::string(colorModelName) + "_" + tilingName + "_" + xChromaOffsetName, "", createTestShaders, textureConversionTest, config);
+                                                       addFunctionCaseWithPrograms(conversionGroup.get(), std::string(colorModelName) + "_" + tilingName + "_" + xChromaOffsetName, "", checkSupport, createTestShaders, textureConversionTest, config);
                                                }
                                        }
                                        else
@@ -1304,7 +1323,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                         vk::VK_FILTER_NEAREST, xChromaOffset, yChromaOffset, false, false,
                                                                                                                                                         colorRange, colorModel, identitySwizzle, srcSize, dstSize);
 
-                                                               addFunctionCaseWithPrograms(conversionGroup.get(), (string(colorModelName) + "_" + colorRangeName + "_" + tilingName + "_" + xChromaOffsetName).c_str(), "", createTestShaders, textureConversionTest, config);
+                                                               addFunctionCaseWithPrograms(conversionGroup.get(), (string(colorModelName) + "_" + colorRangeName + "_" + tilingName + "_" + xChromaOffsetName).c_str(), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                        }
                                                }
                                        }
@@ -1349,7 +1368,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                vk::VK_FILTER_LINEAR, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                                                defaultColorRange, defaultColorModel, identitySwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
 
                                                                {
@@ -1359,7 +1378,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                vk::VK_FILTER_LINEAR, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                                                defaultColorRange, defaultColorModel, swappedChromaSwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
 
                                                                if (!explicitReconstruction)
@@ -1371,7 +1390,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                        vk::VK_FILTER_NEAREST, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                                                        defaultColorRange, defaultColorModel, identitySwizzle, srcSize, dstSize);
 
-                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", createTestShaders, textureConversionTest, config);
+                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                        }
 
                                                                        {
@@ -1381,7 +1400,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                        vk::VK_FILTER_NEAREST, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                                                        defaultColorRange, defaultColorModel, swappedChromaSwizzle, srcSize, dstSize);
 
-                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", createTestShaders, textureConversionTest, config);
+                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                        }
                                                                }
                                                        }
@@ -1400,7 +1419,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                vk::VK_FILTER_NEAREST, chromaLocation, chromaLocation, explicitReconstruction, disjoint,
                                                                                                                                                                                defaultColorRange, defaultColorModel, identitySwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
 
                                                                {
@@ -1410,7 +1429,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                vk::VK_FILTER_NEAREST, chromaLocation, chromaLocation, explicitReconstruction, disjoint,
                                                                                                                                                                                defaultColorRange, defaultColorModel, swappedChromaSwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
                                                        }
                                                }
@@ -1466,7 +1485,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                 vk::VK_FILTER_NEAREST, chromaOffset, chromaOffset, false, false,
                                                                                                                                                                 colorRange, colorModel, identitySwizzle, srcSize, dstSize);
 
-                                                       addFunctionCaseWithPrograms(conversionGroup.get(), std::string(colorModelName) + "_" + tilingName + "_" + chromaOffsetName, "", createTestShaders, textureConversionTest, config);
+                                                       addFunctionCaseWithPrograms(conversionGroup.get(), std::string(colorModelName) + "_" + tilingName + "_" + chromaOffsetName, "", checkSupport, createTestShaders, textureConversionTest, config);
                                                }
                                        }
                                        else
@@ -1494,7 +1513,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                        vk::VK_FILTER_NEAREST, chromaOffset, chromaOffset, false, false,
                                                                                                                                                                        colorRange, colorModel, identitySwizzle, srcSize, dstSize);
 
-                                                               addFunctionCaseWithPrograms(conversionGroup.get(), (string(colorModelName) + "_" + colorRangeName + "_" + tilingName + "_" + chromaOffsetName).c_str(), "", createTestShaders, textureConversionTest, config);
+                                                               addFunctionCaseWithPrograms(conversionGroup.get(), (string(colorModelName) + "_" + colorRangeName + "_" + tilingName + "_" + chromaOffsetName).c_str(), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                        }
                                                }
                                        }
@@ -1541,7 +1560,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                        vk::VK_FILTER_LINEAR, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                        defaultColorRange, defaultColorModel, identitySwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
 
                                                                {
@@ -1550,7 +1569,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                        vk::VK_FILTER_LINEAR, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                        defaultColorRange, defaultColorModel, swappedChromaSwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string(explicitReconstruction ? "explicit_linear_" : "default_linear_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
 
                                                                if (!explicitReconstruction)
@@ -1561,7 +1580,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                vk::VK_FILTER_NEAREST, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                                defaultColorRange, defaultColorModel, identitySwizzle, srcSize, dstSize);
 
-                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", createTestShaders, textureConversionTest, config);
+                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                        }
 
                                                                        {
@@ -1570,7 +1589,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                vk::VK_FILTER_NEAREST, xChromaOffset, yChromaOffset, explicitReconstruction, disjoint,
                                                                                                                                                                defaultColorRange, defaultColorModel, swappedChromaSwizzle, srcSize, dstSize);
 
-                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", createTestShaders, textureConversionTest, config);
+                                                                               addFunctionCaseWithPrograms(textureFilterGroup.get(), string("default_nearest_") + xChromaOffsetName + "_" + yChromaOffsetName + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                        }
                                                                }
                                                        }
@@ -1589,7 +1608,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                vk::VK_FILTER_NEAREST, chromaLocation, chromaLocation, explicitReconstruction, disjoint,
                                                                                                                                                                                defaultColorRange, defaultColorModel, identitySwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : ""), "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
 
                                                                {
@@ -1599,7 +1618,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                                                                                                                                                vk::VK_FILTER_NEAREST, chromaLocation, chromaLocation, explicitReconstruction, disjoint,
                                                                                                                                                                                defaultColorRange, defaultColorModel, swappedChromaSwizzle, srcSize, dstSize);
 
-                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", createTestShaders, textureConversionTest, config);
+                                                                       addFunctionCaseWithPrograms(textureFilterGroup.get(), string("explicit_nearest") + "_" + tilingName + (disjoint ? "_disjoint" : "") + "_swapped_chroma", "", checkSupport, createTestShaders, textureConversionTest, config);
                                                                }
                                                        }
                                                }
@@ -1654,7 +1673,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                std::ostringstream                      testName;
                                                testName << string("implicit_nearest_") << srcSize.x() << "x" << srcSize.y() << "_" << tilingName << "_" << xChromaOffsetName << "_" << yChromaOffsetName;
 
-                                               addFunctionCaseWithPrograms(oneToOneGroup.get(), testName.str(), "", createTestShaders, textureConversionTest, config);
+                                               addFunctionCaseWithPrograms(oneToOneGroup.get(), testName.str(), "", checkSupport, createTestShaders, textureConversionTest, config);
                                        }
                                }
                        }
index 9eae2bf..15a6348 100644 (file)
@@ -93,7 +93,7 @@ struct TestConfig
        ImageConfig     dst;
 };
 
-void checkSupport (Context& context, const TestConfig& config)
+void checkSupport (Context& context, const TestConfig config)
 {
        if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), string("VK_KHR_sampler_ycbcr_conversion")))
                TCU_THROW(NotSupportedError, "Extension VK_KHR_sampler_ycbcr_conversion not supported");
@@ -745,8 +745,6 @@ void logTestCaseInfo (TestLog&                                                      log,
 
 tcu::TestStatus imageCopyTest (Context& context, const TestConfig config)
 {
-       checkSupport(context, config);
-
        {
                const size_t                    copyCount       = 10;
                TestLog&                                log                     (context.getTestContext().getLog());
@@ -1077,7 +1075,7 @@ void initTests (tcu::TestCaseGroup* testGroup)
                                                const bool                      dstDisjoint     = dstDisjointNdx == 1;
                                                const TestConfig        config          (ImageConfig(srcFormat, srcTiling, srcDisjoint, srcSize), ImageConfig(dstFormat, dstTiling, dstDisjoint, dstSize));
 
-                                               addFunctionCase(dstFormatGroup.get(), string(srcTilingName) + (srcDisjoint ? "_disjoint_" : "_") + string(dstTilingName) + (dstDisjoint ? "_disjoint" : ""), "", imageCopyTest, config);
+                                               addFunctionCase(dstFormatGroup.get(), string(srcTilingName) + (srcDisjoint ? "_disjoint_" : "_") + string(dstTilingName) + (dstDisjoint ? "_disjoint" : ""), "", checkSupport, imageCopyTest, config);
                                        }
                                }
                        }
index e55d634..d0a8b2e 100644 (file)
@@ -287,7 +287,7 @@ ShaderSpec getShaderSpec (const TestParameters&)
        return spec;
 }
 
-void checkSupport (Context& context, const TestParameters& params)
+void checkSupport (Context& context, const TestParameters params)
 {
        checkImageSupport(context, params.format, params.flags, params.tiling);
 }
@@ -308,8 +308,6 @@ void generateLookupCoordinates (const UVec2& imageSize, vector<Vec2>* dst)
 
 tcu::TestStatus testFormat (Context& context, TestParameters params)
 {
-       checkSupport(context, params);
-
        const DeviceInterface&                                  vkd                                             = context.getDeviceInterface();
        const VkDevice                                                  device                                  = context.getDevice();
 
@@ -569,17 +567,17 @@ void populatePerFormatGroup (tcu::TestCaseGroup* group, VkFormat format)
                const char* const               shaderTypeName  = shaderTypes[shaderTypeNdx].name;
                const string                    name                    = string(shaderTypeName) + "_" + tilingName;
 
-               addFunctionCaseWithPrograms(group, name, "", initPrograms, testFormat, TestParameters(format, size, 0u, tiling, shaderType, false));
+               addFunctionCaseWithPrograms(group, name, "", checkSupport, initPrograms, testFormat, TestParameters(format, size, 0u, tiling, shaderType, false));
 
                if (getPlaneCount(format) > 1)
-                       addFunctionCaseWithPrograms(group, name + "_disjoint", "", initPrograms, testFormat, TestParameters(format, size, (VkImageCreateFlags)VK_IMAGE_CREATE_DISJOINT_BIT, tiling, shaderType, false));
+                       addFunctionCaseWithPrograms(group, name + "_disjoint", "", checkSupport, initPrograms, testFormat, TestParameters(format, size, (VkImageCreateFlags)VK_IMAGE_CREATE_DISJOINT_BIT, tiling, shaderType, false));
 
                if (tiling == VK_IMAGE_TILING_LINEAR)
                {
-                       addFunctionCaseWithPrograms(group, name + "_mapped", "", initPrograms, testFormat, TestParameters(format, size, 0u, tiling, shaderType, true));
+                       addFunctionCaseWithPrograms(group, name + "_mapped", "", checkSupport, initPrograms, testFormat, TestParameters(format, size, 0u, tiling, shaderType, true));
 
                        if (getPlaneCount(format) > 1)
-                               addFunctionCaseWithPrograms(group, name + "_disjoint_mapped", "", initPrograms, testFormat, TestParameters(format, size, (VkImageCreateFlags)VK_IMAGE_CREATE_DISJOINT_BIT, tiling, shaderType, true));
+                               addFunctionCaseWithPrograms(group, name + "_disjoint_mapped", "", checkSupport, initPrograms, testFormat, TestParameters(format, size, (VkImageCreateFlags)VK_IMAGE_CREATE_DISJOINT_BIT, tiling, shaderType, true));
                }
        }
 }
index 102f79e..acf5d49 100644 (file)
@@ -338,10 +338,6 @@ UVec2 getMaxPlaneDivisor (const PlanarFormatDescription& formatDesc)
 tcu::TestStatus testImageQuery (Context& context, TestParameters params)
 {
        const bool                                                      isYCbCrImage    = isYCbCrFormat(params.format);
-
-       if (isYCbCrImage)
-               checkImageSupport(context, params.format, params.flags);
-
        const DeviceInterface&                          vkd                             = context.getDeviceInterface();
        const VkDevice                                          device                  = context.getDevice();
 
@@ -483,13 +479,17 @@ tcu::TestStatus testImageQuery (Context& context, TestParameters params)
        }
 }
 
-tcu::TestStatus testImageQueryLod (Context& context, TestParameters params)
+void checkSupport (Context& context, TestParameters params)
 {
-       const bool                                                      isYCbCrImage    = isYCbCrFormat(params.format);
+       const bool isYCbCrImage = isYCbCrFormat(params.format);
 
        if (isYCbCrImage)
                checkImageSupport(context, params.format, params.flags);
+}
 
+tcu::TestStatus testImageQueryLod (Context& context, TestParameters params)
+{
+       const bool                                                      isYCbCrImage    = isYCbCrFormat(params.format);
        const DeviceInterface&                          vkd                             = context.getDeviceInterface();
        const VkDevice                                          device                  = context.getDevice();
 
@@ -720,6 +720,7 @@ void addImageQueryCase (tcu::TestCaseGroup* group, const TestParameters& params)
        addFunctionCaseWithPrograms(group,
                                                                name,
                                                                "",
+                                                               checkSupport,
                                                                isLod ? initImageQueryLodPrograms : initImageQueryPrograms,
                                                                isLod ? testImageQueryLod : testImageQuery,
                                                                params);
index b3268c4..630364b 100644 (file)
@@ -456,6 +456,15 @@ void checkImageUsageSupport (Context&                      context,
        }
 }
 
+void checkSupport(Context& context, TestParameters params)
+{
+       const VkFormat                                  planeViewFormat = getPlaneCompatibleFormat(params.format, params.planeNdx);
+       const VkImageUsageFlags                 usage                   = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
+
+       checkImageSupport(context, params.format, params.createFlags);
+       checkImageUsageSupport(context, params.format, usage);
+       checkImageUsageSupport(context, planeViewFormat, usage);
+}
 
 tcu::TestStatus testPlaneView (Context& context, TestParameters params)
 {
@@ -473,11 +482,6 @@ tcu::TestStatus testPlaneView (Context& context, TestParameters params)
        const UVec2                                             size                    = params.size;
        const UVec2                                             planeSize               (size.x() / formatInfo.planes[params.planeNdx].widthDivisor,
                                                                                                         size.y() / formatInfo.planes[params.planeNdx].heightDivisor);
-       const VkImageUsageFlags                 usage                   = VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT;
-
-       checkImageSupport(context, format, createFlags);
-       checkImageUsageSupport(context, format, usage);
-       checkImageUsageSupport(context, planeViewFormat, usage);
 
        const Unique<VkImage>                   image                   (createTestImage(vkd, device, format, size, createFlags));
        const Unique<VkImage>                   imageAlias              ((params.viewType == TestParameters::VIEWTYPE_MEMORY_ALIAS)
@@ -714,7 +718,7 @@ void addPlaneViewCase (tcu::TestCaseGroup* group, const TestParameters& params)
 
        name << "_plane_" << params.planeNdx;
 
-       addFunctionCaseWithPrograms(group, name.str(), "", initPrograms, testPlaneView, params);
+       addFunctionCaseWithPrograms(group, name.str(), "", checkSupport, initPrograms, testPlaneView, params);
 }
 
 void populateViewTypeGroup (tcu::TestCaseGroup* group, TestParameters::ViewType viewType)