| 1 |
|
| 2 |
/* |
| 3 |
* Linux clgd547x/Mesa interface. |
| 4 |
* |
| 5 |
* v0.1 - Peter McDermott ([email protected]) |
| 6 |
* |
| 7 |
* notes: |
| 8 |
* TODO: texture mapping, stenciling, stippling, fog. (and many more) |
| 9 |
* |
| 10 |
* bugs: |
| 11 |
* see TODOs. Try grepping the source tree for -PFM or TODO to get an |
| 12 |
* idea of things that have changed |
| 13 |
*/ |
| 14 |
|
| 15 |
#ifdef MONDELLO |
| 16 |
|
| 17 |
#include <stdio.h> |
| 18 |
#include <assert.h> |
| 19 |
#include "mondello/clgd547x.h" |
| 20 |
#include "mondello/graphics.h" |
| 21 |
#include "mondello/cmesa.h" |
| 22 |
#include "context.h" |
| 23 |
#include "types.h" |
| 24 |
#include "xform.h" |
| 25 |
|
| 26 |
#include "macros.h" |
| 27 |
#include "vb.h" |
| 28 |
#include "texture.h" |
| 29 |
|
| 30 |
/* #define DEBUG_CMESA */ |
| 31 |
|
| 32 |
|
| 33 |
struct clgd547x_mesa_context { |
| 34 |
|
| 35 |
struct gl_context *glctx; /* the core Mesa context */ |
| 36 |
|
| 37 |
GLint width, height; /* size of color buffer */ |
| 38 |
GLint depth; /* bits per pixel (8,16,24 or 32) */ |
| 39 |
|
| 40 |
GLboolean rgb_flag; /* rgb or ci mode */ |
| 41 |
GLboolean db_flag; /* double buffering avail */ |
| 42 |
|
| 43 |
GLuint index; /* current color index */ |
| 44 |
GLint red,green,blue,alpha; /* current rgb color */ |
| 45 |
GLuint rmult, gmult, bmult, amult; |
| 46 |
|
| 47 |
GLuint pixel; /* 8bpp: white */ |
| 48 |
GLuint clearpixel; /* 8bpp: black */ |
| 49 |
|
| 50 |
GLuint clearr; /* 24bpp: r,g,b triple used to clear buff */ |
| 51 |
GLuint clearg; |
| 52 |
GLuint clearb; |
| 53 |
GLuint cleara; |
| 54 |
|
| 55 |
unsigned long color_table[256]; /* used for dithering in 8pp -TODO: fix */ |
| 56 |
GLubyte red_table[65536]; |
| 57 |
GLubyte blue_table[65536]; |
| 58 |
GLubyte green_table[65536]; |
| 59 |
}; |
| 60 |
|
| 61 |
static clgd547xMesaContext clgd547xMesa = NULL; /* the current context */ |
| 62 |
|
| 63 |
/* taken from xmesaP.h */ |
| 64 |
|
| 65 |
#define _R 5 |
| 66 |
#define _G 9 |
| 67 |
#define _B 5 |
| 68 |
#define _DX 4 |
| 69 |
#define _DY 4 |
| 70 |
#define _D (_DX*_DY) |
| 71 |
|
| 72 |
#define _MIX(r,g,b) (((r)*_G+(g))*_B+(b)) |
| 73 |
#define _DITH0(C,c) (((unsigned)((_D*(C-1)+1)*c)) >> 12) |
| 74 |
#define LOOKUP( R, G, B ) \ |
| 75 |
clgd547xMesa->color_table[_MIX(_DITH0(_R, (R)), \ |
| 76 |
_DITH0(_G, (G)), \ |
| 77 |
_DITH0(_B, (B)))] |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
static points_func choose_points_function( void ); |
| 83 |
static void NULL_points( GLuint first, GLuint last); |
| 84 |
static void size1_rgba_points( GLuint first, GLuint last); |
| 85 |
static void mono_size1_rgba_points( GLuint first, GLuint last); |
| 86 |
static void size1_ci_points( GLuint first, GLuint last); |
| 87 |
static void mono_size1_ci_points( GLuint first, GLuint last); |
| 88 |
static void sizen_rgba_points( GLuint first, GLuint last); |
| 89 |
static void mono_sizen_rgba_points( GLuint first, GLuint last); |
| 90 |
static void sizen_ci_points( GLuint first, GLuint last); |
| 91 |
static void mono_sizen_ci_points( GLuint first, GLuint last); |
| 92 |
|
| 93 |
static line_func choose_line_function( void ); |
| 94 |
static void NULL_line( GLuint v1, GLuint v2, GLuint pv); |
| 95 |
static void size1_rgba_smooth_line(GLuint v1, GLuint v2, GLuint pv); |
| 96 |
static void size1_ci_smooth_line( GLuint v1, GLuint v2, GLuint pv ); |
| 97 |
static void size1_rgba_flat_line( GLuint v1, GLuint v2, GLuint pv); |
| 98 |
static void mono_size1_rgba_flat_line( GLuint v1, GLuint v2, GLuint pv); |
| 99 |
static void size1_ci_flat_line( GLuint v1, GLuint v2, GLuint pv ); |
| 100 |
static void mono_size1_ci_flat_line( GLuint v1, GLuint v2, GLuint pv ); |
| 101 |
static void sizen_line( GLuint v1, GLuint v2, GLuint pv ); |
| 102 |
static void mono_sizen_line( GLuint v1, GLuint v2, GLuint pv ); |
| 103 |
|
| 104 |
static polygon_func choose_polygon_function( void ); |
| 105 |
static void NULL_polygon( GLuint n, GLuint vlist[], GLuint pv); |
| 106 |
static void rgba_smooth_polygon( GLuint n, GLuint vlist[], GLuint pv); |
| 107 |
static void dith_smooth_polygon( GLuint n, GLuint vlist[], GLuint pv); |
| 108 |
static void ci_smooth_polygon( GLuint n, GLuint vlist[], GLuint pv ); |
| 109 |
static void rgba_flat_polygon( GLuint n, GLuint vlist[], GLuint pv); |
| 110 |
static void mono_rgba_flat_polygon( GLuint n, GLuint vlist[], GLuint pv); |
| 111 |
static void dith_flat_polygon( GLuint n, GLuint vlist[], GLuint pv); |
| 112 |
static void ci_flat_polygon( GLuint n, GLuint vlist[], GLuint pv ); |
| 113 |
static void mono_ci_flat_polygon( GLuint n, GLuint vlist[], GLuint pv ); |
| 114 |
|
| 115 |
void alloc_depth_buffer(void); |
| 116 |
void clear_depth_buffer(void); |
| 117 |
void read_depth_span( GLuint n, GLint x, GLint y, GLfloat depth[] ); |
| 118 |
|
| 119 |
void write_index_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 120 |
GLuint index[], GLenum primitive ); |
| 121 |
void write_monoindex_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 122 |
GLuint index, GLenum primitive ); |
| 123 |
void write_color_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 124 |
GLubyte red[], GLubyte green[], |
| 125 |
GLubyte blue[], GLubyte alpha[], |
| 126 |
GLenum primitive ); |
| 127 |
void write_monocolor_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 128 |
GLint r, GLint g, GLint b, GLint a, |
| 129 |
GLenum primitive ); |
| 130 |
void write_texture_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 131 |
GLfloat s[], GLfloat t[], |
| 132 |
GLubyte red[], GLubyte green[], |
| 133 |
GLubyte blue[], GLubyte alpha[], |
| 134 |
GLenum primitive ); |
| 135 |
|
| 136 |
/* |
| 137 |
* Convert Mesa window Y coordinate to VGA screen Y coordinate: |
| 138 |
*/ |
| 139 |
#define FLIP(Y) (clgd547xMesa->height-(Y)-1) |
| 140 |
|
| 141 |
/**********************************************************************/ |
| 142 |
/***** Miscellaneous functions *****/ |
| 143 |
/**********************************************************************/ |
| 144 |
|
| 145 |
/* Taken from XMesa1.c |
| 146 |
* Setup RGB rending for a window with a PseudoColor, StaticColor, |
| 147 |
* GrayScale or StaticGray visual. We try to allocate a palette of 225 |
| 148 |
* colors (5 red, 9 green, 5 blue) and dither to approximate a 24-bit RGB |
| 149 |
* color. While this function was originally designed just for 8-bit |
| 150 |
* visuals, it has also proven to work from 4-bit up to 16-bit visuals. |
| 151 |
* The fact that this method works for gray scale displays depends on |
| 152 |
* XAllocColor allocating a good gray to approximate an RGB color. |
| 153 |
* Dithering code contributed by Bob Mercier. |
| 154 |
*/ |
| 155 |
static int setup_dithered_color( clgd547xMesaContext c ) |
| 156 |
{ |
| 157 |
int r, g, b, i,index; |
| 158 |
GLuint red, blue, green; |
| 159 |
|
| 160 |
index=0; |
| 161 |
|
| 162 |
if (c->depth<4 || c->depth>16) return; |
| 163 |
|
| 164 |
assert( c->depth>=4 && c->depth<=16 ); |
| 165 |
|
| 166 |
/* This is a hack for GLUT: pre-allocate the gray needed for pop-up menus */ |
| 167 |
|
| 168 |
/* Allocate X colors and initialize color_table[], red_table[], etc */ |
| 169 |
for (r = 0; r < _R; r++) { |
| 170 |
for (g = 0; g < _G; g++) { |
| 171 |
for (b = 0; b < _B; b++) { |
| 172 |
red = r * 65535 / (_R-1); |
| 173 |
green = g * 65535 / (_G-1); |
| 174 |
blue = b * 65535 / (_B-1); |
| 175 |
|
| 176 |
i = _MIX( r, g, b ); |
| 177 |
|
| 178 |
clgd547x_setcolorindex(index,red,green,blue); |
| 179 |
|
| 180 |
c->color_table[i]=index; |
| 181 |
c->red_table[index] = r * 255 / (_R-1); |
| 182 |
c->green_table[index] = g * 255 / (_G-1); |
| 183 |
c->blue_table[index] = b * 255 / (_B-1); |
| 184 |
|
| 185 |
index++; |
| 186 |
} |
| 187 |
} |
| 188 |
} |
| 189 |
|
| 190 |
c->rmult = 255; |
| 191 |
c->gmult = 255; |
| 192 |
c->bmult = 255; |
| 193 |
c->amult = 255; |
| 194 |
/* c->dithered_pf = PF_DITHER; |
| 195 |
c->undithered_pf = PF_LOOKUP; */ |
| 196 |
c->pixel = c->color_table[_MIX(_R-1,_G-1,_B-1)]; /* white */ |
| 197 |
c->clearpixel = c->color_table[_MIX(0,0,0)]; /* black */ |
| 198 |
|
| 199 |
return 1; |
| 200 |
} |
| 201 |
|
| 202 |
/* |
| 203 |
* return buffer size information |
| 204 |
*/ |
| 205 |
static void buffer_size( GLuint *width, GLuint *height, GLuint *depth ) |
| 206 |
{ |
| 207 |
int colors; |
| 208 |
|
| 209 |
#ifdef DEBUG_CMESA |
| 210 |
printf("cmesa: buffer_size(...)\n"); |
| 211 |
#endif |
| 212 |
|
| 213 |
*width = clgd547xMesa->width = clgd547x_getxdim(); |
| 214 |
*height = clgd547xMesa->height = clgd547x_getydim(); |
| 215 |
*depth = clgd547xMesa->depth; |
| 216 |
} |
| 217 |
|
| 218 |
/* Set current color index */ |
| 219 |
static void set_index( GLuint index ) |
| 220 |
{ |
| 221 |
#ifdef DEBUG_CMESA |
| 222 |
printf("cmesa: set_index(%d)\n",index); |
| 223 |
#endif |
| 224 |
|
| 225 |
clgd547xMesa->index = index; |
| 226 |
} |
| 227 |
|
| 228 |
|
| 229 |
/* Set current drawing color */ |
| 230 |
static void set_color( GLubyte red, GLubyte green, |
| 231 |
GLubyte blue, GLubyte alpha ) |
| 232 |
{ |
| 233 |
#ifdef DEBUG_CMESA |
| 234 |
printf("cmesa: set_color(%d,%d,%d,%d)\n",red,green,blue,alpha); |
| 235 |
#endif |
| 236 |
|
| 237 |
clgd547xMesa->red = red; |
| 238 |
clgd547xMesa->green = green; |
| 239 |
clgd547xMesa->blue = blue; |
| 240 |
} |
| 241 |
|
| 242 |
/* implements glClearIndex() */ |
| 243 |
static void clear_index( GLuint index ) |
| 244 |
{ |
| 245 |
#ifdef DEBUG_CMESA |
| 246 |
printf("cmesa: clear_index(%d)\n",index); |
| 247 |
#endif |
| 248 |
} |
| 249 |
|
| 250 |
|
| 251 |
/* implements glClearColor() */ |
| 252 |
static void clear_color( GLubyte red, GLubyte green, |
| 253 |
GLubyte blue, GLubyte alpha ) |
| 254 |
{ |
| 255 |
#ifdef DEBUG_CMESA |
| 256 |
printf("cmesa: clear_color(%d,%d,%d,%d)\n",red,green,blue,alpha); |
| 257 |
#endif |
| 258 |
|
| 259 |
clgd547xMesa->clearr=red; |
| 260 |
clgd547xMesa->clearg=green; |
| 261 |
clgd547xMesa->clearb=blue; |
| 262 |
clgd547xMesa->cleara=alpha; |
| 263 |
/* note: clgd5470 doesn't maintain a separate alpha buffer */ |
| 264 |
} |
| 265 |
|
| 266 |
|
| 267 |
static void clear( GLboolean all, |
| 268 |
GLint x, GLint y, GLint width, GLint height ) |
| 269 |
{ |
| 270 |
|
| 271 |
#ifdef DEBUG_CMESA |
| 272 |
printf("cmesa: clear(%d,%d,%d,%d)\n",x,y,width,height); |
| 273 |
#endif |
| 274 |
|
| 275 |
if (clgd547xMesa->depth==8) { |
| 276 |
clear8c(clgd547xMesa->clearpixel); |
| 277 |
} |
| 278 |
else { |
| 279 |
clear24c(clgd547xMesa->clearr,clgd547xMesa->clearg, |
| 280 |
clgd547xMesa->clearb,clgd547xMesa->cleara); |
| 281 |
} |
| 282 |
} |
| 283 |
|
| 284 |
|
| 285 |
static GLboolean index_mask( GLuint mask ) |
| 286 |
{ |
| 287 |
/* TODO */ |
| 288 |
#ifdef DEBUG_CMESA |
| 289 |
printf("cmesa: index_mask(%d)\n",mask); |
| 290 |
#endif |
| 291 |
|
| 292 |
return GL_FALSE; |
| 293 |
} |
| 294 |
|
| 295 |
|
| 296 |
static GLboolean color_mask( GLboolean rmask, GLboolean gmask, |
| 297 |
GLboolean bmask, GLboolean amask) |
| 298 |
{ |
| 299 |
/* TODO */ |
| 300 |
#ifdef DEBUG_CMESA |
| 301 |
printf("cmesa: color_mask(%d,%d,%d,%d)\n",rmask,gmask,bmask,amask); |
| 302 |
#endif |
| 303 |
|
| 304 |
return GL_FALSE; |
| 305 |
} |
| 306 |
|
| 307 |
/* |
| 308 |
* note: logical operations are enabled via glEnable(GL_LOGIC_OP) and |
| 309 |
* are disabled via glDisable(GL_LOGIC_OP); |
| 310 |
*/ |
| 311 |
static GLboolean logicop( GLenum op ) |
| 312 |
{ |
| 313 |
uint mfield; |
| 314 |
|
| 315 |
#ifdef DEBUG_CMESA |
| 316 |
printf("cmesa: logicop(%d)\n",op); |
| 317 |
#endif |
| 318 |
|
| 319 |
#ifdef FALSE_X |
| 320 |
switch (op) { |
| 321 |
case GL_CLEAR: mfield = ALL_ZEROS; break; /* 0 */ |
| 322 |
case GL_SET: mfield = ALL_ONES; break; /* 1 */ |
| 323 |
case GL_COPY: mfield = A_ONLY; break; /* s */ |
| 324 |
case GL_COPY_INVERTED: mfield = ABAR; break; /* !s */ |
| 325 |
case GL_NOOP: mfield = B_ONLY; break; /* d */ |
| 326 |
case GL_INVERT: mfield = BBAR; break; /* !d */ |
| 327 |
case GL_AND: mfield = A_AND_B; break; /* s&d */ |
| 328 |
case GL_NAND: mfield = A_NAND_B; break; /* !(s&d) */ |
| 329 |
case GL_OR: mfield = A_OR_B; break; /* s|d */ |
| 330 |
case GL_NOR: mfield = A_NOR_B; break; /* !(s|d) */ |
| 331 |
case GL_XOR: mfield = A_XOR_B; break; /* s^d */ |
| 332 |
case GL_EQUIV: mfield = A_XNOR_B; break; /* !(s^d) */ |
| 333 |
case GL_AND_REVERSE: mfield = A_AND_BBAR; break; /* s&!d */ |
| 334 |
case GL_AND_INVERTED: mfield = ABAR_AND_B; break; /* !s&d */ |
| 335 |
case GL_OR_REVERSE: mfield = A_OR_BBAR; break; /* s|!d */ |
| 336 |
case GL_OR_INVERTED: mfield = ABAR_OR_B; break; /* !s|d */ |
| 337 |
default: return GL_FALSE; |
| 338 |
} |
| 339 |
|
| 340 |
clgd547x_logicop(mfield); |
| 341 |
#endif |
| 342 |
|
| 343 |
return GL_TRUE; |
| 344 |
} |
| 345 |
|
| 346 |
|
| 347 |
static void dither( GLboolean enable ) |
| 348 |
{ |
| 349 |
/* TODO */ |
| 350 |
|
| 351 |
#ifdef DEBUG_CMESA |
| 352 |
printf("cmesa: dither\n"); |
| 353 |
#endif |
| 354 |
|
| 355 |
/* no-op */ |
| 356 |
} |
| 357 |
|
| 358 |
void set_depth_func(GLenum func) |
| 359 |
{ |
| 360 |
/* Mondello's depth buffer is broken, and wasn't fixed for the revision |
| 361 |
* I (PFM) have. It's possible to work around it, but not fun. The |
| 362 |
* default mode works fine. See mondello/graphics.c, #define FN(z) for |
| 363 |
* an idea of what's taken to fix it |
| 364 |
*/ |
| 365 |
|
| 366 |
#ifdef DEBUG_CMESA |
| 367 |
printf("cmesa: set_depth_func\n"); |
| 368 |
#endif |
| 369 |
|
| 370 |
switch (func) { |
| 371 |
case GL_NEVER: |
| 372 |
case GL_LESS: /* (default) pass if incoming z < stored z */ |
| 373 |
case GL_GEQUAL: |
| 374 |
case GL_LEQUAL: |
| 375 |
case GL_GREATER: |
| 376 |
case GL_NOTEQUAL: |
| 377 |
case GL_EQUAL: |
| 378 |
case GL_ALWAYS: |
| 379 |
CC.NewState |= NEW_RASTER_OPS; |
| 380 |
break; |
| 381 |
default: |
| 382 |
gl_error( GL_INVALID_ENUM, "glDepth.Func" ); |
| 383 |
} |
| 384 |
} |
| 385 |
|
| 386 |
/* |
| 387 |
* set the buffer used in double buffering |
| 388 |
*/ |
| 389 |
static GLboolean set_buffer( GLenum mode ) |
| 390 |
{ |
| 391 |
#ifdef DEBUG_CMESA |
| 392 |
printf("cmesa: set_buffer(%d)\n",mode); |
| 393 |
#endif |
| 394 |
|
| 395 |
if (!clgd547xMesa->db_flag) { |
| 396 |
return GL_FALSE; |
| 397 |
} |
| 398 |
|
| 399 |
if (mode==GL_FRONT) { |
| 400 |
clgd547x_setBuffer(0); |
| 401 |
} |
| 402 |
else if (mode==GL_BACK) { |
| 403 |
clgd547x_setBuffer(1); |
| 404 |
} |
| 405 |
else { |
| 406 |
return GL_FALSE; |
| 407 |
} |
| 408 |
|
| 409 |
return GL_TRUE; |
| 410 |
} |
| 411 |
|
| 412 |
|
| 413 |
/**********************************************************************/ |
| 414 |
/***** Rasterization *****/ |
| 415 |
/**********************************************************************/ |
| 416 |
|
| 417 |
/********************* points ***************************************/ |
| 418 |
/* |
| 419 |
pv is the "provoking vertex". This is the vertex that determines |
| 420 |
the color of flat lines/polygons |
| 421 |
*/ |
| 422 |
|
| 423 |
#define POINT_CLIP(x,y) if (x<0 || x>>CC.BufferWidth || \ |
| 424 |
y<0 || y>>CC.BufferWidth) return; |
| 425 |
|
| 426 |
static points_func choose_points_function( void ) |
| 427 |
{ |
| 428 |
|
| 429 |
#ifdef DEBUG_CMESA |
| 430 |
printf("cmesa: choose_points_function()\n"); |
| 431 |
#endif |
| 432 |
|
| 433 |
if (CC.RenderMode!=GL_RENDER) { |
| 434 |
/* either in selection or feedback mode */ |
| 435 |
return NULL; |
| 436 |
} |
| 437 |
|
| 438 |
if (CC.Texture.Enabled) { |
| 439 |
return NULL_points; /* no texturing yet */ |
| 440 |
} |
| 441 |
|
| 442 |
if (CC.Point.Size==1.0) { |
| 443 |
/* non-texture mapped, size=1 */ |
| 444 |
if (CC.RGBAflag) |
| 445 |
return CC.MonoPixels ? mono_size1_rgba_points : size1_rgba_points; |
| 446 |
else |
| 447 |
return CC.MonoPixels ? mono_size1_ci_points : size1_ci_points; |
| 448 |
} |
| 449 |
else { |
| 450 |
/* non-texture mapped, any size */ |
| 451 |
if (CC.RGBAflag) |
| 452 |
return CC.MonoPixels ? mono_sizen_rgba_points : sizen_rgba_points; |
| 453 |
else |
| 454 |
return CC.MonoPixels ? mono_sizen_ci_points : sizen_ci_points; |
| 455 |
} |
| 456 |
} |
| 457 |
|
| 458 |
/* |
| 459 |
* This function is called to skip drawing points the driver |
| 460 |
* doesn't know how to handle (i.e. texture mapped points) |
| 461 |
*/ |
| 462 |
static void NULL_points( GLuint first, GLuint last) |
| 463 |
{ |
| 464 |
return; |
| 465 |
} |
| 466 |
|
| 467 |
static void mono_size1_rgba_points( GLuint first, GLuint last) |
| 468 |
{ |
| 469 |
GLuint i; |
| 470 |
GLint shift = CC.ColorShift; |
| 471 |
|
| 472 |
#ifdef DEBUG_CMESA |
| 473 |
printf("cmesa: mono_size1_rgba_points(...)\n"); |
| 474 |
#endif |
| 475 |
|
| 476 |
for (i=first;i<=last;i++) { |
| 477 |
if (VB.Unclipped[i]) { |
| 478 |
GLint x, y, z; |
| 479 |
GLint red, green, blue, alpha; |
| 480 |
|
| 481 |
x = (GLint) VB.Win[i][0]; |
| 482 |
y = (GLint) VB.Win[i][1]; |
| 483 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 484 |
|
| 485 |
point24_3c( x, FLIP(y), z, |
| 486 |
clgd547xMesa->red>>shift,clgd547xMesa->green>>shift, |
| 487 |
clgd547xMesa->blue>>shift,clgd547xMesa->alpha>>shift); |
| 488 |
} |
| 489 |
} |
| 490 |
} |
| 491 |
|
| 492 |
static void size1_rgba_points( GLuint first, GLuint last) |
| 493 |
{ |
| 494 |
GLuint i; |
| 495 |
GLint shift = CC.ColorShift; |
| 496 |
|
| 497 |
#ifdef DEBUG_CMESA |
| 498 |
printf("cmesa: size1_rgba_points(...)\n"); |
| 499 |
#endif |
| 500 |
|
| 501 |
for (i=first;i<=last;i++) { |
| 502 |
if (VB.Unclipped[i]) { |
| 503 |
GLint x, y, z; |
| 504 |
GLint red, green, blue, alpha; |
| 505 |
|
| 506 |
x = (GLint) VB.Win[i][0]; |
| 507 |
y = (GLint) VB.Win[i][1]; |
| 508 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 509 |
|
| 510 |
red = VB.Color[i][0] >> shift; |
| 511 |
green = VB.Color[i][1] >> shift; |
| 512 |
blue = VB.Color[i][2] >> shift; |
| 513 |
alpha = VB.Color[i][3] >> shift; |
| 514 |
|
| 515 |
point24_3c( x, FLIP(y), z, red, green, blue, alpha ); |
| 516 |
} |
| 517 |
} |
| 518 |
} |
| 519 |
|
| 520 |
static void mono_size1_ci_points( GLuint first, GLuint last) |
| 521 |
{ |
| 522 |
GLuint i; |
| 523 |
|
| 524 |
#ifdef DEBUG_CMESA |
| 525 |
printf("cmesa: mono_size1_ci_points(...)\n"); |
| 526 |
#endif |
| 527 |
|
| 528 |
for (i=first;i<=last;i++) { |
| 529 |
if (VB.Unclipped[i]) { |
| 530 |
GLint x, y, z; |
| 531 |
GLfloat r,g,b; |
| 532 |
x = (GLint) VB.Win[i][0]; |
| 533 |
y = (GLint) VB.Win[i][1]; |
| 534 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 535 |
point8_3c( x, FLIP(y), z, clgd547xMesa->index ); |
| 536 |
} |
| 537 |
} |
| 538 |
} |
| 539 |
|
| 540 |
static void size1_ci_points( GLuint first, GLuint last) |
| 541 |
{ |
| 542 |
GLuint i; |
| 543 |
|
| 544 |
#ifdef DEBUG_CMESA |
| 545 |
printf("cmesa: size1_ci_points(...)\n"); |
| 546 |
#endif |
| 547 |
|
| 548 |
for (i=first;i<=last;i++) { |
| 549 |
if (VB.Unclipped[i]) { |
| 550 |
GLint x, y, z; |
| 551 |
GLfloat r,g,b; |
| 552 |
x = (GLint) VB.Win[i][0]; |
| 553 |
y = (GLint) VB.Win[i][1]; |
| 554 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 555 |
r = VB.Color[i][0]; |
| 556 |
g = VB.Color[i][1]; |
| 557 |
b = VB.Color[i][2]; |
| 558 |
point8_3c( x, FLIP(y), z, LOOKUP(r,g,b) ); |
| 559 |
} |
| 560 |
} |
| 561 |
} |
| 562 |
|
| 563 |
static void mono_sizen_rgba_points( GLuint first, GLuint last) |
| 564 |
{ |
| 565 |
GLuint i; |
| 566 |
GLint isize; |
| 567 |
|
| 568 |
#ifdef DEBUG_CMESA |
| 569 |
printf("cmesa: mono_sizen_rgba_points(...)\n"); |
| 570 |
#endif |
| 571 |
|
| 572 |
isize = (GLint) (CLAMP(CC.Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); |
| 573 |
|
| 574 |
for (i=first;i<=last;i++) { |
| 575 |
if (VB.Unclipped[i]) { |
| 576 |
GLint x, y, z; |
| 577 |
GLint x0, x1, y0, y1; |
| 578 |
GLint ix, iy; |
| 579 |
|
| 580 |
x = (GLint) VB.Win[i][0]; |
| 581 |
y = FLIP((GLint) VB.Win[i][1]); |
| 582 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 583 |
|
| 584 |
if (isize&1) { |
| 585 |
/* odd size */ |
| 586 |
x0 = x - isize/2; |
| 587 |
x1 = x + isize/2; |
| 588 |
y0 = y - isize/2; |
| 589 |
y1 = y + isize/2; |
| 590 |
} |
| 591 |
else { |
| 592 |
/* even size */ |
| 593 |
x0 = (GLint) (x + 0.5F) - isize/2; |
| 594 |
x1 = x0 + isize-1; |
| 595 |
y0 = (GLint) (y + 0.5F) - isize/2; |
| 596 |
y1 = y0 + isize-1; |
| 597 |
} |
| 598 |
|
| 599 |
clearArea24_3c( x0, y0, x1, y1, z, |
| 600 |
clgd547xMesa->red, |
| 601 |
clgd547xMesa->green, |
| 602 |
clgd547xMesa->blue, |
| 603 |
clgd547xMesa->alpha); |
| 604 |
} |
| 605 |
} |
| 606 |
} |
| 607 |
|
| 608 |
static void sizen_rgba_points( GLuint first, GLuint last) |
| 609 |
{ |
| 610 |
GLuint i; |
| 611 |
GLint isize; |
| 612 |
GLint shift = CC.ColorShift; |
| 613 |
|
| 614 |
#ifdef DEBUG_CMESA |
| 615 |
printf("cmesa: sizen_rgba_points(...)\n"); |
| 616 |
#endif |
| 617 |
|
| 618 |
isize = (GLint) (CLAMP(CC.Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); |
| 619 |
|
| 620 |
for (i=first;i<=last;i++) { |
| 621 |
if (VB.Unclipped[i]) { |
| 622 |
GLint x, y, z; |
| 623 |
GLint x0, x1, y0, y1; |
| 624 |
GLint ix, iy; |
| 625 |
|
| 626 |
x = (GLint) VB.Win[i][0]; |
| 627 |
y = FLIP((GLint) VB.Win[i][1]); |
| 628 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 629 |
|
| 630 |
if (isize&1) { |
| 631 |
/* odd size */ |
| 632 |
x0 = x - isize/2; |
| 633 |
x1 = x + isize/2; |
| 634 |
y0 = y - isize/2; |
| 635 |
y1 = y + isize/2; |
| 636 |
} |
| 637 |
else { |
| 638 |
/* even size */ |
| 639 |
x0 = (GLint) (x + 0.5F) - isize/2; |
| 640 |
x1 = x0 + isize-1; |
| 641 |
y0 = (GLint) (y + 0.5F) - isize/2; |
| 642 |
y1 = y0 + isize-1; |
| 643 |
} |
| 644 |
|
| 645 |
clearArea24_3c( x0, y0, x1, y1, z, |
| 646 |
VB.Color[i][0] >> shift, |
| 647 |
VB.Color[i][1] >> shift, |
| 648 |
VB.Color[i][2] >> shift, |
| 649 |
VB.Color[i][3] >> shift ); |
| 650 |
} |
| 651 |
} |
| 652 |
} |
| 653 |
|
| 654 |
static void mono_sizen_ci_points( GLuint first, GLuint last) |
| 655 |
{ |
| 656 |
GLuint i; |
| 657 |
GLint isize; |
| 658 |
|
| 659 |
#ifdef DEBUG_CMESA |
| 660 |
printf("cmesa: mono_sizen_ci_points(...)\n"); |
| 661 |
#endif |
| 662 |
|
| 663 |
isize = (GLint) (CLAMP(CC.Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); |
| 664 |
|
| 665 |
for (i=first;i<=last;i++) { |
| 666 |
if (VB.Unclipped[i]) { |
| 667 |
GLint x, y, z; |
| 668 |
GLint x0, x1, y0, y1; |
| 669 |
GLint ix, iy; |
| 670 |
|
| 671 |
x = (GLint) VB.Win[i][0]; |
| 672 |
y = FLIP((GLint) VB.Win[i][1]); |
| 673 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 674 |
|
| 675 |
if (isize&1) { |
| 676 |
/* odd size */ |
| 677 |
x0 = x - isize/2; |
| 678 |
x1 = x + isize/2; |
| 679 |
y0 = y - isize/2; |
| 680 |
y1 = y + isize/2; |
| 681 |
} |
| 682 |
else { |
| 683 |
/* even size */ |
| 684 |
x0 = (GLint) (x + 0.5F) - isize/2; |
| 685 |
x1 = x0 + isize-1; |
| 686 |
y0 = (GLint) (y + 0.5F) - isize/2; |
| 687 |
y1 = y0 + isize-1; |
| 688 |
} |
| 689 |
|
| 690 |
clearArea8_3c( x0, y0, x1, y1, z, clgd547xMesa->index); |
| 691 |
} |
| 692 |
} |
| 693 |
} |
| 694 |
|
| 695 |
static void sizen_ci_points( GLuint first, GLuint last) |
| 696 |
{ |
| 697 |
GLuint i; |
| 698 |
GLint isize; |
| 699 |
GLint shift = CC.ColorShift; |
| 700 |
|
| 701 |
#ifdef DEBUG_CMESA |
| 702 |
printf("cmesa: sizen_ci_points(...)\n"); |
| 703 |
#endif |
| 704 |
|
| 705 |
isize = (GLint) (CLAMP(CC.Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); |
| 706 |
|
| 707 |
for (i=first;i<=last;i++) { |
| 708 |
if (VB.Unclipped[i]) { |
| 709 |
GLint x, y, z; |
| 710 |
GLint x0, x1, y0, y1; |
| 711 |
GLint ix, iy; |
| 712 |
|
| 713 |
x = (GLint) VB.Win[i][0]; |
| 714 |
y = FLIP((GLint) VB.Win[i][1]); |
| 715 |
z = (GLint) (VB.Win[i][2] * DEPTH_SCALE); |
| 716 |
|
| 717 |
if (isize&1) { |
| 718 |
/* odd size */ |
| 719 |
x0 = x - isize/2; |
| 720 |
x1 = x + isize/2; |
| 721 |
y0 = y - isize/2; |
| 722 |
y1 = y + isize/2; |
| 723 |
} |
| 724 |
else { |
| 725 |
/* even size */ |
| 726 |
x0 = (GLint) (x + 0.5F) - isize/2; |
| 727 |
x1 = x0 + isize-1; |
| 728 |
y0 = (GLint) (y + 0.5F) - isize/2; |
| 729 |
y1 = y0 + isize-1; |
| 730 |
} |
| 731 |
|
| 732 |
clearArea8_3c( x0, y0, x1, y1, z, VB.Index[i]); |
| 733 |
} |
| 734 |
} |
| 735 |
} |
| 736 |
|
| 737 |
/********************* lines ***************************************/ |
| 738 |
static line_func choose_line_function( void ) |
| 739 |
{ |
| 740 |
line_func t; |
| 741 |
|
| 742 |
#ifdef DEBUG_CMESA |
| 743 |
printf("cmesa: choose_line_function()\n"); |
| 744 |
#endif |
| 745 |
|
| 746 |
if (CC.RenderMode!=GL_RENDER) { |
| 747 |
/* either in selection or feedback mode */ |
| 748 |
return NULL; |
| 749 |
} |
| 750 |
|
| 751 |
if (CC.Texture.Enabled) { |
| 752 |
return NULL_line; /* texturing isn't supported */ |
| 753 |
} |
| 754 |
|
| 755 |
/* non-texture mapped lines */ |
| 756 |
if (CC.Line.SmoothFlag) { |
| 757 |
/* smooth shaded */ |
| 758 |
t=CC.RGBAflag ? size1_rgba_smooth_line : size1_ci_smooth_line; |
| 759 |
} |
| 760 |
else { |
| 761 |
/* flat shaded */ |
| 762 |
if (CC.RGBAflag) |
| 763 |
t=CC.MonoPixels ? mono_size1_rgba_flat_line : size1_rgba_flat_line; |
| 764 |
else |
| 765 |
t=CC.MonoPixels ? mono_size1_ci_flat_line : size1_ci_flat_line; |
| 766 |
} |
| 767 |
|
| 768 |
if (CC.Line.Width!=1.0) { |
| 769 |
CC.LineFunc2=t; /* flat/smooth line func called inside sizen_line */ |
| 770 |
return sizen_line; |
| 771 |
} |
| 772 |
return t; |
| 773 |
} |
| 774 |
|
| 775 |
/* |
| 776 |
* this function is called for lines that aren't supported by the |
| 777 |
* driver (i.e. texturing) |
| 778 |
*/ |
| 779 |
static void NULL_line(GLuint v1, GLuint v2, GLuint pv) |
| 780 |
{ |
| 781 |
return; |
| 782 |
} |
| 783 |
|
| 784 |
static void size1_rgba_smooth_line(GLuint v1, GLuint v2, GLuint pv) |
| 785 |
{ |
| 786 |
|
| 787 |
#ifdef DEBUG_CMESA |
| 788 |
printf("cmesa: size1_rgba_smooth_line(...)\n"); |
| 789 |
#endif |
| 790 |
|
| 791 |
line24_3s((uint)VB.Win[v1][0],FLIP((uint)VB.Win[v1][1]),(uint)(VB.Win[v1][2]*DEPTH_SCALE), |
| 792 |
(uint)VB.Color[v1][0],(uint)VB.Color[v1][1],(uint)VB.Color[v1][2],(uint)VB.Color[v1][3], |
| 793 |
(uint)VB.Win[v2][0],FLIP((uint)VB.Win[v2][1]),(uint)(VB.Win[v2][2]*DEPTH_SCALE), |
| 794 |
(uint)VB.Color[v2][0],(uint)VB.Color[v2][1],(uint)VB.Color[v2][2],(uint)VB.Color[v2][3]); |
| 795 |
|
| 796 |
} |
| 797 |
|
| 798 |
static void size1_ci_smooth_line( GLuint v1, GLuint v2, GLuint pv ) |
| 799 |
{ |
| 800 |
|
| 801 |
#ifdef DEBUG_CMESA |
| 802 |
printf("cmesa: size1_ci_smooth_line(...)\n"); |
| 803 |
#endif |
| 804 |
|
| 805 |
line8_3s((uint)VB.Win[v1][0],FLIP((uint)VB.Win[v1][1]), |
| 806 |
(uint)(VB.Win[v1][2]*DEPTH_SCALE),(uint)VB.Index[v1], |
| 807 |
(uint)VB.Win[v2][0],FLIP((uint)VB.Win[v2][1]), |
| 808 |
(uint)(VB.Win[v2][2]*DEPTH_SCALE),(uint)VB.Index[v2]); |
| 809 |
|
| 810 |
} |
| 811 |
|
| 812 |
static void mono_size1_rgba_flat_line( GLuint v1, GLuint v2, GLuint pv) |
| 813 |
{ |
| 814 |
|
| 815 |
#ifdef DEBUG_CMESA |
| 816 |
printf("cmesa: mono_size1_rgba_flat_line(...)\n"); |
| 817 |
#endif |
| 818 |
|
| 819 |
line24_3fc((uint)VB.Win[v1][0],FLIP((uint)VB.Win[v1][1]),(uint)(VB.Win[v1][2]*DEPTH_SCALE), |
| 820 |
(uint)VB.Win[v2][0],FLIP((uint)VB.Win[v2][1]),(uint)(VB.Win[v2][2]*DEPTH_SCALE), |
| 821 |
clgd547xMesa->red,clgd547xMesa->green, |
| 822 |
clgd547xMesa->blue,clgd547xMesa->alpha); |
| 823 |
|
| 824 |
} |
| 825 |
|
| 826 |
static void size1_rgba_flat_line( GLuint v1, GLuint v2, GLuint pv) |
| 827 |
{ |
| 828 |
|
| 829 |
#ifdef DEBUG_CMESA |
| 830 |
printf("cmesa: size1_rgba_flat_line(...)\n"); |
| 831 |
#endif |
| 832 |
|
| 833 |
line24_3fc((uint)VB.Win[v1][0],FLIP((uint)VB.Win[v1][1]),(uint)(VB.Win[v1][2]*DEPTH_SCALE), |
| 834 |
(uint)VB.Win[v2][0],FLIP((uint)VB.Win[v2][1]),(uint)(VB.Win[v2][2]*DEPTH_SCALE), |
| 835 |
(uint)VB.Color[pv][0],(uint)VB.Color[pv][1], |
| 836 |
(uint)VB.Color[pv][2],(uint)VB.Color[pv][3]); |
| 837 |
|
| 838 |
} |
| 839 |
|
| 840 |
static void mono_size1_ci_flat_line( GLuint v1, GLuint v2, GLuint pv ) |
| 841 |
{ |
| 842 |
|
| 843 |
#ifdef DEBUG_CMESA |
| 844 |
printf("cmesa: mono_size1_ci_flat_line(...)\n"); |
| 845 |
#endif |
| 846 |
|
| 847 |
line8_3fc((uint)VB.Win[v1][0],FLIP((uint)VB.Win[v1][1]),(uint)(VB.Win[v1][2]*DEPTH_SCALE), |
| 848 |
(uint)VB.Win[v2][0],FLIP((uint)VB.Win[v2][1]),(uint)(VB.Win[v2][2]*DEPTH_SCALE), |
| 849 |
clgd547xMesa->index); |
| 850 |
|
| 851 |
} |
| 852 |
|
| 853 |
static void size1_ci_flat_line( GLuint v1, GLuint v2, GLuint pv ) |
| 854 |
{ |
| 855 |
|
| 856 |
#ifdef DEBUG_CMESA |
| 857 |
printf("cmesa: size1_ci_flat_line(...)\n"); |
| 858 |
#endif |
| 859 |
|
| 860 |
line8_3fc((uint)VB.Win[v1][0],FLIP((uint)VB.Win[v1][1]),(uint)(VB.Win[v1][2]*DEPTH_SCALE), |
| 861 |
(uint)VB.Win[v2][0],FLIP((uint)VB.Win[v2][1]),(uint)(VB.Win[v2][2]*DEPTH_SCALE), |
| 862 |
(uint)VB.Index[pv]); |
| 863 |
|
| 864 |
} |
| 865 |
|
| 866 |
static void sizen_line(GLuint v1, GLuint v2, GLuint pv) |
| 867 |
{ |
| 868 |
GLint width, w0, wi, s1, s2; |
| 869 |
GLint x1, y1, x2, y2; |
| 870 |
|
| 871 |
#ifdef DEBUG_CMESA |
| 872 |
printf("cmesa: sizen_line(...)\n"); |
| 873 |
#endif |
| 874 |
|
| 875 |
x1=VB.Win[v1][0]; |
| 876 |
y1=VB.Win[v1][1]; |
| 877 |
x2=VB.Win[v2][0]; |
| 878 |
y2=VB.Win[v2][1]; |
| 879 |
|
| 880 |
/* calculate width */ |
| 881 |
width = (GLint) CLAMP( CC.Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); |
| 882 |
w0 = -width / 2; |
| 883 |
|
| 884 |
if ( ABSI(y2-y1) < ABSI(x2-x1) ) { /* dx < dy */ |
| 885 |
/* Y-major: duplicate pixels in X direction */ |
| 886 |
|
| 887 |
/* should the vertices be invariant? -PFM */ |
| 888 |
VB.Win[v1][0]-=w0; |
| 889 |
VB.Win[v2][0]-=w0; |
| 890 |
for (wi=0;wi<width;wi++) { |
| 891 |
CC.LineFunc2(v1,v2,pv); |
| 892 |
VB.Win[v1][0]++; |
| 893 |
VB.Win[v2][0]++; |
| 894 |
} |
| 895 |
|
| 896 |
VB.Win[v1][0]=x1; |
| 897 |
VB.Win[v2][0]=x2; |
| 898 |
} |
| 899 |
else { /* dx > dy */ |
| 900 |
/* X-major: duplicate pixels in Y direction */ |
| 901 |
/* should the verices be invariant? -PFM */ |
| 902 |
|
| 903 |
VB.Win[v1][1]-=w0; |
| 904 |
VB.Win[v2][1]-=w0; |
| 905 |
for (wi=0;wi<width;wi++) { |
| 906 |
CC.LineFunc2(v1,v2,pv); |
| 907 |
VB.Win[v1][1]++; |
| 908 |
VB.Win[v2][1]++; |
| 909 |
} |
| 910 |
|
| 911 |
VB.Win[v1][1]=y1; |
| 912 |
VB.Win[v2][1]=y2; |
| 913 |
} |
| 914 |
} |
| 915 |
|
| 916 |
/********************* polygons ***************************************/ |
| 917 |
static polygon_func choose_polygon_function( void ) |
| 918 |
{ |
| 919 |
|
| 920 |
#ifdef DEBUG_CMESA |
| 921 |
printf("cmesa: choose_polygon_function(...)\n"); |
| 922 |
#endif |
| 923 |
|
| 924 |
if (CC.RenderMode!=GL_RENDER) { |
| 925 |
/* either in selection or feedback mode */ |
| 926 |
return NULL; |
| 927 |
} |
| 928 |
|
| 929 |
if (CC.Texture.Enabled) { |
| 930 |
return NULL_polygon; /* texturing isn't supported */ |
| 931 |
} |
| 932 |
|
| 933 |
if (CC.Light.ShadeModel==GL_SMOOTH) { |
| 934 |
/* smooth shaded, no texturing */ |
| 935 |
if (clgd547xMesa->depth==8) |
| 936 |
return CC.RGBAflag ? dith_smooth_polygon : ci_smooth_polygon; |
| 937 |
else |
| 938 |
return rgba_smooth_polygon; |
| 939 |
} |
| 940 |
else { |
| 941 |
/* flat shaded, no texturing */ |
| 942 |
if (clgd547xMesa->depth==8) { |
| 943 |
if (CC.RGBAflag) /* 8bpp dithered */ |
| 944 |
return dith_flat_polygon; |
| 945 |
else |
| 946 |
return CC.MonoPixels ? mono_ci_flat_polygon : ci_flat_polygon; |
| 947 |
} |
| 948 |
else { |
| 949 |
return CC.MonoPixels ? mono_rgba_flat_polygon : rgba_flat_polygon; |
| 950 |
} |
| 951 |
} |
| 952 |
} |
| 953 |
|
| 954 |
/* |
| 955 |
* this function is called for polygons we don't support (i.e. textures) |
| 956 |
*/ |
| 957 |
static void NULL_polygon( GLuint n, GLuint vlist[], GLuint pv) |
| 958 |
{ |
| 959 |
return; |
| 960 |
} |
| 961 |
|
| 962 |
static void rgba_smooth_polygon( GLuint n, GLuint vlist[], GLuint pv) |
| 963 |
{ |
| 964 |
int v; |
| 965 |
|
| 966 |
#ifdef DEBUG_CMESA |
| 967 |
printf("cmesa: rgba_smooth_polygon(...)\n"); |
| 968 |
#endif |
| 969 |
|
| 970 |
if (n<3) |
| 971 |
return; |
| 972 |
|
| 973 |
for(v=0; v <= n-3; v++) { |
| 974 |
#define v0 vlist[0] |
| 975 |
#define v1 vlist[v+1] |
| 976 |
#define v2 vlist[v+2] |
| 977 |
|
| 978 |
triangle24_3sv(v0,v1,v2); |
| 979 |
} |
| 980 |
} |
| 981 |
|
| 982 |
static void dith_smooth_polygon( GLuint n, GLuint vlist[], GLuint pv ) |
| 983 |
{ |
| 984 |
int v; |
| 985 |
|
| 986 |
#define SHIFT CC.ColorShift |
| 987 |
|
| 988 |
#ifdef DEBUG_CMESA |
| 989 |
printf("cmesa: dith_smooth_polygon()\n"); |
| 990 |
#endif |
| 991 |
|
| 992 |
if (n<3) |
| 993 |
return; |
| 994 |
|
| 995 |
for(v=0; v <= n-3; v++) { |
| 996 |
triangle8_3sv(v0,v1,v2); |
| 997 |
} |
| 998 |
} |
| 999 |
|
| 1000 |
static void ci_smooth_polygon( GLuint n, GLuint vlist[], GLuint pv ) |
| 1001 |
{ |
| 1002 |
int v; |
| 1003 |
|
| 1004 |
#ifdef DEBUG_CMESA |
| 1005 |
printf("cmesa: ci_smooth_polygon(%d,%d,%d)\n", |
| 1006 |
VB.Index[v0],VB.Index[v1],VB.Index[v2]); |
| 1007 |
#endif |
| 1008 |
|
| 1009 |
if (n<3) |
| 1010 |
return; |
| 1011 |
|
| 1012 |
for(v=0; v <= n-3; v++) { |
| 1013 |
triangle8_3sv(v0,v1,v2); |
| 1014 |
} |
| 1015 |
} |
| 1016 |
|
| 1017 |
static void mono_rgba_flat_polygon( GLuint n, GLuint vlist[], GLuint pv) |
| 1018 |
{ |
| 1019 |
int v; |
| 1020 |
|
| 1021 |
#ifdef DEBUG_CMESA |
| 1022 |
printf("cmesa: mono_rgba_flat_polygon(...)\n"); |
| 1023 |
#endif |
| 1024 |
|
| 1025 |
for(v=0; v <= n-3; v++) { |
| 1026 |
triangle24_3fcv(v0,v1,v2,pv); |
| 1027 |
} |
| 1028 |
} |
| 1029 |
|
| 1030 |
static void rgba_flat_polygon( GLuint n, GLuint vlist[], GLuint pv) |
| 1031 |
{ |
| 1032 |
int v; |
| 1033 |
|
| 1034 |
#ifdef DEBUG_CMESA |
| 1035 |
printf("cmesa: rgba_flat_polygon(...)\n"); |
| 1036 |
#endif |
| 1037 |
|
| 1038 |
for(v=0; v <= n-3; v++) { |
| 1039 |
triangle24_3fcv(v0,v1,v2,pv); |
| 1040 |
} |
| 1041 |
} |
| 1042 |
|
| 1043 |
static void dith_flat_polygon( GLuint n, GLuint vlist[], GLuint pv) |
| 1044 |
{ |
| 1045 |
int v; |
| 1046 |
|
| 1047 |
#ifdef DEBUG_CMESA |
| 1048 |
printf("cmesa: dith_flat_polygon(...)\n"); |
| 1049 |
#endif |
| 1050 |
|
| 1051 |
for(v=0; v <= n-3; v++) { |
| 1052 |
triangle8_3fcv(v0,v1,v2,pv); |
| 1053 |
} |
| 1054 |
} |
| 1055 |
|
| 1056 |
static void mono_ci_flat_polygon(GLuint n, GLuint vlist[], GLuint pv ) |
| 1057 |
{ |
| 1058 |
int v; |
| 1059 |
|
| 1060 |
#ifdef DEBUG_CMESA |
| 1061 |
printf("cmesa: mono_ci_flat_polygon(%d,%d,%d)\n",VB.Color[pv][0],VB.Color[pv][1],VB.Color[pv][2]); |
| 1062 |
#endif |
| 1063 |
|
| 1064 |
for(v=0; v <= n-3; v++) { |
| 1065 |
triangle8_3fcv(v0,v1,v2,pv); |
| 1066 |
} |
| 1067 |
} |
| 1068 |
|
| 1069 |
|
| 1070 |
static void ci_flat_polygon( GLuint n, GLuint vlist[], GLuint pv ) |
| 1071 |
{ |
| 1072 |
int v; |
| 1073 |
|
| 1074 |
#ifdef DEBUG_CMESA |
| 1075 |
printf("cmesa: ci_flat_polygon(%d,%d,%d)\n",VB.Color[pv][0],VB.Color[pv][1],VB.Color[pv][2]); |
| 1076 |
#endif |
| 1077 |
|
| 1078 |
for(v=0; v <= n-3; v++) { |
| 1079 |
triangle8_3fcv(v0,v1,v2,pv); |
| 1080 |
} |
| 1081 |
} |
| 1082 |
|
| 1083 |
/**************** 3D depth buffer functions *******************************/ |
| 1084 |
|
| 1085 |
/* this is a no-op, since the z-buffer is in hardware */ |
| 1086 |
void alloc_depth_buffer( void ) |
| 1087 |
{ |
| 1088 |
#ifdef DEBUG_CMESA |
| 1089 |
printf("cmesa: alloc_depth_buffer()\n"); |
| 1090 |
#endif |
| 1091 |
} |
| 1092 |
|
| 1093 |
void read_depth_span( GLuint n, GLint x, GLint y, GLfloat depth[] ) |
| 1094 |
{ |
| 1095 |
#ifdef DEBUG_CMESA |
| 1096 |
printf("cmesa: read_depth_span()\n"); |
| 1097 |
#endif |
| 1098 |
} |
| 1099 |
|
| 1100 |
/***************** 3D span functions **************************************/ |
| 1101 |
|
| 1102 |
void write_index_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 1103 |
GLuint index[], GLenum primitive ) |
| 1104 |
{ |
| 1105 |
#ifdef DEBUG_CMESA |
| 1106 |
printf("cmesa: write_index_span_z()\n"); |
| 1107 |
#endif |
| 1108 |
} |
| 1109 |
|
| 1110 |
void write_monoindex_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 1111 |
GLuint index, GLenum primitive ) |
| 1112 |
{ |
| 1113 |
#ifdef DEBUG_CMESA |
| 1114 |
printf("cmesa: write_monoindex_span_z()\n"); |
| 1115 |
#endif |
| 1116 |
} |
| 1117 |
|
| 1118 |
void write_color_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 1119 |
GLubyte red[], GLubyte green[], |
| 1120 |
GLubyte blue[], GLubyte alpha[], |
| 1121 |
GLenum primitive ) |
| 1122 |
{ |
| 1123 |
#ifdef DEBUG_CMESA |
| 1124 |
printf("cmesa: write_color_span_z()\n"); |
| 1125 |
#endif |
| 1126 |
} |
| 1127 |
|
| 1128 |
void write_monocolor_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 1129 |
GLint r, GLint g, GLint b, GLint a, |
| 1130 |
GLenum primitive ) |
| 1131 |
{ |
| 1132 |
#ifdef DEBUG_CMESA |
| 1133 |
printf("cmesa: write_monocolor_span_z()\n"); |
| 1134 |
#endif |
| 1135 |
} |
| 1136 |
|
| 1137 |
void write_texture_span_z( GLuint n, GLint x, GLint y, GLdepth z[], |
| 1138 |
GLfloat s[], GLfloat t[], |
| 1139 |
GLubyte red[], GLubyte green[], |
| 1140 |
GLubyte blue[], GLubyte alpha[], |
| 1141 |
GLenum primitive ) |
| 1142 |
{ |
| 1143 |
#ifdef DEBUG_CMESA |
| 1144 |
printf("cmesa: write_texture_span_z(...)\n"); |
| 1145 |
#endif |
| 1146 |
} |
| 1147 |
|
| 1148 |
/**********************************************************************/ |
| 1149 |
/***** Write spans of pixels *****/ |
| 1150 |
/**********************************************************************/ |
| 1151 |
|
| 1152 |
|
| 1153 |
static void write_index_span( GLuint n, GLint x, GLint y, |
| 1154 |
const GLuint index[], |
| 1155 |
const GLubyte mask[] ) |
| 1156 |
{ |
| 1157 |
int i; |
| 1158 |
|
| 1159 |
|
| 1160 |
#ifdef DEBUG_CMESA |
| 1161 |
printf("cmesa: write_index_span(...)\n"); |
| 1162 |
#endif |
| 1163 |
|
| 1164 |
y = FLIP(y); |
| 1165 |
for (i=0;i<n;i++,x++) { |
| 1166 |
if (mask[i]) { |
| 1167 |
/* clgd547x_setcolor( index[i] ); |
| 1168 |
clgd547x_drawpixel( x, y ); |
| 1169 |
*/ |
| 1170 |
} |
| 1171 |
} |
| 1172 |
} |
| 1173 |
|
| 1174 |
static void write_monoindex_span(GLuint n,GLint x,GLint y,const GLubyte mask[]) |
| 1175 |
{ |
| 1176 |
int i; |
| 1177 |
|
| 1178 |
#ifdef DEBUG_CMESA |
| 1179 |
printf("cmesa: write_monoindex_span(...)\n"); |
| 1180 |
#endif |
| 1181 |
|
| 1182 |
y = FLIP(y); |
| 1183 |
/* use current color index */ |
| 1184 |
for (i=0;i<n;i++,x++) { |
| 1185 |
if (mask[i]) { |
| 1186 |
/* clgd547x_drawpixel( x, y, clgd547xMesa->index ); */ |
| 1187 |
} |
| 1188 |
|
| 1189 |
} |
| 1190 |
} |
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 |
static void write_color_span( GLuint n, GLint x, GLint y, |
| 1195 |
const GLubyte red[], const GLubyte green[], |
| 1196 |
const GLubyte blue[], const GLubyte alpha[], |
| 1197 |
const GLubyte mask[] ) |
| 1198 |
{ |
| 1199 |
int i; |
| 1200 |
|
| 1201 |
#ifdef DEBUG_CMESA |
| 1202 |
printf("cmesa: write_color_span(...)\n"); |
| 1203 |
#endif |
| 1204 |
|
| 1205 |
y=FLIP(y); |
| 1206 |
if (mask) { |
| 1207 |
/* draw some pixels */ |
| 1208 |
for (i=0; i<n; i++, x++) { |
| 1209 |
if (mask[i]) { |
| 1210 |
/* clgd547x_drawpixel( x, y, red[i], green[i], blue[i]); |
| 1211 |
*/ |
| 1212 |
} |
| 1213 |
} |
| 1214 |
} |
| 1215 |
else { |
| 1216 |
/* draw all pixels */ |
| 1217 |
for (i=0; i<n; i++, x++) { |
| 1218 |
/* clgd547x_drawpixel( x, y, red[i], green[i], blue[i]); |
| 1219 |
*/ |
| 1220 |
} |
| 1221 |
} |
| 1222 |
} |
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
static void write_monocolor_span( GLuint n, GLint x, GLint y, |
| 1227 |
const GLubyte mask[]) |
| 1228 |
{ |
| 1229 |
int i; |
| 1230 |
|
| 1231 |
#ifdef DEBUG_CMESA |
| 1232 |
printf("cmesa: write_monocolor_span(...)\n"); |
| 1233 |
#endif |
| 1234 |
|
| 1235 |
y=FLIP(y); |
| 1236 |
/* use current rgb color */ |
| 1237 |
for (i=0; i<n; i++, x++) { |
| 1238 |
/* if (mask[i]) { |
| 1239 |
clgd547x_drawpixel( x, y, |
| 1240 |
clgd547xMesa->red, clgd547xMesa->green,clgd547xMesa->blue ); |
| 1241 |
} |
| 1242 |
*/ |
| 1243 |
} |
| 1244 |
} |
| 1245 |
|
| 1246 |
|
| 1247 |
|
| 1248 |
/**********************************************************************/ |
| 1249 |
/***** Read spans of pixels *****/ |
| 1250 |
/**********************************************************************/ |
| 1251 |
|
| 1252 |
|
| 1253 |
static void read_index_span( GLuint n, GLint x, GLint y, GLuint index[]) |
| 1254 |
{ |
| 1255 |
int i; |
| 1256 |
|
| 1257 |
#ifdef DEBUG_CMESA |
| 1258 |
printf("cmesa: read_index_span()\n"); |
| 1259 |
#endif |
| 1260 |
|
| 1261 |
y = FLIP(y); |
| 1262 |
for (i=0; i<n; i++,x++) { |
| 1263 |
/* index[i] = clgd547x_getpixel( x, y ); */ |
| 1264 |
} |
| 1265 |
} |
| 1266 |
|
| 1267 |
|
| 1268 |
|
| 1269 |
static void read_color_span( GLuint n, GLint x, GLint y, |
| 1270 |
GLubyte red[], GLubyte green[], |
| 1271 |
GLubyte blue[], GLubyte alpha[] ) |
| 1272 |
{ |
| 1273 |
int i; |
| 1274 |
|
| 1275 |
#ifdef DEBUG_CMESA |
| 1276 |
printf("cmesa: read_color_span()\n"); |
| 1277 |
#endif |
| 1278 |
|
| 1279 |
for (i=0; i<n; i++, x++) { |
| 1280 |
/* TODO */ |
| 1281 |
} |
| 1282 |
} |
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
/**********************************************************************/ |
| 1287 |
/***** Write arrays of pixels *****/ |
| 1288 |
/**********************************************************************/ |
| 1289 |
|
| 1290 |
|
| 1291 |
static void write_index_pixels( GLuint n, const GLint x[], const GLint y[], |
| 1292 |
const GLuint index[], const GLubyte mask[] ) |
| 1293 |
{ |
| 1294 |
int i; |
| 1295 |
|
| 1296 |
#ifdef DEBUG_CMESA |
| 1297 |
printf("cmesa: write_index_pixel(...)\n"); |
| 1298 |
#endif |
| 1299 |
|
| 1300 |
for (i=0; i<n; i++) { |
| 1301 |
if (mask[i]) { |
| 1302 |
/* clgd547x_drawpixel( x[i], FLIP(y[i]), index[i] ); |
| 1303 |
*/ |
| 1304 |
} |
| 1305 |
} |
| 1306 |
} |
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
static void write_monoindex_pixels( GLuint n, |
| 1311 |
const GLint x[], const GLint y[], |
| 1312 |
const GLubyte mask[] ) |
| 1313 |
{ |
| 1314 |
int i; |
| 1315 |
|
| 1316 |
#ifdef DEBUG_CMESA |
| 1317 |
printf("cmesa: write_monoindex_pixels(...)\n"); |
| 1318 |
#endif |
| 1319 |
|
| 1320 |
/* use current color index */ |
| 1321 |
for (i=0; i<n; i++) { |
| 1322 |
/* if (mask[i]) { |
| 1323 |
clgd547x_drawpixel( x[i], FLIP(y[i]), clgd547xMesa->index ); |
| 1324 |
} |
| 1325 |
*/ |
| 1326 |
} |
| 1327 |
} |
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
static void write_color_pixels( GLuint n, const GLint x[], const GLint y[], |
| 1332 |
const GLubyte r[], const GLubyte g[], |
| 1333 |
const GLubyte b[], const GLubyte a[], |
| 1334 |
const GLubyte mask[] ) |
| 1335 |
{ |
| 1336 |
int i; |
| 1337 |
|
| 1338 |
#ifdef DEBUG_CMESA |
| 1339 |
printf("cmesa: write_color_pixels(...)\n"); |
| 1340 |
#endif |
| 1341 |
|
| 1342 |
for (i=0; i<n; i++) { |
| 1343 |
/* if (mask[i]) { |
| 1344 |
clgd547x_drawpixel( x[i], FLIP(y[i]), r[i], g[i], b[i] ); |
| 1345 |
} |
| 1346 |
*/ |
| 1347 |
} |
| 1348 |
} |
| 1349 |
|
| 1350 |
|
| 1351 |
|
| 1352 |
static void write_monocolor_pixels( GLuint n, |
| 1353 |
const GLint x[], const GLint y[], |
| 1354 |
const GLubyte mask[] ) |
| 1355 |
{ |
| 1356 |
int i; |
| 1357 |
|
| 1358 |
#ifdef DEBUG_CMESA |
| 1359 |
printf("cmesa: write_monocolor_pixels(...)\n"); |
| 1360 |
#endif |
| 1361 |
|
| 1362 |
/* use current rgb color */ |
| 1363 |
for (i=0; i<n; i++) { |
| 1364 |
/* if (mask[i]) { |
| 1365 |
clgd547x_drawpixel( x[i], FLIP(y[i]), |
| 1366 |
clgd547xMesa->red, clgd547xMesa->green, clgd547xMesa->blue ); |
| 1367 |
} |
| 1368 |
*/ |
| 1369 |
} |
| 1370 |
} |
| 1371 |
|
| 1372 |
/**********************************************************************/ |
| 1373 |
/***** Read arrays of pixels *****/ |
| 1374 |
/**********************************************************************/ |
| 1375 |
|
| 1376 |
/* Read an array of color index pixels. */ |
| 1377 |
static void read_index_pixels( GLuint n, const GLint x[], const GLint y[], |
| 1378 |
GLuint index[], const GLubyte mask[] ) |
| 1379 |
{ |
| 1380 |
int i; |
| 1381 |
|
| 1382 |
#ifdef DEBUG_CMESA |
| 1383 |
printf("cmesa: read_index_pixels(...)\n"); |
| 1384 |
#endif |
| 1385 |
|
| 1386 |
for (i=0; i<n; i++,x++) { |
| 1387 |
/* index[i] = clgd547x_getpixel( x[i], FLIP(y[i]) ); */ |
| 1388 |
} |
| 1389 |
} |
| 1390 |
|
| 1391 |
|
| 1392 |
|
| 1393 |
static void read_color_pixels( GLuint n, const GLint x[], const GLint y[], |
| 1394 |
GLubyte red[], GLubyte green[], |
| 1395 |
GLubyte blue[], GLubyte alpha[], |
| 1396 |
const GLubyte mask[] ) |
| 1397 |
{ |
| 1398 |
/* TODO */ |
| 1399 |
|
| 1400 |
#ifdef DEBUG_CMESA |
| 1401 |
printf("cmesa: read_color_pixels(...)\n"); |
| 1402 |
#endif |
| 1403 |
|
| 1404 |
} |
| 1405 |
|
| 1406 |
|
| 1407 |
/************************************************************************/ |
| 1408 |
|
| 1409 |
static void clgd547x_mesa_setup_dd_pointers( void ) |
| 1410 |
{ |
| 1411 |
|
| 1412 |
#ifdef DEBUG_CMESA |
| 1413 |
printf("cmesa: clgd547x_mesa_setup_dd_pointers()\n"); |
| 1414 |
#endif |
| 1415 |
|
| 1416 |
/* Initialize all the pointers in the DD struct. Do this whenever */ |
| 1417 |
/* a new context is made current or we change buffers via set_buffer! */ |
| 1418 |
|
| 1419 |
DD.finish = clgd547x_finish; |
| 1420 |
DD.flush = clgd547x_flush; |
| 1421 |
|
| 1422 |
DD.clear_index = clear_index; |
| 1423 |
DD.clear_color = clear_color; |
| 1424 |
DD.clear = clear; |
| 1425 |
|
| 1426 |
DD.index = set_index; |
| 1427 |
DD.color = set_color; |
| 1428 |
DD.index_mask = index_mask; |
| 1429 |
DD.color_mask = color_mask; |
| 1430 |
|
| 1431 |
DD.logicop = logicop; |
| 1432 |
DD.dither = dither; |
| 1433 |
|
| 1434 |
DD.set_buffer = set_buffer; |
| 1435 |
DD.buffer_size = buffer_size; |
| 1436 |
|
| 1437 |
DD.alloc_depth_buffer = alloc_depth_buffer; |
| 1438 |
DD.clear_depth_buffer = clgd547x_clearDepthBuffer; |
| 1439 |
/* DD.set_depth_func = set_depth_func; */ |
| 1440 |
DD.read_depth_span = read_depth_span; |
| 1441 |
|
| 1442 |
DD.get_points_func = choose_points_function; |
| 1443 |
DD.get_line_func = choose_line_function; |
| 1444 |
DD.get_polygon_func = choose_polygon_function; |
| 1445 |
|
| 1446 |
/* |
| 1447 |
DD.write_index_span_z = write_index_span_z; |
| 1448 |
DD.write_monoindex_span_z = write_monoindex_span_z; |
| 1449 |
DD.write_color_span_z = write_color_span_z; |
| 1450 |
DD.write_monocolor_span_z = write_monocolor_span_z; |
| 1451 |
DD.write_texture_span_z = write_texture_span_z; |
| 1452 |
*/ |
| 1453 |
|
| 1454 |
/* Pixel/span writing functions: */ |
| 1455 |
/* TODO: use different funcs for 8, 16, 32-bit depths */ |
| 1456 |
DD.write_color_span = write_color_span; |
| 1457 |
DD.write_monocolor_span = write_monocolor_span; |
| 1458 |
DD.write_color_pixels = write_color_pixels; |
| 1459 |
DD.write_monocolor_pixels = write_monocolor_pixels; |
| 1460 |
DD.write_index_span = write_index_span; |
| 1461 |
DD.write_monoindex_span = write_monoindex_span; |
| 1462 |
DD.write_index_pixels = write_index_pixels; |
| 1463 |
DD.write_monoindex_pixels = write_monoindex_pixels; |
| 1464 |
|
| 1465 |
/* Pixel/span reading functions: */ |
| 1466 |
/* TODO: use different funcs for 8, 16, 32-bit depths */ |
| 1467 |
DD.read_index_span = read_index_span; |
| 1468 |
DD.read_color_span = read_color_span; |
| 1469 |
DD.read_index_pixels = read_index_pixels; |
| 1470 |
DD.read_color_pixels = read_color_pixels; |
| 1471 |
} |
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
/* |
| 1476 |
* Create a new VGA/Mesa context and return a handle to it. |
| 1477 |
*/ |
| 1478 |
clgd547xMesaContext clgd547xMesaCreateContext( void ) |
| 1479 |
{ |
| 1480 |
clgd547xMesaContext ctx; |
| 1481 |
GLfloat redscale, greenscale, bluescale, alphascale; |
| 1482 |
|
| 1483 |
#ifdef DEBUG_CMESA |
| 1484 |
printf("cmesa: clgd547xMesaCreateContext()\n"); |
| 1485 |
#endif |
| 1486 |
|
| 1487 |
ctx = (clgd547xMesaContext) malloc( sizeof(struct clgd547x_mesa_context) ); |
| 1488 |
|
| 1489 |
ctx->width = clgd547x_getxdim(); |
| 1490 |
ctx->height = clgd547x_getydim(); |
| 1491 |
ctx->db_flag = GL_TRUE; /* double buffering */ |
| 1492 |
ctx->depth = clgd547x_getdepth(); |
| 1493 |
|
| 1494 |
/* RGB mode -- this is what you want for the demos -TODO - PFM*/ |
| 1495 |
if (GL_TRUE) { |
| 1496 |
ctx->rgb_flag = GL_TRUE; |
| 1497 |
redscale = greenscale = bluescale = alphascale = 255.0; |
| 1498 |
setup_dithered_color(ctx); |
| 1499 |
} |
| 1500 |
else { |
| 1501 |
ctx->rgb_flag = GL_FALSE; |
| 1502 |
redscale = greenscale = bluescale = alphascale = 0.0; |
| 1503 |
} |
| 1504 |
|
| 1505 |
ctx->glctx = gl_new_context( ctx->rgb_flag, |
| 1506 |
redscale, greenscale, bluescale, alphascale, |
| 1507 |
ctx->db_flag, NULL ); |
| 1508 |
|
| 1509 |
ctx->index = 1; |
| 1510 |
ctx->red = ctx->green = ctx->blue = 255; |
| 1511 |
|
| 1512 |
return ctx; |
| 1513 |
} |
| 1514 |
|
| 1515 |
|
| 1516 |
/* |
| 1517 |
* Destroy the given VGA/Mesa context. |
| 1518 |
*/ |
| 1519 |
void clgd547xMesaDestroyContext( clgd547xMesaContext ctx ) |
| 1520 |
{ |
| 1521 |
|
| 1522 |
#ifdef DEBUG_CMESA |
| 1523 |
printf("cmesa: clgd547xMesaDestroyContext()\n"); |
| 1524 |
#endif |
| 1525 |
|
| 1526 |
if (ctx) { |
| 1527 |
gl_destroy_context( ctx->glctx ); |
| 1528 |
free( ctx ); |
| 1529 |
if (ctx==clgd547xMesa) { |
| 1530 |
clgd547xMesa = NULL; |
| 1531 |
} |
| 1532 |
} |
| 1533 |
} |
| 1534 |
|
| 1535 |
|
| 1536 |
|
| 1537 |
/* |
| 1538 |
* Make the specified VGA/Mesa context the current one. |
| 1539 |
*/ |
| 1540 |
void clgd547xMesaMakeCurrent( clgd547xMesaContext ctx ) |
| 1541 |
{ |
| 1542 |
|
| 1543 |
#ifdef DEBUG_CMESA |
| 1544 |
printf("cmesa: clgd547xMesaMakeCurrent()\n"); |
| 1545 |
#endif |
| 1546 |
|
| 1547 |
clgd547xMesa = ctx; |
| 1548 |
gl_set_context( ctx->glctx ); |
| 1549 |
|
| 1550 |
clgd547x_mesa_setup_dd_pointers(); |
| 1551 |
gl_viewport( 0, 0, ctx->width, ctx->height ); |
| 1552 |
setMondelloHeight(ctx->height); |
| 1553 |
} |
| 1554 |
|
| 1555 |
|
| 1556 |
/* |
| 1557 |
* Return a handle to the current VGA/Mesa context. |
| 1558 |
*/ |
| 1559 |
clgd547xMesaContext clgd547xMesaGetCurrentContext( void ) |
| 1560 |
{ |
| 1561 |
|
| 1562 |
#ifdef DEBUG_CMESA |
| 1563 |
printf("cmesa: clgd547xMesaContext()\n"); |
| 1564 |
#endif |
| 1565 |
|
| 1566 |
return clgd547xMesa; |
| 1567 |
} |
| 1568 |
|
| 1569 |
|
| 1570 |
#else |
| 1571 |
|
| 1572 |
/* |
| 1573 |
* Need this to provide at least one external definition. |
| 1574 |
*/ |
| 1575 |
|
| 1576 |
int gl_clgd547x_dummy_function(void) |
| 1577 |
{ |
| 1578 |
return 0; |
| 1579 |
} |
| 1580 |
|
| 1581 |
#endif /* MONDELLO */ |
| 1582 |
|