Started work on BeginRenderPass, enough to get a clear screen!

pull/17/head
Caleb Cornett 2022-03-07 21:47:07 -05:00
parent 9bdad47a36
commit 3175f20db6
1 changed files with 55 additions and 7 deletions

View File

@ -850,21 +850,69 @@ static void D3D11_QueueDestroyGraphicsPipeline(
/* Graphics State */
static void D3D11_BeginRenderPass(
Refresh_Renderer* driverData,
Refresh_CommandBuffer* commandBuffer,
Refresh_Rect* renderArea,
Refresh_ColorAttachmentInfo* colorAttachmentInfos,
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_Rect *renderArea,
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
uint32_t colorAttachmentCount,
Refresh_DepthStencilAttachmentInfo* depthStencilAttachmentInfo
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
) {
NOT_IMPLEMENTED
D3D11Renderer *renderer = (D3D11Renderer*) driverData;
D3D11CommandBuffer *cmdbuf = (D3D11CommandBuffer*) commandBuffer;
D3D11Texture *texture;
float clearColors[4];
ID3D11RenderTargetView *rtViews[MAX_COLOR_TARGET_BINDINGS];
ID3D11DepthStencilView *dsView = NULL;
D3D11_VIEWPORT viewports[1];
D3D11_RECT scissorRects[1];
uint8_t i;
/* Get the RTVs for each color attachment. */
for (i = 0; i < colorAttachmentCount; i += 1)
{
rtViews[i] = ((D3D11Texture*) colorAttachmentInfos[i].texture)->rtv;
}
/* FIXME: Get the DSV for the depth stencil attachment, if one exists! */
/* Set the render targets. */
ID3D11DeviceContext_OMSetRenderTargets(
cmdbuf->context,
colorAttachmentCount,
rtViews,
NULL
);
/* Perform load ops on those render targets. */
for (i = 0; i < colorAttachmentCount; i += 1)
{
texture = (D3D11Texture*) colorAttachmentInfos[i].texture;
if (colorAttachmentInfos[i].loadOp == REFRESH_LOADOP_CLEAR)
{
clearColors[0] = colorAttachmentInfos[i].clearColor.x;
clearColors[1] = colorAttachmentInfos[i].clearColor.y;
clearColors[2] = colorAttachmentInfos[i].clearColor.z;
clearColors[3] = colorAttachmentInfos[i].clearColor.w;
ID3D11DeviceContext_ClearRenderTargetView(
cmdbuf->context,
texture->rtv,
clearColors
);
}
}
/* FIXME: Set viewport and scissor state */
/* FIXME: What should we do with render area? */
}
static void D3D11_EndRenderPass(
Refresh_Renderer* driverData,
Refresh_CommandBuffer* commandBuffer
) {
NOT_IMPLEMENTED
/* FIXME: What should we do here? */
}
static void D3D11_BindGraphicsPipeline(