15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_stereo_view_rendering
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_stereo_view_rendering
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Kedarnath Thangudu, NVIDIA Corporation (kthangudu 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Mark Kilgard, NVIDIA Corporation
165bd8deadSopenharmony_ci    Pat Brown, NVIDIA Corporation
175bd8deadSopenharmony_ci    Jason Schmidt, NVIDIA Corporation
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciStatus
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Shipping in NVIDIA release 367.XX drivers and up.
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciVersion
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    Last Modified Date:         November 25, 2017
265bd8deadSopenharmony_ci    NVIDIA Revision:            3
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciNumber
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    OpenGL Extension #489
315bd8deadSopenharmony_ci    OpenGL ES Extension #296
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ciDependencies
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    This extension is written against OpenGL 4.5 Specification
365bd8deadSopenharmony_ci    (Compatibility Profile).
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    This extension interacts with the OpenGL ES 3.1 Specification.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci    The extension requires NV_viewport_array2.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension interacts with NV_gpu_program4 and NV_gpu_program5.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ci    This extension interacts with EXT_tessellation_shader.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ciOverview
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    Virtual reality (VR) applications often render a single logical scene
495bd8deadSopenharmony_ci    from multiple views corresponding to a pair of eyes.  The views (eyes) are
505bd8deadSopenharmony_ci    separated by a fixed offset in the X direction.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    Traditionally, multiple views are rendered via multiple rendering passes.
535bd8deadSopenharmony_ci    This is expensive for the GPU because the objects in the scene must be
545bd8deadSopenharmony_ci    transformed, rasterized, shaded, and fragment processed redundantly.  This
555bd8deadSopenharmony_ci    is expensive for the CPU because the scene graph needs to be visited
565bd8deadSopenharmony_ci    multiple times and driver validation happens for each view.  Rendering N
575bd8deadSopenharmony_ci    passes tends to take N times longer than a single pass.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    This extension provides a mechanism to render binocular (stereo) views
605bd8deadSopenharmony_ci    from a single stream of OpenGL rendering commands.  Vertex, tessellation,
615bd8deadSopenharmony_ci    and geometry (VTG) shaders can output two positions for each vertex
625bd8deadSopenharmony_ci    corresponding to the two eye views.  A built-in "gl_SecondaryPositionNV"
635bd8deadSopenharmony_ci    is added to specify the second position.  The positions from each view may
645bd8deadSopenharmony_ci    be sent to different viewports and/or layers.  A built-in
655bd8deadSopenharmony_ci    "gl_SecondaryViewportMaskNV[]" is also added to specify the viewport mask
665bd8deadSopenharmony_ci    for the second view.  A new layout-qualifier "secondary_view_offset" is
675bd8deadSopenharmony_ci    added for built-in output "gl_Layer" which allows for the geometry from
685bd8deadSopenharmony_ci    each view to be sent to different layers for rendering.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ciNew Procedures and Functions
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    None.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ciNew Tokens
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    None.
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ciAdditions to Chapter 11 of the OpenGL 4.5 (Compatibility Profile) Specification
795bd8deadSopenharmony_ci(Programmable Vertex Processing)
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    Add to Section 11.1.3.10 (Shader Outputs)
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci    The built-in output variables gl_SecondaryPositionNV and
845bd8deadSopenharmony_ci    gl_SecondaryViewportMaskNV[] hold the homogeneous vertex position and the
855bd8deadSopenharmony_ci    viewport mask for the secondary view, as described in Section 11.5
865bd8deadSopenharmony_ci    (Stereo Offsetted Rendering).
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    [Section 11.2 of the OpenGL 4.5 specification corresponds to
895bd8deadSopenharmony_ci     Section 11.1ts of the OpenGL ES 3.1 specification, and
905bd8deadSopenharmony_ci     Section 11.3 of the OpenGL 4.5 specification corresponds to
915bd8deadSopenharmony_ci     Section 11.1gs of the OpenGL ES 3.1 specification]
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    In Section 11.2.1.2.2 (Tessellation Control Shader Inputs), modify the
945bd8deadSopenharmony_ci    line describing members of gl_in[] to include gl_SecondaryPositionNV
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    The members of each element of the gl_in[] array are gl_Position,
975bd8deadSopenharmony_ci    gl_SecondaryPositionNV, gl_PointSize, ...
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    Add to Section 11.2.1.2.3 (Tessellation Control Shader Outputs)
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci    The built-in output variables gl_SecondaryPositionNV and
1025bd8deadSopenharmony_ci    gl_SecondaryViewportMaskNV[] hold the homogeneous vertex position and the
1035bd8deadSopenharmony_ci    viewport mask for the secondary view, as described in Section 11.5
1045bd8deadSopenharmony_ci    (Stereo Offsetted Rendering).
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci    In Section 11.2.3.3 (Tessellation Evaluation Shader Outputs), modify the
1075bd8deadSopenharmony_ci    line describing members of gl_in[] to include gl_SecondaryPositionNV
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    The members of each element of the gl_in[] array are gl_Position,
1105bd8deadSopenharmony_ci    gl_SecondaryPositionNV, gl_PointSize, ...
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    Add to Section 11.2.3.4 (Tessellation Evaluation Shader Outputs)
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    The built-in output variables gl_SecondaryPositionNV and
1155bd8deadSopenharmony_ci    gl_SecondaryViewportMaskNV[] hold the homogeneous vertex position and the
1165bd8deadSopenharmony_ci    viewport mask for the secondary view, as described in Section 11.5
1175bd8deadSopenharmony_ci    (Stereo Offsetted Rendering).
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    In Section 11.3.4.4 (Geometry Shader Inputs), add to the list of members
1205bd8deadSopenharmony_ci    of gl_in[]
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci    The members of each element of the gl_in[] array are:
1235bd8deadSopenharmony_ci        ...
1245bd8deadSopenharmony_ci        * Structure member gl_SecondaryPositionNV holds the per-vertex position
1255bd8deadSopenharmony_ci        of the secondary view, written by the upstream shader to the built-in
1265bd8deadSopenharmony_ci        output variable gl_SecondaryPositionNV. Note that writing to
1275bd8deadSopenharmony_ci        gl_SecondaryPositionNV from either the upstream or geometry shader is
1285bd8deadSopenharmony_ci        optional (also see section 7.1("Built-In Variables") of the OpenGL
1295bd8deadSopenharmony_ci        Shading Language Specification).
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    Add to Section 11.2.3.5 (Geometry Shader Outputs)
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci    The built-in output variables gl_SecondaryPositionNV and
1345bd8deadSopenharmony_ci    gl_SecondaryViewportMaskNV[] hold the homogeneous vertex position and the
1355bd8deadSopenharmony_ci    viewport mask for the secondary view, as described in Section 11.5
1365bd8deadSopenharmony_ci    (Stereo Offsetted Rendering).
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    Modify Section 11.4 (Layer and Viewport Selection) to include
1405bd8deadSopenharmony_ci    gl_SecondaryViewportMaskNV[] wherever gl_ViewportMask[] is mentioned.
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    Add a new Section 11.5 (Stereo Offsetted Rendering)
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Application may render a single logical scene from two views,
1455bd8deadSopenharmony_ci    corresponding to a pair of eyes, that are separated only in the X
1465bd8deadSopenharmony_ci    direction by fixed offset. Vertex, tessellation, and geometry (VTG)
1475bd8deadSopenharmony_ci    shaders may compute and write the vertex coordinates for each of the pair
1485bd8deadSopenharmony_ci    of stereo views.  The input/output built-ins "gl_Position" and
1495bd8deadSopenharmony_ci    "gl_SecondaryPositionNV" may be used to read/write the positions
1505bd8deadSopenharmony_ci    corresponding to the primary and secondary views respectively.  Only the
1515bd8deadSopenharmony_ci    "x" coordinate is expected to differ between these views, so the "yzw"
1525bd8deadSopenharmony_ci    coordinates for secondary position are also obtained from the "gl_Position"
1535bd8deadSopenharmony_ci    and writes to "gl_SecondaryPositionNV.yzw" are ignored.
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci    VTG shaders may also write to "gl_SecondaryViewportMaskNV[]" to specify a
1565bd8deadSopenharmony_ci    viewport mask for primitives in the secondary view. If
1575bd8deadSopenharmony_ci    "gl_SecondaryViewportMaskNV[]" is not specified, "gl_ViewportMask[]" will
1585bd8deadSopenharmony_ci    be used as the viewport mask for primitives from both views.
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    Primitives from each view may be sent to different layers as described
1615bd8deadSopenharmony_ci    in Section 7.1 of the GLSL specification.
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ciAdditions to Chapter 13 of the OpenGL 4.5 (Compatibility Profile)
1645bd8deadSopenharmony_ciSpecification (Fixed-Function Vertex Post-Processing)
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    Modify Section 13.2 (Transform Feedback), p. 453 [section 12.1 in OpenGL ES]
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    Modify the first paragraph:
1695bd8deadSopenharmony_ci
1705bd8deadSopenharmony_ci    ...The vertices are fed back after vertex color clamping, but before
1715bd8deadSopenharmony_ci    viewport mask expansion, stereo view expansion, flat-shading, and
1725bd8deadSopenharmony_ci    clipping. ...
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    Modify Section 13.6.1 (Controlling the Viewport)
1755bd8deadSopenharmony_ci    [section 12.5.1 in OpenGL ES] to include
1765bd8deadSopenharmony_ci    gl_SecondaryViewportMaskNV[] wherever gl_ViewportMask[] is mentioned.
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ciNew Implementation Dependent State
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    None.
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ciNew State
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    None.
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL/EGL Specifications
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    None.
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ciGLX Protocol
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci    None.
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ciModifications to the OpenGL Shading Language Specification, Version 4.50
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci    Including the following line in a shader can be used to control the
1985bd8deadSopenharmony_ci    language features described in this extension:
1995bd8deadSopenharmony_ci
2005bd8deadSopenharmony_ci        #extension GL_NV_stereo_view_rendering : <behavior>
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.3
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    New preprocessor #defines are added to the OpenGL Shading Language:
2055bd8deadSopenharmony_ci
2065bd8deadSopenharmony_ci        #define GL_NV_stereo_view_rendering     1
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci    Modify Section 7.1 (Built-In Language Variables), p. 118
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ci    Add to the list of vertex shader built-ins:
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci        out gl_PerVertex {
2135bd8deadSopenharmony_ci            highp vec4 gl_SecondaryPositionNV;
2145bd8deadSopenharmony_ci            highp int  gl_SecondaryViewportMaskNV[];
2155bd8deadSopenharmony_ci        };
2165bd8deadSopenharmony_ci
2175bd8deadSopenharmony_ci    Add to the list of geometry shader built-ins:
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ci        in gl_PerVertex {
2205bd8deadSopenharmony_ci            highp vec4 gl_SecondaryPositionNV;
2215bd8deadSopenharmony_ci        } gl_in[];
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci        out gl_PerVertex {
2245bd8deadSopenharmony_ci            highp vec4 gl_SecondaryPositionNV;
2255bd8deadSopenharmony_ci            highp int gl_SecondaryViewportMaskNV[];
2265bd8deadSopenharmony_ci        };
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    Add to the list of tessellation control shader built-ins:
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci        in gl_PerVertex {
2315bd8deadSopenharmony_ci            highp vec4 gl_SecondaryPositionNV;
2325bd8deadSopenharmony_ci        } gl_in[gl_MaxPatchVertices];
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ci        out gl_PerVertex {
2355bd8deadSopenharmony_ci            highp vec4 gl_SecondaryPositionNV;
2365bd8deadSopenharmony_ci            highp int  gl_SecondaryViewportMaskNV[];
2375bd8deadSopenharmony_ci        } gl_out[];
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci    Add to the list of tessellation evaluation shader built-ins:
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci        in gl_PerVertex {
2425bd8deadSopenharmony_ci            highp vec4 gl_SecondaryPositionNV;
2435bd8deadSopenharmony_ci        } gl_in[gl_MaxPatchVertices];
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci        out gl_PerVertex {
2465bd8deadSopenharmony_ci            highp vec4 gl_SecondaryPositionNV;
2475bd8deadSopenharmony_ci            highp int  gl_SecondaryViewportMaskNV[];
2485bd8deadSopenharmony_ci        };
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    Add the following descriptions for gl_SecondaryPositionNV and
2515bd8deadSopenharmony_ci    gl_SecondaryViewportMaskNV[]:
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci    The output variables gl_SecondaryPositionNV and gl_SecondaryViewportMaskNV[]
2545bd8deadSopenharmony_ci    are available in vertex, tessellation, and geometry languages to specify
2555bd8deadSopenharmony_ci    the position and the viewport mask for the secondary view respectively.
2565bd8deadSopenharmony_ci    The input variable gl_SecondaryPositionNV is available in the tessellation
2575bd8deadSopenharmony_ci    and geometry languages to read the secondary position written by a
2585bd8deadSopenharmony_ci    previous shader stage. See section 11.5 ("Stereo Offsetted Rendering") of
2595bd8deadSopenharmony_ci    the OpenGL 4.5 specification for more information.
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    Add the following to the description of gl_Layer
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    The shader output gl_Layer may be redeclared with the following layout
2655bd8deadSopenharmony_ci    qualifier which is available in vertex, tessellation, and geometry
2665bd8deadSopenharmony_ci    shaders:
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci        layout-qualifier-id
2695bd8deadSopenharmony_ci            secondary_view_offset = integer-constant-expression
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    along with the <viewport-relative> layout qualifier introduced in
2725bd8deadSopenharmony_ci    NV_viewport_array2.  When using layered rendering, the layout qualifier
2735bd8deadSopenharmony_ci    <secondary_view_offset> may be used to indicate the layer offset for the
2745bd8deadSopenharmony_ci    primitives in the second view. If gl_Layer is redeclared with both
2755bd8deadSopenharmony_ci    <viewport_relative> and <secondary_view_offset>, the layer used for
2765bd8deadSopenharmony_ci    rendering the primitives of the second view is computed by first adding
2775bd8deadSopenharmony_ci    the viewport index and then the offset value specified by
2785bd8deadSopenharmony_ci    <secondary_view_offset>.
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ciErrors
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci    None.
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ciInteractions with EXT_tessellation_shader
2865bd8deadSopenharmony_ci
2875bd8deadSopenharmony_ci    If implemented on OpenGL ES and EXT_tessellation_shader is not supported,
2885bd8deadSopenharmony_ci    remove all language referring to the tessellation control and tessellation
2895bd8deadSopenharmony_ci    evaluation pipeline stages.
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ciInteractions with NV_gpu_program4 and NV_gpu_program5
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci    If NV_gpu_program4 is supported and the "NV_stereo_view_rendering" program
2945bd8deadSopenharmony_ci    option is specified, vertex, tessellation control/evaluation, and geometry
2955bd8deadSopenharmony_ci    program result variable "result.secondaryposition" can be used to specify
2965bd8deadSopenharmony_ci    the vertex's position coordinates from the second view and
2975bd8deadSopenharmony_ci    "result.secondaryviewportmask[]" can be used to specify the mask of
2985bd8deadSopenharmony_ci    viewports that the primitives from the second view will be emitted to. When
2995bd8deadSopenharmony_ci    this program option is specified in tessellation control/evaluation, and/or
3005bd8deadSopenharmony_ci    geometry programs, a vertex attribute "vertex[m].secondaryposition" is also
3015bd8deadSopenharmony_ci    available to read the secondary position computed in a previous shader
3025bd8deadSopenharmony_ci    stage.
3035bd8deadSopenharmony_ci
3045bd8deadSopenharmony_ci    Modify Section 2.X.2 of NV_gpu_program4, Program Grammar
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ci    (add the following rule to the NV_gpu_program4 grammar for Geometry and
3075bd8deadSopenharmony_ci    Tessellation Control/Eval programs)
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ci    <attribBasic>       ::= ...
3105bd8deadSopenharmony_ci                          | <vtxPrefix> "secondaryposition"
3115bd8deadSopenharmony_ci
3125bd8deadSopenharmony_ci    (add the following rule to the NV_gpu_program4 grammar for Vertex,
3135bd8deadSopenharmony_ci    Geometry, and Tessellation Control/Eval programs)
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    <declaration>       ::= ...
3165bd8deadSopenharmony_ci                          | "SECONDARY_VIEW_LAYER_OFFSET" <optSign> <int>
3175bd8deadSopenharmony_ci
3185bd8deadSopenharmony_ci    <resultBasic>       ::= ...
3195bd8deadSopenharmony_ci                          | <resPrefix> "secondaryposition"
3205bd8deadSopenharmony_ci                          | <resPrefix> "secondaryviewportmask" arrayMemAbs
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci    (add the following to the tables of Geometry and Tessellation
3235bd8deadSopenharmony_ci    Control/Eval Program Attribute Bindings)
3245bd8deadSopenharmony_ci
3255bd8deadSopenharmony_ci        Binding                         Components  Description
3265bd8deadSopenharmony_ci        ---------------------------     ----------  ---------------------------
3275bd8deadSopenharmony_ci        vertex[m].secondaryposition      (x,y,z,w)  object coordinates for the
3285bd8deadSopenharmony_ci                                                    second view
3295bd8deadSopenharmony_ci
3305bd8deadSopenharmony_ci    (add the following subsection to section 2.X.3.2 of NV_gpu_program4,
3315bd8deadSopenharmony_ci     Program Attribute Variables)
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ci    If an attribute binding in a geometry/tessellation program matches
3345bd8deadSopenharmony_ci    "vertex[m].secondaryposition", the "x" component of the attribute provides
3355bd8deadSopenharmony_ci    the "x" coordinate for the secondary view position. The "y", "z", and "w"
3365bd8deadSopenharmony_ci    components will be the same as the "y", "z", and "w" components of
3375bd8deadSopenharmony_ci    "vertex[m].position".
3385bd8deadSopenharmony_ci
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci    (add the following to the tables of Vertex, Geometry, and Tessellation
3415bd8deadSopenharmony_ci    Control/Eval Program Result Variable Bindings)
3425bd8deadSopenharmony_ci
3435bd8deadSopenharmony_ci        Binding                        Components  Description
3445bd8deadSopenharmony_ci        -----------------------------  ----------  ----------------------------
3455bd8deadSopenharmony_ci        result.secondaryposition        (x,y,z,w)  object coordinates for the
3465bd8deadSopenharmony_ci                                                   second view
3475bd8deadSopenharmony_ci        result.secondaryviewportmask[]  (v,-,-,-)  viewport array mask for the
3485bd8deadSopenharmony_ci                                                   second view
3495bd8deadSopenharmony_ci
3505bd8deadSopenharmony_ci    (add the following subsection to section 2.X.3.5 of NV_gpu_program4,
3515bd8deadSopenharmony_ci     Program Results.)
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci    If a result variable binding matches "result.secondaryposition", updates
3545bd8deadSopenharmony_ci    to the "x" component of the result variable provide the "x" coordinate for
3555bd8deadSopenharmony_ci    the position from the secondary view. The y, z, and w coordinates for the
3565bd8deadSopenharmony_ci    secondary view position are expected to be the same as the primary
3575bd8deadSopenharmony_ci    position and are taken from the "result.position". Updates to y, z, and w
3585bd8deadSopenharmony_ci    components of "result.secondaryposition" are ignored.
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ci    If a result variable binding matches "result.secondaryviewportmask[]",
3615bd8deadSopenharmony_ci    updates to the "x" component of the result variable provide a single
3625bd8deadSopenharmony_ci    integer that serves as a mask of viewport indices for the secondary
3635bd8deadSopenharmony_ci    view. The mask must be written as an integer value; writing a floating-
3645bd8deadSopenharmony_ci    point value will produce undefined results. If the value has bits greater
3655bd8deadSopenharmony_ci    than or equal to MAX_VIEWPORTS set, the number of viewports the primitive
3665bd8deadSopenharmony_ci    is emitted to and which viewports are used undefined. If a program
3675bd8deadSopenharmony_ci    specifies "NV_stereo_view_rendering" program option and does not write the
3685bd8deadSopenharmony_ci    "result.secondaryviewportmask[]", then "result.viewportmask[]" will be
3695bd8deadSopenharmony_ci    used as the viewport mask for both the views.
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    If the "NV_stereo_view_rendering" program option is not specified, the
3725bd8deadSopenharmony_ci    "result.secondaryposition" and "result.secondaryviewportmask[]" bindings
3735bd8deadSopenharmony_ci    are unavailable.
3745bd8deadSopenharmony_ci
3755bd8deadSopenharmony_ci    (add the following to Section 2.X.6.Y, Program Options)
3765bd8deadSopenharmony_ci
3775bd8deadSopenharmony_ci    + Stereo Offsetted Rendering (NV_stereo_view_rendering)
3785bd8deadSopenharmony_ci
3795bd8deadSopenharmony_ci    If a vertex, geometry, tessellation control, or tessellation evaluation
3805bd8deadSopenharmony_ci    program specifies the "NV_stereo_view_rendering" option, the result
3815bd8deadSopenharmony_ci    bindings "result.secondaryposition" and "result.secondaryviewportmask[]"
3825bd8deadSopenharmony_ci    will be available to specify the secondary position and viewportmask
3835bd8deadSopenharmony_ci    respectively.
3845bd8deadSopenharmony_ci
3855bd8deadSopenharmony_ci    (add the following to Section 2.X.7.Y, Program Declarations)
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci    + Layer Offset for the Secondary View (NV_SECONDARY_VIEW_LAYER_OFFSET)
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    The NV_SECONDARY_VIEW_LAYER_OFFSET statement declares the layer offset
3905bd8deadSopenharmony_ci    value to be added to the "result.layer" for the secondary view. If the
3915bd8deadSopenharmony_ci    program also specifies the "NV_layer_viewport_relative" option, both the
3925bd8deadSopenharmony_ci    viewport index and the above offset are added to the "result.layer" for
3935bd8deadSopenharmony_ci    the second view.
3945bd8deadSopenharmony_ci
3955bd8deadSopenharmony_ciIssues
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ci    (1) Where does the stereo view expansion occur?
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci    RESOLVED: This operation occurs right before viewport mask expansion
4005bd8deadSopenharmony_ci    (NV_viewport_array2). The primary primitive is broadcast to different
4015bd8deadSopenharmony_ci    viewports based on the viewport id/viewport mask followed by the secondary
4025bd8deadSopenharmony_ci    primitive. This specification applies the stereo view expansion after
4035bd8deadSopenharmony_ci    transform feedback, and makes all primitive queries except for clipping
4045bd8deadSopenharmony_ci    primitives only count each primitive once. Clipping primitives' queries
4055bd8deadSopenharmony_ci    count the primitives once for each view.
4065bd8deadSopenharmony_ci
4075bd8deadSopenharmony_ci    (2) Do we need "gl_SecondaryViewportIdNV" for the second view?
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci    RESOLVED: No. "gl_SecondaryViewportMaskNV[]" should cover that functionality.
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci    (3) Should the secondary position be readable from the tessellation
4125bd8deadSopenharmony_ci    control/evaluation and geometry shaders?
4135bd8deadSopenharmony_ci
4145bd8deadSopenharmony_ci    RESOLVED: Yes. If the secondary position is written by the vertex shader,
4155bd8deadSopenharmony_ci    tessellation shader should be able to read position to evaluate the
4165bd8deadSopenharmony_ci    interpolated positions for the second view.
4175bd8deadSopenharmony_ci
4185bd8deadSopenharmony_ciRevision History
4195bd8deadSopenharmony_ci
4205bd8deadSopenharmony_ci    Revision 3 2017/11/25 (pbrown)
4215bd8deadSopenharmony_ci      - Add to the OpenGL ES Extension Registry
4225bd8deadSopenharmony_ci    Revision 2 2017/02/21 (jaschmidt)
4235bd8deadSopenharmony_ci      - Formally add OpenGL ES interactions
4245bd8deadSopenharmony_ci    Revision 1
4255bd8deadSopenharmony_ci      - Internal revisions.
426