From 127fad89be5c8e5cd50a09eb2d6928bffc3774f2 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 18 Mar 2018 23:35:40 +0100 Subject: [PATCH] [d3d11] Refactored D3D11SamplerState creation --- src/d3d11/d3d11_device.cpp | 8 ++++---- src/d3d11/d3d11_sampler.cpp | 4 ++-- src/d3d11/d3d11_sampler.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index f08ece4c..41eecff9 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -1165,16 +1165,16 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D11Device::CreateSamplerState( const D3D11_SAMPLER_DESC* pSamplerDesc, ID3D11SamplerState** ppSamplerState) { - HRESULT hr = D3D11SamplerState::ValidateDesc(pSamplerDesc); + D3D11_SAMPLER_DESC desc = *pSamplerDesc; - if (FAILED(hr)) - return hr; + if (FAILED(D3D11SamplerState::NormalizeDesc(&desc))) + return E_INVALIDARG; if (ppSamplerState == nullptr) return S_FALSE; try { - *ppSamplerState = m_samplerObjects.Create(this, *pSamplerDesc); + *ppSamplerState = m_samplerObjects.Create(this, desc); return S_OK; } catch (const DxvkError& e) { Logger::err(e.message()); diff --git a/src/d3d11/d3d11_sampler.cpp b/src/d3d11/d3d11_sampler.cpp index f7e363c7..b74f0b2b 100644 --- a/src/d3d11/d3d11_sampler.cpp +++ b/src/d3d11/d3d11_sampler.cpp @@ -73,8 +73,8 @@ namespace dxvk { } - HRESULT D3D11SamplerState::ValidateDesc(const D3D11_SAMPLER_DESC* desc) { - const uint32_t filterBits = static_cast(desc->Filter); + HRESULT D3D11SamplerState::NormalizeDesc(D3D11_SAMPLER_DESC* pDesc) { + const uint32_t filterBits = static_cast(pDesc->Filter); if (filterBits & 0xFFFFFF2A) { Logger::err(str::format("D3D11SamplerState: Unhandled filter: ", filterBits)); diff --git a/src/d3d11/d3d11_sampler.h b/src/d3d11/d3d11_sampler.h index e1f9cef9..e7f9eb08 100644 --- a/src/d3d11/d3d11_sampler.h +++ b/src/d3d11/d3d11_sampler.h @@ -33,8 +33,8 @@ namespace dxvk { return m_sampler; } - static HRESULT ValidateDesc( - const D3D11_SAMPLER_DESC* desc); + static HRESULT NormalizeDesc( + D3D11_SAMPLER_DESC* pDesc); private: