Vulkan-Docs/doc/specs/vulkan/appendices/VK_NV_geometry_shader_passthrough.txt
Jon Leech e958791a01 Change log for March 16, 2018 Vulkan 1.1.71 spec update:
* First public update for Vulkan 1.1.

Github Issues:

  * Refer to standard sparse image block shape format tables explicitly in
    the <<sparsememory-standard-shapes, Standard Sparse Image Block Shapes>>
    section (public issue 93).
  * Add the missing definition of the code:LocalInvocationIndex decoration
    in the <<interfaces-builtin-variables, Built-In Variables>> section
    (public issue 532).
  * Clarify dynamic state definition in the introduction to the <<pipelines,
    Pipelines>> section and the new <<pipelines-dynamic-state, Dynamic
    State>> subsection (public issue 620).
  * Clarified deprecation statement in the `VK_AMD_negative_viewport_height`
    appendix (public issue 674).
  * Fix parameter descriptions for flink:vkCreateIndirectCommandsLayoutNVX
    (public issue 677).

Internal Issues:

  * Remove description of <<primsrast-points, rasterization point size>>
    being taken from the tessellation control shader, since there are no
    circumstances under which you can have TCS without TES (internal issue
    522).
  * Define <<copies-images-format-size-compatibility, _size-compatible_
    image formats>> for flink:vkCmdCopyImage, add it to the glossary, and
    use that definition for slink:VkImageViewCreateInfo (internal issue
    771).
  * Change brief descriptions of enumerant names, and of parameters which
    are enumerants, from "`enum *indicates*`" to "`enum *specifies*`" for
    consistency, and add a markup style guide rule (internal issue 862).
  * Clarify how execution dependencies interact with
    <<synchronization-submission-order, submission order>> at numerous
    places in the <<renderpass, Render Pass>> and <<synchronization,
    Synchronization>> chapters (internal issue 1062).
  * Clarify statement in the <<interfaces-resources-setandbinding,
    DescriptorSet and Binding Assignment>> section that only interface
    variables statically used by the entry point used in a pipeline must be
    present in the descriptor set layout (internal issue 1172).
  * Flip sparse image diagrams with partially full mip levels vertically, to
    match graph origins of other image diagrams (internal issue 1176).
  * Update new SVG diagrams to have consistent style and base font size,
    increase consistency of primitive topology diagrams, and add a section
    to the style guide on creating and editing images in a consistent style
    (internal issue 1177).
  * Resolve problems with valid usage statement extraction by fixing
    existing VUID tags for interfaces promoted to version 1.1 and fixing
    conditional directives around
    VUID-VkMemoryDedicatedAllocateInfo-image-01797 (internal issue 1184).
  * Strip `KHR` suffixes from a few interfaces promoted to Vulkan 1.1 that
    were missed previously (internal issue 1185).
  * Restrict code:OpImageQuerySizeLod and code:OpImageQueryLevels to only
    work on code:Image operands with their code:Sampled operand set to 1. In
    other words, these operations are not defined to work with storage
    images (internal issue 1193).
  * Recycle extension slot for extension #82 in `vk.xml`. This extension was
    never published (internal issue 1195).
  * Add an issue to the `VK_KHR_maintenance1` appendix noting that zero
    height viewports are allowed when this extension is enabled (internal
    issue 1202).
  * Fix slink:VkDescriptorSetLayoutBinding description so that shader stages
    always use descriptor bindings, not the other way around (internal issue
    1206).
  * Fix field name for
    slink:VkInputAttachmentAspectReference::pname:inputAttachmentIndex
    (internal issue 1210).

Other Issues:

  * Fix a few broken links in the <<versions-1.1, Version 1.1>> appendix.
  * Replace a few old refBegin/refEnd tags with open block markup around
    interfaces, and remove old KHX VUID tags that were breaking the valid
    usage statement extraction.
  * Fix error codes accidentally tagged as success codes in `vk.xml` for
    flink:vkGetSwapchainCounterEXT.
  * Added valid usage statements for ftext:vkBind*Memory2 input structures
    stext:VkBind*MemoryInfo, and fix a pname:image -> pname:buffer typo in a
    couple of places.
  * Fix swapped descriptions of elink:VkDescriptorType enums
    ename:VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE and
    ename:VK_DESCRIPTOR_TYPE_STORAGE_IMAGE (reported via tweet).

New Extensions:

  * `VK_ANDROID_external_memory_android_hardware_buffer`
2018-03-17 04:04:05 -07:00

185 lines
5.6 KiB
Plaintext

include::meta/VK_NV_geometry_shader_passthrough.txt[]
*Last Modified Date*::
2017-02-15
*Interactions and External Dependencies*::
- This extension requires the
https://www.khronos.org/registry/spir-v/extensions/NV/SPV_NV_geometry_shader_passthrough.html[+SPV_NV_geometry_shader_passthrough+]
SPIR-V extension.
- This extension requires the
https://www.khronos.org/registry/OpenGL/extensions/NV/NV_geometry_shader_passthrough.txt[+GL_NV_geometry_shader_passthrough+]
extension for GLSL source languages.
- This extension requires the pname:geometryShader feature.
*Contributors*::
- Piers Daniell, NVIDIA
- Jeff Bolz, NVIDIA
This extension adds support for the following SPIR-V extension in Vulkan:
* +SPV_NV_geometry_shader_passthrough+
Geometry shaders provide the ability for applications to process each
primitive sent through the graphics pipeline using a programmable shader.
However, one common use case treats them largely as a "`passthrough`".
In this use case, the bulk of the geometry shader code simply copies inputs
from each vertex of the input primitive to corresponding outputs in the
vertices of the output primitive.
Such shaders might also compute values for additional built-in or
user-defined per-primitive attributes (e.g., code:Layer) to be assigned to
all the vertices of the output primitive.
This extension provides access to the code:PassthroughNV decoration under
the code:GeometryShaderPassthroughNV capability.
Adding this to a geometry shader input variable specifies that the values of
this input are copied to the corresponding vertex of the output primitive.
When using GLSL source-based shading languages, the code:passthrough layout
qualifier from +GL_NV_geometry_shader_passthrough+ maps to the
code:PassthroughNV decoration.
To use the code:passthrough layout, in GLSL the
+GL_NV_geometry_shader_passthrough+ extension must be enabled.
Behaviour is described in the +GL_NV_geometry_shader_passthrough+ extension
specification.
=== New Object Types
None.
=== New Enum Constants
None.
=== New Enums
None.
=== New Structures
None.
=== New Functions
None.
=== New Built-In Variables
None.
=== New Variable Decoration
* <<geometry-passthrough-passthrough,code:PassthroughNV>> in
<<geometry-passthrough,Geometry Shader Passthrough>>
=== New SPIR-V Capabilities
* <<spirvenv-capabilities-table-geometryshaderpassthrough,GeometryShaderPassthroughNV>>
=== Issues
1) Should we require or allow a passthrough geometry shader to specify the
output layout qualifiers for the output primitive type and maximum vertex
count in the SPIR-V?
*RESOLVED*: Yes they should be required in the SPIR-V.
Per GL_NV_geometry_shader_passthrough they are not permitted in the GLSL
source shader, but SPIR-V is lower-level.
It is straightforward for the GLSL compiler to infer them from the input
primitive type and to explicitly emit them in the SPIR-V according to the
following table.
[options="header"]
|====
| Input Layout | Implied Output Layout
| points | `layout(points, max_vertices=1)`
| lines | `layout(line_stripo, max_vertices=2)`
| triangles | `layout(triangle_strip, max_vertices=3)`
|====
2) How does interface matching work with passthrough geometry shaders?
*RESOLVED*: This is described in <<geometry-passthrough-interface,
Passthrough Interface Matching>>.
In GL when using passthough geometry shaders in separable mode, all inputs
must also be explicitly assigned location layout qualifiers.
In Vulkan all SPIR-V shader inputs (except built-ins) must also have
location decorations specified.
Redeclarations of built-in varables that add the passthrough layout
qualifier are exempted from the rule requiring location assignment because
built-in variables do not have locations and are matched by code:BuiltIn
decoration.
=== Sample Code
Consider the following simple geometry shader in unextended GLSL:
[source,c]
---------------------------------------------------
layout(triangles) in;
layout(triangle_strip) out;
layout(max_vertices=3) out;
in Inputs {
vec2 texcoord;
vec4 baseColor;
} v_in[];
out Outputs {
vec2 texcoord;
vec4 baseColor;
};
void main()
{
int layer = compute_layer();
for (int i = 0; i < 3; i++) {
gl_Position = gl_in[i].gl_Position;
texcoord = v_in[i].texcoord;
baseColor = v_in[i].baseColor;
gl_Layer = layer;
EmitVertex();
}
}
---------------------------------------------------
In this shader, the inputs code:gl_Position, code:Inputs.texcoord, and
code:Inputs.baseColor are simply copied from the input vertex to the
corresponding output vertex.
The only "`interesting`" work done by the geometry shader is computing and
emitting a code:gl_Layer value for the primitive.
The following geometry shader, using this extension, is equivalent:
[source,c]
---------------------------------------------------
#extension GL_NV_geometry_shader_passthrough : require
layout(triangles) in;
// No output primitive layout qualifiers required.
// Redeclare gl_PerVertex to pass through "gl_Position".
layout(passthrough) in gl_PerVertex {
vec4 gl_Position;
} gl_in[];
// Declare "Inputs" with "passthrough" to automatically copy members.
layout(passthrough) in Inputs {
vec2 texcoord;
vec4 baseColor;
} v_in[];
// No output block declaration required.
void main()
{
// The shader simply computes and writes gl_Layer. We don't
// loop over three vertices or call EmitVertex().
gl_Layer = compute_layer();
}
---------------------------------------------------
=== Version History
* Revision 1, 2017-02-15 (Daniel Koch)
- Internal revisions