1Name 2 3 AMD_depth_clamp_separate 4 5Name Strings 6 7 GL_AMD_depth_clamp_separate 8 9Contact 10 11 Pierre Boudier (pierre.boudier 'at' amd.com) 12 13Contributors 14 15 Pierre Boudier, AMD 16 Graham Sellers, AMD 17 18Status 19 20 In Progress 21 22Version 23 24 Last Modified Date: 09/15/2010 25 Author Revision: 2 26 27Number 28 29 401 30 31Dependencies 32 33 The extension is written against the OpenGL 4.1 (Core) Specification. 34 35Overview 36 37 The extension ARB_depth_clamp introduced the ability to control 38 the clamping of the depth value for both the near and far plane. 39 One limitation is that the control was for both planes at the 40 same time; some applications can benefit from having clamping 41 enabled for only one of the two planes, in order to save 42 fillrate for the other plane by clipping the geometry. 43 44 This extension provides exactly such functionality. 45 46New Procedures and Functions 47 48 None 49 50New Tokens 51 52 Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, 53 and by the <pname> parameter of GetBooleanv, GetIntegerv, 54 GetFloatv, and GetDoublev: 55 56 DEPTH_CLAMP_NEAR_AMD 0x901E 57 DEPTH_CLAMP_FAR_AMD 0x901F 58 59Additions to Chapter 2 of the OpenGL 4.1 (Core) Specification (OpenGL Operation) 60 61 Section 2.20 "Primitive Clipping" 62 63 Add to the end of the 3rd paragraph: 64 65 "Depth clamping is enabled with the generic Enable command and 66 disabled with the Disable command. The value of the argument to 67 either command may be DEPTH_CLAMP_NEAR_AMD or DEPTH_CLAMP_FAR_AMD to enable 68 or disable depth clamping at the near and far planes, respectively. If near 69 depth clamping is enabled, the "-w_c <= z_c" plane equation is ignored by 70 view volume clipping. Effectively, there is no near plane. Likewise, if far 71 clamping is enabled, the "z_c <= w_c" plane equation is ignored by view 72 volume clipping, effectively removing the near plane." 73 74 "In addition to DEPTH_CLAMP_NEAR_AMD and DEPTH_CLAMP_FAR_AMD, the token 75 DEPTH_CLAMP may be used to simultaneously enable or disable depth clamping 76 at both the near and far planes." 77 78Additions to Chapter 3 of the OpenGL 4.1 (Core) Specification (Rasterization) 79 80 None. 81 82Additions to Chapter 4 of the OpenGL 4.1 (Core) Specification (Per-Fragment 83Operations and the Frame Buffer) 84 85 -- Section 4.1.5 "Depth buffer test" 86 87 Add to the end of the 2nd paragraph: 88 89 "If depth clamping (see section 2.20) is enabled, before the incoming 90 fragment's z_w is compared z_w is clamped to the range [min(n,f),0] if 91 clamping at the near plane is enabled, [0, max(n,f)] if clamping at the 92 far plane is enabled, and [min(n,f), max(n,f)] if clamping is enabled at 93 both the near and far planes, where n and f are the current near and far 94 depth range values (see section 2.12.1)." 95 96Additions to Chapter 5 of the OpenGL 4.1 (Core) Specification (Special Functions) 97 98 None. 99 100Additions to Chapter 6 of the OpenGL 4.1 (Core) Specification (State and 101State Requests) 102 103 None. 104 105Additions to Appendix A of the OpenGL 4.1 (Core) Specification (Invariance) 106 107 None. 108 109Additions to the AGL/GLX/WGL Specifications 110 111 None. 112 113Errors 114 115 None. 116 117New State 118 119Add to table 6.9, Transformation State - p.350 120 121 +----------------------+---------+---------------+---------------+-------------------------+-------+ 122 | Get Value | Type | Get Command | Initial Value | Description | Sec | 123 +----------------------+---------+---------------+---------------+-------------------------+-------+ 124 | DEPTH_CLAMP_NEAR_AMD | B | IsEnabled | FALSE | Depth clamping enabled | 2.20 | 125 | | | | | at the near plane | | 126 | DEPTH_CLAMP_FAR_AMD | B | IsEnabled | FALSE | Depth clamping enabled | 2.20 | 127 | | | | | at the far plane | | 128 +----------------------+---------+---------------+---------------+-------------------------+-------+ 129 130 * Note that DEPTH_CLAMP still exists. However, enabling it enables depth clamping for both 131 the near and the far plane. Querying DEPTH_CLAMP will return TRUE if DEPTH_CLAMP_NEAR_AMD _or_ 132 DEPTH_CLAMP_FAR_AMD is enabled. 133 134New Implementation Dependent State 135 136 None 137 138Issues 139 140 1) What should happen to GL_DEPTH_CLAMP? What happens if depth clamping is 141 enabled at one plane, but not the other - what does glIsEnabled(GL_DEPTH_CLAMP) 142 return? 143 144 DISCUSSION: Right now, glIsEnabled(GL_DEPTH_CLAMP) returns GL_TRUE if clamping 145 is enabled at either plane. Other options are to return GL_TRUE only if clamping 146 is enabled at both planes, or to maintain traditional depth clamping as 147 separate state, and have yet another enable to control separate clamping. 148 149Revision History 150 151 Rev. Date Author Changes 152 ---- -------- -------- ----------------------------------------- 153 154 2 09/15/2010 gsellers Update to stand against OpenGL 4.1 155 Add token values. 156 Minor cleanup. 157 Some clarifications. 158 Add issue 1. 159 1 11/19/2009 pboudier Initial draft based on ARB_depth_clamp 160