summaryrefslogtreecommitdiffstats
path: root/examples/vulkan
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-09-10 10:04:36 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-09-12 08:34:15 +0000
commit1c6bd414dd1c8d1e87b5310cf704a2a8a2966ee4 (patch)
treed5f0f1fef18e76906165ec279b00a4003a811778 /examples/vulkan
parent48897f97e726dd34559b9fa213501ea24bfb692d (diff)
Fix device local alloc in hellovulkantexture
Running with QT_VK_FORCE_STAGE_TEX does not work at all with recent NVIDIA drivers due to QVulkanWindow's and the example's naive way of picking the memory index. Enhance this and add a warning note to the QVulkanWindow docs as well. Change-Id: I7f200e11d982b56e3da3b71ee3915bd7bfca5cc1 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'examples/vulkan')
-rw-r--r--examples/vulkan/hellovulkantexture/hellovulkantexture.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp
index c3dc891efa..257191ef4e 100644
--- a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp
+++ b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp
@@ -223,6 +223,16 @@ bool VulkanRenderer::createTextureImage(const QSize &size, VkImage *image, VkDev
VkMemoryRequirements memReq;
m_devFuncs->vkGetImageMemoryRequirements(dev, *image, &memReq);
+ if (!(memReq.memoryTypeBits & (1 << memIndex))) {
+ VkPhysicalDeviceMemoryProperties physDevMemProps;
+ m_window->vulkanInstance()->functions()->vkGetPhysicalDeviceMemoryProperties(m_window->physicalDevice(), &physDevMemProps);
+ for (uint32_t i = 0; i < physDevMemProps.memoryTypeCount; ++i) {
+ if (!(memReq.memoryTypeBits & (1 << i)))
+ continue;
+ memIndex = i;
+ }
+ }
+
VkMemoryAllocateInfo allocInfo = {
VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
nullptr,