Source code of Windows XP (NT5)
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.

664 lines
19 KiB

  1. /*****************************************************************************
  2. *
  3. * file name: sxci.h
  4. *
  5. ******************************************************************************/
  6. /* [dlee] Modified for Windows NT */
  7. #ifdef WINDOWS_NT
  8. extern PVOID pMgaDeviceExtension;
  9. #endif
  10. /*
  11. * opcodes for SXCI
  12. */
  13. /*** general opcodes ***/
  14. #define CLEAR 0x0004
  15. #define DONE 0x0001
  16. #define INITRC 0x0E00
  17. #define NOOP 0x0501
  18. #define SETBUFFERCONFIGURATION 0x0300
  19. #define SETBGCOLOR 0x1800
  20. #define SETCLIPLIST 0x0500
  21. #define SETENDPOINT 0x1700
  22. #define SETFGCOLOR 0x0402
  23. #define SETFILLPATTERN 0x1600
  24. #define SETLINESTYLE 0x0502
  25. #define SETLINESTYLEOFFSET 0x0600
  26. #define SETLOGICOP 0x0800
  27. #define SETTRANSPARENCY 0x1400
  28. #define SETTRIVIALIN 0x1300
  29. #define SYNC 0x0301
  30. /*** screen opcodes ***/
  31. #define RENDERSCPOLYLINE 0x0304
  32. #define RENDERSCPOLYGON 0x0404
  33. #define SPANLINE 0x0204
  34. /*** 2D opcodes ***/
  35. #define RENDER2DMULTIPOLYLINE 0x0602
  36. #define RENDER2DMULTIPOLYLINE32 0x0a02
  37. #define RENDER2DPOLYGON 0x0302
  38. #define RENDER2DPOLYGON32 0x0902
  39. #define SET2DVIEWPORT 0x0002
  40. #define SET2DWINDOW 0x0102
  41. #define SET2DWINDOW32 0x0702
  42. /*** 3D opcodes ***/
  43. #define CHANGEMATRIX 0x0000
  44. #define RENDERPOLYLINE 0x0103
  45. #define RENDERPOLYQUAD 0x0203
  46. #define RENDERPOLYTRIANGLE 0x0303
  47. #define SETCLIP3D 0x0400
  48. #define SETLIGHTSOURCES 0x0700
  49. #define SETRENDERDATA 0x1000
  50. #define SETRENDERMODE 0x0A00
  51. #define SETSURFACEATTR 0x1100
  52. #define SETVIEWER 0x0B00
  53. #define SETZBUFFER 0x0c00
  54. /*
  55. * typedefs for SXCI data
  56. */
  57. typedef float IFLOAT; /* integer value passed as a float */
  58. typedef float NFLOAT; /* a normalized float 0.0 <= value <= 1.0 */
  59. typedef struct {
  60. double x;
  61. double y;
  62. double z;
  63. } point;
  64. typedef enum {
  65. Xaxis,
  66. Yaxis,
  67. Zaxis,
  68. Waxis
  69. } axis_name;
  70. typedef struct {
  71. double data[4][4];
  72. } matrix;
  73. typedef struct {
  74. float M[4][4];
  75. } MATRIX4;
  76. typedef struct {
  77. float X;
  78. float Y;
  79. float Z;
  80. } POINT3;
  81. typedef struct {
  82. NFLOAT X;
  83. NFLOAT Y;
  84. NFLOAT Z;
  85. } NORM3; /* where X*X + Y*Y + Z*Z = 1.0 */
  86. typedef struct {
  87. NFLOAT Red;
  88. NFLOAT Green;
  89. NFLOAT Blue;
  90. } COLOR3;
  91. /* sxci interprets these 16-bit datum as a signed values */
  92. typedef struct {
  93. word X;
  94. word Y;
  95. } IPOINT2;
  96. /* sxci interprets these 32-bit datum as a signed values */
  97. typedef struct {
  98. dword X;
  99. dword Y;
  100. } IPOINT2_32;
  101. #define NULL_LIGHT_TYPE 0.0
  102. typedef struct {
  103. float Type; /* Type = 0.0 */
  104. } NULL_LIGHT;
  105. #define AMBIENT_LIGHT_TYPE 1.0
  106. typedef struct {
  107. float Type; /* Type = 1.0 */
  108. COLOR3 AmbientCol;
  109. } AMBIENT_LIGHT;
  110. #define DIRECTIONAL_LIGHT_TYPE 2.0
  111. typedef struct {
  112. float Type; /* Type = 2.0 */
  113. COLOR3 DiffuseCol;
  114. COLOR3 SpecularCol;
  115. NORM3 Direction;
  116. } DIRECTIONAL_LIGHT;
  117. #define POSITIONAL_LIGHT_TYPE 3.0
  118. typedef struct {
  119. float Type; /* Type = 3.0 */
  120. COLOR3 DiffuseCol;
  121. COLOR3 SpecularCol;
  122. POINT3 Position;
  123. NFLOAT AttGlobal;
  124. NFLOAT AttDist;
  125. } POSITIONAL_LIGHT;
  126. #define SPOT_LIGHT_TYPE 4.0
  127. typedef struct {
  128. float Type; /* Type = 4.0 */
  129. COLOR3 DiffuseCol;
  130. COLOR3 SpecularCol;
  131. POINT3 Position;
  132. NORM3 Direction;
  133. NFLOAT AttGlobal;
  134. NFLOAT AttDist;
  135. IFLOAT ConeExp;
  136. NFLOAT CosMaxIAngle;
  137. NFLOAT CosAttIAngle;
  138. } SPOT_LIGHT;
  139. typedef union {
  140. NULL_LIGHT Null_Light;
  141. AMBIENT_LIGHT Ambient_Light;
  142. DIRECTIONAL_LIGHT Directional_Light;
  143. POSITIONAL_LIGHT Positional_Light;
  144. SPOT_LIGHT Spot_Light;
  145. } LIGHT_SOURCES;
  146. /*
  147. * typedefs for SXCI commands (templates)
  148. */
  149. /* -------------------------------------------------------------------
  150. * General Opcodes
  151. * ------------------------------------------------------------------- */
  152. /*** Clear ***/
  153. #define DISPLAY_AND_Z 0x0
  154. #define DISPLAY_ONLY 0x1
  155. #define Z_ONLY 0x2
  156. #define Z_NEAR 0.0
  157. #define Z_FAR 1.0
  158. typedef struct {
  159. short Opcode; /* 0x0004 */
  160. short ClearMode; /* 0 = clear display and z */
  161. /* 1 = clear display only */
  162. /* 2 = clear Z-buffer only */
  163. long RcId; /* Rendering context Id */
  164. COLOR3 ClearColor; /* color for display clear */
  165. NFLOAT ClearDepth; /* Depth for Z-buffer clear */
  166. } Clear;
  167. /*** Done ***/
  168. typedef struct {
  169. short Opcode; /* 0x0001 */
  170. char Null;
  171. char Reserved;
  172. } Done;
  173. /*** InitRc ***/
  174. typedef struct {
  175. short Opcode; /* 0x0E00 */
  176. short Null;
  177. long RcId;
  178. } InitRc;
  179. /*** NoOp ***/
  180. typedef struct {
  181. short Opcode; /* 0x0501 */
  182. short Len; /* Number of longs to skip */
  183. long RcId; /* Rendering context Id */
  184. long Data[1]; /* Data buffer to skip */
  185. } NoOp;
  186. /*** SetBufferConfiguration ***/
  187. #define TC_FULL_DEPTH 0 /* Normal mode:display full depth frame buffer */
  188. #define TC_BUF_A 1 /* Double-buffer mode: display frame buffer A */
  189. #define TC_BUF_B 2 /* Double-buffer mode: display frame buffer B */
  190. typedef struct {
  191. short Opcode; /* 0x0300 */
  192. char BcDisplayMode;
  193. char BcDrawMode;
  194. long RcId; /* Rendering context Id */
  195. } SetBufferConfiguration;
  196. /*** SetBgColor ***/
  197. typedef struct {
  198. short Opcode; /* 0x1800 */
  199. short Null;
  200. long RcId; /* Rendering context Id */
  201. COLOR3 BgColor; /* Background color */
  202. } SetBgColor;
  203. /*** SetCliplist ***/
  204. typedef struct {
  205. short Opcode;
  206. short CliplistLength;
  207. long RcId;
  208. long ClipId;
  209. mtxClipList Cliplist;
  210. } SetCliplist;
  211. /*** SetEndPoint ***/
  212. typedef struct {
  213. short Opcode; /* 0x1700 */
  214. short EndPoint; /* 0 = disabled, 1 = Enabled */
  215. long RcId; /* Rendering context Id */
  216. } SetEndPoint;
  217. /*** SetFgColor ***/
  218. typedef struct {
  219. short Opcode; /* 0x0402 */
  220. short Null;
  221. long RcId; /* Rendering context Id */
  222. COLOR3 FgColor; /* Foreground color */
  223. } SetFgColor;
  224. /*** SetFillPattern ***/
  225. typedef struct {
  226. short Opcode; /* 0x1600 */
  227. short PattMode; /* 0 = disabled, 1 = Enabled */
  228. long RcId; /* Rendering context Id */
  229. char FillPatt[8]; /* Fill pattern data */
  230. } SetFillPattern;
  231. /*** SetLinesStyle ***/
  232. typedef struct {
  233. short Opcode; /* 0x0502 */
  234. short LsMode; /* 0 = disabled, 1 = Enabled */
  235. long RcId; /* Rendering context Id */
  236. long LineStyle; /* 32-bit line style */
  237. } SetLineStyle;
  238. /*** SetLinesStyleOffset ***/
  239. typedef struct {
  240. short Opcode; /* 0x0600 */
  241. short Offset; /* Offset to shift the pattern when it is */
  242. /* reset (value 0 to 31 */
  243. long RcId; /* Rendering context Id */
  244. } SetLineStyleOffset;
  245. /*** SetLogicOp ***/
  246. #define CLEAR_OP ((word)0x0)
  247. #define NOR ((word)0x1)
  248. #define ANDINVERTED ((word)0x2)
  249. #define REPLACEINVERTED ((word)0x3)
  250. #define ANDREVERSE ((word)0x4)
  251. #define INVERT ((word)0x5)
  252. #define XOR ((word)0x6)
  253. #define NAND ((word)0x7)
  254. #define AND ((word)0x8)
  255. #define EQUIV ((word)0x9)
  256. #define NOOP_OP ((word)0xa)
  257. #define ORINVERTED ((word)0xb)
  258. #define REPLACE ((word)0xc)
  259. #define ORREVERSE ((word)0xd)
  260. #define OR ((word)0xe)
  261. #define SET ((word)0xf)
  262. typedef struct {
  263. short Opcode; /* 0x0800 */
  264. short LogicOp;
  265. long RcId; /* Rendering context Id */
  266. } SetLogicOp;
  267. /*** SetTransparency ***/
  268. #if !defined(OPAQUE)
  269. #define OPAQUE ((word)0x0)
  270. #endif
  271. #if !defined(TRANSPARENT)
  272. #define TRANSPARENT ((word)0x1)
  273. #endif
  274. typedef struct {
  275. short Opcode; /* 0x1400 */
  276. short TranspMode; /* 0 = opaque, 1 = transparent */
  277. long RcId; /* Rendering context Id */
  278. } SetTransparency;
  279. /*** SetTrivialIn ***/
  280. typedef struct {
  281. short Opcode;
  282. short TrivMode;
  283. long RcId;
  284. } SetTrivialIn;
  285. /*** Sync ***/
  286. typedef struct {
  287. short Opcode; /* 0x0301 */
  288. char Null;
  289. char Reserved;
  290. long RcId; /* Special RcId set to -1 */
  291. } Sync;
  292. /* -------------------------------------------------------------------
  293. * Screen Opcodes
  294. * ------------------------------------------------------------------- */
  295. /*** RenderScPolyline ***/
  296. typedef struct {
  297. short Opcode; /* 0x0304 */
  298. short Npts; /* Number of points */
  299. long RcId; /* Rendering context Id */
  300. IPOINT2 Points[1]; /* xy coordinates */
  301. } RenderScPolyline;
  302. /*** RenderScPolygon ***/
  303. typedef struct {
  304. short Opcode; /* 0x0404 */
  305. short Npts; /* MUST be 3 or 4 */
  306. long RcId; /* Rendering context Id */
  307. IPOINT2 Points[1]; /* Array of points */
  308. } RenderScPolygon;
  309. /*** SpanLine ***/
  310. typedef struct {
  311. short Opcode; /* 0x0204 */
  312. short Null;
  313. long RcId; /* Rendering context Id */
  314. long YPosition; /* Vertical screen position */
  315. long XStart; /* Start point (screen coords) */
  316. long XEnd; /* End point (screen coords) */
  317. long ZStart; /* Start Z value (screen coords) */
  318. long ZEnd; /* End Z value (screen coords) */
  319. COLOR3 RGBStart; /* Start RGB value */
  320. COLOR3 RGBEnd; /* End RGB value */
  321. } SpanLine;
  322. /* -------------------------------------------------------------------
  323. * 2D Opcodes
  324. * ------------------------------------------------------------------- */
  325. /*** Render2dMultiPolyline ***/
  326. typedef struct {
  327. short Opcode; /* 0x0602 */
  328. short Npts; /* Number of points */
  329. long RcId; /* Rendering context Id */
  330. IPOINT2 Data[1]; /* Data consisting of tag fields and xy coords */
  331. } Render2dMultiPolyline;
  332. /*** Render2dMultiPolyline32 ***/
  333. typedef struct {
  334. short Opcode; /* 0x0A02 */
  335. short Npts; /* Number of points */
  336. long RcId; /* Rendering context Id */
  337. IPOINT2_32 Data[1]; /* Data consisting of tag fields and xy coords */
  338. } Render2dMultiPolyline32;
  339. /*** Render2dPolygon ***/
  340. typedef struct {
  341. short Opcode; /* 0x0302 */
  342. short Npts; /* MUST be 3 or 4 */
  343. long RcId; /* Rendering context Id */
  344. IPOINT2 Points[1]; /* Array of points */
  345. } Render2dPolygon;
  346. /*** Render2dPolygon32 ***/
  347. typedef struct {
  348. short Opcode; /* 0x0902 */
  349. short Npts; /* MUST be 3 or 4 */
  350. long RcId; /* Rendering context Id */
  351. IPOINT2_32 Data[1]; /* Array of points */
  352. } Render2dPolygon32;
  353. /*** Set2dViewport ***/
  354. typedef struct {
  355. short Opcode; /* 0x0002 */
  356. short Null;
  357. long RcId;
  358. IPOINT2 XMinYMin;
  359. IPOINT2 XMaxYMax;
  360. } Set2dViewport;
  361. /*** Set2dWindow ***/
  362. typedef struct {
  363. short Opcode; /* 0x0102 */
  364. short Null;
  365. long RcId;
  366. IPOINT2 XMinYMin; /* upper left hand corner of virtual window */
  367. IPOINT2 XMaxYMax; /* lower right hand corner of virtual window */
  368. } Set2dWindow;
  369. /*** Set2dWindow32 ***/
  370. typedef struct {
  371. short Opcode; /* 0x0702 */
  372. short Null;
  373. long RcId;
  374. IPOINT2_32 XMinYMin; /* upper left hand corner of virtual window */
  375. IPOINT2_32 XMaxYMax; /* lower right hand corner of virtual window */
  376. } Set2dWindow32;
  377. /* -------------------------------------------------------------------
  378. * 3D Opcodes
  379. * ------------------------------------------------------------------- */
  380. /*** ChangeMatrix ***/
  381. #define MW 0 /* Modeling to world coordinate matrix */
  382. #define WV 1 /* World to viewing coordinate matrix */
  383. #define VS 2 /* Viewing to screen coordinate matrix */
  384. #define MAT_REPLACE 0 /* Replace M=source */
  385. #define MAT_PREMULT 1 /* Pre-multiply M=source*M */
  386. #define MAT_POSTMULT 2 /* Post-multiply M=M*source */
  387. #define IEEE 0
  388. /* XG3 support declaration */
  389. #define DEVICE_DEPENDANT 1
  390. typedef struct {
  391. short Opcode; /* 0x0000 */
  392. short MatrixNo; /* MW, WV or VS */
  393. long RcId; /* index to target Rc */
  394. short Operation; /* 0=Replace, 1=Pre-mult, 2=Post-mult */
  395. short Mode; /* must be 0 = source in IEEE floating point */
  396. MATRIX4 Source;
  397. } ChangeMatrix;
  398. /*** RenderPolyline ***/
  399. typedef struct {
  400. short Opcode; /* 0x0103 */
  401. short LenVertexList; /* length of VertexList[] in longs */
  402. long RcId;
  403. POINT3 Points[1]; /* VertexPosition */
  404. } RenderPolyline;
  405. typedef struct {
  406. POINT3 VertexPosition; /* Vertex position */
  407. NORM3 OptVertexNormal; /* Optional vertex normal */
  408. } TileVertexList;
  409. typedef struct {
  410. IFLOAT VertexInfo; /* Which vertices are specified */
  411. NORM3 OptTileNormal; /* Optional tile normal */
  412. TileVertexList TileVertexLst[1];
  413. } TileList;
  414. /*** RenderPolyQuad ***/
  415. typedef struct {
  416. short Opcode; /* 0x0203 */
  417. short LenTileList; /* Length of TileList in longs */
  418. long RcId;
  419. TileList TileLst[1];
  420. } RenderPolyQuad;
  421. /*** RenderPolyTriangle ***/
  422. typedef struct {
  423. short Opcode; /* 0x0303 */
  424. short LenTileList; /* Length of tileList[] in longs */
  425. long RcId;
  426. TileList TileLst[1];
  427. } RenderPolyTriangle;
  428. /*** SetClip3D defines ***/
  429. #define CLIP_LEFT 0x01
  430. #define CLIP_TOP 0x02
  431. #define CLIP_RIGHT 0x04
  432. #define CLIP_BOTTOM 0x08
  433. #define CLIP_FRONT 0x10
  434. #define CLIP_BACK 0x20
  435. #define CLIP_ALL 0x3f
  436. typedef struct {
  437. short Opcode; /* 0x0400 */
  438. short Clip3DPlanes; /* see defines above */
  439. long RcId;
  440. } SetClip3D;
  441. /*** SetLightSources ***/
  442. typedef struct {
  443. short Opcode; /* 0x0700 */
  444. short LenLSDB; /* Length of LSDB[] in longs */
  445. long RcId;
  446. long LSDBId; /* buffer id for sxci to store LSDB */
  447. float LSDB[1]; /* light source description buffer data */
  448. } SetLightSources;
  449. /*** SetRenderData ***/
  450. #define RD_VERTEX_NORMAL (0x1 << 0)
  451. #define RD_TILE_NORMAL (0x1 << 8)
  452. typedef struct {
  453. short Opcode; /* 0x1000 */
  454. short Null;
  455. long RcId;
  456. long OptData; /* see defines above */
  457. NORM3 Reserved;
  458. COLOR3 Reserved1;
  459. NORM3 Reserved2;
  460. } SetRenderData;
  461. /*** SetRenderMode ***/
  462. #define WIREFRAME_NORMAL 0 /* Wireframe - special for AutoCAD */
  463. #define WIREFRAME_ACAD 0 /* Wireframe - special for AutoCAD */
  464. #define FLAT_EXTENDED 8 /* solves double lighting problem of mode 2,
  465. the view direction and viewing matrix
  466. must be correctly set */
  467. #define GOURAUD_EXTENDED 9 /* solves double lighting problem of mode 4,
  468. the view direction and viewing matrix
  469. must be correctly set */
  470. typedef struct {
  471. short Opcode; /* 0x0A00 */
  472. short RenderMode; /* see defines above */
  473. long RcId;
  474. } SetRenderMode;
  475. /*** SetSurfaceAttr ***/
  476. typedef struct {
  477. short Opcode; /* 0x1100 */
  478. short Null;
  479. long RcId;
  480. COLOR3 SurfEmission; /* Emission color */
  481. COLOR3 SurfAmbient; /* Ambient reflectivity constant */
  482. COLOR3 SurfDiffuse; /* Diffuse reflectivity constant */
  483. COLOR3 SurfSpecular; /* Specular reflectivity constant */
  484. IFLOAT SurfSpecExp; /* Specular reflectivity exponent */
  485. } SetSurfaceAttr;
  486. #define INFINITE_VIEWER 0
  487. #define LOCAL_VIEWER 1
  488. /*** SetViewer, formerly SetViewDirection ***/
  489. typedef struct {
  490. short Opcode; /* 0x0B00 */
  491. short ViewMode; /* mode = 0 infinite viewer */
  492. /* mode = 1 local viewer */
  493. long RcId;
  494. POINT3 ViewerPosition; /* Viewer position in world coords */
  495. NORM3 ViewerDirection; /* normalized direction */
  496. } SetViewer;
  497. /*** SetZBuffer ***/
  498. #define ZF_DISABLE ((short)0) /* Z buffering disabled */
  499. #define ZF_ENABLE ((short)1) /* Z buffering enabled */
  500. #define ZF_LESS ((long)0) /* NEVER replace intensity */
  501. #define ZF_LEQUAL ((long)1) /* LESS than or EQUAL */
  502. typedef struct {
  503. short Opcode; /* 0x0C00 */
  504. short ZMode; /* 0=disable, 1=enable */
  505. long RcId;
  506. long ZFunction; /* 0 = < compares */
  507. } SetZBuffer; /* 1 = <= compares */
  508. /* -------------------------------------------------------------------
  509. * For SXCI.DLL
  510. * ------------------------------------------------------------------- */
  511. #define SXCI_2D 2
  512. #define SXCI_3D 3
  513. #define ID_mtxAllocBuffer 1
  514. #define ID_mtxAllocCL 2
  515. #define ID_mtxAllocRC 3
  516. #define ID_mtxAllocLSDB 4
  517. #define ID_mtxFreeBuffer 5
  518. #define ID_mtxFreeCL 6
  519. #define ID_mtxFreeLSDB 7
  520. #define ID_mtxFreeRC 8
  521. #define ID_mtxPostBuffer 9
  522. #define ID_mtxSetCL 10
  523. #define ID_mtxBlendCL 11
  524. #define ID_mtxGetBlockSize 12
  525. #define ID_mtxScScBitBlt 13
  526. #define ID_mtxScMemBitBlt 14
  527. #define ID_mtxMemScBitBlt 15
  528. #define ID_mtxAllocHugeBuffer 16
  529. #define ID_mtxFreeHugeBuffer 17
  530. #define ID_CallCaddiInit 30
  531. #define ID_PassPoolMem 31