15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_depth_clamp 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_depth_clamp 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Gert Wollny (gert.wollny 'at' collabora.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNotice 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Copyright (c) 2019 Collabora LTD 165bd8deadSopenharmony_ci Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at 175bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciStatus 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Complete. 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciVersion 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Version 1, 2019/01/24. 265bd8deadSopenharmony_ci Based on ARB_depth_clamp version 4, modified 2009/08/02. 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciNumber 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci #309 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciDependencies 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci OpenGL ES 2.0 is required. 355bd8deadSopenharmony_ci Written based on the wording of the OpenGL ES 3.2 specification. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciOverview 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci Conventional OpenGL clips geometric primitives to a clip volume 405bd8deadSopenharmony_ci with six faces, two of which are the near and far clip planes. 415bd8deadSopenharmony_ci Clipping to the near and far planes of the clip volume ensures that 425bd8deadSopenharmony_ci interpolated depth values (after the depth range transform) must be 435bd8deadSopenharmony_ci in the [0,1] range. 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci In some rendering applications such as shadow volumes, it is useful 465bd8deadSopenharmony_ci to allow line and polygon primitives to be rasterized without 475bd8deadSopenharmony_ci clipping the primitive to the near or far clip volume planes (side 485bd8deadSopenharmony_ci clip volume planes clip normally). Without the near and far clip 495bd8deadSopenharmony_ci planes, rasterization (pixel coverage determination) in X and Y 505bd8deadSopenharmony_ci can proceed normally if we ignore the near and far clip planes. 515bd8deadSopenharmony_ci The one major issue is that fragments of a primitive may extend 525bd8deadSopenharmony_ci beyond the conventional window space depth range for depth values 535bd8deadSopenharmony_ci (typically the range [0,1]). Rather than discarding fragments that 545bd8deadSopenharmony_ci defy the window space depth range (effectively what near and far 555bd8deadSopenharmony_ci plane clipping accomplish), the depth values can be clamped to the 565bd8deadSopenharmony_ci current depth range. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci This extension provides exactly such functionality. This 595bd8deadSopenharmony_ci functionality is useful to obviate the need for near plane capping 605bd8deadSopenharmony_ci of stenciled shadow volumes. The functionality may also be useful 615bd8deadSopenharmony_ci for rendering geometry "beyond" the far plane if an alternative 625bd8deadSopenharmony_ci algorithm (rather than depth testing) for hidden surface removal is 635bd8deadSopenharmony_ci applied to such geometry (specifically, the painter's algorithm). 645bd8deadSopenharmony_ci Similar situations at the near clip plane can be avoided at the 655bd8deadSopenharmony_ci near clip plane where apparently solid objects can be "seen through" 665bd8deadSopenharmony_ci if they intersect the near clip plane. 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ciNew Procedures and Functions 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci None 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ciNew Tokens 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, 755bd8deadSopenharmony_ci and by the <pname> parameter of GetBooleanv, GetIntegerv, 765bd8deadSopenharmony_ci GetFloatv: 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci DEPTH_CLAMP_EXT 0x864F 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ciAdditions to Chapter 12 of the OpenGL ES 3.2 Specification (Fixed-Function Vertex Post-Processing) 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci -- Section 12.5 "Primitive Clipping" 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci Add to the end of the 1st paragraph: 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci "Depth clamping is enabled with the generic Enable command and 875bd8deadSopenharmony_ci disabled with the Disable command. The value of the argument to 885bd8deadSopenharmony_ci either command is DEPTH_CLAMP_EXT. If depth clamping is enabled, the 895bd8deadSopenharmony_ci "-w_c <= z_c <= w_c" plane equation are ignored by view volume 905bd8deadSopenharmony_ci clipping (effectively, there is no near or far plane clipping)." 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ciAdditions to Chapter 15 of the OpenGL ES 3.2 Specification (Writing Fragments and Samples to the Framebuffer) 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci -- Section 15.1.3 "Depth buffer test" 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci Add to the end of the 2nd paragraph: 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci "If depth clamping (see section 12.15) is enabled, before the 995bd8deadSopenharmony_ci incoming fragment's z_w is compared z_w is clamped to the range 1005bd8deadSopenharmony_ci [min(n,f),max(n,f)], where n and f are the current near and far 1015bd8deadSopenharmony_ci depth range values (see section 12.6.1)." 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci None 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ciGLX Protocol 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci None 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ciErrors 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci None 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ciNew State 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ciAdd to table 6.4, transformation state 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ciGet Value Type Get Command Initial Value Description Sec 1205bd8deadSopenharmony_ci-------------- ---- ----------- ------------- -------------- ------ 1215bd8deadSopenharmony_ciDEPTH_CLAMP_EXT B IsEnabled False Depth clamping 12.5 1225bd8deadSopenharmony_ci on/off 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ciNew Implementation Dependent State 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci None 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ciIssues 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci See the issue list in GL_ARB_depth_clamp. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci Can fragments with w_c <=0 be generated when this extension is supported? 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci RESOLUTION: No. The inequalities in OpenGL ES Specification 12.5 clarify 1355bd8deadSopenharmony_ci that only primitives that lie in the region w_c >= 0 can be produced by 1365bd8deadSopenharmony_ci clipping and the vertex normalization in 12.6 clarifies that values 1375bd8deadSopenharmony_ci w_c = 0 are prohibited. Hence fragments with w_c <= 0 should also never 1385bd8deadSopenharmony_ci be generated when this extension is supported. 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci How does this extension differ from ARB_depth_clamp? 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci Instead of DEPTH_CLAMP the parameter is called DEPTH_CLAMP_EXT. 1435bd8deadSopenharmony_ci Push/pop attrib bits are not relevant for OpenGL ES. 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ciRevision History 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci Version 1, 2019/01/25 (Gert Wollny) - rewrite ARB_depth_clamp against 1485bd8deadSopenharmony_ci OpenGL ES 3.2 instead of OpenGL 3.1. 149