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);


  • commandBuffer is the command buffer into which the command will be recorded.

  • pSampleLocationsInfo is the sample locations state to set.


This command sets the custom sample locations for subsequent drawing commands 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

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 Command Type





See Also

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 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0