1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 05:52:11 +01:00

[d3d9,dxso] Add d3d9.forceSampleRateShading option

This commit is contained in:
Philip Rebohle 2023-01-08 01:05:50 +01:00
parent e426ec09a1
commit 0342a25e61
8 changed files with 25 additions and 2 deletions

View File

@ -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

View File

@ -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 };

View File

@ -49,6 +49,7 @@ namespace dxvk {
D3D9FixedFunctionOptions(const D3D9Options* options);
bool invariantPosition;
bool forceSampleRateShading;
};
// Returns new oFog if VS

View File

@ -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);

View File

@ -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;

View File

@ -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());

View File

@ -25,6 +25,7 @@ namespace dxvk {
invariantPosition = options.invariantPosition;
forceSamplerTypeSpecConstants = options.forceSamplerTypeSpecConstants;
forceSampleRateShading = options.forceSampleRateShading;
vertexFloatConstantBufferAsSSBO = pDevice->GetVertexConstantLayout().floatSize() > devInfo.core.properties.limits.maxUniformBufferRange;

View File

@ -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;