mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
shader: share workgroup and selector count resolution
This commit is contained in:
@@ -306,6 +306,11 @@ bool MaterializeIndirectDescriptor(const ResourcePlan& p
|
|||||||
const auto children_begin = descriptors.size();
|
const auto children_begin = descriptors.size();
|
||||||
const auto root_resource = specializations[resource_index];
|
const auto root_resource = specializations[resource_index];
|
||||||
const auto evaluate_count = [&](uint32_t& count) {
|
const auto evaluate_count = [&](uint32_t& count) {
|
||||||
|
if (indirect.workgroup_axis != UINT32_MAX) {
|
||||||
|
if (indirect.workgroup_axis >= runtime.workgroup_counts.size()) return false;
|
||||||
|
count = runtime.workgroup_counts[indirect.workgroup_axis];
|
||||||
|
return count != 0u;
|
||||||
|
}
|
||||||
if (!clean.Evaluate(indirect.key_count, count)) return false;
|
if (!clean.Evaluate(indirect.key_count, count)) return false;
|
||||||
if (indirect.signed_count && std::bit_cast<int32_t>(count) < 0) count = 0;
|
if (indirect.signed_count && std::bit_cast<int32_t>(count) < 0) count = 0;
|
||||||
return true;
|
return true;
|
||||||
@@ -431,14 +436,7 @@ bool MaterializeIndirectDescriptor(const ResourcePlan& p
|
|||||||
if (selector == nullptr) {
|
if (selector == nullptr) {
|
||||||
uint32_t key_count = 0;
|
uint32_t key_count = 0;
|
||||||
uint32_t first_key = 0;
|
uint32_t first_key = 0;
|
||||||
if (indirect.workgroup_axis != UINT32_MAX) {
|
if (!evaluate_count(key_count)) return false;
|
||||||
if (indirect.workgroup_axis >= runtime.workgroup_counts.size()) return false;
|
|
||||||
key_count = runtime.workgroup_counts[indirect.workgroup_axis];
|
|
||||||
if (key_count == 0u) return false;
|
|
||||||
} else {
|
|
||||||
if (!evaluate_count(key_count))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!indirect.selector_first.IsEmpty() && !clean.Evaluate(indirect.selector_first, first_key))
|
if (!indirect.selector_first.IsEmpty() && !clean.Evaluate(indirect.selector_first, first_key))
|
||||||
return false;
|
return false;
|
||||||
if (indirect.table_stride == 0u || key_count > MaxIndirectDescriptorProbes ||
|
if (indirect.table_stride == 0u || key_count > MaxIndirectDescriptorProbes ||
|
||||||
|
|||||||
Reference in New Issue
Block a user