2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * DOS/DJGPP device driver v1.3 for Mesa 5.0
28 * Copyright (C) 2002 - Borca Daniel
29 * Email : dborca@yahoo.com
30 * Web : http://www.geocities.com/dborca
39 #include "extensions.h"
42 #include "texformat.h"
44 #include "array_cache/acache.h"
45 #include "swrast/s_context.h"
46 #include "swrast/s_depth.h"
47 #include "swrast/s_lines.h"
48 #include "swrast/s_triangle.h"
49 #include "swrast/s_trispan.h"
50 #include "swrast/swrast.h"
51 #include "swrast_setup/swrast_setup.h"
53 #include "tnl/t_context.h"
54 #include "tnl/t_pipeline.h"
68 #include "../FX/fxdrv.h"
76 * In C++ terms, this class derives from the GLvisual class.
77 * Add system-specific fields to it.
81 GLboolean db_flag
; /* double buffered? */
82 GLboolean rgb_flag
; /* RGB mode? */
83 GLuint depth
; /* bits per pixel (1, 8, 24, etc) */
87 int zbuffer
; /* Z=buffer: 0=no, 1=SW, -1=HW */
91 * In C++ terms, this class derives from the GLframebuffer class.
92 * Add system-specific fields to it.
95 GLframebuffer gl_buffer
; /* The depth, stencil, accum, etc buffers */
96 void *the_window
; /* your window handle, etc */
98 int xpos
, ypos
; /* position */
99 int width
, height
; /* size in pixels */
103 * In C++ terms, this class derives from the GLcontext class.
104 * Add system-specific fields to it.
106 struct dmesa_context
{
107 GLcontext
*gl_ctx
; /* the core library context */
118 /****************************************************************************
120 ***************************************************************************/
121 #define FLIP(y) (dmesa->Buffer->height - (y) - 1)
122 #define FLIP2(y) (_b_ - (y))
126 #define DSTRIDE dmesa->Buffer->width
128 #define DSTRIDE dmesa->visual->stride_in_pixels
129 #define vl_putpixel mga_putpixel
130 #define vl_mixrgba mga_mixrgb
131 #define vl_mixrgb mga_mixrgb
132 #define vl_getrgba mga_getrgba
133 #define vl_setz mga_setz
134 #define vl_getz mga_getz
137 /****************************************************************************
139 ***************************************************************************/
140 static void write_rgba_span (const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
141 const GLubyte rgba
[][4], const GLubyte mask
[])
143 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
147 offset
= DSTRIDE
* FLIP(y
) + x
;
149 /* draw some pixels */
150 for (i
=0; i
<n
; i
++, offset
++) {
152 vl_putpixel(offset
, vl_mixrgba(rgba
[i
]));
156 /* draw all pixels */
157 for (i
=0; i
<n
; i
++, offset
++) {
158 vl_putpixel(offset
, vl_mixrgba(rgba
[i
]));
164 /* draw some pixels */
166 for (i
= 0; i
< n
; i
++) {
171 mga_draw_span_rgb_tx32(x
+ i
- offset
, y
, offset
, (const unsigned long *)(&rgba
[i
-offset
]));
177 mga_draw_span_rgb_tx32(x
+ n
- offset
, y
, offset
, (const unsigned long *)(&rgba
[n
-offset
]));
180 /* draw all pixels */
181 mga_draw_span_rgb_tx32(x
, y
, n
, (const unsigned long *)rgba
);
188 static void write_rgb_span (const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
189 const GLubyte rgb
[][3], const GLubyte mask
[])
191 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
194 offset
= DSTRIDE
* FLIP(y
) + x
;
196 /* draw some pixels */
197 for (i
=0; i
<n
; i
++, offset
++) {
199 vl_putpixel(offset
, vl_mixrgb(rgb
[i
]));
203 /* draw all pixels */
204 for (i
=0; i
<n
; i
++, offset
++) {
205 vl_putpixel(offset
, vl_mixrgb(rgb
[i
]));
212 static void write_mono_rgba_span (const GLcontext
*ctx
,
213 GLuint n
, GLint x
, GLint y
,
214 const GLchan color
[4], const GLubyte mask
[])
216 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
217 GLuint i
, offset
, rgba
= vl_mixrgba(color
);
219 offset
= DSTRIDE
* FLIP(y
) + x
;
221 /* draw some pixels */
222 for (i
=0; i
<n
; i
++, offset
++) {
224 vl_putpixel(offset
, rgba
);
228 /* draw all pixels */
229 for (i
=0; i
<n
; i
++, offset
++) {
230 vl_putpixel(offset
, rgba
);
237 static void read_rgba_span (const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
240 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
243 offset
= DSTRIDE
* FLIP(y
) + x
;
244 /* read all pixels */
245 for (i
=0; i
<n
; i
++, offset
++) {
246 vl_getrgba(offset
, rgba
[i
]);
252 static void write_rgba_pixels (const GLcontext
*ctx
,
253 GLuint n
, const GLint x
[], const GLint y
[],
254 const GLubyte rgba
[][4], const GLubyte mask
[])
256 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
257 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1;
260 /* draw some pixels */
261 for (i
=0; i
<n
; i
++) {
263 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], vl_mixrgba(rgba
[i
]));
267 /* draw all pixels */
268 for (i
=0; i
<n
; i
++) {
269 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], vl_mixrgba(rgba
[i
]));
276 static void write_mono_rgba_pixels (const GLcontext
*ctx
,
277 GLuint n
, const GLint x
[], const GLint y
[],
278 const GLchan color
[4], const GLubyte mask
[])
280 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
281 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1, rgba
= vl_mixrgba(color
);
284 /* draw some pixels */
285 for (i
=0; i
<n
; i
++) {
287 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], rgba
);
291 /* draw all pixels */
292 for (i
=0; i
<n
; i
++) {
293 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], rgba
);
300 static void read_rgba_pixels (const GLcontext
*ctx
,
301 GLuint n
, const GLint x
[], const GLint y
[],
302 GLubyte rgba
[][4], const GLubyte mask
[])
304 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
305 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1;
308 /* read some pixels */
309 for (i
=0; i
<n
; i
++) {
311 vl_getrgba(FLIP2(y
[i
])*_w_
+ x
[i
], rgba
[i
]);
315 /* read all pixels */
316 for (i
=0; i
<n
; i
++) {
317 vl_getrgba(FLIP2(y
[i
])*_w_
+ x
[i
], rgba
[i
]);
324 /****************************************************************************
326 ***************************************************************************/
328 static void write_index_span (const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
329 const GLuint index
[], const GLubyte mask
[])
331 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
334 offset
= DSTRIDE
* FLIP(y
) + x
;
336 /* draw some pixels */
337 for (i
=0; i
<n
; i
++, offset
++) {
339 vl_putpixel(offset
, index
[i
]);
343 /* draw all pixels */
344 for (i
=0; i
<n
; i
++, offset
++) {
345 vl_putpixel(offset
, index
[i
]);
352 static void write_index8_span (const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
353 const GLubyte index
[], const GLubyte mask
[])
355 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
358 offset
= DSTRIDE
* FLIP(y
) + x
;
360 /* draw some pixels */
361 for (i
=0; i
<n
; i
++, offset
++) {
363 vl_putpixel(offset
, index
[i
]);
367 /* draw all pixels */
368 for (i
=0; i
<n
; i
++, offset
++) {
369 vl_putpixel(offset
, index
[i
]);
376 static void write_mono_index_span (const GLcontext
*ctx
,
377 GLuint n
, GLint x
, GLint y
,
378 GLuint colorIndex
, const GLubyte mask
[])
380 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
383 offset
= DSTRIDE
* FLIP(y
) + x
;
385 /* draw some pixels */
386 for (i
=0; i
<n
; i
++, offset
++) {
388 vl_putpixel(offset
, colorIndex
);
392 /* draw all pixels */
393 for (i
=0; i
<n
; i
++, offset
++) {
394 vl_putpixel(offset
, colorIndex
);
401 static void read_index_span (const GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
404 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
407 offset
= DSTRIDE
* FLIP(y
) + x
;
408 /* read all pixels */
409 for (i
=0; i
<n
; i
++, offset
++) {
410 index
[i
] = vl_getpixel(offset
);
416 static void write_index_pixels (const GLcontext
*ctx
,
417 GLuint n
, const GLint x
[], const GLint y
[],
418 const GLuint index
[], const GLubyte mask
[])
420 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
421 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1;
424 /* draw some pixels */
425 for (i
=0; i
<n
; i
++) {
427 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], index
[i
]);
431 /* draw all pixels */
432 for (i
=0; i
<n
; i
++) {
433 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], index
[i
]);
440 static void write_mono_index_pixels (const GLcontext
*ctx
,
441 GLuint n
, const GLint x
[], const GLint y
[],
442 GLuint colorIndex
, const GLubyte mask
[])
444 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
445 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1;
448 /* draw some pixels */
449 for (i
=0; i
<n
; i
++) {
451 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], colorIndex
);
455 /* draw all pixels */
456 for (i
=0; i
<n
; i
++) {
457 vl_putpixel(FLIP2(y
[i
])*_w_
+ x
[i
], colorIndex
);
464 static void read_index_pixels (const GLcontext
*ctx
,
465 GLuint n
, const GLint x
[], const GLint y
[],
466 GLuint index
[], const GLubyte mask
[])
468 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
469 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1;
472 /* read some pixels */
473 for (i
=0; i
<n
; i
++) {
475 index
[i
] = vl_getpixel(FLIP2(y
[i
])*_w_
+ x
[i
]);
479 /* read all pixels */
480 for (i
=0; i
<n
; i
++) {
481 index
[i
] = vl_getpixel(FLIP2(y
[i
])*_w_
+ x
[i
]);
489 /****************************************************************************
491 ***************************************************************************/
493 static void write_depth_span (GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
494 const GLdepth depth
[], const GLubyte mask
[])
496 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
499 offset
= DSTRIDE
* FLIP(y
) + x
;
501 /* draw some values */
502 for (i
=0; i
<n
; i
++, offset
++) {
504 vl_setz(offset
, depth
[i
]);
508 /* draw all values */
509 for (i
=0; i
<n
; i
++, offset
++) {
510 vl_setz(offset
, depth
[i
]);
517 static void read_depth_span (GLcontext
*ctx
, GLuint n
, GLint x
, GLint y
,
520 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
523 offset
= DSTRIDE
* FLIP(y
) + x
;
524 /* read all values */
525 for (i
=0; i
<n
; i
++, offset
++) {
526 depth
[i
] = vl_getz(offset
);
532 static void write_depth_pixels (GLcontext
*ctx
, GLuint n
,
533 const GLint x
[], const GLint y
[],
534 const GLdepth depth
[], const GLubyte mask
[])
536 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
537 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1;
540 /* draw some values */
541 for (i
=0; i
<n
; i
++) {
543 vl_setz(FLIP2(y
[i
])*_w_
+ x
[i
], depth
[i
]);
547 /* draw all values */
548 for (i
=0; i
<n
; i
++) {
549 vl_setz(FLIP2(y
[i
])*_w_
+ x
[i
], depth
[i
]);
556 static void read_depth_pixels (GLcontext
*ctx
, GLuint n
,
557 const GLint x
[], const GLint y
[],
560 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
561 GLuint i
, _w_
= DSTRIDE
, _b_
= dmesa
->Buffer
->height
- 1;
563 /* read all values */
564 for (i
=0; i
<n
; i
++) {
565 depth
[i
] = vl_getz(FLIP2(y
[i
])*_w_
+ x
[i
]);
572 /****************************************************************************
573 * Optimized triangle rendering
574 ***************************************************************************/
577 * NON-depth-buffered flat triangle.
579 static void tri_rgb_flat (GLcontext
*ctx
,
584 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
585 GLuint _b_
= dmesa
->Buffer
->height
- 1;
587 GLuint _w_
= dmesa
->Buffer
->width
;
589 #define SETUP_CODE GLuint rgb = vl_mixrgb(v2->color);
591 #define RENDER_SPAN(span) \
592 GLuint i, offset = FLIP2(span.y)*_w_ + span.x; \
593 for (i = 0; i < span.end; i++, offset++) { \
594 vl_putpixel(offset, rgb); \
597 #include "swrast/s_tritemp.h"
599 MGAvertex m0
, m1
, m2
;
600 m0
.win
[0] = v0
->win
[0];
601 m0
.win
[1] = FLIP2(v0
->win
[1]);
602 m1
.win
[0] = v1
->win
[0];
603 m1
.win
[1] = FLIP2(v1
->win
[1]);
604 m2
.win
[0] = v2
->win
[0];
605 m2
.win
[1] = FLIP2(v2
->win
[1]);
606 *(unsigned long *)m2
.color
= *(unsigned long *)v2
->color
;
607 mga_draw_tri_rgb_flat((int)SWRAST_CONTEXT(ctx
)->_backface_sign
, &m0
, &m1
, &m2
);
614 * Z-less flat triangle.
616 static void tri_rgb_flat_zless (GLcontext
*ctx
,
621 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
622 GLuint _b_
= dmesa
->Buffer
->height
- 1;
624 GLuint _w_
= dmesa
->Buffer
->width
;
627 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
628 #define SETUP_CODE GLuint rgb = vl_mixrgb(v2->color);
630 #define RENDER_SPAN(span) \
631 GLuint i, offset = FLIP2(span.y)*_w_ + span.x; \
632 for (i = 0; i < span.end; i++, offset++) { \
633 const DEPTH_TYPE z = FixedToDepth(span.z); \
635 vl_putpixel(offset, rgb); \
638 span.z += span.zStep; \
641 #include "swrast/s_tritemp.h"
643 MGAvertex m0
, m1
, m2
;
644 m0
.win
[0] = v0
->win
[0];
645 m0
.win
[1] = FLIP2(v0
->win
[1]);
646 m0
.win
[2] = v0
->win
[2];
647 m1
.win
[0] = v1
->win
[0];
648 m1
.win
[1] = FLIP2(v1
->win
[1]);
649 m1
.win
[2] = v1
->win
[2];
650 m2
.win
[0] = v2
->win
[0];
651 m2
.win
[1] = FLIP2(v2
->win
[1]);
652 m2
.win
[2] = v2
->win
[2];
653 *(unsigned long *)m2
.color
= *(unsigned long *)v2
->color
;
654 mga_draw_tri_rgb_flat_zless((int)SWRAST_CONTEXT(ctx
)->_backface_sign
, &m0
, &m1
, &m2
);
661 * NON-depth-buffered iterated triangle.
663 static void tri_rgb_iter (GLcontext
*ctx
,
668 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
669 GLuint _b_
= dmesa
->Buffer
->height
- 1;
671 GLuint _w_
= dmesa
->Buffer
->width
;
674 #define RENDER_SPAN(span) \
675 GLuint i, offset = FLIP2(span.y)*_w_ + span.x; \
676 for (i = 0; i < span.end; i++, offset++) { \
677 vl_putpixel(offset, vl_mixfix(span.red, span.green, span.blue)); \
678 span.red += span.redStep; \
679 span.green += span.greenStep; \
680 span.blue += span.blueStep; \
683 #include "swrast/s_tritemp.h"
685 MGAvertex m0
, m1
, m2
;
686 m0
.win
[0] = v0
->win
[0];
687 m0
.win
[1] = FLIP2(v0
->win
[1]);
688 m1
.win
[0] = v1
->win
[0];
689 m1
.win
[1] = FLIP2(v1
->win
[1]);
690 m2
.win
[0] = v2
->win
[0];
691 m2
.win
[1] = FLIP2(v2
->win
[1]);
692 *(unsigned long *)m0
.color
= *(unsigned long *)v0
->color
;
693 *(unsigned long *)m1
.color
= *(unsigned long *)v1
->color
;
694 *(unsigned long *)m2
.color
= *(unsigned long *)v2
->color
;
695 mga_draw_tri_rgb_iter((int)SWRAST_CONTEXT(ctx
)->_backface_sign
, &m0
, &m1
, &m2
);
702 * Z-less iterated triangle.
704 static void tri_rgb_iter_zless (GLcontext
*ctx
,
709 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
710 GLuint _b_
= dmesa
->Buffer
->height
- 1;
712 GLuint _w_
= dmesa
->Buffer
->width
;
715 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
718 #define RENDER_SPAN(span) \
719 GLuint i, offset = FLIP2(span.y)*_w_ + span.x; \
720 for (i = 0; i < span.end; i++, offset++) { \
721 const DEPTH_TYPE z = FixedToDepth(span.z); \
723 vl_putpixel(offset, vl_mixfix(span.red, span.green, span.blue));\
726 span.red += span.redStep; \
727 span.green += span.greenStep; \
728 span.blue += span.blueStep; \
729 span.z += span.zStep; \
732 #include "swrast/s_tritemp.h"
734 MGAvertex m0
, m1
, m2
;
735 m0
.win
[0] = v0
->win
[0];
736 m0
.win
[1] = FLIP2(v0
->win
[1]);
737 m0
.win
[2] = v0
->win
[2];
738 m1
.win
[0] = v1
->win
[0];
739 m1
.win
[1] = FLIP2(v1
->win
[1]);
740 m1
.win
[2] = v1
->win
[2];
741 m2
.win
[0] = v2
->win
[0];
742 m2
.win
[1] = FLIP2(v2
->win
[1]);
743 m2
.win
[2] = v2
->win
[2];
744 *(unsigned long *)m0
.color
= *(unsigned long *)v0
->color
;
745 *(unsigned long *)m1
.color
= *(unsigned long *)v1
->color
;
746 *(unsigned long *)m2
.color
= *(unsigned long *)v2
->color
;
747 mga_draw_tri_rgb_iter_zless((int)SWRAST_CONTEXT(ctx
)->_backface_sign
, &m0
, &m1
, &m2
);
754 * Analyze context state to see if we can provide a fast triangle function
755 * Otherwise, return NULL.
757 static swrast_tri_func
dmesa_choose_tri_function (GLcontext
*ctx
)
759 const SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
761 if ((ctx
->RenderMode
!= GL_RENDER
)
762 || (ctx
->Polygon
.SmoothFlag
)
763 || (ctx
->Polygon
.StippleFlag
)
764 || (ctx
->Texture
._EnabledUnits
)
765 || (swrast
->_RasterMask
& MULTI_DRAW_BIT
)
766 || (ctx
->Polygon
.CullFlag
&& ctx
->Polygon
.CullFaceMode
== GL_FRONT_AND_BACK
)) {
767 return (swrast_tri_func
)NULL
;
770 if (swrast
->_RasterMask
==DEPTH_BIT
771 && ctx
->Depth
.Func
==GL_LESS
772 && ctx
->Depth
.Mask
==GL_TRUE
773 && ctx
->Visual
.depthBits
== DEFAULT_SOFTWARE_DEPTH_BITS
) {
774 return (ctx
->Light
.ShadeModel
==GL_SMOOTH
) ? tri_rgb_iter_zless
: tri_rgb_flat_zless
;
777 if (swrast
->_RasterMask
==0) { /* no depth test */
778 return (ctx
->Light
.ShadeModel
==GL_SMOOTH
) ? tri_rgb_iter
: tri_rgb_flat
;
781 return (swrast_tri_func
)NULL
;
786 /* Override for the swrast triangle-selection function. Try to use one
787 * of our internal triangle functions, otherwise fall back to the
788 * standard swrast functions.
790 static void dmesa_choose_tri (GLcontext
*ctx
)
792 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
794 if (!(swrast
->Triangle
=dmesa_choose_tri_function(ctx
)))
795 _swrast_choose_triangle(ctx
);
800 /****************************************************************************
801 * Optimized line rendering
802 ***************************************************************************/
805 static __inline
void matrox_line_clip_hack (GLcontext
*ctx
, int _b_
, MGAvertex
*m0
, const SWvertex
*vert0
, MGAvertex
*m1
, const SWvertex
*vert1
)
807 int x0
= vert0
->win
[0];
808 int y0
= vert0
->win
[1];
809 int x1
= vert1
->win
[0];
810 int y1
= vert1
->win
[1];
812 GLint w
= ctx
->DrawBuffer
->Width
;
813 GLint h
= ctx
->DrawBuffer
->Height
;
814 if ((x0
==w
) | (x1
==w
)) {
815 if ((x0
==w
) & (x1
==w
))
820 if ((y0
==h
) | (y1
==h
)) {
821 if ((y0
==h
) & (y1
==h
))
828 m0
->win
[1] = FLIP2(y0
);
830 m1
->win
[1] = FLIP2(y1
);
835 * NON-depth-buffered flat line.
837 static void line_rgb_flat (GLcontext
*ctx
,
838 const SWvertex
*vert0
,
839 const SWvertex
*vert1
)
841 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
842 GLuint _b_
= dmesa
->Buffer
->height
- 1;
844 GLuint _w_
= dmesa
->Buffer
->width
;
845 GLuint rgb
= vl_mixrgb(vert1
->color
);
849 #define PLOT(X,Y) vl_putpixel(FLIP2(Y) * _w_ + X, rgb);
851 #include "swrast/s_linetemp.h"
854 matrox_line_clip_hack(ctx
, _b_
, &m0
, vert0
, &m1
, vert1
);
855 *(unsigned long *)m1
.color
= *(unsigned long *)vert1
->color
;
856 mga_draw_line_rgb_flat(&m0
, &m1
);
865 static void line_rgb_flat_zless (GLcontext
*ctx
,
866 const SWvertex
*vert0
,
867 const SWvertex
*vert1
)
869 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
870 GLuint _b_
= dmesa
->Buffer
->height
- 1;
872 GLuint _w_
= dmesa
->Buffer
->width
;
873 GLuint rgb
= vl_mixrgb(vert1
->color
);
877 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
882 vl_putpixel(FLIP2(Y) * _w_ + X, rgb); \
885 #include "swrast/s_linetemp.h"
888 matrox_line_clip_hack(ctx
, _b_
, &m0
, vert0
, &m1
, vert1
);
889 m0
.win
[2] = vert0
->win
[2];
890 m1
.win
[2] = vert1
->win
[2];
891 *(unsigned long *)m1
.color
= *(unsigned long *)vert1
->color
;
892 mga_draw_line_rgb_flat_zless(&m0
, &m1
);
899 #define line_rgb_iter NULL
900 #define line_rgb_iter_zless NULL
903 * NON-depth-buffered iterated line.
905 static void line_rgb_iter (GLcontext
*ctx
,
906 const SWvertex
*vert0
,
907 const SWvertex
*vert1
)
909 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
910 GLuint _b_
= dmesa
->Buffer
->height
- 1;
912 matrox_line_clip_hack(ctx
, _b_
, &m0
, vert0
, &m1
, vert1
);
913 *(unsigned long *)m0
.color
= *(unsigned long *)vert0
->color
;
914 *(unsigned long *)m1
.color
= *(unsigned long *)vert1
->color
;
915 mga_draw_line_rgb_iter(&m0
, &m1
);
921 * Z-less iterated line.
923 static void line_rgb_iter_zless (GLcontext
*ctx
,
924 const SWvertex
*vert0
,
925 const SWvertex
*vert1
)
927 const DMesaContext dmesa
= (DMesaContext
)ctx
->DriverCtx
;
928 GLuint _b_
= dmesa
->Buffer
->height
- 1;
930 matrox_line_clip_hack(ctx
, _b_
, &m0
, vert0
, &m1
, vert1
);
931 m0
.win
[2] = vert0
->win
[2];
932 m1
.win
[2] = vert1
->win
[2];
933 *(unsigned long *)m0
.color
= *(unsigned long *)vert0
->color
;
934 *(unsigned long *)m1
.color
= *(unsigned long *)vert1
->color
;
935 mga_draw_line_rgb_iter_zless(&m0
, &m1
);
942 * Analyze context state to see if we can provide a fast line function
943 * Otherwise, return NULL.
945 static swrast_line_func
dmesa_choose_line_function (GLcontext
*ctx
)
947 const SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
949 if ((ctx
->RenderMode
!= GL_RENDER
)
950 || (ctx
->Line
.SmoothFlag
)
951 || (ctx
->Texture
._EnabledUnits
)
952 || (ctx
->Line
.StippleFlag
)
953 || (swrast
->_RasterMask
& MULTI_DRAW_BIT
)
954 || (ctx
->Line
.Width
!=1.0F
)) {
955 return (swrast_line_func
)NULL
;
958 if (swrast
->_RasterMask
==DEPTH_BIT
959 && ctx
->Depth
.Func
==GL_LESS
960 && ctx
->Depth
.Mask
==GL_TRUE
961 && ctx
->Visual
.depthBits
== DEFAULT_SOFTWARE_DEPTH_BITS
) {
962 return (ctx
->Light
.ShadeModel
==GL_SMOOTH
) ? line_rgb_iter_zless
: line_rgb_flat_zless
;
965 if (swrast
->_RasterMask
==0) { /* no depth test */
966 return (ctx
->Light
.ShadeModel
==GL_SMOOTH
) ? line_rgb_iter
: line_rgb_flat
;
969 return (swrast_line_func
)NULL
;
974 /* Override for the swrast line-selection function. Try to use one
975 * of our internal line functions, otherwise fall back to the
976 * standard swrast functions.
978 static void dmesa_choose_line (GLcontext
*ctx
)
980 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
982 if (!(swrast
->Line
=dmesa_choose_line_function(ctx
)))
983 _swrast_choose_line(ctx
);
988 /****************************************************************************
989 * Miscellaneous device driver funcs
990 ***************************************************************************/
992 static void clear_index (GLcontext
*ctx
, GLuint index
)
994 ((DMesaContext
)ctx
->DriverCtx
)->ClearIndex
= index
;
997 static void clear_color (GLcontext
*ctx
, const GLfloat color
[4])
1000 CLAMPED_FLOAT_TO_UBYTE(col
[0], color
[0]);
1001 CLAMPED_FLOAT_TO_UBYTE(col
[1], color
[1]);
1002 CLAMPED_FLOAT_TO_UBYTE(col
[2], color
[2]);
1003 CLAMPED_FLOAT_TO_UBYTE(col
[3], color
[3]);
1004 ((DMesaContext
)ctx
->DriverCtx
)->ClearColor
= vl_mixrgba(col
);
1009 static void clear (GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
1010 GLint x
, GLint y
, GLint width
, GLint height
)
1012 const DMesaContext c
= (DMesaContext
)ctx
->DriverCtx
;
1013 const GLuint
*colorMask
= (GLuint
*)&ctx
->Color
.ColorMask
;
1016 * Clear the specified region of the buffers indicated by 'mask'
1017 * using the clear color or index as specified by one of the two
1019 * If all==GL_TRUE, clear whole buffer, else just clear region defined
1020 * by x,y,width,height
1023 /* we can't handle color or index masking */
1024 if ((*colorMask
== 0xffffffff) && (ctx
->Color
.IndexMask
== 0xffffffff)) {
1026 if (mask
& DD_BACK_LEFT_BIT
) {
1027 int color
= c
->visual
->rgb_flag
? c
->ClearColor
: c
->ClearIndex
;
1032 vl_rect(x
, y
, width
, height
, color
);
1035 mask
&= ~DD_BACK_LEFT_BIT
;
1038 unsigned short z
= -1;
1039 int color
= c
->ClearColor
;
1040 if (mask
& DD_DEPTH_BIT
) {
1041 z
= ctx
->Depth
.Clear
* 0xffff;
1044 mga_clear(mask
& DD_FRONT_LEFT_BIT
,
1045 mask
& DD_BACK_LEFT_BIT
,
1046 mask
& DD_DEPTH_BIT
,
1047 0, 0, c
->Buffer
->width
, c
->Buffer
->height
,
1050 mga_clear(mask
& DD_FRONT_LEFT_BIT
,
1051 mask
& DD_BACK_LEFT_BIT
,
1052 mask
& DD_DEPTH_BIT
,
1053 x
, y
, width
, height
,
1056 mask
&= ~(DD_FRONT_LEFT_BIT
| DD_BACK_LEFT_BIT
| DD_DEPTH_BIT
);
1061 _swrast_Clear(ctx
, mask
, all
, x
, y
, width
, height
);
1067 static void set_buffer (GLcontext
*ctx
, GLframebuffer
*colorBuffer
, GLuint bufferBit
)
1070 * XXX todo - examine bufferBit and set read/write pointers
1077 * Return the width and height of the current buffer.
1078 * If anything special has to been done when the buffer/window is
1079 * resized, do it now.
1081 static void get_buffer_size (GLframebuffer
*buffer
, GLuint
*width
, GLuint
*height
)
1083 DMesaBuffer b
= (DMesaBuffer
)buffer
;
1086 *height
= b
->height
;
1091 static const GLubyte
* get_string (GLcontext
*ctx
, GLenum name
)
1095 return (const GLubyte
*)"Mesa DJGPP"
1102 "\0port (c) Borca Daniel feb-2003";
1110 static void finish (GLcontext
*ctx
)
1113 * XXX todo - OPTIONAL FUNCTION: implements glFinish if possible
1119 static void flush (GLcontext
*ctx
)
1122 * XXX todo - OPTIONAL FUNCTION: implements glFlush if possible
1128 /****************************************************************************
1130 ***************************************************************************/
1131 #define DMESA_NEW_LINE (_NEW_LINE | \
1136 _SWRAST_NEW_RASTERMASK)
1138 #define DMESA_NEW_TRIANGLE (_NEW_POLYGON | \
1143 _SWRAST_NEW_RASTERMASK)
1145 /* Extend the software rasterizer with our line and triangle
1148 static void dmesa_register_swrast_functions (GLcontext
*ctx
)
1150 SWcontext
*swrast
= SWRAST_CONTEXT(ctx
);
1152 swrast
->choose_line
= dmesa_choose_line
;
1153 swrast
->choose_triangle
= dmesa_choose_tri
;
1155 swrast
->invalidate_line
|= DMESA_NEW_LINE
;
1156 swrast
->invalidate_triangle
|= DMESA_NEW_TRIANGLE
;
1161 /* Setup pointers and other driver state that is constant for the life
1164 static void dmesa_init_pointers (GLcontext
*ctx
)
1167 struct swrast_device_driver
*dd
= _swrast_GetDeviceDriverReference(ctx
);
1169 ctx
->Driver
.GetString
= get_string
;
1170 ctx
->Driver
.GetBufferSize
= get_buffer_size
;
1171 ctx
->Driver
.Flush
= flush
;
1172 ctx
->Driver
.Finish
= finish
;
1174 /* Software rasterizer pixel paths:
1176 ctx
->Driver
.Accum
= _swrast_Accum
;
1177 ctx
->Driver
.Bitmap
= _swrast_Bitmap
;
1178 ctx
->Driver
.Clear
= clear
;
1179 ctx
->Driver
.ResizeBuffers
= _swrast_alloc_buffers
;
1180 ctx
->Driver
.CopyPixels
= _swrast_CopyPixels
;
1181 ctx
->Driver
.DrawPixels
= _swrast_DrawPixels
;
1182 ctx
->Driver
.ReadPixels
= _swrast_ReadPixels
;
1183 ctx
->Driver
.DrawBuffer
= _swrast_DrawBuffer
;
1185 /* Software texture functions:
1187 ctx
->Driver
.ChooseTextureFormat
= _mesa_choose_tex_format
;
1188 ctx
->Driver
.TexImage1D
= _mesa_store_teximage1d
;
1189 ctx
->Driver
.TexImage2D
= _mesa_store_teximage2d
;
1190 ctx
->Driver
.TexImage3D
= _mesa_store_teximage3d
;
1191 ctx
->Driver
.TexSubImage1D
= _mesa_store_texsubimage1d
;
1192 ctx
->Driver
.TexSubImage2D
= _mesa_store_texsubimage2d
;
1193 ctx
->Driver
.TexSubImage3D
= _mesa_store_texsubimage3d
;
1194 ctx
->Driver
.TestProxyTexImage
= _mesa_test_proxy_teximage
;
1196 ctx
->Driver
.CopyTexImage1D
= _swrast_copy_teximage1d
;
1197 ctx
->Driver
.CopyTexImage2D
= _swrast_copy_teximage2d
;
1198 ctx
->Driver
.CopyTexSubImage1D
= _swrast_copy_texsubimage1d
;
1199 ctx
->Driver
.CopyTexSubImage2D
= _swrast_copy_texsubimage2d
;
1200 ctx
->Driver
.CopyTexSubImage3D
= _swrast_copy_texsubimage3d
;
1202 ctx
->Driver
.CompressedTexImage1D
= _mesa_store_compressed_teximage1d
;
1203 ctx
->Driver
.CompressedTexImage2D
= _mesa_store_compressed_teximage2d
;
1204 ctx
->Driver
.CompressedTexImage3D
= _mesa_store_compressed_teximage3d
;
1205 ctx
->Driver
.CompressedTexSubImage1D
= _mesa_store_compressed_texsubimage1d
;
1206 ctx
->Driver
.CompressedTexSubImage2D
= _mesa_store_compressed_texsubimage2d
;
1207 ctx
->Driver
.CompressedTexSubImage3D
= _mesa_store_compressed_texsubimage3d
;
1209 /* Swrast hooks for imaging extensions:
1211 ctx
->Driver
.CopyColorTable
= _swrast_CopyColorTable
;
1212 ctx
->Driver
.CopyColorSubTable
= _swrast_CopyColorSubTable
;
1213 ctx
->Driver
.CopyConvolutionFilter1D
= _swrast_CopyConvolutionFilter1D
;
1214 ctx
->Driver
.CopyConvolutionFilter2D
= _swrast_CopyConvolutionFilter2D
;
1216 /* Statechange callbacks:
1218 ctx
->Driver
.ClearColor
= clear_color
;
1219 ctx
->Driver
.ClearIndex
= clear_index
;
1221 /* Initialize the TNL driver interface:
1223 tnl
= TNL_CONTEXT(ctx
);
1224 tnl
->Driver
.RunPipeline
= _tnl_run_pipeline
;
1226 dd
->SetBuffer
= set_buffer
;
1228 /* Install swsetup for tnl->Driver.Render.*:
1230 _swsetup_Wakeup(ctx
);
1232 /* The span functions should be in `dmesa_update_state', but I'm
1233 * pretty sure they will never change during the life of the Visual
1236 if (((DMesaContext
)ctx
->DriverCtx
)->visual
->zbuffer
== -1) {
1237 /* Depth span/pixel functions */
1238 dd
->WriteDepthSpan
= write_depth_span
;
1239 dd
->WriteDepthPixels
= write_depth_pixels
;
1240 dd
->ReadDepthSpan
= read_depth_span
;
1241 dd
->ReadDepthPixels
= read_depth_pixels
;
1246 /* Index span/pixel functions */
1247 dd
->WriteCI32Span
= write_index_span
;
1248 dd
->WriteCI8Span
= write_index8_span
;
1249 dd
->WriteMonoCISpan
= write_mono_index_span
;
1250 dd
->WriteCI32Pixels
= write_index_pixels
;
1251 dd
->WriteMonoCIPixels
= write_mono_index_pixels
;
1252 dd
->ReadCI32Span
= read_index_span
;
1253 dd
->ReadCI32Pixels
= read_index_pixels
;
1256 /* RGB(A) span/pixel functions */
1257 dd
->WriteRGBASpan
= write_rgba_span
;
1258 dd
->WriteRGBSpan
= write_rgb_span
;
1259 dd
->WriteMonoRGBASpan
= write_mono_rgba_span
;
1260 dd
->WriteRGBAPixels
= write_rgba_pixels
;
1261 dd
->WriteMonoRGBAPixels
= write_mono_rgba_pixels
;
1262 dd
->ReadRGBASpan
= read_rgba_span
;
1263 dd
->ReadRGBAPixels
= read_rgba_pixels
;
1268 static void dmesa_update_state (GLcontext
*ctx
, GLuint new_state
)
1270 /* Propogate statechange information to swrast and swrast_setup
1271 * modules. The DMesa driver has no internal GL-dependent state.
1273 _swrast_InvalidateState( ctx
, new_state
);
1274 _ac_InvalidateState( ctx
, new_state
);
1275 _tnl_InvalidateState( ctx
, new_state
);
1276 _swsetup_InvalidateState( ctx
, new_state
);
1282 /****************************************************************************
1283 * DMesa Public API Functions
1284 ***************************************************************************/
1287 * The exact arguments to this function will depend on your window system
1289 DMesaVisual
DMesaCreateVisual (GLint width
,
1295 GLboolean alphaFlag
,
1302 GLint redBits
, greenBits
, blueBits
, alphaBits
, indexBits
;
1352 if ((colDepth
=vl_video_init(width
, height
, colDepth
, rgbFlag
, refresh
)) <= 0) {
1356 if (mga_open(width
, height
, colDepth
, dbFlag
? 2 : 1, depthSize
== 16, refresh
) < 0) {
1361 if (alphaFlag
&& (alphaBits
==0)) {
1365 if ((v
=(DMesaVisual
)calloc(1, sizeof(struct dmesa_visual
))) != NULL
) {
1366 /* Create core visual */
1367 v
->gl_visual
= _mesa_create_visual(rgbFlag
, /* rgb */
1369 GL_FALSE
, /* stereo */
1374 indexBits
, /* indexBits */
1377 accumSize
, /* accumRed */
1378 accumSize
, /* accumGreen */
1379 accumSize
, /* accumBlue */
1380 alphaFlag
?accumSize
:0, /* accumAlpha */
1381 1); /* numSamples */
1383 v
->depth
= colDepth
;
1384 v
->db_flag
= dbFlag
;
1385 v
->rgb_flag
= rgbFlag
;
1387 v
->zbuffer
= (depthSize
> 0) ? 1 : 0;
1389 mga_get(MGA_GET_HPIXELS
, &v
->stride_in_pixels
);
1390 if (depthSize
== 16) {
1400 int i
= 0, fx_attrib
[32];
1406 if (dbFlag
) fx_attrib
[i
++] = FXMESA_DOUBLEBUFFER
;
1407 if (depthSize
> 0) { fx_attrib
[i
++] = FXMESA_DEPTH_SIZE
; fx_attrib
[i
++] = depthSize
; }
1408 if (stencilSize
> 0) { fx_attrib
[i
++] = FXMESA_STENCIL_SIZE
; fx_attrib
[i
++] = stencilSize
; }
1409 if (accumSize
> 0) { fx_attrib
[i
++] = FXMESA_ACCUM_SIZE
; fx_attrib
[i
++] = accumSize
; }
1410 if (alphaFlag
) { fx_attrib
[i
++] = FXMESA_ALPHA_SIZE
; fx_attrib
[i
++] = 1; }
1411 fx_attrib
[i
] = FXMESA_NONE
;
1413 return (DMesaVisual
)fxMesaCreateBestContext(-1, width
, height
, fx_attrib
);
1419 void DMesaDestroyVisual (DMesaVisual v
)
1422 _mesa_destroy_visual(v
->gl_visual
);
1432 fxMesaDestroyContext((fxMesaContext
)v
);
1438 DMesaBuffer
DMesaCreateBuffer (DMesaVisual visual
,
1439 GLint xpos
, GLint ypos
,
1440 GLint width
, GLint height
)
1445 if ((b
=(DMesaBuffer
)calloc(1, sizeof(struct dmesa_buffer
))) != NULL
) {
1447 _mesa_initialize_framebuffer(&b
->gl_buffer
,
1449 visual
->zbuffer
== 1,
1450 visual
->gl_visual
->stencilBits
> 0,
1451 visual
->gl_visual
->accumRedBits
> 0,
1452 visual
->gl_visual
->alphaBits
> 0);
1461 return (DMesaBuffer
)visual
;
1467 void DMesaDestroyBuffer (DMesaBuffer b
)
1471 free(b
->the_window
);
1473 _mesa_free_framebuffer_data(&b
->gl_buffer
);
1480 DMesaContext
DMesaCreateContext (DMesaVisual visual
,
1485 GLboolean direct
= GL_FALSE
;
1487 if ((c
=(DMesaContext
)calloc(1, sizeof(struct dmesa_context
))) != NULL
) {
1488 c
->gl_ctx
= _mesa_create_context(visual
->gl_visual
,
1489 share
? share
->gl_ctx
: NULL
,
1492 _mesa_enable_sw_extensions(c
->gl_ctx
);
1493 _mesa_enable_1_3_extensions(c
->gl_ctx
);
1494 _mesa_enable_1_4_extensions(c
->gl_ctx
);
1496 /* you probably have to do a bunch of other initializations here. */
1499 c
->gl_ctx
->Driver
.UpdateState
= dmesa_update_state
;
1501 /* Initialize the software rasterizer and helper modules.
1503 _swrast_CreateContext(c
->gl_ctx
);
1504 _ac_CreateContext(c
->gl_ctx
);
1505 _tnl_CreateContext(c
->gl_ctx
);
1506 _swsetup_CreateContext(c
->gl_ctx
);
1507 if (visual
->rgb_flag
) dmesa_register_swrast_functions(c
->gl_ctx
);
1508 dmesa_init_pointers(c
->gl_ctx
);
1514 return (DMesaContext
)visual
;
1520 void DMesaDestroyContext (DMesaContext c
)
1524 _swsetup_DestroyContext(c
->gl_ctx
);
1525 _swrast_DestroyContext(c
->gl_ctx
);
1526 _tnl_DestroyContext(c
->gl_ctx
);
1527 _ac_DestroyContext(c
->gl_ctx
);
1528 _mesa_destroy_context(c
->gl_ctx
);
1536 GLboolean
DMesaMoveBuffer (GLint xpos
, GLint ypos
)
1538 #if !defined(FX) && !defined(MATROX)
1539 GET_CURRENT_CONTEXT(ctx
);
1540 DMesaBuffer b
= ((DMesaContext
)ctx
->DriverCtx
)->Buffer
;
1542 if (vl_sync_buffer(&b
->the_window
, xpos
, ypos
, b
->width
, b
->height
) != 0) {
1557 GLboolean
DMesaResizeBuffer (GLint width
, GLint height
)
1559 #if !defined(FX) && !defined(MATROX)
1560 GET_CURRENT_CONTEXT(ctx
);
1561 DMesaBuffer b
= ((DMesaContext
)ctx
->DriverCtx
)->Buffer
;
1563 if (vl_sync_buffer(&b
->the_window
, b
->xpos
, b
->ypos
, width
, height
) != 0) {
1579 * Make the specified context and buffer the current one.
1581 GLboolean
DMesaMakeCurrent (DMesaContext c
, DMesaBuffer b
)
1584 if ((c
!= NULL
) && (b
!= NULL
)) {
1586 if (vl_sync_buffer(&b
->the_window
, b
->xpos
, b
->ypos
, b
->width
, b
->height
) != 0) {
1593 _mesa_make_current(c
->gl_ctx
, &b
->gl_buffer
);
1594 if (c
->gl_ctx
->Viewport
.Width
== 0) {
1595 /* initialize viewport to window size */
1596 _mesa_Viewport(0, 0, b
->width
, b
->height
);
1600 _mesa_make_current(NULL
, NULL
);
1604 fxMesaMakeCurrent((fxMesaContext
)c
);
1612 void DMesaSwapBuffers (DMesaBuffer b
)
1614 /* copy/swap back buffer to front if applicable */
1616 GET_CURRENT_CONTEXT(ctx
);
1617 _mesa_notifySwapBuffers(ctx
);
1621 if (((DMesaContext
)ctx
->DriverCtx
)->visual
->db_flag
) {
1626 fxMesaSwapBuffers();
1632 void DMesaSetCI (int ndx
, GLfloat red
, GLfloat green
, GLfloat blue
)
1634 #if !defined(FX) && !defined(MATROX)
1635 vl_setCI(ndx
, red
, green
, blue
);
1641 DMesaContext
DMesaGetCurrentContext (void)
1644 GET_CURRENT_CONTEXT(ctx
);
1645 return (ctx
== NULL
) ? NULL
: (DMesaContext
)ctx
->DriverCtx
;
1647 return (DMesaContext
)fxMesaGetCurrentContext();
1653 int DMesaGetIntegerv (GLenum pname
, GLint
*params
)
1656 GET_CURRENT_CONTEXT(ctx
);
1657 const DMesaContext c
= (ctx
== NULL
) ? NULL
: (DMesaContext
)ctx
->DriverCtx
;
1659 const fxMesaContext c
= fxMesaGetCurrentContext();
1667 case DMESA_GET_SCREEN_SIZE
:
1670 vl_get(VL_GET_SCREEN_SIZE
, params
);
1672 mga_get(MGA_GET_SCREEN_SIZE
, params
);
1675 params
[0] = c
->screen_width
;
1676 params
[1] = c
->screen_height
;
1679 case DMESA_GET_DRIVER_CAPS
:
1682 params
[0] = DMESA_DRIVER_SWDB_BIT
;
1687 params
[0] = DMESA_DRIVER_LLWO_BIT
;