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,
const vk::VkPhysicalDevice physicalDevice,
const vk::InstanceInterface& instance,
const vk::VkImageCreateInfo& imageCreateInfo,
- vk::VkQueue queue,
- deUint32 queueFamilyIndex,
+ vk::VkQueue universalQueue,
+ deUint32 universalQueueFamilyIndex,
+ vk::VkQueue sparseQueue,
vk::Allocator& allocator,
std::vector<de::SharedPtr<vk::Allocation> >& allocations,
const TestTexture& srcTexture,
vk::VkImage destImage);
-
-
/*--------------------------------------------------------------------*//*!
* Allocates memory for a sparse image and handles the memory binding.
*//*--------------------------------------------------------------------*/
namespace
{
-deUint32 findQueueFamilyIndexWithCaps (const InstanceInterface& vkInstance, VkPhysicalDevice physicalDevice, VkQueueFlags requiredCaps)
-{
- const std::vector<VkQueueFamilyProperties> queueProps = getPhysicalDeviceQueueFamilyProperties(vkInstance, physicalDevice);
-
- for (size_t queueNdx = 0; queueNdx < queueProps.size(); queueNdx++)
- {
- if ((queueProps[queueNdx].queueFlags & requiredCaps) == requiredCaps)
- return (deUint32)queueNdx;
- }
-
- TCU_THROW(NotSupportedError, "No matching queue found");
-}
-
-Move<VkDevice> createDevice(const InstanceInterface& vkInstance, VkPhysicalDevice physicalDevice, deUint32 queueFamilyIndex)
-{
- const VkPhysicalDeviceFeatures deviceFeatures = getPhysicalDeviceFeatures(vkInstance, physicalDevice);
-
- VkDeviceQueueCreateInfo queueInfo;
- VkDeviceCreateInfo deviceInfo;
- const float queuePriority = 1.0f;
-
- deMemset(&queueInfo, 0, sizeof(queueInfo));
- deMemset(&deviceInfo, 0, sizeof(deviceInfo));
-
- queueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queueInfo.pNext = DE_NULL;
- queueInfo.flags = (VkDeviceQueueCreateFlags)0u;
- queueInfo.queueFamilyIndex = queueFamilyIndex;
- queueInfo.queueCount = 1u;
- queueInfo.pQueuePriorities = &queuePriority;
-
- deviceInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
- deviceInfo.pNext = DE_NULL;
- deviceInfo.queueCreateInfoCount = 1u;
- deviceInfo.pQueueCreateInfos = &queueInfo;
- deviceInfo.enabledExtensionCount = 0u;
- deviceInfo.ppEnabledExtensionNames = DE_NULL;
- deviceInfo.enabledLayerCount = 0u;
- deviceInfo.ppEnabledLayerNames = DE_NULL;
- deviceInfo.pEnabledFeatures = &deviceFeatures;
-
- if (!deviceFeatures.sparseBinding)
- TCU_THROW(NotSupportedError, "Sparse binding not supported");
-
- return createDevice(vkInstance, physicalDevice, &deviceInfo);
-}
-
de::MovePtr<Allocation> createBufferMemory (const DeviceInterface& vk,
VkDevice device,
Allocator& allocator,
const InstanceInterface& instance,
Allocator& allocator,
vector<de::SharedPtr<Allocation> >& allocations,
- deUint32 queueFamilyIndex,
- VkQueue& queue,
+ deUint32 universalQueueFamilyIndex,
+ VkQueue sparseQueue,
+ deUint32 sparseQueueFamilyIndex,
const VkSemaphore& bindSemaphore,
VkFormat format,
deUint32 width,
deUint32 height)
{
- const VkExtent3D imageExtent =
+ deUint32 queueFamilyIndices[] = {universalQueueFamilyIndex, sparseQueueFamilyIndex};
+ const VkSharingMode sharingMode = universalQueueFamilyIndex != sparseQueueFamilyIndex ? VK_SHARING_MODE_CONCURRENT : VK_SHARING_MODE_EXCLUSIVE;
+
+ const VkExtent3D imageExtent =
{
width,
height,
1u
};
- const VkImageCreateInfo imageCreateInfo =
+ const VkImageCreateInfo imageCreateInfo =
{
VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
DE_NULL,
VK_SAMPLE_COUNT_1_BIT,
VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT,
- VK_SHARING_MODE_EXCLUSIVE,
- 1u,
- &queueFamilyIndex,
+ sharingMode,
+ sharingMode == VK_SHARING_MODE_CONCURRENT ? 2u : 1u,
+ queueFamilyIndices,
VK_IMAGE_LAYOUT_UNDEFINED
};
Move<VkImage> destImage = createImage(vk, device, &imageCreateInfo);
- vkt::pipeline::allocateAndBindSparseImage(vk, device, physicalDevice, instance, imageCreateInfo, bindSemaphore, queue, allocator, allocations, mapVkFormat(format), *destImage);
+ vkt::pipeline::allocateAndBindSparseImage(vk, device, physicalDevice, instance, imageCreateInfo, bindSemaphore, sparseQueue, allocator, allocations, mapVkFormat(format), *destImage);
return destImage;
}
const deUint32 m_height;
const VkFormat m_format;
- deUint32 m_queueFamilyIndex;
- const Unique<VkDevice> m_device;
- VkQueue m_queue;
-
- SimpleAllocator m_allocator;
vector<de::SharedPtr<Allocation> > m_allocations;
const Unique<VkSemaphore> m_bindSemaphore;
, m_width (32u)
, m_height (32u)
, m_format (format)
- , m_queueFamilyIndex (findQueueFamilyIndexWithCaps(context.getInstanceInterface(), context.getPhysicalDevice(), VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_BINDING_BIT))
- , m_device (createDevice(context.getInstanceInterface(), context.getPhysicalDevice(), m_queueFamilyIndex))
- , m_queue (getDeviceQueue(context.getDeviceInterface(), *m_device, m_queueFamilyIndex, 0))
- , m_allocator (context.getDeviceInterface(), *m_device, getPhysicalDeviceMemoryProperties(context.getInstanceInterface(), context.getPhysicalDevice()))
- , m_bindSemaphore (createSemaphore(context.getDeviceInterface(), *m_device))
- , m_dstImage (createSparseImageAndMemory(context.getDeviceInterface(), *m_device, context.getPhysicalDevice(), context.getInstanceInterface(), m_allocator, m_allocations, m_queueFamilyIndex, m_queue, *m_bindSemaphore, m_format, m_width, m_height))
- , m_dstImageView (createImageView(context.getDeviceInterface(), *m_device, *m_dstImage, m_format, VK_IMAGE_ASPECT_COLOR_BIT))
- , m_dstBuffer (createBuffer(context.getDeviceInterface(), *m_device, m_format, m_width, m_height))
- , m_dstBufferMemory (createBufferMemory(context.getDeviceInterface(), *m_device, m_allocator, *m_dstBuffer))
- , m_renderPass (createRenderPass(context.getDeviceInterface(), *m_device, m_format))
- , m_framebuffer (createFramebuffer(context.getDeviceInterface(), *m_device, *m_renderPass, *m_dstImageView, m_width, m_height))
- , m_renderPipelineLayout (createRenderPipelineLayout(context.getDeviceInterface(), *m_device))
- , m_renderPipeline (createRenderPipeline(context.getDeviceInterface(), *m_device, *m_renderPass, *m_renderPipelineLayout, context.getBinaryCollection(), m_width, m_height))
- , m_commandPool (createCommandPool(context.getDeviceInterface(), *m_device, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, m_queueFamilyIndex))
+ , m_bindSemaphore (createSemaphore(context.getDeviceInterface(), context.getDevice()))
+ , m_dstImage (createSparseImageAndMemory(context.getDeviceInterface(), context.getDevice(), context.getPhysicalDevice(), context.getInstanceInterface(), context.getDefaultAllocator(), m_allocations, context.getUniversalQueueFamilyIndex(), context.getSparseQueue(), context.getSparseQueueFamilyIndex(), *m_bindSemaphore, m_format, m_width, m_height))
+ , m_dstImageView (createImageView(context.getDeviceInterface(), context.getDevice(), *m_dstImage, m_format, VK_IMAGE_ASPECT_COLOR_BIT))
+ , m_dstBuffer (createBuffer(context.getDeviceInterface(), context.getDevice(), m_format, m_width, m_height))
+ , m_dstBufferMemory (createBufferMemory(context.getDeviceInterface(), context.getDevice(), context.getDefaultAllocator(), *m_dstBuffer))
+ , m_renderPass (createRenderPass(context.getDeviceInterface(), context.getDevice(), m_format))
+ , m_framebuffer (createFramebuffer(context.getDeviceInterface(), context.getDevice(), *m_renderPass, *m_dstImageView, m_width, m_height))
+ , m_renderPipelineLayout (createRenderPipelineLayout(context.getDeviceInterface(), context.getDevice()))
+ , m_renderPipeline (createRenderPipeline(context.getDeviceInterface(), context.getDevice(), *m_renderPass, *m_renderPipelineLayout, context.getBinaryCollection(), m_width, m_height))
+ , m_commandPool (createCommandPool(context.getDeviceInterface(), context.getDevice(), VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, context.getUniversalQueueFamilyIndex()))
{
}
tcu::TestStatus SparseRenderTargetTestInstance::iterate (void)
{
const DeviceInterface& vkd (m_context.getDeviceInterface());
- const Unique<VkCommandBuffer> commandBuffer (allocateCommandBuffer(vkd, *m_device, *m_commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
+ const Unique<VkCommandBuffer> commandBuffer (allocateCommandBuffer(vkd, m_context.getDevice(), *m_commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
{
const VkCommandBufferBeginInfo beginInfo =
DE_NULL
};
- VK_CHECK(vkd.queueSubmit(m_queue, 1u, &submitInfo, (VkFence)0u));
- VK_CHECK(vkd.queueWaitIdle(m_queue));
+ VK_CHECK(vkd.queueSubmit(m_context.getUniversalQueue(), 1u, &submitInfo, (VkFence)0u));
+ VK_CHECK(vkd.queueWaitIdle(m_context.getUniversalQueue()));
}
{
TextureBinding::TextureBinding (Context& context)
: m_context (context)
- , m_queueFamilyIndex (findQueueFamilyIndexWithCaps(context.getInstanceInterface(), context.getPhysicalDevice(), VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_SPARSE_BINDING_BIT))
- , m_device (createDevice())
- , m_deviceInterface (context.getInstanceInterface(), *m_device)
- , m_allocator (createAllocator())
{
}
TextureBinding::TextureBinding (Context& context, const TestTextureSp& textureData, const TextureBinding::Type type, const TextureBinding::ImageBackingMode backingMode)
: m_context (context)
- , m_queueFamilyIndex (findQueueFamilyIndexWithCaps(context.getInstanceInterface(), context.getPhysicalDevice(), VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_SPARSE_BINDING_BIT))
, m_type (type)
, m_backingMode (backingMode)
, m_textureData (textureData)
- , m_device (createDevice())
- , m_deviceInterface (context.getInstanceInterface(), *m_device)
- , m_allocator (createAllocator())
{
updateTextureData(m_textureData, m_type);
}
const DeviceInterface& vkd = m_context.getDeviceInterface();
const VkDevice vkDevice = m_context.getDevice();
const bool sparse = m_backingMode == IMAGE_BACKING_MODE_SPARSE;
- const deUint32 queueFamilyIndex = sparse ? m_queueFamilyIndex : m_context.getUniversalQueueFamilyIndex();
- const VkQueue queue = sparse ? getDeviceQueue(vkd, vkDevice, queueFamilyIndex, 0) : m_context.getUniversalQueue();
+ const deUint32 queueFamilyIndices[] = {m_context.getUniversalQueueFamilyIndex(), m_context.getSparseQueueFamilyIndex()};
Allocator& allocator = m_context.getDefaultAllocator();
m_type = textureType;
m_textureData = textureData;
const deUint32 arraySize = textureData->getArraySize();
vk::VkImageFormatProperties imageFormatProperties;
const VkResult imageFormatQueryResult = m_context.getInstanceInterface().getPhysicalDeviceImageFormatProperties(m_context.getPhysicalDevice(), format, imageType, imageTiling, imageUsageFlags, imageCreateFlags, &imageFormatProperties);
+ const VkSharingMode sharingMode = (sparse && m_context.getUniversalQueueFamilyIndex() != m_context.getSparseQueueFamilyIndex()) ? VK_SHARING_MODE_CONCURRENT : VK_SHARING_MODE_EXCLUSIVE;
if (imageFormatQueryResult == VK_ERROR_FORMAT_NOT_SUPPORTED)
{
VK_SAMPLE_COUNT_1_BIT, // VkSampleCountFlagBits samples;
imageTiling, // VkImageTiling tiling;
imageUsageFlags, // VkImageUsageFlags usage;
- VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
- 1u, // deUint32 queueFamilyIndexCount;
- &queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
+ sharingMode, // VkSharingMode sharingMode;
+ sharingMode == VK_SHARING_MODE_CONCURRENT ? 2u : 1u, // deUint32 queueFamilyIndexCount;
+ queueFamilyIndices, // const deUint32* pQueueFamilyIndices;
VK_IMAGE_LAYOUT_UNDEFINED // VkImageLayout initialLayout;
};
m_context.getPhysicalDevice(),
m_context.getInstanceInterface(),
imageParams,
- queue,
- queueFamilyIndex,
- *m_allocator,
+ m_context.getUniversalQueue(),
+ m_context.getUniversalQueueFamilyIndex(),
+ m_context.getSparseQueue(),
+ allocator,
m_allocations,
*m_textureData,
*m_textureImage);
pipeline::uploadTestTexture (vkd,
vkDevice,
- queue,
- queueFamilyIndex,
+ m_context.getUniversalQueue(),
+ m_context.getUniversalQueueFamilyIndex(),
allocator,
*m_textureData,
*m_textureImage);
m_textureImageView = createImageView(vkd, vkDevice, &viewParams);
}
-vk::Allocator* TextureBinding::createAllocator() const
-{
- VkPhysicalDeviceMemoryProperties memoryProperties = getPhysicalDeviceMemoryProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice());
- return new SimpleAllocator(m_deviceInterface, *m_device, memoryProperties);
-}
-
-Move<VkDevice> TextureBinding::createDevice() const
-{
- const InstanceInterface& vk = m_context.getInstanceInterface();
- const VkPhysicalDevice physicalDevice = m_context.getPhysicalDevice();
- const VkPhysicalDeviceFeatures deviceFeatures = getPhysicalDeviceFeatures(vk, physicalDevice);
-
- VkDeviceQueueCreateInfo queueInfo;
- VkDeviceCreateInfo deviceInfo;
- const float queuePriority = 1.0f;
-
- deMemset(&queueInfo, 0, sizeof(queueInfo));
- deMemset(&deviceInfo, 0, sizeof(deviceInfo));
-
- queueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queueInfo.pNext = DE_NULL;
- queueInfo.flags = (VkDeviceQueueCreateFlags)0u;
- queueInfo.queueFamilyIndex = m_queueFamilyIndex;
- queueInfo.queueCount = 1u;
- queueInfo.pQueuePriorities = &queuePriority;
-
- deviceInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
- deviceInfo.pNext = DE_NULL;
- deviceInfo.queueCreateInfoCount = 1u;
- deviceInfo.pQueueCreateInfos = &queueInfo;
- deviceInfo.enabledExtensionCount = 0u;
- deviceInfo.ppEnabledExtensionNames = DE_NULL;
- deviceInfo.enabledLayerCount = 0u;
- deviceInfo.ppEnabledLayerNames = DE_NULL;
- deviceInfo.pEnabledFeatures = &deviceFeatures;
-
- return vk::createDevice(vk, physicalDevice, &deviceInfo);
-}
-
const deUint16 TextureRenderer::s_vertexIndices[6] = { 0, 1, 2, 2, 1, 3 };
const VkDeviceSize TextureRenderer::s_vertexIndexBufferSize = sizeof(TextureRenderer::s_vertexIndices);
TextureBinding& operator= (const TextureBinding&); // not allowed!
void updateTextureData (const TestTextureSp& textureData, const Type type);
- vk::Allocator* createAllocator (void) const;
- vk::Move<vk::VkDevice> createDevice (void) const;
Context& m_context;
- const deUint32 m_queueFamilyIndex;
Type m_type;
ImageBackingMode m_backingMode;
TestTextureSp m_textureData;
vk::Move<vk::VkImage> m_textureImage;
de::MovePtr<vk::Allocation> m_textureImageMemory;
vk::Move<vk::VkImageView> m_textureImageView;
- vk::Unique<vk::VkDevice> m_device;
- vk::DeviceDriver m_deviceInterface;
- const de::UniquePtr<vk::Allocator> m_allocator;
std::vector<de::SharedPtr<vk::Allocation> > m_allocations;
};
Move<VkDevice> createDefaultDevice (const InstanceInterface& vki,
VkPhysicalDevice physicalDevice,
deUint32 queueIndex,
+ deUint32 sparseQueueIndex,
const VkPhysicalDeviceFeatures2KHR& enabledFeatures,
const vector<string>& enabledExtensions,
const tcu::CommandLine& cmdLine)
{
- VkDeviceQueueCreateInfo queueInfo;
+ VkDeviceQueueCreateInfo queueInfo[2];
VkDeviceCreateInfo deviceInfo;
vector<string> enabledLayers;
vector<const char*> layerPtrs;
vector<const char*> extensionPtrs;
const float queuePriority = 1.0f;
+ const deUint32 numQueues = enabledFeatures.features.sparseBinding ? 2 : 1;
deMemset(&queueInfo, 0, sizeof(queueInfo));
deMemset(&deviceInfo, 0, sizeof(deviceInfo));
for (size_t ndx = 0; ndx < enabledExtensions.size(); ++ndx)
extensionPtrs[ndx] = enabledExtensions[ndx].c_str();
- // VK_KHR_get_physical_device_propeties2 is used if enabledFeatures.pNext != 0
-
- queueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queueInfo.pNext = DE_NULL;
- queueInfo.flags = (VkDeviceQueueCreateFlags)0u;
- queueInfo.queueFamilyIndex = queueIndex;
- queueInfo.queueCount = 1u;
- queueInfo.pQueuePriorities = &queuePriority;
-
+ queueInfo[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
+ queueInfo[0].pNext = DE_NULL;
+ queueInfo[0].flags = (VkDeviceQueueCreateFlags)0u;
+ queueInfo[0].queueFamilyIndex = queueIndex;
+ queueInfo[0].queueCount = 1u;
+ queueInfo[0].pQueuePriorities = &queuePriority;
+
+ queueInfo[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
+ queueInfo[1].pNext = DE_NULL;
+ queueInfo[1].flags = (VkDeviceQueueCreateFlags)0u;
+ queueInfo[1].queueFamilyIndex = sparseQueueIndex;
+ queueInfo[1].queueCount = 1u;
+ queueInfo[1].pQueuePriorities = &queuePriority;
+
+ // VK_KHR_get_physical_device_properties2 is used if enabledFeatures.pNext != 0
deviceInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
deviceInfo.pNext = enabledFeatures.pNext ? &enabledFeatures : DE_NULL;
- deviceInfo.queueCreateInfoCount = 1u;
- deviceInfo.pQueueCreateInfos = &queueInfo;
+ deviceInfo.queueCreateInfoCount = numQueues;
+ deviceInfo.pQueueCreateInfos = queueInfo;
deviceInfo.enabledExtensionCount = (deUint32)extensionPtrs.size();
deviceInfo.ppEnabledExtensionNames = (extensionPtrs.empty() ? DE_NULL : &extensionPtrs[0]);
deviceInfo.enabledLayerCount = (deUint32)layerPtrs.size();
deUint32 getUniversalQueueFamilyIndex (void) const { return m_universalQueueFamilyIndex; }
VkQueue getUniversalQueue (void) const;
+ deUint32 getSparseQueueFamilyIndex (void) const { return m_sparseQueueFamilyIndex; }
+ VkQueue getSparseQueue (void) const;
private:
static VkPhysicalDeviceFeatures filterDefaultDeviceFeatures (const VkPhysicalDeviceFeatures& deviceFeatures);
const InstanceDriver m_instanceInterface;
const VkPhysicalDevice m_physicalDevice;
-
- const deUint32 m_universalQueueFamilyIndex;
const vector<string> m_deviceExtensions;
const DeviceFeatures m_deviceFeatures;
+
+ const deUint32 m_universalQueueFamilyIndex;
+ const deUint32 m_sparseQueueFamilyIndex;
const VkPhysicalDeviceProperties m_deviceProperties;
const Unique<VkDevice> m_device;
, m_instance (createInstance(vkPlatform, m_instanceExtensions, cmdLine))
, m_instanceInterface (vkPlatform, *m_instance)
, m_physicalDevice (chooseDevice(m_instanceInterface, *m_instance, cmdLine))
- , m_universalQueueFamilyIndex (findQueueFamilyIndexWithCaps(m_instanceInterface, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT))
, m_deviceExtensions (filterExtensions(enumerateDeviceExtensionProperties(m_instanceInterface, m_physicalDevice, DE_NULL)))
, m_deviceFeatures (m_instanceInterface, m_physicalDevice, m_instanceExtensions, m_deviceExtensions)
+ , m_universalQueueFamilyIndex (findQueueFamilyIndexWithCaps(m_instanceInterface, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT))
+ , m_sparseQueueFamilyIndex (m_deviceFeatures.coreFeatures.features.sparseBinding ? findQueueFamilyIndexWithCaps(m_instanceInterface, m_physicalDevice, VK_QUEUE_SPARSE_BINDING_BIT) : 0)
, m_deviceProperties (getPhysicalDeviceProperties(m_instanceInterface, m_physicalDevice))
- , m_device (createDefaultDevice(m_instanceInterface,
- m_physicalDevice,
- m_universalQueueFamilyIndex,
- m_deviceFeatures.coreFeatures,
- m_deviceExtensions,
- cmdLine))
+ , m_device (createDefaultDevice(m_instanceInterface, m_physicalDevice, m_universalQueueFamilyIndex, m_sparseQueueFamilyIndex, m_deviceFeatures.coreFeatures, m_deviceExtensions, cmdLine))
, m_deviceInterface (m_instanceInterface, *m_device)
{
}
return getDeviceQueue(m_deviceInterface, *m_device, m_universalQueueFamilyIndex, 0);
}
-namespace
+VkQueue DefaultDevice::getSparseQueue (void) const
{
+ if (!m_deviceFeatures.coreFeatures.features.sparseBinding)
+ TCU_THROW(NotSupportedError, "Sparse binding not supported.");
+
+ return getDeviceQueue(m_deviceInterface, *m_device, m_sparseQueueFamilyIndex, 0);
+}
+namespace
+{
// Allocator utilities
vk::Allocator* createAllocator (DefaultDevice* device)
const vk::DeviceInterface& Context::getDeviceInterface (void) const { return m_device->getDeviceInterface(); }
deUint32 Context::getUniversalQueueFamilyIndex (void) const { return m_device->getUniversalQueueFamilyIndex(); }
vk::VkQueue Context::getUniversalQueue (void) const { return m_device->getUniversalQueue(); }
+deUint32 Context::getSparseQueueFamilyIndex (void) const { return m_device->getSparseQueueFamilyIndex(); }
+vk::VkQueue Context::getSparseQueue (void) const { return m_device->getSparseQueue(); }
vk::Allocator& Context::getDefaultAllocator (void) const { return *m_allocator; }
// TestCase
const vk::DeviceInterface& getDeviceInterface (void) const;
deUint32 getUniversalQueueFamilyIndex (void) const;
vk::VkQueue getUniversalQueue (void) const;
-
+ deUint32 getSparseQueueFamilyIndex (void) const;
+ vk::VkQueue getSparseQueue (void) const;
vk::Allocator& getDefaultAllocator (void) const;
protected: