diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-07-25 18:10:41 +1200 |
|---|---|---|
| committer | Chris Forbes <chrisforbes@google.com> | 2016-08-01 09:13:51 +1200 |
| commit | a003ab3d2d94bd93246b98a36ab42d2c72f084ee (patch) | |
| tree | a3637df857ab0470f88596df711c7b2fb2e8bef0 /layers/descriptor_sets.cpp | |
| parent | 40f0fc36c8bf1eb0bb0440b43d7b723134ef13c9 (diff) | |
| download | usermoji-a003ab3d2d94bd93246b98a36ab42d2c72f084ee.tar.xz | |
layers: Add plumbing for descriptor requirements
We want to be able to impose requirements on images & views bound to
descriptor sets based on their usage in the shader. This adds the
plumbing from pipelines into descriptor sets to enable that.
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/descriptor_sets.cpp')
| -rw-r--r-- | layers/descriptor_sets.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index a149485f..b3a49670 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -335,10 +335,11 @@ bool cvdescriptorset::DescriptorSet::IsCompatible(const DescriptorSetLayout *lay // This includes validating that all descriptors in the given bindings are updated, // that any update buffers are valid, and that any dynamic offsets are within the bounds of their buffers. // Return true if state is acceptable, or false and write an error message into error string -bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::unordered_set<uint32_t> &bindings, +bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::unordered_map<uint32_t, descriptor_req> &bindings, const std::vector<uint32_t> &dynamic_offsets, std::string *error) const { auto dyn_offset_index = 0; - for (auto binding : bindings) { + for (auto binding_pair : bindings) { + auto binding = binding_pair.first; if (!p_layout_->HasBinding(binding)) { std::stringstream error_str; error_str << "Attempting to validate DrawState for binding #" << binding @@ -417,11 +418,12 @@ bool cvdescriptorset::DescriptorSet::ValidateDrawState(const std::unordered_set< return true; } // For given bindings, place any update buffers or images into the passed-in unordered_sets -uint32_t cvdescriptorset::DescriptorSet::GetStorageUpdates(const std::unordered_set<uint32_t> &bindings, +uint32_t cvdescriptorset::DescriptorSet::GetStorageUpdates(const std::unordered_map<uint32_t, descriptor_req> &bindings, std::unordered_set<VkBuffer> *buffer_set, std::unordered_set<VkImageView> *image_set) const { auto num_updates = 0; - for (auto binding : bindings) { + for (auto binding_pair : bindings) { + auto binding = binding_pair.first; // If a binding doesn't exist, skip it if (!p_layout_->HasBinding(binding)) { continue; |
