# vkCmdSetSampleLocationsEXT(3) Manual Page

## Name

vkCmdSetSampleLocationsEXT - Set sample locations dynamically for a command buffer

Loading… please wait.

## C Specification

To dynamically set the sample locations used for rasterization, call:

    // Provided by VK_EXT_sample_locations
    void vkCmdSetSampleLocationsEXT(
        VkCommandBuffer                             commandBuffer,
        const VkSampleLocationsInfoEXT*             pSampleLocationsInfo);

## Parameters

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

- `pSampleLocationsInfo` is the sample locations state to set.

## Description

This command sets the custom sample locations for subsequent drawing commands when drawing using shader objects, or when the graphics pipeline is created with `VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT` set in VkPipelineDynamicStateCreateInfo::`pDynamicStates`, and when the VkPipelineSampleLocationsStateCreateInfoEXT::`sampleLocationsEnable` property of the bound graphics pipeline is `VK_TRUE`. Otherwise, this state is specified by the VkPipelineSampleLocationsStateCreateInfoEXT::`sampleLocationsInfo` values used to create the currently active pipeline.

Valid Usage

- VUID-vkCmdSetSampleLocationsEXT-variableSampleLocations-01530
  If VkPhysicalDeviceSampleLocationsPropertiesEXT::`variableSampleLocations` is `VK_FALSE` then the current render pass 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 sample locations state pointed to by `pSampleLocationsInfo`

Valid Usage (Implicit)

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

- VUID-vkCmdSetSampleLocationsEXT-pSampleLocationsInfo-parameter
  `pSampleLocationsInfo` must be a valid pointer to a valid VkSampleLocationsInfoEXT structure

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

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

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

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 | Both | Outside | Graphics | State

## See Also

VK_EXT_sample_locations, VkCommandBuffer, VkSampleLocationsInfoEXT

## 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-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0