forked from MoonsideGames/Refresh
BeginRenderPass
parent
ffae2d8bfb
commit
2f06a8a13f
|
@ -344,12 +344,6 @@ typedef struct REFRESH_DepthStencilValue
|
||||||
uint32_t stencil;
|
uint32_t stencil;
|
||||||
} REFRESH_DepthStencilValue;
|
} REFRESH_DepthStencilValue;
|
||||||
|
|
||||||
typedef struct REFRESH_ClearValue
|
|
||||||
{
|
|
||||||
REFRESH_Color color;
|
|
||||||
REFRESH_DepthStencilValue depthStencil;
|
|
||||||
} REFRESH_ClearValue;
|
|
||||||
|
|
||||||
typedef struct REFRESH_Rect
|
typedef struct REFRESH_Rect
|
||||||
{
|
{
|
||||||
int32_t x;
|
int32_t x;
|
||||||
|
@ -1206,18 +1200,20 @@ REFRESHAPI void REFRESH_AddDisposeGraphicsPipeline(
|
||||||
* All load, store and resolve operations are restricted
|
* All load, store and resolve operations are restricted
|
||||||
* to the given rectangle.
|
* to the given rectangle.
|
||||||
* clearValues:
|
* clearValues:
|
||||||
* A pointer to an array of REFRESH_ClearValue structures
|
* A pointer to an array of REFRESH_Color structures
|
||||||
* that contains clear values for each render target in the
|
* that contains clear values for each color target in the
|
||||||
* framebuffer.
|
* framebuffer. May be NULL.
|
||||||
* clearCount: The amount of clearValue structs in the above array.
|
* clearCount: The amount of color structs in the above array.
|
||||||
|
* depthStencilClearValue: The depth/stencil clear value. May be NULL.
|
||||||
*/
|
*/
|
||||||
REFRESHAPI void REFRESH_BeginRenderPass(
|
REFRESHAPI void REFRESH_BeginRenderPass(
|
||||||
REFRESH_Device *device,
|
REFRESH_Device *device,
|
||||||
REFRESH_RenderPass *renderPass,
|
REFRESH_RenderPass *renderPass,
|
||||||
REFRESH_Framebuffer *framebuffer,
|
REFRESH_Framebuffer *framebuffer,
|
||||||
REFRESH_Rect renderArea,
|
REFRESH_Rect renderArea,
|
||||||
REFRESH_ClearValue *pClearValues,
|
REFRESH_Color *pColorClearValues,
|
||||||
uint32_t clearCount
|
uint32_t colorClearCount,
|
||||||
|
REFRESH_DepthStencilValue *depthStencilClearValue
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Ends the current render pass. */
|
/* Ends the current render pass. */
|
||||||
|
|
|
@ -746,8 +746,9 @@ void REFRESH_BeginRenderPass(
|
||||||
REFRESH_RenderPass *renderPass,
|
REFRESH_RenderPass *renderPass,
|
||||||
REFRESH_Framebuffer *framebuffer,
|
REFRESH_Framebuffer *framebuffer,
|
||||||
REFRESH_Rect renderArea,
|
REFRESH_Rect renderArea,
|
||||||
REFRESH_ClearValue *pClearValues,
|
REFRESH_Color *pColorClearValues,
|
||||||
uint32_t clearCount
|
uint32_t colorClearCount,
|
||||||
|
REFRESH_DepthStencilValue *depthStencilClearValue
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->BeginRenderPass(
|
device->BeginRenderPass(
|
||||||
|
@ -755,8 +756,9 @@ void REFRESH_BeginRenderPass(
|
||||||
renderPass,
|
renderPass,
|
||||||
framebuffer,
|
framebuffer,
|
||||||
renderArea,
|
renderArea,
|
||||||
pClearValues,
|
pColorClearValues,
|
||||||
clearCount
|
colorClearCount,
|
||||||
|
depthStencilClearValue
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -463,8 +463,9 @@ struct REFRESH_Device
|
||||||
REFRESH_RenderPass *renderPass,
|
REFRESH_RenderPass *renderPass,
|
||||||
REFRESH_Framebuffer *framebuffer,
|
REFRESH_Framebuffer *framebuffer,
|
||||||
REFRESH_Rect renderArea,
|
REFRESH_Rect renderArea,
|
||||||
REFRESH_ClearValue *pClearValues,
|
REFRESH_Color *pColorClearValues,
|
||||||
uint32_t clearCount
|
uint32_t colorClearCount,
|
||||||
|
REFRESH_DepthStencilValue *depthStencilClearValue
|
||||||
);
|
);
|
||||||
|
|
||||||
void(*EndRenderPass)(
|
void(*EndRenderPass)(
|
||||||
|
|
|
@ -3859,10 +3859,57 @@ static void VULKAN_BeginRenderPass(
|
||||||
REFRESH_RenderPass *renderPass,
|
REFRESH_RenderPass *renderPass,
|
||||||
REFRESH_Framebuffer *framebuffer,
|
REFRESH_Framebuffer *framebuffer,
|
||||||
REFRESH_Rect renderArea,
|
REFRESH_Rect renderArea,
|
||||||
REFRESH_ClearValue *pClearValues,
|
REFRESH_Color *pColorClearValues,
|
||||||
uint32_t clearCount
|
uint32_t colorClearCount,
|
||||||
|
REFRESH_DepthStencilValue *depthStencilClearValue
|
||||||
) {
|
) {
|
||||||
SDL_assert(0);
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
|
VkClearValue *clearValues;
|
||||||
|
uint32_t i;
|
||||||
|
uint32_t colorCount = colorClearCount;
|
||||||
|
|
||||||
|
if (depthStencilClearValue != NULL)
|
||||||
|
{
|
||||||
|
colorCount += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearValues = SDL_stack_alloc(VkClearValue, colorCount);
|
||||||
|
|
||||||
|
for (i = 0; i < colorClearCount; i += 1)
|
||||||
|
{
|
||||||
|
clearValues[i].color.uint32[0] = pColorClearValues[i].r;
|
||||||
|
clearValues[i].color.uint32[1] = pColorClearValues[i].g;
|
||||||
|
clearValues[i].color.uint32[2] = pColorClearValues[i].b;
|
||||||
|
clearValues[i].color.uint32[3] = pColorClearValues[i].a;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (depthStencilClearValue != NULL)
|
||||||
|
{
|
||||||
|
clearValues[colorClearCount].depthStencil.depth =
|
||||||
|
depthStencilClearValue->depth;
|
||||||
|
clearValues[colorClearCount].depthStencil.stencil =
|
||||||
|
depthStencilClearValue->stencil;
|
||||||
|
}
|
||||||
|
|
||||||
|
VkRenderPassBeginInfo renderPassBeginInfo;
|
||||||
|
renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||||
|
renderPassBeginInfo.pNext = NULL;
|
||||||
|
renderPassBeginInfo.renderPass = (VkRenderPass) renderPass;
|
||||||
|
renderPassBeginInfo.framebuffer = (VkFramebuffer) framebuffer;
|
||||||
|
renderPassBeginInfo.renderArea.extent.width = renderArea.w;
|
||||||
|
renderPassBeginInfo.renderArea.extent.height = renderArea.h;
|
||||||
|
renderPassBeginInfo.renderArea.offset.x = renderArea.x;
|
||||||
|
renderPassBeginInfo.renderArea.offset.y = renderArea.y;
|
||||||
|
renderPassBeginInfo.pClearValues = clearValues;
|
||||||
|
renderPassBeginInfo.clearValueCount = colorCount;
|
||||||
|
|
||||||
|
RECORD_CMD(renderer->vkCmdBeginRenderPass(
|
||||||
|
renderer->currentCommandBuffer,
|
||||||
|
&renderPassBeginInfo,
|
||||||
|
VK_SUBPASS_CONTENTS_INLINE
|
||||||
|
));
|
||||||
|
|
||||||
|
SDL_stack_free(clearValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_EndRenderPass(
|
static void VULKAN_EndRenderPass(
|
||||||
|
|
Loading…
Reference in New Issue