started exposing command buffers

submit_rewrite
cosmonaut 2021-01-01 22:07:15 -08:00 committed by thatcosmonaut
parent 5f00941900
commit c818e332e7
4 changed files with 481 additions and 339 deletions

View File

@ -66,6 +66,7 @@ typedef struct REFRESH_ShaderModule REFRESH_ShaderModule;
typedef struct REFRESH_RenderPass REFRESH_RenderPass;
typedef struct REFRESH_ComputePipeline REFRESH_ComputePipeline;
typedef struct REFRESH_GraphicsPipeline REFRESH_GraphicsPipeline;
typedef struct REFRESH_CommandBuffer REFRESH_CommandBuffer;
typedef enum REFRESH_PresentMode
{
@ -1349,6 +1350,23 @@ REFRESHAPI void REFRESH_BindComputeTextures(
/* Submission/Presentation */
/* Returns an allocated REFRESH_CommandBuffer* object.
*
* NOTE:
* A command buffer may only be used on the thread that
* it was acquired on. Using it on any other thread is an error.
*
* fixed:
* If a command buffer is designated as fixed, it can be
* acquired once, have commands recorded into it, and
* be re-submitted indefinitely.
*
*/
REFRESHAPI REFRESH_CommandBuffer* REFRESH_AcquireCommandBuffer(
REFRESH_Device *device,
uint8_t fixed
);
/* Queues an image to be presented to the screen.
* The image will be presented upon the next REFRESH_Submit call.
*

View File

@ -885,6 +885,17 @@ void REFRESH_BindComputeTextures(
);
}
REFRESH_CommandBuffer* REFRESH_AcquireCommandBuffer(
REFRESH_Device *device,
uint8_t fixed
) {
NULL_RETURN_NULL(device);
return device->AcquireCommandBuffer(
device->driverData,
fixed
);
}
void REFRESH_QueuePresent(
REFRESH_Device *device,
REFRESH_TextureSlice* textureSlice,

View File

@ -523,6 +523,11 @@ struct REFRESH_Device
REFRESH_Texture **pTextures
);
REFRESH_CommandBuffer* (*AcquireCommandBuffer)(
REFRESH_Renderer *driverData,
uint8_t fixed
);
void(*QueuePresent)(
REFRESH_Renderer *driverData,
REFRESH_TextureSlice *textureSlice,
@ -590,6 +595,7 @@ struct REFRESH_Device
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
ASSIGN_DRIVER_FUNC(QueuePresent, name) \
ASSIGN_DRIVER_FUNC(Submit, name)

File diff suppressed because it is too large Load Diff