diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_compute_pass.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp | 29 |
3 files changed, 29 insertions, 12 deletions
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index f4b3ee95c..8ac58bc2f 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -358,7 +358,7 @@ void BufferCacheRuntime::ReserveNullBuffer() { | |||
| 358 | if (null_buffer) { | 358 | if (null_buffer) { |
| 359 | return; | 359 | return; |
| 360 | } | 360 | } |
| 361 | null_buffer = device.GetLogical().CreateBuffer(VkBufferCreateInfo{ | 361 | VkBufferCreateInfo create_info{ |
| 362 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, | 362 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, |
| 363 | .pNext = nullptr, | 363 | .pNext = nullptr, |
| 364 | .flags = 0, | 364 | .flags = 0, |
| @@ -367,9 +367,13 @@ void BufferCacheRuntime::ReserveNullBuffer() { | |||
| 367 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, | 367 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, |
| 368 | .queueFamilyIndexCount = 0, | 368 | .queueFamilyIndexCount = 0, |
| 369 | .pQueueFamilyIndices = nullptr, | 369 | .pQueueFamilyIndices = nullptr, |
| 370 | }); | 370 | }; |
| 371 | if (device.IsExtTransformFeedbackSupported()) { | ||
| 372 | create_info.usage |= VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT; | ||
| 373 | } | ||
| 374 | null_buffer = device.GetLogical().CreateBuffer(create_info); | ||
| 371 | if (device.HasDebuggingToolAttached()) { | 375 | if (device.HasDebuggingToolAttached()) { |
| 372 | null_buffer.SetObjectNameEXT("Null index buffer"); | 376 | null_buffer.SetObjectNameEXT("Null buffer"); |
| 373 | } | 377 | } |
| 374 | null_buffer_commit = memory_allocator.Commit(null_buffer, MemoryUsage::DeviceLocal); | 378 | null_buffer_commit = memory_allocator.Commit(null_buffer, MemoryUsage::DeviceLocal); |
| 375 | 379 | ||
diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index 8e426ce2c..73157a15d 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp | |||
| @@ -326,7 +326,7 @@ std::pair<VkBuffer, VkDeviceSize> QuadIndexedPass::Assemble( | |||
| 326 | .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER, | 326 | .sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER, |
| 327 | .pNext = nullptr, | 327 | .pNext = nullptr, |
| 328 | .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, | 328 | .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, |
| 329 | .dstAccessMask = VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, | 329 | .dstAccessMask = VK_ACCESS_INDEX_READ_BIT, |
| 330 | }; | 330 | }; |
| 331 | const std::array push_constants{base_vertex, index_shift}; | 331 | const std::array push_constants{base_vertex, index_shift}; |
| 332 | const VkDescriptorSet set = descriptor_allocator.Commit(); | 332 | const VkDescriptorSet set = descriptor_allocator.Commit(); |
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp index 555b12ed7..5d5329abf 100644 --- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp | |||
| @@ -61,11 +61,15 @@ std::optional<u32> FindMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& p | |||
| 61 | return std::nullopt; | 61 | return std::nullopt; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | u32 FindMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& props, u32 type_mask) { | 64 | u32 FindMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties& props, u32 type_mask, |
| 65 | // Try to find a DEVICE_LOCAL_BIT type, Nvidia and AMD have a dedicated heap for this | 65 | bool try_device_local) { |
| 66 | std::optional<u32> type = FindMemoryTypeIndex(props, type_mask, STREAM_FLAGS); | 66 | std::optional<u32> type; |
| 67 | if (type) { | 67 | if (try_device_local) { |
| 68 | return *type; | 68 | // Try to find a DEVICE_LOCAL_BIT type, Nvidia and AMD have a dedicated heap for this |
| 69 | type = FindMemoryTypeIndex(props, type_mask, STREAM_FLAGS); | ||
| 70 | if (type) { | ||
| 71 | return *type; | ||
| 72 | } | ||
| 69 | } | 73 | } |
| 70 | // Otherwise try without the DEVICE_LOCAL_BIT | 74 | // Otherwise try without the DEVICE_LOCAL_BIT |
| 71 | type = FindMemoryTypeIndex(props, type_mask, HOST_FLAGS); | 75 | type = FindMemoryTypeIndex(props, type_mask, HOST_FLAGS); |
| @@ -115,12 +119,21 @@ StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& mem | |||
| 115 | .buffer = *stream_buffer, | 119 | .buffer = *stream_buffer, |
| 116 | }; | 120 | }; |
| 117 | const auto memory_properties = device.GetPhysical().GetMemoryProperties(); | 121 | const auto memory_properties = device.GetPhysical().GetMemoryProperties(); |
| 118 | stream_memory = dev.AllocateMemory(VkMemoryAllocateInfo{ | 122 | VkMemoryAllocateInfo stream_memory_info{ |
| 119 | .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, | 123 | .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, |
| 120 | .pNext = make_dedicated ? &dedicated_info : nullptr, | 124 | .pNext = make_dedicated ? &dedicated_info : nullptr, |
| 121 | .allocationSize = requirements.size, | 125 | .allocationSize = requirements.size, |
| 122 | .memoryTypeIndex = FindMemoryTypeIndex(memory_properties, requirements.memoryTypeBits), | 126 | .memoryTypeIndex = |
| 123 | }); | 127 | FindMemoryTypeIndex(memory_properties, requirements.memoryTypeBits, true), |
| 128 | }; | ||
| 129 | stream_memory = dev.TryAllocateMemory(stream_memory_info); | ||
| 130 | if (!stream_memory) { | ||
| 131 | LOG_INFO(Render_Vulkan, "Dynamic memory allocation failed, trying with system memory"); | ||
| 132 | stream_memory_info.memoryTypeIndex = | ||
| 133 | FindMemoryTypeIndex(memory_properties, requirements.memoryTypeBits, false); | ||
| 134 | stream_memory = dev.AllocateMemory(stream_memory_info); | ||
| 135 | } | ||
| 136 | |||
| 124 | if (device.HasDebuggingToolAttached()) { | 137 | if (device.HasDebuggingToolAttached()) { |
| 125 | stream_memory.SetObjectNameEXT("Stream Buffer Memory"); | 138 | stream_memory.SetObjectNameEXT("Stream Buffer Memory"); |
| 126 | } | 139 | } |