File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,34 @@ class NBL_API2 ICPUDescriptorSet final : public IDescriptorSet<ICPUDescriptorSet
79
79
80
80
inline bool valid () const override {
81
81
if (!m_layout->valid ()) return false ;
82
+ for (auto type_i = 0u ; type_i < static_cast <uint32_t >(IDescriptor::E_TYPE::ET_COUNT); type_i++)
83
+ {
84
+ const auto descriptorType = static_cast <IDescriptor::E_TYPE>(type_i);
85
+ const auto descriptorCategory = IDescriptor::GetTypeCategory (descriptorType);
86
+ const auto & descriptorRedirect = m_layout->getDescriptorRedirect (descriptorType);
87
+ const auto & descriptorInfoArr = m_descriptorInfos[type_i];
88
+
89
+ if (descriptorInfoArr->size () != descriptorRedirect.getTotalCount ()) return false ;
90
+
91
+ auto offset = 0 ;
92
+ for (auto binding_i = 0 ; binding_i < descriptorRedirect.getBindingCount (); binding_i++)
93
+ {
94
+ const auto storageIndex = IDescriptorSetLayoutBase::CBindingRedirect::storage_range_index_t (binding_i);
95
+ const auto descriptorCount = descriptorRedirect.getCount (storageIndex);
96
+ const auto createFlags = descriptorRedirect.getCreateFlags (storageIndex);
97
+ const auto isPartiallyBound = !createFlags.hasFlags (IDescriptorSetLayoutBase::SBindingBase::E_CREATE_FLAGS::ECF_PARTIALLY_BOUND_BIT);
98
+ for (auto descriptor_i = 0 ; descriptor_i < descriptorCount; descriptor_i++)
99
+ {
100
+ const auto storageOffset = IDescriptorSetLayoutBase::CBindingRedirect::storage_offset_t (offset);
101
+ const auto & descriptorInfo = descriptorInfoArr->operator [](offset);
102
+
103
+ // partiallyBound layout can have null descriptor, otherwise not
104
+ if (!isPartiallyBound && !descriptorInfo.desc ) return false ;
105
+ if (descriptorInfo.desc && descriptorInfo.desc ->getTypeCategory () != descriptorCategory) return false ;
106
+ }
107
+ }
108
+ }
109
+
82
110
return true ;
83
111
}
84
112
You can’t perform that action at this time.
0 commit comments