Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

800 lines
34 KiB

  1. /**************************************************************************
  2. ***************************************************************************
  3. *
  4. * Copyright (c) 1997, Cirrus Logic, Inc.
  5. * All Rights Reserved
  6. *
  7. * FILE: l3d.h
  8. *
  9. * DESCRIPTION: 546X 3D engine defines and structures
  10. *
  11. * AUTHOR: Goran Devic, Mark Einkauf
  12. *
  13. ***************************************************************************
  14. ***************************************************************************/
  15. #ifndef _L3D_H_
  16. #define _L3D_H_
  17. /*********************************************************************
  18. * Defines and basic types
  19. **********************************************************************/
  20. #ifndef OPENGL_MCD // LL3D's type.h redundant with basic type definitions in other DDK/msdev headers
  21. #include "type.h" /* Include basic types */
  22. #endif // ndef OPENGL_MCD
  23. /*********************************************************************
  24. *
  25. * Library initialization defines
  26. *
  27. **********************************************************************/
  28. #define LL_USE_BUFFER_B 0x0001 /* Use double buffering */
  29. #define LL_USE_BUFFER_Z 0x0002 /* Use Z buffer */
  30. #define LL_BUFFER_Z_8BPP 0x0004 /* Use 8bpp instead of 16bpp Z */
  31. #define LL_BUFFER_Z888 0x0008 /* Only in 32bpp use Z888 */
  32. #define LL_8BPP_INDEXED 0x0010 /* Only in 8bpp - indexed mode */
  33. #define LL_HARDWARE_CURSOR 0x0020 /* Use hardware cursor */
  34. /*********************************************************************
  35. *
  36. * Buffer identification numbers and Z stride info.
  37. *
  38. * Used with LL_InitLib()
  39. *
  40. **********************************************************************/
  41. #define LL_ID_BUFFER_A 0 /* ID of the primary buffer */
  42. #define LL_ID_BUFFER_B 1 /* ID of the secondary buffer */
  43. #define LL_ID_BUFFER_Z 2 /* ID of the Z buffer in RDRAM */
  44. /*********************************************************************
  45. *
  46. * Destination defines for the objects
  47. *
  48. * Used with LL_SetZBuffer
  49. *
  50. **********************************************************************/
  51. #define LL_IN_RDRAM 0 /* Object is in the RDRAM memory */
  52. #define LL_IN_HOST 1 /* Object is in Host memory */
  53. /*********************************************************************
  54. *
  55. * Rendering mode
  56. *
  57. * Used with LL_SetRenderingMode
  58. *
  59. **********************************************************************/
  60. #define LL_PROCESSOR_MODE 0 /* Use processor mode */
  61. #define LL_COPROCESSOR_MODE 1 /* Use coprocessor indirect mode */
  62. /*********************************************************************
  63. *
  64. * Texture flag values
  65. *
  66. * Used with LL_RegisterTexture
  67. *
  68. **********************************************************************/
  69. #define LL_SYSTEM_ONLY 1 /* Put texture in system memory */
  70. #define LL_VIDEO_ONLY 2 /* Put texture in video memory */
  71. #define LL_DEFAULT 0 /* Try video, then system */
  72. /*********************************************************************
  73. *
  74. * Texture types
  75. *
  76. * Used with LL_RegisterTexture
  77. *
  78. **********************************************************************/
  79. #define LL_TEX_4BPP 0 /* 4 Bpp indexed */
  80. #define LL_TEX_8BPP 2 /* 8 Bpp indexed */
  81. #define LL_TEX_332 3 /* 3:3:2 true color */
  82. #define LL_TEX_565 4 /* 5:6:5 true color */
  83. #define LL_TEX_1555 5 /* (mask):5:5:5 true color */
  84. #define LL_TEX_1888 6 /* (mask):8:8:8 true color */
  85. #define LL_TEX_8_ALPHA 10 /* alpha only */
  86. #define LL_TEX_4444 12 /* 4:4:4:4 true color */
  87. #define LL_TEX_8888 14 /* 8:8:8:8 true color */
  88. /*********************************************************************
  89. *
  90. * Cursor modes
  91. *
  92. * Used with LL_SetCursor
  93. *
  94. **********************************************************************/
  95. #define LL_CUR_DISABLE 0 /* Turn off cursor */
  96. #define LL_CUR_32x3 1 /* 32x32 cursor, 3 colors/t */
  97. #define LL_CUR_32x2 2 /* 32x32 cursor, 2 colors */
  98. #define LL_CUR_32x2H 3 /* 32x32 cursor, 2 colors+hghlt */
  99. #define LL_CUR_64x3 5 /* 64x64 cursor, 3 colors/t */
  100. #define LL_CUR_64x2 6 /* 64x64 cursor, 2 colors */
  101. #define LL_CUR_64x2H 7 /* 64x64 cursor, 2 colors+hghlt */
  102. //These are new for CGL 1.70, and are defined in CGL as:
  103. #define LL_ALT_32x3 0x09
  104. #define LL_ALT_32x2H 0x0A
  105. #define LL_ALT_32x2 0x0B
  106. #define LL_ALT_64x3 0x0D
  107. #define LL_ALT_64x2H 0x0E
  108. #define LL_ALT_64x2 0x0F
  109. #define NEED_MOUSE_UPDATE 0x01 //if the coordinates of cursor need updated
  110. #define MOUSE_IS_UPDATED 0x00 //if the coordinates have been updated
  111. /*********************************************************************
  112. *
  113. * Z Compare modes:
  114. *
  115. * Used with LL_SetZCompareMode(mode), LL_GetZCompareMode()
  116. *
  117. **********************************************************************/
  118. #define LL_Z_WRITE_GREATER_EQUAL 0x00000000 /* True if new >= old */
  119. #define LL_Z_WRITE_GREATER 0x00000001 /* True if new > old */
  120. #define LL_Z_WRITE_LESS_EQUAL 0x00000002 /* True if new <= old */
  121. #define LL_Z_WRITE_LESS 0x00000003 /* True if new < old */
  122. #define LL_Z_WRITE_NOT_EQUAL 0x00000004 /* True if new <> old */
  123. #define LL_Z_WRITE_EQUAL 0x00000005 /* True if new = old */
  124. /*********************************************************************
  125. *
  126. * Functional Z modes:
  127. *
  128. * Used with LL_SetZMode(mode), LL_GetZMode()
  129. *
  130. **********************************************************************/
  131. #define LL_Z_MODE_NORMAL 0x00000000 /* Normal operation */
  132. #define LL_Z_MODE_MASK 0x00000001 /* Z not written */
  133. #define LL_Z_MODE_ALWAYS 0x00000002 /* Z, color always wrt*/
  134. #define LL_Z_MODE_ONLY 0x00000003 /* Color not written */
  135. #define LL_Z_MODE_HIT 0x00000004 /* collision dtct only*/
  136. /*********************************************************************
  137. *
  138. * Color compare controls
  139. *
  140. * Used with LL_ColorBoundsControl( dwControl)
  141. *
  142. **********************************************************************/
  143. #define LL_COLOR_SATURATE_ENABLE 0x00000040 /* for indexed mode */
  144. #define LL_COLOR_SATURATE_DISABLE 0x00000000 /* (default) */
  145. #define LL_COLOR_COMPARE_INCLUSIVE 0x00000400 /* tc modes */
  146. #define LL_COLOR_COMPARE_EXCLUSIVE 0x00000000 /* tc modes (default) */
  147. #define LL_COLOR_COMPARE_BLUE 0x00000200 /* blue (default off) */
  148. #define LL_COLOR_COMPARE_GREEN 0x00000100 /* green (default off)*/
  149. #define LL_COLOR_COMPARE_RED 0x00000080 /* red (default off) */
  150. /*********************************************************************
  151. *
  152. * Notes on Alpha blending and Lighting section:
  153. *
  154. * If used separately, every combination of alpha mode and destination
  155. * is valid. Note that if LL_ALPHA_DEST_INTERP or LL_LIGHTING_INTERP_RGB
  156. * are selected, color interpolators may not be used.
  157. *
  158. * When using alpha blending and lighting at the same time, be careful
  159. * not to use Polyeng or LA-interpolators more than once.
  160. *
  161. **********************************************************************/
  162. /*********************************************************************
  163. *
  164. * Alpha mode: Magnitude of alpha blending will be taken from
  165. * - constant alpha, use LL_SetConstantAlpha(src/new,dest/old)
  166. * this mode uses LA-interpolators
  167. * - interpolated, variable alpha from LA-interpolators
  168. * this mode also uses LA-interpolators
  169. * - alpha field from the frame buffer
  170. *
  171. * Used with LL_SetAlphaMode(mode), LL_GetAlphaMode()
  172. *
  173. **********************************************************************/
  174. #define LL_ALPHA_CONST 0x00000000 /* Constant alpha */
  175. #define LL_ALPHA_TEXTURE 0x00000001 /* Texture alpha */
  176. #define LL_ALPHA_INTERP 0x00000002 /* Using LA interp. */
  177. #define LL_ALPHA_FRAME 0x00000003 /* Using frame values */
  178. /*********************************************************************
  179. *
  180. * Alpha destination: Selects where the second color input to the
  181. * alpha multiplier comes from
  182. * - color from the frame buffer ("normal" alpha blending)
  183. * - constant color (also called fog) from COLOR0 register
  184. * - interpolated, shaded color from the polygon engine (also fog)
  185. * also LL_GOURAUD must be set in the flags
  186. * this mode uses Polyengine color registers
  187. *
  188. * Fog: Use aliases LL_FOG_CONST and LL_FOG_INTERP to avoid fetching
  189. * colors from the frame and to set the fog color.
  190. *
  191. * Used with LL_SetAlphaDestColor(mode), LL_GetAlphaDestColor()
  192. *
  193. **********************************************************************/
  194. #define LL_ALPHA_DEST_FRAME 0x00000000 /* Using frame color */
  195. #define LL_ALPHA_DEST_CONST 0x00000001 /* Constant color */
  196. #define LL_ALPHA_DEST_INTERP 0x00000002 /* Using poly engine */
  197. #define LL_FOG_CONST 0x00000001 /* Constant fog */
  198. #define LL_FOG_INTERP 0x00000002 /* Using poly engine */
  199. /*********************************************************************
  200. *
  201. * Lighting source: Selects the value for the lighting multiplier
  202. * - interpolated light from the polygon engine
  203. * load lighting values as r,g,b components
  204. * also LL_GOURAUD must be set in the flags
  205. * this mode uses Polyengine color registers
  206. * - interpolated light from the alpha interpolator
  207. * load lighting values as alpha components
  208. * this mode uses LA-interpolators
  209. * - constant light from the COLOR1 register
  210. *
  211. * Used with LL_SetLightingSource(mode), LL_GetLightingSource()
  212. *
  213. **********************************************************************/
  214. #define LL_LIGHTING_INTERP_RGB 0x00000000 /* Using poly engine */
  215. #define LL_LIGHTING_INTERP_ALPHA 0x00000001 /* Using LA interp. */
  216. #define LL_LIGHTING_CONST 0x00000002 /* Constant light */
  217. #define LL_LIGHTING_TEXTURE 0x00000003 /* FrameScaling Mode */
  218. /*********************************************************************
  219. *
  220. * Rendering instruction modifiers
  221. *
  222. * Used in dwFlags field with LL_POINT...LL_INDEXED_POLY
  223. *
  224. **********************************************************************/
  225. #define LL_SAME_COLOR 0x00008000 /* Use previously loaded color */
  226. #define LL_Z_BUFFER 0x00002000 /* Use Z buffer */
  227. #define LL_ALPHA 0x00000001 /* Do Alpha blending */
  228. #define LL_LIGHTING 0x00040000 /* Do lighting */
  229. #define LL_STIPPLE 0x00080000 /* Enable stipple or */
  230. #define LL_PATTERN 0x00100000 /* Enable pattern or */
  231. #define LL_DITHER 0x00200000 /* Enable dither,use PATTERN_RAM */
  232. #define LL_GOURAUD 0x00001000 /* Enable Gouraud shading */
  233. #define LL_TEXTURE 0x00020000 /* Use texture mapping */
  234. #define LL_PERSPECTIVE 0x00010000 /* Perspective corrected texture */
  235. #define LL_TEX_FILTER 0x40000000 /* Filtered textures */
  236. #define LL_TEX_SATURATE 0x20000000 /* Texture saturation (opp wrap) */
  237. #define LL_TEX_DECAL 0x10000000 /* Texture masking (1555,1888) */
  238. #define LL_TEX_DECAL_INTERP 0x18000000 /*Texture masking (1555,1888)*/
  239. //positions in TxCtl0_3D register
  240. #define CLMCD_TEX_FILTER 0x00040000 /* Filtered textures */
  241. #define CLMCD_TEX_U_SATURATE 0x00000008 /* Texture saturation (opp wrap) */
  242. #define CLMCD_TEX_V_SATURATE 0x00000080 /* Texture saturation (opp wrap) */
  243. #define CLMCD_TEX_DECAL 0x00200000 /* Texture masking (1555,1888) */
  244. #define CLMCD_TEX_DECAL_INTERP 0x00400000 /* Texture masking (1555,1888) */
  245. #define CLMCD_TEX_DECAL_POL 0x00100000 /* Texture masking (1555,1888) */
  246. /*********************************************************************
  247. *
  248. * Type of the line mesh:
  249. * - lines are concatenated, each reusing the predecessor's
  250. * vertex as its first vertex
  251. * - first vertex defines the center of a "wheel" structure with
  252. * each succesive vertex defining the outer point
  253. * - list of independent pairs of vertices
  254. *
  255. **********************************************************************/
  256. #define LL_LINE_STRIP 0x02000000 /* Line strip mesh of lines */
  257. #define LL_LINE_FAN 0x01000000 /* Line fan mesh of lines */
  258. #define LL_LINE_LIST 0x00000000 /* Line list mesh of lines */
  259. /*********************************************************************
  260. *
  261. * Type of the polygon mesh:
  262. * - triangles are concatenated, each reusing the predecessor's
  263. * last two vertices as its own first two
  264. * - first vertex defines the center of a "wheel" structure with
  265. * each succesive vertex pair defining the outer points
  266. * - list of independent triplets of vertices
  267. *
  268. **********************************************************************/
  269. #define LL_POLY_STRIP 0x02000000 /* Poly strip mesh of triangles */
  270. #define LL_POLY_FAN 0x01000000 /* Poly fan mesh of triangles */
  271. #define LL_POLY_LIST 0x00000000 /* Poly list mesh of triangles */
  272. /**************************************************************************
  273. *
  274. * Commands for the bOp field of a batch cell
  275. *
  276. ***************************************************************************/
  277. #define LL_IDLE 0x00 /* Stops Laguna execution */
  278. #define LL_NOP 0x01 /* Does nothing */
  279. #define LL_POINT 0x02 /* Point primitive(s) */
  280. #define LL_LINE 0x03 /* Line primitive(s) */
  281. #define LL_POLY 0x04 /* Triangle primitive(s) */
  282. #define LL_SET_COLOR0 0x08 /* Sets color0 register w/dwFlags*/
  283. #define LL_SET_COLOR1 0x09 /* Sets color1 register w/dwFlags*/
  284. #define LL_SET_DEST_COLOR_BOUNDS 0x0B /* Sets the color bounds regs */
  285. #define LL_SET_CLIP_REGION 0x0C /* Sets clip region and flags */
  286. #define LL_SET_Z_MODE 0x0D /* Sets the Z functional mode */
  287. #define LL_SET_Z_BUFFER 0x0E /* Sets the location of the Zbuf */
  288. #define LL_SET_Z_COMPARE_MODE 0x0F /* Sets the Z compare mode */
  289. #define LL_SET_ALPHA_MODE 0x10 /* Sets the alpha blending mode */
  290. #define LL_SET_CONSTANT_ALPHA 0x11 /* Sets the constants for alpha */
  291. #define LL_SET_ALPHA_DEST_COLOR 0x12 /* Sets the alpha destination col*/
  292. #define LL_SET_LIGHTING_SOURCE 0x13 /* Sets the lighting source */
  293. #define LL_AALINE 0x14 /* Anti-aliased True Color Line(s*/
  294. #define LL_RAW_DATA 0x15 /* Copy data into d-list */
  295. #define LL_QUALITY 0x16 /* Sets the speed/quality dial */
  296. #define LL_SET_TEXTURE_COLOR_BOUNDS 0x17 /* Sets the texture color bounds */
  297. #define LL_SET_PATTERN 0x18 /* Sets pattern registers */
  298. /*********************************************************************
  299. *
  300. * LL_Vert structure defines a vertex with its X,Y,Z coordinates.
  301. * Also, the coordinates on the texture that may be associated with
  302. * it are also stored in this structure as (U,V) fields. If the
  303. * texture is perspective corrected, the vertex' W factor is used.
  304. *
  305. * The pixel on the screen that is associated with this vertex has
  306. * color 'index' (if THE indexed mode is used), or (r,g,b) if a true
  307. * color mode is used.
  308. *
  309. * If alpha blending is used, alpha value is stored in the 'a' field.
  310. *
  311. * Add DWORD values are fixed point 16:16.
  312. *
  313. **********************************************************************/
  314. typedef struct /* Vertex structure */
  315. {
  316. DWORD x; /* X screen coordinate */
  317. DWORD y; /* Y screen coordinate */
  318. DWORD z; /* Z coordinate */
  319. DWORD u; /* Texture u coordinate */
  320. DWORD v; /* Texture v coordinate */
  321. float w; /* Perspective w factor */
  322. union
  323. {
  324. BYTE index; /* Indexed color value */
  325. struct
  326. {
  327. BYTE r; /* Red component */
  328. BYTE g; /* Green component */
  329. BYTE b; /* Blue component */
  330. BYTE a; /* Alpha component */
  331. };
  332. };
  333. } LL_Vert;
  334. /*********************************************************************
  335. *
  336. * LL_Batch structure holds the operation that is being requested,
  337. * along with its parameters.
  338. *
  339. * The array of the vertices used in the current operation
  340. * is pointed to by pVert pointer.
  341. *
  342. **********************************************************************/
  343. typedef struct /* Batch cell structure */
  344. {
  345. BYTE bOp; /* Operation requested */
  346. BYTE bRop; /* Raster operation for 2D */
  347. WORD wBuf; /* Texture / Buffer designator */
  348. WORD wCount; /* General purpose counter */
  349. DWORD dwFlags; /* Operation flag modifiers */
  350. LL_Vert *pVert; /* Pointer to the associated */
  351. /* array of vertices */
  352. } LL_Batch;
  353. /*********************************************************************
  354. *
  355. * LL_Pattern structure holds the pattern to be stored in the
  356. * PATTERN_RAM registers. These values are used for pattern,
  357. * dither or stipple (only one at a time).
  358. *
  359. **********************************************************************/
  360. typedef struct /* pattern holding structure */
  361. {
  362. DWORD pat[ 8 ]; /* 8 word pattern */
  363. } LL_Pattern;
  364. /*********************************************************************
  365. *
  366. * LL_Rect structure defines a general rectangular region
  367. *
  368. **********************************************************************/
  369. typedef struct
  370. {
  371. DWORD left; /* x1 */
  372. DWORD top; /* y1 */
  373. DWORD right; /* x2 */
  374. DWORD bottom; /* y2 */
  375. } LL_Rect;
  376. /*********************************************************************
  377. *
  378. * LL_Color structure defines color by its components or index
  379. *
  380. **********************************************************************/
  381. typedef struct
  382. {
  383. union
  384. {
  385. struct /* If in true color mode, */
  386. {
  387. BYTE r; /* Red component */
  388. BYTE g; /* Green component */
  389. BYTE b; /* Blue component */
  390. };
  391. BYTE index; /* Index if in 8bpp indexed mode */
  392. };
  393. } LL_Color;
  394. typedef struct {
  395. float x;
  396. float y;
  397. float w;
  398. float u;
  399. float v;
  400. } TEXTURE_VERTEX;
  401. /*********************************************************************
  402. *
  403. * LL_Texture structure defines a texture map
  404. *
  405. **********************************************************************/
  406. typedef struct _LL_Texture
  407. {
  408. void *pohTextureMap; // control block for region containing map in offscreen memory
  409. MCDTEXTURE *pTex; // ptr to texture in user memory
  410. // LL_Color * ColPalette; /* Pointer to palette if indexed */
  411. // BYTE bMem; /* Index to the texture memory block */
  412. DWORD dwTxCtlBits;
  413. float fWidth; /* Texture X dimension in texels */
  414. float fHeight; /* Texture Y dimension in texels */
  415. BYTE bSizeMask; /* Encoded size 0=16,... Y[7:4],X[3:0] */
  416. BYTE bType; /* Texture type */
  417. // BYTE fIndexed; /* True for indexed textures */
  418. // BYTE bLookupOffset; /* Palette lookup offset (indexed only)*/
  419. WORD wXloc; /* X offset location in bytes */
  420. WORD wYloc; /* Y offset location in lines */
  421. float fLastDrvDraw; /* time stamp, sort of */
  422. BYTE bAlphaInTexture;
  423. BYTE bNegativeMap;
  424. BYTE bMasking;
  425. // doubly linked list pointers
  426. struct _LL_Texture* prev;
  427. struct _LL_Texture* next;
  428. } LL_Texture;
  429. /*********************************************************************
  430. *
  431. * LL_DeviceState structure hold the information about the state
  432. * of the graphics processor (hardware).
  433. *
  434. * During the library initialization, the following fields have to
  435. * be initialized:
  436. *
  437. * dwFlags with optional
  438. * LL_USE_BUFFER_B or
  439. * LL_USE_BUFFER_Z or
  440. * LL_BUFFER_Z_8BPP or
  441. * LL_BUFFER_Z888 or
  442. * LL_8BPP_INDEXED or
  443. * LL_HARDWARE_CURSOR
  444. *
  445. * dwDisplayListLen with the amount of memory to lock for the
  446. * physical graphics device display list (in bytes).
  447. *
  448. * dwSystemTexturesLen with the total size for the system
  449. * textures (in bytes)
  450. *
  451. **********************************************************************/
  452. typedef struct
  453. {
  454. /* These three fields may be set before calling the LL_InitLib function */
  455. DWORD dwFlags; /* Init flags */
  456. DWORD dwDisplayListLen; /* Total size for the display lists in bytes */
  457. DWORD dwSystemTexturesLen; /* Total size for the system textures in bytes */
  458. /* These variables may be used by the software */
  459. DWORD *pRegs; /* Register apperture, pointer to memory mappped I/O */
  460. BYTE *pFrame; /* Frame apperture, pointer to the linear frame buffer */
  461. DWORD dwVRAM; /* Amount of video memory on the card in bytes */
  462. WORD wHoriz; /* Current horizontal resolution */
  463. WORD wVert; /* Current vertical resolution */
  464. } LL_DeviceState;
  465. /*********************************************************************
  466. *
  467. * LL_Point structure defines a general point coordinates
  468. *
  469. **********************************************************************/
  470. typedef struct
  471. {
  472. DWORD nX; /* x coordinate */
  473. DWORD nY; /* y coordinate */
  474. } LL_Point;
  475. /*********************************************************************
  476. *
  477. * Font support structures and macros
  478. *
  479. **********************************************************************/
  480. typedef struct // Font header structure
  481. {
  482. WORD nMinimum; // Font minimum character code value
  483. WORD nMaximum; // Font maximum character code value
  484. WORD nDefault; // Font default character code value
  485. WORD nHeight; // Font height in pixels
  486. DWORD nReserved; // Font reserved data
  487. WORD nIndex[]; // Font index array
  488. } LL_FontHeader;
  489. typedef struct // Font structure
  490. {
  491. LL_FontHeader *pHeader; // Pointer to font header
  492. BYTE *pBitmap; // Pointer to font bitmap
  493. int nID; // Font buffer ID value
  494. char cBreak; // Break character value
  495. int nExtra; // Current break extra in pixels
  496. int nLast; // Previous break extra in pixels
  497. int nSpace; // Current font spacing in pixels
  498. int nPrevious; // Previous font spacing in pixels
  499. int nAverage; // Average font width in pixels
  500. int nMaximum; // Maximum font width in pixels
  501. } LL_Font;
  502. #define Y_EXTENT(Extent) ((unsigned) (Extent) >> 16)
  503. #define X_EXTENT(Extent) ((Extent) & 0xFFFF)
  504. #define TEX_MASK_EN 0x00200000
  505. #define TEX_HIPRECISION_2NDORDER 0x00800000 // 8.24 vs. 16.16 2nd order terms
  506. #ifdef CGL // Goran will have equivalent soon??...
  507. #define LL_PIXEL_MASK_DISABLE 0x00000000
  508. #define LL_PIXEL_MASK_ENABLE 0x00000001
  509. // TX_CTL0_3D values
  510. #define LL_TEX_U_OVF_SAT_EN 0x00000004
  511. #define LL_TEX_V_OVF_SAT_EN 0x00000080
  512. #define LL_TEXMODE_A888 0x00000600
  513. #define LL_TEXMODE_A555 0x00000500
  514. #define LL_TEXMODE_565 0x00000400 // not used by CGL
  515. #define LL_TEXMODE_332 0x00000300
  516. #define LL_TEXMODE_8MAP 0x00000200
  517. #define LL_TEXMODE_4MAP 0x00000000 // not used by CGL
  518. #define TEX_MASK_FUNC 0x00400000
  519. #define TEX_MASK_EN 0x00200000
  520. #define TEX_MASK_POL 0x00100000
  521. #define TEX_HIPRECISION_2NDORDER 0x00800000 // 8.24 vs. 16.16 2nd order terms
  522. #define LL_TEX_FILTER_ENABLE 0x00040000
  523. // TX_CTL1_3D values
  524. #define CCOMP_INCLUSIVE 0x08000000
  525. #define TX_BLU_COMP 0x04000000
  526. #define TX_GRN_COMP 0x02000000
  527. #define TX_RED_COMP 0x01000000
  528. #define ABS(a) (((a) < 0) ? -(a) : (a))
  529. #endif // CGL
  530. // BEGIN Chris' additions //
  531. typedef unsigned long ULONG; //
  532. typedef ULONG * PULONG ; //
  533. typedef unsigned short UWORD ; //
  534. typedef UWORD * PUWORD ; //
  535. typedef unsigned char UBYTE; //
  536. typedef UBYTE * PUBYTE; //
  537. typedef struct { //
  538. unsigned char bBlue,bGreen,bRed,bAlpha; //
  539. } LL_COLOR_ST;//this mimics the CGL_COLOR_ST.Should we include CGL in this library instead of mimicing this struct?//
  540. #define num_of_regs 42 //
  541. #define num_of_insignificant_regs 46 //
  542. #define num_of_modes 70 //
  543. #define LL_DISABLE 0x00
  544. #define LL_32x32x3 0x01
  545. #define LL_32x32x2HL 0x02
  546. #define LL_32x32x2 0x03
  547. #define LL_64x64x3 0x05
  548. #define LL_64x64x2HL 0x06
  549. #define LL_64x64x2 0x07
  550. // following was moved here from setmode.c
  551. #ifdef B4_REALHW
  552. /* Defines the code for the 5462 chip that is the underlying */
  553. /* hardware for the testing before 5464 comes out. This code should */
  554. /* then be modified to reflect real code returned by the BIOS */
  555. /* function 12h subfunction 80h (Inquire VGA type) */
  556. #define EBIOS_CLGD5462 0x60 /* BIOS Laguna 1 signature */
  557. #define EBIOS_CLGD5464 0xD4 /* BIOS Laguna 3D signature */
  558. #define EBIOS_CLGD5464B 0xD0 /* BIOS Laguna 3D alt signature */
  559. #else
  560. /* Defines the code for the 5462 chip that is the underlying */
  561. /* hardware for the testing before 5464 comes out. This code should */
  562. /* then be modified to reflect real code returned by the BIOS */
  563. /* function 12h subfunction 80h (Inquire VGA type) */
  564. #define EBIOS_CLGD5462 0x60 /* BIOS Laguna 1 signature */
  565. #define EBIOS_CLGD5464 0x64 /* BIOS Laguna 3D signature */
  566. #define EBIOS_CLGD5464B 0x61 /* BIOS Laguna 3D alt signature */
  567. #endif
  568. // END Chris' additions
  569. /*********************************************************************
  570. *
  571. * Error codes
  572. *
  573. **********************************************************************/
  574. #define LL_OK 0x0000 // There was no error
  575. #define LL_ERROR 0xffffffff // Generic error prefix
  576. #define LLE_PCX_FILE_OPEN 0x0002 // Error opening file
  577. #define LLE_PCX_READ_HEADER 0x0003 // Error reading the header
  578. #define LLE_PCX_NOT_SUITABLE 0x0004 // Not a suitable PCX file
  579. #define LLE_PCX_PALETTE_READ 0x0005 // Error reading the palette
  580. #define LLE_PCX_PALETTE_SEEK 0x0006 // Error seeking the palette
  581. #define LLE_PCX_ALLOC_PALETTE 0x0007 // Error allocating memory
  582. #define LLE_TEX_ALLOC 0x0008 // Texture memory allocation failure
  583. #define LLE_TEX_BAD_ID 0x0009 // Invalid texture ID
  584. #define LLE_TEX_TOO_MANY 0x000a // Too many textures
  585. #define LLE_TEX_DIMENSION 0x000b // Invalid texture dimensions
  586. #define LLE_TEX_TYPE 0x000c // Invalid texture type
  587. #define LLE_TEX_STORAGE 0x000d // Invalid storage type
  588. #define LLE_TEX_LOCKED 0x000e // Use of locked texture
  589. #define LLE_TEX_NOT_LOCKED 0x000f // Unlocking of unlocked texture
  590. #define LLE_BUF_CONFIG 0x0010 // Wrong buffers configuration
  591. #define LLE_BUF_PITCH 0x0011 // Invalid buffer pitch
  592. #define LLE_BUF_NUM 0x0012 // Too many buffers
  593. #define LLE_BUF_ALLOC 0x0013 // Error allocating buffer
  594. #define LLE_BUF_BAD_ID 0x0014 // Invalid buffer ID
  595. #define LLE_BUF_FREE 0x0015 // Buffer already free
  596. #define LLE_BUF_FREE_VIDEO 0x0016 // Cannot free a buffer in vram
  597. #define LLE_BUF_NOT_ALLOC 0x0017 // Buffer was not allocated
  598. #define LLE_INI_NOT_LAGUNA 0x0018 // Wrong hardware (from extended BIOS)
  599. #define LLE_INI_MODE 0x0019 // Invalid graphcs mode
  600. #define LLE_INI_DL_LEN 0x001a // Invalid display list size
  601. #define LLE_INI_ALLOC_DL 0x001b // D-list allocation error
  602. #define LLE_INI_Z_BUFFER 0x001c // Invalid Z buffer placement
  603. #define LLE_FON_LOAD 0x001d // Error loading font
  604. #define LLE_FON_ALLOC 0x001e // Error allocating font memory
  605. /*********************************************************************
  606. *
  607. * Function prototypes
  608. *
  609. **********************************************************************/
  610. // Init/Execute Functions
  611. //
  612. extern DWORD LL_InitLib( VOID *ppdev );
  613. #ifndef CGL // modemon way (mode.ini)
  614. extern DWORD LL_InitGraph( LL_DeviceState *DC, char *sController, char *sMode );
  615. #else // cgl's dll (embedded mode tables)
  616. extern DWORD LL_InitGraph( LL_DeviceState *DC, char *sController, int Mode );
  617. #endif
  618. extern DWORD LL_CloseGraph( LL_DeviceState *DC );
  619. extern void LL_QueueOp( LL_Batch *pBatch );
  620. extern void LL_Execute( LL_Batch * pBatch );
  621. extern void LL_Wait();
  622. extern void LL_SetRenderingMode( DWORD dwMode );
  623. #ifndef CGL // CGL has own version as of 6/24/96 - ChrisS may merge
  624. extern void LL_SetPalette( LL_Color * Col, BYTE first, int count );
  625. #endif
  626. extern BYTE LL_SpeedQualityDial( int SpeedQuality );
  627. // Buffer Functions
  628. //
  629. extern DWORD LL_AllocSystemBuffer( DWORD Xdim, DWORD Ydim, DWORD pitch );
  630. extern DWORD LL_RegisterUserBuffer( BYTE * pMem, DWORD Xdim, DWORD Ydim, DWORD pitch );
  631. extern DWORD LL_FreeSystemBuffer( DWORD dwBufID );
  632. // Texture Management Functions
  633. //
  634. #ifndef CGL
  635. extern DWORD LL_RegisterTexture( DWORD dwFlags, WORD wWidth, WORD wHeight, BYTE bType );
  636. #else
  637. extern DWORD LL_RegisterTexture( DWORD dwFlags, WORD wWidth, WORD wBufWidth, WORD wHeight, BYTE bType, DWORD dwAddress );
  638. #endif
  639. extern DWORD LL_FreeTexture( DWORD dwID );
  640. extern LL_Texture * LL_LockTexture( DWORD dwID );
  641. extern DWORD LL_UnLockTexture( DWORD dwID );
  642. extern DWORD LL_SetTexturePaletteOffset( DWORD dwID, BYTE bOffset );
  643. extern void UpdateTextureInfo();
  644. // Control Functions
  645. //
  646. extern void LL_SetZBuffer( DWORD buf_num );
  647. extern void LL_SetZCompareMode( DWORD dwZCompareMode );
  648. extern DWORD LL_GetZCompareMode();
  649. extern void LL_SetZMode( DWORD dwZMode );
  650. extern DWORD LL_GetZMode();
  651. extern void LL_SetAlphaMode( DWORD dwAlphaMode );
  652. extern DWORD LL_GetAlphaMode();
  653. extern void LL_SetAlphaDestColor( DWORD dwAlphaDestColor );
  654. extern DWORD LL_GetAlphaDestColor();
  655. extern void LL_SetLightingSource( DWORD dwLighting );
  656. extern DWORD LL_GetLightingSource();
  657. extern void LL_SetClipRegion( LL_Rect * rect );
  658. extern void LL_GetClipRegion( LL_Rect * rect );
  659. extern void LL_SetPattern( LL_Pattern *Pattern );
  660. extern void LL_GetPattern( LL_Pattern *Pattern );
  661. extern void LL_SetPatternOffset( BYTE bOffsetX, BYTE bOffsetY );
  662. extern void LL_GetPatternOffset( BYTE * pbOffsetX, BYTE * pbOffsetY );
  663. extern void LL_SetTextureColorBounds( DWORD dwControl, LL_Color * Min, LL_Color * Max );
  664. extern void LL_SetDestColorBounds( DWORD dwControl, LL_Color * Min, LL_Color * Max );
  665. extern void LL_SetColor0( DWORD dwColor0 );
  666. extern void LL_SetColor1( DWORD dwColor1 );
  667. extern void LL_GetColorRegisters( DWORD * pdwColor0, DWORD * pdwColor1 );
  668. extern void LL_SetConstantAlpha( WORD wSource, WORD wDestination );
  669. // Hardware cursor / Mouse functions
  670. //
  671. #ifndef CGL // CGL has own version as of 6/24/96 - ChrisS may merge
  672. extern void LL_SetCursor( BYTE bMode, LL_Color * pColor, BYTE * pbCursor);
  673. extern void LL_SetCursorPos( WORD wX, WORD wY );
  674. #endif // CGL
  675. extern void LL_GetMouseStatus( WORD * pwX, WORD * pwY, WORD * pwButtons );
  676. extern void LL_SetMouseCallback( void (far *fnCallback)( WORD wX, WORD wY, WORD wButtons ) );
  677. extern void LL_SetCursorHotSpot( BYTE bX, BYTE bY );
  678. // Font functions
  679. //
  680. extern LL_Font * LL_FontLoad( char * pName );
  681. extern LL_Font * LL_FontUnload( LL_Font * pFont );
  682. extern int LL_FontExtent( LL_Font * pFont, char * pString );
  683. extern int LL_FontWrite( LL_Font * pFont, LL_Point * pPoint, LL_Rect * pClip, char *pString );
  684. // Support Functons
  685. //
  686. extern void DumpDisplayList( DWORD *pPtr, DWORD dwLen );
  687. extern DWORD LL_PCX_Load( LL_Texture * pTex, char * sName, WORD wAlphaIndex );
  688. extern DWORD LL_PCX_Load_Buffer( DWORD dwBufID, char * sName, WORD wAlphaIndex, BYTE bType );
  689. extern char * LL_ErrorStr( DWORD error_code );
  690. #endif // _L3D_H_