layers: Fix WriteDescriptorSet::dstSet validation
authorDustin Graves <dustin@lunarg.com>
Thu, 30 Mar 2017 21:42:16 +0000 (15:42 -0600)
committerDustin Graves <dustin@lunarg.com>
Fri, 31 Mar 2017 16:03:46 +0000 (10:03 -0600)
VkWriteDescriptorSet::dstSet is ignored by vkCmdPushDescriptorSetsKHR,
so the 'must not be a null handle' validation for dstSet has been moved
from the code validating the VkWriteDescriptor struct members to the
code validating the vkUpdateDescriptorSets function parameters.

Change-Id: Ia6f11d33e4d57d4c848aab72cfd91da5d5a15a30

layers/parameter_validation.cpp
scripts/parameter_validation_generator.py

index bc41f125577f9c9a25fbc685b47d99cb3185cc70..0edce558f8c17a895c160476ecc9afc7f6c71f40 100644 (file)
@@ -3792,6 +3792,11 @@ VKAPI_ATTR void VKAPI_CALL UpdateDescriptorSets(VkDevice device, uint32_t descri
                             i, validation_error_map[VALIDATION_ERROR_00957]);
             }
 
+            // dstSet must be a valid VkDescriptorSet handle
+            skip |= validate_required_handle(report_data, "vkUpdateDescriptorSets",
+                                             ParameterName("pDescriptorWrites[%i].dstSet", ParameterName::IndexVector{i}),
+                                             pDescriptorWrites[i].dstSet);
+
             if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) ||
                 (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) ||
                 (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
index 1d0dec8141de51363d57a94c99260bda8cf53f9f..57e5551dbdad6587fd93f1e4ead8f75583d007bc 100644 (file)
@@ -136,6 +136,8 @@ class ParamCheckerOutputGenerator(OutputGenerator):
             'vkEnumerateDeviceExtensionsProperties',
             'vkCreateDebugReportCallbackEXT',
             'vkDebugReportMessageEXT']
+        # Structure fields to ignore
+        self.structMemberBlacklist = { 'VkWriteDescriptorSet' : ['dstSet'] }
         # Validation conditions for some special case struct members that are conditionally validated
         self.structMemberValidationConditions = { 'VkPipelineColorBlendStateCreateInfo' : { 'logicOp' : '{}logicOpEnable == VK_TRUE' } }
         # Header version
@@ -360,6 +362,10 @@ class ParamCheckerOutputGenerator(OutputGenerator):
             isoptional = False
             if self.paramIsOptional(member) or (name == 'pNext') or (isstaticarray):
                 isoptional = True
+            # Determine if value should be ignored by code generation.
+            noautovalidity = False
+            if (member.attrib.get('noautovalidity') is not None) or ((typeName in self.structMemberBlacklist) and (name in self.structMemberBlacklist[typeName])):
+                noautovalidity = True
             membersInfo.append(self.CommandParam(type=type, name=name,
                                                 ispointer=self.paramIsPointer(member),
                                                 isstaticarray=isstaticarray,
@@ -368,7 +374,7 @@ class ParamCheckerOutputGenerator(OutputGenerator):
                                                 isconst=True if 'const' in cdecl else False,
                                                 isoptional=isoptional,
                                                 iscount=iscount,
-                                                noautovalidity=True if member.attrib.get('noautovalidity') is not None else False,
+                                                noautovalidity=noautovalidity,
                                                 len=self.getLen(member),
                                                 extstructs=member.attrib.get('validextensionstructs') if name == 'pNext' else None,
                                                 condition=conditions[name] if conditions and name in conditions else None,