Merge pull request #562 from krOoze/warn_when_pvoid_autovalidity

Tweak some void* (auto)validity
This commit is contained in:
Jon Leech 2017-10-12 15:33:24 -07:00 committed by GitHub
commit 9da85cc6eb
3 changed files with 37 additions and 17 deletions

View File

@ -2373,6 +2373,15 @@ include::../api/protos/vkUpdateDescriptorSetWithTemplateKHR.txt[]
of slink:VkDescriptorImageInfo, slink:VkDescriptorBufferInfo, or
slink:VkBufferView used to write the descriptors.
.Valid Usage
****
* pname:pData must: be a pointer to a memory that contains one or more
valid instances of slink:VkDescriptorImageInfo,
slink:VkDescriptorBufferInfo, or slink:VkBufferView in a layout defined
by pname:descriptorUpdateTemplate when it was created with
flink:vkCreateDescriptorUpdateTemplateKHR
****
include::../validity/protos/vkUpdateDescriptorSetWithTemplateKHR.txt[]
.API example
@ -2699,6 +2708,11 @@ include::../api/protos/vkCmdPushDescriptorSetWithTemplateKHR.txt[]
The pipelineBindPoint specified during the creation of the descriptor
update template must: be supported by the pname:commandBuffer's parent
sname:VkCommandPool's queue family
* pname:pData must: be a pointer to a memory that contains one or more
valid instances of slink:VkDescriptorImageInfo,
slink:VkDescriptorBufferInfo, or slink:VkBufferView in a layout defined
by pname:descriptorUpdateTemplate when it was created with
flink:vkCreateDescriptorUpdateTemplateKHR
****
include::../validity/protos/vkCmdPushDescriptorSetWithTemplateKHR.txt[]

View File

@ -406,22 +406,28 @@ class ValidityOutputGenerator(OutputGenerator):
elif self.paramIsPointer(param):
# Handle pointers - which are really special case arrays (i.e. they don't have a length)
#TODO should do something here if someone ever uses some intricate comma-separated `optional`
pointercount = paramtype.tail.count('*')
# Could be multi-level pointers (e.g. ppData - pointer to a pointer). Handle that.
for i in range(0, pointercount):
asciidoc += 'a pointer to '
# Treat void* as an int
if paramtype.text == 'void':
# If there's only one pointer, it's optional, and it doesn't point at anything in particular - we don't need any language.
if pointercount == 1 and param.attrib.get('optional') is not None:
pointercount -= 1
# Could be multi-level pointers (e.g. ppData - pointer to a pointer). Handle that.
asciidoc += 'a '
for i in range(0, pointercount):
asciidoc += 'pointer to a '
# Handle void* and pointers to it
if paramtype.text == 'void':
# If there is only void*, it is just optional int - we don't need any language.
if pointercount == 0 and param.attrib.get('optional') is not None:
return '' # early return
else:
# Pointer to nothing in particular - delete the " to " portion
asciidoc = asciidoc[:-4]
else:
# Add an article for English semantic win
asciidoc += 'a '
if param.attrib.get('optional').split(',')[pointercount] is not None:
# The last void* is just optional int (e.g. to be filled by the impl.)
typetext = 'pointer value'
# If a value is "const" that means it won't get modified, so it must be valid going into the function.
if param.text is not None and paramtype.text != 'void':

View File

@ -1527,7 +1527,7 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<member values="VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN"><type>VkStructureType</type> <name>sType</name></member>
<member>const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkViSurfaceCreateFlagsNN</type> <name>flags</name></member>
<member><type>void</type>* <name>window</name></member>
<member noautovalidity="true"><type>void</type>* <name>window</name></member>
</type>
<type category="struct" name="VkWaylandSurfaceCreateInfoKHR">
<member values="VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR"><type>VkStructureType</type> <name>sType</name></member>
@ -2317,13 +2317,13 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<member values="VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK"><type>VkStructureType</type> <name>sType</name></member>
<member>const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkIOSSurfaceCreateFlagsMVK</type> <name>flags</name></member>
<member>const <type>void</type>* <name>pView</name></member>
<member noautovalidity="true">const <type>void</type>* <name>pView</name></member>
</type>
<type category="struct" name="VkMacOSSurfaceCreateInfoMVK">
<member values="VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK"><type>VkStructureType</type> <name>sType</name></member>
<member>const <type>void</type>* <name>pNext</name></member>
<member optional="true"><type>VkMacOSSurfaceCreateFlagsMVK</type> <name>flags</name></member>
<member>const <type>void</type>* <name>pView</name></member>
<member noautovalidity="true">const <type>void</type>* <name>pView</name></member>
</type>
<type category="struct" name="VkViewportWScalingNV">
<member><type>float</type> <name>xcoeff</name></member>
@ -3796,7 +3796,7 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<param><type>VkDeviceSize</type> <name>offset</name></param>
<param><type>VkDeviceSize</type> <name>size</name></param>
<param optional="true"><type>VkMemoryMapFlags</type> <name>flags</name></param>
<param><type>void</type>** <name>ppData</name></param>
<param optional="false,true"><type>void</type>** <name>ppData</name></param>
</command>
<command>
<proto><type>void</type> <name>vkUnmapMemory</name></proto>
@ -5222,7 +5222,7 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<param><type>VkDevice</type> <name>device</name></param>
<param externsync="true"><type>VkDescriptorSet</type> <name>descriptorSet</name></param>
<param><type>VkDescriptorUpdateTemplateKHR</type> <name>descriptorUpdateTemplate</name></param>
<param>const <type>void</type>* <name>pData</name></param>
<param noautovalidity="true">const <type>void</type>* <name>pData</name></param>
</command>
<command queues="graphics,compute" renderpass="both" cmdbufferlevel="primary,secondary">
<proto><type>void</type> <name>vkCmdPushDescriptorSetWithTemplateKHR</name></proto>
@ -5230,7 +5230,7 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<param><type>VkDescriptorUpdateTemplateKHR</type> <name>descriptorUpdateTemplate</name></param>
<param><type>VkPipelineLayout</type> <name>layout</name></param>
<param><type>uint32_t</type> <name>set</name></param>
<param>const <type>void</type>* <name>pData</name></param>
<param noautovalidity="true">const <type>void</type>* <name>pData</name></param>
</command>
<command>
<proto><type>void</type> <name>vkSetHdrMetadataEXT</name></proto>