mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 19:24:12 +01:00
[d3d11] Refactored D3D11SamplerState creation
This commit is contained in:
parent
b04e9b5f18
commit
127fad89be
@ -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());
|
||||
|
@ -73,8 +73,8 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11SamplerState::ValidateDesc(const D3D11_SAMPLER_DESC* desc) {
|
||||
const uint32_t filterBits = static_cast<uint32_t>(desc->Filter);
|
||||
HRESULT D3D11SamplerState::NormalizeDesc(D3D11_SAMPLER_DESC* pDesc) {
|
||||
const uint32_t filterBits = static_cast<uint32_t>(pDesc->Filter);
|
||||
|
||||
if (filterBits & 0xFFFFFF2A) {
|
||||
Logger::err(str::format("D3D11SamplerState: Unhandled filter: ", filterBits));
|
||||
|
@ -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:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user