From c44a095bca36ba44be27a696a2f84700a438c1bb Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 16 Feb 2024 18:53:52 -0800 Subject: [PATCH] CreateCpuBuffer writes a data pointer --- include/Refresh.h | 4 +++- src/Refresh.c | 6 ++++-- src/Refresh_Driver.h | 5 ++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/Refresh.h b/include/Refresh.h index 47d5058..44157db 100644 --- a/include/Refresh.h +++ b/include/Refresh.h @@ -685,10 +685,12 @@ REFRESHAPI Refresh_GpuBuffer* Refresh_CreateGpuBuffer( /* Creates a CpuBuffer. * * sizeInBytes: The length of the buffer. + * pDataPtr: On success, contains a pointer that can be used to copy to/from the buffer. */ REFRESHAPI Refresh_CpuBuffer* Refresh_CreateCpuBuffer( Refresh_Device *device, - uint32_t sizeInBytes + uint32_t sizeInBytes, + void **pDataPtr ); /* Disposal */ diff --git a/src/Refresh.c b/src/Refresh.c index 7ec0e77..300b908 100644 --- a/src/Refresh.c +++ b/src/Refresh.c @@ -310,12 +310,14 @@ Refresh_GpuBuffer* Refresh_CreateGpuBuffer( Refresh_CpuBuffer* Refresh_CreateCpuBuffer( Refresh_Device *device, - uint32_t sizeInBytes + uint32_t sizeInBytes, + void **pDataPtr ) { NULL_RETURN_NULL(device); return device->CreateCpuBuffer( device->driverData, - sizeInBytes + sizeInBytes, + pDataPtr ); } diff --git a/src/Refresh_Driver.h b/src/Refresh_Driver.h index 4e9c683..80efbfa 100644 --- a/src/Refresh_Driver.h +++ b/src/Refresh_Driver.h @@ -216,7 +216,8 @@ struct Refresh_Device Refresh_CpuBuffer* (*CreateCpuBuffer)( Refresh_Renderer *driverData, - uint32_t sizeInBytes + uint32_t sizeInBytes, + void **pDataPtr ); /* Disposal */ @@ -605,8 +606,6 @@ struct Refresh_Device ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \ ASSIGN_DRIVER_FUNC(DispatchCompute, name) \ ASSIGN_DRIVER_FUNC(EndComputePass, name) \ - ASSIGN_DRIVER_FUNC(MapCpuBuffer, name) \ - ASSIGN_DRIVER_FUNC(UnmapCpuBuffer, name) \ ASSIGN_DRIVER_FUNC(BeginCopyPass, name) \ ASSIGN_DRIVER_FUNC(UploadToTexture, name) \ ASSIGN_DRIVER_FUNC(UploadToBuffer, name) \