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

include::{generated}/meta/{refprefix}VK_EXT_provoking_vertex.txt[]

=== Other Extension Metadata

*Last Modified Date*::
    2021-02-22
*IP Status*::
    No known IP claims.
*Contributors*::
  - Alexis Hétu, Google
  - Bill Licea-Kane, Qualcomm
  - Daniel Koch, Nvidia
  - Jamie Madill, Google
  - Jan-Harald Fredriksen, Arm
  - Jason Ekstrand, Intel
  - Jeff Bolz, Nvidia
  - Jeff Leger, Qualcomm
  - Jesse Hall, Google
  - Jörg Wagner, Arm
  - Matthew Netsch, Qualcomm
  - Mike Blumenkrantz, Valve
  - Piers Daniell, Nvidia
  - Tobias Hector, AMD

=== Description

This extension allows changing the provoking vertex convention between
Vulkan's default convention (first vertex) and OpenGL's convention (last
vertex).

This extension is intended for use by API-translation layers that implement
APIs like OpenGL on top of Vulkan, and need to match the source API's
provoking vertex convention.
Applications using Vulkan directly should use Vulkan's default convention.

include::{generated}/interfaces/VK_EXT_provoking_vertex.txt[]

=== Issues

1) At what granularity should this state be set?

*RESOLVED*: At pipeline bind, with an optional per-renderpass restriction.

The most natural place to put this state is in the graphics pipeline object.
Some implementations require it to be known when creating the pipeline, and
pipeline state is convenient for implementing OpenGL 3.2's
glProvokingVertex, which can change the state between draw calls.
However, some implementations can only change it approximately renderpass
granularity.
To accommodate both, provoking vertex will be pipeline state, but
implementations can require that only one mode is used within a renderpass
instance; the renderpass's mode is chosen implicitly when the first pipeline
is bound.

2) Does the provoking vertex mode affect the order that vertices are written
to transform feedback buffers?

*RESOLVED*: Yes, to enable layered implementations of OpenGL and D3D.

All of OpenGL, OpenGL ES, and Direct3D 11 require that vertices are written
to transform feedback buffers such that flat-shaded attributes have the same
value when drawing the contents of the transform feedback buffer as they did
in the original drawing when the transform feedback buffer was written
(assuming the provoking vertex mode has not changed, in APIs that support
more than one mode).


=== Version History

  * Revision 1, (1c) 2021-02-22 (Jesse Hall)
    - Added
      VkPhysicalDeviceProvokingVertexPropertiesEXT::transformFeedbackPreservesTriangleFanProvokingVertex
      to accommodate implementations that cannot change the transform
      feedback vertex order for triangle fans.
  * Revision 1, (1b) 2020-06-14 (Jesse Hall)
    - Added
      VkPhysicalDeviceProvokingVertexFeaturesEXT::transformFeedbackPreservesProvokingVertex
      and required that transform feedback write vertices so as to preserve
      the provoking vertex of each primitive.
  * Revision 1, (1a) 2019-10-23 (Jesse Hall)
    - Initial draft, based on a proposal by Alexis Hétu
