Compare commits

..

No commits in common. "main" and "1.15.4" have entirely different histories.
main ... 1.15.4

1 changed files with 13 additions and 31 deletions

View File

@ -708,7 +708,6 @@ struct VulkanBuffer
VulkanResourceAccessType resourceAccessType;
VkBufferUsageFlags usage;
uint8_t requireHostVisible;
uint8_t preferDeviceLocal;
SDL_atomic_t referenceCount; /* Tracks command buffer usage */
@ -2933,7 +2932,7 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForImage(
{
memoryTypeIndex = 0;
requiredMemoryPropertyFlags = 0;
ignoredMemoryPropertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
ignoredMemoryPropertyFlags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
if (isRenderTarget)
{
@ -2979,32 +2978,23 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
VulkanRenderer* renderer,
VkBuffer buffer,
VkDeviceSize size,
uint8_t requireHostVisible,
uint8_t preferDeviceLocal,
uint8_t dedicatedAllocation,
VulkanMemoryUsedRegion** usedRegion
) {
uint8_t bindResult = 0;
uint32_t memoryTypeIndex = 0;
VkMemoryPropertyFlags requiredMemoryPropertyFlags = 0;
VkMemoryPropertyFlags ignoredMemoryPropertyFlags = 0;
VkMemoryPropertyFlags requiredMemoryPropertyFlags;
VkMemoryPropertyFlags ignoredMemoryPropertyFlags;
VkMemoryRequirements2KHR memoryRequirements =
{
VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR,
NULL
};
if (requireHostVisible)
{
requiredMemoryPropertyFlags =
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
}
else
{
ignoredMemoryPropertyFlags =
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
}
requiredMemoryPropertyFlags =
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if (preferDeviceLocal)
{
@ -3043,10 +3033,9 @@ static uint8_t VULKAN_INTERNAL_BindMemoryForBuffer(
}
/* Bind failed, try again if originally preferred device local */
if (bindResult != 1)
if (bindResult != 1 && preferDeviceLocal)
{
memoryTypeIndex = 0;
requiredMemoryPropertyFlags =
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
@ -4107,7 +4096,6 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
VkDeviceSize size,
VulkanResourceAccessType resourceAccessType,
VkBufferUsageFlags usage,
uint8_t requireHostVisible,
uint8_t preferDeviceLocal,
uint8_t dedicatedAllocation
) {
@ -4121,7 +4109,6 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
buffer->size = size;
buffer->resourceAccessType = resourceAccessType;
buffer->usage = usage;
buffer->requireHostVisible = requireHostVisible;
buffer->preferDeviceLocal = preferDeviceLocal;
bufferCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
@ -4145,7 +4132,6 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
renderer,
buffer->buffer,
buffer->size,
buffer->requireHostVisible,
buffer->preferDeviceLocal,
dedicatedAllocation,
&buffer->usedRegion
@ -4229,7 +4215,6 @@ static VulkanUniformBufferPool* VULKAN_INTERNAL_CreateUniformBufferPool(
UBO_BUFFER_SIZE,
resourceAccessType,
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
1,
0,
1
);
@ -4275,7 +4260,8 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
VulkanRenderer *renderer,
uint32_t sizeInBytes,
VulkanResourceAccessType resourceAccessType,
VkBufferUsageFlags usageFlags
VkBufferUsageFlags usageFlags,
uint8_t dedicated
) {
VulkanBufferContainer* bufferContainer;
VulkanBuffer* buffer;
@ -4288,9 +4274,8 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
sizeInBytes,
resourceAccessType,
usageFlags,
0,
1,
0
dedicated
);
if (buffer == NULL)
@ -7121,7 +7106,8 @@ static Refresh_Buffer* VULKAN_CreateBuffer(
(VulkanRenderer*) driverData,
sizeInBytes,
resourceAccessType,
vulkanUsageFlags
vulkanUsageFlags,
0
);
}
@ -7203,7 +7189,6 @@ static VulkanTransferBuffer* VULKAN_INTERNAL_AcquireTransferBuffer(
RESOURCE_ACCESS_TRANSFER_READ_WRITE,
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
1,
0,
1
);
transferBuffer->fromPool = 0;
@ -10597,7 +10582,6 @@ static uint8_t VULKAN_INTERNAL_DefragmentMemory(
currentRegion->vulkanBuffer->size,
RESOURCE_ACCESS_NONE,
currentRegion->vulkanBuffer->usage,
currentRegion->vulkanBuffer->requireHostVisible,
currentRegion->vulkanBuffer->preferDeviceLocal,
0
);
@ -12002,11 +11986,10 @@ static Refresh_Device* VULKAN_CreateDevice(
renderer->dummyBuffer = VULKAN_INTERNAL_CreateBuffer(
renderer,
16,
1,
RESOURCE_ACCESS_GENERAL,
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
0,
0,
1
);
@ -12123,7 +12106,6 @@ static Refresh_Device* VULKAN_CreateDevice(
RESOURCE_ACCESS_TRANSFER_READ_WRITE,
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
1,
0,
1
);