Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-01-08 03:05:50 +0300
committerPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-01-08 03:34:18 +0300
commited411c3496a1b204cac74fb8e31f30926db3a5dc (patch)
tree3155b73353a1328f8759a52a199f4eaaac047d57
parentbbc9e589e4c6ba077f3e1ae566f5ff293ce1a1d7 (diff)
[d3d9,dxso] Add d3d9.forceSampleRateShading optiond3d11-supersampling
-rw-r--r--dxvk.conf1
-rw-r--r--src/d3d9/d3d9_fixed_function.cpp11
-rw-r--r--src/d3d9/d3d9_fixed_function.h1
-rw-r--r--src/d3d9/d3d9_options.cpp1
-rw-r--r--src/d3d9/d3d9_options.h3
-rw-r--r--src/dxso/dxso_compiler.cpp6
-rw-r--r--src/dxso/dxso_options.cpp1
-rw-r--r--src/dxso/dxso_options.h3
8 files changed, 25 insertions, 2 deletions
diff --git a/dxvk.conf b/dxvk.conf
index 473ca91b..626c187a 100644
--- a/dxvk.conf
+++ b/dxvk.conf
@@ -208,6 +208,7 @@
# Supported values: True, False
# d3d11.forceSampleRateShading = False
+# d3d9.forceSampleRateShading = False
# Forces the sample count of all textures to 1, and performs
diff --git a/src/d3d9/d3d9_fixed_function.cpp b/src/d3d9/d3d9_fixed_function.cpp
index c24cf064..f8225222 100644
--- a/src/d3d9/d3d9_fixed_function.cpp
+++ b/src/d3d9/d3d9_fixed_function.cpp
@@ -14,6 +14,7 @@ namespace dxvk {
D3D9FixedFunctionOptions::D3D9FixedFunctionOptions(const D3D9Options* options) {
invariantPosition = options->invariantPosition;
+ forceSampleRateShading = options->forceSampleRateShading;
}
uint32_t DoFixedFunctionFog(D3D9ShaderSpecConstantManager& spec, SpirvModule& spvModule, const D3D9FogContext& fogCtx) {
@@ -933,10 +934,16 @@ namespace dxvk {
uint32_t ptr = m_module.newVar(ptrType, storageClass);
- if (builtin == spv::BuiltInMax)
+ if (builtin == spv::BuiltInMax) {
m_module.decorateLocation(ptr, slot);
- else
+
+ if (isPS() && input && m_options.forceSampleRateShading) {
+ m_module.enableCapability(spv::CapabilitySampleRateShading);
+ m_module.decorate(ptr, spv::DecorationSample);
+ }
+ } else {
m_module.decorateBuiltIn(ptr, builtin);
+ }
bool diffuseOrSpec = semantic == DxsoSemantic{ DxsoUsage::Color, 0 }
|| semantic == DxsoSemantic{ DxsoUsage::Color, 1 };
diff --git a/src/d3d9/d3d9_fixed_function.h b/src/d3d9/d3d9_fixed_function.h
index a7545871..104f044c 100644
--- a/src/d3d9/d3d9_fixed_function.h
+++ b/src/d3d9/d3d9_fixed_function.h
@@ -49,6 +49,7 @@ namespace dxvk {
D3D9FixedFunctionOptions(const D3D9Options* options);
bool invariantPosition;
+ bool forceSampleRateShading;
};
// Returns new oFog if VS
diff --git a/src/d3d9/d3d9_options.cpp b/src/d3d9/d3d9_options.cpp
index 33938c4f..0ecb3895 100644
--- a/src/d3d9/d3d9_options.cpp
+++ b/src/d3d9/d3d9_options.cpp
@@ -63,6 +63,7 @@ namespace dxvk {
this->enableDialogMode = config.getOption<bool> ("d3d9.enableDialogMode", false);
this->forceSamplerTypeSpecConstants = config.getOption<bool> ("d3d9.forceSamplerTypeSpecConstants", false);
this->forceSwapchainMSAA = config.getOption<int32_t> ("d3d9.forceSwapchainMSAA", -1);
+ this->forceSampleRateShading = config.getOption<bool> ("d3d9.forceSampleRateShading", false);
this->forceAspectRatio = config.getOption<std::string> ("d3d9.forceAspectRatio", "");
this->allowDiscard = config.getOption<bool> ("d3d9.allowDiscard", true);
this->enumerateByDisplays = config.getOption<bool> ("d3d9.enumerateByDisplays", true);
diff --git a/src/d3d9/d3d9_options.h b/src/d3d9/d3d9_options.h
index 43fcbb95..592c27d1 100644
--- a/src/d3d9/d3d9_options.h
+++ b/src/d3d9/d3d9_options.h
@@ -123,6 +123,9 @@ namespace dxvk {
/// Forces an MSAA level on the swapchain
int32_t forceSwapchainMSAA;
+ /// Forces sample rate shading
+ bool forceSampleRateShading;
+
/// Allow D3DLOCK_DISCARD
bool allowDiscard;
diff --git a/src/dxso/dxso_compiler.cpp b/src/dxso/dxso_compiler.cpp
index 8b9b16dd..f453f817 100644
--- a/src/dxso/dxso_compiler.cpp
+++ b/src/dxso/dxso_compiler.cpp
@@ -3192,6 +3192,12 @@ void DxsoCompiler::emitControlFlowGenericLoop(
m_module.decorateLocation(inputPtr.id, slot);
+ if (m_programInfo.type() == DxsoProgramType::PixelShader
+ && m_moduleInfo.options.forceSampleRateShading) {
+ m_module.enableCapability(spv::CapabilitySampleRateShading);
+ m_module.decorate(inputPtr.id, spv::DecorationSample);
+ }
+
std::string name =
str::format("in_", elem.semantic.usage, elem.semantic.usageIndex);
m_module.setDebugName(inputPtr.id, name.c_str());
diff --git a/src/dxso/dxso_options.cpp b/src/dxso/dxso_options.cpp
index 163c39b9..d9f7834e 100644
--- a/src/dxso/dxso_options.cpp
+++ b/src/dxso/dxso_options.cpp
@@ -25,6 +25,7 @@ namespace dxvk {
invariantPosition = options.invariantPosition;
forceSamplerTypeSpecConstants = options.forceSamplerTypeSpecConstants;
+ forceSampleRateShading = options.forceSampleRateShading;
vertexFloatConstantBufferAsSSBO = pDevice->GetVertexConstantLayout().floatSize() > devInfo.core.properties.limits.maxUniformBufferRange;
diff --git a/src/dxso/dxso_options.h b/src/dxso/dxso_options.h
index 437f9753..cd0ab8e1 100644
--- a/src/dxso/dxso_options.h
+++ b/src/dxso/dxso_options.h
@@ -36,6 +36,9 @@ namespace dxvk {
/// Works around a game bug in Halo CE where it gives cube textures to 2d/volume samplers
bool forceSamplerTypeSpecConstants;
+ /// Interpolate pixel shader inputs at the sample location rather than pixel center
+ bool forceSampleRateShading;
+
/// Should the SWVP float constant buffer be a SSBO (because of the size on NV)
bool vertexFloatConstantBufferAsSSBO;