• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    NV_render_depth_texture
4
5Name Strings
6
7    WGL_NV_render_depth_texture
8
9Contact
10
11    Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com)
12
13Notice
14
15    Copyright NVIDIA Corporation, 2001, 2002.
16
17Status
18
19    Shipping, March 2002.
20
21Version
22
23    Last Modified Date:  2003/01/08
24    NVIDIA Revision:     1
25
26Number
27
28    263
29
30Dependencies
31
32    OpenGL 1.1 is required.
33
34    ARB_render_texture is required.
35
36    SGIX_depth_texture is required.
37
38    NV_render_texture_rectangle affects the definition of this extension.
39
40Overview
41
42    This extension allows a depth buffer to be used for both rendering and
43    texturing.  It is built upon the ARB_render_texture extension; the only
44    addition in this extension is the ability to use a depth buffer as a
45    DEPTH_COMPONENT texture map.
46
47Issues
48
49    In the ARB_render_texture spec, the number and size of physical depth
50    buffers in a rendered texture is left undefined.  From the
51    ARB_render_texture specification:
52
53        The contents of the depth and stencil buffers may not be preserved
54        when rendering a texture to the pbuffer and switching which image
55        of the texture is rendered to (e.g., switching from rendering one
56        mipmap level to rendering another).
57
58    That behavior is clearly unacceptable in an implementation where the
59    rendered texture IS the depth buffer.
60
61      RESOLVED:  Yes, it needs to be fixed.  This extension specifies that
62      each mipmap level and cube map face gets its own depth buffer, whose
63      contents are preserved when switching render targets.
64
65    Should there be separate pixel format attributes for BIND_TO_TEXTURE_DEPTH
66    and BIND_TO_TEXTURE_RECTANGLE_DEPTH?  Or is a single attribute sufficient?
67
68      RESOLVED:  We should support separate capabilities, as done with the
69      other formats.  See the NV_render_texture_rectangle spec for more info.
70
71    Should it be possible to have a single pbuffer support binding both color
72    and depth buffers to textures?
73
74      RESOLVED:  Yes.  This means that we must provide a separate
75      DEPTH_TEXTURE_FORMAT attribute that must be set at pbuffer creation
76      time, since using only the TEXTURE_FORMAT attribute would allow you to
77      create a pbuffer supporting either color or depth textures, but not
78      both.
79
80    For double-buffered or stereo pixel formats that support binding to depth
81    textures, how many depth buffers do you have?
82
83      RESOLVED:  There is only a single depth buffer for double-buffered or
84      stereo pixel formats.  Double buffering refers only to the number of
85      color buffers.  There will be multiple depth buffers only if the pbuffer
86      is specified to support mipmaps or cube maps.
87
88    What happens with multisample pixel formats, where the only depth buffer
89    contains multiple samples per pixel?  This issue is slightly different for
90    rendered depth textures, since multisample pixel formats do contain
91    "normal" color buffers in addition to the multisample buffer.
92
93      UNRESOLVED.
94
95New Procedures and Functions
96
97    None.
98
99New Tokens
100
101    Accepted by the <piAttributes> parameter of wglGetPixelFormatAttribivARB,
102    wglGetPixelFormatAttribfvARB, and the <piAttribIList> and <pfAttribIList>
103    parameters of wglChoosePixelFormatARB:
104
105        WGL_BIND_TO_TEXTURE_DEPTH_NV                    0x20A3
106        WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV          0x20A4
107
108    Accepted by the <piAttribList> parameter of wglCreatePbufferARB and
109    by the <iAttribute> parameter of wglQueryPbufferARB:
110
111        WGL_DEPTH_TEXTURE_FORMAT_NV                     0x20A5
112
113    Accepted as a value in the <piAttribList> parameter of wglCreatePbufferARB
114    and returned in the value parameter of wglQueryPbufferARB when
115    <iAttribute> is WGL_DEPTH_TEXTURE_FORMAT_NV:
116
117        WGL_TEXTURE_DEPTH_COMPONENT_NV                  0x20A6
118        WGL_NO_TEXTURE_ARB                              0x2077
119
120    Accepted by the <iBuffer> parameter of wglBindTexImageARB:
121
122        WGL_DEPTH_COMPONENT_NV                          0x20A7
123
124Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
125
126    None.
127
128Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
129
130    None.
131
132Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
133Operations and the Frame Buffer)
134
135    None.
136
137Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
138
139    None.
140
141Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and State
142Requests)
143
144    None.
145
146Additions to the WGL Specification
147
148    First, close your eyes and pretend that a WGL specification actually
149    existed.  Maybe if we all concentrate hard enough, one will magically
150    appear.
151
152
153    (Add to the description of <piAttributes> in wglGetPixelFormatAttribivARB
154    and <pfAttributes> in wglGetPixelFormatfv:)
155
156        WGL_BIND_TO_TEXTURE_DEPTH_NV
157        WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV
158
159        True if the depth buffer can be bound to a DEPTH_COMPONENT texture or
160        texture rectangle.  Currently only pbuffers can be bound as textures
161        so this attribute will only be TRUE if WGL_DRAW_TO_PBUFFER is also
162        TRUE.
163
164
165    (Add new table entries to match criteria in description of
166    wglChoosePixelFormatARB:)
167
168        Attribute                               Type     Match Criteria
169
170        WGL_BIND_TO_TEXTURE_DEPTH_NV            boolean      exact
171        WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV  boolean      exact
172
173
174    (In the wglCreatePbufferARB section, modify the attribute list)
175
176        WGL_TEXTURE_FORMAT_ARB
177
178        This attribute indicates the base internal format of the texture that
179        will be created when a color buffer of a pbuffer is bound to a texture
180        map.  It can be set to WGL_TEXTURE_RGB_ARB (indicating an internal
181        format of RGB), WGL_TEXTURE_RGBA_ARB (indicating a base internal
182        format of RGBA), or WGL_NO_TEXTURE_ARB. The default value is
183        WGL_NO_TEXTURE_ARB.
184
185        WGL_DEPTH_TEXTURE_FORMAT_NV
186
187        This attribute indicates the base internal format of the texture that
188        will be created when the depth buffer of a pbuffer is bound to a
189        texture map.  It can be set to WGL_TEXTURE_DEPTH_COMPONENT_NV
190        (indicating an internal format of DEPTH_COMPONENT), or
191        WGL_NO_TEXTURE_ARB. The default value is WGL_NO_TEXTURE_ARB.
192
193    (In the wglCreatePbufferARB section, modify the discussion of what happens
194    to the depth/stencil/accum buffers when switching between mipmap levels or
195    cube map faces.)
196
197    For pbuffers with a texture format of WGL_TEXTURE_RGB_ARB or
198    WGL_TEXTURE_RGBA_ARB, there will be a separate set of color buffers for
199    each mipmap level and cube map face in the pbuffer.  Otherwise, the WGL
200    implementation is free to share a single set of color, auxillary, and
201    accumulation buffers between levels or faces.
202
203    For pbuffers with a depth texture format of
204    WGL_TEXTURE_DEPTH_COMPONENT_NV, there will be a separate depth buffer for
205    each mipmap level and cube map face.  Otherwise, the WGL implementation is
206    free to share a single depth buffer between levels or faces.
207
208    The contents of any color or depth buffer that may be shared between faces
209    are undefined after switching between mipmap levels or cube map faces.
210
211    (In the wglCreatePbufferARB section, add to the error list)
212
213        ERROR_INVALID_DATA     WGL_DEPTH_TEXTURE_FORMAT_NV is
214                               WGL_TEXTURE_DEPTH_COMPONENT_NV,
215                               WGL_TEXTURE_TARGET_ARB is
216                               WGL_TEXTURE_RECTANGLE_NV, and the
217                               WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV
218                               attribute is not set in the pixel format.
219
220        ERROR_INVALID_DATA     WGL_DEPTH_TEXTURE_FORMAT_NV is
221                               WGL_TEXTURE_DEPTH_COMPONENT_NV,
222                               WGL_TEXTURE_TARGET_ARB is not
223                               WGL_TEXTURE_RECTANGLE_NV, and the
224                               WGL_BIND_TO_TEXTURE_DEPTH_NV attribute is not
225                               set in the pixel format.
226
227   (In the wglCreatePbufferARB section, modify the error list, replacing the
228    errors concerning texture format/target combinations with the following.)
229
230        ERROR_INVALID_DATA     WGL_TEXTURE_TARGET_ARB is WGL_NO_TEXTURE_ARB
231                               and either WGL_TEXTURE_FORMAT_ARB or
232                               WGL_DEPTH_TEXTURE_FORMAT_NV is not
233                               WGL_NO_TEXTURE_ARB.
234
235        ERROR_INVALID_DATA     WGL_TEXTURE_TARGET_ARB is not
236                               WGL_NO_TEXTURE_ARB and both
237                               WGL_TEXTURE_FORMAT_ARB and
238                               WGL_DEPTH_TEXTURE_FORMAT_NV are
239                               WGL_NO_TEXTURE_ARB.
240
241    Modify wglDestroyPbufferARB:
242
243        A pbuffer is destroyed by calling
244
245        BOOL wglDestroyPbufferARB(HPBUFFERARB hPbuffer);
246
247        The pbuffer is destroyed once it is no longer current to any rendering
248        context and once all color and depth buffers that are bound to a
249        texture object have been released.  When a pbuffer is destroyed, any
250        memory resources that are attached to it are freed and its handle is
251        no longer valid.
252
253        ....
254
255    Modify wglBindTexImageARB:
256
257    ...
258
259        The pbuffer attribute WGL_DEPTH_TEXTURE_FORMAT_NV determines the base
260        internal format of the depth texture. The format-specific component
261        sizes are also determined by pbuffer attributes as shown in the table
262        below.  The component sizes are dependent on the format of the
263        texture.
264
265        Texture Component           Size                 Format
266
267            D                   WGL_DEPTH_BITS_ARB       DEPTH_COMPONENT
268
269
270        Table x.x: Size of texture components
271
272        ...
273
274        The possible values for <iBuffer> are WGL_FRONT_LEFT_ARB,
275        WGL_FRONT_RIGHT_ARB, WGL_BACK_LEFT_ARB, WGL_BACK_RIGHT_ARB,
276        WGL_DEPTH_COMPONENT_NV, and WGL_AUX0_ARB through WGL_AUXn_ARB.
277
278        ...
279
280
281    (Modify paragraphs in wglBindTexImageARB section to include language about
282     allowing depth buffers)
283
284    Note that the color or depth buffer is bound to a texture object.  If the
285    texture object is shared between contexts, then the color or depth buffers
286    are also shared.  If a texture object is deleted before
287    wglReleaseTexImageARB is called, then the color buffer is released and the
288    pbuffer is made available for reading and writing.
289
290    It is not an error to call TexImage2D, TexImage1D, CopyTexImage1D or
291    CopyTexImage2D to replace an image of a texture object that has a color or
292    depth buffer bound to it. However, these calls will cause the color or
293    depth buffers to be released back to the pbuffer and new memory will be
294    allocated for the texture. Note that the color or depth buffer is released
295    even if the image that is being defined is a mipmap level that was not
296    defined by the color buffer.
297
298
299    (Modify wglReleaseTexImageARB section to include language allowing the
300    binding of depth buffers)
301
302    To release a color or depth buffer that is being used as a texture call
303
304        BOOL wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer)
305
306    This releases the specified color or depth buffer back to the pbuffer. The
307    pbuffer is made available for reading and writing when it no longer has
308    any color or depth buffers bound as textures.
309
310    <iBuffer> must be one of WGL_FRONT_LEFT_ARB, WGL_FRONT_RIGHT_ARB,
311    WGL_BACK_LEFT_ARB, WGL_BACK_RIGHT_ARB, WGL_DEPTH_COMPONENT_NV, or
312    WGL_AUX0_ARB through WGL_AUXn_ARB.
313
314    The contents of the color or depth buffer being released are undefined
315    when it is first released. In particular, there is no guarantee that the
316    texture image is still present. However, the contents of other color,
317    depth, stencil, or accumulation buffers are unaffected when the color or
318    depth buffer is released.
319
320    If the specified color or depth buffer is no longer bound to a texture
321    (e.g., because the texture object was deleted) then this call is a noop;
322    no error is generated.
323
324    After a color or depth buffer is released from a texture (either
325    explicitly by calling wglReleaseTexImageARB or implicitly by calling a
326    routine such as TexImage2D), all texture images that were defined by the
327    color buffer become NULL (it is as if TexImage was called with an image of
328    zero width).
329
330New State
331
332    None
333
334Dependencies on NV_render_texture_rectangle
335
336    If NV_render_texture_rectangle is not supported, all references to texture
337    rectangles and WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV should be deleted.
338
339Revision History
340
341    None
342