1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 01:24:11 +01:00

[d3d11] implement 'clampNegativeLodBias' as a conf option

This commit is contained in:
Lilium 2023-05-20 14:08:00 +02:00 committed by Joshie
parent 3fce9886f5
commit bd575a4a46
4 changed files with 10 additions and 1 deletions

View File

@ -197,6 +197,7 @@
#
# Supported values: True, False
# d3d11.clampNegativeLodBias = False
# d3d9.clampNegativeLodBias = False

View File

@ -21,6 +21,7 @@ namespace dxvk {
this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0);
this->samplerAnisotropy = config.getOption<int32_t>("d3d11.samplerAnisotropy", -1);
this->samplerLodBias = config.getOption<float>("d3d11.samplerLodBias", 0.0f);
this->clampNegativeLodBias = config.getOption<bool>("d3d11.clampNegativeLodBias", false);
this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", true);
this->floatControls = config.getOption<bool>("d3d11.floatControls", true);
this->forceSampleRateShading = config.getOption<bool>("d3d11.forceSampleRateShading", false);

View File

@ -63,6 +63,9 @@ namespace dxvk {
/// Enforces the given LOD bias for all samplers.
float samplerLodBias;
/// Clamps negative LOD bias
bool clampNegativeLodBias;
/// Declare vertex positions in shaders as invariant
bool invariantPosition;

View File

@ -47,9 +47,13 @@ namespace dxvk {
if (desc.MaxAnisotropy > 16) info.maxAnisotropy = 16.0f;
// Enforce LOD bias specified in the device options
if (info.minFilter == VK_FILTER_LINEAR && info.magFilter == VK_FILTER_LINEAR)
if (info.minFilter == VK_FILTER_LINEAR && info.magFilter == VK_FILTER_LINEAR) {
info.mipmapLodBias += device->GetOptions()->samplerLodBias;
if (device->GetOptions()->clampNegativeLodBias)
info.mipmapLodBias = std::max(info.mipmapLodBias, 0.0f);
}
// Enforce anisotropy specified in the device options
int32_t samplerAnisotropyOption = device->GetOptions()->samplerAnisotropy;