[d3d11,dxbc] Add d3d11.forceSampleRateShading option

This commit is contained in:
Philip Rebohle 2023-01-08 00:51:13 +01:00
parent 06fb93daf0
commit e426ec09a1
6 changed files with 28 additions and 0 deletions

View File

@ -201,6 +201,15 @@
# d3d9.invariantPosition = True
# Forces per-sample rate shading when MSAA is enabled, rather than per-pixel
# shading. May improve visual clarity at a significant performance cost, but
# may also introduce visual issues in some games.
#
# Supported values: True, False
# d3d11.forceSampleRateShading = False
# Forces the sample count of all textures to 1, and performs
# the needed fixups in resolve operations and shaders.
#

View File

@ -23,6 +23,7 @@ namespace dxvk {
this->samplerLodBias = config.getOption<float>("d3d11.samplerLodBias", 0.0f);
this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", true);
this->floatControls = config.getOption<bool>("d3d11.floatControls", true);
this->forceSampleRateShading = config.getOption<bool>("d3d11.forceSampleRateShading", false);
this->disableMsaa = config.getOption<bool>("d3d11.disableMsaa", false);
this->enableContextLock = config.getOption<bool>("d3d11.enableContextLock", false);
this->deferSurfaceCreation = config.getOption<bool>("dxgi.deferSurfaceCreation", false);

View File

@ -99,6 +99,11 @@ namespace dxvk {
/// for a single window that may interfere with each other.
bool deferSurfaceCreation;
/// Enables sample rate shading by interpolating fragment shader
/// inputs at the sample location rather than pixel center,
/// unless otherwise specified by the application.
bool forceSampleRateShading;
/// Forces the sample count of all textures to be 1, and
/// performs the required shader and resolve fixups.
bool disableMsaa;

View File

@ -726,6 +726,14 @@ namespace dxvk {
m_module.decorate(varId, spv::DecorationSample);
}
if (m_moduleInfo.options.forceSampleRateShading) {
if (im == DxbcInterpolationMode::Linear
|| im == DxbcInterpolationMode::LinearNoPerspective) {
m_module.enableCapability(spv::CapabilitySampleRateShading);
m_module.decorate(varId, spv::DecorationSample);
}
}
// Declare the input slot as defined
m_inputMask |= 1u << regIdx;
m_vArrayLength = std::max(m_vArrayLength, regIdx + 1);

View File

@ -38,6 +38,7 @@ namespace dxvk {
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
forceVolatileTgsmAccess = options.forceVolatileTgsmAccess;
disableMsaa = options.disableMsaa;
forceSampleRateShading = options.forceSampleRateShading;
enableSampleShadingInterlock = device->features().extFragmentShaderInterlock.fragmentShaderSampleInterlock;
// Figure out float control flags to match D3D11 rules

View File

@ -43,6 +43,10 @@ namespace dxvk {
/// Replace ld_ms with ld
bool disableMsaa = false;
/// Force sample rate shading by using sample
/// interpolation for fragment shader inputs
bool forceSampleRateShading = false;
// Enable per-sample interlock if supported
bool enableSampleShadingInterlock = false;