1Name
2
3    EXT_shadow_funcs
4
5Name Strings
6
7    GL_EXT_shadow_funcs
8
9Contact
10
11    Mark J. Kilgard (mjk 'at' nvidia.com)
12
13Status
14
15    Complete
16
17Version
18
19    Last Modified Date:  $Date: 2002/03/22 $
20    NVIDIA Revision:  $Revision: #5 $
21
22Number
23
24    267
25
26Dependencies
27
28    OpenGL 1.1 is required.
29    ARB_depth_texture is required.
30    ARB_shadow is required.
31    This extension is written against the OpenGL 1.3 Specification. 
32
33Overview
34
35    This extension generalizes the GL_ARB_shadow extension to support all
36    eight binary texture comparison functions rather than just GL_LEQUAL
37    and GL_GEQUAL.
38
39IP Status
40
41    None.
42
43Issues
44
45    (1) What should this extension be called?
46
47      RESOLUTION: EXT_shadow_funcs.  The extension adds new texture
48      compare (shadow) comparison functions to ARB_shadow.
49
50    (2) Are there issues with GL_EQUAL and GL_NOTEQUAL?
51
52      The GL_EQUAL mode (and GL_NOTEQUAL) may be difficult to obtain
53      well-defined behavior from. This is because there is no guarantee
54      that the divide done by the shadow mapping r/q division is going
55      to exactly match the z/w perspective divide and depth range scale
56      & bias used to generate depth values.  Perhaps it can work in a
57      well-defined manner in orthographic views or if you can guarantee
58      that the texture hardware's r/q is computed with the same hardware
59      used to compute z/w (NVIDIA's NV_texture_shader extension can
60      provide such a guarantee).
61
62      Similiarly, GL_LESS and GL_GREATER or only different from GL_LEQUAL
63      and GL_GEQUAL respectively by a single unit of depth precision
64      which may make the difference between these modes very subtle.
65
66New Procedures and Functions
67
68    None
69
70New Tokens
71
72    None
73
74Additions to Chapter 2 of the 1.3 Specification (OpenGL Operation)
75
76    None
77
78Additions to Chapter 3 of the 1.3 Specification (Rasterization)
79
80    Section 3.8.4, Texture Parameters, p. 133, update table 3.19 with the
81    following new legal values for TEXTURE_COMPARE_FUNC_ARB:
82
83        Name                        Type  Legal Values
84        --------------------------  ----  -------------------------------
85        TEXTURE_COMPARE_FUNC_ARB    enum  LEQUAL, GEQUAL, LESS, GREATER,
86                                          EQUAL, NOTEQUAL, ALWAYS, NEVER
87
88    After section 3.8.12, Texture Environments and Texture Functions,
89    p. 149, update the texture compare pseudo-code in section 3.8.13.1
90    (as added by ARB_shadow):
91
92        if TEXTURE_COMPARE_MODE_ARB = NONE
93
94            r = Dt
95
96        else if TEXTURE_COMPARE_MODE_ARB = COMPARE_R_TO_TEXTURE_ARB
97
98            if TEXTURE_COMPARE_FUNC_ARB = LEQUAL
99
100                 { 1.0,  if R <= Dt
101             r = {
102                 { 0.0,  if R > Dt
103    
104            else if TEXTURE_COMPARE_FUNC_ARB = GEQUAL
105    
106                 { 1.0,  if R >= Dt
107             r = {
108                 { 0.0,  if R < Dt
109    
110            else if TEXTURE_COMPARE_FUNC_ARB = LESS
111    
112                 { 1.0,  if R < Dt
113             r = {
114                 { 0.0,  if R >= Dt
115    
116            else if TEXTURE_COMPARE_FUNC_ARB = GREATER
117    
118                 { 1.0,  if R > Dt
119             r = {
120                 { 0.0,  if R <= Dt
121    
122            else if TEXTURE_COMPARE_FUNC_ARB = EQUAL
123    
124                 { 1.0,  if R == Dt
125             r = {
126                 { 0.0,  if R != Dt
127    
128            else if TEXTURE_COMPARE_FUNC_ARB = NOTEQUAL
129    
130                 { 1.0,  if R != Dt
131             r = {
132                 { 0.0,  if R == Dt
133    
134            else if TEXTURE_COMPARE_FUNC_ARB = ALWAYS
135    
136             r = 1.0
137    
138            else if TEXTURE_COMPARE_FUNC_ARB = NEVER
139    
140             r = 0.0
141
142            endif
143
144            if DEPTH_TEXTURE_MODE_ARB = LUMINANCE
145    
146                Lt = r
147    
148            else if DEPTH_TEXTURE_MODE_ARB = INTENSITY
149    
150                It = r
151    
152            else if DEPTH_TEXTURE_MODE_ARB = ALPHA
153    
154                At = r
155    
156            endif
157
158        endif
159
160Additions to Chapter 4 of the 1.3 Specification (Per-Fragment Operations
161and the Frame Buffer)
162
163    None
164
165Additions to Chapter 5 of the 1.3 Specification (Special Functions)
166
167    None
168
169Additions to Chapter 6 of the 1.3 Specification (State and State Requests)
170
171    None
172
173Additions to the GLX Specification
174
175    None
176
177Errors
178
179    INVALID_ENUM is generated if TexParameter[if][v] parameter <pname>
180    is TEXTURE_COMPARE_FUNC_ARB and parameter <param> is not one of
181    LEQUAL, GEQUAL, LESS, GREATER, EQUAL, NOTEQUAL, ALWAYS, or NEVER.
182
183New State
184
185    In table 6.16, Texture Objects, p. 224, add the following:
186
187    Get Value                   Type  Get Command           Initial Value  Description     Sec.   Attribute
188    --------------------------  ----  --------------------  -------------  --------------  -----  ---------
189    TEXTURE_COMPARE_FUNC_ARB    Z_8   GetTexParameter[if]v  LEQUAL         compare func    3.8.13 texture
190
191New Implementation Dependent State
192
193    None
194
195Revision History
196
197    None
198
199NV20 Implementation Details
200
201    NV20 (GeForce3 and Quadro DCC) will fallback to software rasterization
202    if two or more texture units have distinct TEXTURE_COMPARE_FUNC_ARB
203    settings that are not opposites (eg, GL_EQUAL and GL_NOTEQUAL).
204    This is not an issue on NV25 (GeForce4 and Quadro4).
205