From 0555023100072c77a170bd6190dc40cd8cc33d25 Mon Sep 17 00:00:00 2001 From: Caleb Cornett Date: Thu, 12 Oct 2023 08:18:53 -0500 Subject: [PATCH] Implement SetViewport and SetScissor --- src/Refresh_Driver_D3D11.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Refresh_Driver_D3D11.c b/src/Refresh_Driver_D3D11.c index ffefa0d..bf68f89 100644 --- a/src/Refresh_Driver_D3D11.c +++ b/src/Refresh_Driver_D3D11.c @@ -1369,7 +1369,22 @@ static void D3D11_SetViewport( Refresh_CommandBuffer *commandBuffer, Refresh_Viewport *viewport ) { - NOT_IMPLEMENTED + D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer*) commandBuffer; + D3D11_VIEWPORT vp = + { + viewport->x, + viewport->y, + viewport->w, + viewport->h, + viewport->minDepth, + viewport->maxDepth + }; + + ID3D11DeviceContext_RSSetViewports( + d3d11CommandBuffer->context, + 1, + &vp + ); } static void D3D11_SetScissor( @@ -1377,7 +1392,20 @@ static void D3D11_SetScissor( Refresh_CommandBuffer *commandBuffer, Refresh_Rect *scissor ) { - NOT_IMPLEMENTED + D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer*)commandBuffer; + D3D11_RECT rect = + { + scissor->x, + scissor->y, + scissor->x + scissor->w, + scissor->y + scissor->h + }; + + ID3D11DeviceContext_RSSetScissorRects( + d3d11CommandBuffer->context, + 1, + &rect + ); } static void D3D11_BindVertexBuffers(