Skip to content

Commit 1e582d0

Browse files
committed
Handle empty descriptor sets in pipeline layout
The VSG generates layouts like this when descriptor bindings are dependent on defines, and doesn't generate matching empty BindDescriptorSet instances to go with them. That disrupts the fix in the previous commit, so they must be handled as if they don't exist. Even though the pipeline layout says these sets exist, there's no need to bind anything to them as they inherently can't be statically used by the pipeline.
1 parent 1a45b1a commit 1e582d0

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

include/vsg/state/DescriptorSetLayout.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ namespace vsg
3737
/// VkDescriptorSetLayoutCreateInfo settings
3838
DescriptorSetLayoutBindings bindings;
3939

40+
virtual bool empty() const { return bindings.empty(); }
41+
4042
/// map the descriptor bindings to the descriptor pool sizes that will be required to represent them.
4143
void getDescriptorPoolSizes(DescriptorPoolSizes& descriptorPoolSizes);
4244

include/vsg/state/ViewDependentState.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ namespace vsg
3333
public:
3434
ViewDescriptorSetLayout();
3535

36+
bool empty() const override { return false; }
37+
3638
VkDescriptorSetLayout vk(uint32_t deviceID) const override { return _viewDescriptorSetLayout ? _viewDescriptorSetLayout->vk(deviceID) : 0; }
3739

3840
int compare(const Object& rhs_object) const override;

src/vsg/state/PipelineLayout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void PipelineLayout::compile(Context& context)
130130
for (auto dsl : setLayouts)
131131
{
132132
if (dsl) dsl->compile(context);
133-
descriptorSetSlots.push_back(dsl != nullptr);
133+
descriptorSetSlots.push_back(dsl != nullptr && !dsl->empty());
134134
}
135135
_implementation[context.deviceID] = PipelineLayout::Implementation::create(context.device, setLayouts, pushConstantRanges, flags);
136136
}

0 commit comments

Comments
 (0)