VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull) /* infinity */));
}
+bool checkSparseImageFormatSupport (const VkPhysicalDevice physicalDevice,
+ const InstanceInterface& instance,
+ const VkImageCreateInfo& imageCreateInfo)
+{
+ const std::vector<VkSparseImageFormatProperties> sparseImageFormatPropVec =
+ getPhysicalDeviceSparseImageFormatProperties(instance, physicalDevice, imageCreateInfo.format, imageCreateInfo.imageType, imageCreateInfo.samples, imageCreateInfo.usage, imageCreateInfo.tiling);
+
+ return (sparseImageFormatPropVec.size() != 0);
+}
+
void allocateAndBindSparseImage (const DeviceInterface& vk,
VkDevice device,
const VkPhysicalDevice physicalDevice,
deUint32 sparseMemoryReqCount = 0;
// Check if the image format supports sparse operations
- const std::vector<VkSparseImageFormatProperties> sparseImageFormatPropVec =
- getPhysicalDeviceSparseImageFormatProperties(instance, physicalDevice, imageCreateInfo.format, imageCreateInfo.imageType, imageCreateInfo.samples, imageCreateInfo.usage, imageCreateInfo.tiling);
-
- if (sparseImageFormatPropVec.size() == 0)
+ if (!checkSparseImageFormatSupport(physicalDevice, instance, imageCreateInfo))
TCU_THROW(NotSupportedError, "The image format does not support sparse operations.");
vk.getImageSparseMemoryRequirements(device, destImage, &sparseMemoryReqCount, DE_NULL);
const VkPhysicalDevice physicalDevice,
const InstanceInterface& instance,
const VkImageCreateInfo& imageCreateInfo,
- VkQueue queue,
- deUint32 queueFamilyIndex,
+ VkQueue universalQueue,
+ deUint32 universalQueueFamilyIndex,
+ VkQueue sparseQueue,
Allocator& allocator,
std::vector<de::SharedPtr<Allocation> >& allocations,
const TestTexture& srcTexture,
bufferSize = stencilOffset + srcStencilTexture->getSize();
}
- allocateAndBindSparseImage (vk, device, physicalDevice, instance, imageCreateInfo, imageMemoryBindSemaphore.get(), queue, allocator, allocations, format, destImage);
+ allocateAndBindSparseImage (vk, device, physicalDevice, instance, imageCreateInfo, imageMemoryBindSemaphore.get(), sparseQueue, allocator, allocations, format, destImage);
{
// Create source buffer
Move<VkBuffer> buffer = createBuffer(vk, device, &bufferParams);
de::MovePtr<Allocation> bufferAlloc = allocator.allocate(getBufferMemoryRequirements(vk, device, *buffer), MemoryRequirement::HostVisible);
- Move<VkCommandPool> cmdPool = createCommandPool(vk, device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex);
+ Move<VkCommandPool> cmdPool = createCommandPool(vk, device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, universalQueueFamilyIndex);
Move<VkCommandBuffer> cmdBuffer = allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
Move<VkFence> fence = createFence(vk, device);
try
{
- VK_CHECK(vk.queueSubmit(queue, 1, &submitInfo, *fence));
+ VK_CHECK(vk.queueSubmit(universalQueue, 1, &submitInfo, *fence));
VK_CHECK(vk.waitForFences(device, 1, &fence.get(), true, ~(0ull) /* infinity */));
}
catch (...)
const VkPhysicalDevice physicalDevice,
const InstanceInterface& instance,
const VkImageCreateInfo& imageCreateInfo,
- VkQueue queue,
- deUint32 queueFamilyIndex,
+ VkQueue universalQueue,
+ deUint32 universalQueueFamilyIndex,
+ VkQueue sparseQueue,
Allocator& allocator,
std::vector<de::SharedPtr<Allocation> >& allocations,
const TestTexture& srcTexture,
physicalDevice,
instance,
imageCreateInfo,
- queue,
- queueFamilyIndex,
+ universalQueue,
+ universalQueueFamilyIndex,
+ sparseQueue,
allocator,
allocations,
*srcDepthTexture,
physicalDevice,
instance,
imageCreateInfo,
- queue,
- queueFamilyIndex,
+ universalQueue,
+ universalQueueFamilyIndex,
+ sparseQueue,
allocator,
allocations,
srcTexture,