aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-10-06 14:16:14 -0600
committerTobin Ehlis <tobine@google.com>2016-10-07 12:01:41 -0600
commit8d02126987816200539cc1303092402b30a6dcb7 (patch)
treec17a8e2449c2b91134dfdff722a3d51b03b74e9c
parent335e331c1edb42d069c05326432baba26d90e085 (diff)
downloadusermoji-8d02126987816200539cc1303092402b30a6dcb7.tar.xz
layers: Add flags for some descriptor validation
Add flags that can gate descriptor checks for in-use descriptor, push constant ranges, and allocate & free descriptors.
-rw-r--r--layers/core_validation.cpp18
-rw-r--r--layers/core_validation.h4
2 files changed, 17 insertions, 5 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 33a7106a..e2be8fee 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -3851,11 +3851,13 @@ void SetLayout(const layer_data *dev_data, GLOBAL_CB_NODE *pCB, VkImageView imag
// func_str is the name of the calling function
// Return false if no errors occur
// Return true if validation error occurs and callback returns true (to skip upcoming API call down the chain)
-static bool validateIdleDescriptorSet(const layer_data *my_data, VkDescriptorSet set, std::string func_str) {
+static bool validateIdleDescriptorSet(const layer_data *dev_data, VkDescriptorSet set, std::string func_str) {
+ if (dev_data->instance_state->disabled.idle_descriptor_set)
+ return false;
bool skip_call = false;
- auto set_node = my_data->setMap.find(set);
- if (set_node == my_data->setMap.end()) {
- skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
+ auto set_node = dev_data->setMap.find(set);
+ if (set_node == dev_data->setMap.end()) {
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
(uint64_t)(set), __LINE__, DRAWSTATE_DOUBLE_DESTROY, "DS",
"Cannot call %s() on descriptor set 0x%" PRIxLEAST64 " that has not been allocated.", func_str.c_str(),
(uint64_t)(set));
@@ -3863,7 +3865,7 @@ static bool validateIdleDescriptorSet(const layer_data *my_data, VkDescriptorSet
// TODO : This covers various error cases so should pass error enum into this function and use passed in enum here
if (set_node->second->in_use.load()) {
skip_call |=
- log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
(uint64_t)(set), __LINE__, VALIDATION_ERROR_00919, "DS",
"Cannot call %s() on descriptor set 0x%" PRIxLEAST64 " that is in use by a command buffer. %s",
func_str.c_str(), (uint64_t)(set), validation_error_map[VALIDATION_ERROR_00919]);
@@ -6630,6 +6632,8 @@ CreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo
// Note that the index argument is optional and only used by CreatePipelineLayout.
static bool validatePushConstantRange(const layer_data *dev_data, const uint32_t offset, const uint32_t size,
const char *caller_name, uint32_t index = 0) {
+ if (dev_data->instance_state->disabled.push_constant_range)
+ return false;
uint32_t const maxPushConstantsSize = dev_data->phys_dev_properties.properties.limits.maxPushConstantsSize;
bool skip_call = false;
// Check that offset + size don't exceed the max.
@@ -6787,6 +6791,8 @@ ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescript
// as well as DescriptorSetLayout ptrs used for later update.
static bool PreCallValidateAllocateDescriptorSets(layer_data *dev_data, const VkDescriptorSetAllocateInfo *pAllocateInfo,
cvdescriptorset::AllocateDescriptorSetsData *common_data) {
+ if (dev_data->instance_state->disabled.allocate_descriptor_sets)
+ return false;
// All state checks for AllocateDescriptorSets is done in single function
return cvdescriptorset::ValidateAllocateDescriptorSets(dev_data->report_data, pAllocateInfo, dev_data, common_data);
}
@@ -6822,6 +6828,8 @@ AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllo
// Verify state before freeing DescriptorSets
static bool PreCallValidateFreeDescriptorSets(const layer_data *dev_data, VkDescriptorPool pool, uint32_t count,
const VkDescriptorSet *descriptor_sets) {
+ if (dev_data->instance_state->disabled.free_descriptor_sets)
+ return false;
bool skip_call = false;
// First make sure sets being destroyed are not currently in-use
for (uint32_t i = 0; i < count; ++i)
diff --git a/layers/core_validation.h b/layers/core_validation.h
index d701903d..22ee28dc 100644
--- a/layers/core_validation.h
+++ b/layers/core_validation.h
@@ -71,6 +71,10 @@ struct CHECK_DISABLED {
bool command_buffer_state;
bool destroy_buffer_view; // Skip validation at DestroyBufferView time
bool object_in_use; // Skip all object in_use checking
+ bool idle_descriptor_set; // Skip check to verify that descriptor set is no in-use
+ bool push_constant_range; // Skip push constant range checks
+ bool free_descriptor_sets; // Skip validation prior to vkFreeDescriptorSets()
+ bool allocate_descriptor_sets; // Skip validation prior to vkAllocateDescriptorSets()
};
#if MTMERGE