Skip to content

Commit 6a76d54

Browse files
committed
Added throwing of exceptions when invalid setup of DescriptorSet/DescriptorSetLayout.
1 parent 585222d commit 6a76d54

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/vsg/state/DescriptorSet.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,19 @@ void DescriptorSet::compile(Context& context)
7171
{
7272
if (!_implementation[context.deviceID])
7373
{
74+
if (!setLayout)
75+
{
76+
throw Exception{"Error: invalid DescriptorSet as no setLayout assigned. ", VK_INCOMPLETE};
77+
}
78+
79+
if (setLayout->bindings.size() != descriptors.size())
80+
{
81+
throw Exception{make_string("Error: invalid DescriptorSet as setLayout bindings size (", setLayout->bindings.size() , ") and descriptors size ", descriptors.size(), ") not equal."), VK_INCOMPLETE};
82+
}
83+
7484
// make sure all the contributing objects are compiled
75-
if (setLayout) setLayout->compile(context);
85+
setLayout->compile(context);
86+
7687
for (auto& descriptor : descriptors) descriptor->compile(context);
7788

7889
_implementation[context.deviceID] = context.allocateDescriptorSet(setLayout);

0 commit comments

Comments
 (0)