1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-30 02:52:10 +01:00

[dxbc] Use clustered subgroup operations on supported hardware

This commit is contained in:
Philip Rebohle 2018-11-11 17:49:11 +01:00
parent ab17c49c4e
commit 0418c02ac3
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 16 additions and 1 deletions

View File

@ -3897,7 +3897,13 @@ namespace dxvk {
uint32_t killSubgroup = m_module.opGroupNonUniformLogicalAnd(
m_module.defBoolType(),
m_module.constu32(spv::ScopeSubgroup),
spv::GroupOperationReduce, killState, 0);
m_moduleInfo.options.useSubgroupOpsClustered
? spv::GroupOperationClusteredReduce
: spv::GroupOperationReduce,
killState,
m_moduleInfo.options.useSubgroupOpsClustered
? m_module.constu32(4)
: 0);
DxbcConditional cond;
cond.labelIf = m_module.allocateId();
@ -6190,6 +6196,9 @@ namespace dxvk {
if (m_moduleInfo.options.useSubgroupOpsForEarlyDiscard) {
m_module.enableCapability(spv::CapabilityGroupNonUniform);
m_module.enableCapability(spv::CapabilityGroupNonUniformArithmetic);
if (m_moduleInfo.options.useSubgroupOpsClustered)
m_module.enableCapability(spv::CapabilityGroupNonUniformClustered);
}
}

View File

@ -19,6 +19,8 @@ namespace dxvk {
= (devInfo.coreSubgroup.subgroupSize >= 4)
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_ARITHMETIC_BIT);
useSubgroupOpsClustered = useSubgroupOpsForEarlyDiscard
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_CLUSTERED_BIT);
}
}

View File

@ -14,6 +14,9 @@ namespace dxvk {
/// Use subgroup operations to discard fragment
/// shader invocations if derivatives remain valid.
bool useSubgroupOpsForEarlyDiscard = false;
/// Use clustered subgroup operations
bool useSubgroupOpsClustered = false;
};
}

View File

@ -43,6 +43,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
DxbcModuleInfo moduleInfo;
moduleInfo.options.useSubgroupOpsForEarlyDiscard = true;
moduleInfo.options.useSubgroupOpsClustered = true;
moduleInfo.xfb = nullptr;
Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);