2018-11-23 16:11:46 +01:00
|
|
|
#include "../d3d11/d3d11_options.h"
|
2018-04-22 23:49:41 +02:00
|
|
|
|
2018-01-07 20:05:27 +01:00
|
|
|
#include "dxbc_options.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2018-11-09 08:41:02 +01:00
|
|
|
DxbcOptions::DxbcOptions() {
|
|
|
|
|
2018-04-22 23:49:41 +02:00
|
|
|
}
|
2018-11-09 08:41:02 +01:00
|
|
|
|
|
|
|
|
2018-11-23 16:11:46 +01:00
|
|
|
DxbcOptions::DxbcOptions(const Rc<DxvkDevice>& device, const D3D11Options& options) {
|
2018-12-12 16:27:01 +01:00
|
|
|
const Rc<DxvkAdapter> adapter = device->adapter();
|
|
|
|
|
2018-07-31 16:58:25 +02:00
|
|
|
const DxvkDeviceFeatures& devFeatures = device->features();
|
2018-12-12 16:27:01 +01:00
|
|
|
const DxvkDeviceInfo& devInfo = adapter->devicePropertiesExt();
|
2019-05-15 18:49:02 +02:00
|
|
|
|
2019-02-19 14:27:21 +01:00
|
|
|
useDepthClipWorkaround
|
|
|
|
= !devFeatures.extDepthClipEnable.depthClipEnable;
|
2018-11-07 11:57:36 +01:00
|
|
|
useStorageImageReadWithoutFormat
|
|
|
|
= devFeatures.core.features.shaderStorageImageReadWithoutFormat;
|
2019-05-15 18:49:02 +02:00
|
|
|
useSubgroupOpsForAtomicCounters
|
2019-07-26 14:07:39 +02:00
|
|
|
= (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT)
|
2019-05-15 18:49:02 +02:00
|
|
|
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
|
2019-07-02 22:53:58 +02:00
|
|
|
useDemoteToHelperInvocation
|
|
|
|
= (devFeatures.extShaderDemoteToHelperInvocation.shaderDemoteToHelperInvocation);
|
2018-11-07 11:57:36 +01:00
|
|
|
useSubgroupOpsForEarlyDiscard
|
|
|
|
= (devInfo.coreSubgroup.subgroupSize >= 4)
|
|
|
|
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
|
2018-11-26 15:09:41 +01:00
|
|
|
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
|
2019-03-09 19:59:56 +01:00
|
|
|
useSdivForBufferIndex
|
|
|
|
= adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);
|
2019-06-05 01:28:29 +02:00
|
|
|
|
|
|
|
switch (device->config().useRawSsbo) {
|
|
|
|
case Tristate::Auto: minSsboAlignment = devInfo.core.properties.limits.minStorageBufferOffsetAlignment; break;
|
2019-06-11 20:23:47 +02:00
|
|
|
case Tristate::True: minSsboAlignment = 4u; break;
|
|
|
|
case Tristate::False: minSsboAlignment = ~0u; break;
|
2019-06-05 01:28:29 +02:00
|
|
|
}
|
2018-11-23 12:28:48 +01:00
|
|
|
|
2020-01-23 01:28:19 +01:00
|
|
|
invariantPosition = options.invariantPosition;
|
2019-11-30 17:01:44 +01:00
|
|
|
enableRtOutputNanFixup = options.enableRtOutputNanFixup;
|
2019-04-05 20:24:08 +02:00
|
|
|
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
2020-02-07 22:47:06 +01:00
|
|
|
forceTgsmBarriers = options.forceTgsmBarriers;
|
2021-07-02 04:36:50 +02:00
|
|
|
disableMsaa = options.disableMsaa;
|
2019-10-30 10:57:36 +01:00
|
|
|
dynamicIndexedConstantBufferAsSsbo = options.constantBufferRangeCheck;
|
2020-01-22 23:58:36 +01:00
|
|
|
|
2021-06-18 15:43:24 +02:00
|
|
|
// Disable subgroup early discard on Nvidia because it may hurt performance
|
2021-05-27 00:40:07 +02:00
|
|
|
if (adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0))
|
2018-11-23 12:28:48 +01:00
|
|
|
useSubgroupOpsForEarlyDiscard = false;
|
2019-01-08 20:58:18 +01:00
|
|
|
|
2021-01-28 15:54:36 +01:00
|
|
|
// Figure out float control flags to match D3D11 rules
|
2021-01-28 20:32:38 +01:00
|
|
|
if (options.floatControls) {
|
|
|
|
if (devInfo.khrShaderFloatControls.shaderSignedZeroInfNanPreserveFloat32)
|
|
|
|
floatControl.set(DxbcFloatControlFlag::PreserveNan32);
|
|
|
|
if (devInfo.khrShaderFloatControls.shaderSignedZeroInfNanPreserveFloat64)
|
|
|
|
floatControl.set(DxbcFloatControlFlag::PreserveNan64);
|
2021-01-28 15:54:36 +01:00
|
|
|
|
2021-01-28 20:32:38 +01:00
|
|
|
if (devInfo.khrShaderFloatControls.denormBehaviorIndependence != VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE) {
|
|
|
|
if (devInfo.khrShaderFloatControls.shaderDenormFlushToZeroFloat32)
|
|
|
|
floatControl.set(DxbcFloatControlFlag::DenormFlushToZero32);
|
|
|
|
if (devInfo.khrShaderFloatControls.shaderDenormPreserveFloat64)
|
|
|
|
floatControl.set(DxbcFloatControlFlag::DenormPreserve64);
|
|
|
|
}
|
2021-01-28 15:54:36 +01:00
|
|
|
}
|
2021-01-28 19:32:00 +01:00
|
|
|
|
|
|
|
if (!devInfo.khrShaderFloatControls.shaderSignedZeroInfNanPreserveFloat32
|
|
|
|
|| adapter->matchesDriver(DxvkGpuVendor::Amd, VK_DRIVER_ID_MESA_RADV_KHR, 0, VK_MAKE_VERSION(20, 3, 0)))
|
|
|
|
enableRtOutputNanFixup = true;
|
2018-01-07 20:05:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|