15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_fragment_layer_viewport
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_fragment_layer_viewport
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Piers Daniell, NVIDIA Corporation (pdaniell 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Christophe Riccio, AMD
165bd8deadSopenharmony_ci    Daniel Koch, Transgaming
175bd8deadSopenharmony_ci    John Kessenich
185bd8deadSopenharmony_ci    Pat Brown, NVIDIA
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ciNotice
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Copyright (c) 2012-2014 The Khronos Group Inc. Copyright terms at
235bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciSpecification Update Policy
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
285bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
295bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
305bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
315bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
325bd8deadSopenharmony_ci    described in more detail at
335bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciStatus
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    Complete. 
385bd8deadSopenharmony_ci    Approved by the ARB on 2012/06/18.
395bd8deadSopenharmony_ci    Ratified by the Khronos Board of Promoters on 2012/07/27.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciVersion
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    Last Modified Date:         January 28, 2014
445bd8deadSopenharmony_ci    Revision:                   5
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ciNumber
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    ARB Extension #129
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ciDependencies
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    OpenGL 3.0 and ARB_geometry_shader4, or OpenGL 3.2 is required.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    ARB_viewport_array is required.
555bd8deadSopenharmony_ci    
565bd8deadSopenharmony_ci    This extension is written against The OpenGL Shading Language 4.20.11
575bd8deadSopenharmony_ci    Specification.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    This extension interacts with NV_gpu_program4.
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ciOverview
625bd8deadSopenharmony_ci
635bd8deadSopenharmony_ci    The geometry shader has the special built-in variables gl_Layer and
645bd8deadSopenharmony_ci    gl_ViewportIndex that specify which layer and viewport primitives
655bd8deadSopenharmony_ci    are rendered to. Currently the fragment shader does not know which
665bd8deadSopenharmony_ci    layer or viewport the fragments are being written to without the
675bd8deadSopenharmony_ci    application implementing their own interface variables between
685bd8deadSopenharmony_ci    the geometry and fragment shaders.
695bd8deadSopenharmony_ci    
705bd8deadSopenharmony_ci    This extension specifies that the gl_Layer and gl_ViewportIndex
715bd8deadSopenharmony_ci    built-in variables are also available to the fragment shader so the
725bd8deadSopenharmony_ci    application doesn't need to implement these manually.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ciNew Procedures and Functions
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    None
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ciNew Tokens
795bd8deadSopenharmony_ci
805bd8deadSopenharmony_ci    None
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL Shading Language 4.20.11 Specification
835bd8deadSopenharmony_ci(Built-In Variables)
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci    "Including the following line in a shader will enable the language
865bd8deadSopenharmony_ci    features described in this extension:
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci        #extension GL_ARB_fragment_layer_viewport : <behavior>
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    where <behavior> is as specified in section 3.3 for the #extension
915bd8deadSopenharmony_ci    directive."
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    A new preprocessor macro is added to the OpenGL Shading Language:
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci      #define GL_ARB_fragment_layer_viewport    1
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    Add to the section labelled "In the fragment language, built-in variables
985bd8deadSopenharmony_ci    are intrinsically declared as:" on page 99:
995bd8deadSopenharmony_ci    
1005bd8deadSopenharmony_ci   "in int gl_Layer;
1015bd8deadSopenharmony_ci    in int gl_ViewportIndex;"
1025bd8deadSopenharmony_ci    
1035bd8deadSopenharmony_ci    Modify the first paragraph describing gl_Layer start on the bottom of page
1045bd8deadSopenharmony_ci    100 as follows:
1055bd8deadSopenharmony_ci    
1065bd8deadSopenharmony_ci   "The variable gl_Layer is available as an output variable in the geometry
1075bd8deadSopenharmony_ci    shader and an input variable in the fragment shader. In the geometry
1085bd8deadSopenharmony_ci    shader it is used to select a specific layer (or face and layer of a cube
1095bd8deadSopenharmony_ci    map) of a multi-layer framebuffer attachment. The actual layer used will
1105bd8deadSopenharmony_ci    come from ..."
1115bd8deadSopenharmony_ci    
1125bd8deadSopenharmony_ci    Add the following paragraph to the end of the section describing gl_Layer
1135bd8deadSopenharmony_ci    on page 101 as follows:
1145bd8deadSopenharmony_ci    
1155bd8deadSopenharmony_ci   "The input variable gl_Layer in the fragment language will have the same 
1165bd8deadSopenharmony_ci    value that was written to the output variable gl_Layer in the geometry 
1175bd8deadSopenharmony_ci    language. If the geometry stage does not dynamically assign a value to 
1185bd8deadSopenharmony_ci    gl_Layer, the value of gl_Layer in the fragment stage will be undefined.  
1195bd8deadSopenharmony_ci    If the geometry stage makes no static assignment to gl_Layer, the input 
1205bd8deadSopenharmony_ci    gl_Layer in the fragment stage will be zero.  Otherwise, the fragment 
1215bd8deadSopenharmony_ci    stage will read the same value written by the geometry stage, even if 
1225bd8deadSopenharmony_ci    that value is out of range.  If a fragment shader contains a static 
1235bd8deadSopenharmony_ci    access to gl_Layer, it will count against the implementation defined 
1245bd8deadSopenharmony_ci    limit for the maximum number of inputs to the fragment stage."
1255bd8deadSopenharmony_ci    
1265bd8deadSopenharmony_ci    Modify the fourth paragraph on page 101 which begins the description of
1275bd8deadSopenharmony_ci    gl_ViewportIndex:
1285bd8deadSopenharmony_ci    
1295bd8deadSopenharmony_ci   "The variable gl_ViewportIndex is available as an output variable in the
1305bd8deadSopenharmony_ci    geometry shader and an input variable in the fragment shader. In the
1315bd8deadSopenharmony_ci    geometry shader it provides the index of the viewport to which the next
1325bd8deadSopenharmony_ci    primitive emitted from the geometry shader should be drawn. ..."
1335bd8deadSopenharmony_ci   
1345bd8deadSopenharmony_ci    After this paragraph add the following new paragraph:
1355bd8deadSopenharmony_ci    
1365bd8deadSopenharmony_ci   "The input variable gl_ViewportIndex in the fragment stage will have the 
1375bd8deadSopenharmony_ci    same value that was written to the output variable gl_ViewportIndex in 
1385bd8deadSopenharmony_ci    the geometry stage.  If the geometry stage does not dynamically assign 
1395bd8deadSopenharmony_ci    to gl_ViewportIndex, the value of gl_ViewportIndex in the fragment shader 
1405bd8deadSopenharmony_ci    will be undefined. If the geometry stage makes no static assignment to 
1415bd8deadSopenharmony_ci    gl_ViewportIndex, the fragment stage will read zero. Otherwise, the 
1425bd8deadSopenharmony_ci    fragment stage will read the same value written by the geometry stage, 
1435bd8deadSopenharmony_ci    even if that value is out of range. If a fragment shader contains a static 
1445bd8deadSopenharmony_ci    access to gl_ViewportIndex, it will count against the implementation 
1455bd8deadSopenharmony_ci    defined limit for the maximum number of inputs to the fragment stage."
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    None
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ciDependencies on NV_gpu_program4
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci    If NV_gpu_program4 is supported, the following edits are made to extend
1545bd8deadSopenharmony_ci    the assembly programming model documented in the NV_gpu_program4
1555bd8deadSopenharmony_ci    extension.  Note that the "result.viewport" geometry shader output
1565bd8deadSopenharmony_ci    requires the use of the "ARB_viewport_array" program option, as documented
1575bd8deadSopenharmony_ci    in the ARB_viewport_array specification.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    (Modify the additions to "Section 2.X.3.2, Program Attribute Variables"
1605bd8deadSopenharmony_ci    from the NV_fragment_program4 extension)
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci      Fragment Attribute Binding  Components  Underlying State
1635bd8deadSopenharmony_ci      --------------------------  ----------  ----------------------------
1645bd8deadSopenharmony_ci      fragment.layer              (l,-,-,-)   primitive layer
1655bd8deadSopenharmony_ci      fragment.viewport           (v,-,-,-)   primitive viewport index
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    If a fragment attribute binding matches "fragment.layer", the "x"
1685bd8deadSopenharmony_ci    component of the fragment attribute variable is filled with a single
1695bd8deadSopenharmony_ci    integer.  If a geometry program is active and includes an instruction
1705bd8deadSopenharmony_ci    writing to the "result.layer" output, this value is obtained by taking the
1715bd8deadSopenharmony_ci    layer value emitted by the geometry program for the provoking vertex.
1725bd8deadSopenharmony_ci    Otherwise, the value zero will be used.  The "y", "z", and "w" components
1735bd8deadSopenharmony_ci    of the variable are always undefined.
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    If a fragment attribute binding matches "fragment.viewport", the "x"
1765bd8deadSopenharmony_ci    component of the fragment attribute variable is filled with a single
1775bd8deadSopenharmony_ci    integer.  If a geometry program is active and includes an instruction
1785bd8deadSopenharmony_ci    writing to the "result.viewport" output, this value is obtained by taking
1795bd8deadSopenharmony_ci    the viewport index value emitted by the geometry program for the provoking
1805bd8deadSopenharmony_ci    vertex.  Otherwise, the value zero will be used.  The "y", "z", and "w"
1815bd8deadSopenharmony_ci    components of the variable are always undefined.
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ci    (Add to "Section 2.X.6, Program Options" of the NV_gpu_program4 extension)
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    + Fragment Layer and Viewport Index Inputs (ARB_fragment_layer_viewport)
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    If a fragment program specifies the "ARB_fragment_layer_viewport" option,
1885bd8deadSopenharmony_ci    it may use the "fragment.layer" and "fragment.viewport" bindings.  If this
1895bd8deadSopenharmony_ci    option is not specified, a program will fail to load if it uses those
1905bd8deadSopenharmony_ci    bindings.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ciErrors
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci    None
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ciNew State
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci    None
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ciNew Implementation Dependent State
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci    None
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ciIssues
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    None
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ciRevision History
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
2125bd8deadSopenharmony_ci    ----  --------  --------  -----------------------------------------------
2135bd8deadSopenharmony_ci    5     01/28/14  Ian R     Fix dependencies.  s/gl_Value/gl_Layer/.  Add
2145bd8deadSopenharmony_ci                              GLSL define for GL_ARB_fragment_layer_viewport.
2155bd8deadSopenharmony_ci    4     06/05/12  johnk     Improve distinctions between stage and shader and
2165bd8deadSopenharmony_ci                              make it be any static access that triggers the 
2175bd8deadSopenharmony_ci                              count against number of inputs to the fragment stage.
2185bd8deadSopenharmony_ci    3     05/31/12  pdaniell  Update language for unassigned and out-of-range
2195bd8deadSopenharmony_ci                              behavior for gl_Layer and gl_ViewportIndex.
2205bd8deadSopenharmony_ci    2     05/25/12  pbrown    Add interaction with NV_gpu_program4, providing
2215bd8deadSopenharmony_ci                              assembly program support for these inputs.
2225bd8deadSopenharmony_ci    1     05/14/12  pdaniell  Initial version.
223