remove SetDataOptions
parent
0c153607f5
commit
65d5a65e9d
|
@ -96,12 +96,6 @@ typedef enum Refresh_StoreOp
|
||||||
REFRESH_STOREOP_DONT_CARE
|
REFRESH_STOREOP_DONT_CARE
|
||||||
} Refresh_StoreOp;
|
} Refresh_StoreOp;
|
||||||
|
|
||||||
typedef enum Refresh_SetDataOptions
|
|
||||||
{
|
|
||||||
REFRESH_SETDATAOPTIONS_IMMEDIATE,
|
|
||||||
REFRESH_SETDATAOPTIONS_DEFERRED
|
|
||||||
} Refresh_SetDataOptions;
|
|
||||||
|
|
||||||
typedef enum Refresh_ClearOptionsBits
|
typedef enum Refresh_ClearOptionsBits
|
||||||
{
|
{
|
||||||
REFRESH_CLEAROPTIONS_COLOR = 0x00000001,
|
REFRESH_CLEAROPTIONS_COLOR = 0x00000001,
|
||||||
|
@ -968,7 +962,6 @@ REFRESHAPI void Refresh_CopyTextureToBuffer(
|
||||||
* offsetInBytes: The starting offset of the buffer to write into.
|
* offsetInBytes: The starting offset of the buffer to write into.
|
||||||
* data: The client data to write into the buffer.
|
* data: The client data to write into the buffer.
|
||||||
* dataLength: The length of data from the client buffer to write.
|
* dataLength: The length of data from the client buffer to write.
|
||||||
* setDataOption: Specifies how the buffer data will be copied.
|
|
||||||
*/
|
*/
|
||||||
REFRESHAPI void Refresh_SetBufferData(
|
REFRESHAPI void Refresh_SetBufferData(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
|
@ -976,8 +969,7 @@ REFRESHAPI void Refresh_SetBufferData(
|
||||||
Refresh_Buffer *buffer,
|
Refresh_Buffer *buffer,
|
||||||
uint32_t offsetInBytes,
|
uint32_t offsetInBytes,
|
||||||
void* data,
|
void* data,
|
||||||
uint32_t dataLength,
|
uint32_t dataLength
|
||||||
Refresh_SetDataOptions setDataOption
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Pushes vertex shader params to the device.
|
/* Pushes vertex shader params to the device.
|
||||||
|
|
|
@ -457,8 +457,7 @@ void Refresh_SetBufferData(
|
||||||
Refresh_Buffer *buffer,
|
Refresh_Buffer *buffer,
|
||||||
uint32_t offsetInBytes,
|
uint32_t offsetInBytes,
|
||||||
void* data,
|
void* data,
|
||||||
uint32_t dataLength,
|
uint32_t dataLength
|
||||||
Refresh_SetDataOptions setDataOption
|
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->SetBufferData(
|
device->SetBufferData(
|
||||||
|
@ -467,8 +466,7 @@ void Refresh_SetBufferData(
|
||||||
buffer,
|
buffer,
|
||||||
offsetInBytes,
|
offsetInBytes,
|
||||||
data,
|
data,
|
||||||
dataLength,
|
dataLength
|
||||||
setDataOption
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,8 +310,7 @@ struct Refresh_Device
|
||||||
Refresh_Buffer *buffer,
|
Refresh_Buffer *buffer,
|
||||||
uint32_t offsetInBytes,
|
uint32_t offsetInBytes,
|
||||||
void* data,
|
void* data,
|
||||||
uint32_t dataLength,
|
uint32_t dataLength
|
||||||
Refresh_SetDataOptions setDataOption
|
|
||||||
);
|
);
|
||||||
|
|
||||||
uint32_t(*PushVertexShaderUniforms)(
|
uint32_t(*PushVertexShaderUniforms)(
|
||||||
|
|
|
@ -6332,6 +6332,12 @@ static void VULKAN_SetTextureData(
|
||||||
VkBufferImageCopy imageCopy;
|
VkBufferImageCopy imageCopy;
|
||||||
uint8_t *stagingBufferPointer;
|
uint8_t *stagingBufferPointer;
|
||||||
|
|
||||||
|
if (vulkanCommandBuffer->renderPassInProgress)
|
||||||
|
{
|
||||||
|
Refresh_LogError("Cannot perform buffer updates mid-render pass!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_INTERNAL_MaybeExpandTransferBuffer(
|
VULKAN_INTERNAL_MaybeExpandTransferBuffer(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer,
|
vulkanCommandBuffer,
|
||||||
|
@ -6757,8 +6763,7 @@ static void VULKAN_SetBufferData(
|
||||||
Refresh_Buffer *buffer,
|
Refresh_Buffer *buffer,
|
||||||
uint32_t offsetInBytes,
|
uint32_t offsetInBytes,
|
||||||
void* data,
|
void* data,
|
||||||
uint32_t dataLength,
|
uint32_t dataLength
|
||||||
Refresh_SetDataOptions setDataOption
|
|
||||||
) {
|
) {
|
||||||
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer* vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
VulkanCommandBuffer* vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||||
|
@ -6767,72 +6772,56 @@ static void VULKAN_SetBufferData(
|
||||||
uint8_t* transferBufferPointer;
|
uint8_t* transferBufferPointer;
|
||||||
VkBufferCopy bufferCopy;
|
VkBufferCopy bufferCopy;
|
||||||
|
|
||||||
if (setDataOption == REFRESH_SETDATAOPTIONS_DEFERRED)
|
if (vulkanCommandBuffer->renderPassInProgress)
|
||||||
{
|
{
|
||||||
if (vulkanCommandBuffer->renderPassInProgress)
|
Refresh_LogError("Cannot perform buffer updates mid-render pass!");
|
||||||
{
|
return;
|
||||||
Refresh_LogError("Cannot perform deferred buffer updates mid-render pass!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VULKAN_INTERNAL_MaybeExpandTransferBuffer(
|
|
||||||
renderer,
|
|
||||||
vulkanCommandBuffer,
|
|
||||||
dataLength
|
|
||||||
);
|
|
||||||
|
|
||||||
transferBuffer = vulkanCommandBuffer->transferBuffers[vulkanCommandBuffer->transferBufferCount - 1];
|
|
||||||
|
|
||||||
transferBufferPointer =
|
|
||||||
transferBuffer->buffer->allocation->mapPointer +
|
|
||||||
transferBuffer->buffer->offset +
|
|
||||||
transferBuffer->offset;
|
|
||||||
|
|
||||||
SDL_memcpy(
|
|
||||||
transferBufferPointer,
|
|
||||||
data,
|
|
||||||
dataLength
|
|
||||||
);
|
|
||||||
|
|
||||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
|
||||||
renderer,
|
|
||||||
vulkanCommandBuffer->commandBuffer,
|
|
||||||
RESOURCE_ACCESS_TRANSFER_READ,
|
|
||||||
transferBuffer->buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
|
||||||
renderer,
|
|
||||||
vulkanCommandBuffer->commandBuffer,
|
|
||||||
RESOURCE_ACCESS_TRANSFER_WRITE,
|
|
||||||
vulkanBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
bufferCopy.srcOffset = transferBuffer->offset;
|
|
||||||
bufferCopy.dstOffset = offsetInBytes;
|
|
||||||
bufferCopy.size = (VkDeviceSize) dataLength;
|
|
||||||
|
|
||||||
renderer->vkCmdCopyBuffer(
|
|
||||||
vulkanCommandBuffer->commandBuffer,
|
|
||||||
transferBuffer->buffer->buffer,
|
|
||||||
vulkanBuffer->buffer,
|
|
||||||
1,
|
|
||||||
&bufferCopy
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (setDataOption == REFRESH_SETDATAOPTIONS_IMMEDIATE)
|
|
||||||
{
|
|
||||||
VULKAN_INTERNAL_SetBufferData(
|
|
||||||
vulkanBuffer,
|
|
||||||
offsetInBytes,
|
|
||||||
data,
|
|
||||||
dataLength
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Refresh_LogError("Unrecognized Refresh_SetDataOptions value!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_MaybeExpandTransferBuffer(
|
||||||
|
renderer,
|
||||||
|
vulkanCommandBuffer,
|
||||||
|
dataLength
|
||||||
|
);
|
||||||
|
|
||||||
|
transferBuffer = vulkanCommandBuffer->transferBuffers[vulkanCommandBuffer->transferBufferCount - 1];
|
||||||
|
|
||||||
|
transferBufferPointer =
|
||||||
|
transferBuffer->buffer->allocation->mapPointer +
|
||||||
|
transferBuffer->buffer->offset +
|
||||||
|
transferBuffer->offset;
|
||||||
|
|
||||||
|
SDL_memcpy(
|
||||||
|
transferBufferPointer,
|
||||||
|
data,
|
||||||
|
dataLength
|
||||||
|
);
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
|
renderer,
|
||||||
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
RESOURCE_ACCESS_TRANSFER_READ,
|
||||||
|
transferBuffer->buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
|
renderer,
|
||||||
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
RESOURCE_ACCESS_TRANSFER_WRITE,
|
||||||
|
vulkanBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
bufferCopy.srcOffset = transferBuffer->offset;
|
||||||
|
bufferCopy.dstOffset = offsetInBytes;
|
||||||
|
bufferCopy.size = (VkDeviceSize) dataLength;
|
||||||
|
|
||||||
|
renderer->vkCmdCopyBuffer(
|
||||||
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
transferBuffer->buffer->buffer,
|
||||||
|
vulkanBuffer->buffer,
|
||||||
|
1,
|
||||||
|
&bufferCopy
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: this should return uint64_t */
|
/* FIXME: this should return uint64_t */
|
||||||
|
|
Loading…
Reference in New Issue