mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[d3d11] Add option to control sampler LOD bias
This commit is contained in:
parent
9671055538
commit
727fd7ac33
10
dxvk.conf
10
dxvk.conf
@ -169,6 +169,16 @@
|
|||||||
# d3d9.samplerAnisotropy = -1
|
# d3d9.samplerAnisotropy = -1
|
||||||
|
|
||||||
|
|
||||||
|
# Changes the mipmap LOD bias for all samplers. The given number will be
|
||||||
|
# added to the LOD bias provided by the application, rather than replacing
|
||||||
|
# it entirely. Positive values will reduce texture detail, while negative
|
||||||
|
# values may increase sharpness at the cost of shimmer.
|
||||||
|
#
|
||||||
|
# Supported values: Any number between -2.0 and 1.0
|
||||||
|
|
||||||
|
# d3d11.samplerLodBias = 0.0
|
||||||
|
|
||||||
|
|
||||||
# Declares vertex positions as invariant in order to solve
|
# Declares vertex positions as invariant in order to solve
|
||||||
# potential Z-fighting issues at a small performance cost.
|
# potential Z-fighting issues at a small performance cost.
|
||||||
#
|
#
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <unordered_map>
|
#include "../util/util_math.h"
|
||||||
|
|
||||||
#include "d3d11_options.h"
|
#include "d3d11_options.h"
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ namespace dxvk {
|
|||||||
this->ignoreGraphicsBarriers = config.getOption<bool>("d3d11.ignoreGraphicsBarriers", false);
|
this->ignoreGraphicsBarriers = config.getOption<bool>("d3d11.ignoreGraphicsBarriers", false);
|
||||||
this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0);
|
this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0);
|
||||||
this->samplerAnisotropy = config.getOption<int32_t>("d3d11.samplerAnisotropy", -1);
|
this->samplerAnisotropy = config.getOption<int32_t>("d3d11.samplerAnisotropy", -1);
|
||||||
|
this->samplerLodBias = config.getOption<float>("d3d11.samplerLodBias", 0.0f);
|
||||||
this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", true);
|
this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", true);
|
||||||
this->floatControls = config.getOption<bool>("d3d11.floatControls", true);
|
this->floatControls = config.getOption<bool>("d3d11.floatControls", true);
|
||||||
this->disableMsaa = config.getOption<bool>("d3d11.disableMsaa", false);
|
this->disableMsaa = config.getOption<bool>("d3d11.disableMsaa", false);
|
||||||
@ -23,6 +24,9 @@ namespace dxvk {
|
|||||||
this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1);
|
this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1);
|
||||||
this->tearFree = config.getOption<Tristate>("dxgi.tearFree", Tristate::Auto);
|
this->tearFree = config.getOption<Tristate>("dxgi.tearFree", Tristate::Auto);
|
||||||
|
|
||||||
|
// Clamp LOD bias so that people don't abuse this in unintended ways
|
||||||
|
this->samplerLodBias = dxvk::fclamp(this->samplerLodBias, -2.0f, 1.0f);
|
||||||
|
|
||||||
int32_t maxImplicitDiscardSize = config.getOption<int32_t>("d3d11.maxImplicitDiscardSize", 256);
|
int32_t maxImplicitDiscardSize = config.getOption<int32_t>("d3d11.maxImplicitDiscardSize", 256);
|
||||||
this->maxImplicitDiscardSize = maxImplicitDiscardSize >= 0
|
this->maxImplicitDiscardSize = maxImplicitDiscardSize >= 0
|
||||||
? VkDeviceSize(maxImplicitDiscardSize) << 10
|
? VkDeviceSize(maxImplicitDiscardSize) << 10
|
||||||
|
@ -62,6 +62,11 @@ namespace dxvk {
|
|||||||
/// given anisotropy value for all samplers.
|
/// given anisotropy value for all samplers.
|
||||||
int32_t samplerAnisotropy;
|
int32_t samplerAnisotropy;
|
||||||
|
|
||||||
|
/// Mipmap LOD bias
|
||||||
|
///
|
||||||
|
/// Enforces the given LOD bias for all samplers.
|
||||||
|
float samplerLodBias;
|
||||||
|
|
||||||
/// Declare vertex positions in shaders as invariant
|
/// Declare vertex positions in shaders as invariant
|
||||||
bool invariantPosition;
|
bool invariantPosition;
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ namespace dxvk {
|
|||||||
if (desc.MaxAnisotropy < 1) info.maxAnisotropy = 1.0f;
|
if (desc.MaxAnisotropy < 1) info.maxAnisotropy = 1.0f;
|
||||||
if (desc.MaxAnisotropy > 16) info.maxAnisotropy = 16.0f;
|
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)
|
||||||
|
info.mipmapLodBias += device->GetOptions()->samplerLodBias;
|
||||||
|
|
||||||
// Enforce anisotropy specified in the device options
|
// Enforce anisotropy specified in the device options
|
||||||
int32_t samplerAnisotropyOption = device->GetOptions()->samplerAnisotropy;
|
int32_t samplerAnisotropyOption = device->GetOptions()->samplerAnisotropy;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user