1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 10:54:16 +01:00

[d3d11] Added default sampler state

This commit is contained in:
Philip Rebohle 2018-01-10 19:07:55 +01:00
parent 74722fa693
commit 1b67ffaed2
2 changed files with 29 additions and 1 deletions

View File

@ -41,6 +41,10 @@ namespace dxvk {
m_context->setBlendConstants(m_state.om.blendFactor);
m_context->setStencilReference(m_state.om.stencilRef);
// Create a default sampler that we're going to bind
// when the application binds null to a sampler slot.
m_defaultSampler = CreateDefaultSampler();
}
@ -1853,7 +1857,7 @@ namespace dxvk {
slotId + i, sampler->GetDXVKSampler());
} else {
m_context->bindResourceSampler(
slotId + i, nullptr);
slotId + i, m_defaultSampler);
}
}
}
@ -1992,4 +1996,25 @@ namespace dxvk {
scissors.data());
}
Rc<DxvkSampler> D3D11DeviceContext::CreateDefaultSampler() {
DxvkSamplerCreateInfo info;
info.minFilter = VK_FILTER_LINEAR;
info.magFilter = VK_FILTER_LINEAR;
info.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
info.mipmapLodBias = 0.0f;
info.mipmapLodMin = -256.0f;
info.mipmapLodMax = 256.0f;
info.useAnisotropy = VK_FALSE;
info.maxAnisotropy = 1.0f;
info.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
info.compareToDepth = VK_FALSE;
info.compareOp = VK_COMPARE_OP_NEVER;
info.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
info.usePixelCoord = VK_FALSE;
return m_device->createSampler(info);
}
}

View File

@ -556,6 +556,7 @@ namespace dxvk {
Rc<DxvkDevice> m_device;
Rc<DxvkContext> m_context;
Rc<DxvkSampler> m_defaultSampler;
Com<D3D11BlendState> m_defaultBlendState;
Com<D3D11DepthStencilState> m_defaultDepthStencilState;
@ -595,6 +596,8 @@ namespace dxvk {
void ApplyViewportState();
Rc<DxvkSampler> CreateDefaultSampler();
};
}