From 80914e9c38d9521da0248814c54a18f7d0e30616 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 15 Feb 2024 16:48:26 -0800 Subject: [PATCH] add command buffer to Pass functions --- include/Refresh.h | 20 ++++++++++++++++---- src/Refresh.c | 24 ++++++++++++++++-------- src/Refresh_Driver.h | 12 ++++++++---- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/include/Refresh.h b/include/Refresh.h index 71de283..a527c63 100644 --- a/include/Refresh.h +++ b/include/Refresh.h @@ -980,7 +980,10 @@ REFRESHAPI void Refresh_EndRenderPass( /* Compute Pass */ /* Begins a compute pass. */ -REFRESHAPI void Refresh_BeginComputePass(Refresh_Device *device); +REFRESHAPI void Refresh_BeginComputePass( + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer +); /* Binds a compute pipeline to the compute bind point. */ REFRESHAPI void Refresh_BindComputePipeline( @@ -1053,7 +1056,10 @@ REFRESHAPI void Refresh_DispatchCompute( ); /* Ends the current compute pass. */ -REFRESHAPI void Refresh_EndComputePass(Refresh_Device *device); +REFRESHAPI void Refresh_EndComputePass( + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer +); /* CpuBuffer Map */ @@ -1078,7 +1084,10 @@ REFRESHAPI void Refresh_UnmapCpuBuffer( /* Copy Pass */ /* Begins a copy pass. */ -REFRESHAPI void Refresh_BeginCopyPass(Refresh_Device *device); +REFRESHAPI void Refresh_BeginCopyPass( + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer +); /* CPU-to-GPU copies occur on the GPU timeline. * @@ -1176,7 +1185,10 @@ REFRESHAPI void Refresh_GenerateMipmaps( Refresh_Texture *texture ); -REFRESHAPI void Refresh_EndCopyPass(Refresh_Device *device); +REFRESHAPI void Refresh_EndCopyPass( + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer +); /* Ends a copy pass. */ diff --git a/src/Refresh.c b/src/Refresh.c index 55f741d..d5c24fc 100644 --- a/src/Refresh.c +++ b/src/Refresh.c @@ -652,11 +652,13 @@ void Refresh_EndRenderPass( /* Compute Pass */ void Refresh_BeginComputePass( - Refresh_Device *device + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer ) { NULL_RETURN(device); device->BeginComputePass( - device->driverData + device->driverData, + commandBuffer ); } @@ -736,11 +738,13 @@ void Refresh_DispatchCompute( } void Refresh_EndComputePass( - Refresh_Device *device + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer ) { NULL_RETURN(device); device->EndComputePass( - device->driverData + device->driverData, + commandBuffer ); } @@ -775,11 +779,13 @@ void Refresh_UnmapCpuBuffer( /* Copy Pass */ void Refresh_BeginCopyPass( - Refresh_Device *device + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer ) { NULL_RETURN(device); device->BeginCopyPass( - device->driverData + device->driverData, + commandBuffer ); } @@ -931,11 +937,13 @@ void Refresh_GenerateMipmaps( } void Refresh_EndCopyPass( - Refresh_Device *device + Refresh_Device *device, + Refresh_CommandBuffer *commandBuffer ) { NULL_RETURN(device); device->EndCopyPass( - device->driverData + device->driverData, + commandBuffer ); } diff --git a/src/Refresh_Driver.h b/src/Refresh_Driver.h index 426eb46..2514efa 100644 --- a/src/Refresh_Driver.h +++ b/src/Refresh_Driver.h @@ -378,7 +378,8 @@ struct Refresh_Device /* Compute Pass */ void (*BeginComputePass)( - Refresh_Renderer *driverData + Refresh_Renderer *driverData, + Refresh_CommandBuffer *commandBuffer ); void (*BindComputePipeline)( @@ -417,7 +418,8 @@ struct Refresh_Device ); void (*EndComputePass)( - Refresh_Renderer *driverData + Refresh_Renderer *driverData, + Refresh_CommandBuffer *commandBuffer ); /* CpuBuffer map/unmap */ @@ -437,7 +439,8 @@ struct Refresh_Device /* Copy Pass */ void (*BeginCopyPass)( - Refresh_Renderer *driverData + Refresh_Renderer *driverData, + Refresh_CommandBuffer *commandBuffer ); void (*UploadToTexture)( @@ -510,7 +513,8 @@ struct Refresh_Device ); void (*EndCopyPass)( - Refresh_Renderer *driverData + Refresh_Renderer *driverData, + Refresh_CommandBuffer *commandBuffer ); /* Submission/Presentation */