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