mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
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.
61 lines
2.6 KiB
C++
61 lines
2.6 KiB
C++
#include "../d3d11/d3d11_options.h"
|
|
|
|
#include "dxbc_options.h"
|
|
|
|
namespace dxvk {
|
|
|
|
DxbcOptions::DxbcOptions() {
|
|
|
|
}
|
|
|
|
|
|
DxbcOptions::DxbcOptions(const Rc<DxvkDevice>& device, const D3D11Options& options) {
|
|
const Rc<DxvkAdapter> adapter = device->adapter();
|
|
|
|
const DxvkDeviceFeatures& devFeatures = device->features();
|
|
const DxvkDeviceInfo& devInfo = adapter->devicePropertiesExt();
|
|
|
|
useDepthClipWorkaround
|
|
= !devFeatures.extDepthClipEnable.depthClipEnable;
|
|
useStorageImageReadWithoutFormat
|
|
= devFeatures.core.features.shaderStorageImageReadWithoutFormat;
|
|
useSubgroupOpsForAtomicCounters
|
|
= (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT)
|
|
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
|
|
useDemoteToHelperInvocation
|
|
= (devFeatures.extShaderDemoteToHelperInvocation.shaderDemoteToHelperInvocation);
|
|
useSubgroupOpsForEarlyDiscard
|
|
= (devInfo.coreSubgroup.subgroupSize >= 4)
|
|
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
|
|
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
|
|
useSdivForBufferIndex
|
|
= adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);
|
|
|
|
switch (device->config().useRawSsbo) {
|
|
case Tristate::Auto: minSsboAlignment = devInfo.core.properties.limits.minStorageBufferOffsetAlignment; break;
|
|
case Tristate::True: minSsboAlignment = 4u; break;
|
|
case Tristate::False: minSsboAlignment = ~0u; break;
|
|
}
|
|
|
|
invariantPosition = options.invariantPosition;
|
|
enableRtOutputNanFixup = options.enableRtOutputNanFixup;
|
|
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
|
dynamicIndexedConstantBufferAsSsbo = options.constantBufferRangeCheck;
|
|
|
|
// 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;
|
|
|
|
if ((adapter->matchesDriver(DxvkGpuVendor::Amd, VK_DRIVER_ID_MESA_RADV_KHR, 0, 0) && !isRadvAco)
|
|
|| (adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0)))
|
|
useSubgroupOpsForEarlyDiscard = false;
|
|
|
|
// Disable atomic counters on older RADV versions
|
|
if (adapter->matchesDriver(DxvkGpuVendor::Amd, VK_DRIVER_ID_MESA_RADV_KHR, 0, VK_MAKE_VERSION(19, 1, 0)))
|
|
useSubgroupOpsForAtomicCounters = false;
|
|
|
|
// Apply shader-related options
|
|
applyTristate(useSubgroupOpsForEarlyDiscard, device->config().useEarlyDiscard);
|
|
}
|
|
|
|
} |