mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-06 22:54:16 +01:00
[dxbc] Use clustered subgroup operations on supported hardware
This commit is contained in:
parent
ab17c49c4e
commit
0418c02ac3
@ -3897,7 +3897,13 @@ namespace dxvk {
|
|||||||
uint32_t killSubgroup = m_module.opGroupNonUniformLogicalAnd(
|
uint32_t killSubgroup = m_module.opGroupNonUniformLogicalAnd(
|
||||||
m_module.defBoolType(),
|
m_module.defBoolType(),
|
||||||
m_module.constu32(spv::ScopeSubgroup),
|
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;
|
DxbcConditional cond;
|
||||||
cond.labelIf = m_module.allocateId();
|
cond.labelIf = m_module.allocateId();
|
||||||
@ -6190,6 +6196,9 @@ namespace dxvk {
|
|||||||
if (m_moduleInfo.options.useSubgroupOpsForEarlyDiscard) {
|
if (m_moduleInfo.options.useSubgroupOpsForEarlyDiscard) {
|
||||||
m_module.enableCapability(spv::CapabilityGroupNonUniform);
|
m_module.enableCapability(spv::CapabilityGroupNonUniform);
|
||||||
m_module.enableCapability(spv::CapabilityGroupNonUniformArithmetic);
|
m_module.enableCapability(spv::CapabilityGroupNonUniformArithmetic);
|
||||||
|
|
||||||
|
if (m_moduleInfo.options.useSubgroupOpsClustered)
|
||||||
|
m_module.enableCapability(spv::CapabilityGroupNonUniformClustered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ namespace dxvk {
|
|||||||
= (devInfo.coreSubgroup.subgroupSize >= 4)
|
= (devInfo.coreSubgroup.subgroupSize >= 4)
|
||||||
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
|
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
|
||||||
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_ARITHMETIC_BIT);
|
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_ARITHMETIC_BIT);
|
||||||
|
useSubgroupOpsClustered = useSubgroupOpsForEarlyDiscard
|
||||||
|
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_CLUSTERED_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -14,6 +14,9 @@ namespace dxvk {
|
|||||||
/// Use subgroup operations to discard fragment
|
/// Use subgroup operations to discard fragment
|
||||||
/// shader invocations if derivatives remain valid.
|
/// shader invocations if derivatives remain valid.
|
||||||
bool useSubgroupOpsForEarlyDiscard = false;
|
bool useSubgroupOpsForEarlyDiscard = false;
|
||||||
|
|
||||||
|
/// Use clustered subgroup operations
|
||||||
|
bool useSubgroupOpsClustered = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -43,6 +43,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
|||||||
|
|
||||||
DxbcModuleInfo moduleInfo;
|
DxbcModuleInfo moduleInfo;
|
||||||
moduleInfo.options.useSubgroupOpsForEarlyDiscard = true;
|
moduleInfo.options.useSubgroupOpsForEarlyDiscard = true;
|
||||||
|
moduleInfo.options.useSubgroupOpsClustered = true;
|
||||||
moduleInfo.xfb = nullptr;
|
moduleInfo.xfb = nullptr;
|
||||||
|
|
||||||
Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);
|
Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user