if (!isSupportedSampleCount(context.getInstanceInterface(), context.getPhysicalDevice(), m_multisampleStateParams.rasterizationSamples))
throw tcu::NotSupportedError("Unsupported number of rasterization samples");
- const DeviceInterface& vk = context.getDeviceInterface();
- const VkDevice vkDevice = context.getDevice();
- const deUint32 queueFamilyIndices[] = { context.getUniversalQueueFamilyIndex(), context.getSparseQueueFamilyIndex() };
- const bool sparse = m_backingMode == IMAGE_BACKING_MODE_SPARSE;
- const VkComponentMapping componentMappingRGBA = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
- const VkImageCreateFlags imageCreateFlags = sparse ? (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) : 0u;
- const VkSharingMode sharingMode = (sparse && context.getUniversalQueueFamilyIndex() != context.getSparseQueueFamilyIndex()) ? VK_SHARING_MODE_CONCURRENT : VK_SHARING_MODE_EXCLUSIVE;
- Allocator& memAlloc = m_context.getDefaultAllocator();
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice vkDevice = context.getDevice();
+ const VkPhysicalDeviceFeatures features = context.getDeviceFeatures();
+ const deUint32 queueFamilyIndices[] = { context.getUniversalQueueFamilyIndex(), context.getSparseQueueFamilyIndex() };
+ const bool sparse = m_backingMode == IMAGE_BACKING_MODE_SPARSE;
+ const VkComponentMapping componentMappingRGBA = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
+ const VkImageCreateFlags imageCreateFlags = sparse ? (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) : 0u;
+ const VkSharingMode sharingMode = (sparse && context.getUniversalQueueFamilyIndex() != context.getSparseQueueFamilyIndex()) ? VK_SHARING_MODE_CONCURRENT : VK_SHARING_MODE_EXCLUSIVE;
+ Allocator& memAlloc = m_context.getDefaultAllocator();
+ const bool usesResolveImage = m_renderType == RENDER_TYPE_RESOLVE || m_renderType == RENDER_TYPE_DEPTHSTENCIL_ONLY;
+
+ if (sparse)
+ {
+ bool sparseSamplesSupported = false;
+ switch(m_multisampleStateParams.rasterizationSamples)
+ {
+ case VK_SAMPLE_COUNT_2_BIT:
+ sparseSamplesSupported = features.sparseResidency2Samples;
+ break;
+ case VK_SAMPLE_COUNT_4_BIT:
+ sparseSamplesSupported = features.sparseResidency4Samples;
+ break;
+ case VK_SAMPLE_COUNT_8_BIT:
+ sparseSamplesSupported = features.sparseResidency8Samples;
+ break;
+ case VK_SAMPLE_COUNT_16_BIT:
+ sparseSamplesSupported = features.sparseResidency16Samples;
+ break;
+ default:
+ break;
+ }
+
+ if (!sparseSamplesSupported)
+ throw tcu::NotSupportedError("Unsupported number of rasterization samples for sparse residency");
+ }
+ if (sparse && !context.getDeviceFeatures().sparseBinding)
+ throw tcu::NotSupportedError("No sparseBinding support");
+
// Create color image
{
const VkImageUsageFlags imageUsageFlags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |