1 #ifndef __GLIDE_H__ 2 #define __GLIDE_H__ 3 4 #define GL_GLEXT_PROTOTYPES 5 #include <boolean.h> 6 #include <glsm/glsmsym.h> 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /* 13 ** ----------------------------------------------------------------------- 14 ** TYPE DEFINITIONS 15 ** ----------------------------------------------------------------------- 16 */ 17 18 /* 19 ** fundamental types 20 */ 21 #define FXTRUE 1 22 #define FXFALSE 0 23 24 /* 25 ** helper macros 26 */ 27 #define FXBIT( i ) ( 1L << (i) ) 28 29 typedef int (*GrProc)(); 30 31 /* 32 ** ----------------------------------------------------------------------- 33 ** CONSTANTS AND TYPES 34 ** ----------------------------------------------------------------------- 35 */ 36 #define GR_MIPMAPLEVELMASK_EVEN FXBIT(0) 37 #define GR_MIPMAPLEVELMASK_ODD FXBIT(1) 38 #define GR_MIPMAPLEVELMASK_BOTH (GR_MIPMAPLEVELMASK_EVEN | GR_MIPMAPLEVELMASK_ODD ) 39 40 #define GR_LODBIAS_BILINEAR 0.5 41 #define GR_LODBIAS_TRILINEAR 0.0 42 43 #define GR_TMU0 0x0 44 #define GR_TMU1 0x1 45 #define GR_TMU2 0x2 46 47 #define GR_COMBINE_FUNCTION_ZERO 0x0 48 #define GR_COMBINE_FUNCTION_NONE GR_COMBINE_FUNCTION_ZERO 49 #define GR_COMBINE_FUNCTION_LOCAL 0x1 50 #define GR_COMBINE_FUNCTION_LOCAL_ALPHA 0x2 51 #define GR_COMBINE_FUNCTION_SCALE_OTHER 0x3 52 #define GR_COMBINE_FUNCTION_BLEND_OTHER GR_COMBINE_FUNCTION_SCALE_OTHER 53 #define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL 0x4 54 #define GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA 0x5 55 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL 0x6 56 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 0x7 57 #define GR_COMBINE_FUNCTION_BLEND GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL 58 #define GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x8 59 #define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 0x9 60 #define GR_COMBINE_FUNCTION_BLEND_LOCAL GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL 61 #define GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA 0x10 62 63 #define GR_COMBINE_FACTOR_ZERO 0x0 64 #define GR_COMBINE_FACTOR_NONE GR_COMBINE_FACTOR_ZERO 65 #define GR_COMBINE_FACTOR_LOCAL 0x1 66 #define GR_COMBINE_FACTOR_OTHER_ALPHA 0x2 67 #define GR_COMBINE_FACTOR_LOCAL_ALPHA 0x3 68 #define GR_COMBINE_FACTOR_TEXTURE_ALPHA 0x4 69 #define GR_COMBINE_FACTOR_TEXTURE_RGB 0x5 70 #define GR_COMBINE_FACTOR_DETAIL_FACTOR GR_COMBINE_FACTOR_TEXTURE_ALPHA 71 #define GR_COMBINE_FACTOR_LOD_FRACTION 0x5 72 #define GR_COMBINE_FACTOR_ONE 0x8 73 #define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL 0x9 74 #define GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA 0xa 75 #define GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA 0xb 76 #define GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 0xc 77 #define GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA 78 #define GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION 0xd 79 80 81 #define GR_COMBINE_LOCAL_ITERATED 0x0 82 #define GR_COMBINE_LOCAL_CONSTANT 0x1 83 #define GR_COMBINE_LOCAL_NONE GR_COMBINE_LOCAL_CONSTANT 84 #define GR_COMBINE_LOCAL_DEPTH 0x2 85 86 #define GR_COMBINE_OTHER_ITERATED 0x0 87 #define GR_COMBINE_OTHER_TEXTURE 0x1 88 #define GR_COMBINE_OTHER_CONSTANT 0x2 89 #define GR_COMBINE_OTHER_NONE GR_COMBINE_OTHER_CONSTANT 90 91 #define GR_ALPHASOURCE_CC_ALPHA 0x0 92 #define GR_ALPHASOURCE_ITERATED_ALPHA 0x1 93 #define GR_ALPHASOURCE_TEXTURE_ALPHA 0x2 94 #define GR_ALPHASOURCE_TEXTURE_ALPHA_TIMES_ITERATED_ALPHA 0x3 95 96 #define GR_COLORCOMBINE_ZERO 0x0 97 #define GR_COLORCOMBINE_CCRGB 0x1 98 #define GR_COLORCOMBINE_ITRGB 0x2 99 #define GR_COLORCOMBINE_ITRGB_DELTA0 0x3 100 #define GR_COLORCOMBINE_DECAL_TEXTURE 0x4 101 #define GR_COLORCOMBINE_TEXTURE_TIMES_CCRGB 0x5 102 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB 0x6 103 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_DELTA0 0x7 104 #define GR_COLORCOMBINE_TEXTURE_TIMES_ITRGB_ADD_ALPHA 0x8 105 #define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA 0x9 106 #define GR_COLORCOMBINE_TEXTURE_TIMES_ALPHA_ADD_ITRGB 0xa 107 #define GR_COLORCOMBINE_TEXTURE_ADD_ITRGB 0xb 108 #define GR_COLORCOMBINE_TEXTURE_SUB_ITRGB 0xc 109 #define GR_COLORCOMBINE_CCRGB_BLEND_ITRGB_ON_TEXALPHA 0xd 110 #define GR_COLORCOMBINE_DIFF_SPEC_A 0xe 111 #define GR_COLORCOMBINE_DIFF_SPEC_B 0xf 112 #define GR_COLORCOMBINE_ONE 0x10 113 114 #define GR_BLEND_ZERO GL_ZERO 115 #define GR_BLEND_SRC_ALPHA GL_SRC_ALPHA 116 #define GR_BLEND_SRC_COLOR 0x2 117 #define GR_BLEND_DST_COLOR GR_BLEND_SRC_COLOR 118 #define GR_BLEND_DST_ALPHA 0x3 119 #define GR_BLEND_ONE GL_ONE 120 #define GR_BLEND_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA 121 #define GR_BLEND_ONE_MINUS_SRC_COLOR 0x6 122 #define GR_BLEND_ONE_MINUS_DST_COLOR GR_BLEND_ONE_MINUS_SRC_COLOR 123 #define GR_BLEND_ONE_MINUS_DST_ALPHA 0x7 124 #define GR_BLEND_RESERVED_8 0x8 125 #define GR_BLEND_RESERVED_9 0x9 126 #define GR_BLEND_RESERVED_A 0xa 127 #define GR_BLEND_RESERVED_B 0xb 128 #define GR_BLEND_RESERVED_C 0xc 129 #define GR_BLEND_RESERVED_D 0xd 130 #define GR_BLEND_RESERVED_E 0xe 131 #define GR_BLEND_ALPHA_SATURATE 0xf 132 #define GR_BLEND_PREFOG_COLOR GR_BLEND_ALPHA_SATURATE 133 134 #define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */ 135 #define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */ 136 #define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */ 137 #define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */ 138 #define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */ 139 #define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */ 140 #define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */ 141 142 #define GR_BUFFER_FRONTBUFFER 0x0 143 #define GR_BUFFER_BACKBUFFER 0x1 144 #define GR_BUFFER_AUXBUFFER 0x2 145 #define GR_BUFFER_DEPTHBUFFER 0x3 146 #define GR_BUFFER_ALPHABUFFER 0x4 147 #define GR_BUFFER_TRIPLEBUFFER 0x5 148 149 #define GR_CHROMAKEY_DISABLE 0x0 150 #define GR_CHROMAKEY_ENABLE 0x1 151 152 #define GR_CHROMARANGE_RGB_ALL_EXT 0x0 153 154 #define GR_CHROMARANGE_DISABLE_EXT 0x00 155 #define GR_CHROMARANGE_ENABLE_EXT 0x01 156 157 #define GR_TEXCHROMA_DISABLE_EXT 0x0 158 #define GR_TEXCHROMA_ENABLE_EXT 0x1 159 160 #define GR_TEXCHROMARANGE_RGB_ALL_EXT 0x0 161 162 #define GR_CMP_NEVER GL_NEVER 163 #define GR_CMP_LESS GL_LESS 164 #define GR_CMP_EQUAL GL_EQUAL 165 #define GR_CMP_LEQUAL GL_LEQUAL 166 #define GR_CMP_GREATER GL_GREATER 167 #define GR_CMP_NOTEQUAL GL_NOTEQUAL 168 #define GR_CMP_GEQUAL GL_EQUAL 169 #define GR_CMP_ALWAYS GL_ALWAYS 170 171 #define GR_COLORFORMAT_ARGB 0x0 172 #define GR_COLORFORMAT_ABGR 0x1 173 174 #define GR_COLORFORMAT_RGBA 0x2 175 #define GR_COLORFORMAT_BGRA 0x3 176 177 #define GR_CULL_DISABLE 0x0 178 #define GR_CULL_NEGATIVE 0x1 179 #define GR_CULL_POSITIVE 0x2 180 181 #define GR_DEPTHBUFFER_DISABLE 0x0 182 #define GR_DEPTHBUFFER_ZBUFFER 0x1 183 #define GR_DEPTHBUFFER_WBUFFER 0x2 184 #define GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS 0x3 185 #define GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS 0x4 186 187 #define GR_DITHER_DISABLE 0x0 188 #define GR_DITHER_2x2 0x1 189 #define GR_DITHER_4x4 0x2 190 191 #define GR_STIPPLE_DISABLE 0x0 192 #define GR_STIPPLE_PATTERN 0x1 193 #define GR_STIPPLE_ROTATE 0x2 194 195 #define GR_FOG_DISABLE 0x0 196 #define GR_FOG_WITH_TABLE_ON_Q 0x1 197 #define GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT 0x2 198 199 #define GR_LFB_READ_ONLY 0x00 200 #define GR_LFB_WRITE_ONLY 0x01 201 #define GR_LFB_IDLE 0x00 202 #define GR_LFB_NOIDLE 0x10 203 204 #define GR_LFB_WRITE_ONLY_EXPLICIT_EXT 0x02 /* explicitly not allow reading from the lfb pointer */ 205 206 #define GR_LFBBYPASS_DISABLE 0x0 207 #define GR_LFBBYPASS_ENABLE 0x1 208 209 #define GR_LFBWRITEMODE_565 0x0 /* RGB:RGB */ 210 #define GR_LFBWRITEMODE_555 0x1 /* RGB:RGB */ 211 #define GR_LFBWRITEMODE_1555 0x2 /* ARGB:ARGB */ 212 #define GR_LFBWRITEMODE_RESERVED1 0x3 213 #define GR_LFBWRITEMODE_888 0x4 /* RGB */ 214 #define GR_LFBWRITEMODE_8888 0x5 /* ARGB */ 215 #define GR_LFBWRITEMODE_RESERVED2 0x6 216 #define GR_LFBWRITEMODE_RESERVED3 0x7 217 #define GR_LFBWRITEMODE_RESERVED4 0x8 218 #define GR_LFBWRITEMODE_RESERVED5 0x9 219 #define GR_LFBWRITEMODE_RESERVED6 0xa 220 #define GR_LFBWRITEMODE_RESERVED7 0xb 221 #define GR_LFBWRITEMODE_565_DEPTH 0xc /* RGB:DEPTH */ 222 #define GR_LFBWRITEMODE_555_DEPTH 0xd /* RGB:DEPTH */ 223 #define GR_LFBWRITEMODE_1555_DEPTH 0xe /* ARGB:DEPTH */ 224 #define GR_LFBWRITEMODE_ZA16 0xf /* DEPTH:DEPTH */ 225 #define GR_LFBWRITEMODE_ANY 0xFF 226 227 228 #define GR_ORIGIN_UPPER_LEFT 0x0 229 #define GR_ORIGIN_LOWER_LEFT 0x1 230 #define GR_ORIGIN_ANY 0xFF 231 232 typedef struct { 233 int size; 234 void *lfbPtr; 235 uint32_t strideInBytes; 236 int32_t writeMode; 237 int32_t origin; 238 } GrLfbInfo_t; 239 240 #define GR_LOD_LOG2_256 0x8 241 #define GR_LOD_LOG2_128 0x7 242 #define GR_LOD_LOG2_64 0x6 243 #define GR_LOD_LOG2_32 0x5 244 #define GR_LOD_LOG2_16 0x4 245 #define GR_LOD_LOG2_8 0x3 246 #define GR_LOD_LOG2_4 0x2 247 #define GR_LOD_LOG2_2 0x1 248 #define GR_LOD_LOG2_1 0x0 249 250 #define GR_MIPMAP_DISABLE 0x0 /* no mip mapping */ 251 #define GR_MIPMAP_NEAREST 0x1 /* use nearest mipmap */ 252 #define GR_MIPMAP_NEAREST_DITHER 0x2 /* GR_MIPMAP_NEAREST + LOD dith */ 253 254 #define GR_SMOOTHING_DISABLE 0x0 255 #define GR_SMOOTHING_ENABLE 0x1 256 257 #define GR_TEXTURECLAMP_WRAP GL_REPEAT 258 #define GR_TEXTURECLAMP_CLAMP GL_CLAMP_TO_EDGE 259 #define GR_TEXTURECLAMP_MIRROR_EXT GL_MIRRORED_REPEAT 260 261 #define GR_TEXTUREFILTER_POINT_SAMPLED 0x0 262 #define GR_TEXTUREFILTER_3POINT_LINEAR 0x1 263 #define GR_TEXTUREFILTER_BILINEAR 0x2 264 265 /* KoolSmoky - */ 266 #define GR_TEXFMT_8BIT 0x0 267 #define GR_TEXFMT_RGB_332 GR_TEXFMT_8BIT 268 #define GR_TEXFMT_YIQ_422 0x1 269 #define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */ 270 #define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */ 271 #define GR_TEXFMT_ALPHA_INTENSITY_44 0x4 272 #define GR_TEXFMT_P_8 0x5 /* 8-bit palette */ 273 #define GR_TEXFMT_RSVD0 0x6 /* GR_TEXFMT_P_8_RGBA */ 274 #define GR_TEXFMT_P_8_6666 GR_TEXFMT_RSVD0 275 #define GR_TEXFMT_P_8_6666_EXT GR_TEXFMT_RSVD0 276 #define GR_TEXFMT_RSVD1 0x7 277 #define GR_TEXFMT_16BIT 0x8 278 #define GR_TEXFMT_ARGB_8332 GR_TEXFMT_16BIT 279 #define GR_TEXFMT_AYIQ_8422 0x9 280 #define GR_TEXFMT_RGB_565 0xa 281 #define GR_TEXFMT_ARGB_1555 0xb 282 #define GR_TEXFMT_ARGB_4444 0xc 283 #define GR_TEXFMT_ALPHA_INTENSITY_88 0xd 284 #define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */ 285 #define GR_TEXFMT_RSVD2 0xf 286 #define GR_TEXFMT_RSVD4 GR_TEXFMT_RSVD2 287 288 #define GR_MODE_DISABLE 0x0 289 #define GR_MODE_ENABLE 0x1 290 291 /* Types of data in strips */ 292 #define GR_FLOAT 0 293 #define GR_U8 1 294 295 /* 296 ** grDrawVertexArray/grDrawVertexArrayContiguous primitive type 297 */ 298 #define GR_POINTS 0 299 #define GR_LINE_STRIP 1 300 #define GR_LINES 2 301 #define GR_POLYGON 3 302 #define GR_TRIANGLE_STRIP GL_TRIANGLE_STRIP 303 #define GR_TRIANGLE_FAN GL_TRIANGLE_FAN 304 #define GR_TRIANGLES GL_TRIANGLES 305 306 /* 307 ** grGetString types 308 */ 309 #define GR_EXTENSION 0xa0 310 #define GR_HARDWARE 0xa1 311 #define GR_RENDERER 0xa2 312 #define GR_VENDOR 0xa3 313 #define GR_VERSION 0xa4 314 315 /* 316 ** ----------------------------------------------------------------------- 317 ** STRUCTURES 318 ** ----------------------------------------------------------------------- 319 */ 320 321 typedef struct { 322 int32_t smallLodLog2; 323 int32_t largeLodLog2; 324 int32_t aspectRatioLog2; 325 int32_t format; 326 int width; 327 int height; 328 void *data; 329 } GrTexInfo; 330 331 #define GR_LFB_SRC_FMT_565 0x00 332 #define GR_LFB_SRC_FMT_555 0x01 333 #define GR_LFB_SRC_FMT_1555 0x02 334 #define GR_LFB_SRC_FMT_888 0x04 335 #define GR_LFB_SRC_FMT_8888 0x05 336 #define GR_LFB_SRC_FMT_565_DEPTH 0x0c 337 #define GR_LFB_SRC_FMT_555_DEPTH 0x0d 338 #define GR_LFB_SRC_FMT_1555_DEPTH 0x0e 339 #define GR_LFB_SRC_FMT_ZA16 0x0f 340 #define GR_LFB_SRC_FMT_RLE16 0x80 341 342 /* 343 ** ----------------------------------------------------------------------- 344 ** FUNCTION PROTOTYPES 345 ** ----------------------------------------------------------------------- 346 */ 347 348 /* 349 ** rendering functions 350 */ 351 void grDrawPoint( const void *pt ); 352 353 void grDrawLine( const void *v1, const void *v2 ); 354 355 void grVertexLayout(uint32_t param, int32_t offset, uint32_t mode); 356 357 void grDrawVertexArrayContiguous(uint32_t mode, uint32_t Count, void *pointers); 358 359 void grBufferClear(uint32_t color, uint32_t alpha, uint32_t depth); 360 361 void grBufferSwap(uint32_t swap_interval); 362 363 364 /* 365 * Vertex Cache functions 366 * 367 * these are public just to allow reuse of the vertex cache vbo in some 368 * specific places. you probably do not want to use them. */ 369 void vbo_enable(); 370 void vbo_disable(); 371 void vbo_bind(); 372 void vbo_unbind(); 373 void vbo_buffer_data(void *data, size_t size); 374 375 /* 376 ** error management 377 */ 378 typedef void (*GrErrorCallbackFnc_t)( const char *string, int32_t fatal ); 379 380 void grErrorSetCallback( GrErrorCallbackFnc_t fnc ); 381 382 /* 383 ** SST routines 384 */ 385 uint32_t grSstWinOpen(void); 386 387 int32_t 388 grSstWinClose( uint32_t context ); 389 390 /* 391 ** Glide configuration and special effect maintenance functions 392 */ 393 394 void grAlphaBlendFunction(GLenum rgb_sf, GLenum rgb_df, GLenum alpha_sf, GLenum alpha_df); 395 396 void grAlphaCombine( 397 int32_t function, int32_t factor, 398 int32_t local, int32_t other, 399 int32_t invert 400 ); 401 402 void grAlphaTestFunction( int32_t function, uint8_t value, int set_alpha_ref); 403 404 void grAlphaTestReferenceValue( uint8_t value ); 405 406 void grChromakeyMode( int32_t mode ); 407 408 void grChromakeyValue( uint32_t value ); 409 410 void grClipWindow(uint32_t minx, uint32_t miny, uint32_t maxx, uint32_t maxy); 411 412 void grColorCombine( 413 int32_t function, int32_t factor, 414 int32_t local, int32_t other, 415 int32_t invert ); 416 417 void grColorMask(bool rgb, bool a); 418 419 void grCullMode( int32_t mode ); 420 421 void grConstantColorValue( uint32_t value ); 422 423 void grDepthBiasLevel( int32_t level ); 424 425 void grDepthBufferFunction(GLenum func); 426 427 #define grDepthBufferMode(mode) \ 428 { \ 429 if (mode == GR_DEPTHBUFFER_DISABLE) \ 430 glDisable(GL_DEPTH_TEST); \ 431 else \ 432 glEnable(GL_DEPTH_TEST); \ 433 } 434 435 void grDepthMask(bool mask); 436 437 void grFogMode( int32_t mode, uint32_t fogcolor ); 438 439 void grLoadGammaTable( uint32_t nentries, uint32_t *red, uint32_t *green, uint32_t *blue); 440 441 void grDepthRange( float n, float f ); 442 443 void grStippleMode( int32_t mode ); 444 445 void grStipplePattern( uint32_t mode ); 446 447 void grViewport( int32_t x, int32_t y, int32_t width, int32_t height ); 448 449 /* 450 ** texture mapping control functions 451 */ 452 uint32_t 453 grTexCalcMemRequired( 454 int32_t lodmax, 455 int32_t aspect, int32_t fmt); 456 457 #define TMU_SIZE (8 * 2048 * 2048) 458 459 #define grTexMaxAddress(tmu) ((TMU_SIZE * 2) - 1) 460 461 void grTexSource( int32_t tmu, 462 uint32_t startAddress, 463 uint32_t evenOdd, 464 GrTexInfo *info, 465 int do_download); 466 467 void grTexFilterClampMode( 468 int32_t tmu, 469 int32_t s_clampmode, 470 int32_t t_clampmode, 471 int32_t minfilter_mode, 472 int32_t magfilter_mode 473 ); 474 475 void grTexCombine( 476 int32_t tmu, 477 int32_t rgb_function, 478 int32_t rgb_factor, 479 int32_t alpha_function, 480 int32_t alpha_factor, 481 int32_t rgb_invert, 482 int32_t alpha_invert 483 ); 484 485 void grTexDetailControl( 486 int32_t tmu, 487 int lod_bias, 488 uint8_t detail_scale, 489 float detail_max 490 ); 491 492 void grTexMipMapMode( int32_t tmu, 493 int32_t mode, 494 int32_t lodBlend ); 495 496 /* 497 ** linear frame buffer functions 498 */ 499 500 int32_t 501 grLfbLock( int32_t type, int32_t buffer, int32_t writeMode, 502 int32_t origin, int32_t pixelPipeline, 503 GrLfbInfo_t *info ); 504 505 #define grLfbUnlock(type, buffer) (true) 506 507 void grLfbConstantAlpha( uint8_t alpha ); 508 509 void grLfbConstantDepth( uint32_t depth ); 510 511 void grLfbWriteColorSwizzle(int32_t swizzleBytes, int32_t swapWords); 512 513 void grLfbWriteColorFormat(int32_t colorFormat); 514 515 int32_t 516 grLfbWriteRegion( int32_t dst_buffer, 517 uint32_t dst_x, uint32_t dst_y, 518 uint32_t src_format, 519 uint32_t src_width, uint32_t src_height, 520 int32_t pixelPipeline, 521 int32_t src_stride, void *src_data ); 522 523 int32_t 524 grLfbReadRegion( int32_t src_buffer, 525 uint32_t src_x, uint32_t src_y, 526 uint32_t src_width, uint32_t src_height, 527 uint32_t dst_stride, void *dst_data ); 528 529 #define guFogGenerateLinear(nearZ, farZ) \ 530 { \ 531 fogStart = (nearZ) / 255.0f; \ 532 fogEnd = (farZ) / 255.0f; \ 533 } 534 535 extern unsigned int BUFFERSWAP; 536 537 #define NUM_TMU 2 538 539 // Vertex structure 540 typedef struct 541 { 542 float x, y, z, q; 543 544 uint8_t b; // These values are arranged like this so that *(uint32_t*)(VERTEX+?) is 545 uint8_t g; // ARGB format that glide can use. 546 uint8_t r; 547 uint8_t a; 548 549 float coord[4]; 550 551 float f; //fog 552 553 float u[2]; 554 float v[2]; 555 float w; 556 uint16_t flags; 557 558 float vec[3]; // normal vector 559 560 float sx, sy, sz; 561 float x_w, y_w, z_w, oow; 562 float u_w[2]; 563 float v_w[2]; 564 uint8_t not_zclipped; 565 uint8_t screen_translated; 566 uint8_t uv_scaled; 567 uint32_t uv_calculated; // like crc 568 uint32_t shade_mod; 569 uint32_t color_backup; 570 571 float ou, ov; 572 573 int number; // way to identify it 574 int scr_off, z_off; // off the screen? 575 } VERTEX; 576 577 // ZIGGY framebuffer copy extension 578 // allow to copy the depth or color buffer from back/front to front/back 579 #define GR_FBCOPY_MODE_DEPTH 0 580 #define GR_FBCOPY_MODE_COLOR 1 581 #define GR_FBCOPY_BUFFER_BACK 0 582 #define GR_FBCOPY_BUFFER_FRONT 1 583 584 // COMBINE extension 585 586 #define GR_FUNC_MODE_ZERO 0x00 587 #define GR_FUNC_MODE_X 0x01 588 #define GR_FUNC_MODE_ONE_MINUS_X 0x02 589 #define GR_FUNC_MODE_NEGATIVE_X 0x03 590 #define GR_FUNC_MODE_X_MINUS_HALF 0x04 591 592 #define GR_CMBX_ZERO 0x00 593 #define GR_CMBX_TEXTURE_ALPHA 0x01 594 #define GR_CMBX_ALOCAL 0x02 595 #define GR_CMBX_AOTHER 0x03 596 #define GR_CMBX_B 0x04 597 #define GR_CMBX_CONSTANT_ALPHA 0x05 598 #define GR_CMBX_CONSTANT_COLOR 0x06 599 #define GR_CMBX_DETAIL_FACTOR 0x07 600 #define GR_CMBX_ITALPHA 0x08 601 #define GR_CMBX_ITRGB 0x09 602 #define GR_CMBX_LOCAL_TEXTURE_ALPHA 0x0a 603 #define GR_CMBX_LOCAL_TEXTURE_RGB 0x0b 604 #define GR_CMBX_LOD_FRAC 0x0c 605 #define GR_CMBX_OTHER_TEXTURE_ALPHA 0x0d 606 #define GR_CMBX_OTHER_TEXTURE_RGB 0x0e 607 #define GR_CMBX_TEXTURE_RGB 0x0f 608 #define GR_CMBX_TMU_CALPHA 0x10 609 #define GR_CMBX_TMU_CCOLOR 0x11 610 611 612 void grColorCombineExt(uint32_t a, uint32_t a_mode, 613 uint32_t b, uint32_t b_mode, 614 uint32_t c, int32_t c_invert, 615 uint32_t d, int32_t d_invert, 616 uint32_t shift, int32_t invert); 617 618 void grAlphaCombineExt(uint32_t a, uint32_t a_mode, 619 uint32_t b, uint32_t b_mode, 620 uint32_t c, int32_t c_invert, 621 uint32_t d, int32_t d_invert, 622 uint32_t shift, int32_t invert); 623 624 void 625 grTexColorCombineExt(int32_t tmu, 626 uint32_t a, uint32_t a_mode, 627 uint32_t b, uint32_t b_mode, 628 uint32_t c, int32_t c_invert, 629 uint32_t d, int32_t d_invert, 630 uint32_t shift, int32_t invert); 631 632 void 633 grTexAlphaCombineExt(int32_t tmu, 634 uint32_t a, uint32_t a_mode, 635 uint32_t b, uint32_t b_mode, 636 uint32_t c, int32_t c_invert, 637 uint32_t d, int32_t d_invert, 638 uint32_t shift, int32_t invert, 639 uint32_t ccolor_value); 640 641 void 642 grColorCombineExt(uint32_t a, uint32_t a_mode, 643 uint32_t b, uint32_t b_mode, 644 uint32_t c, int32_t c_invert, 645 uint32_t d, int32_t d_invert, 646 uint32_t shift, int32_t invert); 647 648 void 649 grAlphaCombineExt(uint32_t a, uint32_t a_mode, 650 uint32_t b, uint32_t b_mode, 651 uint32_t c, int32_t c_invert, 652 uint32_t d, int32_t d_invert, 653 uint32_t shift, int32_t invert); 654 655 extern void grChromaRangeExt(uint32_t color0, uint32_t color1, uint32_t mode); 656 extern void grChromaRangeModeExt(int32_t mode); 657 extern void grTexChromaRangeExt(int32_t tmu, uint32_t color0, uint32_t color1, int32_t mode); 658 extern void grTexChromaModeExt(int32_t tmu, int32_t mode); 659 660 extern int width, height; 661 extern float fogStart, fogEnd; 662 663 #ifdef __cplusplus 664 } 665 #endif 666 667 #endif /* __GLIDE_H__ */ 668