summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Kraus <petr_kraus@email.cz>2017-10-11 19:36:59 +0200
committerPetr Kraus <petr_kraus@email.cz>2017-10-12 14:46:31 +0200
commitfc0178407f247de55dd7556c018869d414667706 (patch)
treede5d794e9a4128ba513fe7aedfceb843fd0d90e7
parentd2d907e4f3730bc4290b518faf0604492b302693 (diff)
downloadvulkan-spec-fc0178407f247de55dd7556c018869d414667706.zip
vulkan-spec-fc0178407f247de55dd7556c018869d414667706.tar.xz
Fix some void* (auto)validity
- Make implicit validity for optional `void*` mean "nothing" in the script - Make `optional` mean non-NULL for `void*` (not implemented) - Uses of `void*` that point to something should have `noautovalidity` (adding it) - Add missing explicit VUs of `void*` parameters (`vkCmdPushDescriptorSetWithTemplateKHR` and `vkUpdateDescriptorSetWithTemplateKHR`) - Also indirectly fixes `vkMapMemory`, `VkAllocationCallbacks`, `VkDebugReportCallbackCreateInfoEXT`, and Apple and NN surface create - Remove ugly text hack from script
-rw-r--r--doc/specs/vulkan/chapters/descriptorsets.txt14
-rw-r--r--src/spec/validitygenerator.py22
-rw-r--r--src/spec/vk.xml12
3 files changed, 34 insertions, 14 deletions
diff --git a/doc/specs/vulkan/chapters/descriptorsets.txt b/doc/specs/vulkan/chapters/descriptorsets.txt
index 6e40b26..1e60aa4 100644
--- a/doc/specs/vulkan/chapters/descriptorsets.txt
+++ b/doc/specs/vulkan/chapters/descriptorsets.txt
@@ -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[]
diff --git a/src/spec/validitygenerator.py b/src/spec/validitygenerator.py
index cfae285..355ad98 100644
--- a/src/spec/validitygenerator.py
+++ b/src/spec/validitygenerator.py
@@ -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('*')
+ # Treat void* as an int
+ if paramtype.text == 'void':
+ 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 += 'a pointer to '
+ asciidoc += 'pointer to a '
+ # Handle void* and pointers to it
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:
+ # 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':
diff --git a/src/spec/vk.xml b/src/spec/vk.xml
index 7ed72c5..958e8d2 100644
--- a/src/spec/vk.xml
+++ b/src/spec/vk.xml
@@ -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>