// Copyright 2018-2021 The Khronos Group, Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

[open,refpage='VkSwapchainCounterCreateInfoEXT',desc='Specify the surface counters desired',type='structs']
--
To enable surface counters when creating a swapchain, add a
sname:VkSwapchainCounterCreateInfoEXT structure to the pname:pNext chain of
slink:VkSwapchainCreateInfoKHR.
sname:VkSwapchainCounterCreateInfoEXT is defined as:

include::{generated}/api/structs/VkSwapchainCounterCreateInfoEXT.txt[]

  * pname:sType is the type of this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:surfaceCounters is a bitmask of elink:VkSurfaceCounterFlagBitsEXT
    specifying surface counters to enable for the swapchain.

.Valid Usage
****
  * [[VUID-VkSwapchainCounterCreateInfoEXT-surfaceCounters-01244]]
    The bits in pname:surfaceCounters must: be supported by
    slink:VkSwapchainCreateInfoKHR::pname:surface, as reported by
    flink:vkGetPhysicalDeviceSurfaceCapabilities2EXT
****

include::{generated}/validity/structs/VkSwapchainCounterCreateInfoEXT.txt[]
--

[open,refpage='vkGetSwapchainCounterEXT',desc='Query the current value of a surface counter',type='protos']
--
The requested counters become active when the first presentation command for
the associated swapchain is processed by the presentation engine.
To query the value of an active counter, use:

include::{generated}/api/protos/vkGetSwapchainCounterEXT.txt[]

  * pname:device is the slink:VkDevice associated with pname:swapchain.
  * pname:swapchain is the swapchain from which to query the counter value.
  * pname:counter is a elink:VkSurfaceCounterFlagBitsEXT value specifying
    the counter to query.
  * pname:pCounterValue will return the current value of the counter.

If a counter is not available because the swapchain is out of date, the
implementation may: return ename:VK_ERROR_OUT_OF_DATE_KHR.

.Valid Usage
****
  * [[VUID-vkGetSwapchainCounterEXT-swapchain-01245]]
    One or more present commands on pname:swapchain must: have been
    processed by the presentation engine
****

include::{generated}/validity/protos/vkGetSwapchainCounterEXT.txt[]
--
