implement transfer queue

submit_rewrite
cosmonaut 2021-01-02 13:31:17 -08:00 committed by thatcosmonaut
parent c818e332e7
commit e0ff380989
4 changed files with 406 additions and 151 deletions

View File

@ -658,6 +658,7 @@ REFRESHAPI void REFRESH_DestroyDevice(REFRESH_Device *device);
*/
REFRESHAPI void REFRESH_Clear(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Rect *clearRect,
REFRESH_ClearOptions options,
REFRESH_Color *colors,
@ -681,6 +682,7 @@ REFRESHAPI void REFRESH_Clear(
*/
REFRESHAPI void REFRESH_DrawInstancedPrimitives(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
@ -707,6 +709,7 @@ REFRESHAPI void REFRESH_DrawInstancedPrimitives(
*/
REFRESHAPI void REFRESH_DrawIndexedPrimitives(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
@ -727,6 +730,7 @@ REFRESHAPI void REFRESH_DrawIndexedPrimitives(
*/
REFRESHAPI void REFRESH_DrawPrimitives(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t vertexStart,
uint32_t primitiveCount,
uint32_t vertexParamOffset,
@ -742,6 +746,7 @@ REFRESHAPI void REFRESH_DrawPrimitives(
*/
REFRESHAPI void REFRESH_DispatchCompute(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t groupCountX,
uint32_t groupCountY,
uint32_t groupCountZ,
@ -895,7 +900,7 @@ REFRESHAPI REFRESH_Buffer* REFRESH_CreateBuffer(
* dataLength: The size of the image data in bytes.
*/
REFRESHAPI void REFRESH_SetTextureData2D(
REFRESH_Device *device,
REFRESH_Device *driverData,
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
@ -920,7 +925,7 @@ REFRESHAPI void REFRESH_SetTextureData2D(
* dataLength: The size of the image data in bytes.
*/
REFRESHAPI void REFRESH_SetTextureData3D(
REFRESH_Device *device,
REFRESH_Device *driverData,
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
@ -946,7 +951,7 @@ REFRESHAPI void REFRESH_SetTextureData3D(
* dataLength: The size of the image data in bytes.
*/
REFRESHAPI void REFRESH_SetTextureDataCube(
REFRESH_Device *device,
REFRESH_Device *driverData,
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
@ -971,7 +976,7 @@ REFRESHAPI void REFRESH_SetTextureDataCube(
* dataLength: The size of the image data in bytes.
*/
REFRESHAPI void REFRESH_SetTextureDataYUV(
REFRESH_Device *device,
REFRESH_Device *driverData,
REFRESH_Texture *y,
REFRESH_Texture *u,
REFRESH_Texture *v,
@ -1014,6 +1019,7 @@ REFRESHAPI void REFRESH_SetBufferData(
*/
REFRESHAPI uint32_t REFRESH_PushVertexShaderParams(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t paramBlockCount
);
@ -1030,6 +1036,7 @@ REFRESHAPI uint32_t REFRESH_PushVertexShaderParams(
*/
REFRESHAPI uint32_t REFRESH_PushFragmentShaderParams(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t paramBlockCount
);
@ -1046,6 +1053,7 @@ REFRESHAPI uint32_t REFRESH_PushFragmentShaderParams(
*/
REFRESHAPI uint32_t REFRESH_PushComputeShaderParams(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t paramBlockCount
);
@ -1061,6 +1069,7 @@ REFRESHAPI uint32_t REFRESH_PushComputeShaderParams(
*/
REFRESHAPI void REFRESH_SetVertexSamplers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
);
@ -1076,6 +1085,7 @@ REFRESHAPI void REFRESH_SetVertexSamplers(
*/
REFRESHAPI void REFRESH_SetFragmentSamplers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
);
@ -1284,6 +1294,7 @@ REFRESHAPI void REFRESH_AddDisposeGraphicsPipeline(
*/
REFRESHAPI void REFRESH_BeginRenderPass(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_RenderPass *renderPass,
REFRESH_Framebuffer *framebuffer,
REFRESH_Rect renderArea,
@ -1294,18 +1305,21 @@ REFRESHAPI void REFRESH_BeginRenderPass(
/* Ends the current render pass. */
REFRESHAPI void REFRESH_EndRenderPass(
REFRESH_Device *device
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer
);
/* Binds a graphics pipeline to the graphics bind point. */
REFRESHAPI void REFRESH_BindGraphicsPipeline(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_GraphicsPipeline *graphicsPipeline
);
/* Binds vertex buffers for use with subsequent draw calls. */
REFRESHAPI void REFRESH_BindVertexBuffers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
REFRESH_Buffer **pBuffers,
@ -1315,6 +1329,7 @@ REFRESHAPI void REFRESH_BindVertexBuffers(
/* Binds an index buffer for use with subsequent draw calls. */
REFRESHAPI void REFRESH_BindIndexBuffer(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Buffer *buffer,
uint64_t offset,
REFRESH_IndexElementSize indexElementSize
@ -1323,6 +1338,7 @@ REFRESHAPI void REFRESH_BindIndexBuffer(
/* Binds a compute pipeline to the compute bind point. */
REFRESHAPI void REFRESH_BindComputePipeline(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_ComputePipeline *computePipeline
);
@ -1334,6 +1350,7 @@ REFRESHAPI void REFRESH_BindComputePipeline(
*/
REFRESHAPI void REFRESH_BindComputeBuffers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Buffer **pBuffers
);
@ -1345,6 +1362,7 @@ REFRESHAPI void REFRESH_BindComputeBuffers(
*/
REFRESHAPI void REFRESH_BindComputeTextures(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures
);
@ -1379,6 +1397,7 @@ REFRESHAPI REFRESH_CommandBuffer* REFRESH_AcquireCommandBuffer(
*/
REFRESHAPI void REFRESH_QueuePresent(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *textureSlice,
REFRESH_Rect *sourceRectangle,
REFRESH_Rect *destinationRectangle
@ -1386,7 +1405,9 @@ REFRESHAPI void REFRESH_QueuePresent(
/* Submits all of the enqueued commands. */
REFRESHAPI void REFRESH_Submit(
REFRESH_Device* device
REFRESH_Device* device,
REFRESH_CommandBuffer **pCommandBuffers,
uint32_t commandBufferCount
);
#ifdef __cplusplus

View File

@ -148,7 +148,8 @@ void REFRESH_DestroyDevice(REFRESH_Device *device)
}
void REFRESH_Clear(
REFRESH_Device *device,
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Rect *clearRect,
REFRESH_ClearOptions options,
REFRESH_Color *colors,
@ -159,6 +160,7 @@ void REFRESH_Clear(
NULL_RETURN(device);
device->Clear(
device->driverData,
commandBuffer,
clearRect,
options,
colors,
@ -170,6 +172,7 @@ void REFRESH_Clear(
void REFRESH_DrawIndexedPrimitives(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
@ -183,6 +186,7 @@ void REFRESH_DrawIndexedPrimitives(
NULL_RETURN(device);
device->DrawIndexedPrimitives(
device->driverData,
commandBuffer,
baseVertex,
minVertexIndex,
numVertices,
@ -197,6 +201,7 @@ void REFRESH_DrawIndexedPrimitives(
void REFRESH_DrawInstancedPrimitives(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
@ -211,6 +216,7 @@ void REFRESH_DrawInstancedPrimitives(
NULL_RETURN(device);
device->DrawInstancedPrimitives(
device->driverData,
commandBuffer,
baseVertex,
minVertexIndex,
numVertices,
@ -226,6 +232,7 @@ void REFRESH_DrawInstancedPrimitives(
void REFRESH_DrawPrimitives(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t vertexStart,
uint32_t primitiveCount,
uint32_t vertexParamOffset,
@ -234,6 +241,7 @@ void REFRESH_DrawPrimitives(
NULL_RETURN(device);
device->DrawPrimitives(
device->driverData,
commandBuffer,
vertexStart,
primitiveCount,
vertexParamOffset,
@ -243,6 +251,7 @@ void REFRESH_DrawPrimitives(
void REFRESH_DispatchCompute(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t groupCountX,
uint32_t groupCountY,
uint32_t groupCountZ,
@ -251,6 +260,7 @@ void REFRESH_DispatchCompute(
NULL_RETURN(device);
device->DispatchCompute(
device->driverData,
commandBuffer,
groupCountX,
groupCountY,
groupCountZ,
@ -549,12 +559,14 @@ void REFRESH_SetBufferData(
uint32_t REFRESH_PushVertexShaderParams(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t elementCount
) {
if (device == NULL) { return 0; }
return device->PushVertexShaderParams(
device->driverData,
commandBuffer,
data,
elementCount
);
@ -562,12 +574,14 @@ uint32_t REFRESH_PushVertexShaderParams(
uint32_t REFRESH_PushFragmentShaderParams(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t elementCount
) {
if (device == NULL) { return 0; }
return device->PushFragmentShaderParams(
device->driverData,
commandBuffer,
data,
elementCount
);
@ -575,12 +589,14 @@ uint32_t REFRESH_PushFragmentShaderParams(
uint32_t REFRESH_PushComputeShaderParams(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t elementCount
) {
if (device == NULL) { return 0; }
return device->PushComputeShaderParams(
device->driverData,
commandBuffer,
data,
elementCount
);
@ -588,12 +604,14 @@ uint32_t REFRESH_PushComputeShaderParams(
void REFRESH_SetVertexSamplers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
) {
NULL_RETURN(device);
device->SetVertexSamplers(
device->driverData,
commandBuffer,
pTextures,
pSamplers
);
@ -601,12 +619,14 @@ void REFRESH_SetVertexSamplers(
void REFRESH_SetFragmentSamplers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
) {
NULL_RETURN(device);
device->SetFragmentSamplers(
device->driverData,
commandBuffer,
pTextures,
pSamplers
);
@ -783,6 +803,7 @@ void REFRESH_AddDisposeGraphicsPipeline(
void REFRESH_BeginRenderPass(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_RenderPass *renderPass,
REFRESH_Framebuffer *framebuffer,
REFRESH_Rect renderArea,
@ -793,6 +814,7 @@ void REFRESH_BeginRenderPass(
NULL_RETURN(device);
device->BeginRenderPass(
device->driverData,
commandBuffer,
renderPass,
framebuffer,
renderArea,
@ -803,25 +825,32 @@ void REFRESH_BeginRenderPass(
}
void REFRESH_EndRenderPass(
REFRESH_Device *device
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer
) {
NULL_RETURN(device);
device->EndRenderPass(device->driverData);
device->EndRenderPass(
device->driverData,
commandBuffer
);
}
void REFRESH_BindGraphicsPipeline(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_GraphicsPipeline *graphicsPipeline
) {
NULL_RETURN(device);
device->BindGraphicsPipeline(
device->driverData,
commandBuffer,
graphicsPipeline
);
}
void REFRESH_BindVertexBuffers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
REFRESH_Buffer **pBuffers,
@ -830,6 +859,7 @@ void REFRESH_BindVertexBuffers(
NULL_RETURN(device);
device->BindVertexBuffers(
device->driverData,
commandBuffer,
firstBinding,
bindingCount,
pBuffers,
@ -839,6 +869,7 @@ void REFRESH_BindVertexBuffers(
void REFRESH_BindIndexBuffer(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Buffer *buffer,
uint64_t offset,
REFRESH_IndexElementSize indexElementSize
@ -846,6 +877,7 @@ void REFRESH_BindIndexBuffer(
NULL_RETURN(device);
device->BindIndexBuffer(
device->driverData,
commandBuffer,
buffer,
offset,
indexElementSize
@ -854,33 +886,39 @@ void REFRESH_BindIndexBuffer(
void REFRESH_BindComputePipeline(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_ComputePipeline *computePipeline
) {
NULL_RETURN(device);
device->BindComputePipeline(
device->driverData,
commandBuffer,
computePipeline
);
}
void REFRESH_BindComputeBuffers(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Buffer **pBuffers
) {
NULL_RETURN(device);
device->BindComputeBuffers(
device->driverData,
commandBuffer,
pBuffers
);
}
void REFRESH_BindComputeTextures(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures
) {
NULL_RETURN(device);
device->BindComputeTextures(
device->driverData,
commandBuffer,
pTextures
);
}
@ -898,6 +936,7 @@ REFRESH_CommandBuffer* REFRESH_AcquireCommandBuffer(
void REFRESH_QueuePresent(
REFRESH_Device *device,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_TextureSlice* textureSlice,
REFRESH_Rect *sourceRectangle,
REFRESH_Rect *destinationRectangle
@ -905,6 +944,7 @@ void REFRESH_QueuePresent(
NULL_RETURN(device);
device->QueuePresent(
device->driverData,
commandBuffer,
textureSlice,
sourceRectangle,
destinationRectangle
@ -912,11 +952,15 @@ void REFRESH_QueuePresent(
}
void REFRESH_Submit(
REFRESH_Device *device
REFRESH_Device *device,
REFRESH_CommandBuffer **pCommandBuffers,
uint32_t commandBufferCount
) {
NULL_RETURN(device);
device->Submit(
device->driverData
device->driverData,
pCommandBuffers,
commandBufferCount
);
}

View File

@ -169,6 +169,7 @@ struct REFRESH_Device
void (*Clear)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Rect *clearRect,
REFRESH_ClearOptions options,
REFRESH_Color *colors,
@ -179,6 +180,7 @@ struct REFRESH_Device
void (*DrawInstancedPrimitives)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
@ -193,6 +195,7 @@ struct REFRESH_Device
void (*DrawIndexedPrimitives)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
@ -206,6 +209,7 @@ struct REFRESH_Device
void (*DrawPrimitives)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
uint32_t vertexStart,
uint32_t primitiveCount,
uint32_t vertexParamOffset,
@ -214,6 +218,7 @@ struct REFRESH_Device
void (*DispatchCompute)(
REFRESH_Renderer *device,
REFRESH_CommandBuffer *commandBuffer,
uint32_t groupCountX,
uint32_t groupCountY,
uint32_t groupCountZ,
@ -362,30 +367,35 @@ struct REFRESH_Device
uint32_t(*PushVertexShaderParams)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t elementCount
);
uint32_t(*PushFragmentShaderParams)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t elementCount
);
uint32_t (*PushComputeShaderParams)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
void *data,
uint32_t elementCount
);
void(*SetVertexSamplers)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
);
void(*SetFragmentSamplers)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
);
@ -476,6 +486,7 @@ struct REFRESH_Device
void(*BeginRenderPass)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_RenderPass *renderPass,
REFRESH_Framebuffer *framebuffer,
REFRESH_Rect renderArea,
@ -485,16 +496,19 @@ struct REFRESH_Device
);
void(*EndRenderPass)(
REFRESH_Renderer *driverData
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer
);
void(*BindGraphicsPipeline)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_GraphicsPipeline *graphicsPipeline
);
void(*BindVertexBuffers)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
REFRESH_Buffer **pBuffers,
@ -503,6 +517,7 @@ struct REFRESH_Device
void(*BindIndexBuffer)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Buffer *buffer,
uint64_t offset,
REFRESH_IndexElementSize indexElementSize
@ -510,16 +525,19 @@ struct REFRESH_Device
void(*BindComputePipeline)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_ComputePipeline *computePipeline
);
void(*BindComputeBuffers)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Buffer **pBuffers
);
void(*BindComputeTextures)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures
);
@ -530,13 +548,16 @@ struct REFRESH_Device
void(*QueuePresent)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *textureSlice,
REFRESH_Rect *sourceRectangle,
REFRESH_Rect *destinationRectangle
);
void(*Submit)(
REFRESH_Renderer *driverData
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer **pCommandBuffers,
uint32_t commandBufferCount
);
/* Opaque pointer for the Driver */

File diff suppressed because it is too large Load Diff