aboutsummaryrefslogtreecommitdiff
path: root/layers/descriptor_sets.cpp
AgeCommit message (Collapse)Author
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 cmd buffer binding for descriptor resourcesTobin Ehlis
This commit creates bindings between a cmd buffer and the images/buffers and their memory allocations that are tied to that cmd buffer's active descriptor slots (set/binding combination). The active resources are anything that's in use during any of the draws issued in the cmd buffer. If any of the bound resources are deleted, the cmd buffer will become invalid and an error will be issued on the next attempt to submit it.
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-22layers: Fix spelling dynami->dynamicTobin Ehlis
2016-08-01layers: Validate image view type requirement for descriptor setsChris Forbes
Signed-off-by: Chris Forbes <chrisforbes@google.com>
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-21layers: Validation buffer descriptor updates for bound memoryTobin Ehlis
When updating buffer descriptors, make sure that there is memory bound to any non-sparse buffer. Add comment that we don't need to do this for image descriptor updates because they require the imageView (not just image) and we already validate at imageView creation that memory is bound to image.
2016-07-19layers: Remove DRAWSTATE_INVALID_POOL checkTobin Ehlis
This check was only flagged when Allocating descriptor sets or resetting a descriptor pool, and in both cases object_tracker will be the first layer to identify and flag the error. Removing this as a redundant check and updating documentation.
2016-07-06tests: Add tests for invalid VkDescriptorBufferInfoTobin Ehlis
Hit 3 new checks just added for VkDescriptorBufferInfo: 1. offset larger than buffer 2. range of 0 3. range larger than buffer size minus offset Also update descriptor write and copy update error enums to be more clear, along with also updating documentation.
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-20layers: GH644 Validate DS image aspect bit restrictionTobin Ehlis
If a DS image is used in a descriptor, regardless of the underlying image layout, we need to validate that BOTH DEPTH and STENCIL aspect bits are NOT set. Only one of the two bits is allowed.
2016-06-20layers: Fix dynamic descriptor countTobin Ehlis
When creating descriptor set layout, we were only incrementing the dynamic descriptor count by 1 regardless of the number of descriptors in a binding. This fix increments the count by the number of descriptors in the binding.
2016-06-02layers: Clean up poolMap accessTobin Ehlis
Remove some unneeded passing of poolMap around and use getPoolNode() function in DescriptorSet class.
2016-06-02layers: Added getSwapchainNode() helperTobin Ehlis
Added getSwapchainNode() helper to core_validation and update DescriptorSet class to use it.
2016-06-02layers: Add getSwapchainFromImage() helperTobin Ehlis
Add getSwapchainFromImage() to core_validation and use it from DescriptorSet class.
2016-06-02layers: Remove unneeded layout_mapTobin Ehlis
2016-06-02layers: Add getImageNode() helperTobin Ehlis
Add getImageNode() helper to core_validation and use it. Also update DescriptorSet class to use the helper and kill its image_map member.
2016-06-02layers: Add getImageViewData() helperTobin Ehlis
Switch imageViewMap to store unique_ptrs. Add getImageViewDate() helper to core_validation and update DescriptorSet to use it.
2016-06-02layers: Add getSamplerNode() helperTobin Ehlis
Kill sampler_map_ in DescriptorSet and add getSamplerNode() helper and use it instead.
2016-06-02layers: Add getBufferViewInfo() helperTobin Ehlis
Add helper function to core_validation for bufferViewMap look-ups and use the helper in DescriptorSet class.
2016-06-02layers: Update getMemObjInfo helperTobin Ehlis
Standardize core_validation use of getMemObjInfo() and update DescriptorSet class to use it as well.
2016-06-02layers: Add getBufferNode() helperTobin Ehlis
Move core_validation bufferMap to use unique_ptr to BUFFER_NODE. Perform bufferMap look-ups using getBufferNode() helper function. Update DescriptorSet class to use getBufferNode() helper and store layer_data instead of bufferMap.
2016-06-02layers: Make layer_data visible to DescriptorSetTobin Ehlis
This is the start of migrating core_validation::layer_data to be visible in DescriptorSet class. DescriptorSet class can't see the contents of layer_data, so it also needs the get<Object>() helper functions to look up items from the maps. This first change only brings along getSetNode() utility function so only set_map references can be removed. Will add follow-on CLs to remove more maps from DescriptorSet class and bring in more utility functions.
2016-06-02layers: Pass common data between pre/post AllocDescriptorSetsTobin Ehlis
With the break between PreValidate* and PostRecord* calls in the layers we can suffer having to do some repeat work in the Post step. In order to prevent this, this CL slightly modifies the interface to pass common data between the pre/post calls in a custom AllocateDescriptorSetsData struct. I initially attempted to fill this data in a separate function that would preceed the PreValidate* call, but such a function would need to include some validation as it includes map checks which may fail. The simplest solution, then, seems to be passing a ptr to the common data to the PreValidate* function who then fills the data. If the validation and call down the chain succeed, the PostRecord* function then takes a ptr to the common data to prevent having to redo the work that was done at validation time.
2016-06-02layers: Add DescriptorSet interface for allocationTobin Ehlis
Create a top-level "Validate" and "Perform" interface for the vkAllocateDescriptorSets() function in DescriptorSet class. Refactor AllocateDescriptorSets() in core_validation to use the new interface. All checks are now performed in a "Pre" function and all state updates are recorded in a "Post" function.
2016-06-02layers: GH611 Fix dynamic offset indexingiostrows
2016-05-31layers: DescriptorSet class indentation fixesTobin Ehlis
More cases where "else" blocks weren't needed because the "if" block returns.
2016-05-31layers: Improve descriptor copy update validationTobin Ehlis
Add buffer usage bit validation for descriptor copy updates. Pass down known descriptor type to copy validate function to avoid having to look it up again. Fix various incorrect "write" references in the copy update error messages.
2016-05-31layers: Remove unneeded else blockTobin Ehlis
The "if" case returns so no need for this else block or the indentation that it includes.
2016-05-31layers: Add usage bit validation for buffer descriptorsTobin Ehlis
Verify that buffer used to update all buffer descriptor types (texel or general) has the correct usage bits set. descriptor
2016-05-31layers: Add usage bit validation for image descriptorsTobin Ehlis
Verify that images used in imageView that's passed to various image descriptor types have the correct usage bits set.
2016-05-31layers: take better advantage of emplace_back in descriptor setsChris Forbes
Doesn't win us anything to use emplace_back to invoke a copy constructor. Construct the unique_ptr from raw ptr in-place instead. Signed-off-by: Chris Forbes <chrisforbes@google.com>
2016-05-31layers: Remove old hacks for imprecise descriptor tracking for computeChris Forbes
We do it properly now. Signed-off-by: Chris Forbes <chrisforbes@google.com>
2016-05-19layers: DescriptorSet class clean-upTobin Ehlis
Minor formatting improvements, removed some useless "const" decls and unused vars and updated a few error codes to be more appropriate.
2016-05-19layers: Verify that src of copy update is updatedTobin Ehlis
Before verifying source update comments make sure that the source descriptors have been updated. This guards against some obscure corner cases where a bad source descriptor could slip through the content verification.
2016-05-19layers: Refactor DescriptorSet update interfaceTobin Ehlis
Mainly refactor and moving code in order to provide an interface to DescriptorSet class that matches top-level vkUpdateDescriptorSets() function. Split the validation of an update as a separate task from performing the update. This allows validation prior to calling down the chain and then only update the state if validation is clean. Hoisted all of the update validation into the DescriptorSet class which prevents having to copy all of the maps into the individual Descriptor classes. This simplifies both their creation and updating their contents. Updated the top-level core_validation UpdateDescriptorSets() code to match Vulkan Validation Layer Authoring Guidelines. As this is an initial POC for the architecture, I kept the Pre* & Post* functions in the core_validation.cpp file, but they should eventually be spun out.
2016-05-19layers: Improve DescriptorSet cleanupTobin Ehlis
Create private helper function InvalidateBoundCmdBuffers() within the DescriptorSet class to unify invalidate cases due to set being updated or freed. Add a destructor for DescriptorSet to make sure that no bound cmd buffers hang on to deleted set references.
2016-05-19layers: Refactor DescriptorSet Update codeTobin Ehlis
This migrates code for DescriptorSet in_use and flagging bound command buffers as invalid from core_validation.cpp into DescriptorSet class.
2016-05-05layers: Migrate VerifyUpdateConsistency to DescriptorSetLayout classTobin Ehlis
This was in the DescriptorSet class, but really belonged in the Layer. There was also a bug where it did not correctly handle the case of an initial offset that oversteps the size of the first binding being updated. That is legal according to the spec so added code to handle that case by walking the bindings until we get to the actual binding on which the first update will occur.
2016-05-05layers: Store layout bindings_ by value instead of ptrTobin Ehlis
Kill the ptr to safe_VkDescriptorSetLayoutBinding in DescriptorSetLayout class. This saves us the "new" and the need for a custom destructor. Couldn't do this initially but I've since added copy constructors to all of the safe_* struct types.
2016-05-05layers: Remove unused IsUpdated(uint32_t) from DescriptorSet classTobin Ehlis
All of the functionality that I thought I would need this for is contained in the ValidateDrawState() function.
2016-05-05layers: Removed unused full_update_ from DescriptorSet classTobin Ehlis
I originally added this thinking it would be useful but currently unused and not correctly tracked so just killing it.
2016-05-05layers: Remove use of map at() function from descriptor_set classTobin Ehlis
2016-05-05layers: Clean up access to descriptors_ vectorTobin Ehlis
Migrate a number of unneccessary .at() calls to just use [] operator. Also replace push_back() calls at descriptor creation time with emplace_back().
2016-05-05layers: Rearchitect Descriptor Set validation codeTobin Ehlis
This change pulls all of the DescriptorSet code out of core_validation.cpp and into its own files/classes in descriptor_set.h/cpp. See header file for complete class documentation. These changes pass tri/cube/smoketest --validate. All related layer validation tests are also updated and passing. Finally, I ran it through mustpass CTS and did not hit any issues related to these changes. These changes not only update the descriptor interface but fix some known lingering bugs with how descriptor updates occurred. This includes now correctly handling updates that cross binding boundaries and updates that write a subset of a binding. Going forward this is a general outline for how we would like to evolve core_validation. That is, we'd like to move the functionality of the checks into reasonable classes and just have core_validation call into those classes to do the majority of the work.