Skip to content

Commit

Permalink
[d3d11] Introduce d3d11.invariantPosition option
Browse files Browse the repository at this point in the history
Apparently it's better to make app profiles than risk tanking
performance for all applications. Invariance rules in D3D11 are
undocumented so it's not clear what the correct solution is.
  • Loading branch information
doitsujin committed Jan 23, 2020
1 parent 11f08c7 commit 9721938
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
9 changes: 9 additions & 0 deletions dxvk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@
# d3d9.samplerAnisotropy = -1


# Declares vertex positions as invariant in order to solve
# potential Z-fighting issues at a small performance cost.
#
# Supported values: True, False

# d3d11.invariantPosition = False
# d3d9.invariantPosition = False


# Replaces NaN outputs from fragment shaders with zeroes for floating
# point render target. Used in some games to prevent artifacting.
#
Expand Down
1 change: 1 addition & 0 deletions src/d3d11/d3d11_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace dxvk {
this->relaxedBarriers = config.getOption<bool>("d3d11.relaxedBarriers", false);
this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0);
this->samplerAnisotropy = config.getOption<int32_t>("d3d11.samplerAnisotropy", -1);
this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", false);
this->deferSurfaceCreation = config.getOption<bool>("dxgi.deferSurfaceCreation", false);
this->numBackBuffers = config.getOption<int32_t>("dxgi.numBackBuffers", 0);
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);
Expand Down
3 changes: 3 additions & 0 deletions src/d3d11/d3d11_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ namespace dxvk {
/// given anisotropy value for all samplers.
int32_t samplerAnisotropy;

/// Declare vertex positions in shaders as invariant
bool invariantPosition;

/// Back buffer count for the Vulkan swap chain.
/// Overrides DXGI_SWAP_CHAIN_DESC::BufferCount.
int32_t numBackBuffers;
Expand Down
5 changes: 1 addition & 4 deletions src/dxbc/dxbc_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ namespace dxvk {
case Tristate::False: minSsboAlignment = ~0u; break;
}

invariantPosition = options.invariantPosition;
enableRtOutputNanFixup = options.enableRtOutputNanFixup;
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
dynamicIndexedConstantBufferAsSsbo = options.constantBufferRangeCheck;

// Don't declare vertex positions as invariant on Nvidia since it
// may break certain games, such as Shadow of the Tomb Raider.
invariantPosition = !adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);

// Disable early discard on RADV (with LLVM) due to GPU hangs
// Disable early discard on Nvidia because it may hurt performance
Expand Down

0 comments on commit 9721938

Please sign in to comment.