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(
|
HRESULT STDMETHODCALLTYPE D3D11Device::CreateSamplerState(
|
||||||
const D3D11_SAMPLER_DESC* pSamplerDesc,
|
const D3D11_SAMPLER_DESC* pSamplerDesc,
|
||||||
ID3D11SamplerState** ppSamplerState) {
|
ID3D11SamplerState** ppSamplerState) {
|
||||||
HRESULT hr = D3D11SamplerState::ValidateDesc(pSamplerDesc);
|
D3D11_SAMPLER_DESC desc = *pSamplerDesc;
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(D3D11SamplerState::NormalizeDesc(&desc)))
|
||||||
return hr;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if (ppSamplerState == nullptr)
|
if (ppSamplerState == nullptr)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
*ppSamplerState = m_samplerObjects.Create(this, *pSamplerDesc);
|
*ppSamplerState = m_samplerObjects.Create(this, desc);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} catch (const DxvkError& e) {
|
} catch (const DxvkError& e) {
|
||||||
Logger::err(e.message());
|
Logger::err(e.message());
|
||||||
|
@ -73,8 +73,8 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT D3D11SamplerState::ValidateDesc(const D3D11_SAMPLER_DESC* desc) {
|
HRESULT D3D11SamplerState::NormalizeDesc(D3D11_SAMPLER_DESC* pDesc) {
|
||||||
const uint32_t filterBits = static_cast<uint32_t>(desc->Filter);
|
const uint32_t filterBits = static_cast<uint32_t>(pDesc->Filter);
|
||||||
|
|
||||||
if (filterBits & 0xFFFFFF2A) {
|
if (filterBits & 0xFFFFFF2A) {
|
||||||
Logger::err(str::format("D3D11SamplerState: Unhandled filter: ", filterBits));
|
Logger::err(str::format("D3D11SamplerState: Unhandled filter: ", filterBits));
|
||||||
|
@ -33,8 +33,8 @@ namespace dxvk {
|
|||||||
return m_sampler;
|
return m_sampler;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT ValidateDesc(
|
static HRESULT NormalizeDesc(
|
||||||
const D3D11_SAMPLER_DESC* desc);
|
D3D11_SAMPLER_DESC* pDesc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user