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.

835 lines
31 KiB

  1. /**************************************************************************
  2. ***************************************************************************
  3. *
  4. * Copyright (c) 1997, Cirrus Logic, Inc.
  5. * All Rights Reserved
  6. *
  7. * FILE: l3system.h
  8. *
  9. * DESCRIPTION: 546X 3D engine defines and structures
  10. *
  11. * AUTHOR: Goran Devic, Mark Einkauf
  12. *
  13. * REVISION HISTORY:
  14. *
  15. * $Log: W:/log/laguna/ddraw/inc/l3system.h $
  16. *
  17. * Rev 1.4 01 Jul 1997 09:58:18 einkauf
  18. *
  19. * add dither x,y offsets, to fix bexact.c OpenGL conformance test
  20. *
  21. * Rev 1.3 08 Apr 1997 12:42:14 einkauf
  22. * cleanup TSystem struct; misc to complete MCD code
  23. *
  24. * Rev 1.2 05 Mar 1997 02:32:02 KENTL
  25. *
  26. * Attempted to merge Rev 1.0 with Rev 1.1. The most recent check-in was
  27. * severely incompatible with the Win95 build of DirectDraw. For some reason,
  28. * only a tiny section of this file is used or even compatible with the
  29. * Win95 build. Revision 1.0 had vast sections of the file commented out.
  30. * Apparently, those sections are required for the WinNT build. I wrapped
  31. * those sections in a couple of huge #ifdef WINNT_VER40, but I haven't
  32. * tested this in an NT build. It seems to work for Win95, though.
  33. *
  34. * Rev 1.0 25 Nov 1996 15:00:40 RUSSL
  35. * Initial revision.
  36. *
  37. ****************************************************************************
  38. ***************************************************************************/
  39. #ifndef _L3SYSTEM_H_
  40. #define _L3SYSTEM_H_
  41. #ifdef WINNT_VER40
  42. #define OPENGL_MCD
  43. /*********************************************************************
  44. * Include types and debug info
  45. **********************************************************************/
  46. #ifndef OPENGL_MCD // LL3D's type.h redundant with basic type definitions in other DDK/msdev headers
  47. #include "type.h"
  48. #endif // ndef OPENGL_MCD
  49. #include "l3d.h"
  50. #define TRUE 1
  51. #define FALSE 0
  52. /*********************************************************************
  53. * Local Variables and defines
  54. **********************************************************************/
  55. #define KB 1024 // Defines a kilobyte
  56. #define MAX_DL_SIZE (512 * KB) // Maximum size of display list
  57. #define NUM_DL 2 // Number of display lists
  58. #define NUM_BUFFERS 32 // Number of allocation buffers;
  59. // video, system memory and user
  60. #define NUM_TEXTURES 512 // Number of textures
  61. #define NUM_TEX_MEM 4 // Number of system texture memory
  62. // chunks (each chunk is 4Mb)
  63. #define EXTRA_FRACT 4 // Texture params functions may use
  64. // some extra bit for precision
  65. // MCD_TEMP - support for temporary dlist of 2K only
  66. #define SIZE_TEMP_DL 2048
  67. #define DL_START_OFFSET 20
  68. /*********************************************************************
  69. * Buffer flags in LL_State structure (dont change!)
  70. **********************************************************************/
  71. #define BUFFER_IN_RDRAM 0
  72. #define BUFFER_IN_SYSTEM 1
  73. #define Z_BUFFER 2
  74. #define BUFFER_USER 4
  75. #define BUFFER_FREE 0x80000000
  76. /*********************************************************************
  77. * Textures flags in LL_State structure (dont change!)
  78. **********************************************************************/
  79. #define TEX_FREE 0x80000000 // Free slot for the texture
  80. #define TEX_NOT_LOADED 0x40000000 // Texture just registered
  81. #define TEX_IN_SYSTEM 0x20000000 // Currently located in system mem
  82. #define TEX_TILED 0x10000000 // Texture is in tiled form
  83. #define TEX_LOCKED 0x08000000 // Texture is locked
  84. #define TEX_MAX_PRIORITY 0xfffffffe // Priority level
  85. #define TEX_DEFAULT_PRIORITY 1 // Default texture priority level
  86. /*********************************************************************
  87. *
  88. * Registers in the form suitable for adding to a pointer to a
  89. * double word.
  90. *
  91. **********************************************************************/
  92. ///////////////////////////////////////////////////////
  93. // 3D Rendering Registers //
  94. ///////////////////////////////////////////////////////
  95. #define X_3D (0x4000/4)
  96. #define Y_3D (0x4004/4)
  97. #define R_3D (0x4008/4)
  98. #define G_3D (0x400C/4)
  99. #define B_3D (0x4010/4)
  100. #define DX_MAIN_3D (0x4014/4)
  101. #define Y_COUNT_3D (0x4018/4)
  102. #define WIDTH1_3D (0x401C/4)
  103. #define WIDTH2_3D (0x4020/4)
  104. #define DWIDTH1_3D (0x4024/4)
  105. #define DWIDTH2_3D (0x4028/4)
  106. #define DR_MAIN_3D (0x402C/4)
  107. #define DG_MAIN_3D (0x4030/4)
  108. #define DB_MAIN_3D (0x4034/4)
  109. #define DR_ORTHO_3D (0x4038/4)
  110. #define DG_ORTHO_3D (0x403C/4)
  111. #define DB_ORTHO_3D (0x4040/4)
  112. #define Z_3D (0x4044/4)
  113. #define DZ_MAIN_3D (0x4048/4)
  114. #define DZ_ORTHO_3D (0x404C/4)
  115. #define V_3D (0x4050/4)
  116. #define U_3D (0x4054/4)
  117. #define DV_MAIN_3D (0x4058/4)
  118. #define DU_MAIN_3D (0x405C/4)
  119. #define DV_ORTHO_3D (0x4060/4)
  120. #define DU_ORTHO_3D (0x4064/4)
  121. #define D2V_MAIN_3D (0x4068/4)
  122. #define D2U_MAIN_3D (0x406C/4)
  123. #define D2V_ORTHO_3D (0x4070/4)
  124. #define D2U_ORTHO_3D (0x4074/4)
  125. #define DV_ORTHO_ADD_3D (0x4078/4)
  126. #define DU_ORTHO_ADD_3D (0x407C/4)
  127. #define A_3D (0x40C0/4)
  128. #define DA_MAIN_3D (0x40C4/4)
  129. #define DA_ORTHO_3D (0x40C8/4)
  130. ///////////////////////////////////////////////////////
  131. // 3D Control registers //
  132. ///////////////////////////////////////////////////////
  133. #define CONTROL_MASK_3D (0x4100/4)
  134. #define CONTROL0_3D (0x4104/4)
  135. #define COLOR_MIN_BOUNDS_3D (0x4108/4)
  136. #define COLOR_MAX_BOUNDS_3D (0x410C/4)
  137. #define CONTROL1_3D (0x4110/4)
  138. #define BASE0_ADDR_3D (0x4114/4)
  139. #define BASE1_ADDR_3D (0x4118/4)
  140. #define TX_CTL0_3D (0x4120/4)
  141. #define TX_XYBASE_3D (0x4124/4)
  142. #define TX_CTL1_3D (0x4128/4)
  143. #define TX_CTL2_3D (0x412C/4)
  144. #define COLOR0_3D (0x4130/4)
  145. #define COLOR1_3D (0x4134/4)
  146. #define Z_COLLIDE_3D (0x4138/4)
  147. #define STATUS0_3D (0x413C/4)
  148. #define PATTERN_RAM_0_3D (0x4140/4)
  149. #define PATTERN_RAM_1_3D (0x4144/4)
  150. #define PATTERN_RAM_2_3D (0x4148/4)
  151. #define PATTERN_RAM_3_3D (0x414C/4)
  152. #define PATTERN_RAM_4_3D (0x4150/4)
  153. #define PATTERN_RAM_5_3D (0x4154/4)
  154. #define PATTERN_RAM_6_3D (0x4158/4)
  155. #define PATTERN_RAM_7_3D (0x415C/4)
  156. #define X_CLIP_3D (0x4160/4)
  157. #define Y_CLIP_3D (0x4164/4)
  158. #define TEX_SRAM_CTRL_3D (0x4168/4)
  159. ///////////////////////////////////////////////////////
  160. // HostXY Unit Registers - Must use WRITE_DEV_REGS //
  161. ///////////////////////////////////////////////////////
  162. #define HXY_BASE0_ADDRESS_PTR_3D (0x4200/4)
  163. #define HXY_BASE0_START_XY_3D (0x4204/4)
  164. #define HXY_BASE0_EXTENT_XY_3D (0x4208/4)
  165. #define HXY_BASE1_ADDRESS_PTR_3D (0x4210/4)
  166. #define HXY_BASE1_OFFSET0_3D (0x4214/4)
  167. #define HXY_BASE1_OFFSET1_3D (0x4218/4)
  168. #define HXY_BASE1_LENGTH_3D (0x421C/4)
  169. #define HXY_HOST_CTRL_3D (0x4240/4)
  170. #define MAILBOX0_3D (0x4260/4)
  171. #define MAILBOX1_3D (0x4264/4)
  172. #define MAILBOX2_3D (0x4268/4)
  173. #define MAILBOX3_3D (0x426C/4)
  174. ///////////////////////////////////////////////////////
  175. // The 3D Prefetch Unit Registers //
  176. ///////////////////////////////////////////////////////
  177. #define PF_BASE_ADDR_3D (0x4400/4)
  178. #define PF_CTRL_3D (0x4404/4)
  179. #define PF_DEST_ADDR_3D (0x4408/4)
  180. #define PF_FB_SEG_3D (0x440C/4)
  181. #define PF_INST_ADDR_3D (0x4420/4)
  182. #define PF_STATUS_3D (0x4424/4)
  183. #define HOST_MASTER_CTRL_3D (0x4440/4)
  184. #define PF_INST_3D (0x4480/4)
  185. #define HOST_3D_DATA_PORT (0x4800/4)
  186. /*********************************************************************
  187. *
  188. * Device select for the WRITE_DEV_REGS instruction
  189. *
  190. **********************************************************************/
  191. #define VGAMEM (0x00000000 << 21)
  192. #define VGAFB (0x00000001 << 21)
  193. #define VPORT (0x00000002 << 21)
  194. #define LPB (0x00000003 << 21)
  195. #define MISC (0x00000004 << 21)
  196. #define ENG2D (0x00000005 << 21)
  197. #define HD (0x00000006 << 21)
  198. #define FB (0x00000007 << 21)
  199. #define ROM (0x00000008 << 21)
  200. #define ENG3D (0x00000009 << 21)
  201. #define HOST_XY (0x0000000A << 21)
  202. #define HDATA_3D (0x0000000B << 21)
  203. #endif // WINNT_VER40
  204. /*********************************************************************
  205. *
  206. * Laguna 3D Micro Instruction Set
  207. *
  208. **********************************************************************/
  209. #define OPCODE_MASK 0xF8000000
  210. #define POINT 0x00000000
  211. #define LINE 0x08000000
  212. #define POLY 0x10000000
  213. #define WRITE_REGISTER 0x18000000
  214. #define READ_REGISTER 0x20000000
  215. #define WRITE_DEV_REGS 0x28000000
  216. #define READ_DEV_REGS 0x30000000
  217. #define BRANCH 0x38000000
  218. #define C_BRANCH 0x40000000
  219. #define NC_BRANCH 0x48000000
  220. #define CALL 0x50000000
  221. #define WRITE_DEST_ADDR 0x58000000
  222. #define IDLE 0x68000000
  223. #define CLEAR 0x69400000
  224. #define WAIT 0x72000000
  225. #define WAIT_AND 0x72000000
  226. #define NWAIT_AND 0x73000000
  227. #define WAIT_OR 0x70000000
  228. #define NWAIT_OR 0x71000000
  229. #define CLEAR_INT 0x78000000
  230. #define SET_INT 0x7A000000
  231. #define TEST 0x80000000
  232. #define TEST_AND 0x82000000
  233. #define NTEST_AND 0x83000000
  234. #define TEST_OR 0x80000000
  235. #define NTEST_OR 0x81000000
  236. #define WRITE_PREFETCH_CONTROL 0x88000000
  237. #ifdef WINNT_VER40 // Not WINNT_VER40
  238. /*********************************************************************
  239. *
  240. * Prefetch status flags (Almost the same as events)
  241. *
  242. **********************************************************************/
  243. #define ST_VBLANK 0x00000001
  244. #define ST_EVSYNC 0x00000002
  245. #define ST_LINE_COMPARE 0x00000004
  246. #define ST_BUFFER_SWITCH 0x00000008
  247. #define ST_Z_BUFFER_COMPARE 0x00000010
  248. #define ST_POLY_ENG_BUSY 0x00000020
  249. #define ST_EXEC_ENG_3D_BUSY 0x00000040
  250. #define ST_XY_ENG_BUSY 0x00000080
  251. #define ST_BLT_ENG_BUSY 0x00000100
  252. #define ST_BLT_WF_EMPTY 0x00000200
  253. #define ST_DL_READY_STATUS 0x00000400
  254. /*********************************************************************
  255. *
  256. * Defines for pixel modes (Control0 register)
  257. *
  258. **********************************************************************/
  259. #define PIXEL_MODE_INDEXED 0
  260. #define PIXEL_MODE_332 1
  261. #define PIXEL_MODE_565 2
  262. #define PIXEL_MODE_555 3
  263. #define PIXEL_MODE_A888 4
  264. #define PIXEL_MODE_Z888 5
  265. /*********************************************************************
  266. *
  267. * Macros for building the instruction opcodes
  268. *
  269. **********************************************************************/
  270. //#define make_point( imodif, count ) (POINT | imodif | count)
  271. #define mk_reg( reg ) (((reg)-0x1000) << 6)
  272. #define mk_dev_reg( reg ) ((((reg)-0x1080)*4) << 6)
  273. #define write_register( reg, count ) \
  274. ( WRITE_REGISTER | mk_reg(reg) | count )
  275. #define write_dev_register( device, reg, count ) \
  276. ( WRITE_DEV_REGS | device | mk_dev_reg(reg) | count )
  277. // Set the register and the cache in LL_State to a specific value
  278. #define SETREG(Offset,Reg,Value) \
  279. *(ppdev->LL_State.pRegs + (Offset)) = ppdev->LL_State.Reg = (Value); /*inp(0x80); inp(0x80)*/
  280. // setreg, no cache: do not cache state for this register
  281. #define SETREG_NC(reg, value) \
  282. (*(ppdev->LL_State.pRegs + reg) = value); /*inp(0x80); inp(0x80)*/
  283. // Clears the range of registers
  284. #define CLEAR_RANGE( StartReg, EndReg ) \
  285. memset( (void *)(ppdev->LL_State.pRegs + (StartReg)), 0, ((EndReg) - (StartReg)+1)*4 )
  286. #ifndef OPENGL_MCD
  287. // The polling for the 3d engine busy bit is done inline to avoid Watcom
  288. // optimization of accessing a byte instead of a dword of that register.
  289. //
  290. #pragma aux Poll3DEngineBusy = \
  291. "lp: test dword ptr [eax], 2" \
  292. " jnz lp" \
  293. parm caller [eax];
  294. #endif // ndef OPENGL_MCD
  295. // Instruction modifier set
  296. //
  297. #define STALL 0x04000000
  298. #define GOURAUD 0x00001000
  299. #define Z_ON 0x00002000
  300. #define SAME_COLOR 0x00008000
  301. #define TEXTURE_LINEAR 0x00020000
  302. #define TEXTURE_PERSPECTIVE 0x00030000
  303. #define LIGHTING 0x00040000
  304. #define STIPPLE 0x00080000
  305. #define PATTERN 0x00100000
  306. #define DITHER 0x00200000
  307. #define ALPHA 0x00400000
  308. #define FETCH_COLOR 0x00800000
  309. #define WARP_MODE 0x01000000
  310. #define MODIFIER_EXPANSION 0x02000000
  311. /*********************************************************************
  312. *
  313. * Speed / Quality decision values
  314. *
  315. **********************************************************************/
  316. #define LLQ_POLY_SUBPIXEL 192 // When poly param will use fp / subpixels
  317. #define LLQ_POLY_FLOAT 64 // Polys start to use fp
  318. #define LLQ_LINE_SUBPIXEL 128 // When lines will consider subpixel addressing
  319. /*********************************************************************
  320. *
  321. * Control0_3d register bitfields
  322. *
  323. **********************************************************************/
  324. typedef struct
  325. {
  326. DWORD Pixel_Mode : 3; // Color frame buffer drawing mode
  327. DWORD Res1 : 1; // Reserved
  328. DWORD Pixel_Mask_Enable : 1; // Enables pixel masking
  329. DWORD Pixel_Mask_Polarity : 1; // Polarity of the pixel masks
  330. DWORD Color_Saturate_En : 1; // Enables saturation in indexed mode
  331. DWORD Red_Color_Compare_En : 1; // Enables compare to bounds for red
  332. DWORD Green_Color_Compare_En: 1; // Enables compare to bounds for green
  333. DWORD Blue_Color_Compare_En : 1; // Enables compare to bounds for blue
  334. DWORD Color_Compare_Mode : 1; // Mask inclusive/exclusive to bounds
  335. DWORD Alpha_Mode : 2; // Selects alpha blending mode
  336. DWORD Alpha_Dest_Color_Sel : 2; // Selects the DEST_RGB input to alpha
  337. DWORD Alpha_Blending_Enable : 1; // Enables alpha blending
  338. DWORD Z_Stride_Control : 1; // 16/8 bit Z depth
  339. DWORD Frame_Scaling_Enable : 1; // Enables frame scaling (multiply src*dest)
  340. DWORD Res2 : 2; // Reserved
  341. DWORD Z_Compare_Mode : 4; // Different Z compare function
  342. DWORD Z_Collision_Detect_En : 1; // Enables Z collision detection
  343. DWORD Light_Src_Sel : 2; // Selects the lighting source input
  344. DWORD Res3 : 1; // Reserved
  345. DWORD Z_Mode : 3; // Controls Z and color update method
  346. DWORD Res4 : 1; // Reserved
  347. } TControl0Reg;
  348. /*********************************************************************
  349. *
  350. * Base0_addr_3d register bitfields
  351. *
  352. **********************************************************************/
  353. typedef struct
  354. {
  355. DWORD Res1 : 6; // Reserved
  356. DWORD Color_Buffer_X_Offset : 7; // Offset to color buffer X address
  357. DWORD Color_Buffer_Location : 1; // For drawing: 0-rdram, 1-host
  358. DWORD Z_Buffer_Location : 1; // For drawing: 0-rdram, 1-host
  359. DWORD Texture_Location : 1; // For drawing: 0-rdram, 1-host
  360. DWORD Pattern_Y_Offset : 4; // Pattern lookup offset for y address
  361. DWORD Res2 : 4; // Reserved
  362. DWORD Pattern_X_Offset : 4; // Pattern lookup offset for x address
  363. DWORD Res3 : 4; // Reserved
  364. } TBase0Reg;
  365. /*********************************************************************
  366. *
  367. * Base1_addr_3d register bitfields
  368. *
  369. **********************************************************************/
  370. typedef struct
  371. {
  372. DWORD Res1 : 5; // Reserved
  373. DWORD Color_Buffer_Y_Offset : 8; // Y offset from the color space Y base
  374. DWORD Res2 : 8; // Reserved
  375. DWORD Z_Buffer_Y_Offset : 8; // Y offset from the color space Y base
  376. DWORD Res3 : 3; // Reserved
  377. } TBase1Reg;
  378. /*********************************************************************
  379. *
  380. * Tx_Ctl0_3d register bitfields
  381. *
  382. **********************************************************************/
  383. #define TX_CTL0_MASK (~0x0C08F000)// All the reserved bits
  384. typedef struct
  385. {
  386. DWORD Tex_U_Address_Mask : 3; // Texture width (U space)
  387. DWORD Tex_U_Ovf_Sat_En : 1; // Texture saturation enable for U
  388. DWORD Tex_V_Address_Mask : 3; // Texture height (V space)
  389. DWORD Tex_V_Ovf_Sat_En : 1; // Texture saturation enable for V
  390. DWORD Texel_Mode : 4; // Texture type
  391. DWORD Res1 : 4; // Reserved
  392. DWORD Texel_Lookup_En : 1; // Use texel data as lookup index
  393. DWORD Tex_As_Src : 1; // Specifies texture as source
  394. DWORD Fil_Tex_En : 1; // Enables filtering
  395. DWORD Res2 : 1; // Reserved
  396. DWORD Tex_Mask_Polarity : 1; // Polarity of the masking bit
  397. DWORD Tex_Mask_Enable : 1; // Enables texture masking
  398. DWORD Tex_Mask_Function : 1; // Texture masking function
  399. DWORD UV_Precision : 1; // UV_Precision 8.24
  400. DWORD Address_Mux : 2; // Texel UV Mux Select
  401. DWORD Res4 : 2; // Reserved
  402. DWORD CLUT_Offset : 4; // Color Lookup Table offset for 4, 8 bpp
  403. } TTxCtl0Reg;
  404. /*********************************************************************
  405. *
  406. * Tx_Ctl1_3d register bitfields
  407. *
  408. **********************************************************************/
  409. typedef struct
  410. {
  411. DWORD Tex_Min_Blue_Color : 8;
  412. DWORD Tex_Min_Green_Color : 8;
  413. DWORD Tex_Min_Red_Color : 8;
  414. DWORD Tex_Red_Color_Compare : 1;
  415. DWORD Tex_Green_Color_Compare : 1;
  416. DWORD Tex_Blue_Color_Compare : 1;
  417. DWORD Tex_Color_Compare_Mode : 1;
  418. DWORD Res : 4;
  419. } TTxCtl1Reg;
  420. /*********************************************************************
  421. *
  422. * Tx_Ctl2_3d register bitfields
  423. *
  424. **********************************************************************/
  425. typedef struct
  426. {
  427. DWORD Tex_Max_Blue_Color : 8;
  428. DWORD Tex_Max_Green_Color : 8;
  429. DWORD Tex_Max_Red_Color : 8;
  430. DWORD Tex_Fraction_Mask : 3;
  431. DWORD En_Cont_Bilinear : 1;
  432. DWORD En_Step_Bilinear : 1;
  433. DWORD Mask_Threshold : 3;
  434. } TTxCtl2Reg;
  435. /*********************************************************************
  436. *
  437. * Tx_XYBase_3d register bitfields
  438. *
  439. **********************************************************************/
  440. typedef struct
  441. {
  442. WORD Tex_X_Base_Addr; // Texture base X coordinate
  443. WORD Tex_Y_Base_Addr; // Texture base Y coordinate
  444. } TTxXYBaseReg;
  445. /*********************************************************************
  446. *
  447. * HXY_Host_Ctrl_3d register bitfields
  448. *
  449. **********************************************************************/
  450. typedef struct
  451. {
  452. DWORD HostXYEnable : 1; // Host XY enable bit
  453. DWORD Res1 : 7; // Reserved
  454. DWORD HostYPitch : 6; // Host Y Pitch of the system
  455. DWORD Res2 : 18; // Reserved
  456. } THXYHostCtrlReg;
  457. /*********************************************************************
  458. *
  459. * TMem structure defines a memory block
  460. *
  461. **********************************************************************/
  462. typedef struct
  463. {
  464. DWORD hMem; // Memory handle
  465. DWORD *dwAddress; // Linear address
  466. DWORD dwSize; // Size of the buffer
  467. DWORD dwPhyPtr; // Physical / page table address
  468. } TMem;
  469. /*********************************************************************
  470. *
  471. * Buffer information structure (buffers A, B, Z, ...)
  472. *
  473. **********************************************************************/
  474. typedef struct
  475. {
  476. DWORD dwFlags; // Buffer flags
  477. DWORD dwAddress; // Buffer start byte address (absolute linear)
  478. DWORD dwPhyAdr; // Buffer physical address (system)
  479. DWORD dwPitchCode; // Pitch code of a buffer (system)
  480. DWORD dwPitchBytes; // Pitch of a buffer in bytes
  481. DWORD hMem; // Internal memory handle (system)
  482. LL_Rect Extent; // Buffer location offsets (video)
  483. } TBuffer;
  484. /*********************************************************************
  485. *
  486. * TDisplayList structure defines a display list.
  487. *
  488. **********************************************************************/
  489. typedef struct
  490. {
  491. // pdwNext points to the next available location within this
  492. // display list to fill in the Laguna instruction.
  493. // It is used for parametarization routines that postincrement
  494. // this variable.
  495. //
  496. DWORD *pdwNext;
  497. // Memory handle for this display list as optained from the
  498. // internal memory allocation function
  499. //
  500. DWORD hMem;
  501. // Linear address of the display list
  502. //
  503. DWORD *pdwLinPtr;
  504. // Linear address of the display list
  505. //
  506. DWORD *pdwStartOutPtr; //ME - next word to be output
  507. // Physical address for a display list is next; it may also
  508. // be the address to the page table. This address has the
  509. // appropriate format to be stored in the BASE* class registers
  510. //
  511. DWORD dwPhyPtr;
  512. // The length of a display list in bytes
  513. //
  514. DWORD dwLen;
  515. // Safety margin for building the display list
  516. //
  517. DWORD dwMargin;
  518. } TDisplayList;
  519. /*********************************************************************
  520. *
  521. * TTextureState structure defines a texture state
  522. *
  523. **********************************************************************/
  524. typedef struct
  525. {
  526. LL_Texture Tex[ NUM_TEXTURES ]; // Array of texture information
  527. TMem Mem[ NUM_TEX_MEM ]; // Allocated memory information
  528. DWORD dwMemBlocks; // Number of Mem entries used
  529. LL_Texture *pLastTexture; // Used to cache textures
  530. } TTextureState;
  531. /*********************************************************************
  532. *
  533. * TTextureRegs structure defines a texture registers
  534. *
  535. **********************************************************************/
  536. typedef struct
  537. {
  538. DWORD dv_main;
  539. DWORD du_main;
  540. DWORD dv_ortho;
  541. DWORD du_ortho;
  542. DWORD d2v_main;
  543. DWORD d2u_main;
  544. DWORD d2v_ortho;
  545. DWORD d2u_ortho;
  546. DWORD dv_ortho_add;
  547. DWORD du_ortho_add;
  548. } TTextureRegs;
  549. /*********************************************************************
  550. *
  551. * System State Structure
  552. *
  553. **********************************************************************/
  554. typedef struct
  555. {
  556. DWORD rColor_Min_Bounds; // Color compare min bounds
  557. DWORD rColor_Max_Bounds; // Color compare max bounds
  558. DWORD AlphaConstSource; // Constant source alpha (9:16)
  559. DWORD AlphaConstDest; // Constant destination alpha (9:16)
  560. // Display lists management
  561. TDisplayList DL[ NUM_DL ]; // Array of d-list segments
  562. TDisplayList *pDL; // Current display list to build
  563. DWORD dwCdl; // Index of the current d-list
  564. // Information from the init / current graphics mode
  565. DWORD *pRegs; // Register apperture
  566. BYTE *pFrame; // Frame apperture
  567. unsigned int pattern_ram_state;
  568. LL_Pattern dither_array;
  569. WORD dither_x_offset;
  570. WORD dither_y_offset;
  571. } TSystem;
  572. typedef struct // MOUSE header structure
  573. {
  574. WORD wX_Position;
  575. WORD wY_Position;
  576. WORD wStatus; //assigned to NEED_MOUSE_UPDATE or MOUSE_IS_UPDATED
  577. } TMouseInfo;
  578. extern void _TriFillTex(
  579. int right2left,
  580. int hiprecision_2ndorder,
  581. TTextureRegs * r,
  582. TEXTURE_VERTEX *vmin,
  583. TEXTURE_VERTEX *vmid,
  584. TEXTURE_VERTEX *vmax,
  585. float frecip_vm_y,
  586. float frecip_del_x_mid );
  587. void _RunLaguna( );
  588. #ifndef OPENGL_MCD // from here down, structs are more specific to LL3D
  589. /*********************************************************************
  590. * Global Variables
  591. **********************************************************************/
  592. extern TSystem LL_State;
  593. extern TMouseInfo LL_MouseInfo;
  594. /*********************************************************************
  595. * External Functions
  596. **********************************************************************/
  597. extern BYTE * GetLagunaApperture( int base );
  598. /*********************************************************************
  599. * From PAGETBL.C:
  600. **********************************************************************/
  601. extern DWORD AllocSystemMemory( DWORD dwSize );
  602. extern void FreeSystemMemory( DWORD hHandle );
  603. extern DWORD GetLinearAddress( DWORD hHandle );
  604. extern DWORD GetPhysicalAddress( DWORD hHandle );
  605. extern DWORD * GetRegisterApperture();
  606. /*********************************************************************
  607. * Extern functions: l3d.c, control.c, points.c, lines.c, polys.c
  608. **********************************************************************/
  609. extern DWORD * fnInvalidOp( DWORD *, LL_Batch * );
  610. extern DWORD * fnNop( DWORD *, LL_Batch * );
  611. extern DWORD * fnPoint( DWORD *, LL_Batch * );
  612. extern DWORD * fnAALine( DWORD *, LL_Batch * );
  613. extern DWORD * fnLine( DWORD *, LL_Batch * );
  614. extern DWORD * fnPoly( DWORD *, LL_Batch * );
  615. extern DWORD * fnNicePoly( DWORD *, LL_Batch * );
  616. extern DWORD * fnPolyFast( DWORD *, LL_Batch * );
  617. extern DWORD * fnSetClipRegion( DWORD *, LL_Batch * );
  618. extern DWORD * fnSetZBuffer( DWORD *, LL_Batch * );
  619. extern DWORD * fnSetZCompareMode( DWORD *, LL_Batch * );
  620. extern DWORD * fnSetZMode( DWORD *, LL_Batch * );
  621. extern DWORD * fnSetAlphaMode( DWORD *, LL_Batch * );
  622. extern DWORD * fnSetAlphaDestColor( DWORD *, LL_Batch * );
  623. extern DWORD * fnSetLightingSource( DWORD *, LL_Batch * );
  624. extern DWORD * fnSetColor0( DWORD *, LL_Batch * );
  625. extern DWORD * fnSetColor1( DWORD *, LL_Batch * );
  626. extern DWORD * fnSetConstantAlpha( DWORD *, LL_Batch * );
  627. extern DWORD * fnSetPattern(DWORD *dwNext, LL_Batch *pBatch);
  628. extern DWORD * fnQuality( DWORD *, LL_Batch * );
  629. extern DWORD * fnSetTextureColorBounds( DWORD *, LL_Batch * );
  630. extern DWORD * fnSetDestColorBounds( DWORD *, LL_Batch * );
  631. extern void LL_ControlInit();
  632. extern void _ShutDown( char * szMsg, ... );
  633. /*********************************************************************
  634. * From displist.c
  635. **********************************************************************/
  636. extern DWORD * (* fnList[256])( DWORD *, LL_Batch * );
  637. extern DWORD * _RunLaguna( DWORD *pdwNext );
  638. /*********************************************************************
  639. * From textures.c
  640. **********************************************************************/
  641. extern int _InitTextures();
  642. extern void _CloseTextures();
  643. /*********************************************************************
  644. * From mem.c
  645. **********************************************************************/
  646. extern void _InitKmem( BYTE *, DWORD );
  647. extern DWORD * _kmalloc( const DWORD * pBlock, int );
  648. extern void _kfree( const DWORD * pBlock, void * );
  649. /*********************************************************************
  650. * From texparm.c
  651. **********************************************************************/
  652. typedef union
  653. {
  654. float f;
  655. long i;
  656. } PTEXTURE;
  657. #define CGL_XYZ DWORD
  658. extern void _TriFillTex( int dir_flag, int dx_main, TTextureRegs * r,
  659. #ifdef B4_PERF
  660. LL_Vert * vmin, LL_Vert * vmid, LL_Vert * vmax,
  661. #else
  662. CGL_XYZ *pV1, PTEXTURE *pT1,
  663. CGL_XYZ *pV2, PTEXTURE *pT2,
  664. CGL_XYZ *pV3, PTEXTURE *pT3,
  665. #endif
  666. int recip_vm_y, int recip_vd_y, int del_x_mid );
  667. /*********************************************************************
  668. *
  669. * Debug defines that are used to determine the specific file
  670. * for inclusion of debug information. For definition, see makefile.
  671. *
  672. **********************************************************************/
  673. #define DEBUG_L3D 0x0001 /* Enable debug info in L3d.c */
  674. #define DEBUG_PAGETBL 0x0002 /* Enable debug info in pagetbl.c */
  675. #define DEBUG_CONTROL 0x0004 /* Enable debug info in control.c */
  676. #define DEBUG_MEM 0x0008 /* Enable debug info in mem.c */
  677. #define DEBUG_TEX 0x0010 /* Enable debug info in textures.c */
  678. #define DEBUG_PCX 0x0020 /* Enable debug info in pcx.c */
  679. #define DEBUG_BUFFERS 0x0040 /* Enable debug info in buffers.c */
  680. #ifdef CGL // added for CGL DLL
  681. #define L3D_MALLOC dpmiAlloc
  682. #define L3D_FREE dpmiFree
  683. #else
  684. #define L3D_MALLOC malloc
  685. #define L3D_FREE free
  686. #endif
  687. #endif // ndef OPENGL_MCD
  688. #endif // _L3SYSTEM_H_
  689. #endif // WINNT_VER40