command buffer basic lifecycle

This commit is contained in:
Gregory Wells
2025-08-12 23:56:35 -04:00
parent 5b43e3d5be
commit 8fc99079dc
3 changed files with 38 additions and 1 deletions

View File

@@ -3,6 +3,24 @@
gnCommandFunctions loadOpenGLCommandFunctions() {
return (gnCommandFunctions) {
._gnCommandPoolAllocateCommandBuffers = openglCommandPoolAllocateCommandBuffers
._gnCommandPoolAllocateCommandBuffers = openglCommandPoolAllocateCommandBuffers,
._gnBeginCommandBuffer = openglBeginCommandBuffer,
._gnResetCommandBuffer = openglResetCommandBuffer,
._gnEndCommandBuffer = openglEndCommandBuffer,
._gnDestroyCommandBuffer = openglDestroyCommandBuffer,
._gnCommandBeginRenderPass = NULL,
._gnCommandEndRenderPass = NULL,
._gnCommandBindGraphicsPipeline = NULL,
._gnCommandSetViewport = NULL,
._gnCommandSetScissor = NULL,
._gnCommandBindUniform = NULL,
._gnCommandPushConstant = NULL,
._gnCommandBindBuffer = NULL,
._gnCommandDraw = NULL,
._gnCommandDrawIndexed = NULL,
};
}

View File

@@ -20,3 +20,17 @@ gnReturnCode openglCommandPoolAllocateCommandBuffers(gnCommandBufferHandle* comm
return GN_SUCCESS;
}
void openglResetCommandBuffer(gnCommandBuffer commandBuffer) {
// commandBuffer->commandBuffer->
// nothing, for now command buffers are implictly reset on begin
}
gnReturnCode openglBeginCommandBuffer(gnCommandBuffer commandBuffer) {
return GN_SUCCESS;
}
gnReturnCode openglEndCommandBuffer(gnCommandBuffer commandBuffer) {
return GN_SUCCESS;
}
void openglDestroyCommandBuffer(gnCommandBuffer commandBuffer) {
commandBuffer->commandPool->commandPool->canBeReallocated[commandBuffer->commandBuffer->index] = GN_TRUE;
}

View File

@@ -5,3 +5,8 @@ typedef struct gnPlatformCommandBuffer_t {
int index;
} gnPlatformCommandBuffer;
gnReturnCode openglCommandPoolAllocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPoolHandle pool);
void openglResetCommandBuffer(gnCommandBuffer commandBuffer);
gnReturnCode openglBeginCommandBuffer(gnCommandBuffer commandBuffer);
gnReturnCode openglEndCommandBuffer(gnCommandBuffer commandBuffer);
void openglDestroyCommandBuffer(gnCommandBuffer commandBuffer);