vkCmdBeginTransformFeedbackEXT(3)

# vkCmdBeginTransformFeedbackEXT(3) Manual Page

## Name

vkCmdBeginTransformFeedbackEXT - Make transform feedback active in the command buffer

Loading… please wait.

## C Specification

Transform feedback for specific transform feedback buffers is made active by calling:

    // Provided by VK_EXT_transform_feedback
    void vkCmdBeginTransformFeedbackEXT(
        VkCommandBuffer                             commandBuffer,
        uint32_t                                    firstCounterBuffer,
        uint32_t                                    counterBufferCount,
        const VkBuffer*                             pCounterBuffers,
        const VkDeviceSize*                         pCounterBufferOffsets);

## Parameters

- `commandBuffer` is the command buffer into which the command is recorded.

- `firstCounterBuffer` is the index of the first transform feedback buffer corresponding to `pCounterBuffers`[0] and `pCounterBufferOffsets`[0].

- `counterBufferCount` is the size of the `pCounterBuffers` and `pCounterBufferOffsets` arrays.

- `pCounterBuffers` is `NULL` or a pointer to an array of VkBuffer handles to counter buffers. Each buffer contains a 4 byte integer value representing the byte offset from the start of the corresponding transform feedback buffer from where to start capturing vertex data. If the byte offset stored to the counter buffer location was done using vkCmdEndTransformFeedbackEXT it can be used to resume transform feedback from the previous location. If `pCounterBuffers` is `NULL`, then transform feedback will start capturing vertex data to byte offset zero in all bound transform feedback buffers. For each element of `pCounterBuffers` that is VK_NULL_HANDLE, transform feedback will start capturing vertex data to byte zero in the corresponding bound transform feedback buffer.

- `pCounterBufferOffsets` is `NULL` or a pointer to an array of `VkDeviceSize` values specifying offsets within each of the `pCounterBuffers` where the counter values were previously written. The location in each counter buffer at these offsets must be large enough to contain 4 bytes of data. This data is the number of bytes captured by the previous transform feedback to this buffer. If `pCounterBufferOffsets` is `NULL`, then it is assumed the offsets are zero.

## Description

The active transform feedback buffers will capture primitives emitted from the corresponding `XfbBuffer` in the bound graphics pipeline. Any `XfbBuffer` emitted that does not output to an active transform feedback buffer will not be captured.

Valid Usage

- VUID-vkCmdBeginTransformFeedbackEXT-transformFeedback-02366
  `VkPhysicalDeviceTransformFeedbackFeaturesEXT`::`transformFeedback` must be enabled

- VUID-vkCmdBeginTransformFeedbackEXT-None-02367
  Transform feedback must not be active

- VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02368
  `firstCounterBuffer` must be less than `VkPhysicalDeviceTransformFeedbackPropertiesEXT`::`maxTransformFeedbackBuffers`

- VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02369
  The sum of `firstCounterBuffer` and `counterBufferCount` must be less than or equal to `VkPhysicalDeviceTransformFeedbackPropertiesEXT`::`maxTransformFeedbackBuffers`

- VUID-vkCmdBeginTransformFeedbackEXT-counterBufferCount-02607
  If `counterBufferCount` is not `0`, and `pCounterBuffers` is not `NULL`, `pCounterBuffers` must be a valid pointer to an array of `counterBufferCount` `VkBuffer` handles that are either valid or VK_NULL_HANDLE

- VUID-vkCmdBeginTransformFeedbackEXT-pCounterBufferOffsets-02370
  For each buffer handle in the array, if it is not VK_NULL_HANDLE it must reference a buffer large enough to hold 4 bytes at the corresponding offset from the `pCounterBufferOffsets` array

- VUID-vkCmdBeginTransformFeedbackEXT-pCounterBuffer-02371
  If `pCounterBuffer` is `NULL`, then `pCounterBufferOffsets` must also be `NULL`

- VUID-vkCmdBeginTransformFeedbackEXT-pCounterBuffers-02372
  For each buffer handle in the `pCounterBuffers` array that is not VK_NULL_HANDLE it must have been created with a `usage` value containing `VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT`

- VUID-vkCmdBeginTransformFeedbackEXT-None-06233
  A valid graphics pipeline must be bound to `VK_PIPELINE_BIND_POINT_GRAPHICS`

- VUID-vkCmdBeginTransformFeedbackEXT-None-04128
  The last pre-rasterization shader stage of the bound graphics pipeline must have been declared with the `Xfb` execution mode

- VUID-vkCmdBeginTransformFeedbackEXT-None-02373
  Transform feedback must not be made active in a render pass instance with multiview enabled

Valid Usage (Implicit)

- VUID-vkCmdBeginTransformFeedbackEXT-commandBuffer-parameter
  `commandBuffer` must be a valid VkCommandBuffer handle

- VUID-vkCmdBeginTransformFeedbackEXT-pCounterBufferOffsets-parameter
  If `counterBufferCount` is not `0`, and `pCounterBufferOffsets` is not `NULL`, `pCounterBufferOffsets` must be a valid pointer to an array of `counterBufferCount` `VkDeviceSize` values

- VUID-vkCmdBeginTransformFeedbackEXT-commandBuffer-recording
  `commandBuffer` must be in the recording state

- VUID-vkCmdBeginTransformFeedbackEXT-commandBuffer-cmdpool
  The `VkCommandPool` that `commandBuffer` was allocated from must support graphics operations

- VUID-vkCmdBeginTransformFeedbackEXT-renderpass
  This command must only be called inside of a render pass instance

- VUID-vkCmdBeginTransformFeedbackEXT-videocoding
  This command must only be called outside of a video coding scope

- VUID-vkCmdBeginTransformFeedbackEXT-commonparent
  Both of `commandBuffer`, and the elements of `pCounterBuffers` that are valid handles of non-ignored parameters must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization

- Host access to `commandBuffer` must be externally synchronized

- Host access to the `VkCommandPool` that `commandBuffer` was allocated from must be externally synchronized

Command Properties

Command Buffer Levels | Render Pass Scope | Video Coding Scope | Supported Queue Types | Command Type
--- | --- | --- | --- | ---
Primary Secondary | Inside | Outside | Graphics | State

## See Also

VK_EXT_transform_feedback, VkBuffer, VkCommandBuffer, `VkDeviceSize`

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright 2014-2022 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0