rename CpuBuffer to TransferBuffer
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
e5cd3c6fce
commit
6f2e4ed6d1
|
@ -703,10 +703,10 @@ typedef struct VulkanBufferContainer
|
||||||
VulkanBuffer *vulkanBuffer;
|
VulkanBuffer *vulkanBuffer;
|
||||||
} VulkanBufferContainer;
|
} VulkanBufferContainer;
|
||||||
|
|
||||||
/* CpuBuffers consist of multiple backing buffer containers so that data transfers
|
/* TransferBuffers consist of multiple backing buffer containers so that data transfers
|
||||||
* can occur safely without the client having to explicitly manage transfer timing.
|
* can occur safely without the client having to explicitly manage transfer timing.
|
||||||
*/
|
*/
|
||||||
typedef struct VulkanCpuBufferContainer /* cast from Refresh_CpuBuffer */
|
typedef struct VulkanTransferBufferContainer /* cast from Refresh_TransferBuffer */
|
||||||
{
|
{
|
||||||
uint32_t sizeInBytes;
|
uint32_t sizeInBytes;
|
||||||
VulkanBufferContainer *activeBuffer;
|
VulkanBufferContainer *activeBuffer;
|
||||||
|
@ -719,7 +719,7 @@ typedef struct VulkanCpuBufferContainer /* cast from Refresh_CpuBuffer */
|
||||||
uint32_t bufferCapacity;
|
uint32_t bufferCapacity;
|
||||||
uint32_t bufferCount;
|
uint32_t bufferCount;
|
||||||
VulkanBufferContainer **backingBuffers;
|
VulkanBufferContainer **backingBuffers;
|
||||||
} VulkanCpuBufferContainer;
|
} VulkanTransferBufferContainer;
|
||||||
|
|
||||||
struct VulkanBuffer
|
struct VulkanBuffer
|
||||||
{
|
{
|
||||||
|
@ -5359,14 +5359,14 @@ static void VULKAN_DrawPrimitives(
|
||||||
static void VULKAN_DrawPrimitivesIndirect(
|
static void VULKAN_DrawPrimitivesIndirect(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_GpuBuffer *buffer,
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
uint32_t offsetInBytes,
|
uint32_t offsetInBytes,
|
||||||
uint32_t drawCount,
|
uint32_t drawCount,
|
||||||
uint32_t stride
|
uint32_t stride
|
||||||
) {
|
) {
|
||||||
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) buffer)->vulkanBuffer;
|
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||||
VkDescriptorSet descriptorSets[4];
|
VkDescriptorSet descriptorSets[4];
|
||||||
uint32_t dynamicOffsets[2];
|
uint32_t dynamicOffsets[2];
|
||||||
|
|
||||||
|
@ -6837,17 +6837,17 @@ static Refresh_GpuBuffer* VULKAN_CreateGpuBuffer(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Refresh_CpuBuffer* VULKAN_CreateCpuBuffer(
|
static Refresh_TransferBuffer* VULKAN_CreateTransferBuffer(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
uint32_t sizeInBytes
|
uint32_t sizeInBytes
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VkBufferUsageFlags vulkanUsageFlags =
|
VkBufferUsageFlags vulkanUsageFlags =
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||||
VulkanCpuBufferContainer *bufferContainer = (VulkanCpuBufferContainer*) SDL_malloc(sizeof(VulkanCpuBufferContainer));
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) SDL_malloc(sizeof(VulkanTransferBufferContainer));
|
||||||
|
|
||||||
bufferContainer->sizeInBytes = sizeInBytes;
|
transferBufferContainer->sizeInBytes = sizeInBytes;
|
||||||
bufferContainer->activeBuffer = VULKAN_INTERNAL_CreateBufferContainer(
|
transferBufferContainer->activeBuffer = VULKAN_INTERNAL_CreateBufferContainer(
|
||||||
renderer,
|
renderer,
|
||||||
sizeInBytes,
|
sizeInBytes,
|
||||||
RESOURCE_ACCESS_NONE,
|
RESOURCE_ACCESS_NONE,
|
||||||
|
@ -6859,14 +6859,14 @@ static Refresh_CpuBuffer* VULKAN_CreateCpuBuffer(
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
bufferContainer->bufferCapacity = 1;
|
transferBufferContainer->bufferCapacity = 1;
|
||||||
bufferContainer->bufferCount = 1;
|
transferBufferContainer->bufferCount = 1;
|
||||||
bufferContainer->backingBuffers = SDL_malloc(
|
transferBufferContainer->backingBuffers = SDL_malloc(
|
||||||
bufferContainer->bufferCapacity * sizeof(VulkanBufferContainer*)
|
transferBufferContainer->bufferCapacity * sizeof(VulkanBufferContainer*)
|
||||||
);
|
);
|
||||||
bufferContainer->backingBuffers[0] = bufferContainer->activeBuffer;
|
transferBufferContainer->backingBuffers[0] = transferBufferContainer->activeBuffer;
|
||||||
|
|
||||||
return (Refresh_CpuBuffer*) bufferContainer;
|
return (Refresh_TransferBuffer*) transferBufferContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setters */
|
/* Setters */
|
||||||
|
@ -7288,10 +7288,10 @@ static void VULKAN_INTERNAL_QueueDestroyBuffer(
|
||||||
|
|
||||||
static void VULKAN_QueueDestroyGpuBuffer(
|
static void VULKAN_QueueDestroyGpuBuffer(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_GpuBuffer *buffer
|
Refresh_GpuBuffer *gpuBuffer
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanBufferContainer *vulkanBufferContainer = (VulkanBufferContainer*) buffer;
|
VulkanBufferContainer *vulkanBufferContainer = (VulkanBufferContainer*) gpuBuffer;
|
||||||
VulkanBuffer *vulkanBuffer = vulkanBufferContainer->vulkanBuffer;
|
VulkanBuffer *vulkanBuffer = vulkanBufferContainer->vulkanBuffer;
|
||||||
|
|
||||||
SDL_LockMutex(renderer->disposeLock);
|
SDL_LockMutex(renderer->disposeLock);
|
||||||
|
@ -7304,25 +7304,25 @@ static void VULKAN_QueueDestroyGpuBuffer(
|
||||||
SDL_UnlockMutex(renderer->disposeLock);
|
SDL_UnlockMutex(renderer->disposeLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_QueueDestroyCpuBuffer(
|
static void VULKAN_QueueDestroyTransferBuffer(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CpuBuffer *buffer
|
Refresh_TransferBuffer *transferBuffer
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCpuBufferContainer *bufferContainer = (VulkanCpuBufferContainer*) buffer;
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
SDL_LockMutex(renderer->disposeLock);
|
SDL_LockMutex(renderer->disposeLock);
|
||||||
|
|
||||||
for (i = 0; i < bufferContainer->bufferCount; i += 1)
|
for (i = 0; i < transferBufferContainer->bufferCount; i += 1)
|
||||||
{
|
{
|
||||||
VULKAN_INTERNAL_QueueDestroyBuffer(renderer, bufferContainer->backingBuffers[i]->vulkanBuffer);
|
VULKAN_INTERNAL_QueueDestroyBuffer(renderer, transferBufferContainer->backingBuffers[i]->vulkanBuffer);
|
||||||
SDL_free(bufferContainer->backingBuffers[i]);
|
SDL_free(transferBufferContainer->backingBuffers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Containers are just client handles, so we can free immediately */
|
/* Containers are just client handles, so we can free immediately */
|
||||||
SDL_free(bufferContainer->backingBuffers);
|
SDL_free(transferBufferContainer->backingBuffers);
|
||||||
SDL_free(bufferContainer);
|
SDL_free(transferBufferContainer);
|
||||||
|
|
||||||
SDL_UnlockMutex(renderer->disposeLock);
|
SDL_UnlockMutex(renderer->disposeLock);
|
||||||
}
|
}
|
||||||
|
@ -8124,13 +8124,13 @@ static void VULKAN_BindVertexBuffers(
|
||||||
static void VULKAN_BindIndexBuffer(
|
static void VULKAN_BindIndexBuffer(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_GpuBuffer *buffer,
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
uint64_t offset,
|
uint64_t offset,
|
||||||
Refresh_IndexElementSize indexElementSize
|
Refresh_IndexElementSize indexElementSize
|
||||||
) {
|
) {
|
||||||
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanBuffer* vulkanBuffer = ((VulkanBufferContainer*) buffer)->vulkanBuffer;
|
VulkanBuffer* vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanBuffer);
|
||||||
|
|
||||||
|
@ -8387,30 +8387,30 @@ static void VULKAN_EndComputePass(
|
||||||
vulkanCommandBuffer->currentComputePipeline = NULL;
|
vulkanCommandBuffer->currentComputePipeline = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_INTERNAL_DiscardActiveCpuBuffer(
|
static void VULKAN_INTERNAL_DiscardActiveTransferBuffer(
|
||||||
VulkanRenderer *renderer,
|
VulkanRenderer *renderer,
|
||||||
VulkanCpuBufferContainer *cpuBufferContainer
|
VulkanTransferBufferContainer *transferBufferContainer
|
||||||
) {
|
) {
|
||||||
VulkanBufferContainer *cpuBuffer;
|
VulkanBufferContainer *transferBuffer;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->preserveContentsOnDefrag = 0;
|
transferBufferContainer->activeBuffer->vulkanBuffer->preserveContentsOnDefrag = 0;
|
||||||
|
|
||||||
/* If a previously-discarded buffer is available, we can use that. */
|
/* If a previously-discarded buffer is available, we can use that. */
|
||||||
for (i = 0; i < cpuBufferContainer->bufferCount; i += 1)
|
for (i = 0; i < transferBufferContainer->bufferCount; i += 1)
|
||||||
{
|
{
|
||||||
cpuBuffer = cpuBufferContainer->backingBuffers[i];
|
transferBuffer = transferBufferContainer->backingBuffers[i];
|
||||||
if (SDL_AtomicGet(&cpuBuffer->vulkanBuffer->referenceCount) == 0)
|
if (SDL_AtomicGet(&transferBuffer->vulkanBuffer->referenceCount) == 0)
|
||||||
{
|
{
|
||||||
cpuBufferContainer->activeBuffer = cpuBuffer;
|
transferBufferContainer->activeBuffer = transferBuffer;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No buffer is available, generate a new one. */
|
/* No buffer is available, generate a new one. */
|
||||||
cpuBufferContainer->activeBuffer = VULKAN_INTERNAL_CreateBufferContainer(
|
transferBufferContainer->activeBuffer = VULKAN_INTERNAL_CreateBufferContainer(
|
||||||
renderer,
|
renderer,
|
||||||
cpuBufferContainer->sizeInBytes,
|
transferBufferContainer->sizeInBytes,
|
||||||
RESOURCE_ACCESS_NONE,
|
RESOURCE_ACCESS_NONE,
|
||||||
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,
|
||||||
|
@ -8421,40 +8421,40 @@ static void VULKAN_INTERNAL_DiscardActiveCpuBuffer(
|
||||||
);
|
);
|
||||||
|
|
||||||
EXPAND_ARRAY_IF_NEEDED(
|
EXPAND_ARRAY_IF_NEEDED(
|
||||||
cpuBufferContainer->backingBuffers,
|
transferBufferContainer->backingBuffers,
|
||||||
VulkanBufferContainer*,
|
VulkanBufferContainer*,
|
||||||
cpuBufferContainer->bufferCount + 1,
|
transferBufferContainer->bufferCount + 1,
|
||||||
cpuBufferContainer->bufferCapacity,
|
transferBufferContainer->bufferCapacity,
|
||||||
cpuBufferContainer->bufferCapacity * 2
|
transferBufferContainer->bufferCapacity * 2
|
||||||
);
|
);
|
||||||
|
|
||||||
cpuBufferContainer->backingBuffers[
|
transferBufferContainer->backingBuffers[
|
||||||
cpuBufferContainer->bufferCount
|
transferBufferContainer->bufferCount
|
||||||
] = cpuBufferContainer->activeBuffer;
|
] = transferBufferContainer->activeBuffer;
|
||||||
cpuBufferContainer->bufferCount += 1;
|
transferBufferContainer->bufferCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_SetData(
|
static void VULKAN_SetData(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
void* data,
|
void* data,
|
||||||
Refresh_CpuBuffer *cpuBuffer,
|
Refresh_TransferBuffer *transferBuffer,
|
||||||
Refresh_BufferCopy *copyParams,
|
Refresh_BufferCopy *copyParams,
|
||||||
Refresh_SetDataOptions option
|
Refresh_SetDataOptions option
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCpuBufferContainer *cpuBufferContainer = (VulkanCpuBufferContainer*) cpuBuffer;
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||||
|
|
||||||
if (option == REFRESH_SETDATAOPTIONS_SAFEDISCARD && SDL_AtomicGet(&cpuBufferContainer->activeBuffer->vulkanBuffer->referenceCount) > 0)
|
if (option == REFRESH_SETDATAOPTIONS_SAFEDISCARD && SDL_AtomicGet(&transferBufferContainer->activeBuffer->vulkanBuffer->referenceCount) > 0)
|
||||||
{
|
{
|
||||||
VULKAN_INTERNAL_DiscardActiveCpuBuffer(
|
VULKAN_INTERNAL_DiscardActiveTransferBuffer(
|
||||||
renderer,
|
renderer,
|
||||||
cpuBufferContainer
|
transferBufferContainer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *bufferPointer =
|
uint8_t *bufferPointer =
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->usedRegion->allocation->mapPointer +
|
transferBufferContainer->activeBuffer->vulkanBuffer->usedRegion->allocation->mapPointer +
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->usedRegion->resourceOffset +
|
transferBufferContainer->activeBuffer->vulkanBuffer->usedRegion->resourceOffset +
|
||||||
copyParams->dstOffset;
|
copyParams->dstOffset;
|
||||||
|
|
||||||
SDL_memcpy(
|
SDL_memcpy(
|
||||||
|
@ -8466,13 +8466,13 @@ static void VULKAN_SetData(
|
||||||
|
|
||||||
static void VULKAN_GetData(
|
static void VULKAN_GetData(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CpuBuffer *cpuBuffer,
|
Refresh_TransferBuffer *transferBuffer,
|
||||||
void* data,
|
void* data,
|
||||||
Refresh_BufferCopy *copyParams
|
Refresh_BufferCopy *copyParams
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCpuBufferContainer *cpuBufferContainer = (VulkanCpuBufferContainer*) cpuBuffer;
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||||
VulkanBuffer *vulkanBuffer = cpuBufferContainer->activeBuffer->vulkanBuffer;
|
VulkanBuffer *vulkanBuffer = transferBufferContainer->activeBuffer->vulkanBuffer;
|
||||||
|
|
||||||
uint8_t *bufferPointer =
|
uint8_t *bufferPointer =
|
||||||
vulkanBuffer->usedRegion->allocation->mapPointer +
|
vulkanBuffer->usedRegion->allocation->mapPointer +
|
||||||
|
@ -8502,13 +8502,13 @@ static void VULKAN_BeginCopyPass(
|
||||||
static void VULKAN_UploadToTexture(
|
static void VULKAN_UploadToTexture(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_CpuBuffer *cpuBuffer,
|
Refresh_TransferBuffer *transferBuffer,
|
||||||
Refresh_TextureSlice *textureSlice,
|
Refresh_TextureSlice *textureSlice,
|
||||||
Refresh_BufferImageCopy *copyParams
|
Refresh_BufferImageCopy *copyParams
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanCpuBufferContainer *bufferContainer = (VulkanCpuBufferContainer*) cpuBuffer;
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||||
VkBufferImageCopy imageCopy;
|
VkBufferImageCopy imageCopy;
|
||||||
|
|
||||||
|
@ -8516,7 +8516,7 @@ static void VULKAN_UploadToTexture(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
RESOURCE_ACCESS_TRANSFER_READ,
|
RESOURCE_ACCESS_TRANSFER_READ,
|
||||||
bufferContainer->activeBuffer->vulkanBuffer
|
transferBufferContainer->activeBuffer->vulkanBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
|
@ -8549,14 +8549,14 @@ static void VULKAN_UploadToTexture(
|
||||||
|
|
||||||
renderer->vkCmdCopyBufferToImage(
|
renderer->vkCmdCopyBufferToImage(
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
bufferContainer->activeBuffer->vulkanBuffer->buffer,
|
transferBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
||||||
vulkanTexture->image,
|
vulkanTexture->image,
|
||||||
AccessMap[vulkanTexture->resourceAccessType].imageLayout,
|
AccessMap[vulkanTexture->resourceAccessType].imageLayout,
|
||||||
1,
|
1,
|
||||||
&imageCopy
|
&imageCopy
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, bufferContainer->activeBuffer->vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBuffer->vulkanBuffer);
|
||||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
||||||
VULKAN_INTERNAL_TrackCopiedTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
VULKAN_INTERNAL_TrackCopiedTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
||||||
}
|
}
|
||||||
|
@ -8564,13 +8564,13 @@ static void VULKAN_UploadToTexture(
|
||||||
static void VULKAN_UploadToBuffer(
|
static void VULKAN_UploadToBuffer(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_CpuBuffer *cpuBuffer,
|
Refresh_TransferBuffer *transferBuffer,
|
||||||
Refresh_GpuBuffer *gpuBuffer,
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
Refresh_BufferCopy *copyParams
|
Refresh_BufferCopy *copyParams
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanCpuBufferContainer *cpuBufferContainer = (VulkanCpuBufferContainer*) cpuBuffer;
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||||
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||||
VkBufferCopy bufferCopy;
|
VkBufferCopy bufferCopy;
|
||||||
|
|
||||||
|
@ -8578,7 +8578,7 @@ static void VULKAN_UploadToBuffer(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
RESOURCE_ACCESS_TRANSFER_READ,
|
RESOURCE_ACCESS_TRANSFER_READ,
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer
|
transferBufferContainer->activeBuffer->vulkanBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
|
@ -8594,13 +8594,13 @@ static void VULKAN_UploadToBuffer(
|
||||||
|
|
||||||
renderer->vkCmdCopyBuffer(
|
renderer->vkCmdCopyBuffer(
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
transferBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
||||||
vulkanGpuBuffer->buffer,
|
vulkanGpuBuffer->buffer,
|
||||||
1,
|
1,
|
||||||
&bufferCopy
|
&bufferCopy
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, cpuBufferContainer->activeBuffer->vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBuffer->vulkanBuffer);
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
||||||
VULKAN_INTERNAL_TrackCopiedBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
VULKAN_INTERNAL_TrackCopiedBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
||||||
}
|
}
|
||||||
|
@ -8609,20 +8609,20 @@ static void VULKAN_DownloadFromTexture(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_TextureSlice *textureSlice,
|
Refresh_TextureSlice *textureSlice,
|
||||||
Refresh_CpuBuffer *cpuBuffer,
|
Refresh_TransferBuffer *transferBuffer,
|
||||||
Refresh_BufferImageCopy *copyParams
|
Refresh_BufferImageCopy *copyParams
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||||
VulkanCpuBufferContainer *cpuBufferContainer = (VulkanCpuBufferContainer*) cpuBuffer;
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||||
VkBufferImageCopy imageCopy;
|
VkBufferImageCopy imageCopy;
|
||||||
|
|
||||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
RESOURCE_ACCESS_TRANSFER_WRITE,
|
RESOURCE_ACCESS_TRANSFER_WRITE,
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer
|
transferBufferContainer->activeBuffer->vulkanBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
|
@ -8657,28 +8657,28 @@ static void VULKAN_DownloadFromTexture(
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
vulkanTexture->image,
|
vulkanTexture->image,
|
||||||
AccessMap[vulkanTexture->resourceAccessType].imageLayout,
|
AccessMap[vulkanTexture->resourceAccessType].imageLayout,
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
transferBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
||||||
1,
|
1,
|
||||||
&imageCopy
|
&imageCopy
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, cpuBufferContainer->activeBuffer->vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBuffer->vulkanBuffer);
|
||||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
||||||
VULKAN_INTERNAL_TrackCopiedTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
VULKAN_INTERNAL_TrackCopiedTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
||||||
|
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->preserveContentsOnDefrag = 1;
|
transferBufferContainer->activeBuffer->vulkanBuffer->preserveContentsOnDefrag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_DownloadFromBuffer(
|
static void VULKAN_DownloadFromBuffer(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_GpuBuffer *gpuBuffer,
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
Refresh_CpuBuffer *cpuBuffer,
|
Refresh_TransferBuffer *transferBuffer,
|
||||||
Refresh_BufferCopy *copyParams
|
Refresh_BufferCopy *copyParams
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanCpuBufferContainer *cpuBufferContainer = (VulkanCpuBufferContainer*) cpuBuffer;
|
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||||
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||||
VkBufferCopy bufferCopy;
|
VkBufferCopy bufferCopy;
|
||||||
|
|
||||||
|
@ -8686,7 +8686,7 @@ static void VULKAN_DownloadFromBuffer(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
RESOURCE_ACCESS_TRANSFER_WRITE,
|
RESOURCE_ACCESS_TRANSFER_WRITE,
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer
|
transferBufferContainer->activeBuffer->vulkanBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
|
@ -8703,16 +8703,16 @@ static void VULKAN_DownloadFromBuffer(
|
||||||
renderer->vkCmdCopyBuffer(
|
renderer->vkCmdCopyBuffer(
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
vulkanGpuBuffer->buffer,
|
vulkanGpuBuffer->buffer,
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
transferBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
||||||
1,
|
1,
|
||||||
&bufferCopy
|
&bufferCopy
|
||||||
);
|
);
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, cpuBufferContainer->activeBuffer->vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBuffer->vulkanBuffer);
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
||||||
|
|
||||||
cpuBufferContainer->activeBuffer->vulkanBuffer->preserveContentsOnDefrag = 1;
|
transferBufferContainer->activeBuffer->vulkanBuffer->preserveContentsOnDefrag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_CopyTextureToTexture(
|
static void VULKAN_CopyTextureToTexture(
|
||||||
|
@ -8793,13 +8793,13 @@ static void VULKAN_CopyTextureToBuffer(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_TextureSlice *textureSlice,
|
Refresh_TextureSlice *textureSlice,
|
||||||
Refresh_GpuBuffer *buffer,
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
Refresh_BufferImageCopy *copyParams
|
Refresh_BufferImageCopy *copyParams
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) buffer)->vulkanBuffer;
|
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||||
VkBufferImageCopy imageCopy;
|
VkBufferImageCopy imageCopy;
|
||||||
|
|
||||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
|
@ -8855,13 +8855,13 @@ static void VULKAN_CopyTextureToBuffer(
|
||||||
static void VULKAN_CopyBufferToTexture(
|
static void VULKAN_CopyBufferToTexture(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_GpuBuffer *buffer,
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
Refresh_TextureSlice *textureSlice,
|
Refresh_TextureSlice *textureSlice,
|
||||||
Refresh_BufferImageCopy *copyParams
|
Refresh_BufferImageCopy *copyParams
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) buffer)->vulkanBuffer;
|
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||||
VkBufferImageCopy imageCopy;
|
VkBufferImageCopy imageCopy;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue