1Name 2 3 ATI_separate_stencil 4 5Name Strings 6 7 GL_ATI_separate_stencil 8 9Contact 10 11 Benj Lipchak, AMD (benj.lipchak 'at' amd.com) 12 Evan Hart, NVIDIA (ehart 'at' nvidia.com) 13 14 15IP Status 16 17 None 18 19Version 20 21 Date: 11/04/2006 22 Revision: 1.1 23 24Number 25 26 289 27 28Dependencies 29 30 This spec is written against the 1.2.1 version of the GL spec. 31 This spec requires OpenGL 1.0 32 33Overview 34 35 This extension provides the ability to modify the stencil buffer 36 differently based on the facing direction of the primitive that 37 generated the fragment. 38 39Issues 40 41 42 43 44New Procedure and Functions 45 46 StencilOpSeparateATI( GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) 47 StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, 48 GLuint mask) 49 50New Tokens 51 52 53 Accepted by the <fail>, <zfail>, and <zpass> parameters of 54 StencilOpSeparateATI: 55 56 KEEP 0x1E00 57 ZERO 0x0000 58 REPLACE 0x1E01 59 INCR 0x1E02 60 DECR 0x1E03 61 INVERT 0x150A 62 63 Accepted by the <frontfunc> and <backfunc> parameters of 64 StencilFuncSeparateATI: 65 66 NEVER 0x0200 67 LESS 0x0201 68 LEQUAL 0x0203 69 GREATER 0x0204 70 GEQUAL 0x0206 71 EQUAL 0x0202 72 NOTEQUAL 0x0205 73 ALWAYS 0x0207 74 75 Accepted by the <face> parameter of StencilOpSeparateATI: 76 77 FRONT 0x0404 78 BACK 0x0405 79 FRONT_AND_BACK 0x0408 80 81 Accepted by the <pname> parameter of GetIntegerv: 82 83 STENCIL_BACK_FUNC_ATI 0x8800 84 STENCIL_BACK_FAIL_ATI 0x8801 85 STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 86 STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 87 88Additions to Chapter 2 of the OpenGL 1.2.1 Specification (Operation) 89 90 None 91 92Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 93 94 Section 3.0 95 96 Change the second paragraph on page 57 to read: 97 98 "A grid square along with its parameters of assigned color, z 99 (depth), texture coordinates, and facing direction is called a 100 fragment; the parameters are collectively dubbed the fragment's 101 associated data. ..." 102 103 New section added after section 3.2 104 105 "Facing Direction 106 107 A fragment derives its facing direction from the primitive that 108 generates the fragment. All fragments generated by primitves 109 other than polygons, triangles, or quadrilaterals are considered 110 to be front facing. For all other fragments the detemination is 111 made by examining the sign of the area computed by equation 2.7 112 of section 2.13.1 (including the possible reversal of this sign 113 as indicated by the last call to FrontFace). If the sign is 114 positive then the fragments are front facing; otherwise, they 115 are back facing." 116 117Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment Operations) 118 119 Section 4.1.4 120 121 Change the first paragraph of section 4.1.4 to read: 122 123 "The stencil test conditionally discards a fragment based on a 124 comparison between the value in the stencil buffer at location 125 ( xw, yw) and a reference value. The test is controlled with 126 127 void StencilFunc( enum func, int ref, uint mask); 128 void StencilFuncSeparateATI( enum frontfunc, enum backfunc, 129 int ref, uint mask); 130 void StencilOp( enum sfail, enum dpfail, enum dppass); 131 void StencilOpSeparateATI( enum face, enum sfail, enum dpfail, 132 enum dppass); 133 134 The test is enabled or disabled with the Enable and Disable 135 commands, using the symbolic constant STENCIL_TEST. When disabled, 136 the stencil test and the associated modifications are not made, 137 and the fragment is always passed. Additionally, the stencil test 138 may treat front and back faces separately. The function 139 StencilFuncSeparateATI sets each independently, while the function 140 Stencil func sets both front and back to the same test." 141 142 Change the third paragraph of section 4.1.4 to read: 143 144 "StencilOp and StencilOpSeparateATI take three arguments that indicate 145 what happens to the stored stencil value if this or certain 146 subsequent tests fail or pass. StencilOp sets the ops for both front 147 and back facing fragments, while StencilOpSeparateATI sets the ops for 148 front facing, back facing, or both types of fragments based on the face 149 parameter. ..." 150 151Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) 152 153 None 154 155Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and State Requests) 156 157 Additions to Table 6.15 Pixel Operations 158 159 Initial 160 Get Value Type Get Cmnd Value Description Sec. Attribute 161 ---------- ------ --------- --------- ------------ ----- ------------- 162 STENCIL_BACK_FUNC_ATI Z8 GetIntegerv ALWAYS 4.1.4 Stencil-buffer 163 STENCIL_BACK_FAIL_ATI Z6 GetIntegerv KEEP 4.1.4 Stencil-buffer 164 STENCIL_BACK_PASS_DEPTH_FAIL_ATI Z6 GetIntegerv KEEP 4.1.4 Stencil-buffer 165 STENCIL_BACK_PASS_DEPTH_PASS_ATI Z6 GetIntegerv KEEP 4.1.4 Stencil-buffer 166 STENCIL_OP_SEPARATE_FACE_ATI B IsEnabled FALSE 4.1.4 Stencil-buffer 167 168 169