/ appendices / VK_EXT_transform_feedback.txt
VK_EXT_transform_feedback.txt
  1  include::meta/VK_EXT_transform_feedback.txt[]
  2  
  3  *Last Modified Data*::
  4      2018-10-09
  5  *Contributors*::
  6    - Baldur Karlsson, Valve
  7    - Boris Zanin, Mobica
  8    - Daniel Rakos, AMD
  9    - Donald Scorgie, Imagination
 10    - Henri Verbeet, CodeWeavers
 11    - Jan-Harald Fredriksen, Arm
 12    - Jason Ekstrand, Intel
 13    - Jeff Bolz, NVIDIA
 14    - Jesse Barker, Unity
 15    - Jesse Hall, Google
 16    - Pierre-Loup Griffais, Valve
 17    - Philip Rebohle, DXVK
 18    - Ruihao Zhang, Qualcomm
 19    - Samuel Pitoiset, Valve
 20    - Slawomir Grajewski, Intel
 21    - Stu Smith, Imagination Technologies
 22  
 23  
 24  This extension adds transform feedback to the Vulkan API by exposing the
 25  SPIR-V code:TransformFeedback and code:GeometryStreams capabilities to
 26  capture vertex, tessellation or geometry shader outputs to one or more
 27  buffers.
 28  It adds API functionality to bind transform feedback buffers to capture the
 29  primitives emitted by the graphics pipeline from SPIR-V outputs decorated
 30  for transform feedback.
 31  The transform feedback capture can be paused and resumed by way of storing
 32  and retrieving a byte counter.
 33  The captured data can be drawn again where the vertex count is derived from
 34  the byte counter without CPU intervention.
 35  If the implementation is capable, a vertex stream other than zero can be
 36  rasterized.
 37  
 38  All these features are designed to match the full capabilities of OpenGL
 39  core transform feedback functionality and beyond.
 40  Many of the features are optional to allow base OpenGL ES GPUs to also
 41  implement this extension.
 42  
 43  The primary purpose of the functionality exposed by this extension is to
 44  support translation layers from other 3D APIs.
 45  This functionality is not considered forward looking, and is not expected to
 46  be promoted to a KHR extension or to core Vulkan.
 47  Unless this is needed for translation, it is recommended that developers use
 48  alternative techniques of using the GPU to process and capture vertex data.
 49  
 50  === New Object Types
 51  
 52  None.
 53  
 54  === New Enum Constants
 55  
 56    * Extending elink:VkStructureType:
 57  
 58    ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT
 59    ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT
 60    ** ename:VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT
 61  
 62    * Extending elink:VkQueryType:
 63  
 64    ** ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT
 65  
 66    * Extending elink:VkBufferUsageFlagBits:
 67  
 68    ** ename:VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT
 69    ** ename:VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT
 70  
 71    * Extending elink:VkAccessFlagBits:
 72  
 73    ** ename:VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT
 74    ** ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT
 75    ** ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT
 76  
 77    * Extending elink:VkPipelineStageFlagBits:
 78  
 79    ** ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT
 80  
 81  === New Enums
 82  
 83    * tlink:VkPipelineRasterizationStateStreamCreateFlagsEXT
 84  
 85  === New Structures
 86  
 87    * Extending slink:VkPhysicalDeviceFeatures2:
 88    ** slink:VkPhysicalDeviceTransformFeedbackFeaturesEXT
 89    * Extending slink:VkPhysicalDeviceProperties2:
 90    ** slink:VkPhysicalDeviceTransformFeedbackPropertiesEXT
 91    * Extending slink:VkPipelineRasterizationStateCreateInfo
 92    ** slink:VkPipelineRasterizationStateStreamCreateInfoEXT
 93  
 94  === New Functions
 95  
 96    * flink:vkCmdBindTransformFeedbackBuffersEXT
 97    * flink:vkCmdBeginTransformFeedbackEXT
 98    * flink:vkCmdEndTransformFeedbackEXT
 99    * flink:vkCmdBeginQueryIndexedEXT
100    * flink:vkCmdEndQueryIndexedEXT
101    * flink:vkCmdDrawIndirectByteCountEXT
102  
103  === Issues
104  
105  1) Should we include pause/resume functionality?
106  
107  *RESOLVED*: Yes, this is needed to ease layering other APIs which have this
108  functionality.
109  To pause use fname:vkCmdEndTransformFeedbackEXT and provide valid buffer
110  handles in the pname:pCounterBuffers array and offsets in the
111  pname:pCounterBufferOffsets array for the implementation to save the resume
112  points.
113  Then to resume use fname:vkCmdBeginTransformFeedbackEXT with the previous
114  pname:pCounterBuffers and pname:pCounterBufferOffsets values.
115  Between the pause and resume there needs to be a memory barrier for the
116  counter buffers with a source access of
117  ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT at pipeline stage
118  ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT to a destination access
119  of ename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT at pipeline stage
120  ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT.
121  
122  2) How does this interact with multiview?
123  
124  *RESOLVED*: Transform feedback cannot be made active in a render pass with
125  multiview enabled.
126  
127  3) How should queries be done?
128  
129  *RESOLVED*: There is a new query type
130  ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT.
131  A query pool created with this type will capture 2 integers -
132  numPrimitivesWritten and numPrimitivesNeeded - for the specified vertex
133  stream output from the last vertex processing stage.
134  The vertex stream output queried is zero by default, but can be specified
135  with the new fname:vkCmdBeginQueryIndexedEXT and
136  fname:vkCmdEndQueryIndexedEXT commands.
137  
138  === Version History
139  
140    * Revision 1, 2018-10-09 (Piers Daniell)
141      - Internal revisions