15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_scissor_exclusive
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_scissor_exclusive
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciContributors
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Mark Kilgard, NVIDIA
165bd8deadSopenharmony_ci    Pyarelal Knowles, NVIDIA
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciStatus
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Shipping
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciVersion
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    Last Modified:      February 6, 2019
255bd8deadSopenharmony_ci    Revision:           2
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciNumber
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    OpenGL Extension #529
305bd8deadSopenharmony_ci    OpenGL ES Extension #311
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciDependencies
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    This extension is written against the OpenGL 4.5 Specification
355bd8deadSopenharmony_ci    (Compatibility Profile), dated October 24, 2016.
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    OpenGL 4.5 or OpenGL ES 3.2 is required.
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    This extension is written against the OpenGL Shading Language
405bd8deadSopenharmony_ci    Specification, version 4.50, dated April 14, 2016.
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension trivially interacts with EXT_draw_buffers2,
435bd8deadSopenharmony_ci    EXT_transform_feedback, NV_transform_feedback, and
445bd8deadSopenharmony_ci    EXT_direct_state_access.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    If implemented in OpenGL ES, at least one of NV_viewport_array or
475bd8deadSopenharmony_ci    OES_viewport_array is required.
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciOverview
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    In unextended OpenGL, applications can enable a per-viewport scissor test
525bd8deadSopenharmony_ci    (SCISSOR_TEST) where fragments are discarded if their (x,y) coordinates
535bd8deadSopenharmony_ci    lie outside the corresponding scissor rectangle.  In this extension, we
545bd8deadSopenharmony_ci    provide a separate per-viewport exclusive scissor test, where fragments
555bd8deadSopenharmony_ci    are discarded if their (x,y) coordinates lie *inside* the corresponding
565bd8deadSopenharmony_ci    exclusive scissor rectangle.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    The regular (inclusive) scissor test and exclusive scissor test are
595bd8deadSopenharmony_ci    orthogonal; applications can enable either or both tests for each
605bd8deadSopenharmony_ci    viewport. If both tests are enabled, fragments will be discarded unless
615bd8deadSopenharmony_ci    their (x,y) coordinates are both inside the regular scissor rectangle and
625bd8deadSopenharmony_ci    outside the exclusive scissor rectangle.
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciNew Procedures and Functions
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    void ScissorExclusiveArrayvNV(uint first, sizei count, const int *v);
675bd8deadSopenharmony_ci    void ScissorExclusiveNV(int x, int y, sizei width, sizei height);
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ciNew Tokens
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by the
725bd8deadSopenharmony_ci    <target> parameter of Enablei, Disablei, IsEnabledi, EnableIndexedEXT,
735bd8deadSopenharmony_ci    DisableIndexedEXT, and IsEnabledIndexedEXT, and by the <pname> parameter
745bd8deadSopenharmony_ci    of GetBooleanv, GetIntegerv, GetInteger64v, GetFloatv, GetDoublev,
755bd8deadSopenharmony_ci    GetDoubleIndexedv, GetBooleani_v, GetIntegeri_v, GetInteger64i_v,
765bd8deadSopenharmony_ci    GetFloati_v, GetDoublei_v, GetBooleanIndexedvEXT, GetIntegerIndexedvEXT,
775bd8deadSopenharmony_ci    and GetFloatIndexedvEXT:
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci        SCISSOR_TEST_EXCLUSIVE_NV                       0x9555
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
825bd8deadSopenharmony_ci    GetInteger64v, GetFloatv, GetDoublev, GetBooleani_v, GetIntegeri_v,
835bd8deadSopenharmony_ci    GetInteger64i_v, GetFloati_v, GetDoublei_v, GetDoubleIndexedv,
845bd8deadSopenharmony_ci    GetBooleanIndexedvEXT, GetIntegerIndexedvEXT, and GetFloatIndexedvEXT:
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci        SCISSOR_BOX_EXCLUSIVE_NV                        0x9556
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ciModifications to the OpenGL 4.5 Specification (Compatibility Profile)
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    Insert a new section after section 14.9.2, Scissor Test (p. 560)
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci    14.9.3  Exclusive Scissor Test
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    Like the scissor test (section 14.9.2), the exclusive scissor test
955bd8deadSopenharmony_ci    determines if (x_w, y_w) lies outside the exclusive scissor rectangles
965bd8deadSopenharmony_ci    defined by four values for each viewport.  These values are set with
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci      void ScissorExclusiveArrayvNV(uint first, sizei count, const int *v);
995bd8deadSopenharmony_ci      void ScissorExclusiveNV(int x, int y, sizei width, sizei height);
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci    ScissorExclusiveArrayvNV defines a set of exclusive scissor rectangles that
1025bd8deadSopenharmony_ci    are each applied to the corresponding viewport (see section 13.6.1).
1035bd8deadSopenharmony_ci    <first> specifies the index of the first exclusive scissor rectangle to
1045bd8deadSopenharmony_ci    modify, and <count> specifies the number of scissor rectangles.  <v>
1055bd8deadSopenharmony_ci    specifies an array of 4*<count> integers, where each group of four
1065bd8deadSopenharmony_ci    integers specifies the left column, bottom row, width, and height (in that
1075bd8deadSopenharmony_ci    order) of an individual exclusive scissor rectangle.
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    ScissorExclusiveNV is equivalent to calling ScissorExclusiveArrayvNV with
1105bd8deadSopenharmony_ci    <first> set to 0, <count> set to the value of MAX_VIEWPORTS, and <v>
1115bd8deadSopenharmony_ci    filled with an array of 4*MAX_VIEWPORTS integer, with each group of four
1125bd8deadSopenharmony_ci    integers set to <x>, <y>, <width>, and <height>, respectively.
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    When enabled, the exclusive scissor test passes only if the fragment is
1155bd8deadSopenharmony_ci    outside the selected exclusive scissor rectangle, which is the case if
1165bd8deadSopenharmony_ci    any of the following conditions is true:
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci      * x_w <  left,
1195bd8deadSopenharmony_ci      * x_w >= left + width,
1205bd8deadSopenharmony_ci      * y_w <  bottom, or
1215bd8deadSopenharmony_ci      * y_w >= bottom + height.
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    Otherwise, the test fails and the fragment is discarded. For points,
1245bd8deadSopenharmony_ci    lines, and polygons, the scissor rectangle for a primitive is selected in
1255bd8deadSopenharmony_ci    the same manner as the viewport (see section 13.6.1).  For bitmaps, pixel
1265bd8deadSopenharmony_ci    rectangles and buffer clears (see section 17.4.3), the scissor rectangle
1275bd8deadSopenharmony_ci    numbered zero is used for the scissor test.
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci      Errors
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci        An INVALID_VALUE error is generated by ScissorExclusiveArrayvNV if
1325bd8deadSopenharmony_ci        <first>+<count> is greater than the value of MAX_VIEWPORTS.
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci        An INVALID_VALUE error is generated if width or height is negative.
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    The exclusive scissor test is enabled or disabled for all viewports using
1375bd8deadSopenharmony_ci    Enable or Disable with target SCISSOR_TEST_EXCLUSIVE_NV.  The test is enabled or
1385bd8deadSopenharmony_ci    disabled for a specific viewport using Enablei or Disablei with the
1395bd8deadSopenharmony_ci    constant SCISSOR_TEST_EXCLUSIVE_NV and the index of the selected viewport.
1405bd8deadSopenharmony_ci    When disabled, it is as if the exclusive scissor test always passes. The
1415bd8deadSopenharmony_ci    value of the scissor test enable for viewport <i> can be queried by
1425bd8deadSopenharmony_ci    calling IsEnabledi with target SCISSOR_TEST_EXCLUSIVE_NV and index <i>.
1435bd8deadSopenharmony_ci    The value of the exclusive scissor test enable for viewport zero may also
1445bd8deadSopenharmony_ci    be queried by calling IsEnabled with the same target, but no index
1455bd8deadSopenharmony_ci    parameter.
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci      Errors
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci        An INVALID_VALUE error is generated by Enablei, Disablei and
1505bd8deadSopenharmony_ci        IsEnabledi if target is SCISSOR_TEST_EXCLUSIVE_NV and <index> is
1515bd8deadSopenharmony_ci        greater than or equal to the value of MAX_VIEWPORTS.
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci    The state required for the exclusive scissor test consists of four integer
1545bd8deadSopenharmony_ci    values per viewport, and a bit indicating whether the test is enabled or
1555bd8deadSopenharmony_ci    disabled for each viewport. In the initial state for all viewports, the
1565bd8deadSopenharmony_ci    exclusive scissor test is disabled and the exclusive scissor rectangle has
1575bd8deadSopenharmony_ci    zero values for all of left, bottom, width, and height.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ciInteractions with EXT_draw_buffers2 or EXT_transform_feedback or
1605bd8deadSopenharmony_ciNV_transform_feedback or EXT_direct_state_access
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Ignore references to GetBooleanIndexedvEXT or GetIntegerIndexedvEXT if
1635bd8deadSopenharmony_ci    none of EXT_draw_buffers2, EXT_transform_feedback, NV_transform_feedback,
1645bd8deadSopenharmony_ci    or EXT_direct_state_access are supported.
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ciInteractions with EXT_draw_buffers2 or EXT_direct_state_access
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    Ignore references to EnableIndexedEXT, DisableIndexedEXT, and
1695bd8deadSopenharmony_ci    IsEnabledIndexedEXT if neither of EXT_draw_buffers2 or
1705bd8deadSopenharmony_ci    EXT_direct_state_access are supported.
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ciInteractions with EXT_direct_state_access
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    Ignore references to GetFloatIndexedvEXT and GetDoubleIndexedvEXT if
1755bd8deadSopenharmony_ci    EXT_direct_state_access is not supported.
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ciInteractions with NV_viewport_array or OES_viewport_array
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci    If NV_viewport_array is supported, references to MAX_VIEWPORTS and
1805bd8deadSopenharmony_ci    GetFloati_v apply to MAX_VIEWPORTS_NV and GetFloati_vNV respecively.
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    If OES_viewport_array is supported, references to MAX_VIEWPORTS and
1835bd8deadSopenharmony_ci    GetFloati_v apply to MAX_VIEWPORTS_OES and GetFloati_vOES respectively.
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ciInteractions with OpenGL ES 3.2
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    If implemented in OpenGL ES, remove all references to GetDoublev,
1885bd8deadSopenharmony_ci    GetDoublei_v, EnableIndexedEXT, DisableIndexedEXT, IsEnabledIndexedEXT,
1895bd8deadSopenharmony_ci    GetBooleanIndexedvEXT, GetIntegerIndexedvEXT, GetFloatIndexedvEXT and
1905bd8deadSopenharmony_ci    GetDoubleIndexedv.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    If implemented in OpenGL ES, remove all references to MAX_VIEWPORTS and
1935bd8deadSopenharmony_ci    GetFloati_v.
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
1965bd8deadSopenharmony_ci
1975bd8deadSopenharmony_ci    None
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ciErrors
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    Errors are described in "Errors" sections of the spec language above.
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ciNew State
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    Get Value                  Type        Get Command   Initial Value   Description                    Sec     Attribute
2065bd8deadSopenharmony_ci    ------------------------   ----------  ------------  -------------   ----------------------------   -----   ---------
2075bd8deadSopenharmony_ci    SCISSOR_TEST_EXCLUSIVE_NV  16* x B     IsEnabledi    FALSE           Exclusive scissoring enabled   14.9.3  scissor/enable
2085bd8deadSopenharmony_ci    SCISSOR_BOX_EXCLUSIVE_NV   16* x 4 x Z GetIntegeri_v (0,0,0,0)       Exclusive scissor rectangles   14.9.3  scissor
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ciNew Implementation Dependent State
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci    None
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ciIssues
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    (1) How should we name this extension?
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci      RESOLVED:  NV_scissor_exclusive.  It defines scissor rectangles and
2195bd8deadSopenharmony_ci      tests that are "exclusive", where fragments pass only if they are
2205bd8deadSopenharmony_ci      outside the rectangle.
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    (2) What should we use for the default values for exclusive scissor
2235bd8deadSopenharmony_ci        rectangles?
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci      RESOLVED:  For inclusive scissors, the default values for an OpenGL
2265bd8deadSopenharmony_ci      context are taken from the size of the drawable first used with the
2275bd8deadSopenharmony_ci      context.  While the inclusive scissor test is initially disabled, the
2285bd8deadSopenharmony_ci      default state allows for "normal" unscissored rendering to that drawable
2295bd8deadSopenharmony_ci      if the test is enabled without explicitly programming a scissor
2305bd8deadSopenharmony_ci      rectangle.
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci      If we used similar state for exclusive scissors, enabling the exclusive
2335bd8deadSopenharmony_ci      scissor test without programming a rectangle would scissor out all
2345bd8deadSopenharmony_ci      rendering to such drawables.  Instead, we specify the default rectangles
2355bd8deadSopenharmony_ci      as (0,0,0,0), which would cause the exclusive scissor test to discard
2365bd8deadSopenharmony_ci      nothing if enabled without programming a rectangle.  Additionally,
2375bd8deadSopenharmony_ci      this approach makes the default state independent of the drawable first
2385bd8deadSopenharmony_ci      used with the OpenGL context.
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    (3) How does the exclusive scissor interact with the functionality
2415bd8deadSopenharmony_ci        of EXT_window_rectangles?
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci      RESOLVED:  The exclusive scissor, as with the inclusive scissor, is orthogonal
2445bd8deadSopenharmony_ci      to the window rectangles testing introduced by EXT_window_rectangles.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci      The window rectangle testing applies to ALL viewports whereas the
2475bd8deadSopenharmony_ci      exclusive scissor, as with the inclusive scissor, are selected by the
2485bd8deadSopenharmony_ci      particular viewport index selected for rasterization.
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci      Additionally window rectangle testing is only support rendering
2515bd8deadSopenharmony_ci      to framebuffer objects (FBOs) whereas the exclusive scissor,
2525bd8deadSopenharmony_ci      as with the conventional inclusive scissor, works on all drawable.
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ciRevision History
2555bd8deadSopenharmony_ci
2565bd8deadSopenharmony_ci    Revision 2 (pknowles)
2575bd8deadSopenharmony_ci    - Add ES interactions.
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci    Revision 1 (pbrown)
2605bd8deadSopenharmony_ci    - Internal revisions.
261