Replace the flags Mesa was using for ctx->NewState with a new set
[mesa.git] / src / mesa / drivers / glide / fxdd.c
1 /* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
7 * Copyright (C) 1999-2000 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 * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
28 * terms stated above.
29 *
30 * Thank you for your contribution, David!
31 *
32 * Please make note of the above copyright/license statement. If you
33 * contributed code or bug fixes to this code under the previous (GNU
34 * Library) license and object to the new license, your code will be
35 * removed at your request. Please see the Mesa docs/COPYRIGHT file
36 * for more information.
37 *
38 * Additional Mesa/3Dfx driver developers:
39 * Daryll Strauss <daryll@precisioninsight.com>
40 * Keith Whitwell <keith@precisioninsight.com>
41 *
42 * See fxapi.h for more revision/author details.
43 */
44
45
46 /* fxdd.c - 3Dfx VooDoo Mesa device driver functions */
47
48
49 #ifdef HAVE_CONFIG_H
50 #include "conf.h"
51 #endif
52
53 #if defined(FX)
54
55 #include "image.h"
56 #include "types.h"
57 #include "fxdrv.h"
58 #include "enums.h"
59 #include "extensions.h"
60 #include "pb.h"
61
62 /* These lookup table are used to extract RGB values in [0,255] from
63 * 16-bit pixel values.
64 */
65 GLubyte FX_PixelToR[0x10000];
66 GLubyte FX_PixelToG[0x10000];
67 GLubyte FX_PixelToB[0x10000];
68
69
70 /*
71 * Initialize the FX_PixelTo{RGB} arrays.
72 * Input: bgrOrder - if TRUE, pixels are in BGR order, else RGB order.
73 */
74 void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
75 {
76 GLuint pixel;
77
78 fxMesa->bgrOrder=bgrOrder;
79 for (pixel = 0; pixel <= 0xffff; pixel++) {
80 GLuint r, g, b;
81 if (bgrOrder) {
82 r = (pixel & 0x001F) << 3;
83 g = (pixel & 0x07E0) >> 3;
84 b = (pixel & 0xF800) >> 8;
85 }
86 else {
87 r = (pixel & 0xF800) >> 8;
88 g = (pixel & 0x07E0) >> 3;
89 b = (pixel & 0x001F) << 3;
90 }
91 r = r * 255 / 0xF8; /* fill in low-order bits */
92 g = g * 255 / 0xFC;
93 b = b * 255 / 0xF8;
94 FX_PixelToR[pixel] = r;
95 FX_PixelToG[pixel] = g;
96 FX_PixelToB[pixel] = b;
97 }
98 }
99
100
101 /**********************************************************************/
102 /***** Miscellaneous functions *****/
103 /**********************************************************************/
104
105 /* Return buffer size information */
106 static void fxDDBufferSize(GLcontext *ctx, GLuint *width, GLuint *height)
107 {
108 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
109
110 if (MESA_VERBOSE&VERBOSE_DRIVER) {
111 fprintf(stderr,"fxmesa: fxDDBufferSize(...) Start\n");
112 }
113
114 *width=fxMesa->width;
115 *height=fxMesa->height;
116
117 if (MESA_VERBOSE&VERBOSE_DRIVER) {
118 fprintf(stderr,"fxmesa: fxDDBufferSize(...) End\n");
119 }
120 }
121
122
123 /* Set current drawing color */
124 static void fxDDSetColor(GLcontext *ctx, GLubyte red, GLubyte green,
125 GLubyte blue, GLubyte alpha )
126 {
127 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
128 GLubyte col[4];
129 ASSIGN_4V( col, red, green, blue, alpha );
130
131 if (MESA_VERBOSE&VERBOSE_DRIVER) {
132 fprintf(stderr,"fxmesa: fxDDSetColor(%d,%d,%d,%d)\n",red,green,blue,alpha);
133 }
134
135 fxMesa->color=FXCOLOR4(col);
136 }
137
138
139 /* Implements glClearColor() */
140 static void fxDDClearColor(GLcontext *ctx, GLubyte red, GLubyte green,
141 GLubyte blue, GLubyte alpha )
142 {
143 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
144 GLubyte col[4];
145
146
147
148 ASSIGN_4V( col, red, green, blue, 255 );
149
150 if (MESA_VERBOSE&VERBOSE_DRIVER) {
151 fprintf(stderr,"fxmesa: fxDDClearColor(%d,%d,%d,%d)\n",red,green,blue,alpha);
152 }
153
154 fxMesa->clearC=FXCOLOR4( col );
155 fxMesa->clearA=alpha;
156 }
157
158
159 /* Clear the color and/or depth buffers */
160 static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
161 GLint x, GLint y, GLint width, GLint height )
162 {
163 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
164 const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
165 const FxU16 clearD = (FxU16) (ctx->Depth.Clear * 0xffff);
166 GLbitfield softwareMask = mask & (DD_STENCIL_BIT | DD_ACCUM_BIT);
167
168 /* we can't clear stencil or accum buffers */
169 mask &= ~(DD_STENCIL_BIT | DD_ACCUM_BIT);
170
171 if (MESA_VERBOSE & VERBOSE_DRIVER) {
172 fprintf(stderr,"fxmesa: fxDDClear(%d,%d,%d,%d)\n", (int) x, (int) y,
173 (int) width, (int) height);
174 }
175
176 if (colorMask != 0xffffffff) {
177 /* do masked color buffer clears in software */
178 softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
179 mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
180 }
181
182 /*
183 * This could probably be done fancier but doing each possible case
184 * explicitly is less error prone.
185 */
186 switch (mask) {
187 case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
188 /* back buffer & depth */
189 FX_grDepthMask(FXTRUE);
190 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
191 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
192 if (!ctx->Depth.Mask) {
193 FX_grDepthMask(FXFALSE);
194 }
195 break;
196 case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
197 /* XXX it appears that the depth buffer isn't cleared when
198 * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
199 * This is a work-around/
200 */
201 /* clear depth */
202 FX_grDepthMask(FXTRUE);
203 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
204 FX_grColorMask(FXFALSE,FXFALSE);
205 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
206 /* clear front */
207 FX_grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
208 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
209 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
210 break;
211 case DD_BACK_LEFT_BIT:
212 /* back buffer only */
213 FX_grDepthMask(FXFALSE);
214 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
215 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
216 if (ctx->Depth.Mask) {
217 FX_grDepthMask(FXTRUE);
218 }
219 break;
220 case DD_FRONT_LEFT_BIT:
221 /* front buffer only */
222 FX_grDepthMask(FXFALSE);
223 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
224 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
225 if (ctx->Depth.Mask) {
226 FX_grDepthMask(FXTRUE);
227 }
228 break;
229 case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
230 /* front and back */
231 FX_grDepthMask(FXFALSE);
232 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
233 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
234 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
235 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
236 if (ctx->Depth.Mask) {
237 FX_grDepthMask(FXTRUE);
238 }
239 break;
240 case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
241 /* clear front */
242 FX_grDepthMask(FXFALSE);
243 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
244 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
245 /* clear back and depth */
246 FX_grDepthMask(FXTRUE);
247 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
248 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
249 if (!ctx->Depth.Mask) {
250 FX_grDepthMask(FXFALSE);
251 }
252 break;
253 case DD_DEPTH_BIT:
254 /* just the depth buffer */
255 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
256 FX_grColorMask(FXFALSE,FXFALSE);
257 FX_grDepthMask(FXTRUE);
258 FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
259 FX_grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
260 if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT)
261 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
262 if (!ctx->Depth.Test || !ctx->Depth.Mask)
263 FX_grDepthMask(FXFALSE);
264 break;
265 default:
266 /* error */
267 ;
268 }
269
270 return softwareMask;
271 }
272
273
274 /* Set the buffer used for drawing */
275 /* XXX support for separate read/draw buffers hasn't been tested */
276 static GLboolean fxDDSetDrawBuffer(GLcontext *ctx, GLenum mode)
277 {
278 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
279
280 if (MESA_VERBOSE&VERBOSE_DRIVER) {
281 fprintf(stderr,"fxmesa: fxDDSetBuffer(%x)\n", (int) mode);
282 }
283
284 if (mode == GL_FRONT_LEFT) {
285 fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
286 FX_grRenderBuffer(fxMesa->currentFB);
287 return GL_TRUE;
288 }
289 else if (mode == GL_BACK_LEFT) {
290 fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
291 FX_grRenderBuffer(fxMesa->currentFB);
292 return GL_TRUE;
293 }
294 else if (mode == GL_NONE) {
295 FX_grColorMask(FXFALSE,FXFALSE);
296 return GL_TRUE;
297 }
298 else {
299 return GL_FALSE;
300 }
301 }
302
303
304 /* Set the buffer used for reading */
305 /* XXX support for separate read/draw buffers hasn't been tested */
306 static void fxDDSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer,
307 GLenum mode )
308 {
309 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
310 (void) buffer;
311
312 if (MESA_VERBOSE&VERBOSE_DRIVER) {
313 fprintf(stderr,"fxmesa: fxDDSetBuffer(%x)\n", (int) mode);
314 }
315
316 if (mode == GL_FRONT_LEFT) {
317 fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
318 FX_grRenderBuffer(fxMesa->currentFB);
319 }
320 else if (mode == GL_BACK_LEFT) {
321 fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
322 FX_grRenderBuffer(fxMesa->currentFB);
323 }
324 }
325
326
327 #ifdef XF86DRI
328 /* test if window coord (px,py) is visible */
329 static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py)
330 {
331 int i;
332 for (i=0; i<fxMesa->numClipRects; i++) {
333 if ((px>=fxMesa->pClipRects[i].x1) &&
334 (px<fxMesa->pClipRects[i].x2) &&
335 (py>=fxMesa->pClipRects[i].y1) &&
336 (py<fxMesa->pClipRects[i].y2)) return GL_TRUE;
337 }
338 return GL_FALSE;
339 }
340 #endif
341
342
343 static GLboolean fxDDDrawBitmap(GLcontext *ctx, GLint px, GLint py,
344 GLsizei width, GLsizei height,
345 const struct gl_pixelstore_attrib *unpack,
346 const GLubyte *bitmap)
347 {
348 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
349 GrLfbInfo_t info;
350 FxU16 color;
351 const struct gl_pixelstore_attrib *finalUnpack;
352 struct gl_pixelstore_attrib scissoredUnpack;
353
354 /* check if there's any raster operations enabled which we can't handle */
355 if (ctx->RasterMask & (ALPHATEST_BIT |
356 BLEND_BIT |
357 DEPTH_BIT |
358 FOG_BIT |
359 LOGIC_OP_BIT |
360 SCISSOR_BIT |
361 STENCIL_BIT |
362 MASKING_BIT |
363 ALPHABUF_BIT |
364 MULTI_DRAW_BIT))
365 return GL_FALSE;
366
367 if (ctx->Scissor.Enabled) {
368 /* This is a bit tricky, but by carefully adjusting the px, py,
369 * width, height, skipPixels and skipRows values we can do
370 * scissoring without special code in the rendering loop.
371 */
372
373 /* we'll construct a new pixelstore struct */
374 finalUnpack = &scissoredUnpack;
375 scissoredUnpack = *unpack;
376 if (scissoredUnpack.RowLength == 0)
377 scissoredUnpack.RowLength = width;
378
379 /* clip left */
380 if (px < ctx->Scissor.X) {
381 scissoredUnpack.SkipPixels += (ctx->Scissor.X - px);
382 width -= (ctx->Scissor.X - px);
383 px = ctx->Scissor.X;
384 }
385 /* clip right */
386 if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) {
387 width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width));
388 }
389 /* clip bottom */
390 if (py < ctx->Scissor.Y) {
391 scissoredUnpack.SkipRows += (ctx->Scissor.Y - py);
392 height -= (ctx->Scissor.Y - py);
393 py = ctx->Scissor.Y;
394 }
395 /* clip top */
396 if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) {
397 height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height));
398 }
399
400 if (width <= 0 || height <= 0)
401 return GL_TRUE; /* totally scissored away */
402 }
403 else {
404 finalUnpack = unpack;
405 }
406
407 /* compute pixel value */
408 {
409 GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f);
410 GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f);
411 GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f);
412 /*GLint a = (GLint)(ctx->Current.RasterColor[3]*255.0f);*/
413 if (fxMesa->bgrOrder)
414 color = (FxU16)
415 ( ((FxU16)0xf8 & b) << (11-3)) |
416 ( ((FxU16)0xfc & g) << (5-3+1)) |
417 ( ((FxU16)0xf8 & r) >> 3);
418 else
419 color = (FxU16)
420 ( ((FxU16)0xf8 & r) << (11-3)) |
421 ( ((FxU16)0xfc & g) << (5-3+1)) |
422 ( ((FxU16)0xf8 & b) >> 3);
423 }
424
425 info.size = sizeof(info);
426 if (!FX_grLfbLock(GR_LFB_WRITE_ONLY,
427 fxMesa->currentFB,
428 GR_LFBWRITEMODE_565,
429 GR_ORIGIN_UPPER_LEFT,
430 FXFALSE,
431 &info)) {
432 #ifndef FX_SILENT
433 fprintf(stderr,"fx Driver: error locking the linear frame buffer\n");
434 #endif
435 return GL_TRUE;
436 }
437
438 #ifdef XF86DRI
439 #define INSIDE(c, x, y) inClipRects((c), (x), (y))
440 #else
441 #define INSIDE(c, x, y) (1)
442 #endif
443
444 {
445 const GLint winX = fxMesa->x_offset;
446 const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
447 /* The dest stride depends on the hardware and whether we're drawing
448 * to the front or back buffer. This compile-time test seems to do
449 * the job for now.
450 */
451 #ifdef XF86DRI
452 const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
453 ? (fxMesa->screen_width) : (info.strideInBytes / 2);
454 #else
455 const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */
456 #endif
457 GLint row;
458 /* compute dest address of bottom-left pixel in bitmap */
459 GLushort *dst = (GLushort *) info.lfbPtr
460 + (winY - py) * dstStride
461 + (winX + px);
462
463 for (row = 0; row < height; row++) {
464 const GLubyte *src = (const GLubyte *) _mesa_image_address( finalUnpack,
465 bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
466 if (finalUnpack->LsbFirst) {
467 /* least significan bit first */
468 GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7);
469 GLint col;
470 for (col=0; col<width; col++) {
471 if (*src & mask) {
472 if (INSIDE(fxMesa, winX + px + col, winY - py - row))
473 dst[col] = color;
474 }
475 if (mask == 128U) {
476 src++;
477 mask = 1U;
478 }
479 else {
480 mask = mask << 1;
481 }
482 }
483 if (mask != 1)
484 src++;
485 }
486 else {
487 /* most significan bit first */
488 GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7);
489 GLint col;
490 for (col=0; col<width; col++) {
491 if (*src & mask) {
492 if (INSIDE(fxMesa, winX + px + col, winY - py - row))
493 dst[col] = color;
494 }
495 if (mask == 1U) {
496 src++;
497 mask = 128U;
498 }
499 else {
500 mask = mask >> 1;
501 }
502 }
503 if (mask != 128)
504 src++;
505 }
506 dst -= dstStride;
507 }
508 }
509
510 #undef INSIDE
511
512 FX_grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB);
513 return GL_TRUE;
514 }
515
516
517 static GLboolean fxDDReadPixels( GLcontext *ctx, GLint x, GLint y,
518 GLsizei width, GLsizei height,
519 GLenum format, GLenum type,
520 const struct gl_pixelstore_attrib *packing,
521 GLvoid *dstImage )
522 {
523 if (ctx->ImageTransferState) {
524 return GL_FALSE; /* can't do this */
525 }
526 else {
527 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
528 GrLfbInfo_t info;
529 GLboolean result = GL_FALSE;
530
531 BEGIN_BOARD_LOCK();
532 if (grLfbLock(GR_LFB_READ_ONLY,
533 fxMesa->currentFB,
534 GR_LFBWRITEMODE_ANY,
535 GR_ORIGIN_UPPER_LEFT,
536 FXFALSE,
537 &info)) {
538 const GLint winX = fxMesa->x_offset;
539 const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
540 #ifdef XF86DRI
541 const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
542 ? (fxMesa->screen_width) : (info.strideInBytes / 2);
543 #else
544 const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
545 #endif
546 const GLushort *src = (const GLushort *) info.lfbPtr
547 + (winY - y) * srcStride + (winX + x);
548 GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage,
549 width, height, format, type, 0, 0, 0);
550 GLint dstStride = _mesa_image_row_stride(packing, width, format, type);
551
552 if (format == GL_RGB && type == GL_UNSIGNED_BYTE) {
553 /* convert 5R6G5B into 8R8G8B */
554 GLint row, col;
555 const GLint halfWidth = width >> 1;
556 const GLint extraPixel = (width & 1);
557 for (row = 0; row < height; row++) {
558 GLubyte *d = dst;
559 for (col = 0; col < halfWidth; col++) {
560 const GLuint pixel = ((const GLuint *) src)[col];
561 const GLint pixel0 = pixel & 0xffff;
562 const GLint pixel1 = pixel >> 16;
563 *d++ = FX_PixelToR[pixel0];
564 *d++ = FX_PixelToG[pixel0];
565 *d++ = FX_PixelToB[pixel0];
566 *d++ = FX_PixelToR[pixel1];
567 *d++ = FX_PixelToG[pixel1];
568 *d++ = FX_PixelToB[pixel1];
569 }
570 if (extraPixel) {
571 GLushort pixel = src[width-1];
572 *d++ = FX_PixelToR[pixel];
573 *d++ = FX_PixelToG[pixel];
574 *d++ = FX_PixelToB[pixel];
575 }
576 dst += dstStride;
577 src -= srcStride;
578 }
579 result = GL_TRUE;
580 }
581 else if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
582 /* convert 5R6G5B into 8R8G8B8A */
583 GLint row, col;
584 const GLint halfWidth = width >> 1;
585 const GLint extraPixel = (width & 1);
586 for (row = 0; row < height; row++) {
587 GLubyte *d = dst;
588 for (col = 0; col < halfWidth; col++) {
589 const GLuint pixel = ((const GLuint *) src)[col];
590 const GLint pixel0 = pixel & 0xffff;
591 const GLint pixel1 = pixel >> 16;
592 *d++ = FX_PixelToR[pixel0];
593 *d++ = FX_PixelToG[pixel0];
594 *d++ = FX_PixelToB[pixel0];
595 *d++ = 255;
596 *d++ = FX_PixelToR[pixel1];
597 *d++ = FX_PixelToG[pixel1];
598 *d++ = FX_PixelToB[pixel1];
599 *d++ = 255;
600 }
601 if (extraPixel) {
602 const GLushort pixel = src[width-1];
603 *d++ = FX_PixelToR[pixel];
604 *d++ = FX_PixelToG[pixel];
605 *d++ = FX_PixelToB[pixel];
606 *d++ = 255;
607 }
608 dst += dstStride;
609 src -= srcStride;
610 }
611 result = GL_TRUE;
612 }
613 else if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
614 /* directly memcpy 5R6G5B pixels into client's buffer */
615 const GLint widthInBytes = width * 2;
616 GLint row;
617 for (row = 0; row < height; row++) {
618 MEMCPY(dst, src, widthInBytes);
619 dst += dstStride;
620 src -= srcStride;
621 }
622 result = GL_TRUE;
623 }
624 else {
625 result = GL_FALSE;
626 }
627
628 grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
629 }
630 END_BOARD_LOCK();
631 return result;
632 }
633 }
634
635
636
637 static void fxDDFinish(GLcontext *ctx)
638 {
639 FX_grFlush();
640 }
641
642
643 static GLint fxDDGetParameteri(const GLcontext *ctx, GLint param)
644 {
645 switch(param) {
646 case DD_HAVE_HARDWARE_FOG:
647 return 1;
648 default:
649 fprintf(stderr,"fx Driver: internal error in fxDDGetParameteri(): %x\n", (int) param);
650 fxCloseHardware();
651 exit(-1);
652 return 0;
653 }
654 }
655
656
657 void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f)
658 {
659 FX_CONTEXT(ctx)->new_state |= FX_NEW_FOG;
660 ctx->Driver.RenderStart = fxSetupFXUnits;
661 }
662
663 /* KW: Put the word Mesa in the render string because quakeworld
664 * checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE).
665 * Why?
666 */
667 static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
668 {
669 #if defined(GLX_DIRECT_RENDERING)
670 /* Building for DRI driver */
671 switch (name) {
672 case GL_RENDERER:
673 {
674 static char buffer[100];
675 char hardware[100];
676 strcpy(hardware, grGetString(GR_HARDWARE));
677 if (strcmp(hardware, "Voodoo3 (tm)") == 0)
678 strcpy(hardware, "Voodoo3");
679 else if (strcmp(hardware, "Voodoo Banshee (tm)") == 0)
680 strcpy(hardware, "VoodooBanshee");
681 else {
682 /* unexpected result: replace spaces with hyphens */
683 int i;
684 for (i = 0; hardware[i]; i++) {
685 if (hardware[i] == ' ' || hardware[i] == '\t')
686 hardware[i] = '-';
687 }
688 }
689 /* now make the GL_RENDERER string */
690 sprintf(buffer, "Mesa DRI %s 20000510", hardware);
691 return buffer;
692 }
693 case GL_VENDOR:
694 return "Precision Insight, Inc.";
695 default:
696 return NULL;
697 }
698
699 #else
700
701 /* Building for Voodoo1/2 stand-alone Mesa */
702 switch (name) {
703 case GL_RENDERER:
704 {
705 static char buf[80];
706
707 if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) {
708 GrVoodooConfig_t *vc =
709 &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig;
710
711 sprintf(buf,
712 "Mesa Glide v0.30 Voodoo_Graphics %d "
713 "CARD/%d FB/%d TM/%d TMU/%s",
714 glbCurrentBoard,
715 (vc->sliDetect ? (vc->fbRam*2) : vc->fbRam),
716 (vc->tmuConfig[GR_TMU0].tmuRam +
717 ((vc->nTexelfx>1) ? vc->tmuConfig[GR_TMU1].tmuRam : 0)),
718 vc->nTexelfx,
719 (vc->sliDetect ? "SLI" : "NOSLI"));
720 }
721 else if (glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96) {
722 GrSst96Config_t *sc =
723 &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config;
724
725 sprintf(buf,
726 "Glide v0.30 Voodoo_Rush %d "
727 "CARD/%d FB/%d TM/%d TMU/NOSLI",
728 glbCurrentBoard,
729 sc->fbRam,
730 sc->tmuConfig.tmuRam,
731 sc->nTexelfx);
732 }
733 else {
734 strcpy(buf, "Glide v0.30 UNKNOWN");
735 }
736 return (GLubyte *) buf;
737 }
738 default:
739 return NULL;
740 }
741 #endif
742 }
743
744
745 int fxDDInitFxMesaContext( fxMesaContext fxMesa )
746 {
747
748 FX_setupGrVertexLayout();
749
750 if (getenv("FX_EMULATE_SINGLE_TMU"))
751 fxMesa->haveTwoTMUs = GL_FALSE;
752
753 fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs;
754
755 if (!getenv("FX_DONT_FAKE_MULTITEX"))
756 fxMesa->emulateTwoTMUs = GL_TRUE;
757
758 if(getenv("FX_GLIDE_SWAPINTERVAL"))
759 fxMesa->swapInterval=atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
760 else
761 fxMesa->swapInterval=1;
762
763 if(getenv("MESA_FX_SWAP_PENDING"))
764 fxMesa->maxPendingSwapBuffers=atoi(getenv("MESA_FX_SWAP_PENDING"));
765 else
766 fxMesa->maxPendingSwapBuffers=2;
767
768 if(getenv("MESA_FX_INFO"))
769 fxMesa->verbose=GL_TRUE;
770 else
771 fxMesa->verbose=GL_FALSE;
772
773 fxMesa->color=0xffffffff;
774 fxMesa->clearC=0;
775 fxMesa->clearA=0;
776
777 fxMesa->stats.swapBuffer=0;
778 fxMesa->stats.reqTexUpload=0;
779 fxMesa->stats.texUpload=0;
780 fxMesa->stats.memTexUpload=0;
781
782 fxMesa->tmuSrc=FX_TMU_NONE;
783 fxMesa->lastUnitsMode=FX_UM_NONE;
784 fxTMInit(fxMesa);
785
786 /* FX units setup */
787
788 fxMesa->unitsState.alphaTestEnabled=GL_FALSE;
789 fxMesa->unitsState.alphaTestFunc=GR_CMP_ALWAYS;
790 fxMesa->unitsState.alphaTestRefValue=0;
791
792 fxMesa->unitsState.blendEnabled=GL_FALSE;
793 fxMesa->unitsState.blendSrcFuncRGB=GR_BLEND_ONE;
794 fxMesa->unitsState.blendDstFuncRGB=GR_BLEND_ZERO;
795 fxMesa->unitsState.blendSrcFuncAlpha=GR_BLEND_ONE;
796 fxMesa->unitsState.blendDstFuncAlpha=GR_BLEND_ZERO;
797
798 fxMesa->unitsState.depthTestEnabled =GL_FALSE;
799 fxMesa->unitsState.depthMask =GL_TRUE;
800 fxMesa->unitsState.depthTestFunc =GR_CMP_LESS;
801
802 FX_grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
803 if(fxMesa->haveDoubleBuffer) {
804 fxMesa->currentFB=GR_BUFFER_BACKBUFFER;
805 FX_grRenderBuffer(GR_BUFFER_BACKBUFFER);
806 } else {
807 fxMesa->currentFB=GR_BUFFER_FRONTBUFFER;
808 FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER);
809 }
810
811 fxMesa->state = NULL;
812 fxMesa->fogTable = NULL;
813
814 fxMesa->state = malloc(FX_grGetInteger(FX_GLIDE_STATE_SIZE));
815 fxMesa->fogTable = malloc(FX_grGetInteger(FX_FOG_TABLE_ENTRIES)*sizeof(GrFog_t));
816
817 if (!fxMesa->state || !fxMesa->fogTable) {
818 if (fxMesa->state) free(fxMesa->state);
819 if (fxMesa->fogTable) free(fxMesa->fogTable);
820 return 0;
821 }
822
823 if(fxMesa->haveZBuffer)
824 FX_grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
825
826 #if (!FXMESA_USE_ARGB)
827 FX_grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); /* Not every Glide has this */
828 #endif
829
830 fxMesa->textureAlign=FX_grGetInteger(FX_TEXTURE_ALIGN);
831 fxMesa->glCtx->Const.MaxTextureLevels=9;
832 fxMesa->glCtx->Const.MaxTextureSize=256;
833 fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1;
834 fxMesa->new_state = _NEW_ALL;
835
836 fxDDSetupInit();
837 fxDDCvaInit();
838 fxDDClipInit();
839 fxDDTrifuncInit();
840 fxDDFastPathInit();
841
842 fxSetupDDPointers(fxMesa->glCtx);
843 fxDDRenderInit(fxMesa->glCtx);
844 fxDDInitExtensions(fxMesa->glCtx);
845
846 fxDDSetNearFar(fxMesa->glCtx,1.0,100.0);
847
848 FX_grGlideGetState((GrState*)fxMesa->state);
849
850 /* XXX Fix me: callback not registered when main VB is created.
851 */
852 if (fxMesa->glCtx->VB)
853 fxDDRegisterVB( fxMesa->glCtx->VB );
854
855 /* XXX Fix me too: need to have the 'struct dd' prepared prior to
856 * creating the context... The below is broken if you try to insert
857 * new stages.
858 */
859 if (fxMesa->glCtx->NrPipelineStages)
860 fxMesa->glCtx->NrPipelineStages = fxDDRegisterPipelineStages(
861 fxMesa->glCtx->PipelineStage,
862 fxMesa->glCtx->PipelineStage,
863 fxMesa->glCtx->NrPipelineStages);
864
865 /* Run the config file */
866 _mesa_context_initialize( fxMesa->glCtx );
867
868 return 1;
869 }
870
871
872 #if 0
873 /* Example extension function */
874 static void fxFooBarEXT(GLint i)
875 {
876 printf("You called glFooBarEXT(%d)\n", i);
877 }
878 #endif
879
880
881 void fxDDInitExtensions( GLcontext *ctx )
882 {
883 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
884
885 gl_extensions_disable(ctx, "GL_EXT_blend_logic_op");
886 gl_extensions_disable(ctx, "GL_EXT_blend_minmax");
887 gl_extensions_disable(ctx, "GL_EXT_blend_subtract");
888 gl_extensions_disable(ctx, "GL_EXT_blend_color");
889 gl_extensions_disable(ctx, "GL_EXT_fog_coord");
890
891 gl_extensions_add(ctx, GL_TRUE, "3DFX_set_global_palette", 0);
892
893 if (!fxMesa->haveTwoTMUs)
894 gl_extensions_disable(ctx, "GL_EXT_texture_env_add");
895
896 if (!fxMesa->emulateTwoTMUs)
897 gl_extensions_disable(ctx, "GL_ARB_multitexture");
898
899
900 /* Example of hooking in an extension function.
901 * For DRI-based drivers, also see __driRegisterExtensions in the
902 * tdfx_xmesa.c file.
903 */
904 #if 0
905 {
906 void **dispatchTable = (void **) ctx->Exec;
907 const int _gloffset_FooBarEXT = 555; /* just an example number! */
908 const int tabSize = _glapi_get_dispatch_table_size();
909 assert(_gloffset_FooBarEXT < tabSize);
910 dispatchTable[_gloffset_FooBarEXT] = (void *) fxFooBarEXT;
911 /* XXX You would also need to hook into the display list dispatch
912 * table. Really, the implementation of extensions might as well
913 * be in the core of Mesa since core Mesa and the device driver
914 * is one big shared lib.
915 */
916 }
917 #endif
918 }
919
920
921 /************************************************************************/
922 /************************************************************************/
923 /************************************************************************/
924
925 /* Check if the hardware supports the current context
926 *
927 * Performs similar work to fxDDChooseRenderState() - should be merged.
928 */
929 static GLboolean fxIsInHardware(GLcontext *ctx)
930 {
931 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
932
933 if (!ctx->Hint.AllowDrawMem)
934 return GL_TRUE; /* you'll take it and like it */
935
936 if((ctx->RasterMask & (STENCIL_BIT | MULTI_DRAW_BIT)) ||
937 ((ctx->Color.BlendEnabled) && (ctx->Color.BlendEquation!=GL_FUNC_ADD_EXT)) ||
938 ((ctx->Color.ColorLogicOpEnabled) && (ctx->Color.LogicOp!=GL_COPY)) ||
939 (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) ||
940 (!((ctx->Color.ColorMask[RCOMP]==ctx->Color.ColorMask[GCOMP]) &&
941 (ctx->Color.ColorMask[GCOMP]==ctx->Color.ColorMask[BCOMP]) &&
942 (ctx->Color.ColorMask[ACOMP]==ctx->Color.ColorMask[ACOMP])))
943 )
944 {
945 return GL_FALSE;
946 }
947 /* Unsupported texture/multitexture cases */
948
949 if(fxMesa->emulateTwoTMUs) {
950 if((ctx->Enabled & (TEXTURE0_3D | TEXTURE1_3D)) ||
951 /* Not very well written ... */
952 ((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) &&
953 ((ctx->Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D)))
954 ) {
955 return GL_FALSE;
956 }
957
958 if (ctx->Texture.ReallyEnabled & TEXTURE0_2D) {
959 if (ctx->Texture.Unit[0].EnvMode == GL_BLEND &&
960 (ctx->Texture.ReallyEnabled & TEXTURE1_2D ||
961 ctx->Texture.Unit[0].EnvColor[0] != 0 ||
962 ctx->Texture.Unit[0].EnvColor[1] != 0 ||
963 ctx->Texture.Unit[0].EnvColor[2] != 0 ||
964 ctx->Texture.Unit[0].EnvColor[3] != 1)) {
965 return GL_FALSE;
966 }
967 if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0)
968 return GL_FALSE;
969 }
970
971 if (ctx->Texture.ReallyEnabled & TEXTURE1_2D) {
972 if (ctx->Texture.Unit[1].EnvMode == GL_BLEND)
973 return GL_FALSE;
974 if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0)
975 return GL_FALSE;
976 }
977
978 if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE))
979 fprintf(stderr, "fxMesa: fxIsInHardware, envmode is %s/%s\n",
980 gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
981 gl_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
982
983 /* KW: This was wrong (I think) and I changed it... which doesn't mean
984 * it is now correct...
985 */
986 if((ctx->Enabled & (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D)) &&
987 (ctx->Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)))
988 {
989 /* Can't use multipass to blend a multitextured triangle - fall
990 * back to software.
991 */
992 if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) {
993 return GL_FALSE;
994 }
995
996 if ((ctx->Texture.Unit[0].EnvMode!=ctx->Texture.Unit[1].EnvMode) &&
997 (ctx->Texture.Unit[0].EnvMode!=GL_MODULATE) &&
998 (ctx->Texture.Unit[0].EnvMode!=GL_REPLACE)) /* q2, seems ok... */
999 {
1000 if (MESA_VERBOSE&VERBOSE_DRIVER)
1001 fprintf(stderr, "fxMesa: unsupported multitex env mode\n");
1002 return GL_FALSE;
1003 }
1004 }
1005 } else {
1006 if((ctx->Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) ||
1007 /* Not very well written ... */
1008 ((ctx->Enabled & TEXTURE0_1D) &&
1009 (!(ctx->Enabled & TEXTURE0_2D)))
1010 ) {
1011 return GL_FALSE;
1012 }
1013
1014
1015 if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
1016 (ctx->Texture.Unit[0].EnvMode==GL_BLEND)) {
1017 return GL_FALSE;
1018 }
1019 }
1020
1021 return GL_TRUE;
1022 }
1023
1024
1025 static void fxDDUpdateDDPointers(GLcontext *ctx)
1026 {
1027 fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
1028 GLuint new_state = ctx->NewState;
1029
1030 if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_STATE))
1031 fprintf(stderr,"fxmesa: fxDDUpdateDDPointers(...)\n");
1032
1033 if (new_state & _FX_NEW_FALLBACK)
1034 fxMesa->is_in_hardware = fxIsInHardware(ctx);
1035
1036 if (fxMesa->is_in_hardware) {
1037 if (fxMesa->new_state)
1038 fxSetupFXUnits(ctx);
1039
1040 if (new_state & _FX_NEW_RENDERSTATE) {
1041 fxDDChooseRenderState( ctx );
1042
1043 fxMesa->RenderVBTables=fxDDChooseRenderVBTables(ctx);
1044 fxMesa->RenderVBClippedTab=fxMesa->RenderVBTables[0];
1045 fxMesa->RenderVBCulledTab=fxMesa->RenderVBTables[1];
1046 fxMesa->RenderVBRawTab=fxMesa->RenderVBTables[2];
1047 }
1048
1049 if (new_state & _FX_NEW_SETUP_FUNCTION)
1050 ctx->Driver.RasterSetup=fxDDChooseSetupFunction(ctx);
1051
1052
1053 ctx->Driver.PointsFunc=fxMesa->PointsFunc;
1054 ctx->Driver.LineFunc=fxMesa->LineFunc;
1055 ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
1056 ctx->Driver.QuadFunc=fxMesa->QuadFunc;
1057 } else {
1058 fxMesa->render_index = FX_FALLBACK;
1059 }
1060 }
1061
1062 static void fxDDReducedPrimitiveChange(GLcontext *ctx, GLenum prim)
1063 {
1064 if (ctx->Polygon.CullFlag) {
1065 if (ctx->PB->primitive != GL_POLYGON) { /* Lines or Points */
1066 FX_grCullMode(GR_CULL_DISABLE);
1067 FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE;
1068 }
1069 }
1070 }
1071
1072 void fxSetupDDPointers(GLcontext *ctx)
1073 {
1074 if (MESA_VERBOSE&VERBOSE_DRIVER) {
1075 fprintf(stderr,"fxmesa: fxSetupDDPointers()\n");
1076 }
1077
1078 ctx->Driver.UpdateStateNotify = (_FX_NEW_SETUP_FUNCTION|
1079 _FX_NEW_RENDERSTATE|
1080 _FX_NEW_FALLBACK|
1081 _SWRAST_NEW_TRIANGLE|
1082 _SWRAST_NEW_LINE|
1083 _SWRAST_NEW_POINT);
1084
1085 ctx->Driver.UpdateState=fxDDUpdateDDPointers;
1086
1087 ctx->Driver.WriteDepthSpan=fxDDWriteDepthSpan;
1088 ctx->Driver.WriteDepthPixels=fxDDWriteDepthPixels;
1089 ctx->Driver.ReadDepthSpan=fxDDReadDepthSpan;
1090 ctx->Driver.ReadDepthPixels=fxDDReadDepthPixels;
1091
1092 ctx->Driver.GetString=fxDDGetString;
1093
1094 ctx->Driver.NearFar=fxDDSetNearFar;
1095
1096 ctx->Driver.GetParameteri=fxDDGetParameteri;
1097
1098 ctx->Driver.ClearIndex=NULL;
1099 ctx->Driver.ClearColor=fxDDClearColor;
1100 ctx->Driver.Clear=fxDDClear;
1101
1102 ctx->Driver.Index=NULL;
1103 ctx->Driver.Color=fxDDSetColor;
1104
1105 ctx->Driver.SetDrawBuffer=fxDDSetDrawBuffer;
1106 ctx->Driver.SetReadBuffer=fxDDSetReadBuffer;
1107 ctx->Driver.GetBufferSize=fxDDBufferSize;
1108
1109 ctx->Driver.Bitmap=fxDDDrawBitmap;
1110 ctx->Driver.DrawPixels=NULL;
1111 ctx->Driver.ReadPixels=fxDDReadPixels;
1112
1113 ctx->Driver.Finish=fxDDFinish;
1114 ctx->Driver.Flush=NULL;
1115
1116 ctx->Driver.RenderStart=NULL;
1117 ctx->Driver.RenderFinish=NULL;
1118
1119 ctx->Driver.TexImage2D = fxDDTexImage2D;
1120 ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
1121 ctx->Driver.GetTexImage = fxDDGetTexImage;
1122 ctx->Driver.TexEnv=fxDDTexEnv;
1123 ctx->Driver.TexParameter=fxDDTexParam;
1124 ctx->Driver.BindTexture=fxDDTexBind;
1125 ctx->Driver.DeleteTexture=fxDDTexDel;
1126 ctx->Driver.UpdateTexturePalette=fxDDTexPalette;
1127
1128 ctx->Driver.RectFunc=NULL;
1129
1130 ctx->Driver.AlphaFunc=fxDDAlphaFunc;
1131 ctx->Driver.BlendFunc=fxDDBlendFunc;
1132 ctx->Driver.DepthFunc=fxDDDepthFunc;
1133 ctx->Driver.DepthMask=fxDDDepthMask;
1134 ctx->Driver.ColorMask=fxDDColorMask;
1135 ctx->Driver.Fogfv=fxDDFogfv;
1136 ctx->Driver.Scissor=fxDDScissor;
1137 ctx->Driver.FrontFace=fxDDFrontFace;
1138 ctx->Driver.CullFace=fxDDCullFace;
1139 ctx->Driver.ShadeModel=fxDDShadeModel;
1140 ctx->Driver.Enable=fxDDEnable;
1141 ctx->Driver.ReducedPrimitiveChange=fxDDReducedPrimitiveChange;
1142
1143 ctx->Driver.RegisterVB=fxDDRegisterVB;
1144 ctx->Driver.UnregisterVB=fxDDUnregisterVB;
1145
1146 ctx->Driver.RegisterPipelineStages = fxDDRegisterPipelineStages;
1147
1148 ctx->Driver.OptimizeImmediatePipeline = 0; /* nothing done yet */
1149 ctx->Driver.OptimizePrecalcPipeline = 0;
1150
1151 /* if (getenv("MESA_USE_FAST") || getenv("FX_USE_FAST")) */
1152 /* ctx->Driver.OptimizePrecalcPipeline = fxDDOptimizePrecalcPipeline; */
1153
1154 if (!getenv("FX_NO_FAST"))
1155 ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline;
1156
1157 ctx->Driver.TriangleCaps = DD_TRI_CULL|DD_TRI_OFFSET|DD_TRI_LIGHT_TWOSIDE;
1158
1159 fxSetupDDSpanPointers(ctx);
1160
1161 FX_CONTEXT(ctx)->render_index = 1; /* force an update */
1162 fxDDUpdateDDPointers(ctx);
1163 }
1164
1165
1166 #else
1167
1168
1169 /*
1170 * Need this to provide at least one external definition.
1171 */
1172
1173 int gl_fx_dummy_function_dd(void)
1174 {
1175 return 0;
1176 }
1177
1178 #endif /* FX */
1179