From 2f57a05c85dbf4380ca264d140769661877e0a93 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 23 Feb 2024 09:42:31 -0800 Subject: [PATCH] rename CpuBuffer to TransferBuffer --- include/Refresh.h | 42 +++++++++++++++++++++--------------------- src/Refresh.c | 36 ++++++++++++++++++------------------ src/Refresh_Driver.h | 24 ++++++++++++------------ 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/include/Refresh.h b/include/Refresh.h index ac67892..aeeba81 100644 --- a/include/Refresh.h +++ b/include/Refresh.h @@ -70,7 +70,7 @@ REFRESHAPI uint32_t Refresh_LinkedVersion(void); typedef struct Refresh_Device Refresh_Device; typedef struct Refresh_GpuBuffer Refresh_GpuBuffer; -typedef struct Refresh_CpuBuffer Refresh_CpuBuffer; +typedef struct Refresh_TransferBuffer Refresh_TransferBuffer; typedef struct Refresh_Texture Refresh_Texture; typedef struct Refresh_Sampler Refresh_Sampler; typedef struct Refresh_ShaderModule Refresh_ShaderModule; @@ -688,11 +688,11 @@ REFRESHAPI Refresh_GpuBuffer* Refresh_CreateGpuBuffer( uint32_t sizeInBytes ); -/* Creates a CpuBuffer. +/* Creates a TransferBuffer. * * sizeInBytes: The length of the buffer. */ -REFRESHAPI Refresh_CpuBuffer* Refresh_CreateCpuBuffer( +REFRESHAPI Refresh_TransferBuffer* Refresh_CreateTransferBuffer( Refresh_Device *device, uint32_t sizeInBytes ); @@ -736,11 +736,11 @@ REFRESHAPI void Refresh_QueueDestroyGpuBuffer( /* Sends a buffer to be destroyed by the renderer. Note that we call it * "QueueDestroy" because it may not be immediately destroyed by the renderer. * - * buffer: The Refresh_CpuBuffer to be destroyed. + * buffer: The Refresh_TransferBuffer to be destroyed. */ -REFRESHAPI void Refresh_QueueDestroyCpuBuffer( +REFRESHAPI void Refresh_QueueDestroyTransferBuffer( Refresh_Device *device, - Refresh_CpuBuffer *buffer + Refresh_TransferBuffer *buffer ); /* Sends a shader module to be destroyed by the renderer. Note that we call it @@ -1049,16 +1049,16 @@ REFRESHAPI void Refresh_EndComputePass( Refresh_CommandBuffer *commandBuffer ); -/* CpuBuffer Set/Get */ +/* TransferBuffer Set/Get */ -/* Immediately copies data from a pointer into a CpuBuffer. +/* Immediately copies data from a pointer into a TransferBuffer. * * option: * SAFEDISCARD: - * If this CpuBuffer has been used in a copy command that has not completed, + * 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 CpuBuffers. + * It is not recommended to use this option with large TransferBuffers. * * OVERWRITE: * Overwrites the data regardless of whether a copy has been issued. @@ -1067,15 +1067,15 @@ REFRESHAPI void Refresh_EndComputePass( REFRESHAPI void Refresh_SetData( Refresh_Device *device, void* data, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferCopy *copyParams, Refresh_SetDataOptions option ); -/* Immediately copies data from a CpuBuffer into a pointer. */ +/* Immediately copies data from a TransferBuffer into a pointer. */ REFRESHAPI void Refresh_GetData( Refresh_Device *device, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, void* data, Refresh_BufferCopy *copyParams ); @@ -1093,36 +1093,36 @@ REFRESHAPI void Refresh_BeginCopyPass( * You MAY assume that the copy has finished for subsequent commands. */ -/* Uploads data from a CpuBuffer to a texture. */ +/* Uploads data from a TransferBuffer to a texture. */ REFRESHAPI void Refresh_UploadToTexture( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_TextureSlice *textureSlice, Refresh_BufferImageCopy *copyParams ); -/* Uploads data from a CpuBuffer to a GpuBuffer. */ +/* Uploads data from a TransferBuffer to a GpuBuffer. */ REFRESHAPI void Refresh_UploadToBuffer( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_GpuBuffer *gpuBuffer, Refresh_BufferCopy *copyParams ); /* GPU-to-CPU copies occur on the GPU timeline. * - * You may NOT assume that the data in the CpuBuffer is fully copied + * You may NOT assume that the data in the TransferBuffer is fully copied * until the command buffer has finished execution. */ -/* Downloads data from a texture to a CpuBuffer. */ +/* Downloads data from a texture to a TransferBuffer. */ REFRESHAPI void Refresh_DownloadFromTexture( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, Refresh_TextureSlice *textureSlice, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferImageCopy *copyParams ); @@ -1131,7 +1131,7 @@ REFRESHAPI void Refresh_DownloadFromBuffer( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, Refresh_GpuBuffer *gpuBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferCopy *copyParams ); diff --git a/src/Refresh.c b/src/Refresh.c index c6b8de1..b4fb534 100644 --- a/src/Refresh.c +++ b/src/Refresh.c @@ -308,12 +308,12 @@ Refresh_GpuBuffer* Refresh_CreateGpuBuffer( ); } -Refresh_CpuBuffer* Refresh_CreateCpuBuffer( +Refresh_TransferBuffer* Refresh_CreateTransferBuffer( Refresh_Device *device, uint32_t sizeInBytes ) { NULL_RETURN_NULL(device); - return device->CreateCpuBuffer( + return device->CreateTransferBuffer( device->driverData, sizeInBytes ); @@ -354,12 +354,12 @@ void Refresh_QueueDestroyGpuBuffer( ); } -void Refresh_QueueDestroyCpuBuffer( +void Refresh_QueueDestroyTransferBuffer( Refresh_Device *device, - Refresh_CpuBuffer *buffer + Refresh_TransferBuffer *buffer ) { NULL_RETURN(device); - device->QueueDestroyCpuBuffer( + device->QueueDestroyTransferBuffer( device->driverData, buffer ); @@ -730,12 +730,12 @@ void Refresh_EndComputePass( ); } -/* CpuBuffer Set/Get */ +/* TransferBuffer Set/Get */ void Refresh_SetData( Refresh_Device *device, void* data, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferCopy *copyParams, Refresh_SetDataOptions option ) { @@ -743,7 +743,7 @@ void Refresh_SetData( device->SetData( device->driverData, data, - cpuBuffer, + transferBuffer, copyParams, option ); @@ -751,14 +751,14 @@ void Refresh_SetData( void Refresh_GetData( Refresh_Device *device, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, void* data, Refresh_BufferCopy *copyParams ) { NULL_RETURN(device); device->GetData( device->driverData, - cpuBuffer, + transferBuffer, data, copyParams ); @@ -780,7 +780,7 @@ void Refresh_BeginCopyPass( void Refresh_UploadToTexture( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_TextureSlice *textureSlice, Refresh_BufferImageCopy *copyParams ) { @@ -788,7 +788,7 @@ void Refresh_UploadToTexture( device->UploadToTexture( device->driverData, commandBuffer, - cpuBuffer, + transferBuffer, textureSlice, copyParams ); @@ -797,7 +797,7 @@ void Refresh_UploadToTexture( void Refresh_UploadToBuffer( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_GpuBuffer *gpuBuffer, Refresh_BufferCopy *copyParams ) { @@ -805,7 +805,7 @@ void Refresh_UploadToBuffer( device->UploadToBuffer( device->driverData, commandBuffer, - cpuBuffer, + transferBuffer, gpuBuffer, copyParams ); @@ -815,7 +815,7 @@ void Refresh_DownloadFromTexture( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, Refresh_TextureSlice *textureSlice, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferImageCopy *copyParams ) { NULL_RETURN(device); @@ -823,7 +823,7 @@ void Refresh_DownloadFromTexture( device->driverData, commandBuffer, textureSlice, - cpuBuffer, + transferBuffer, copyParams ); } @@ -832,7 +832,7 @@ void Refresh_DownloadFromBuffer( Refresh_Device *device, Refresh_CommandBuffer *commandBuffer, Refresh_GpuBuffer *gpuBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferCopy *copyParams ) { NULL_RETURN(device); @@ -840,7 +840,7 @@ void Refresh_DownloadFromBuffer( device->driverData, commandBuffer, gpuBuffer, - cpuBuffer, + transferBuffer, copyParams ); } diff --git a/src/Refresh_Driver.h b/src/Refresh_Driver.h index 3809af4..5c5ed14 100644 --- a/src/Refresh_Driver.h +++ b/src/Refresh_Driver.h @@ -214,7 +214,7 @@ struct Refresh_Device uint32_t sizeInBytes ); - Refresh_CpuBuffer* (*CreateCpuBuffer)( + Refresh_TransferBuffer* (*CreateTransferBuffer)( Refresh_Renderer *driverData, uint32_t sizeInBytes ); @@ -236,9 +236,9 @@ struct Refresh_Device Refresh_GpuBuffer *buffer ); - void (*QueueDestroyCpuBuffer)( + void (*QueueDestroyTransferBuffer)( Refresh_Renderer *driverData, - Refresh_CpuBuffer *buffer + Refresh_TransferBuffer *buffer ); void (*QueueDestroyShaderModule)( @@ -413,19 +413,19 @@ struct Refresh_Device Refresh_CommandBuffer *commandBuffer ); - /* CpuBuffer Set/Get */ + /* TransferBuffer Set/Get */ void (*SetData)( Refresh_Renderer *driverData, void* data, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferCopy *copyParams, Refresh_SetDataOptions option ); void (*GetData)( Refresh_Renderer *driverData, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, void* data, Refresh_BufferCopy *copyParams ); @@ -440,7 +440,7 @@ struct Refresh_Device void (*UploadToTexture)( Refresh_Renderer *driverData, Refresh_CommandBuffer *commandBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_TextureSlice *textureSlice, Refresh_BufferImageCopy *copyParams ); @@ -448,7 +448,7 @@ struct Refresh_Device void (*UploadToBuffer)( Refresh_Renderer *driverData, Refresh_CommandBuffer *commandBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_GpuBuffer *gpuBuffer, Refresh_BufferCopy *copyParams ); @@ -457,7 +457,7 @@ struct Refresh_Device Refresh_Renderer *driverData, Refresh_CommandBuffer *commandBuffer, Refresh_TextureSlice *textureSlice, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferImageCopy *copyParams ); @@ -465,7 +465,7 @@ struct Refresh_Device Refresh_Renderer *driverData, Refresh_CommandBuffer *commandBuffer, Refresh_GpuBuffer *gpuBuffer, - Refresh_CpuBuffer *cpuBuffer, + Refresh_TransferBuffer *transferBuffer, Refresh_BufferCopy *copyParams ); @@ -592,11 +592,11 @@ struct Refresh_Device ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \ ASSIGN_DRIVER_FUNC(CreateTexture, name) \ ASSIGN_DRIVER_FUNC(CreateGpuBuffer, name) \ - ASSIGN_DRIVER_FUNC(CreateCpuBuffer, name) \ + ASSIGN_DRIVER_FUNC(CreateTransferBuffer, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \ ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyGpuBuffer, name) \ - ASSIGN_DRIVER_FUNC(QueueDestroyCpuBuffer, name) \ + ASSIGN_DRIVER_FUNC(QueueDestroyTransferBuffer, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \