From 7754cb1115f59bfd706217a6c5f32ae490df2e19 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 11 Aug 2018 19:16:34 +0200 Subject: [PATCH] [d3d10] Implement RS(Set|Get)(Viewports|ScissprRects) --- src/d3d10/d3d10_device.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/d3d10/d3d10_device.cpp b/src/d3d10/d3d10_device.cpp index 511c1b80..1c7eabf3 100644 --- a/src/d3d10/d3d10_device.cpp +++ b/src/d3d10/d3d10_device.cpp @@ -826,14 +826,25 @@ namespace dxvk { void STDMETHODCALLTYPE D3D10Device::RSSetViewports( UINT NumViewports, const D3D10_VIEWPORT* pViewports) { - Logger::err("D3D10Device::RSSetViewports: Not implemented"); + D3D11_VIEWPORT vp[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + + for (uint32_t i = 0; i < NumViewports; i++) { + vp[i].TopLeftX = float(pViewports[i].TopLeftX); + vp[i].TopLeftY = float(pViewports[i].TopLeftY); + vp[i].Width = float(pViewports[i].Width); + vp[i].Height = float(pViewports[i].Height); + vp[i].MinDepth = pViewports[i].MinDepth; + vp[i].MaxDepth = pViewports[i].MaxDepth; + } + + m_context->RSSetViewports(NumViewports, vp); } void STDMETHODCALLTYPE D3D10Device::RSSetScissorRects( UINT NumRects, const D3D10_RECT* pRects) { - Logger::err("D3D10Device::RSSetScissorRects: Not implemented"); + m_context->RSSetScissorRects(NumRects, pRects); } @@ -846,14 +857,26 @@ namespace dxvk { void STDMETHODCALLTYPE D3D10Device::RSGetViewports( UINT* NumViewports, D3D10_VIEWPORT* pViewports) { - Logger::err("D3D10Device::RSGetViewports: Not implemented"); + D3D11_VIEWPORT vp[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + m_context->RSGetViewports(NumViewports, pViewports != nullptr ? vp : nullptr); + + if (pViewports != nullptr) { + for (uint32_t i = 0; i < *NumViewports; i++) { + pViewports[i].TopLeftX = int32_t(vp[i].TopLeftX); + pViewports[i].TopLeftY = int32_t(vp[i].TopLeftY); + pViewports[i].Width = uint32_t(vp[i].Width); + pViewports[i].Height = uint32_t(vp[i].Height); + pViewports[i].MinDepth = vp[i].MinDepth; + pViewports[i].MaxDepth = vp[i].MaxDepth; + } + } } void STDMETHODCALLTYPE D3D10Device::RSGetScissorRects( UINT* NumRects, D3D10_RECT* pRects) { - Logger::err("D3D10Device::RSGetScissorRects: Not implemented"); + m_context->RSGetScissorRects(NumRects, pRects); }