starting on resource rotation
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
695abd4139
commit
5b416ffe82
|
@ -327,11 +327,17 @@ typedef enum Refresh_BorderColor
|
|||
REFRESH_BORDERCOLOR_INT_OPAQUE_WHITE
|
||||
} Refresh_BorderColor;
|
||||
|
||||
typedef enum Refresh_SetDataOptions
|
||||
typedef enum Refresh_TransferOptions
|
||||
{
|
||||
REFRESH_SETDATAOPTIONS_SAFEDISCARD,
|
||||
REFRESH_SETDATAOPTIONS_OVERWRITE
|
||||
} Refresh_SetDataOptions;
|
||||
REFRESH_TRANSFEROPTIONS_SAFEDISCARD,
|
||||
REFRESH_TRANSFEROPTIONS_OVERWRITE
|
||||
} Refresh_TransferOptions;
|
||||
|
||||
typedef enum Refresh_CopyOptions
|
||||
{
|
||||
REFRESH_COPYOPTIONS_SAFEDISCARD,
|
||||
REFRESH_COPYOPTIONS_SAFEOVERWRITE
|
||||
} Refresh_CopyOptions;
|
||||
|
||||
typedef enum Refresh_Backend
|
||||
{
|
||||
|
@ -1064,16 +1070,16 @@ REFRESHAPI void Refresh_EndComputePass(
|
|||
* Overwrites the data regardless of whether a copy has been issued.
|
||||
* Use this option with great care, as it can cause data races to occur!
|
||||
*/
|
||||
REFRESHAPI void Refresh_SetData(
|
||||
REFRESHAPI void Refresh_SetTransferData(
|
||||
Refresh_Device *device,
|
||||
void* data,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_SetDataOptions option
|
||||
Refresh_TransferOptions option
|
||||
);
|
||||
|
||||
/* Immediately copies data from a TransferBuffer into a pointer. */
|
||||
REFRESHAPI void Refresh_GetData(
|
||||
REFRESHAPI void Refresh_GetTransferData(
|
||||
Refresh_Device *device,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
void* data,
|
||||
|
@ -1093,13 +1099,27 @@ REFRESHAPI void Refresh_BeginCopyPass(
|
|||
* You MAY assume that the copy has finished for subsequent commands.
|
||||
*/
|
||||
|
||||
/*
|
||||
* option:
|
||||
* SAFEDISCARD:
|
||||
* If this TransferBuffer has been used in a copy command that has not completed,
|
||||
* the issued copy commands will still be valid at the cost of increased memory usage.
|
||||
* Otherwise the data will overwrite.
|
||||
* It is not recommended to use this option with large resources.
|
||||
*
|
||||
* OVERWRITE:
|
||||
* Overwrites the data regardless of whether a copy has been issued.
|
||||
* Use this option with great care, as it can cause data races to occur!
|
||||
*/
|
||||
|
||||
/* Uploads data from a TransferBuffer to a texture. */
|
||||
REFRESHAPI void Refresh_UploadToTexture(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
/* Uploads data from a TransferBuffer to a GpuBuffer. */
|
||||
|
@ -1108,7 +1128,8 @@ REFRESHAPI void Refresh_UploadToBuffer(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferCopy *copyParams
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
/* GPU-to-CPU copies occur on the GPU timeline.
|
||||
|
@ -1144,7 +1165,8 @@ REFRESHAPI void Refresh_CopyTextureToTexture(
|
|||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *source,
|
||||
Refresh_TextureSlice *destination
|
||||
Refresh_TextureSlice *destination,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
/* Copies image data from a texture slice into a buffer. */
|
||||
|
@ -1153,7 +1175,8 @@ REFRESHAPI void Refresh_CopyTextureToBuffer(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
/* Copies data from a buffer to a texture slice. */
|
||||
|
@ -1162,7 +1185,8 @@ REFRESHAPI void Refresh_CopyBufferToTexture(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
/* Copies data from a buffer to a buffer. */
|
||||
|
@ -1171,7 +1195,8 @@ REFRESHAPI void Refresh_CopyBufferToBuffer(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *source,
|
||||
Refresh_GpuBuffer *destination,
|
||||
Refresh_BufferCopy *copyParams
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
/* Generate mipmaps for the given texture. */
|
||||
|
|
|
@ -732,15 +732,15 @@ void Refresh_EndComputePass(
|
|||
|
||||
/* TransferBuffer Set/Get */
|
||||
|
||||
void Refresh_SetData(
|
||||
void Refresh_SetTransferData(
|
||||
Refresh_Device *device,
|
||||
void* data,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_SetDataOptions option
|
||||
Refresh_TransferOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->SetData(
|
||||
device->SetTransferData(
|
||||
device->driverData,
|
||||
data,
|
||||
transferBuffer,
|
||||
|
@ -749,14 +749,14 @@ void Refresh_SetData(
|
|||
);
|
||||
}
|
||||
|
||||
void Refresh_GetData(
|
||||
void Refresh_GetTransferData(
|
||||
Refresh_Device *device,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
void* data,
|
||||
Refresh_BufferCopy *copyParams
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->GetData(
|
||||
device->GetTransferData(
|
||||
device->driverData,
|
||||
transferBuffer,
|
||||
data,
|
||||
|
@ -782,7 +782,8 @@ void Refresh_UploadToTexture(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->UploadToTexture(
|
||||
|
@ -790,7 +791,8 @@ void Refresh_UploadToTexture(
|
|||
commandBuffer,
|
||||
transferBuffer,
|
||||
textureSlice,
|
||||
copyParams
|
||||
copyParams,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -799,7 +801,8 @@ void Refresh_UploadToBuffer(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferCopy *copyParams
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->UploadToBuffer(
|
||||
|
@ -807,7 +810,8 @@ void Refresh_UploadToBuffer(
|
|||
commandBuffer,
|
||||
transferBuffer,
|
||||
gpuBuffer,
|
||||
copyParams
|
||||
copyParams,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -849,14 +853,16 @@ void Refresh_CopyTextureToTexture(
|
|||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *sourceTextureSlice,
|
||||
Refresh_TextureSlice *destinationTextureSlice
|
||||
Refresh_TextureSlice *destinationTextureSlice,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->CopyTextureToTexture(
|
||||
device->driverData,
|
||||
commandBuffer,
|
||||
sourceTextureSlice,
|
||||
destinationTextureSlice
|
||||
destinationTextureSlice,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -865,7 +871,8 @@ void Refresh_CopyTextureToBuffer(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferImageCopy *copyParameters
|
||||
Refresh_BufferImageCopy *copyParameters,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->CopyTextureToBuffer(
|
||||
|
@ -873,7 +880,8 @@ void Refresh_CopyTextureToBuffer(
|
|||
commandBuffer,
|
||||
textureSlice,
|
||||
gpuBuffer,
|
||||
copyParameters
|
||||
copyParameters,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -882,7 +890,8 @@ void Refresh_CopyBufferToTexture(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->CopyBufferToTexture(
|
||||
|
@ -890,7 +899,8 @@ void Refresh_CopyBufferToTexture(
|
|||
commandBuffer,
|
||||
gpuBuffer,
|
||||
textureSlice,
|
||||
copyParams
|
||||
copyParams,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -899,7 +909,8 @@ void Refresh_CopyBufferToBuffer(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *source,
|
||||
Refresh_GpuBuffer *destination,
|
||||
Refresh_BufferCopy *copyParams
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->CopyBufferToBuffer(
|
||||
|
@ -907,7 +918,8 @@ void Refresh_CopyBufferToBuffer(
|
|||
commandBuffer,
|
||||
source,
|
||||
destination,
|
||||
copyParams
|
||||
copyParams,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -415,15 +415,15 @@ struct Refresh_Device
|
|||
|
||||
/* TransferBuffer Set/Get */
|
||||
|
||||
void (*SetData)(
|
||||
void (*SetTransferData)(
|
||||
Refresh_Renderer *driverData,
|
||||
void* data,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_SetDataOptions option
|
||||
Refresh_TransferOptions option
|
||||
);
|
||||
|
||||
void (*GetData)(
|
||||
void (*GetTransferData)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
void* data,
|
||||
|
@ -442,7 +442,8 @@ struct Refresh_Device
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
void (*UploadToBuffer)(
|
||||
|
@ -450,7 +451,8 @@ struct Refresh_Device
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferCopy *copyParams
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
void (*DownloadFromTexture)(
|
||||
|
@ -473,7 +475,8 @@ struct Refresh_Device
|
|||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *source,
|
||||
Refresh_TextureSlice *destination
|
||||
Refresh_TextureSlice *destination,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
void (*CopyTextureToBuffer)(
|
||||
|
@ -481,7 +484,8 @@ struct Refresh_Device
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
void (*CopyBufferToTexture)(
|
||||
|
@ -489,7 +493,8 @@ struct Refresh_Device
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
void (*CopyBufferToBuffer)(
|
||||
|
@ -497,7 +502,8 @@ struct Refresh_Device
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *source,
|
||||
Refresh_GpuBuffer *destination,
|
||||
Refresh_BufferCopy *copyParams
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
void (*GenerateMipmaps)(
|
||||
|
@ -622,8 +628,8 @@ struct Refresh_Device
|
|||
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
|
||||
ASSIGN_DRIVER_FUNC(EndComputePass, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetData, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetData, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTransferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetTransferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(BeginCopyPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(UploadToTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(UploadToBuffer, name) \
|
||||
|
|
|
@ -695,28 +695,10 @@ static const VulkanResourceAccessInfo AccessMap[RESOURCE_ACCESS_TYPES_COUNT] =
|
|||
/* We use pointer indirection so that defrag can occur without objects
|
||||
* needing to be aware of the backing buffers changing.
|
||||
*/
|
||||
typedef struct VulkanBufferContainer
|
||||
typedef struct VulkanBufferHandle
|
||||
{
|
||||
VulkanBuffer *vulkanBuffer;
|
||||
} VulkanBufferContainer;
|
||||
|
||||
/* TransferBuffers consist of multiple backing buffer containers so that data transfers
|
||||
* can occur safely without the client having to explicitly manage transfer timing.
|
||||
*/
|
||||
typedef struct VulkanTransferBufferContainer /* cast from Refresh_TransferBuffer */
|
||||
{
|
||||
uint32_t sizeInBytes;
|
||||
VulkanBufferContainer *activeBuffer;
|
||||
|
||||
/* These are all the buffers that have been used by this container.
|
||||
* If a buffer is bound and then updated with Discard, a new buffer
|
||||
* will be added to this list.
|
||||
* These can be reused after they are submitted and command processing is complete.
|
||||
*/
|
||||
uint32_t bufferCapacity;
|
||||
uint32_t bufferCount;
|
||||
VulkanBufferContainer **backingBuffers;
|
||||
} VulkanTransferBufferContainer;
|
||||
} VulkanBufferHandle;
|
||||
|
||||
struct VulkanBuffer
|
||||
{
|
||||
|
@ -729,15 +711,34 @@ struct VulkanBuffer
|
|||
uint8_t requireHostVisible;
|
||||
uint8_t preferDeviceLocal;
|
||||
uint8_t preferHostLocal;
|
||||
uint8_t preserveContentsOnDefrag;
|
||||
|
||||
SDL_atomic_t referenceCount; /* Tracks command buffer usage */
|
||||
|
||||
VulkanBufferContainer *container;
|
||||
VulkanBufferHandle *handle;
|
||||
|
||||
uint8_t markedForDestroy; /* so that defrag doesn't double-free */
|
||||
};
|
||||
|
||||
/* Buffer resources consist of multiple backing buffer handles so that data transfers
|
||||
* can occur without blocking or the client having to manage extra resources.
|
||||
*
|
||||
* Cast from Refresh_GpuBuffer or Refresh_TransferBuffer.
|
||||
*/
|
||||
typedef struct VulkanBufferContainer
|
||||
{
|
||||
VulkanBufferHandle *activeBufferHandle;
|
||||
|
||||
/* These are all the buffer handles that have been used by this container.
|
||||
* If the resource is bound and then updated with SafeDiscard, a new resource
|
||||
* will be added to this list.
|
||||
* These can be reused after they are submitted and command processing is complete.
|
||||
*/
|
||||
uint32_t bufferCapacity;
|
||||
uint32_t bufferCount;
|
||||
VulkanBufferHandle **bufferHandles;
|
||||
|
||||
} VulkanBufferContainer;
|
||||
|
||||
typedef enum VulkanUniformBufferType
|
||||
{
|
||||
UNIFORM_BUFFER_VERTEX,
|
||||
|
@ -777,10 +778,10 @@ typedef struct VulkanShaderModule
|
|||
SDL_atomic_t referenceCount;
|
||||
} VulkanShaderModule;
|
||||
|
||||
typedef struct VulkanTextureContainer /* Cast from Refresh_Texture */
|
||||
typedef struct VulkanTextureHandle
|
||||
{
|
||||
VulkanTexture *vulkanTexture;
|
||||
} VulkanTextureContainer;
|
||||
} VulkanTextureHandle;
|
||||
|
||||
struct VulkanTexture
|
||||
{
|
||||
|
@ -803,15 +804,34 @@ struct VulkanTexture
|
|||
|
||||
VkImageAspectFlags aspectFlags;
|
||||
|
||||
struct VulkanTexture *msaaTex;
|
||||
struct VulkanTexture *msaaTex; /* doesn't need to be a handle because render targets are dedicated */
|
||||
|
||||
SDL_atomic_t referenceCount;
|
||||
|
||||
VulkanTextureContainer *container;
|
||||
VulkanTextureHandle *handle;
|
||||
|
||||
uint8_t markedForDestroy; /* so that defrag doesn't double-free */
|
||||
};
|
||||
|
||||
/* Texture resources consist of multiple backing texture handles so that data transfers
|
||||
* can occur without blocking or the client having to manage extra resources.
|
||||
*
|
||||
* Cast from Refresh_Texture.
|
||||
*/
|
||||
typedef struct VulkanTextureContainer
|
||||
{
|
||||
VulkanTextureHandle *activeTextureHandle;
|
||||
|
||||
/* These are all the texture handles that have been used by this container.
|
||||
* If the resource is bound and then updated with SafeDiscard, a new resource
|
||||
* will be added to this list.
|
||||
* These can be reused after they are submitted and command processing is complete.
|
||||
*/
|
||||
uint32_t textureCapacity;
|
||||
uint32_t textureCount;
|
||||
VulkanTextureHandle **textureHandles;
|
||||
} VulkanTextureContainer;
|
||||
|
||||
typedef struct VulkanRenderTarget
|
||||
{
|
||||
VkImageView view;
|
||||
|
@ -837,7 +857,7 @@ typedef struct VulkanSwapchainData
|
|||
|
||||
/* Swapchain images */
|
||||
VkExtent2D extent;
|
||||
VulkanTextureContainer *textureContainers;
|
||||
VulkanTextureHandle *textureContainers;
|
||||
uint32_t imageCount;
|
||||
|
||||
/* Synchronization primitives */
|
||||
|
@ -4195,8 +4215,7 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
|
|||
uint8_t requireHostVisible,
|
||||
uint8_t preferHostLocal,
|
||||
uint8_t preferDeviceLocal,
|
||||
uint8_t dedicatedAllocation,
|
||||
uint8_t preserveContentsOnDefrag
|
||||
uint8_t dedicatedAllocation
|
||||
) {
|
||||
VulkanBuffer* buffer;
|
||||
VkResult vulkanResult;
|
||||
|
@ -4211,7 +4230,6 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
|
|||
buffer->requireHostVisible = requireHostVisible;
|
||||
buffer->preferHostLocal = preferHostLocal;
|
||||
buffer->preferDeviceLocal = preferDeviceLocal;
|
||||
buffer->preserveContentsOnDefrag = preserveContentsOnDefrag;
|
||||
buffer->markedForDestroy = 0;
|
||||
|
||||
bufferCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
||||
|
@ -4253,7 +4271,7 @@ static VulkanBuffer* VULKAN_INTERNAL_CreateBuffer(
|
|||
}
|
||||
|
||||
buffer->usedRegion->vulkanBuffer = buffer; /* lol */
|
||||
buffer->container = NULL;
|
||||
buffer->handle = NULL;
|
||||
|
||||
buffer->resourceAccessType = resourceAccessType;
|
||||
|
||||
|
@ -4304,7 +4322,6 @@ static VulkanUniformBufferObject* VULKAN_INTERNAL_CreateUniformBufferObject(
|
|||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
);
|
||||
|
||||
|
@ -4350,18 +4367,16 @@ static VulkanUniformBufferObject* VULKAN_INTERNAL_CreateUniformBufferObject(
|
|||
}
|
||||
|
||||
/* Indirection so we can cleanly defrag buffers */
|
||||
static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
|
||||
static VulkanBufferHandle* VULKAN_INTERNAL_CreateBufferHandle(
|
||||
VulkanRenderer *renderer,
|
||||
uint32_t sizeInBytes,
|
||||
VulkanResourceAccessType resourceAccessType,
|
||||
VkBufferUsageFlags usageFlags,
|
||||
uint8_t requireHostVisible,
|
||||
uint8_t preferHostLocal,
|
||||
uint8_t preferDeviceLocal,
|
||||
uint8_t dedicatedAllocation,
|
||||
uint8_t preserveContentsOnDefrag
|
||||
uint8_t preferDeviceLocal
|
||||
) {
|
||||
VulkanBufferContainer* bufferContainer;
|
||||
VulkanBufferHandle* bufferHandle;
|
||||
VulkanBuffer* buffer;
|
||||
|
||||
/* always set transfer bits so we can defrag */
|
||||
|
@ -4375,8 +4390,7 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
|
|||
requireHostVisible,
|
||||
preferHostLocal,
|
||||
preferDeviceLocal,
|
||||
dedicatedAllocation,
|
||||
preserveContentsOnDefrag
|
||||
0
|
||||
);
|
||||
|
||||
if (buffer == NULL)
|
||||
|
@ -4385,11 +4399,53 @@ static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bufferContainer = SDL_malloc(sizeof(VulkanBufferContainer));
|
||||
bufferContainer->vulkanBuffer = buffer;
|
||||
buffer->container = bufferContainer;
|
||||
bufferHandle = SDL_malloc(sizeof(VulkanBufferHandle));
|
||||
bufferHandle->vulkanBuffer = buffer;
|
||||
buffer->handle = bufferHandle;
|
||||
|
||||
return (VulkanBufferContainer*) bufferContainer;
|
||||
return bufferHandle;
|
||||
}
|
||||
|
||||
static VulkanBufferContainer* VULKAN_INTERNAL_CreateBufferContainer(
|
||||
VulkanRenderer *renderer,
|
||||
uint32_t sizeInBytes,
|
||||
VulkanResourceAccessType resourceAccessType,
|
||||
VkBufferUsageFlags usageFlags,
|
||||
uint8_t requireHostVisible,
|
||||
uint8_t preferHostLocal,
|
||||
uint8_t preferDeviceLocal
|
||||
) {
|
||||
VulkanBufferContainer *bufferContainer;
|
||||
VulkanBufferHandle *bufferHandle;
|
||||
|
||||
bufferHandle = VULKAN_INTERNAL_CreateBufferHandle(
|
||||
renderer,
|
||||
sizeInBytes,
|
||||
resourceAccessType,
|
||||
usageFlags,
|
||||
requireHostVisible,
|
||||
preferHostLocal,
|
||||
preferDeviceLocal
|
||||
);
|
||||
|
||||
if (bufferHandle == NULL)
|
||||
{
|
||||
Refresh_LogError("Failed to create buffer container!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bufferContainer = SDL_malloc(sizeof(VulkanBufferContainer));
|
||||
|
||||
bufferContainer->activeBufferHandle = bufferHandle;
|
||||
|
||||
bufferContainer->bufferCapacity = 1;
|
||||
bufferContainer->bufferCount = 1;
|
||||
bufferContainer->bufferHandles = SDL_malloc(
|
||||
bufferContainer->bufferCapacity * sizeof(VulkanBufferHandle*)
|
||||
);
|
||||
bufferContainer->bufferHandles[0] = bufferContainer->activeBufferHandle;
|
||||
|
||||
return bufferContainer;
|
||||
}
|
||||
|
||||
static void VULKAN_INTERNAL_DestroyUniformBufferObject(
|
||||
|
@ -4861,7 +4917,7 @@ static uint8_t VULKAN_INTERNAL_CreateSwapchain(
|
|||
);
|
||||
|
||||
swapchainData->textureContainers = SDL_malloc(
|
||||
sizeof(VulkanTextureContainer) * swapchainData->imageCount
|
||||
sizeof(VulkanTextureHandle) * swapchainData->imageCount
|
||||
);
|
||||
|
||||
if (!swapchainData->textureContainers)
|
||||
|
@ -4935,6 +4991,7 @@ static uint8_t VULKAN_INTERNAL_CreateSwapchain(
|
|||
swapchainData->textureContainers[i].vulkanTexture->format = swapchainData->swapchainFormat;
|
||||
swapchainData->textureContainers[i].vulkanTexture->is3D = 0;
|
||||
swapchainData->textureContainers[i].vulkanTexture->isCube = 0;
|
||||
swapchainData->textureContainers[i].vulkanTexture->depth = 1;
|
||||
swapchainData->textureContainers[i].vulkanTexture->layerCount = 1;
|
||||
swapchainData->textureContainers[i].vulkanTexture->levelCount = 1;
|
||||
swapchainData->textureContainers[i].vulkanTexture->sampleCount = REFRESH_SAMPLECOUNT_1;
|
||||
|
@ -5385,7 +5442,7 @@ static void VULKAN_DrawPrimitivesIndirect(
|
|||
) {
|
||||
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferHandle*) gpuBuffer)->vulkanBuffer;
|
||||
VkDescriptorSet descriptorSets[4];
|
||||
uint32_t dynamicOffsets[2];
|
||||
|
||||
|
@ -5701,7 +5758,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
|
||||
if (texture->msaaTex != NULL)
|
||||
{
|
||||
|
@ -5824,7 +5881,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|||
}
|
||||
else
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = texture->format;
|
||||
|
@ -6719,6 +6776,7 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
|||
uint8_t isDepthFormat = IsRefreshDepthFormat(textureCreateInfo->format);
|
||||
VkFormat format;
|
||||
VulkanTextureContainer *container;
|
||||
VulkanTextureHandle *textureHandle;
|
||||
VulkanTexture *vulkanTexture;
|
||||
|
||||
if (isDepthFormat)
|
||||
|
@ -6764,6 +6822,7 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
|||
imageAspectFlags = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
}
|
||||
|
||||
/* FIXME: what if this fails? */
|
||||
vulkanTexture = VULKAN_INTERNAL_CreateTexture(
|
||||
renderer,
|
||||
textureCreateInfo->width,
|
||||
|
@ -6784,6 +6843,7 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
|||
!isDepthFormat &&
|
||||
textureCreateInfo->sampleCount > REFRESH_SAMPLECOUNT_1 )
|
||||
{
|
||||
/* FIXME: what if this fails? */
|
||||
vulkanTexture->msaaTex = VULKAN_INTERNAL_CreateTexture(
|
||||
renderer,
|
||||
textureCreateInfo->width,
|
||||
|
@ -6798,9 +6858,18 @@ static Refresh_Texture* VULKAN_CreateTexture(
|
|||
);
|
||||
}
|
||||
|
||||
textureHandle = SDL_malloc(sizeof(VulkanTextureHandle));
|
||||
textureHandle->vulkanTexture = vulkanTexture;
|
||||
vulkanTexture->handle = textureHandle;
|
||||
|
||||
container = SDL_malloc(sizeof(VulkanTextureContainer));
|
||||
container->vulkanTexture = vulkanTexture;
|
||||
vulkanTexture->container = container;
|
||||
|
||||
container->activeTextureHandle = textureHandle;
|
||||
container->textureCapacity = 1;
|
||||
container->textureCount =1 ;
|
||||
container->textureHandles = SDL_malloc(
|
||||
container->textureCapacity * sizeof(VulkanTextureHandle*)
|
||||
);
|
||||
|
||||
return (Refresh_Texture*) container;
|
||||
}
|
||||
|
@ -6850,8 +6919,6 @@ static Refresh_GpuBuffer* VULKAN_CreateGpuBuffer(
|
|||
vulkanUsageFlags,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
@ -6860,32 +6927,15 @@ static Refresh_TransferBuffer* VULKAN_CreateTransferBuffer(
|
|||
Refresh_Renderer *driverData,
|
||||
uint32_t sizeInBytes
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VkBufferUsageFlags vulkanUsageFlags =
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) SDL_malloc(sizeof(VulkanTransferBufferContainer));
|
||||
|
||||
transferBufferContainer->sizeInBytes = sizeInBytes;
|
||||
transferBufferContainer->activeBuffer = VULKAN_INTERNAL_CreateBufferContainer(
|
||||
renderer,
|
||||
return (Refresh_TransferBuffer*) VULKAN_INTERNAL_CreateBufferContainer(
|
||||
(VulkanRenderer*) driverData,
|
||||
sizeInBytes,
|
||||
RESOURCE_ACCESS_NONE,
|
||||
vulkanUsageFlags,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
transferBufferContainer->bufferCapacity = 1;
|
||||
transferBufferContainer->bufferCount = 1;
|
||||
transferBufferContainer->backingBuffers = SDL_malloc(
|
||||
transferBufferContainer->bufferCapacity * sizeof(VulkanBufferContainer*)
|
||||
);
|
||||
transferBufferContainer->backingBuffers[0] = transferBufferContainer->activeBuffer;
|
||||
|
||||
return (Refresh_TransferBuffer*) transferBufferContainer;
|
||||
}
|
||||
|
||||
/* Setters */
|
||||
|
@ -7150,7 +7200,7 @@ static void VULKAN_BindVertexSamplers(
|
|||
|
||||
for (i = 0; i < samplerCount; i += 1)
|
||||
{
|
||||
currentTexture = ((VulkanTextureContainer*) pTextures[i])->vulkanTexture;
|
||||
currentTexture = ((VulkanTextureHandle*) pTextures[i])->vulkanTexture;
|
||||
currentSampler = (VulkanSampler*) pSamplers[i];
|
||||
descriptorImageInfos[i].imageView = currentTexture->view;
|
||||
descriptorImageInfos[i].sampler = currentSampler->sampler;
|
||||
|
@ -7193,7 +7243,7 @@ static void VULKAN_BindFragmentSamplers(
|
|||
|
||||
for (i = 0; i < samplerCount; i += 1)
|
||||
{
|
||||
currentTexture = ((VulkanTextureContainer*) pTextures[i])->vulkanTexture;
|
||||
currentTexture = ((VulkanTextureHandle*) pTextures[i])->vulkanTexture;
|
||||
currentSampler = (VulkanSampler*) pSamplers[i];
|
||||
descriptorImageInfos[i].imageView = currentTexture->view;
|
||||
descriptorImageInfos[i].sampler = currentSampler->sampler;
|
||||
|
@ -7243,7 +7293,7 @@ static void VULKAN_QueueDestroyTexture(
|
|||
Refresh_Texture *texture
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanTextureContainer *vulkanTextureContainer = (VulkanTextureContainer *)texture;
|
||||
VulkanTextureHandle *vulkanTextureContainer = (VulkanTextureHandle *)texture;
|
||||
VulkanTexture *vulkanTexture = vulkanTextureContainer->vulkanTexture;
|
||||
|
||||
SDL_LockMutex(renderer->disposeLock);
|
||||
|
@ -7310,7 +7360,7 @@ static void VULKAN_QueueDestroyGpuBuffer(
|
|||
Refresh_GpuBuffer *gpuBuffer
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanBufferContainer *vulkanBufferContainer = (VulkanBufferContainer*) gpuBuffer;
|
||||
VulkanBufferHandle *vulkanBufferContainer = (VulkanBufferHandle*) gpuBuffer;
|
||||
VulkanBuffer *vulkanBuffer = vulkanBufferContainer->vulkanBuffer;
|
||||
|
||||
SDL_LockMutex(renderer->disposeLock);
|
||||
|
@ -7328,19 +7378,19 @@ static void VULKAN_QueueDestroyTransferBuffer(
|
|||
Refresh_TransferBuffer *transferBuffer
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer*) transferBuffer;
|
||||
uint32_t i;
|
||||
|
||||
SDL_LockMutex(renderer->disposeLock);
|
||||
|
||||
for (i = 0; i < transferBufferContainer->bufferCount; i += 1)
|
||||
{
|
||||
VULKAN_INTERNAL_QueueDestroyBuffer(renderer, transferBufferContainer->backingBuffers[i]->vulkanBuffer);
|
||||
SDL_free(transferBufferContainer->backingBuffers[i]);
|
||||
VULKAN_INTERNAL_QueueDestroyBuffer(renderer, transferBufferContainer->bufferHandles[i]->vulkanBuffer);
|
||||
SDL_free(transferBufferContainer->bufferHandles[i]);
|
||||
}
|
||||
|
||||
/* Containers are just client handles, so we can free immediately */
|
||||
SDL_free(transferBufferContainer->backingBuffers);
|
||||
SDL_free(transferBufferContainer->bufferHandles);
|
||||
SDL_free(transferBufferContainer);
|
||||
|
||||
SDL_UnlockMutex(renderer->disposeLock);
|
||||
|
@ -7433,7 +7483,7 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
hash.colorTargetDescriptions[i].format = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture->format;
|
||||
hash.colorTargetDescriptions[i].format = ((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture->format;
|
||||
hash.colorTargetDescriptions[i].clearColor = colorAttachmentInfos[i].clearColor;
|
||||
hash.colorTargetDescriptions[i].loadOp = colorAttachmentInfos[i].loadOp;
|
||||
hash.colorTargetDescriptions[i].storeOp = colorAttachmentInfos[i].storeOp;
|
||||
|
@ -7442,7 +7492,7 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|||
hash.colorAttachmentSampleCount = REFRESH_SAMPLECOUNT_1;
|
||||
if (colorAttachmentCount > 0)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[0].texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) colorAttachmentInfos[0].texture)->vulkanTexture;
|
||||
if (texture->msaaTex != NULL)
|
||||
{
|
||||
hash.colorAttachmentSampleCount = texture->msaaTex->sampleCount;
|
||||
|
@ -7461,7 +7511,7 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|||
}
|
||||
else
|
||||
{
|
||||
hash.depthStencilTargetDescription.format = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->vulkanTexture->format;
|
||||
hash.depthStencilTargetDescription.format = ((VulkanTextureHandle*) depthStencilAttachmentInfo->texture)->vulkanTexture->format;
|
||||
hash.depthStencilTargetDescription.loadOp = depthStencilAttachmentInfo->loadOp;
|
||||
hash.depthStencilTargetDescription.storeOp = depthStencilAttachmentInfo->storeOp;
|
||||
hash.depthStencilTargetDescription.stencilLoadOp = depthStencilAttachmentInfo->stencilLoadOp;
|
||||
|
@ -7529,7 +7579,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
|
||||
renderTarget = VULKAN_INTERNAL_FetchRenderTarget(
|
||||
renderer,
|
||||
|
@ -7565,7 +7615,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
}
|
||||
else
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
renderTarget = VULKAN_INTERNAL_FetchRenderTarget(
|
||||
renderer,
|
||||
texture,
|
||||
|
@ -7601,7 +7651,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
|
||||
renderTarget = VULKAN_INTERNAL_FetchRenderTarget(
|
||||
renderer,
|
||||
|
@ -7635,7 +7685,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
|
||||
if (depthStencilAttachmentInfo != NULL)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
renderTarget = VULKAN_INTERNAL_FetchRenderTarget(
|
||||
renderer,
|
||||
texture,
|
||||
|
@ -7783,7 +7833,7 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
w = texture->dimensions.width >> colorAttachmentInfos[i].level;
|
||||
h = texture->dimensions.height >> colorAttachmentInfos[i].level;
|
||||
|
||||
|
@ -7800,7 +7850,7 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
if (depthStencilAttachmentInfo != NULL)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
w = texture->dimensions.width >> depthStencilAttachmentInfo->level;
|
||||
h = texture->dimensions.height >> depthStencilAttachmentInfo->level;
|
||||
|
||||
|
@ -7841,7 +7891,7 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
renderer,
|
||||
|
@ -7868,7 +7918,7 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
if (depthStencilAttachmentInfo != NULL)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
depthAspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
|
||||
if (IsStencilFormat(texture->format))
|
||||
|
@ -7908,7 +7958,7 @@ static void VULKAN_BeginRenderPass(
|
|||
clearValues[i].color.float32[2] = colorAttachmentInfos[i].clearColor.z;
|
||||
clearValues[i].color.float32[3] = colorAttachmentInfos[i].clearColor.w;
|
||||
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
texture = ((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
if (texture->msaaTex != NULL)
|
||||
{
|
||||
clearValues[i+1].color.float32[0] = colorAttachmentInfos[i].clearColor.x;
|
||||
|
@ -7950,13 +8000,13 @@ static void VULKAN_BeginRenderPass(
|
|||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
vulkanCommandBuffer->renderPassColorTargetTextures[i] =
|
||||
((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
((VulkanTextureHandle*) colorAttachmentInfos[i].texture)->vulkanTexture;
|
||||
}
|
||||
vulkanCommandBuffer->renderPassColorTargetCount = colorAttachmentCount;
|
||||
|
||||
if (depthStencilAttachmentInfo != NULL)
|
||||
{
|
||||
vulkanCommandBuffer->renderPassDepthTexture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
vulkanCommandBuffer->renderPassDepthTexture = ((VulkanTextureHandle*) depthStencilAttachmentInfo->texture)->vulkanTexture;
|
||||
}
|
||||
|
||||
/* Set sensible default viewport state */
|
||||
|
@ -8124,7 +8174,7 @@ static void VULKAN_BindVertexBuffers(
|
|||
|
||||
for (i = 0; i < bindingCount; i += 1)
|
||||
{
|
||||
currentVulkanBuffer = ((VulkanBufferContainer*) pBuffers[i])->vulkanBuffer;
|
||||
currentVulkanBuffer = ((VulkanBufferHandle*) pBuffers[i])->vulkanBuffer;
|
||||
buffers[i] = currentVulkanBuffer->buffer;
|
||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, currentVulkanBuffer);
|
||||
}
|
||||
|
@ -8149,7 +8199,7 @@ static void VULKAN_BindIndexBuffer(
|
|||
) {
|
||||
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanBuffer* vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||
VulkanBuffer* vulkanBuffer = ((VulkanBufferHandle*) gpuBuffer)->vulkanBuffer;
|
||||
|
||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanBuffer);
|
||||
|
||||
|
@ -8222,7 +8272,7 @@ static void VULKAN_BindComputeBuffers(
|
|||
|
||||
for (i = 0; i < computePipeline->pipelineLayout->bufferDescriptorSetCache->bindingCount; i += 1)
|
||||
{
|
||||
currentVulkanBuffer = ((VulkanBufferContainer*) pBuffers[i])->vulkanBuffer;
|
||||
currentVulkanBuffer = ((VulkanBufferHandle*) pBuffers[i])->vulkanBuffer;
|
||||
|
||||
descriptorBufferInfos[i].buffer = currentVulkanBuffer->buffer;
|
||||
descriptorBufferInfos[i].offset = 0;
|
||||
|
@ -8270,7 +8320,7 @@ static void VULKAN_BindComputeTextures(
|
|||
|
||||
for (i = 0; i < computePipeline->pipelineLayout->imageDescriptorSetCache->bindingCount; i += 1)
|
||||
{
|
||||
currentTexture = ((VulkanTextureContainer*) pTextures[i])->vulkanTexture;
|
||||
currentTexture = ((VulkanTextureHandle*) pTextures[i])->vulkanTexture;
|
||||
descriptorImageInfos[i].imageView = currentTexture->view;
|
||||
descriptorImageInfos[i].sampler = VK_NULL_HANDLE;
|
||||
descriptorImageInfos[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
|
@ -8406,74 +8456,107 @@ static void VULKAN_EndComputePass(
|
|||
vulkanCommandBuffer->currentComputePipeline = NULL;
|
||||
}
|
||||
|
||||
static void VULKAN_INTERNAL_DiscardActiveTransferBuffer(
|
||||
static void VULKAN_INTERNAL_DiscardActiveBuffer(
|
||||
VulkanRenderer *renderer,
|
||||
VulkanTransferBufferContainer *transferBufferContainer
|
||||
VulkanBufferContainer *bufferContainer
|
||||
) {
|
||||
VulkanBufferContainer *transferBuffer;
|
||||
VulkanBufferHandle *bufferHandle;
|
||||
uint32_t i;
|
||||
|
||||
transferBufferContainer->activeBuffer->vulkanBuffer->preserveContentsOnDefrag = 0;
|
||||
|
||||
/* If a previously-discarded buffer is available, we can use that. */
|
||||
for (i = 0; i < transferBufferContainer->bufferCount; i += 1)
|
||||
for (i = 0; i < bufferContainer->bufferCount; i += 1)
|
||||
{
|
||||
transferBuffer = transferBufferContainer->backingBuffers[i];
|
||||
if (SDL_AtomicGet(&transferBuffer->vulkanBuffer->referenceCount) == 0)
|
||||
bufferHandle = bufferContainer->bufferHandles[i];
|
||||
if (SDL_AtomicGet(&bufferHandle->vulkanBuffer->referenceCount) == 0)
|
||||
{
|
||||
transferBufferContainer->activeBuffer = transferBuffer;
|
||||
bufferContainer->activeBufferHandle = bufferHandle;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* No buffer is available, generate a new one. */
|
||||
transferBufferContainer->activeBuffer = VULKAN_INTERNAL_CreateBufferContainer(
|
||||
/* No buffer handle is available, generate a new one. */
|
||||
bufferContainer->activeBufferHandle = VULKAN_INTERNAL_CreateBufferHandle(
|
||||
renderer,
|
||||
transferBufferContainer->sizeInBytes,
|
||||
bufferContainer->activeBufferHandle->vulkanBuffer->size,
|
||||
RESOURCE_ACCESS_NONE,
|
||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
bufferContainer->activeBufferHandle->vulkanBuffer->usage,
|
||||
bufferContainer->activeBufferHandle->vulkanBuffer->requireHostVisible,
|
||||
bufferContainer->activeBufferHandle->vulkanBuffer->preferHostLocal,
|
||||
bufferContainer->activeBufferHandle->vulkanBuffer->preferDeviceLocal
|
||||
);
|
||||
|
||||
EXPAND_ARRAY_IF_NEEDED(
|
||||
transferBufferContainer->backingBuffers,
|
||||
VulkanBufferContainer*,
|
||||
transferBufferContainer->bufferCount + 1,
|
||||
transferBufferContainer->bufferCapacity,
|
||||
transferBufferContainer->bufferCapacity * 2
|
||||
bufferContainer->bufferHandles,
|
||||
VulkanBufferHandle*,
|
||||
bufferContainer->bufferCount + 1,
|
||||
bufferContainer->bufferCapacity,
|
||||
bufferContainer->bufferCapacity * 2
|
||||
);
|
||||
|
||||
transferBufferContainer->backingBuffers[
|
||||
transferBufferContainer->bufferCount
|
||||
] = transferBufferContainer->activeBuffer;
|
||||
transferBufferContainer->bufferCount += 1;
|
||||
bufferContainer->bufferHandles[
|
||||
bufferContainer->bufferCount
|
||||
] = bufferContainer->activeBufferHandle;
|
||||
bufferContainer->bufferCount += 1;
|
||||
}
|
||||
|
||||
static void VULKAN_SetData(
|
||||
static void VULKAN_INTERNAL_DiscardActiveTexture(
|
||||
VulkanRenderer *renderer,
|
||||
VulkanTextureContainer *textureContainer
|
||||
) {
|
||||
VulkanTextureHandle *textureHandle;
|
||||
uint32_t i;
|
||||
|
||||
/* If a previously-discarded buffer is available, we can use that. */
|
||||
for (i = 0; i < textureContainer->textureCount; i += 1)
|
||||
{
|
||||
textureHandle = textureContainer->textureHandles[i];
|
||||
if (SDL_AtomicGet(&textureHandle->vulkanTexture->referenceCount) == 0)
|
||||
{
|
||||
textureContainer->activeTextureHandle = textureHandle;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* No texture handle is available, generate a new one. */
|
||||
textureContainer->activeTextureHandle = VULKAN_INTERNAL_CreateTexture(
|
||||
|
||||
);
|
||||
|
||||
EXPAND_ARRAY_IF_NEEDED(
|
||||
textureContainer->textureHandles,
|
||||
VulkanTextureHandle*,
|
||||
textureContainer->textureCount + 1,
|
||||
textureContainer->textureCapacity,
|
||||
textureContainer->textureCapacity * 2
|
||||
);
|
||||
|
||||
textureContainer->textureHandles[
|
||||
textureContainer->textureCount
|
||||
] = textureContainer->activeTextureHandle;
|
||||
textureContainer->textureCount += 1;
|
||||
}
|
||||
|
||||
static void VULKAN_SetTransferData(
|
||||
Refresh_Renderer *driverData,
|
||||
void* data,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_SetDataOptions option
|
||||
Refresh_TransferOptions option
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer*) transferBuffer;
|
||||
|
||||
if (option == REFRESH_SETDATAOPTIONS_SAFEDISCARD && SDL_AtomicGet(&transferBufferContainer->activeBuffer->vulkanBuffer->referenceCount) > 0)
|
||||
if (option == REFRESH_TRANSFEROPTIONS_SAFEDISCARD && SDL_AtomicGet(&transferBufferContainer->activeBufferHandle->vulkanBuffer->referenceCount) > 0)
|
||||
{
|
||||
VULKAN_INTERNAL_DiscardActiveTransferBuffer(
|
||||
VULKAN_INTERNAL_DiscardActiveBuffer(
|
||||
renderer,
|
||||
transferBufferContainer
|
||||
);
|
||||
}
|
||||
|
||||
uint8_t *bufferPointer =
|
||||
transferBufferContainer->activeBuffer->vulkanBuffer->usedRegion->allocation->mapPointer +
|
||||
transferBufferContainer->activeBuffer->vulkanBuffer->usedRegion->resourceOffset +
|
||||
transferBufferContainer->activeBufferHandle->vulkanBuffer->usedRegion->allocation->mapPointer +
|
||||
transferBufferContainer->activeBufferHandle->vulkanBuffer->usedRegion->resourceOffset +
|
||||
copyParams->dstOffset;
|
||||
|
||||
SDL_memcpy(
|
||||
|
@ -8483,15 +8566,15 @@ static void VULKAN_SetData(
|
|||
);
|
||||
}
|
||||
|
||||
static void VULKAN_GetData(
|
||||
static void VULKAN_GetTransferData(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
void* data,
|
||||
Refresh_BufferCopy *copyParams
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||
VulkanBuffer *vulkanBuffer = transferBufferContainer->activeBuffer->vulkanBuffer;
|
||||
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer*) transferBuffer;
|
||||
VulkanBuffer *vulkanBuffer = transferBufferContainer->activeBufferHandle->vulkanBuffer;
|
||||
|
||||
uint8_t *bufferPointer =
|
||||
vulkanBuffer->usedRegion->allocation->mapPointer +
|
||||
|
@ -8503,8 +8586,6 @@ static void VULKAN_GetData(
|
|||
bufferPointer,
|
||||
copyParams->size
|
||||
);
|
||||
|
||||
vulkanBuffer->preserveContentsOnDefrag = 0;
|
||||
}
|
||||
|
||||
static void VULKAN_BeginCopyPass(
|
||||
|
@ -8523,33 +8604,42 @@ static void VULKAN_UploadToTexture(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer*) transferBuffer;
|
||||
VulkanTextureContainer *vulkanTextureContainer = (VulkanTextureContainer*) textureSlice->texture;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
if (option == REFRESH_COPYOPTIONS_SAFEDISCARD && SDL_AtomicGet(&vulkanTextureContainer->activeTextureHandle->vulkanTexture->referenceCount) > 0)
|
||||
{
|
||||
VULKAN_INTERNAL_DiscardActiveTexture(
|
||||
renderer,
|
||||
vulkanTextureContainer
|
||||
);
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
renderer,
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
RESOURCE_ACCESS_TRANSFER_READ,
|
||||
transferBufferContainer->activeBuffer->vulkanBuffer
|
||||
transferBufferContainer->activeBufferHandle->vulkanBuffer
|
||||
);
|
||||
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
renderer,
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
RESOURCE_ACCESS_TRANSFER_WRITE,
|
||||
vulkanTexture->aspectFlags,
|
||||
vulkanTextureContainer->activeTextureHandle->vulkanTexture->aspectFlags,
|
||||
0,
|
||||
vulkanTexture->layerCount,
|
||||
vulkanTextureContainer->activeTextureHandle->vulkanTexture->layerCount,
|
||||
0,
|
||||
vulkanTexture->levelCount,
|
||||
vulkanTextureContainer->activeTextureHandle->vulkanTexture->levelCount,
|
||||
0,
|
||||
vulkanTexture->image,
|
||||
&vulkanTexture->resourceAccessType
|
||||
vulkanTextureContainer->activeTextureHandle->vulkanTexture->image,
|
||||
&vulkanTextureContainer->activeTextureHandle->vulkanTexture->resourceAccessType
|
||||
);
|
||||
|
||||
imageCopy.imageExtent.width = textureSlice->w;
|
||||
|
@ -8558,7 +8648,7 @@ static void VULKAN_UploadToTexture(
|
|||
imageCopy.imageOffset.x = textureSlice->x;
|
||||
imageCopy.imageOffset.y = textureSlice->y;
|
||||
imageCopy.imageOffset.z = textureSlice->z;
|
||||
imageCopy.imageSubresource.aspectMask = vulkanTexture->aspectFlags;
|
||||
imageCopy.imageSubresource.aspectMask = vulkanTextureContainer->activeTextureHandle->vulkanTexture->aspectFlags;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureSlice->baseLayer;
|
||||
imageCopy.imageSubresource.layerCount = textureSlice->layerCount;
|
||||
imageCopy.imageSubresource.mipLevel = textureSlice->mipLevel;
|
||||
|
@ -8568,16 +8658,16 @@ static void VULKAN_UploadToTexture(
|
|||
|
||||
renderer->vkCmdCopyBufferToImage(
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
transferBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
||||
vulkanTexture->image,
|
||||
AccessMap[vulkanTexture->resourceAccessType].imageLayout,
|
||||
transferBufferContainer->activeBufferHandle->vulkanBuffer->buffer,
|
||||
vulkanTextureContainer->activeTextureHandle->vulkanTexture->image,
|
||||
AccessMap[vulkanTextureContainer->activeTextureHandle->vulkanTexture->resourceAccessType].imageLayout,
|
||||
1,
|
||||
&imageCopy
|
||||
);
|
||||
|
||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBuffer->vulkanBuffer);
|
||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
||||
VULKAN_INTERNAL_TrackCopiedTexture(renderer, vulkanCommandBuffer, vulkanTexture);
|
||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, vulkanTextureContainer->activeTextureHandle->vulkanTexture);
|
||||
VULKAN_INTERNAL_TrackCopiedTexture(renderer, vulkanCommandBuffer, vulkanTextureContainer->activeTextureHandle->vulkanTexture);
|
||||
}
|
||||
|
||||
static void VULKAN_UploadToBuffer(
|
||||
|
@ -8585,19 +8675,20 @@ static void VULKAN_UploadToBuffer(
|
|||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferCopy *copyParams
|
||||
Refresh_BufferCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer*) transferBuffer;
|
||||
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferHandle*) gpuBuffer)->vulkanBuffer;
|
||||
VkBufferCopy bufferCopy;
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
renderer,
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
RESOURCE_ACCESS_TRANSFER_READ,
|
||||
transferBufferContainer->activeBuffer->vulkanBuffer
|
||||
transferBufferContainer->activeBufferHandle->vulkanBuffer
|
||||
);
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
|
@ -8613,13 +8704,13 @@ static void VULKAN_UploadToBuffer(
|
|||
|
||||
renderer->vkCmdCopyBuffer(
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
transferBufferContainer->activeBuffer->vulkanBuffer->buffer,
|
||||
transferBufferContainer->activeBufferHandle->vulkanBuffer->buffer,
|
||||
vulkanGpuBuffer->buffer,
|
||||
1,
|
||||
&bufferCopy
|
||||
);
|
||||
|
||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBuffer->vulkanBuffer);
|
||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
||||
VULKAN_INTERNAL_TrackCopiedBuffer(renderer, vulkanCommandBuffer, vulkanGpuBuffer);
|
||||
}
|
||||
|
@ -8633,7 +8724,7 @@ static void VULKAN_DownloadFromTexture(
|
|||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureHandle*) textureSlice->texture)->vulkanTexture;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
|
@ -8698,7 +8789,7 @@ static void VULKAN_DownloadFromBuffer(
|
|||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTransferBufferContainer *transferBufferContainer = (VulkanTransferBufferContainer*) transferBuffer;
|
||||
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||
VulkanBuffer *vulkanGpuBuffer = ((VulkanBufferHandle*) gpuBuffer)->vulkanBuffer;
|
||||
VkBufferCopy bufferCopy;
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
|
@ -8742,8 +8833,8 @@ static void VULKAN_CopyTextureToTexture(
|
|||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTexture *srcTexture = ((VulkanTextureContainer*) source->texture)->vulkanTexture;
|
||||
VulkanTexture *dstTexture = ((VulkanTextureContainer*) destination->texture)->vulkanTexture;
|
||||
VulkanTexture *srcTexture = ((VulkanTextureHandle*) source->texture)->vulkanTexture;
|
||||
VulkanTexture *dstTexture = ((VulkanTextureHandle*) destination->texture)->vulkanTexture;
|
||||
VkImageCopy imageCopy;
|
||||
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
|
@ -8817,8 +8908,8 @@ static void VULKAN_CopyTextureToBuffer(
|
|||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureHandle*) textureSlice->texture)->vulkanTexture;
|
||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferHandle*) gpuBuffer)->vulkanBuffer;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
|
@ -8880,8 +8971,8 @@ static void VULKAN_CopyBufferToTexture(
|
|||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferContainer*) gpuBuffer)->vulkanBuffer;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) textureSlice->texture)->vulkanTexture;
|
||||
VulkanBuffer *vulkanBuffer = ((VulkanBufferHandle*) gpuBuffer)->vulkanBuffer;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureHandle*) textureSlice->texture)->vulkanTexture;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
|
@ -8943,8 +9034,8 @@ static void VULKAN_CopyBufferToBuffer(
|
|||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanBuffer *vulkanSrcBuffer = ((VulkanBufferContainer*) source)->vulkanBuffer;
|
||||
VulkanBuffer *vulkanDstBuffer = ((VulkanBufferContainer*) destination)->vulkanBuffer;
|
||||
VulkanBuffer *vulkanSrcBuffer = ((VulkanBufferHandle*) source)->vulkanBuffer;
|
||||
VulkanBuffer *vulkanDstBuffer = ((VulkanBufferHandle*) destination)->vulkanBuffer;
|
||||
VkBufferCopy bufferCopy;
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
|
@ -8986,7 +9077,7 @@ static void VULKAN_GenerateMipmaps(
|
|||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureContainer*) texture)->vulkanTexture;
|
||||
VulkanTexture *vulkanTexture = ((VulkanTextureHandle*) texture)->vulkanTexture;
|
||||
VulkanResourceAccessType *levelAccessType;
|
||||
VkImageBlit blit;
|
||||
uint32_t level;
|
||||
|
@ -9544,7 +9635,7 @@ static Refresh_Texture* VULKAN_AcquireSwapchainTexture(
|
|||
WindowData *windowData;
|
||||
VulkanSwapchainData *swapchainData;
|
||||
VkResult acquireResult = VK_SUCCESS;
|
||||
VulkanTextureContainer *swapchainTextureContainer = NULL;
|
||||
VulkanTextureHandle *swapchainTextureContainer = NULL;
|
||||
VulkanPresentData *presentData;
|
||||
|
||||
windowData = VULKAN_INTERNAL_FetchWindowData(windowHandle);
|
||||
|
@ -10348,11 +10439,11 @@ static uint8_t VULKAN_INTERNAL_DefragmentMemory(
|
|||
}
|
||||
|
||||
/* re-point original container to new buffer */
|
||||
if (currentRegion->vulkanBuffer->container != NULL)
|
||||
if (currentRegion->vulkanBuffer->handle != NULL)
|
||||
{
|
||||
newBuffer->container = currentRegion->vulkanBuffer->container;
|
||||
newBuffer->container->vulkanBuffer = newBuffer;
|
||||
currentRegion->vulkanBuffer->container = NULL;
|
||||
newBuffer->handle = currentRegion->vulkanBuffer->handle;
|
||||
newBuffer->handle->vulkanBuffer = newBuffer;
|
||||
currentRegion->vulkanBuffer->handle = NULL;
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_QueueDestroyBuffer(renderer, currentRegion->vulkanBuffer);
|
||||
|
@ -10464,9 +10555,9 @@ static uint8_t VULKAN_INTERNAL_DefragmentMemory(
|
|||
}
|
||||
|
||||
/* re-point original container to new texture */
|
||||
newTexture->container = currentRegion->vulkanTexture->container;
|
||||
newTexture->container->vulkanTexture = newTexture;
|
||||
currentRegion->vulkanTexture->container = NULL;
|
||||
newTexture->handle = currentRegion->vulkanTexture->handle;
|
||||
newTexture->handle->vulkanTexture = newTexture;
|
||||
currentRegion->vulkanTexture->handle = NULL;
|
||||
|
||||
VULKAN_INTERNAL_QueueDestroyTexture(renderer, currentRegion->vulkanTexture);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue