mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[d3d11] Added option to limit tessellation factors
d3d11.maxTessFactor accepts values ranging from 8 to 64, and limits the maximum tessellation factor accordingly.
This commit is contained in:
parent
2541aeb25c
commit
f8dc5612f7
@ -612,6 +612,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
|
moduleInfo.tess = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
@ -636,6 +637,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
|
moduleInfo.tess = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
@ -679,6 +681,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
|
moduleInfo.tess = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
@ -701,8 +704,15 @@ namespace dxvk {
|
|||||||
InitReturnPtr(ppHullShader);
|
InitReturnPtr(ppHullShader);
|
||||||
D3D11CommonShader module;
|
D3D11CommonShader module;
|
||||||
|
|
||||||
|
DxbcTessInfo tessInfo;
|
||||||
|
tessInfo.maxTessFactor = float(m_d3d11Options.maxTessFactor);
|
||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
|
moduleInfo.tess = nullptr;
|
||||||
|
|
||||||
|
if (tessInfo.maxTessFactor >= 8.0f)
|
||||||
|
moduleInfo.tess = &tessInfo;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
@ -727,6 +737,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
|
moduleInfo.tess = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
@ -751,6 +762,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options = m_dxbcOptions;
|
moduleInfo.options = m_dxbcOptions;
|
||||||
|
moduleInfo.tess = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->CreateShaderModule(&module,
|
if (FAILED(this->CreateShaderModule(&module,
|
||||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||||
|
@ -7,6 +7,7 @@ namespace dxvk {
|
|||||||
D3D11Options::D3D11Options(const Config& config) {
|
D3D11Options::D3D11Options(const Config& config) {
|
||||||
this->allowMapFlagNoWait = config.getOption<bool>("d3d11.allowMapFlagNoWait", false);
|
this->allowMapFlagNoWait = config.getOption<bool>("d3d11.allowMapFlagNoWait", false);
|
||||||
this->fakeStreamOutSupport = config.getOption<bool>("d3d11.fakeStreamOutSupport", false);
|
this->fakeStreamOutSupport = config.getOption<bool>("d3d11.fakeStreamOutSupport", false);
|
||||||
|
this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -23,6 +23,13 @@ namespace dxvk {
|
|||||||
/// well enough without it. Will be removed once
|
/// well enough without it. Will be removed once
|
||||||
/// Stream Output is properly supported in DXVK.
|
/// Stream Output is properly supported in DXVK.
|
||||||
bool fakeStreamOutSupport;
|
bool fakeStreamOutSupport;
|
||||||
|
|
||||||
|
/// Maximum tessellation factor.
|
||||||
|
///
|
||||||
|
/// Limits tessellation factors in tessellation
|
||||||
|
/// control shaders. Values from 8 to 64 are
|
||||||
|
/// supported, other values will be ignored.
|
||||||
|
int32_t maxTessFactor;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -5631,10 +5631,17 @@ namespace dxvk {
|
|||||||
= m_module.constu32(tessFactor.index);
|
= m_module.constu32(tessFactor.index);
|
||||||
|
|
||||||
// Apply global tess factor limit
|
// Apply global tess factor limit
|
||||||
|
float maxTessFactor = m_hs.maxTessFactor;
|
||||||
|
|
||||||
|
if (m_moduleInfo.tess != nullptr) {
|
||||||
|
if (m_moduleInfo.tess->maxTessFactor < maxTessFactor)
|
||||||
|
maxTessFactor = m_moduleInfo.tess->maxTessFactor;
|
||||||
|
}
|
||||||
|
|
||||||
DxbcRegisterValue tessValue = emitRegisterExtract(value, mask);
|
DxbcRegisterValue tessValue = emitRegisterExtract(value, mask);
|
||||||
tessValue.id = m_module.opFClamp(getVectorTypeId(tessValue.type),
|
tessValue.id = m_module.opFClamp(getVectorTypeId(tessValue.type),
|
||||||
tessValue.id, m_module.constf32(0.0f),
|
tessValue.id, m_module.constf32(0.0f),
|
||||||
m_module.constf32(m_hs.maxTessFactor));
|
m_module.constf32(maxTessFactor));
|
||||||
|
|
||||||
DxbcRegisterPointer ptr;
|
DxbcRegisterPointer ptr;
|
||||||
ptr.type.ctype = DxbcScalarType::Float32;
|
ptr.type.ctype = DxbcScalarType::Float32;
|
||||||
|
@ -4,6 +4,17 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Tessellation info
|
||||||
|
*
|
||||||
|
* Stores the maximum tessellation factor
|
||||||
|
* to export from tessellation shaders.
|
||||||
|
*/
|
||||||
|
struct DxbcTessInfo {
|
||||||
|
float maxTessFactor;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Shader module info
|
* \brief Shader module info
|
||||||
*
|
*
|
||||||
@ -12,6 +23,7 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
struct DxbcModuleInfo {
|
struct DxbcModuleInfo {
|
||||||
DxbcOptions options;
|
DxbcOptions options;
|
||||||
|
DxbcTessInfo* tess;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user