prefer host-local instead of require host-local
	
		
			
	
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
				
					
				
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
							parent
							
								
									9d36ddaac1
								
							
						
					
					
						commit
						899f961461
					
				| 
						 | 
					@ -731,7 +731,7 @@ struct VulkanBuffer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint8_t requireHostVisible;
 | 
						uint8_t requireHostVisible;
 | 
				
			||||||
	uint8_t preferDeviceLocal;
 | 
						uint8_t preferDeviceLocal;
 | 
				
			||||||
	uint8_t requireHostLocal;
 | 
						uint8_t preferHostLocal;
 | 
				
			||||||
	uint8_t preserveContentsOnDefrag;
 | 
						uint8_t preserveContentsOnDefrag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SDL_atomic_t referenceCount; /* Tracks command buffer usage */
 | 
						SDL_atomic_t referenceCount; /* Tracks command buffer usage */
 | 
				
			||||||
| 
						 | 
					@ -1716,7 +1716,8 @@ typedef struct VulkanRenderer
 | 
				
			||||||
	VkPhysicalDeviceProperties2 physicalDeviceProperties;
 | 
						VkPhysicalDeviceProperties2 physicalDeviceProperties;
 | 
				
			||||||
	VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties;
 | 
						VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties;
 | 
				
			||||||
	VkDevice logicalDevice;
 | 
						VkDevice logicalDevice;
 | 
				
			||||||
	uint8_t unifiedMemoryWarning;
 | 
						uint8_t integratedMemoryNotification;
 | 
				
			||||||
 | 
						uint8_t outOfDeviceLocalMemoryWarning;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint8_t supportsDebugUtils;
 | 
						uint8_t supportsDebugUtils;
 | 
				
			||||||
	uint8_t debugMode;
 | 
						uint8_t debugMode;
 | 
				
			||||||
| 
						 | 
					@ -2921,7 +2922,7 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForImage(
 | 
				
			||||||
			Refresh_LogWarn("RenderTarget is allocated in host memory, pre-allocate your targets!");
 | 
								Refresh_LogWarn("RenderTarget is allocated in host memory, pre-allocate your targets!");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Refresh_LogWarn("Out of device local memory, falling back to host memory");
 | 
							Refresh_LogWarn("Out of device-local memory, allocating textures on host-local memory!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while (VULKAN_INTERNAL_FindImageMemoryRequirements(
 | 
							while (VULKAN_INTERNAL_FindImageMemoryRequirements(
 | 
				
			||||||
			renderer,
 | 
								renderer,
 | 
				
			||||||
| 
						 | 
					@ -2960,7 +2961,7 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
 | 
				
			||||||
	VkBuffer buffer,
 | 
						VkBuffer buffer,
 | 
				
			||||||
	VkDeviceSize size,
 | 
						VkDeviceSize size,
 | 
				
			||||||
	uint8_t requireHostVisible,
 | 
						uint8_t requireHostVisible,
 | 
				
			||||||
	uint8_t requireHostLocal,
 | 
						uint8_t preferHostLocal,
 | 
				
			||||||
	uint8_t preferDeviceLocal,
 | 
						uint8_t preferDeviceLocal,
 | 
				
			||||||
	uint8_t dedicatedAllocation,
 | 
						uint8_t dedicatedAllocation,
 | 
				
			||||||
	VulkanMemoryUsedRegion** usedRegion
 | 
						VulkanMemoryUsedRegion** usedRegion
 | 
				
			||||||
| 
						 | 
					@ -2982,7 +2983,7 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
 | 
				
			||||||
			VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
 | 
								VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (requireHostLocal)
 | 
						if (preferHostLocal)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ignoredMemoryPropertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
 | 
							ignoredMemoryPropertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -3021,11 +3022,12 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Bind failed, try again with fallback flags */
 | 
						/* Bind failed, try again without preferred flags */
 | 
				
			||||||
	if (bindResult != 1)
 | 
						if (bindResult != 1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		memoryTypeIndex = 0;
 | 
							memoryTypeIndex = 0;
 | 
				
			||||||
		requiredMemoryPropertyFlags = 0;
 | 
							requiredMemoryPropertyFlags = 0;
 | 
				
			||||||
 | 
							ignoredMemoryPropertyFlags = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (requireHostVisible)
 | 
							if (requireHostVisible)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -3034,16 +3036,16 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
 | 
				
			||||||
				VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
 | 
									VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (requireHostLocal)
 | 
							if (preferHostLocal && !renderer->integratedMemoryNotification)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			ignoredMemoryPropertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
 | 
								Refresh_LogInfo("Integrated memory detected, allocating TransferBuffers on device-local memory!");
 | 
				
			||||||
 | 
								renderer->integratedMemoryNotification = 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Follow-up for the warning logged by FindMemoryType */
 | 
							if (preferDeviceLocal && !renderer->outOfDeviceLocalMemoryWarning)
 | 
				
			||||||
		if (!renderer->unifiedMemoryWarning)
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Refresh_LogWarn("No unified memory found, falling back to host memory");
 | 
								Refresh_LogWarn("Out of device-local memory, allocating GpuBuffers on host-local memory, expect degraded performance!");
 | 
				
			||||||
			renderer->unifiedMemoryWarning = 1;
 | 
								renderer->outOfDeviceLocalMemoryWarning = 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while (VULKAN_INTERNAL_FindBufferMemoryRequirements(
 | 
							while (VULKAN_INTERNAL_FindBufferMemoryRequirements(
 | 
				
			||||||
| 
						 | 
					@ -4174,7 +4176,7 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
 | 
				
			||||||
	VulkanResourceAccessType resourceAccessType,
 | 
						VulkanResourceAccessType resourceAccessType,
 | 
				
			||||||
	VkBufferUsageFlags usage,
 | 
						VkBufferUsageFlags usage,
 | 
				
			||||||
	uint8_t requireHostVisible,
 | 
						uint8_t requireHostVisible,
 | 
				
			||||||
	uint8_t requireHostLocal,
 | 
						uint8_t preferHostLocal,
 | 
				
			||||||
	uint8_t preferDeviceLocal,
 | 
						uint8_t preferDeviceLocal,
 | 
				
			||||||
	uint8_t dedicatedAllocation,
 | 
						uint8_t dedicatedAllocation,
 | 
				
			||||||
	uint8_t preserveContentsOnDefrag
 | 
						uint8_t preserveContentsOnDefrag
 | 
				
			||||||
| 
						 | 
					@ -4190,7 +4192,7 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
 | 
				
			||||||
	buffer->resourceAccessType = resourceAccessType;
 | 
						buffer->resourceAccessType = resourceAccessType;
 | 
				
			||||||
	buffer->usage = usage;
 | 
						buffer->usage = usage;
 | 
				
			||||||
	buffer->requireHostVisible = requireHostVisible;
 | 
						buffer->requireHostVisible = requireHostVisible;
 | 
				
			||||||
	buffer->requireHostLocal = requireHostLocal;
 | 
						buffer->preferHostLocal = preferHostLocal;
 | 
				
			||||||
	buffer->preferDeviceLocal = preferDeviceLocal;
 | 
						buffer->preferDeviceLocal = preferDeviceLocal;
 | 
				
			||||||
	buffer->preserveContentsOnDefrag = preserveContentsOnDefrag;
 | 
						buffer->preserveContentsOnDefrag = preserveContentsOnDefrag;
 | 
				
			||||||
	buffer->markedForDestroy = 0;
 | 
						buffer->markedForDestroy = 0;
 | 
				
			||||||
| 
						 | 
					@ -4217,7 +4219,7 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
 | 
				
			||||||
		buffer->buffer,
 | 
							buffer->buffer,
 | 
				
			||||||
		buffer->size,
 | 
							buffer->size,
 | 
				
			||||||
		buffer->requireHostVisible,
 | 
							buffer->requireHostVisible,
 | 
				
			||||||
		buffer->requireHostLocal,
 | 
							buffer->preferHostLocal,
 | 
				
			||||||
		buffer->preferDeviceLocal,
 | 
							buffer->preferDeviceLocal,
 | 
				
			||||||
		dedicatedAllocation,
 | 
							dedicatedAllocation,
 | 
				
			||||||
		&buffer->usedRegion
 | 
							&buffer->usedRegion
 | 
				
			||||||
| 
						 | 
					@ -4337,7 +4339,7 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
 | 
				
			||||||
	VulkanResourceAccessType resourceAccessType,
 | 
						VulkanResourceAccessType resourceAccessType,
 | 
				
			||||||
	VkBufferUsageFlags usageFlags,
 | 
						VkBufferUsageFlags usageFlags,
 | 
				
			||||||
	uint8_t requireHostVisible,
 | 
						uint8_t requireHostVisible,
 | 
				
			||||||
	uint8_t requireHostLocal,
 | 
						uint8_t preferHostLocal,
 | 
				
			||||||
	uint8_t preferDeviceLocal,
 | 
						uint8_t preferDeviceLocal,
 | 
				
			||||||
	uint8_t dedicatedAllocation,
 | 
						uint8_t dedicatedAllocation,
 | 
				
			||||||
	uint8_t preserveContentsOnDefrag
 | 
						uint8_t preserveContentsOnDefrag
 | 
				
			||||||
| 
						 | 
					@ -4354,7 +4356,7 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
 | 
				
			||||||
		resourceAccessType,
 | 
							resourceAccessType,
 | 
				
			||||||
		usageFlags,
 | 
							usageFlags,
 | 
				
			||||||
		requireHostVisible,
 | 
							requireHostVisible,
 | 
				
			||||||
		requireHostLocal,
 | 
							preferHostLocal,
 | 
				
			||||||
		preferDeviceLocal,
 | 
							preferDeviceLocal,
 | 
				
			||||||
		dedicatedAllocation,
 | 
							dedicatedAllocation,
 | 
				
			||||||
		preserveContentsOnDefrag
 | 
							preserveContentsOnDefrag
 | 
				
			||||||
| 
						 | 
					@ -10278,7 +10280,7 @@ static uint8_t VULKAN_INTERNAL_DefragmentMemory(
 | 
				
			||||||
					RESOURCE_ACCESS_NONE,
 | 
										RESOURCE_ACCESS_NONE,
 | 
				
			||||||
					currentRegion->vulkanBuffer->usage,
 | 
										currentRegion->vulkanBuffer->usage,
 | 
				
			||||||
					currentRegion->vulkanBuffer->requireHostVisible,
 | 
										currentRegion->vulkanBuffer->requireHostVisible,
 | 
				
			||||||
					currentRegion->vulkanBuffer->requireHostLocal,
 | 
										currentRegion->vulkanBuffer->preferHostLocal,
 | 
				
			||||||
					currentRegion->vulkanBuffer->preferDeviceLocal,
 | 
										currentRegion->vulkanBuffer->preferDeviceLocal,
 | 
				
			||||||
					0,
 | 
										0,
 | 
				
			||||||
					currentRegion->vulkanBuffer->preserveContentsOnDefrag
 | 
										currentRegion->vulkanBuffer->preserveContentsOnDefrag
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue