Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
57 | pj | 1 | /* $Id: swrast.h,v 1.1 2003-02-28 11:49:44 pj Exp $ */ |
2 | |||
3 | /* |
||
4 | * Mesa 3-D graphics library |
||
5 | * Version: 4.1 |
||
6 | * |
||
7 | * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
||
8 | * |
||
9 | * Permission is hereby granted, free of charge, to any person obtaining a |
||
10 | * copy of this software and associated documentation files (the "Software"), |
||
11 | * to deal in the Software without restriction, including without limitation |
||
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||
13 | * and/or sell copies of the Software, and to permit persons to whom the |
||
14 | * Software is furnished to do so, subject to the following conditions: |
||
15 | * |
||
16 | * The above copyright notice and this permission notice shall be included |
||
17 | * in all copies or substantial portions of the Software. |
||
18 | * |
||
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
||
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||
22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
||
23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||
24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
25 | * |
||
26 | */ |
||
27 | |||
28 | /** |
||
29 | * \file swrast/swrast.h |
||
30 | * \brief Defines basic structures for sw_rasterizer. |
||
31 | * \author Keith Whitwell <keith@tungstengraphics.com> |
||
32 | */ |
||
33 | |||
34 | #ifndef SWRAST_H |
||
35 | #define SWRAST_H |
||
36 | |||
37 | #include "mtypes.h" |
||
38 | |||
39 | /** |
||
40 | * \struct SWvertex |
||
41 | * \brief Data-structure to handle vertices in the software rasterizer. |
||
42 | * |
||
43 | * The software rasterizer now uses this format for vertices. Thus a |
||
44 | * 'RasterSetup' stage or other translation is required between the |
||
45 | * tnl module and the swrast rasterization functions. This serves to |
||
46 | * isolate the swrast module from the internals of the tnl module, and |
||
47 | * improve its usefulness as a fallback mechanism for hardware |
||
48 | * drivers. |
||
49 | * |
||
50 | * Full software drivers: |
||
51 | * - Register the rastersetup and triangle functions from |
||
52 | * utils/software_helper. |
||
53 | * - On statechange, update the rasterization pointers in that module. |
||
54 | * |
||
55 | * Rasterization hardware drivers: |
||
56 | * - Keep native rastersetup. |
||
57 | * - Implement native twoside,offset and unfilled triangle setup. |
||
58 | * - Implement a translator from native vertices to swrast vertices. |
||
59 | * - On partial fallback (mix of accelerated and unaccelerated |
||
60 | * prims), call a pass-through function which translates native |
||
61 | * vertices to SWvertices and calls the appropriate swrast function. |
||
62 | * - On total fallback (vertex format insufficient for state or all |
||
63 | * primitives unaccelerated), hook in swrast_setup instead. |
||
64 | */ |
||
65 | typedef struct { |
||
66 | /** win[0], win[1] are the screen-coords of SWvertex. win[2] is the |
||
67 | * z-coord. what is win[3]? */ |
||
68 | GLfloat win[4]; |
||
69 | GLfloat texcoord[MAX_TEXTURE_UNITS][4]; |
||
70 | GLchan color[4]; |
||
71 | GLchan specular[4]; |
||
72 | GLfloat fog; |
||
73 | GLuint index; |
||
74 | GLfloat pointSize; |
||
75 | } SWvertex; |
||
76 | |||
77 | |||
78 | /** |
||
79 | * \struct sw_span |
||
80 | * \brief Contains data for either a horizontal line or a set of |
||
81 | * pixels that are passed through a pipeline of functions before being |
||
82 | * drawn. |
||
83 | * |
||
84 | * The sw_span structure describes the colors, Z, fogcoord, texcoords, |
||
85 | * etc for either a horizontal run or a set of independent pixels. We |
||
86 | * can either specify a base/step to indicate interpolated values, or |
||
87 | * fill in arrays of values. The interpMask and arrayMask bitfields |
||
88 | * indicate which are active. |
||
89 | * |
||
90 | * With this structure it's easy to hand-off span rasterization to |
||
91 | * subroutines instead of doing it all inline in the triangle functions |
||
92 | * like we used to do. |
||
93 | * It also cleans up the local variable namespace a great deal. |
||
94 | * |
||
95 | * It would be interesting to experiment with multiprocessor rasterization |
||
96 | * with this structure. The triangle rasterizer could simply emit a |
||
97 | * stream of these structures which would be consumed by one or more |
||
98 | * span-processing threads which could run in parallel. |
||
99 | */ |
||
100 | |||
101 | |||
102 | /** |
||
103 | * \defgroup SpanFlags SPAN_XXX-flags |
||
104 | * Bitmasks to indicate which span_arrays need to be computed |
||
105 | * (sw_span::interpMask) or have already been filled |
||
106 | * (sw_span::arrayMask) |
||
107 | */ |
||
108 | /*@{*/ |
||
109 | #define SPAN_RGBA 0x001 |
||
110 | #define SPAN_SPEC 0x002 |
||
111 | #define SPAN_INDEX 0x004 |
||
112 | #define SPAN_Z 0x008 |
||
113 | #define SPAN_FOG 0x010 |
||
114 | #define SPAN_TEXTURE 0x020 |
||
115 | #define SPAN_INT_TEXTURE 0x040 |
||
116 | #define SPAN_LAMBDA 0x080 |
||
117 | #define SPAN_COVERAGE 0x100 |
||
118 | #define SPAN_FLAT 0x200 /**< flat shading? */ |
||
119 | /** sw_span::arrayMask only - for span_arrays::x, span_arrays::y */ |
||
120 | #define SPAN_XY 0x400 |
||
121 | #define SPAN_MASK 0x800 /**< sw_span::arrayMask only */ |
||
122 | /*@}*/ |
||
123 | |||
124 | |||
125 | /** |
||
126 | * \struct span_arrays |
||
127 | * \brief Arrays of fragment values. |
||
128 | * |
||
129 | * These will either be computed from the x/xStep values above or |
||
130 | * filled in by glDraw/CopyPixels, etc. |
||
131 | */ |
||
132 | struct span_arrays { |
||
133 | GLchan rgb[MAX_WIDTH][3]; |
||
134 | GLchan rgba[MAX_WIDTH][4]; |
||
135 | GLuint index[MAX_WIDTH]; |
||
136 | GLchan spec[MAX_WIDTH][4]; /* specular color */ |
||
137 | GLint x[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ |
||
138 | GLint y[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ |
||
139 | GLdepth z[MAX_WIDTH]; |
||
140 | GLfloat fog[MAX_WIDTH]; |
||
141 | GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4]; |
||
142 | GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH]; |
||
143 | GLfloat coverage[MAX_WIDTH]; |
||
144 | |||
145 | /** This mask indicates if fragment is alive or culled */ |
||
146 | GLubyte mask[MAX_WIDTH]; |
||
147 | }; |
||
148 | |||
149 | |||
150 | struct sw_span { |
||
151 | GLint x, y; |
||
152 | |||
153 | /** Only need to process pixels between start <= i < end */ |
||
154 | /** At this time, start is always zero. */ |
||
155 | GLuint start, end; |
||
156 | |||
157 | /** This flag indicates that mask[] array is effectively filled with ones */ |
||
158 | GLboolean writeAll; |
||
159 | |||
160 | /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */ |
||
161 | GLenum primitive; |
||
162 | |||
163 | /** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */ |
||
164 | GLuint facing; |
||
165 | |||
166 | /** |
||
167 | * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates |
||
168 | * which of the x/xStep variables are relevant. |
||
169 | */ |
||
170 | GLuint interpMask; |
||
171 | |||
172 | #if CHAN_TYPE == GL_FLOAT |
||
173 | GLfloat red, redStep; |
||
174 | GLfloat green, greenStep; |
||
175 | GLfloat blue, blueStep; |
||
176 | GLfloat alpha, alphaStep; |
||
177 | GLfloat specRed, specRedStep; |
||
178 | GLfloat specGreen, specGreenStep; |
||
179 | GLfloat specBlue, specBlueStep; |
||
180 | #else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED SHORT */ |
||
181 | GLfixed red, redStep; |
||
182 | GLfixed green, greenStep; |
||
183 | GLfixed blue, blueStep; |
||
184 | GLfixed alpha, alphaStep; |
||
185 | GLfixed specRed, specRedStep; |
||
186 | GLfixed specGreen, specGreenStep; |
||
187 | GLfixed specBlue, specBlueStep; |
||
188 | #endif |
||
189 | GLfixed index, indexStep; |
||
190 | GLfixed z, zStep; |
||
191 | GLfloat fog, fogStep; |
||
192 | GLfloat tex[MAX_TEXTURE_UNITS][4]; |
||
193 | GLfloat texStepX[MAX_TEXTURE_UNITS][4]; |
||
194 | GLfloat texStepY[MAX_TEXTURE_UNITS][4]; |
||
195 | GLfixed intTex[2], intTexStep[2]; |
||
196 | |||
197 | /** |
||
198 | * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates |
||
199 | * which of the fragment arrays in the span_arrays struct are relevant. |
||
200 | */ |
||
201 | GLuint arrayMask; |
||
202 | |||
203 | /** |
||
204 | * We store the arrays of fragment values in a separate struct so |
||
205 | * that we can allocate sw_span structs on the stack without using |
||
206 | * a lot of memory. The span_arrays struct is about 400KB while the |
||
207 | * sw_span struct is only about 512 bytes. |
||
208 | */ |
||
209 | struct span_arrays *array; |
||
210 | }; |
||
211 | |||
212 | |||
213 | #define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \ |
||
214 | do { \ |
||
215 | (S).primitive = (PRIMITIVE); \ |
||
216 | (S).interpMask = (INTERP_MASK); \ |
||
217 | (S).arrayMask = (ARRAY_MASK); \ |
||
218 | (S).start = 0; \ |
||
219 | (S).end = (END); \ |
||
220 | (S).facing = 0; \ |
||
221 | (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \ |
||
222 | } while (0) |
||
223 | |||
224 | |||
225 | |||
226 | struct swrast_device_driver; |
||
227 | |||
228 | |||
229 | /* These are the public-access functions exported from swrast. |
||
230 | */ |
||
231 | extern void |
||
232 | _swrast_alloc_buffers( GLframebuffer *buffer ); |
||
233 | |||
234 | extern void |
||
235 | _swrast_use_read_buffer( GLcontext *ctx ); |
||
236 | |||
237 | extern void |
||
238 | _swrast_use_draw_buffer( GLcontext *ctx ); |
||
239 | |||
240 | extern GLboolean |
||
241 | _swrast_CreateContext( GLcontext *ctx ); |
||
242 | |||
243 | extern void |
||
244 | _swrast_DestroyContext( GLcontext *ctx ); |
||
245 | |||
246 | /* Get a (non-const) reference to the device driver struct for swrast. |
||
247 | */ |
||
248 | extern struct swrast_device_driver * |
||
249 | _swrast_GetDeviceDriverReference( GLcontext *ctx ); |
||
250 | |||
251 | extern void |
||
252 | _swrast_Bitmap( GLcontext *ctx, |
||
253 | GLint px, GLint py, |
||
254 | GLsizei width, GLsizei height, |
||
255 | const struct gl_pixelstore_attrib *unpack, |
||
256 | const GLubyte *bitmap ); |
||
257 | |||
258 | extern void |
||
259 | _swrast_CopyPixels( GLcontext *ctx, |
||
260 | GLint srcx, GLint srcy, |
||
261 | GLint destx, GLint desty, |
||
262 | GLsizei width, GLsizei height, |
||
263 | GLenum type ); |
||
264 | |||
265 | extern void |
||
266 | _swrast_DrawPixels( GLcontext *ctx, |
||
267 | GLint x, GLint y, |
||
268 | GLsizei width, GLsizei height, |
||
269 | GLenum format, GLenum type, |
||
270 | const struct gl_pixelstore_attrib *unpack, |
||
271 | const GLvoid *pixels ); |
||
272 | |||
273 | extern void |
||
274 | _swrast_ReadPixels( GLcontext *ctx, |
||
275 | GLint x, GLint y, GLsizei width, GLsizei height, |
||
276 | GLenum format, GLenum type, |
||
277 | const struct gl_pixelstore_attrib *unpack, |
||
278 | GLvoid *pixels ); |
||
279 | |||
280 | extern void |
||
281 | _swrast_Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, |
||
282 | GLint x, GLint y, GLint width, GLint height ); |
||
283 | |||
284 | extern void |
||
285 | _swrast_Accum( GLcontext *ctx, GLenum op, |
||
286 | GLfloat value, GLint xpos, GLint ypos, |
||
287 | GLint width, GLint height ); |
||
288 | |||
289 | |||
290 | extern void |
||
291 | _swrast_DrawBuffer( GLcontext *ctx, GLenum mode ); |
||
292 | |||
293 | |||
294 | /* Reset the stipple counter |
||
295 | */ |
||
296 | extern void |
||
297 | _swrast_ResetLineStipple( GLcontext *ctx ); |
||
298 | |||
299 | /* These will always render the correct point/line/triangle for the |
||
300 | * current state. |
||
301 | * |
||
302 | * For flatshaded primitives, the provoking vertex is the final one. |
||
303 | */ |
||
304 | extern void |
||
305 | _swrast_Point( GLcontext *ctx, const SWvertex *v ); |
||
306 | |||
307 | extern void |
||
308 | _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ); |
||
309 | |||
310 | extern void |
||
311 | _swrast_Triangle( GLcontext *ctx, const SWvertex *v0, |
||
312 | const SWvertex *v1, const SWvertex *v2 ); |
||
313 | |||
314 | extern void |
||
315 | _swrast_Quad( GLcontext *ctx, |
||
316 | const SWvertex *v0, const SWvertex *v1, |
||
317 | const SWvertex *v2, const SWvertex *v3); |
||
318 | |||
319 | extern void |
||
320 | _swrast_flush( GLcontext *ctx ); |
||
321 | |||
322 | extern void |
||
323 | _swrast_render_primitive( GLcontext *ctx, GLenum mode ); |
||
324 | |||
325 | extern void |
||
326 | _swrast_render_start( GLcontext *ctx ); |
||
327 | |||
328 | extern void |
||
329 | _swrast_render_finish( GLcontext *ctx ); |
||
330 | |||
331 | /* Tell the software rasterizer about core state changes. |
||
332 | */ |
||
333 | extern void |
||
334 | _swrast_InvalidateState( GLcontext *ctx, GLuint new_state ); |
||
335 | |||
336 | /* Configure software rasterizer to match hardware rasterizer characteristics: |
||
337 | */ |
||
338 | extern void |
||
339 | _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ); |
||
340 | |||
341 | extern void |
||
342 | _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ); |
||
343 | |||
344 | /* Debug: |
||
345 | */ |
||
346 | extern void |
||
347 | _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); |
||
348 | |||
349 | |||
350 | /* |
||
351 | * Imaging fallbacks (a better solution should be found, perhaps |
||
352 | * moving all the imaging fallback code to a new module) |
||
353 | */ |
||
354 | extern void |
||
355 | _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, |
||
356 | GLenum internalFormat, |
||
357 | GLint x, GLint y, GLsizei width, |
||
358 | GLsizei height); |
||
359 | extern void |
||
360 | _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, |
||
361 | GLenum internalFormat, |
||
362 | GLint x, GLint y, GLsizei width); |
||
363 | extern void |
||
364 | _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, |
||
365 | GLint x, GLint y, GLsizei width); |
||
366 | extern void |
||
367 | _swrast_CopyColorTable( GLcontext *ctx, |
||
368 | GLenum target, GLenum internalformat, |
||
369 | GLint x, GLint y, GLsizei width); |
||
370 | |||
371 | |||
372 | /* |
||
373 | * Texture fallbacks, Brian Paul. Could also live in a new module |
||
374 | * with the rest of the texture store fallbacks? |
||
375 | */ |
||
376 | extern void |
||
377 | _swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level, |
||
378 | GLenum internalFormat, |
||
379 | GLint x, GLint y, GLsizei width, GLint border); |
||
380 | |||
381 | extern void |
||
382 | _swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level, |
||
383 | GLenum internalFormat, |
||
384 | GLint x, GLint y, GLsizei width, GLsizei height, |
||
385 | GLint border); |
||
386 | |||
387 | |||
388 | extern void |
||
389 | _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, |
||
390 | GLint xoffset, GLint x, GLint y, GLsizei width); |
||
391 | |||
392 | extern void |
||
393 | _swrast_copy_texsubimage2d(GLcontext *ctx, |
||
394 | GLenum target, GLint level, |
||
395 | GLint xoffset, GLint yoffset, |
||
396 | GLint x, GLint y, GLsizei width, GLsizei height); |
||
397 | |||
398 | extern void |
||
399 | _swrast_copy_texsubimage3d(GLcontext *ctx, |
||
400 | GLenum target, GLint level, |
||
401 | GLint xoffset, GLint yoffset, GLint zoffset, |
||
402 | GLint x, GLint y, GLsizei width, GLsizei height); |
||
403 | |||
404 | |||
405 | |||
406 | /* The driver interface for the software rasterizer. |
||
407 | * Unless otherwise noted, all functions are mandatory. |
||
408 | */ |
||
409 | struct swrast_device_driver { |
||
410 | |||
411 | void (*SetBuffer)( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit); |
||
412 | /* |
||
413 | * Specifies the current buffer for span/pixel writing/reading. |
||
414 | * buffer indicates which window to write to / read from. Normally, |
||
415 | * this'll be the buffer currently bound to the context, but it doesn't |
||
416 | * have to be! |
||
417 | * bufferBit indicates which color buffer, one of: |
||
418 | * FRONT_LEFT_BIT - this buffer always exists |
||
419 | * BACK_LEFT_BIT - when double buffering |
||
420 | * FRONT_RIGHT_BIT - when using stereo |
||
421 | * BACK_RIGHT_BIT - when using stereo and double buffering |
||
422 | * AUXn_BIT - if aux buffers are implemented |
||
423 | */ |
||
424 | |||
425 | |||
426 | /*** |
||
427 | *** Functions for synchronizing access to the framebuffer: |
||
428 | ***/ |
||
429 | |||
430 | void (*SpanRenderStart)(GLcontext *ctx); |
||
431 | void (*SpanRenderFinish)(GLcontext *ctx); |
||
432 | /* OPTIONAL. |
||
433 | * |
||
434 | * Called before and after all rendering operations, including DrawPixels, |
||
435 | * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. |
||
436 | * These are a suitable place for grabbing/releasing hardware locks. |
||
437 | * |
||
438 | * NOTE: The swrast triangle/line/point routines *DO NOT* call |
||
439 | * these functions. Locking in that case must be organized by the |
||
440 | * driver by other mechanisms. |
||
441 | */ |
||
442 | |||
443 | /*** |
||
444 | *** Functions for writing pixels to the frame buffer: |
||
445 | ***/ |
||
446 | |||
447 | void (*WriteRGBASpan)( const GLcontext *ctx, |
||
448 | GLuint n, GLint x, GLint y, |
||
449 | CONST GLchan rgba[][4], const GLubyte mask[] ); |
||
450 | void (*WriteRGBSpan)( const GLcontext *ctx, |
||
451 | GLuint n, GLint x, GLint y, |
||
452 | CONST GLchan rgb[][3], const GLubyte mask[] ); |
||
453 | /* Write a horizontal run of RGBA or RGB pixels. |
||
454 | * If mask is NULL, draw all pixels. |
||
455 | * If mask is not null, only draw pixel [i] when mask [i] is true. |
||
456 | */ |
||
457 | |||
458 | void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
459 | const GLchan color[4], const GLubyte mask[] ); |
||
460 | /* Write a horizontal run of RGBA pixels all with the same color. |
||
461 | */ |
||
462 | |||
463 | void (*WriteRGBAPixels)( const GLcontext *ctx, |
||
464 | GLuint n, const GLint x[], const GLint y[], |
||
465 | CONST GLchan rgba[][4], const GLubyte mask[] ); |
||
466 | /* Write array of RGBA pixels at random locations. |
||
467 | */ |
||
468 | |||
469 | void (*WriteMonoRGBAPixels)( const GLcontext *ctx, |
||
470 | GLuint n, const GLint x[], const GLint y[], |
||
471 | const GLchan color[4], const GLubyte mask[] ); |
||
472 | /* Write an array of mono-RGBA pixels at random locations. |
||
473 | */ |
||
474 | |||
475 | void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
476 | const GLuint index[], const GLubyte mask[] ); |
||
477 | void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
478 | const GLubyte index[], const GLubyte mask[] ); |
||
479 | /* Write a horizontal run of CI pixels. One function is for 32bpp |
||
480 | * indexes and the other for 8bpp pixels (the common case). You mus |
||
481 | * implement both for color index mode. |
||
482 | */ |
||
483 | |||
484 | void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
485 | GLuint colorIndex, const GLubyte mask[] ); |
||
486 | /* Write a horizontal run of color index pixels using the color index |
||
487 | * last specified by the Index() function. |
||
488 | */ |
||
489 | |||
490 | void (*WriteCI32Pixels)( const GLcontext *ctx, |
||
491 | GLuint n, const GLint x[], const GLint y[], |
||
492 | const GLuint index[], const GLubyte mask[] ); |
||
493 | /* |
||
494 | * Write a random array of CI pixels. |
||
495 | */ |
||
496 | |||
497 | void (*WriteMonoCIPixels)( const GLcontext *ctx, |
||
498 | GLuint n, const GLint x[], const GLint y[], |
||
499 | GLuint colorIndex, const GLubyte mask[] ); |
||
500 | /* Write a random array of color index pixels using the color index |
||
501 | * last specified by the Index() function. |
||
502 | */ |
||
503 | |||
504 | |||
505 | /*** |
||
506 | *** Functions to read pixels from frame buffer: |
||
507 | ***/ |
||
508 | |||
509 | void (*ReadCI32Span)( const GLcontext *ctx, |
||
510 | GLuint n, GLint x, GLint y, GLuint index[] ); |
||
511 | /* Read a horizontal run of color index pixels. |
||
512 | */ |
||
513 | |||
514 | void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
515 | GLchan rgba[][4] ); |
||
516 | /* Read a horizontal run of RGBA pixels. |
||
517 | */ |
||
518 | |||
519 | void (*ReadCI32Pixels)( const GLcontext *ctx, |
||
520 | GLuint n, const GLint x[], const GLint y[], |
||
521 | GLuint indx[], const GLubyte mask[] ); |
||
522 | /* Read a random array of CI pixels. |
||
523 | */ |
||
524 | |||
525 | void (*ReadRGBAPixels)( const GLcontext *ctx, |
||
526 | GLuint n, const GLint x[], const GLint y[], |
||
527 | GLchan rgba[][4], const GLubyte mask[] ); |
||
528 | /* Read a random array of RGBA pixels. |
||
529 | */ |
||
530 | |||
531 | |||
532 | |||
533 | /*** |
||
534 | *** For supporting hardware Z buffers: |
||
535 | *** Either ALL or NONE of these functions must be implemented! |
||
536 | *** NOTE that Each depth value is a 32-bit GLuint. If the depth |
||
537 | *** buffer is less than 32 bits deep then the extra upperbits are zero. |
||
538 | ***/ |
||
539 | |||
540 | void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
541 | const GLdepth depth[], const GLubyte mask[] ); |
||
542 | /* Write a horizontal span of values into the depth buffer. Only write |
||
543 | * depth[i] value if mask[i] is nonzero. |
||
544 | */ |
||
545 | |||
546 | void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
547 | GLdepth depth[] ); |
||
548 | /* Read a horizontal span of values from the depth buffer. |
||
549 | */ |
||
550 | |||
551 | |||
552 | void (*WriteDepthPixels)( GLcontext *ctx, GLuint n, |
||
553 | const GLint x[], const GLint y[], |
||
554 | const GLdepth depth[], const GLubyte mask[] ); |
||
555 | /* Write an array of randomly positioned depth values into the |
||
556 | * depth buffer. Only write depth[i] value if mask[i] is nonzero. |
||
557 | */ |
||
558 | |||
559 | void (*ReadDepthPixels)( GLcontext *ctx, GLuint n, |
||
560 | const GLint x[], const GLint y[], |
||
561 | GLdepth depth[] ); |
||
562 | /* Read an array of randomly positioned depth values from the depth buffer. |
||
563 | */ |
||
564 | |||
565 | |||
566 | |||
567 | /*** |
||
568 | *** For supporting hardware stencil buffers: |
||
569 | *** Either ALL or NONE of these functions must be implemented! |
||
570 | ***/ |
||
571 | |||
572 | void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
573 | const GLstencil stencil[], const GLubyte mask[] ); |
||
574 | /* Write a horizontal span of stencil values into the stencil buffer. |
||
575 | * If mask is NULL, write all stencil values. |
||
576 | * Else, only write stencil[i] if mask[i] is non-zero. |
||
577 | */ |
||
578 | |||
579 | void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, |
||
580 | GLstencil stencil[] ); |
||
581 | /* Read a horizontal span of stencil values from the stencil buffer. |
||
582 | */ |
||
583 | |||
584 | void (*WriteStencilPixels)( GLcontext *ctx, GLuint n, |
||
585 | const GLint x[], const GLint y[], |
||
586 | const GLstencil stencil[], |
||
587 | const GLubyte mask[] ); |
||
588 | /* Write an array of stencil values into the stencil buffer. |
||
589 | * If mask is NULL, write all stencil values. |
||
590 | * Else, only write stencil[i] if mask[i] is non-zero. |
||
591 | */ |
||
592 | |||
593 | void (*ReadStencilPixels)( GLcontext *ctx, GLuint n, |
||
594 | const GLint x[], const GLint y[], |
||
595 | GLstencil stencil[] ); |
||
596 | /* Read an array of stencil values from the stencil buffer. |
||
597 | */ |
||
598 | }; |
||
599 | |||
600 | |||
601 | |||
602 | #endif |