From 406baadac8a84b722aeae9c710e86b724e072a59 Mon Sep 17 00:00:00 2001 From: Jari Komppa Date: Fri, 4 May 2018 14:51:17 +0300 Subject: [PATCH] Added more early-out hardware support checks This patch adds more early-out hardware support checks to speed up the conformance test especially on hardware that does not support some features. Affects: dEQP-VK.api.pipeline.* dEQP-VK.api.copy_and_blit.* dEQP-VK.api.buffer_view.create.* dEQP-VK.api.buffer.* Components: Framework, Vulkan VK-GL-CTS issue: 899 Change-Id: Ied10dfd4ce60eda4d1830a38f42b5f38f813d50f --- .../modules/vulkan/api/vktApiBufferTests.cpp | 36 +- .../vulkan/api/vktApiBufferViewCreateTests.cpp | 25 +- .../vulkan/api/vktApiCopiesAndBlittingTests.cpp | 371 +++++++++++---------- .../modules/vulkan/api/vktApiPipelineTests.cpp | 17 +- .../vulkancts/modules/vulkan/vktTestCaseUtil.hpp | 29 ++ 5 files changed, 274 insertions(+), 204 deletions(-) diff --git a/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp index c990873..df8b4aa 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiBufferTests.cpp @@ -262,6 +262,20 @@ public: return new BufferTestInstance(ctx, m_testCase); } + virtual void checkSupport (Context& ctx) const + { + const VkPhysicalDeviceFeatures& physicalDeviceFeatures = getPhysicalDeviceFeatures(ctx.getInstanceInterface(), ctx.getPhysicalDevice()); + + if ((m_testCase.flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) && !physicalDeviceFeatures.sparseBinding) + TCU_THROW(NotSupportedError, "Sparse bindings feature is not supported"); + + if ((m_testCase.flags & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT) && !physicalDeviceFeatures.sparseResidencyBuffer) + TCU_THROW(NotSupportedError, "Sparse buffer residency feature is not supported"); + + if ((m_testCase.flags & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT) && !physicalDeviceFeatures.sparseResidencyAliased) + TCU_THROW(NotSupportedError, "Sparse aliased residency feature is not supported"); + } + private: BufferCaseParameters m_testCase; }; @@ -288,15 +302,18 @@ class DedicatedAllocationBuffersTestCase : public TestCase { tcu::TestLog& log = m_testCtx.getLog(); log << tcu::TestLog::Message << getBufferUsageFlagsStr(m_testCase.usage) << tcu::TestLog::EndMessage; - const std::vector& extensions = ctx.getDeviceExtensions(); - const deBool isSupported = isDeviceExtensionSupported(ctx.getUsedApiVersion(), extensions, "VK_KHR_dedicated_allocation"); + return new DedicatedAllocationBufferTestInstance(ctx, m_testCase); + } + + virtual void checkSupport (Context& ctx) const + { + const std::vector& extensions = ctx.getDeviceExtensions(); + const deBool isSupported = isDeviceExtensionSupported(ctx.getUsedApiVersion(), extensions, "VK_KHR_dedicated_allocation"); if (!isSupported) { TCU_THROW(NotSupportedError, "Not supported"); } - return new DedicatedAllocationBufferTestInstance(ctx, m_testCase); } - private: BufferCaseParameters m_testCase; }; @@ -479,17 +496,6 @@ tcu::TestStatus BufferTestInstance::bufferCreateAndAllocTest (VkDeviceSize tcu::TestStatus BufferTestInstance::iterate (void) { - const VkPhysicalDeviceFeatures& physicalDeviceFeatures = getPhysicalDeviceFeatures(getInstanceInterface(), getPhysicalDevice()); - - if ((m_testCase.flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT ) && !physicalDeviceFeatures.sparseBinding) - TCU_THROW(NotSupportedError, "Sparse bindings feature is not supported"); - - if ((m_testCase.flags & VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT ) && !physicalDeviceFeatures.sparseResidencyBuffer) - TCU_THROW(NotSupportedError, "Sparse buffer residency feature is not supported"); - - if ((m_testCase.flags & VK_BUFFER_CREATE_SPARSE_ALIASED_BIT ) && !physicalDeviceFeatures.sparseResidencyAliased) - TCU_THROW(NotSupportedError, "Sparse aliased residency feature is not supported"); - const VkDeviceSize testSizes[] = { 1, diff --git a/external/vulkancts/modules/vulkan/api/vktApiBufferViewCreateTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiBufferViewCreateTests.cpp index 295d2b7..490ee8f 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiBufferViewCreateTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiBufferViewCreateTests.cpp @@ -123,6 +123,21 @@ public: { return new BufferViewTestInstance(ctx, m_testCase); } + virtual void checkSupport (Context& ctx) const + { + VkFormatProperties properties; + + ctx.getInstanceInterface().getPhysicalDeviceFormatProperties(ctx.getPhysicalDevice(), m_testCase.format, &properties); + if (!(properties.bufferFeatures & m_testCase.features)) + TCU_THROW(NotSupportedError, "Format not supported"); + if (m_testCase.bufferAllocationKind == ALLOCATION_KIND_DEDICATED) + { + const std::vector& extensions = ctx.getDeviceExtensions(); + const deBool isSupported = isDeviceExtensionSupported(ctx.getUsedApiVersion(), extensions, "VK_KHR_dedicated_allocation"); + if (!isSupported) + TCU_THROW(NotSupportedError, "Dedicated allocation not supported"); + } + } private: BufferViewCaseParameters m_testCase; }; @@ -196,11 +211,6 @@ tcu::TestStatus BufferDedicatedAllocation::createTestBuffer (VkDeviceSize Move& testBuffer, Move& memory) const { - const std::vector& extensions = context.getDeviceExtensions(); - const deBool isSupported = isDeviceExtensionSupported(context.getUsedApiVersion(), extensions, "VK_KHR_dedicated_allocation"); - if (!isSupported) - TCU_THROW(NotSupportedError, "Not supported"); - const InstanceInterface& vkInstance = context.getInstanceInterface(); const VkDevice vkDevice = context.getDevice(); const VkPhysicalDevice vkPhysicalDevice = context.getPhysicalDevice(); @@ -322,11 +332,6 @@ tcu::TestStatus BufferViewTestInstance::iterate (void) const VkDeviceSize size = 3 * 5 * 7 * 64; Move testBuffer; Move testBufferMemory; - VkFormatProperties properties; - - m_context.getInstanceInterface().getPhysicalDeviceFormatProperties(m_context.getPhysicalDevice(), m_testCase.format, &properties); - if (!(properties.bufferFeatures & m_testCase.features)) - TCU_THROW(NotSupportedError, "Format not supported"); // Create buffer if (m_testCase.bufferAllocationKind == ALLOCATION_KIND_DEDICATED) diff --git a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp index c8bf4f5..d9fae02 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp @@ -346,12 +346,6 @@ CopiesAndBlittingTestInstance::CopiesAndBlittingTestInstance (Context& context, const VkDevice vkDevice = context.getDevice(); const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); - if (m_params.allocationKind == ALLOCATION_KIND_DEDICATED) - { - if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_dedicated_allocation")) - TCU_THROW(NotSupportedError, "VK_KHR_dedicated_allocation is not supported"); - } - // Create command pool m_cmdPool = createCommandPool(vk, vkDevice, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, queueFamilyIndex); @@ -839,32 +833,6 @@ CopyImageToImage::CopyImageToImage (Context& context, TestParams params) const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); Allocator& memAlloc = context.getDefaultAllocator(); - if ((m_params.dst.image.imageType == VK_IMAGE_TYPE_3D && m_params.src.image.imageType == VK_IMAGE_TYPE_2D) || - (m_params.dst.image.imageType == VK_IMAGE_TYPE_2D && m_params.src.image.imageType == VK_IMAGE_TYPE_3D)) - { - if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_maintenance1")) - TCU_THROW(NotSupportedError, "Extension VK_KHR_maintenance1 not supported"); - } - - VkImageFormatProperties properties; - if ((context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.src.image.format, - m_params.src.image.imageType, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_SRC_BIT, - 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) || - (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.dst.image.format, - m_params.dst.image.imageType, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_DST_BIT, - 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED)) - { - TCU_THROW(NotSupportedError, "Format not supported"); - } - // Create source image { const VkImageCreateInfo sourceImageParams = @@ -1176,12 +1144,48 @@ public: const TestParams params) : vkt::TestCase (testCtx, name, description) , m_params (params) - {} + {} virtual TestInstance* createInstance (Context& context) const - { - return new CopyImageToImage(context, m_params); - } + { + return new CopyImageToImage(context, m_params); + } + + virtual void checkSupport (Context& context) const + { + if (m_params.allocationKind == ALLOCATION_KIND_DEDICATED) + { + if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_dedicated_allocation")) + TCU_THROW(NotSupportedError, "VK_KHR_dedicated_allocation is not supported"); + } + + if ((m_params.dst.image.imageType == VK_IMAGE_TYPE_3D && m_params.src.image.imageType == VK_IMAGE_TYPE_2D) || + (m_params.dst.image.imageType == VK_IMAGE_TYPE_2D && m_params.src.image.imageType == VK_IMAGE_TYPE_3D)) + { + if (!isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_maintenance1")) + TCU_THROW(NotSupportedError, "Extension VK_KHR_maintenance1 not supported"); + } + + VkImageFormatProperties properties; + if ((context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.src.image.format, + m_params.src.image.imageType, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_SRC_BIT, + 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) || + (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.dst.image.format, + m_params.dst.image.imageType, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_DST_BIT, + 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED)) + { + TCU_THROW(NotSupportedError, "Format not supported"); + } + } + private: TestParams m_params; }; @@ -1769,47 +1773,6 @@ BlittingImages::BlittingImages (Context& context, TestParams params) const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); Allocator& memAlloc = context.getDefaultAllocator(); - VkImageFormatProperties properties; - if ((context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.src.image.format, - VK_IMAGE_TYPE_2D, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_SRC_BIT, - 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) || - (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.dst.image.format, - VK_IMAGE_TYPE_2D, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_DST_BIT, - 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED)) - { - TCU_THROW(NotSupportedError, "Format not supported"); - } - - VkFormatProperties srcFormatProperties; - context.getInstanceInterface().getPhysicalDeviceFormatProperties(context.getPhysicalDevice(), m_params.src.image.format, &srcFormatProperties); - if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT)) - { - TCU_THROW(NotSupportedError, "Format feature blit source not supported"); - } - - VkFormatProperties dstFormatProperties; - context.getInstanceInterface().getPhysicalDeviceFormatProperties(context.getPhysicalDevice(), m_params.dst.image.format, &dstFormatProperties); - if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) - { - TCU_THROW(NotSupportedError, "Format feature blit destination not supported"); - } - - if (m_params.filter == VK_FILTER_LINEAR) - { - if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) - TCU_THROW(NotSupportedError, "Source format feature sampled image filter linear not supported"); - if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) - TCU_THROW(NotSupportedError, "Destination format feature sampled image filter linear not supported"); - } - // Create source image { const VkImageCreateInfo sourceImageParams = @@ -2593,12 +2556,57 @@ public: const TestParams params) : vkt::TestCase (testCtx, name, description) , m_params (params) - {} + {} virtual TestInstance* createInstance (Context& context) const - { - return new BlittingImages(context, m_params); - } + { + return new BlittingImages(context, m_params); + } + + virtual void checkSupport (Context& context) const + { + VkImageFormatProperties properties; + if ((context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.src.image.format, + VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_SRC_BIT, + 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) || + (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.dst.image.format, + VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_DST_BIT, + 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED)) + { + TCU_THROW(NotSupportedError, "Format not supported"); + } + + VkFormatProperties srcFormatProperties; + context.getInstanceInterface().getPhysicalDeviceFormatProperties(context.getPhysicalDevice(), m_params.src.image.format, &srcFormatProperties); + if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT)) + { + TCU_THROW(NotSupportedError, "Format feature blit source not supported"); + } + + VkFormatProperties dstFormatProperties; + context.getInstanceInterface().getPhysicalDeviceFormatProperties(context.getPhysicalDevice(), m_params.dst.image.format, &dstFormatProperties); + if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) + { + TCU_THROW(NotSupportedError, "Format feature blit destination not supported"); + } + + if (m_params.filter == VK_FILTER_LINEAR) + { + if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) + TCU_THROW(NotSupportedError, "Source format feature sampled image filter linear not supported"); + if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) + TCU_THROW(NotSupportedError, "Destination format feature sampled image filter linear not supported"); + } + } + private: TestParams m_params; }; @@ -2635,70 +2643,6 @@ BlittingMipmaps::BlittingMipmaps (Context& context, TestParams params) const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); Allocator& memAlloc = context.getDefaultAllocator(); - { - VkImageFormatProperties properties; - if (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.src.image.format, - VK_IMAGE_TYPE_2D, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_SRC_BIT, - 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) - { - TCU_THROW(NotSupportedError, "Format not supported"); - } - else if ((m_params.src.image.extent.width > properties.maxExtent.width) || - (m_params.src.image.extent.height > properties.maxExtent.height) || - (m_params.src.image.extent.depth > properties.maxArrayLayers)) - { - TCU_THROW(NotSupportedError, "Image size not supported"); - } - } - - { - VkImageFormatProperties properties; - if (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.dst.image.format, - VK_IMAGE_TYPE_2D, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_DST_BIT, - 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) - { - TCU_THROW(NotSupportedError, "Format not supported"); - } - else if ((m_params.dst.image.extent.width > properties.maxExtent.width) || - (m_params.dst.image.extent.height > properties.maxExtent.height) || - (m_params.dst.image.extent.depth > properties.maxArrayLayers)) - { - TCU_THROW(NotSupportedError, "Image size not supported"); - } - else if (m_params.mipLevels > properties.maxMipLevels) - { - TCU_THROW(NotSupportedError, "Number of mip levels not supported"); - } - } - - const VkFormatProperties srcFormatProperties = getPhysicalDeviceFormatProperties (vki, vkPhysDevice, m_params.src.image.format); - if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT)) - { - TCU_THROW(NotSupportedError, "Format feature blit source not supported"); - } - - const VkFormatProperties dstFormatProperties = getPhysicalDeviceFormatProperties (vki, vkPhysDevice, m_params.dst.image.format); - if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) - { - TCU_THROW(NotSupportedError, "Format feature blit destination not supported"); - } - - if (m_params.filter == VK_FILTER_LINEAR) - { - if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) - TCU_THROW(NotSupportedError, "Source format feature sampled image filter linear not supported"); - if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) - TCU_THROW(NotSupportedError, "Destination format feature sampled image filter linear not supported"); - } - // Create source image { const VkImageCreateInfo sourceImageParams = @@ -3267,12 +3211,82 @@ public: const TestParams params) : vkt::TestCase (testCtx, name, description) , m_params (params) - {} + {} virtual TestInstance* createInstance (Context& context) const - { - return new BlittingMipmaps(context, m_params); - } + { + return new BlittingMipmaps(context, m_params); + } + + virtual void checkSupport (Context& context) const + { + const InstanceInterface& vki = context.getInstanceInterface(); + const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice(); + { + VkImageFormatProperties properties; + if (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.src.image.format, + VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_SRC_BIT, + 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) + { + TCU_THROW(NotSupportedError, "Format not supported"); + } + else if ((m_params.src.image.extent.width > properties.maxExtent.width) || + (m_params.src.image.extent.height > properties.maxExtent.height) || + (m_params.src.image.extent.depth > properties.maxArrayLayers)) + { + TCU_THROW(NotSupportedError, "Image size not supported"); + } + } + + { + VkImageFormatProperties properties; + if (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.dst.image.format, + VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_DST_BIT, + 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) + { + TCU_THROW(NotSupportedError, "Format not supported"); + } + else if ((m_params.dst.image.extent.width > properties.maxExtent.width) || + (m_params.dst.image.extent.height > properties.maxExtent.height) || + (m_params.dst.image.extent.depth > properties.maxArrayLayers)) + { + TCU_THROW(NotSupportedError, "Image size not supported"); + } + else if (m_params.mipLevels > properties.maxMipLevels) + { + TCU_THROW(NotSupportedError, "Number of mip levels not supported"); + } + } + + const VkFormatProperties srcFormatProperties = getPhysicalDeviceFormatProperties (vki, vkPhysDevice, m_params.src.image.format); + if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT)) + { + TCU_THROW(NotSupportedError, "Format feature blit source not supported"); + } + + const VkFormatProperties dstFormatProperties = getPhysicalDeviceFormatProperties (vki, vkPhysDevice, m_params.dst.image.format); + if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) + { + TCU_THROW(NotSupportedError, "Format feature blit destination not supported"); + } + + if (m_params.filter == VK_FILTER_LINEAR) + { + if (!(srcFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) + TCU_THROW(NotSupportedError, "Source format feature sampled image filter linear not supported"); + if (!(dstFormatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)) + TCU_THROW(NotSupportedError, "Destination format feature sampled image filter linear not supported"); + } + } + private: TestParams m_params; }; @@ -3312,11 +3326,6 @@ ResolveImageToImage::ResolveImageToImage (Context& context, TestParams params, c : CopiesAndBlittingTestInstance (context, params) , m_options (options) { - const VkSampleCountFlagBits rasterizationSamples = m_params.samples; - - if (!(context.getDeviceProperties().limits.framebufferColorSampleCounts & rasterizationSamples)) - throw tcu::NotSupportedError("Unsupported number of rasterization samples"); - const InstanceInterface& vki = context.getInstanceInterface(); const DeviceInterface& vk = context.getDeviceInterface(); const VkPhysicalDevice vkPhysDevice = context.getPhysicalDevice(); @@ -3337,22 +3346,7 @@ ResolveImageToImage::ResolveImageToImage (Context& context, TestParams params, c Move pipelineLayout; Move graphicsPipeline; - VkImageFormatProperties properties; - if ((context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.src.image.format, - m_params.src.image.imageType, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_SRC_BIT, 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) || - (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), - m_params.dst.image.format, - m_params.dst.image.imageType, - VK_IMAGE_TILING_OPTIMAL, - VK_IMAGE_USAGE_TRANSFER_DST_BIT, 0, - &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED)) - { - TCU_THROW(NotSupportedError, "Format not supported"); - } + const VkSampleCountFlagBits rasterizationSamples = m_params.samples; // Create color image. { @@ -3934,13 +3928,40 @@ public: : vkt::TestCase (testCtx, name, description) , m_params (params) , m_options (options) - {} - virtual void initPrograms (SourceCollections& programCollection) const; + {} + + virtual void initPrograms (SourceCollections& programCollection) const; virtual TestInstance* createInstance (Context& context) const - { - return new ResolveImageToImage(context, m_params, m_options); - } + { + return new ResolveImageToImage(context, m_params, m_options); + } + + virtual void checkSupport (Context& context) const + { + const VkSampleCountFlagBits rasterizationSamples = m_params.samples; + + if (!(context.getDeviceProperties().limits.framebufferColorSampleCounts & rasterizationSamples)) + throw tcu::NotSupportedError("Unsupported number of rasterization samples"); + + VkImageFormatProperties properties; + if ((context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.src.image.format, + m_params.src.image.imageType, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_SRC_BIT, 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED) || + (context.getInstanceInterface().getPhysicalDeviceImageFormatProperties (context.getPhysicalDevice(), + m_params.dst.image.format, + m_params.dst.image.imageType, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_TRANSFER_DST_BIT, 0, + &properties) == VK_ERROR_FORMAT_NOT_SUPPORTED)) + { + TCU_THROW(NotSupportedError, "Format not supported"); + } + } + private: TestParams m_params; const ResolveImageToImageOptions m_options; diff --git a/external/vulkancts/modules/vulkan/api/vktApiPipelineTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiPipelineTests.cpp index c68e022..a826532 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiPipelineTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiPipelineTests.cpp @@ -1375,12 +1375,21 @@ tcu::TestStatus pipelineLayoutLifetimeComputeTest (Context& context) return tcu::TestStatus::pass("Pass"); } +void checkSupport (Context& context) +{ + const InstanceInterface& vki = context.getInstanceInterface(); + const VkPhysicalDevice physicalDevice = context.getPhysicalDevice(); + + // Throws exception if not supported + getRenderTargetFormat(vki, physicalDevice); +} + tcu::TestCaseGroup* createrenderpassTests (tcu::TestContext& testCtx) { de::MovePtr renderPassTests(new tcu::TestCaseGroup(testCtx, "renderpass", "Renderpass tests")); - addFunctionCaseWithPrograms(renderPassTests.get(), "destroy_pipeline_renderpass", "Draw after destroying the renderpass used to create a pipeline", createDestroyPipelineRenderPassSource, renderpassLifetimeTest); - addFunctionCase(renderPassTests.get(), "framebuffer_compatible_renderpass", "Use a render pass with a framebuffer that was created using another compatible render pass", framebufferCompatibleRenderPassTest); + addFunctionCaseWithPrograms(renderPassTests.get(), "destroy_pipeline_renderpass", "Draw after destroying the renderpass used to create a pipeline", checkSupport, createDestroyPipelineRenderPassSource, renderpassLifetimeTest); + addFunctionCase(renderPassTests.get(), "framebuffer_compatible_renderpass", "Use a render pass with a framebuffer that was created using another compatible render pass", checkSupport, framebufferCompatibleRenderPassTest); return renderPassTests.release(); } @@ -1389,8 +1398,8 @@ tcu::TestCaseGroup* createPipelineLayoutLifetimeTests (tcu::TestContext& testCtx { de::MovePtr pipelineLayoutLifetimeTests(new tcu::TestCaseGroup(testCtx, "lifetime", "Pipeline layout lifetime tests")); - addFunctionCaseWithPrograms(pipelineLayoutLifetimeTests.get(), "graphics", "Test pipeline layout lifetime in graphics pipeline", createPipelineLayoutLifetimeGraphicsSource, pipelineLayoutLifetimeGraphicsTest); - addFunctionCaseWithPrograms(pipelineLayoutLifetimeTests.get(), "compute", "Test pipeline layout lifetime in compute pipeline", createPipelineLayoutLifetimeComputeSource, pipelineLayoutLifetimeComputeTest); + addFunctionCaseWithPrograms(pipelineLayoutLifetimeTests.get(), "graphics", "Test pipeline layout lifetime in graphics pipeline", checkSupport, createPipelineLayoutLifetimeGraphicsSource, pipelineLayoutLifetimeGraphicsTest); + addFunctionCaseWithPrograms(pipelineLayoutLifetimeTests.get(), "compute", "Test pipeline layout lifetime in compute pipeline", checkSupport, createPipelineLayoutLifetimeComputeSource, pipelineLayoutLifetimeComputeTest); return pipelineLayoutLifetimeTests.release(); } diff --git a/external/vulkancts/modules/vulkan/vktTestCaseUtil.hpp b/external/vulkancts/modules/vulkan/vktTestCaseUtil.hpp index 106e5b6..fb94ae2 100644 --- a/external/vulkancts/modules/vulkan/vktTestCaseUtil.hpp +++ b/external/vulkancts/modules/vulkan/vktTestCaseUtil.hpp @@ -214,6 +214,16 @@ inline TestCase* createFunctionCase (tcu::TestContext& testCtx, return new InstanceFactory1(testCtx, type, name, desc, testFunction); } +inline TestCase* createFunctionCase (tcu::TestContext& testCtx, + tcu::TestNodeType type, + const std::string& name, + const std::string& desc, + FunctionSupport0::Function checkSupport, + FunctionInstance0::Function testFunction) +{ + return new InstanceFactory1WithSupport(testCtx, type, name, desc, testFunction, checkSupport); +} + inline TestCase* createFunctionCaseWithPrograms (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, @@ -299,6 +309,15 @@ inline void addFunctionCase (tcu::TestCaseGroup* group, group->addChild(createFunctionCase(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, testFunc)); } +inline void addFunctionCase (tcu::TestCaseGroup* group, + const std::string& name, + const std::string& desc, + FunctionSupport0::Function checkSupport, + FunctionInstance0::Function testFunc) +{ + group->addChild(createFunctionCase(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, checkSupport, testFunc)); +} + inline void addFunctionCaseWithPrograms (tcu::TestCaseGroup* group, const std::string& name, const std::string& desc, @@ -308,6 +327,16 @@ inline void addFunctionCaseWithPrograms (tcu::TestCaseGroup* group, group->addChild(createFunctionCaseWithPrograms(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, initPrograms, testFunc)); } +inline void addFunctionCaseWithPrograms (tcu::TestCaseGroup* group, + const std::string& name, + const std::string& desc, + FunctionSupport0::Function checkSupport, + FunctionPrograms0::Function initPrograms, + FunctionInstance0::Function testFunc) +{ + group->addChild(createFunctionCaseWithPrograms(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, checkSupport, initPrograms, testFunc)); +} + template void addFunctionCase (tcu::TestCaseGroup* group, const std::string& name, -- 2.7.4