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