aboutsummaryrefslogtreecommitdiff
path: root/layers/descriptor_sets.h
AgeCommit message (Collapse)Author
2018-01-26layers: Add push descriptor set layout create VUIDJohn Zulauf
Add VUID checks to vkCreateDescriptorSetLayout for push descriptor sets. Additional checks include: VALIDATION_ERROR_05000230 VkDescriptorSetLayoutCreateInfo-flags-00280 VALIDATION_ERROR_05000232 VkDescriptorSetLayoutCreateInfo-flags-00281 Also added check for use of VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR when the required extension VK_KHR_push_descriptor is not enabled. Updated CreateDescriptorSetBindingWithIgnoredSamplers test, which violated the above check. Change-Id: Ie009019bbb7859553df92473796a1a929a9464f7
2018-01-18layers: Add validation for destroyed layoutsJohn Zulauf
Add three tests to flag with descriptor set update operations are being done to descriptor sets with destroyed descriptor set layouts. The tests use overload VUID (generic "must be valid * handles) which need to be replaced with specific ones when they are added to the spec. VALIDATION_ERROR_15c00280 (write dst must be valid) -> write dst created from destroyed layout VALIDATION_ERROR_03207601 (copy dst must be valid) -> copy dst created from destroyed layout VALIDATION_ERROR_0322d201 (copy src must be valid) -> copy src create from destroyed layout Change-Id: I8a3edc67b3e86037cdaa6353176814abfddef1a0
2018-01-04layers: Add validation caching for draw/dispatchJohn Zulauf
Validation of descriptors at draw or dispatch time is now cached, s.t. without changes that affect validity, validation checks are not repeated. Change-Id: I713662d00813989bf4441921456afca431d730d7
2018-01-04layers: Replace iterative DS Get.* with maps/setsJohn Zulauf
Profiling indicated hot spots in DescriptorSet Get functions which iterated in binding space to lookup values. Replaced iterative searches with maps/sets. Additionally simplified construction, optimized map/set creation and Get.* for DescriptorSet and DescriptorSetLayout. Change-Id: Ia2948e56333d3643d4377b39e75acf4c951d558b
2018-01-04layers: Combine global binding start/end lookupJohn Zulauf
Binding start/end lookup where using two separate maps indexed on a common key. Combined to avoid repeated lookups. Change-Id: I57ed71736537de5eb83fe41599a8acec9bf23d13
2018-01-03tests: Add a guard around noexcept in vktestbinding.hDave Houlton
VS2013 does not provide 'noexcept'. Layers had multiple occurences of a NOEXCEPT macro to protect the VS2013 build. This commit consolidates that macro to a single location in vk_sdk_platform.h, which is also visible to the layer tests via test_common.h. Updates the vktestbinding.h occurences of 'noexcept' to use the NOEXCEPT macro. Change-Id: I38bf8c08cda6fe75de78dff69050a913b47f91b1
2017-10-26layers: Validate push descriptor set layout countJózef Kucia
2017-09-13layers: Use layout flags to test for push descriptor setsJózef Kucia
2017-08-31layers: Account for push descriptor sets in CVMark Lobodzinski
Change-Id: I1095edce0f26e2a4ced6fa301143622dc5cd0afd
2017-07-07layers:Identify layout from pipelineLayoutTobin Ehlis
When checking IsCompatible() for a DescriptorSetLayout, the passed-in layout is always from a pipelineLayout, however this was not specified in the code. Add comment to specify this usage and update the error message to always distinguish which of the layouts using in the compare is from the pipelineLayout.
2017-06-21layers:Make DSLayout const in shared_ptrsTobin Ehlis
Declare DescriptorSetLayout's const for shared_ptrs in Pipeline layout and DSAllocate structs.
2017-06-21layers:IsCompatible uses raw DSLayout ptrTobin Ehlis
Update IsCompatible calls for DescriptorSetLayout class to use raw ptrs instead of shared_ptr as the calls just temporarily use the ptr and don't affect ptr ownership.
2017-06-21layers:Set DescriptorSetLayout in DS to constTobin Ehlis
The DescriptorSetLayout pointed to by shared_ptr in DescriptorSet is const so add const across uses as appropriate.
2017-06-21layers:Pass shared_ptr by const refTobin Ehlis
DescriptorSetLayout shared_ptr will always survive the lifetime of the DescriptorSet constructor so pass by const ref.
2017-06-20layers:Migrate DSLayout to shared_ptrTobin Ehlis
Update Descriptor Set Layout copy in Descriptor Set, as well as various ptr references to use shared_ptr. This fixes some potential memory leaks and makes Descriptor Set class lighter weight.
2017-06-13layers: Use copies of layout data for descriptorsetsMark Lobodzinski
DescriptrSets used pointers to descriptorsetlayout data, which caused invalid references if the layouts were deleted before the descriptor sets. Changed the layer to copy the data. Change-Id: I671f1efed2aa0986f3a370b51f2f96c07b555af7
2017-05-09layers: Remove default ctors for {Image,}SamplerDescriptorChris Forbes
These just added confusion; we already support the !immut case in the other ctor. V2: ImageSamplerDescriptor remaining ctor was buggy.
2017-04-22layers: Switch CV over to layer object typesMark Lobodzinski
Convert internal uses of VkDebugReportObjectTypeEXT for the core- validation layer to use the internal layer-povided object-type. Also modified tests for changed error text. Change-Id: If080f4bf452ead0c6fecc648309bfd95b27fc0ce
2017-04-14layers:Add image layout validation for descriptorsTobin Ehlis
This change adds validation to make sure that an image layout at the time the image is used in a descriptor matches the layout that was given when the descriptor was updated. Because image view covers a range of mip levels, loop over each level and verify layouts one at a time. Also Updated a number of validate functions to use cont ptr params for data that they aren't changing.
2017-03-15layers:Connect VK_EXT_validation_flagsTobin Ehlis
Add support for VK_EXT_validation_flags in core_validation. The only enum currently supported is VK_VALIDATION_CHECK_ALL_EXT which disables all existing flags in validation. Note that most checks are still not guarded by flags so that option will only disable the checks that are guarded by flags. In testing this I found a bug with AllocateDescriptorSets() where common state was not updated with the flag enabled so this includes a fix for that issue as well.
2017-03-13layers: Add GetNextValidBinding function to CVMark Lobodzinski
Change-Id: Ifaa7aea1c7569ffaf5d417a1cd5caadaa38c96b0
2017-03-13layers: Move desc set helper to descriptorset moduleMark Lobodzinski
Change-Id: I695cf51b6fa27df7585582f545c0077efb9fd432
2017-02-08layers:Add using statements for layer_dataTobin Ehlis
Add "using core_validation::layer_data;" to descriptor and buffer validation files. This cleans up the code without adding any confusion or name collisions.
2017-02-06layers:Add buffer descriptor device limit checksTobin Ehlis
This adds missing checks for max range for storage and uniform buffer updates. Also update database file.
2017-01-26repo: Clang-format LVL source files using GoogleMark Lobodzinski
Switch clang-format standard from the LLVM style to the Google style for more consistency. Change-Id: I247c4abc275d7873a91522e1e234198adaa24033
2016-12-29layers:Don't pass active binding set aroundTobin Ehlis
The active bindings set was being passed around but the data is only used in a couple places and an alternate form of it is available in the binding->requirement map. Also, the binding set was wrong in that it stored bindings for all bound sets at draw time, but was being used to check bindings for individual sets.
2016-12-23layers:Split ValidateAndUpdateDrawState()Tobin Ehlis
Split ValidateAndUpdateDrawState() to isolate validation and state updates into ValidateDrawState() & UpdateDrawState() functions. Refactored CmdDraw() to use Pre/Post patter with all state updates now occurring in the Post function. Made some initial updates to other Draw/Dispatch functions to call each new function in-line, but will refactor these functions to use Pre/Post in follow-on commits.
2016-12-15layers:Refactor consecutive descriptor countTobin Ehlis
Refactor GetConsecutiveDescriptorCountFromBinding() to use the fact that bindings are now stored in-order. No longer need to chase binding order through the map, just get current binding index and then parse rest of the binding array in-order.
2016-12-15layers:Store DescriptorSetLayout class in-orderTobin Ehlis
Sort the bindings in the internal data structure of the DescriptorSetLayout class so that they're stored in binding order. This commit keeps the interface and mapping structures the same. Further commits will take more use of the fact that layout is now stored in binding order.
2016-12-02layers:Handle consecutive descriptor updatesTobin Ehlis
Fixes #1165 According to spec descriptor updates should roll over to the next binding number. If bindings were out of order, this was broken in validation. This fix corrects validation and state update for out-of-order descriptor bindings by checking consecutive updates based on correct binding count for consecutive bindings and by performing updates on a per-binding basis, making sure to roll update over to the correct next binding. Also update the error message, related negative test, and database file.
2016-11-17layers:Rename BUFFER_NODE->BUFFER_STATETobin Ehlis
2016-11-17layers:Fix descriptor dynamic offset handlingTobin Ehlis
Fixes #1162 The dynamic offsets passed in at descriptor bind time are ordered based on the binding order and any consecutive array indicies within those bindings. When we validate the dynamic offsets at draw time, we were using the entire dynamic offset array, but only the active bindings. If we had an inactive dynamic binding before the end of the bindings we would use the wrong offsets. This change fixes the issue by creating a mapping between bindings and dynamic offset array indicies at descriptor layout creation time. At draw time the mapping is then used to lookup the correct dynamic offset array index for a given binding.
2016-10-25layers:Refactor CreateDescriptorSetLayoutTobin Ehlis
Update CreateDescriptorSetLayout() to use Pre/Post pattern and split out validation of createInfo for the layout to occur before the creation of the layout.
2016-10-13layers:Bind descriptor pool to cmd bufferTobin Ehlis
Add pool state to DescriptorSet instead of just the pool. Then, at bind time, create a dual binding between the cmd buffer and the pool. This correcly puts pool in-use when cmd buffer is submitted, as well as flagging cmd buffer as INVALID if/when the pool is destroyed.
2016-10-13layers:Add pool member to DescriptorSet classTobin Ehlis
When creating a DescriptorSet instance, record the pool that the set is allocated from in a private pool_ variable. Then, when binding a set to a cmd buffer, also create a binding between the command buffer and the pool. This allows us to catch the in-use case when sets are implicitly freed by calling vkDestroyDescriptorPool().
2016-10-13layers:Rename DESCRIPTOR_POOL_NODE to *_STATETobin Ehlis
Continuing the NODE->STATE renaming effort
2016-10-10layers: Pass unique error codes through descriptor validationTobin Ehlis
Descriptor validation builds up error strings at multiple levels such as UpdateError->WriteUpdate->BufferUpdate->BufferOffset. The final error is then reported via a log_msg() call at the top level. In order for this design to allow for the new unique error codes, we need to pass error codes down the chain in the same way we pass error strings down the chain. This change adds error msg passing for descriptor updates. Many error codes are added in as well as comments for codes that are missing or need to be updated. The database file is also updated to account for all of the checks that were updated and/or reviewed.
2016-10-10layers: Fix Windows build warningsMark Lobodzinski
NOEXCEPT is defined multiple times Change-Id: I9aef970e9588c17071cd71a31873db4090d50b07
2016-10-07layers: Updating descriptor checks to use unique enumsTobin Ehlis
Initial batch of updates to use unique validation error enums and messages for a few checks. Updated the database file and flagged some other checks that are missing along with "TODO" notes in the code.
2016-09-26layers: Remove spurious using BASE_NODE::*.Chris Forbes
Inheritance is all public (except for FRAMEBUFFER_NODE, which ought to have been), and there's no template inheritance involved, so these didn't do anything interesting. Fix FRAMEBUFFER_NODE to publicly inherit BASE_NODE, and drop the noise everywhere. Signed-off-by: Chris Forbes <chrisforbes@google.com>
2016-08-24layers: Update descriptor binding to use an ordered mapTobin Ehlis
When dealing with dynamic offsets, the binding numbers, and array indices within a binding, are all sequential. This is according to the spec "Descriptor Set Binding" section which states, "...entries are ordered by the binding numbers in the descriptor set layouts; and within a binding array, elements are in order." This means when processing the binding numbers to validate the dynamic offsets at draw time, we should do so in order to make sure that the sequential dynamic offset index correctly correlates with the dynamic offset being processed.
2016-08-23layers: Add tracking between sampler and cmd bufferTobin Ehlis
Update SAMPLER_NODE to inherit from BASE_NODE and keep track of cb_bindings for sampler. At draw time, add any bindings between cmd buffer and samplers that are connected to active descriptors. At DestroySampler() time, set CB_INVALID for any cmd buffers in cb_bindings. Also includes some additional plumbing to prepare for connecting images/buffers that are tied to descriptor sets to cmd buffers that those sets are bound to.
2016-08-23layers: Only bind active sets to cmd buffersTobin Ehlis
Don't create a binding between every set bound to a cmd buffer, but only the sets that are verified active at draw time. Gather up active descriptorset bindings in prepration of also binding the resources from each individual active set to the cmd buffer.
2016-08-23layers: Add descriptor sets to CB_INVALID trackingTobin Ehlis
This is start of a series intended to enable CB_INVALID tracking for descriptor sets. Much of the tracking is already in place in the special-purpose uniqueBoundSets data struct, so I'll be migrating the tracking from that struct to the more general-purpose object_bindings set.
2016-08-01layers: Add plumbing for descriptor requirementsChris Forbes
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>
2016-07-06layers: Add validation for VkDescriptorBufferInfo structTobin Ehlis
For a descriptor write update to a buffer type, verify that the contents of VkDescriptorBufferInfo struct are valid according to valid usage guidelines of the spec. Spun off the usage bit validation into its own function ValidateBufferUsage(). Previous ValidateBufferUpdate() function now calls that function as well as performing all of the checks for the buffer, range, and offset members of VkDescriptorBufferInfo struct.
2016-06-28layers: Unify invalid command buffer handlingTobin Ehlis
Created a single vector to track any cmd buffer dependencies that are destroyed and thereby cause the cmd buffer to become invalid. Currently just tracking the previous object types of descriptor sets and framebuffers, but will update the tracking to include all cmd buffer dependencies in future commits.
2016-06-27layers: GH616 Improve descriptor set invalid binding handlingTobin Ehlis
Prior to calls to get an global index from a binding, make sure that HasBinding() is called to verify that the binding exists. Added HasBinding() calls to a couple of validation functions for early exist. Updated code comment to indicate that HasBinding() call should precede GetGlobal*IndexFromBinding() calls. Added assert() to GetGlobal*IndexFromBinding() calls in the error case to make error more obvious in debug builds. Note that Perform*Update() functions already indicate that they should be preceded by their matching Validate*Update() functions, which include the appropriate checks for HasBinding(). case the Validate*Update() funciont
2016-06-02layers: Comment updateTobin Ehlis
2016-06-02layers: Clean up poolMap accessTobin Ehlis
Remove some unneeded passing of poolMap around and use getPoolNode() function in DescriptorSet class.