# vkCmdBindPipeline(3) Manual Page

## Name

vkCmdBindPipeline - Bind a pipeline object to a command buffer

## C Specification

Once a pipeline has been created, it can be bound to the command buffer using the command:

    void vkCmdBindPipeline(
        VkCommandBuffer                             commandBuffer,
        VkPipelineBindPoint                         pipelineBindPoint,
        VkPipeline                                  pipeline);

## Parameters

- `commandBuffer` is the command buffer that the pipeline will be bound to.

- `pipelineBindPoint` is a VkPipelineBindPoint value specifying whether to bind to the compute or graphics bind point. Binding one does not disturb the other.

- `pipeline` is the pipeline to be bound.

## Description

Once bound, a pipeline binding affects subsequent graphics or compute commands in the command buffer until a different pipeline is bound to the bind point. The pipeline bound to `VK_PIPELINE_BIND_POINT_COMPUTE` controls the behavior of vkCmdDispatch and vkCmdDispatchIndirect. The pipeline bound to `VK_PIPELINE_BIND_POINT_GRAPHICS` controls the behavior of all drawing commands. The pipeline bound to `VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR` controls the behavior of vkCmdTraceRaysKHR. No other commands are affected by the pipeline state.

Valid Usage

- If `pipelineBindPoint` is `VK_PIPELINE_BIND_POINT_COMPUTE`, the `VkCommandPool` that `commandBuffer` was allocated from must support compute operations

- If `pipelineBindPoint` is `VK_PIPELINE_BIND_POINT_GRAPHICS`, the `VkCommandPool` that `commandBuffer` was allocated from must support graphics operations

- If `pipelineBindPoint` is `VK_PIPELINE_BIND_POINT_COMPUTE`, `pipeline` must be a compute pipeline

- If `pipelineBindPoint` is `VK_PIPELINE_BIND_POINT_GRAPHICS`, `pipeline` must be a graphics pipeline

- If the variable multisample rate feature is not supported, `pipeline` is a graphics pipeline, the current subpass has no attachments, and this is not the first call to this function with a graphics pipeline after transitioning to the current subpass, then the sample count specified by this pipeline must match that set in the previous pipeline

- If VkPhysicalDeviceSampleLocationsPropertiesEXT::`variableSampleLocations` is `VK_FALSE`, and `pipeline` is a graphics pipeline created with a VkPipelineSampleLocationsStateCreateInfoEXT structure having its `sampleLocationsEnable` member set to `VK_TRUE` but without `VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT` enabled then the current render pass instance must have been begun by specifying a VkRenderPassSampleLocationsBeginInfoEXT structure whose `pPostSubpassSampleLocations` member contains an element with a `subpassIndex` matching the current subpass index and the `sampleLocationsInfo` member of that element must match the `sampleLocationsInfo` specified in VkPipelineSampleLocationsStateCreateInfoEXT when the pipeline was created

- This command must not be recorded when transform feedback is active

- If `pipelineBindPoint` is `VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR`, the `VkCommandPool` that `commandBuffer` was allocated from must support compute operations

- If `pipelineBindPoint` is `VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR`, the `pipeline` must be a ray tracing pipeline

- The `pipeline` must not have been created with `VK_PIPELINE_CREATE_LIBRARY_BIT_KHR` set.

Valid Usage (Implicit)

- `commandBuffer` must be a valid VkCommandBuffer handle

- `pipelineBindPoint` must be a valid VkPipelineBindPoint value

- `pipeline` must be a valid VkPipeline handle

- `commandBuffer` must be in the recording state

- The `VkCommandPool` that `commandBuffer` was allocated from must support graphics, or compute operations

- Both of `commandBuffer`, and `pipeline` 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 | Supported Queue Types | Pipeline Type
--- | --- | --- | ---
Primary Secondary | Both | Graphics Compute |

## See Also

VkCommandBuffer, VkPipeline, VkPipelineBindPoint

## 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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.