mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +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;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -636,6 +637,7 @@ namespace dxvk {
|
||||
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -679,6 +681,7 @@ namespace dxvk {
|
||||
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -701,8 +704,15 @@ namespace dxvk {
|
||||
InitReturnPtr(ppHullShader);
|
||||
D3D11CommonShader module;
|
||||
|
||||
DxbcTessInfo tessInfo;
|
||||
tessInfo.maxTessFactor = float(m_d3d11Options.maxTessFactor);
|
||||
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
|
||||
if (tessInfo.maxTessFactor >= 8.0f)
|
||||
moduleInfo.tess = &tessInfo;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -727,6 +737,7 @@ namespace dxvk {
|
||||
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
@ -751,6 +762,7 @@ namespace dxvk {
|
||||
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options = m_dxbcOptions;
|
||||
moduleInfo.tess = nullptr;
|
||||
|
||||
if (FAILED(this->CreateShaderModule(&module,
|
||||
pShaderBytecode, BytecodeLength, pClassLinkage,
|
||||
|
@ -7,6 +7,7 @@ namespace dxvk {
|
||||
D3D11Options::D3D11Options(const Config& config) {
|
||||
this->allowMapFlagNoWait = config.getOption<bool>("d3d11.allowMapFlagNoWait", 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
|
||||
/// Stream Output is properly supported in DXVK.
|
||||
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);
|
||||
|
||||
// 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);
|
||||
tessValue.id = m_module.opFClamp(getVectorTypeId(tessValue.type),
|
||||
tessValue.id, m_module.constf32(0.0f),
|
||||
m_module.constf32(m_hs.maxTessFactor));
|
||||
m_module.constf32(maxTessFactor));
|
||||
|
||||
DxbcRegisterPointer ptr;
|
||||
ptr.type.ctype = DxbcScalarType::Float32;
|
||||
|
@ -4,6 +4,17 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
/**
|
||||
* \brief Tessellation info
|
||||
*
|
||||
* Stores the maximum tessellation factor
|
||||
* to export from tessellation shaders.
|
||||
*/
|
||||
struct DxbcTessInfo {
|
||||
float maxTessFactor;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Shader module info
|
||||
*
|
||||
@ -11,7 +22,8 @@ namespace dxvk {
|
||||
* This data can be supplied by the client API implementation.
|
||||
*/
|
||||
struct DxbcModuleInfo {
|
||||
DxbcOptions options;
|
||||
DxbcOptions options;
|
||||
DxbcTessInfo* tess;
|
||||
};
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user