, 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:
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
{
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,
}
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,
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,
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,
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,
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");
{
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");
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;
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);
}
}
}
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);
}
}
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
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);
}
}
}
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);
}
{
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)
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);
}
{
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);
}
}
}
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);
}
{
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);
}
}
}
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
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);
}
}
}
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);
}
{
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)
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);
}
{
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);
}
}
}
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);
}
{
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);
}
}
}
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);
}
}
}