Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/vsg/state/PipelineLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ namespace vsg
void release(uint32_t deviceID) { _implementation[deviceID] = {}; }
void release() { _implementation.clear(); }

// returns whether the layouts are push-constant-compatible and the lowest N for which the layouts are not compatible for descriptor set N
std::pair<bool, uint32_t> computeCompatibility(const PipelineLayout& other);

public:
ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return PipelineLayout::create(*this, copyop); }
int compare(const Object& rhs) const override;
Expand Down
20 changes: 20 additions & 0 deletions src/vsg/state/PipelineLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ PipelineLayout::~PipelineLayout()
{
}

std::pair<bool, uint32_t> vsg::PipelineLayout::computeCompatibility(const PipelineLayout& other)
{
auto result = std::make_pair<bool, uint32_t>(compare_value_container(pushConstantRanges, other.pushConstantRanges) == 0, 0);
if (!result.first)
return result;
#ifdef VK_EXT_graphics_pipeline_library
if ((flags & VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT) != (other.flags & VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT))
return result;
#endif
for (result.second = 0; result.second < std::min(setLayouts.size(), other.setLayouts.size()); ++result.second)
{
// if this is a partial layout for a graphics pipeline library, it may be made compatible later
if (!setLayouts[result.second] || !other.setLayouts[result.second])
continue;
if (compare_value_container(setLayouts[result.second]->bindings, other.setLayouts[result.second]->bindings) != 0)
break;
}
return result;
}

int PipelineLayout::compare(const Object& rhs_object) const
{
int result = Object::compare(rhs_object);
Expand Down
Loading