All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.vulkan.NVGeometryShaderPassthrough Maven / Gradle / Ivy

Go to download

A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.

There is a newer version: 3.3.4
Show newest version
/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 * MACHINE GENERATED FILE, DO NOT EDIT
 */
package org.lwjgl.vulkan;

/**
 * This extension adds support for the following SPIR-V extension in Vulkan:
 * 
 * 
    *
  • {@code 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 “{@code 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 {@code GL_NV_geometry_shader_passthrough} maps to the {@code PassthroughNV} decoration. To use the {@code passthrough} layout, in GLSL the {@code GL_NV_geometry_shader_passthrough} extension must be enabled. Behaviour is described in the {@code GL_NV_geometry_shader_passthrough} extension specification.

* *
Sample Code
* *

Consider the following simple geometry shader in unextended GLSL:

* *

 * 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 “{@code 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:

* *

 * #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 do not
 *     // loop over three vertices or call EmitVertex().
 *     gl_Layer = compute_layer();
 * }
* *
VK_NV_geometry_shader_passthrough
* *
*
Name String
*
{@code VK_NV_geometry_shader_passthrough}
*
Extension Type
*
Device extension
*
Registered Extension Number
*
96
*
Revision
*
1
*
Extension and Version Dependencies
*
    *
  • Requires Vulkan 1.0
  • *
*
Contact
*
*
* *
Other Extension Metadata
* *
*
Last Modified Date
*
2017-02-15
*
Interactions and External Dependencies
*
*
Contributors
*
    *
  • Piers Daniell, NVIDIA
  • *
  • Jeff Bolz, NVIDIA
  • *
*
*/ public final class NVGeometryShaderPassthrough { /** The extension specification version. */ public static final int VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION = 1; /** The extension name. */ public static final String VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME = "VK_NV_geometry_shader_passthrough"; private NVGeometryShaderPassthrough() {} }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy