mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
[dxbc] Declare vertex positions as invariant
Otherwise, games relying on different vertex shaders to produce the same numerical results may suffer from Z-fighting issues. Fixes #1364.
This commit is contained in:
parent
ff2c6a076f
commit
11f08c7dea
@ -740,6 +740,11 @@ namespace dxvk {
|
||||
// Add index decoration for potential dual-source blending
|
||||
if (m_programInfo.type() == DxbcProgramType::PixelShader)
|
||||
m_module.decorateIndex(varId, 0);
|
||||
|
||||
// Declare vertex positions in all stages as invariant, even if
|
||||
// this is not the last stage, to help with potential Z fighting.
|
||||
if (sv == DxbcSystemValue::Position && m_moduleInfo.options.invariantPosition)
|
||||
m_module.decorate(varId, spv::DecorationInvariant);
|
||||
}
|
||||
|
||||
m_oRegs.at(regIdx) = { regType, varId };
|
||||
|
@ -41,6 +41,10 @@ namespace dxvk {
|
||||
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
|
||||
bool isRadvAco = std::string(devInfo.core.properties.deviceName).find("RADV/ACO") != std::string::npos;
|
||||
|
@ -42,6 +42,9 @@ namespace dxvk {
|
||||
/// Clear thread-group shared memory to zero
|
||||
bool zeroInitWorkgroupMemory = false;
|
||||
|
||||
/// Declare vertex positions as invariant
|
||||
bool invariantPosition = false;
|
||||
|
||||
/// Minimum storage buffer alignment
|
||||
VkDeviceSize minSsboAlignment = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user