15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_read_depth 45bd8deadSopenharmony_ci NV_read_stencil 55bd8deadSopenharmony_ci NV_read_depth_stencil 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ciName Strings 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ci GL_NV_read_depth 105bd8deadSopenharmony_ci GL_NV_read_stencil 115bd8deadSopenharmony_ci GL_NV_read_depth_stencil 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContact 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Greg Roth, NVIDIA Corporation (groth 'at' nvidia.com) 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciContributors 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Koji Ashida, NVIDIA Corporation 205bd8deadSopenharmony_ci Gregory Prisament, NVIDIA Corporation 215bd8deadSopenharmony_ci Greg Roth, NVIDIA Corporation 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciStatus 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Complete. 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciVersion 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci Last Modified Date: November 9, 2021 305bd8deadSopenharmony_ci NVIDIA Revision: 5.0 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciNumber 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci OpenGL ES Extension #94 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ciDependencies 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci Written against the OpenGL ES 2.0 Specification. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci NV_read_depth_stencil requires OES_packed_depth_stencil. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciOverview 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci Unextended OpenGL-ES 2.0 only supports using ReadPixels to read from the 455bd8deadSopenharmony_ci default color buffer of the currently-bound framebuffer. However, it is 465bd8deadSopenharmony_ci useful for debugging to be able to read from depth and stencil buffers. 475bd8deadSopenharmony_ci This extension re-introduces these features into OpenGL-ES 2.0. 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci This document describes several extensions in order to allow an 505bd8deadSopenharmony_ci implementation to support a subset of the total functionality. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci The NV_read_depth extension allows reading from the depth buffer using 535bd8deadSopenharmony_ci ReadPixels. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci The NV_read_stencil extension allows reading from the stencil buffer using 565bd8deadSopenharmony_ci ReadPixels. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci The NV_read_depth_stencil extension allows reading from packed 595bd8deadSopenharmony_ci depth-stencil buffers using ReadPixels. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ciNew Procedures and Functions 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci None. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ciNew Tokens 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci None. 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ciChanges to Chapter 4 of the OpenGL ES 2.0 Specification 715bd8deadSopenharmony_ci(Per-Fragment Operations and the Framebuffer) 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci Section 4.3.1 (Reading Pixels), replace description of ReadPixels: 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci The arguments after x and y to ReadPixels are those described in 775bd8deadSopenharmony_ci section 3.6.2 defining pixel rectangles. The pixel storage modes 785bd8deadSopenharmony_ci that apply to ReadPixels are summarized in Table 4.3. 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci Section 4.3.1 (Reading Pixels) subsection "Obtaining Pixels from 815bd8deadSopenharmony_ci the Framebuffer", replace the first paragraph with: 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci If the <format> is DEPTH_COMPONENT, then values are obtained 845bd8deadSopenharmony_ci from the depth buffer. If there is no depth buffer, the error 855bd8deadSopenharmony_ci INVALID_OPERATION occurs. If the <type> is not UNSIGNED_SHORT, 865bd8deadSopenharmony_ci FLOAT, or UNSIGNED_INT_24_8_OES then the error INVALID_ENUM 875bd8deadSopenharmony_ci occurs. If the <type> is FLOAT and the depth buffer is not a 885bd8deadSopenharmony_ci float buffer, an INVALID_OPERATION error occurs. If the <type> 895bd8deadSopenharmony_ci is UNSIGNED_SHORT or UNSIGNED_INT_24_8_OES and the depth buffer 905bd8deadSopenharmony_ci is a float buffer, an INVALID_OPERATION error occurs. When the 915bd8deadSopenharmony_ci <type> is UNSIGNED_INT_24_8_OES the values read into the 8 925bd8deadSopenharmony_ci stencil bits are undefined. 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci If the <format> is DEPTH_STENCIL_OES, then values are taken from 955bd8deadSopenharmony_ci both the depth buffer and the stencil buffer. If there is no 965bd8deadSopenharmony_ci depth buffer or if there is no stencil buffer, then the error 975bd8deadSopenharmony_ci INVALID_OPERATION occurs. If the <type> is not UNSIGNED_INT_24_- 985bd8deadSopenharmony_ci 8_OES or FLOAT_32_UNSIGNED_INT_24_8_REV_NV, then the error 995bd8deadSopenharmony_ci INVALID_ENUM occurs. If the <type> is FLOAT_32_UNSIGNED_INT_24_- 1005bd8deadSopenharmony_ci 8_REV_NV and the depth buffer is not a float buffer, an INVALID_- 1015bd8deadSopenharmony_ci OPERATION error occurs. If the <type> is UNSIGNED_INT_24_8_OES 1025bd8deadSopenharmony_ci and the depth buffer is a float buffer, an INVALID_OPERATION 1035bd8deadSopenharmony_ci error occurs. 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci If the <format> is STENCIL_INDEX, then values are taken from 1065bd8deadSopenharmony_ci the stencil buffer. If there is no stencil buffer, then the 1075bd8deadSopenharmony_ci error INVALID_OPERATION occurs. If the <type> is not 1085bd8deadSopenharmony_ci UNSIGNED_BYTE, then the error INVALID_ENUM occurs. 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci If <format> is a color format, then red, green, blue, and alpha 1115bd8deadSopenharmony_ci values are obtained from the color buffer at each pixel 1125bd8deadSopenharmony_ci location. If the framebuffer does not support alpha values then 1135bd8deadSopenharmony_ci the value that is obtained is 1.0. Only two combinations of 1145bd8deadSopenharmony_ci color format and type are accepted. The first is format RGBA and 1155bd8deadSopenharmony_ci type UNSIGNED_BYTE. The second is an implementation-chosen 1165bd8deadSopenharmony_ci format from among those defined in table 3.4, excluding formats 1175bd8deadSopenharmony_ci LUMINANCE and LUMINANCE_ALPHA. The values of format and type for 1185bd8deadSopenharmony_ci this format may be determined by calling GetIntegerv with the 1195bd8deadSopenharmony_ci symbolic constants IMPLEMENTATION_COLOR_READ_FORMAT and 1205bd8deadSopenharmony_ci IMPLEMENTATION_COLOR_READ_TYPE, respectively. The implementation- 1215bd8deadSopenharmony_ci chosen format may vary depending on the format of the currently 1225bd8deadSopenharmony_ci bound rendering surface. Unsupported combinations of format and 1235bd8deadSopenharmony_ci type will generate an INVALID_OPERATION error. 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ciDependencies on NV_read_depth: 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci If NV_read_depth is not supported, the paragraph in "Obtaining Pixels 1285bd8deadSopenharmony_ci from the Framebuffer" describing behavior when the <format> is 1295bd8deadSopenharmony_ci DEPTH_COMPONENT is omitted. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ciDependencies on NV_read_stencil: 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci If NV_read_stencil is not supported, the paragraph in "Obtaining 1345bd8deadSopenharmony_ci Pixels from the Framebuffer" describing behavior "when the <format> 1355bd8deadSopenharmony_ci is STENCIL_INDEX" is omitted. 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ciDependencies on NV_read_depth_stencil: 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci If NV_read_depth_stencil is not supported, the paragraph in 1405bd8deadSopenharmony_ci "Obtaining Pixels from the Framebuffer" describing behavior "when 1415bd8deadSopenharmony_ci the <format> is DEPTH_STENCIL_OES is omitted and UNSIGNED_INT_24_8_EXT is not an 1425bd8deadSopenharmony_ci accepted <value> when <format> is DEPTH_COMPONENT. 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ciIssues 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci 1. Do we need to be able to read stencil buffers individually? 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci On platforms that easily support reading stencil buffers 1495bd8deadSopenharmony_ci individually, it is useful for debugging. However, we do not want 1505bd8deadSopenharmony_ci to require that it is supported on platforms using packed depth- 1515bd8deadSopenharmony_ci stencil buffers. Therefore we use multiple extension names. 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci 2. Should we have FRONT/BACK, LEFT/RIGHT buffer enums for <mode> 1545bd8deadSopenharmony_ci parameter of ReadBufferNV to be used with window system provided 1555bd8deadSopenharmony_ci framebuffers? 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci OpenGL ES 2.0 does not support stereo framebuffers, so for now we 1585bd8deadSopenharmony_ci only support FRONT and BACK. 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci 3. Should this extension add reading of coverage samples? 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci No. That should be left to the EGL_NV_coverage_sample 1635bd8deadSopenharmony_ci specification. 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci 4. How does this extension interact with NV_read_buffer? 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci NV_read_buffer adds support for the ReadBufferNV command, which is 1685bd8deadSopenharmony_ci used to select which color buffer to read from. It does not 1695bd8deadSopenharmony_ci affect the behavior of this extension, since all framebuffers have 1705bd8deadSopenharmony_ci at most one depth and one stencil buffer. 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ciRevision History 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci Rev. Date Author Changes 1765bd8deadSopenharmony_ci ---- -------- --------- ------------------------------------- 1775bd8deadSopenharmony_ci 5 11/09/21 Jon Leech Removed references to 1785bd8deadSopenharmony_ci NV_depth_buffer_float2, which was 1795bd8deadSopenharmony_ci abandoned and never published. 1805bd8deadSopenharmony_ci (see KhronosGroup/OpenGL-Registry#488). 1815bd8deadSopenharmony_ci 4 06/01/11 groth Mostly rewrote spec edits to better 1825bd8deadSopenharmony_ci match the spec and more clearly 1835bd8deadSopenharmony_ci describe behavior. Reformatted. 1845bd8deadSopenharmony_ci 3 03/22/09 gprisament Split from NV_read_buffer. 1855bd8deadSopenharmony_ci Broken into several extension names. 1865bd8deadSopenharmony_ci Re-wrote overview section. 1875bd8deadSopenharmony_ci 2 07/03/08 kashida Change to depend on 1885bd8deadSopenharmony_ci NV_packed_depth_stencil2 1895bd8deadSopenharmony_ci 1 06/10/07 kashida First revision. 1905bd8deadSopenharmony_ci 191