15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    WGL_ARB_buffer_region
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    WGL_ARB_buffer_region
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Dale Kirkland, NVIDIA (dkirkland 'at' nvidia.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciNotice
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Copyright (c) 1999-2013 The Khronos Group Inc. Copyright terms at
165bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciSpecification Update Policy
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
215bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
225bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
235bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
245bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
255bd8deadSopenharmony_ci    described in more detail at
265bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciStatus
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    Complete. Approved by ARB on 12/8/1999
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciVersion
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    Last Modified Date: March 12, 2002
355bd8deadSopenharmony_ci    Revision: 1.1
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ciNumber
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    ARB Extension #4
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciDependencies
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    The extension is written against the OpenGL 1.2.1 Specification
445bd8deadSopenharmony_ci    although it should work on any previous OpenGL specification.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    The WGL_EXT_extensions_string extension is required.
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ciOverview
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    The buffer region extension is a mechanism that allows an area of
515bd8deadSopenharmony_ci    an OpenGL window to be saved in off-screen memory for quick
525bd8deadSopenharmony_ci    restores.  The off-screen memory can either be frame buffer memory
535bd8deadSopenharmony_ci    or system memory, although frame buffer memory might offer optimal
545bd8deadSopenharmony_ci    performance.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ci    A buffer region can be created for the front color, back color,
575bd8deadSopenharmony_ci    depth, and/or stencil buffer.  Multiple buffer regions for the same
585bd8deadSopenharmony_ci    buffer type can exist.
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ciIP Status
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    None
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciIssues
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    1. Do we need the glBufferRegionEnabled call that is in the
675bd8deadSopenharmony_ci       Kinetix extensions?
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci       The reason behind this function was so that a single driver
705bd8deadSopenharmony_ci       could be used on adapters with various amounts of memory -- the
715bd8deadSopenharmony_ci       extension would always be present but its use would depend on a
725bd8deadSopenharmony_ci       separate call.  The same functionality could be achieved by not
735bd8deadSopenharmony_ci       advertising this extension or always returning a value of NULL
745bd8deadSopenharmony_ci       from wglCreateBufferRegionARB.
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    2. Should the width/height be specified on the create.
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci       Because applications create regions that are not used, it would
795bd8deadSopenharmony_ci       be better to leave the size as a parameter on the save.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    3. Should information be added to the create to allow for layer
825bd8deadSopenharmony_ci       support?
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci       Layer support has been added.
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    4. Which DC gets used for buffer region operations?
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci       The DC that was allocated on the CreateBufferRegionARB call is
895bd8deadSopenharmony_ci       saved and used for subsequent save and restore operations.  It
905bd8deadSopenharmony_ci       must remain valid during the life of the buffer region.  This is
915bd8deadSopenharmony_ci       analogous to the RC method for handling the DC.
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci    5. Does the driver do a flush before the save and restore?
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci       In keeping with the same paradigm as SwapBuffers, a flush will
965bd8deadSopenharmony_ci       be made by the driver for the RC bound to the calling thread
975bd8deadSopenharmony_ci       before the save and restore operations.
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    6. Which coordinate system is used?
1005bd8deadSopenharmony_ci
1015bd8deadSopenharmony_ci       The KTX_buffer_region and WIN_swap_hint extensions specify the
1025bd8deadSopenharmony_ci       (x,y) origin as the lower left corner of the rectangle.  This
1035bd8deadSopenharmony_ci       extension adopts the same philosophy.
1045bd8deadSopenharmony_ci
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ciNew Procedures and Functions
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    HANDLE wglCreateBufferRegionARB(HDC hDC,
1095bd8deadSopenharmony_ci                                    int iLayerPlane,
1105bd8deadSopenharmony_ci                                    UINT uType)
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    VOID wglDeleteBufferRegionARB(HANDLE hRegion)
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    BOOL wglSaveBufferRegionARB(HANDLE hRegion,
1155bd8deadSopenharmony_ci                                int x,
1165bd8deadSopenharmony_ci                                int y,
1175bd8deadSopenharmony_ci                                int width,
1185bd8deadSopenharmony_ci                                int height)
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    BOOL wglRestoreBufferRegionARB(HANDLE hRegion,
1215bd8deadSopenharmony_ci                                   int x,
1225bd8deadSopenharmony_ci                                   int y,
1235bd8deadSopenharmony_ci                                   int width,
1245bd8deadSopenharmony_ci                                   int height,
1255bd8deadSopenharmony_ci                                   int xSrc,
1265bd8deadSopenharmony_ci                                   int ySrc)
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ciNew Tokens
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    Accepted by the <uType> parameter of wglCreateBufferRegionARB is the
1325bd8deadSopenharmony_ci    bitwise OR of any of the following values:
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci      WGL_FRONT_COLOR_BUFFER_BIT_ARB          0x00000001
1355bd8deadSopenharmony_ci      WGL_BACK_COLOR_BUFFER_BIT_ARB           0x00000002
1365bd8deadSopenharmony_ci      WGL_DEPTH_BUFFER_BIT_ARB                0x00000004
1375bd8deadSopenharmony_ci      WGL_STENCIL_BUFFER_BIT_ARB              0x00000008
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    None
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    None
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
1515bd8deadSopenharmony_ciOperations and the Frame Buffer)
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci    None
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    None
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and
1625bd8deadSopenharmony_ciState Requests)
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    None
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.2.1 Specification (Invariance)
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    None
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ciAdditions to the GLX Specification
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    None
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ciGLX Protocol
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    None
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ciAdditions to the WGL Specification
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    A buffer region can be created with wglCreateBufferRegionARB
1835bd8deadSopenharmony_ci    which returns a handle associated with the buffer region.
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci      HANDLE wglCreateBufferRegionARB(HDC hDC,
1865bd8deadSopenharmony_ci                                      INT iLayerPlane,
1875bd8deadSopenharmony_ci                                      UINT uType)
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    <hDC> specifies a device context for the device on which the buffer
1905bd8deadSopenharmony_ci    region is created. <iLayerPlane> specifies the layer.  Positive
1915bd8deadSopenharmony_ci    values identify overlay planes, negative values identify underlay
1925bd8deadSopenharmony_ci    planes.  A value of 0 identifies the main plane.
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    <uType> is a bitwise OR of any of the following values indicating
1955bd8deadSopenharmony_ci    which buffers can be saved or restored.  Multiple bits can be set
1965bd8deadSopenharmony_ci    and may result in better performance if multiple buffers are saved
1975bd8deadSopenharmony_ci    or restored.
1985bd8deadSopenharmony_ci
1995bd8deadSopenharmony_ci        WGL_FRONT_COLOR_BUFFER_BIT_ARB
2005bd8deadSopenharmony_ci        WGL_BACK_COLOR_BUFFER_BIT_ARB
2015bd8deadSopenharmony_ci        WGL_DEPTH_BUFFER_BIT_ARB
2025bd8deadSopenharmony_ci        WGL_STENCIL_BUFFER_BIT_ARB
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    For stereo windows, WGL_FRONT_COLOR_BUFFER_BIT_ARB implies both the
2055bd8deadSopenharmony_ci    left and right front buffers, and WGL_BACK_COLOR_BUFFER_BIT_ARB
2065bd8deadSopenharmony_ci    implies both the left and right back buffers.
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci    When wglCreateBufferRegionARB fails to create a buffer region, a
2095bd8deadSopenharmony_ci    value of NULL is returned.  To get extended error information, call
2105bd8deadSopenharmony_ci    GetLastError.
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci    Image, depth, and stencil data can be saved into the buffer region
2135bd8deadSopenharmony_ci    by calling wglSaveBufferRegionARB.
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci      BOOL wglSaveBufferRegionARB(HANDLE hRegion,
2165bd8deadSopenharmony_ci                                  int x,
2175bd8deadSopenharmony_ci                                  int y,
2185bd8deadSopenharmony_ci                                  int width,
2195bd8deadSopenharmony_ci                                  int height)
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci    <hRegion> is a handle to a buffer region previously created with
2225bd8deadSopenharmony_ci    wglCreateBufferRegionARB.  The DC specified when the region was
2235bd8deadSopenharmony_ci    created is used as the device context specifying the window.
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci    <x> and <y> specify the window position for the source rectangle.
2265bd8deadSopenharmony_ci    <width> and <height> specify the width and height of the source
2275bd8deadSopenharmony_ci    rectangle.  Data outside the window for the specified rectangle is
2285bd8deadSopenharmony_ci    undefined.  The OpenGL coordinate system is used for specifying the
2295bd8deadSopenharmony_ci    rectangle (<x> and <y> specify the lower-left corner of the
2305bd8deadSopenharmony_ci    rectangle).
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci    If an RC is current to the calling thread, a flush will occur
2335bd8deadSopenharmony_ci    before the save operation.
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci    The saved buffer region area can be freed by calling
2365bd8deadSopenharmony_ci    wglSaveBufferRegionARB with <width> or <height> set to a value
2375bd8deadSopenharmony_ci    of 0.
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ci    If the call to wglSaveBufferRegionARB is successful, a value of
2405bd8deadSopenharmony_ci    TRUE is returned.  Otherwise, a value of FALSE is returned.  To
2415bd8deadSopenharmony_ci    get extended error information, call GetLastError.
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    A previously saved region can be restored (multiple times) with
2445bd8deadSopenharmony_ci    the wglRestoreBufferRegionARB function.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci      BOOL wglRestoreBufferRegionARB(HANDLE hRegion,
2475bd8deadSopenharmony_ci                                     int x,
2485bd8deadSopenharmony_ci                                     int y,
2495bd8deadSopenharmony_ci                                     int width,
2505bd8deadSopenharmony_ci                                     int height,
2515bd8deadSopenharmony_ci                                     int xSrc,
2525bd8deadSopenharmony_ci                                     int ySrc)
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci    <hRegion> is a handle to a buffer region previously created with
2555bd8deadSopenharmony_ci    wglCreateBufferRegionARB.  The DC specified when the region was
2565bd8deadSopenharmony_ci    created is used as the device context specifying the window.
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci    <x> and <y> specify the window position for the destination
2595bd8deadSopenharmony_ci    rectangle.  <width> and <height> specify the width and height of
2605bd8deadSopenharmony_ci    the destination rectangle.  The OpenGL coordinate system is used
2615bd8deadSopenharmony_ci    for specifying the rectangle (<x> and <y> specify the lower-left
2625bd8deadSopenharmony_ci    corner of the rectangle).
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    <xSrc> and <ySrc> specify the position in the buffer region for
2655bd8deadSopenharmony_ci    the source of the data.  Any portion of the rectangle outside of
2665bd8deadSopenharmony_ci    the saved region is ignored.
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci    If an RC is current to the calling thread, a flush will occur
2695bd8deadSopenharmony_ci    before the restore operation.
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    If the call to wglRestoreBufferRegionARB is successful, a value of
2725bd8deadSopenharmony_ci    TRUE is returned.  Otherwise, a value of FALSE is returned.  To
2735bd8deadSopenharmony_ci    get extended error information, call GetLastError.
2745bd8deadSopenharmony_ci
2755bd8deadSopenharmony_ci    The buffer region can be deleted with wglDeleteBufferRegionARB.
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci      VOID wglDeleteBufferRegionARB(HANDLE hRegion)
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci    <hRegion> is a handle to a buffer region previously created with
2805bd8deadSopenharmony_ci    wglCreateBufferRegionARB.  Any saved data associated with <hRegion>
2815bd8deadSopenharmony_ci    is discarded.  The DC used to create the region must still be valid
2825bd8deadSopenharmony_ci    for the delete to work.
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ciDependencies on WGL_EXT_extensions_string
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    Because there is no way to extend wgl, these calls are defined in
2875bd8deadSopenharmony_ci    the ICD and can be called by obtaining the address with
2885bd8deadSopenharmony_ci    wglGetProcAddress.  Because this extension is a WGL extension, it
2895bd8deadSopenharmony_ci    is not included in the GL_EXTENSIONS string.  Its existence can be
2905bd8deadSopenharmony_ci    determined with the WGL_EXT_extensions_string extension.
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ciErrors
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ci    ERROR_NO_SYSTEM_RESOURCES is generated if memory cannot be
2955bd8deadSopenharmony_ci    allocated for storing the saved data.
2965bd8deadSopenharmony_ci
2975bd8deadSopenharmony_ci    ERROR_INVALID_HANDLE is generated if <hRegion> is not a valid
2985bd8deadSopenharmony_ci    handle that was previously returned by wglCreateBufferRegionARB.
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci    ERROR_INVALID_DATA is generated if <uType> is zero or includes
3015bd8deadSopenharmony_ci    an undefined bit.
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci    ERROR_INVALID_DATA is generated if <width> or <height> is negative.
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ciNew State
3065bd8deadSopenharmony_ci
3075bd8deadSopenharmony_ci    None
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ciNew Implementation Dependent State
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci    None
3125bd8deadSopenharmony_ci
3135bd8deadSopenharmony_ciConformance Test
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    1. Clear the window to blue.
3165bd8deadSopenharmony_ci    2. Save an area of the window using wglSaveBufferRegionARB.
3175bd8deadSopenharmony_ci    3. Clear the window to red.
3185bd8deadSopenharmony_ci    4. Restore the area of the window using wglRestoreBufferRegionARB.
3195bd8deadSopenharmony_ci    5. Verify that the area was restored.
3205bd8deadSopenharmony_ci    6. Repeat for the depth buffer.
3215bd8deadSopenharmony_ci    7. Repeat for the stencil buffer.
3225bd8deadSopenharmony_ci    8. Repeat for image and depth buffer.
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ciRevision History
3255bd8deadSopenharmony_ci
3265bd8deadSopenharmony_ci    12/10/99  1.0  ARB extension - based on the wgl_buffer_region
3275bd8deadSopenharmony_ci                   extension.
3285bd8deadSopenharmony_ci    03/12/02  1.1  Updated contact information.
329