From a8f3a5219b6ac4ed3c3cbb8674a5363ad6ea7479 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 11 Aug 2018 20:47:13 +0200 Subject: [PATCH] [d3d10] Implement (VS|GS|PS)(Set|Get)Samplers --- src/d3d10/d3d10_device.cpp | 57 ++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/src/d3d10/d3d10_device.cpp b/src/d3d10/d3d10_device.cpp index af9e6300a..126a41427 100644 --- a/src/d3d10/d3d10_device.cpp +++ b/src/d3d10/d3d10_device.cpp @@ -705,7 +705,15 @@ namespace dxvk { UINT StartSlot, UINT NumSamplers, ID3D10SamplerState* const* ppSamplers) { - Logger::err("D3D10Device::VSSetSamplers: Not implemented"); + ID3D11SamplerState* d3d11Samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + + for (uint32_t i = 0; i < NumSamplers; i++) { + d3d11Samplers[i] = ppSamplers && ppSamplers[i] + ? static_cast(ppSamplers[i])->GetD3D11Iface() + : nullptr; + } + + m_context->VSSetSamplers(StartSlot, NumSamplers, d3d11Samplers); } @@ -742,7 +750,14 @@ namespace dxvk { UINT StartSlot, UINT NumSamplers, ID3D10SamplerState** ppSamplers) { - Logger::err("D3D10Device::VSGetSamplers: Not implemented"); + ID3D11SamplerState* d3d11Samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + m_context->VSGetSamplers(StartSlot, NumSamplers, d3d11Samplers); + + for (uint32_t i = 0; i < NumSamplers; i++) { + ppSamplers[i] = d3d11Samplers[i] + ? static_cast(d3d11Samplers[i])->GetD3D10Iface() + : nullptr; + } } @@ -780,7 +795,15 @@ namespace dxvk { UINT StartSlot, UINT NumSamplers, ID3D10SamplerState* const* ppSamplers) { - Logger::err("D3D10Device::GSSetSamplers: Not implemented"); + ID3D11SamplerState* d3d11Samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + + for (uint32_t i = 0; i < NumSamplers; i++) { + d3d11Samplers[i] = ppSamplers && ppSamplers[i] + ? static_cast(ppSamplers[i])->GetD3D11Iface() + : nullptr; + } + + m_context->GSSetSamplers(StartSlot, NumSamplers, d3d11Samplers); } @@ -817,7 +840,14 @@ namespace dxvk { UINT StartSlot, UINT NumSamplers, ID3D10SamplerState** ppSamplers) { - Logger::err("D3D10Device::GSGetSamplers: Not implemented"); + ID3D11SamplerState* d3d11Samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + m_context->GSGetSamplers(StartSlot, NumSamplers, d3d11Samplers); + + for (uint32_t i = 0; i < NumSamplers; i++) { + ppSamplers[i] = d3d11Samplers[i] + ? static_cast(d3d11Samplers[i])->GetD3D10Iface() + : nullptr; + } } @@ -855,7 +885,15 @@ namespace dxvk { UINT StartSlot, UINT NumSamplers, ID3D10SamplerState* const* ppSamplers) { - Logger::err("D3D10Device::PSSetSamplers: Not implemented"); + ID3D11SamplerState* d3d11Samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + + for (uint32_t i = 0; i < NumSamplers; i++) { + d3d11Samplers[i] = ppSamplers && ppSamplers[i] + ? static_cast(ppSamplers[i])->GetD3D11Iface() + : nullptr; + } + + m_context->PSSetSamplers(StartSlot, NumSamplers, d3d11Samplers); } @@ -892,7 +930,14 @@ namespace dxvk { UINT StartSlot, UINT NumSamplers, ID3D10SamplerState** ppSamplers) { - Logger::err("D3D10Device::PSGetSamplers: Not implemented"); + ID3D11SamplerState* d3d11Samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + m_context->PSGetSamplers(StartSlot, NumSamplers, d3d11Samplers); + + for (uint32_t i = 0; i < NumSamplers; i++) { + ppSamplers[i] = d3d11Samplers[i] + ? static_cast(d3d11Samplers[i])->GetD3D10Iface() + : nullptr; + } }