start rewriting render pass API
continuous-integration/drone/push Build is failing Details

pull/14/head
cosmonaut 2022-02-23 23:48:22 -08:00
parent a3aea0f796
commit 44d510892c
5 changed files with 413 additions and 515 deletions

View File

@ -59,9 +59,7 @@ typedef struct Refresh_Buffer Refresh_Buffer;
typedef struct Refresh_Texture Refresh_Texture;
typedef struct Refresh_Sampler Refresh_Sampler;
typedef struct Refresh_RenderTarget Refresh_RenderTarget;
typedef struct Refresh_Framebuffer Refresh_Framebuffer;
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;
@ -473,30 +471,6 @@ typedef struct Refresh_GraphicsPipelineLayoutCreateInfo
uint32_t fragmentSamplerBindingCount;
} Refresh_GraphicsPipelineLayoutCreateInfo;
typedef struct Refresh_ColorTargetDescription
{
Refresh_TextureFormat format;
Refresh_SampleCount multisampleCount;
Refresh_LoadOp loadOp;
Refresh_StoreOp storeOp;
} Refresh_ColorTargetDescription;
typedef struct Refresh_DepthStencilTargetDescription
{
Refresh_TextureFormat depthStencilFormat;
Refresh_LoadOp loadOp;
Refresh_StoreOp storeOp;
Refresh_LoadOp stencilLoadOp;
Refresh_StoreOp stencilStoreOp;
} Refresh_DepthStencilTargetDescription;
typedef struct Refresh_RenderPassCreateInfo
{
const Refresh_ColorTargetDescription *colorTargetDescriptions;
uint32_t colorTargetCount;
const Refresh_DepthStencilTargetDescription *depthTargetDescription; /* can be NULL */
} Refresh_RenderPassCreateInfo;
typedef struct Refresh_ShaderModuleCreateInfo
{
size_t codeSize;
@ -579,6 +553,19 @@ typedef struct Refresh_ComputePipelineCreateInfo
Refresh_ComputePipelineLayoutCreateInfo pipelineLayoutCreateInfo;
} Refresh_ComputePipelineCreateInfo;
typedef struct Refresh_AttachmentDescription
{
Refresh_TextureFormat format;
Refresh_SampleCount sampleCount;
} Refresh_AttachmentDescription;
typedef struct Refresh_GraphicsPipelineAttachmentInfo
{
Refresh_AttachmentDescription colorAttachmentDescriptions[4];
uint32_t colorAttachmentCount;
Refresh_AttachmentDescription *depthStencilAttachmentDescription; /* Can be NULL */
} Refresh_GraphicsPipelineAttachmentInfo;
typedef struct Refresh_GraphicsPipelineCreateInfo
{
Refresh_ShaderStageState vertexShaderState;
@ -591,18 +578,28 @@ typedef struct Refresh_GraphicsPipelineCreateInfo
Refresh_DepthStencilState depthStencilState;
Refresh_ColorBlendState colorBlendState;
Refresh_GraphicsPipelineLayoutCreateInfo pipelineLayoutCreateInfo;
Refresh_RenderPass *renderPass;
Refresh_GraphicsPipelineAttachmentInfo attachmentInfo;
} Refresh_GraphicsPipelineCreateInfo;
typedef struct Refresh_FramebufferCreateInfo
/* Render pass structures */
typedef struct Refresh_ColorAttachmentInfo
{
Refresh_RenderTarget *pRenderTarget;
Refresh_Vec4 clearColor; /* Can be ignored by RenderPass */
Refresh_LoadOp loadOp;
Refresh_StoreOp storeOp;
} Refresh_ColorAttachmentInfo;
typedef struct Refresh_DepthStencilAttachmentInfo
{
Refresh_RenderPass *renderPass;
Refresh_RenderTarget **pColorTargets;
uint32_t colorTargetCount;
Refresh_RenderTarget *pDepthStencilTarget;
uint32_t width;
uint32_t height;
} Refresh_FramebufferCreateInfo;
Refresh_DepthStencilValue depthStencilValue; /* Can be ignored by RenderPass */
Refresh_LoadOp loadOp;
Refresh_StoreOp storeOp;
Refresh_LoadOp stencilLoadOp;
Refresh_StoreOp stencilStoreOp;
} Refresh_DepthStencilAttachmentInfo;
/* Interop Structs */
@ -802,12 +799,6 @@ REFRESHAPI void Refresh_DispatchCompute(
/* State Creation */
/* Returns an allocated RenderPass* object. */
REFRESHAPI Refresh_RenderPass* Refresh_CreateRenderPass(
Refresh_Device *device,
Refresh_RenderPassCreateInfo *renderPassCreateInfo
);
/* Returns an allocated ComputePipeline* object. */
REFRESHAPI Refresh_ComputePipeline* Refresh_CreateComputePipeline(
Refresh_Device *device,
@ -826,12 +817,6 @@ REFRESHAPI Refresh_Sampler* Refresh_CreateSampler(
Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
);
/* Returns an allocated Framebuffer* object. */
REFRESHAPI Refresh_Framebuffer* Refresh_CreateFramebuffer(
Refresh_Device *device,
Refresh_FramebufferCreateInfo *framebufferCreateInfo
);
/* Returns an allocated ShaderModule* object. */
REFRESHAPI Refresh_ShaderModule* Refresh_CreateShaderModule(
Refresh_Device *device,
@ -1081,19 +1066,6 @@ REFRESHAPI void Refresh_QueueDestroyRenderTarget(
Refresh_RenderTarget *renderTarget
);
/* Sends a framebuffer to be destroyed by the renderer. Note that we call it
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
* this is not called from the main thread (for example, if a garbage collector
* deletes the resource instead of the programmer).
*
* framebuffer: The Refresh_Framebuffer to be destroyed.
*/
REFRESHAPI void Refresh_QueueDestroyFramebuffer(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_Framebuffer *frameBuffer
);
/* Sends a shader module to be destroyed by the renderer. Note that we call it
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
* this is not called from the main thread (for example, if a garbage collector
@ -1107,19 +1079,6 @@ REFRESHAPI void Refresh_QueueDestroyShaderModule(
Refresh_ShaderModule *shaderModule
);
/* Sends a render pass to be destroyed by the renderer. Note that we call it
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
* this is not called from the main thread (for example, if a garbage collector
* deletes the resource instead of the programmer).
*
* renderPass: The Refresh_RenderPass to be destroyed.
*/
REFRESHAPI void Refresh_QueueDestroyRenderPass(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderPass *renderPass
);
/* Sends a compute pipeline to be destroyed by the renderer. Note that we call it
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
* this is not called from the main thread (for example, if a garbage collector
@ -1150,28 +1109,23 @@ REFRESHAPI void Refresh_QueueDestroyGraphicsPipeline(
/* Begins a render pass.
*
* renderPass: The renderpass to begin.
* framebuffer: The framebuffer to bind for the render pass.
* renderArea:
* The area affected by the render pass.
* All load, store and resolve operations are restricted
* to the given rectangle.
* clearValues:
* A pointer to an array of Refresh_Color structures
* that contains clear values for each color target in the
* framebuffer. May be NULL.
* clearCount: The amount of color structs in the above array.
* depthStencilClearValue: The depth/stencil clear value. May be NULL.
* pColorAttachmentInfos:
* A pointer to an array of Refresh_ColorAttachmentInfo structures
* that contains render targets and clear values. May be NULL.
* colorAttachmentCount: The amount of structs in the above array.
* depthStencilAttachmentInfo: The depth/stencil render target and clear value. May be NULL.
*/
REFRESHAPI void Refresh_BeginRenderPass(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderPass *renderPass,
Refresh_Framebuffer *framebuffer,
Refresh_Rect *renderArea,
Refresh_Vec4 *pColorClearValues,
uint32_t colorClearCount,
Refresh_DepthStencilValue *depthStencilClearValue
Refresh_ColorAttachmentInfo *pColorAttachmentInfos,
uint32_t colorAttachmentCount,
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
);
/* Ends the current render pass. */

View File

@ -250,17 +250,6 @@ void Refresh_DispatchCompute(
);
}
Refresh_RenderPass* Refresh_CreateRenderPass(
Refresh_Device *device,
Refresh_RenderPassCreateInfo *renderPassCreateInfo
) {
NULL_RETURN_NULL(device);
return device->CreateRenderPass(
device->driverData,
renderPassCreateInfo
);
}
Refresh_ComputePipeline* Refresh_CreateComputePipeline(
Refresh_Device *device,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
@ -294,17 +283,6 @@ Refresh_Sampler* Refresh_CreateSampler(
);
}
Refresh_Framebuffer* Refresh_CreateFramebuffer(
Refresh_Device *device,
Refresh_FramebufferCreateInfo *framebufferCreateInfo
) {
NULL_RETURN_NULL(device);
return device->CreateFramebuffer(
device->driverData,
framebufferCreateInfo
);
}
Refresh_ShaderModule* Refresh_CreateShaderModule(
Refresh_Device *device,
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
@ -592,19 +570,6 @@ void Refresh_QueueDestroyRenderTarget(
);
}
void Refresh_QueueDestroyFramebuffer(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_Framebuffer *frameBuffer
) {
NULL_RETURN(device);
device->QueueDestroyFramebuffer(
device->driverData,
commandBuffer,
frameBuffer
);
}
void Refresh_QueueDestroyShaderModule(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
@ -618,19 +583,6 @@ void Refresh_QueueDestroyShaderModule(
);
}
void Refresh_QueueDestroyRenderPass(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderPass *renderPass
) {
NULL_RETURN(device);
device->QueueDestroyRenderPass(
device->driverData,
commandBuffer,
renderPass
);
}
void Refresh_QueueDestroyComputePipeline(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
@ -659,24 +611,20 @@ void Refresh_QueueDestroyGraphicsPipeline(
void Refresh_BeginRenderPass(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderPass *renderPass,
Refresh_Framebuffer *framebuffer,
Refresh_CommandBuffer *commandBuffer,
Refresh_Rect *renderArea,
Refresh_Vec4 *pColorClearValues,
uint32_t colorClearCount,
Refresh_DepthStencilValue *depthStencilClearValue
Refresh_ColorAttachmentInfo *pColorAttachmentInfos,
uint32_t colorAttachmentCount,
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
) {
NULL_RETURN(device);
device->BeginRenderPass(
device->driverData,
commandBuffer,
renderPass,
framebuffer,
renderArea,
pColorClearValues,
colorClearCount,
depthStencilClearValue
pColorAttachmentInfos,
colorAttachmentCount,
depthStencilAttachmentInfo
);
}

View File

@ -218,11 +218,6 @@ struct Refresh_Device
/* State Creation */
Refresh_RenderPass* (*CreateRenderPass)(
Refresh_Renderer *driverData,
Refresh_RenderPassCreateInfo *renderPassCreateInfo
);
Refresh_ComputePipeline* (*CreateComputePipeline)(
Refresh_Renderer *driverData,
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
@ -238,11 +233,6 @@ struct Refresh_Device
Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
);
Refresh_Framebuffer* (*CreateFramebuffer)(
Refresh_Renderer *driverData,
Refresh_FramebufferCreateInfo *framebufferCreateInfo
);
Refresh_ShaderModule* (*CreateShaderModule)(
Refresh_Renderer *driverData,
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
@ -383,24 +373,12 @@ struct Refresh_Device
Refresh_RenderTarget *renderTarget
);
void(*QueueDestroyFramebuffer)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_Framebuffer *frameBuffer
);
void(*QueueDestroyShaderModule)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_ShaderModule *shaderModule
);
void(*QueueDestroyRenderPass)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderPass *renderPass
);
void(*QueueDestroyComputePipeline)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
@ -417,13 +395,11 @@ struct Refresh_Device
void(*BeginRenderPass)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderPass *renderPass,
Refresh_Framebuffer *framebuffer,
Refresh_Rect *renderArea,
Refresh_Vec4 *pColorClearValues,
uint32_t colorClearCount,
Refresh_DepthStencilValue *depthStencilClearValue
Refresh_CommandBuffer *commandBuffer,
Refresh_Rect *renderArea,
Refresh_ColorAttachmentInfo *pColorAttachmentInfos,
uint32_t colorAttachmentCount,
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
);
void(*EndRenderPass)(
@ -509,11 +485,9 @@ struct Refresh_Device
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
ASSIGN_DRIVER_FUNC(CreateRenderPass, name) \
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
ASSIGN_DRIVER_FUNC(CreateFramebuffer, name) \
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
ASSIGN_DRIVER_FUNC(CreateTexture, name) \
ASSIGN_DRIVER_FUNC(CreateRenderTarget, name) \
@ -533,9 +507,7 @@ struct Refresh_Device
ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyRenderTarget, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyFramebuffer, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyRenderPass, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \

View File

@ -321,12 +321,6 @@ static void TEMPLATE_DispatchCompute(
/* State Creation */
static Refresh_RenderPass* TEMPLATE_CreateRenderPass(
Refresh_Renderer *driverData,
Refresh_RenderPassCreateInfo *renderPassCreateInfo
) {
NOT_IMPLEMENTED
}
static Refresh_ComputePipeline* TEMPLATE_CreateComputePipeline(
Refresh_Renderer *driverData,
@ -349,13 +343,6 @@ static Refresh_Sampler* TEMPLATE_CreateSampler(
NOT_IMPLEMENTED
}
static Refresh_Framebuffer* TEMPLATE_CreateFramebuffer(
Refresh_Renderer *driverData,
Refresh_FramebufferCreateInfo *framebufferCreateInfo
) {
NOT_IMPLEMENTED
}
static Refresh_ShaderModule* TEMPLATE_CreateShaderModule(
Refresh_Renderer *driverData,
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
@ -504,6 +491,7 @@ static void TEMPLATE_GetBufferData(
static void TEMPLATE_QueueDestroyTexture(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_Texture *texture
) {
NOT_IMPLEMENTED
@ -511,6 +499,7 @@ static void TEMPLATE_QueueDestroyTexture(
static void TEMPLATE_QueueDestroySampler(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_Sampler *sampler
) {
NOT_IMPLEMENTED
@ -518,6 +507,7 @@ static void TEMPLATE_QueueDestroySampler(
static void TEMPLATE_QueueDestroyBuffer(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_Buffer *buffer
) {
NOT_IMPLEMENTED
@ -525,34 +515,25 @@ static void TEMPLATE_QueueDestroyBuffer(
static void TEMPLATE_QueueDestroyRenderTarget(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderTarget *renderTarget
) {
NOT_IMPLEMENTED
}
static void TEMPLATE_QueueDestroyFramebuffer(
Refresh_Renderer *driverData,
Refresh_Framebuffer *frameBuffer
) {
NOT_IMPLEMENTED
}
static void TEMPLATE_QueueDestroyShaderModule(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_ShaderModule *shaderModule
) {
NOT_IMPLEMENTED
}
static void TEMPLATE_QueueDestroyRenderPass(
Refresh_Renderer *driverData,
Refresh_RenderPass *renderPass
) {
NOT_IMPLEMENTED
}
static void TEMPLATE_QueueDestroyComputePipeline(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_ComputePipeline *computePipeline
) {
NOT_IMPLEMENTED
@ -560,6 +541,7 @@ static void TEMPLATE_QueueDestroyComputePipeline(
static void TEMPLATE_QueueDestroyGraphicsPipeline(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *graphicsPipeline
) {
NOT_IMPLEMENTED
@ -570,12 +552,10 @@ static void TEMPLATE_QueueDestroyGraphicsPipeline(
static void TEMPLATE_BeginRenderPass(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_RenderPass *renderPass,
Refresh_Framebuffer *framebuffer,
Refresh_Rect *renderArea,
Refresh_Vec4 *pColorClearValues,
uint32_t colorClearCount,
Refresh_DepthStencilValue *depthStencilClearValue
Refresh_ColorAttachmentInfo *pColorAttachmentInfos,
uint32_t colorAttachmentCount,
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
) {
NOT_IMPLEMENTED
}

File diff suppressed because it is too large Load Diff