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.

725 lines
23 KiB

  1. /* $Id: driver.h,v 1.71 1995/12/04 11:31:51 sjl Exp $
  2. *
  3. * Copyright (c) RenderMorphics Ltd. 1993, 1994
  4. * Version 1.1
  5. *
  6. * All rights reserved.
  7. *
  8. * This file contains private, unpublished information and may not be
  9. * copied in part or in whole without express permission of
  10. * RenderMorphics Ltd.
  11. *
  12. */
  13. #ifndef __DRIVER_H__
  14. #define __DRIVER_H__
  15. #define USE_FLOAT
  16. #ifdef WIN32
  17. //#define WIN32_LEAN_AND_MEAN
  18. #endif
  19. #include <stddef.h>
  20. #include <wtypes.h>
  21. typedef struct _RLDDIDriver RLDDIDriver;
  22. typedef struct _RLDDIDriverStack RLDDIDriverStack;
  23. #ifdef USE_FLOAT
  24. #include "fltval.h"
  25. #else
  26. #include "fixval.h"
  27. #endif
  28. #include "osdep.h"
  29. #ifdef D3D
  30. typedef enum _RLRenderQuality {
  31. RLRenderWireframe, /* display just the edges */
  32. RLRenderUnlitFlat, /* flat shaded without lighting */
  33. RLRenderFlat, /* flat shaded */
  34. RLRenderGouraud, /* gouraud shaded */
  35. RLRenderPhong /* phong shaded */
  36. } RLRenderQuality;
  37. typedef enum _RLColorModel {
  38. RLColorRamp, RLColorRGB
  39. } RLColorModel;
  40. typedef enum _RLLightType {
  41. RLLightAmbient,
  42. RLLightPoint,
  43. RLLightSpot,
  44. RLLightDirectional,
  45. RLLightParallelPoint
  46. } RLLightType;
  47. #if 0
  48. /*
  49. * Error codes
  50. */
  51. typedef enum _RLError {
  52. RLNoError = 0, /* no error */
  53. RLBadObject, /* object expected in argument */
  54. RLBadType, /* bad argument type passed */
  55. RLBadAlloc, /* out of memory */
  56. RLFaceUsed, /* face already used in a mesh */
  57. RLNotFound, /* object not found in specified place */
  58. RLNotDoneYet, /* unimplemented */
  59. RLFileNotFound, /* file cannot be opened */
  60. RLBadFile, /* data file is corrupt */
  61. RLBadDevice, /* device is not compatible with renderer */
  62. RLBadValue, /* bad argument value */
  63. RLBadMajorVersion, /* bad dll major version */
  64. RLBadMinorVersion, /* bad dll minor version */
  65. RLMaxError
  66. } RLErrorXXX;
  67. #endif
  68. #else
  69. #include "rl.h"
  70. #endif D3D
  71. /*
  72. * Normal precision used to store numbers.
  73. */
  74. #define NORMAL_PREC 16
  75. #define DTOVAL(d) DTOVALP(d,NORMAL_PREC)
  76. #define VALTOD(f) VALPTOD(f,NORMAL_PREC)
  77. #define ITOVAL(i) ITOVALP(i,NORMAL_PREC)
  78. #define VALTOI(f) VALPTOI(f,NORMAL_PREC)
  79. #define VALROUND(f) VALPROUND(f,NORMAL_PREC)
  80. #define VALTOFX(f) VALTOFXP(f,NORMAL_PREC)
  81. #define FXTOVAL(f) FXPTOVAL(f,NORMAL_PREC)
  82. #define ITOFX(i) ITOFXP(i,NORMAL_PREC)
  83. #define FXTOI(f) FXPTOI(f,NORMAL_PREC)
  84. #define FXROUND(f) FXPROUND(f,NORMAL_PREC)
  85. #define FXFLOOR(f) FXPTOI(f,NORMAL_PREC)
  86. #define FXCEIL(f) FXPCEIL(f,NORMAL_PREC)
  87. #define VALTOFX24(f) VALTOFXP(f,24)
  88. #define FX24TOVAL(f) FXPTOVAL(f,24)
  89. #define VALTOFX20(f) VALTOFXP(f,20)
  90. #define FX20TOVAL(f) FXPTOVAL(f,20)
  91. #define VALTOFX12(f) VALTOFXP(f,12)
  92. #define FX12TOVAL(f) FXPTOVAL(f,12)
  93. #define VALTOFX8(f) VALTOFXP(f,8)
  94. #define FX8TOVAL(f) FXPTOVAL(f,8)
  95. /*
  96. * A handy macro.
  97. */
  98. #define RLDDIAbs(N) (((N) < 0) ? -(N) : (N))
  99. #if defined(__DOS__) || defined(__WINDOWS_386__)
  100. #define RLFAR far
  101. #else
  102. #define RLFAR
  103. #endif
  104. #ifndef UNUSED
  105. #if defined(__WATCOMC__)
  106. #define UNUSED(v) (v)
  107. #else
  108. #define UNUSED(v)
  109. #endif
  110. #endif
  111. typedef enum _RLDDIServiceType {
  112. /*
  113. * Notify a module after it has been pushed into a stack.
  114. *
  115. * The module may also register fast service functions;
  116. * to register a fast service, set the appropriate table entry.
  117. * Note: the module must either register *no* services (old style),
  118. * or *all* the services it supports (including RLDDIPush)
  119. */
  120. /* HRESULT */ RLDDIPush, /* 0, RLDDIServiceProc[] */
  121. /*
  122. * Get a set of functions to create transform, render and lighting
  123. * drivers compatible with the given windowing system driver and color
  124. * model.
  125. */
  126. /* HRESULT */ RLDDIGetCreateDriverFunctions,/* RLColorModel, &result */
  127. /*
  128. * Notify a module before it is popped from a stack.
  129. */
  130. /* HRESULT */ RLDDIPop, /* NULL, NULL */
  131. /*
  132. * Set various rendering parameters.
  133. */
  134. /* HRESULT */ RLDDISetRenderParams, /* 0, RLDDIRenderParams* */
  135. /*
  136. * Set the current viewport.
  137. */
  138. /* HRESULT */ RLDDISetViewport, /* id, D3DVIEWPORT2* */
  139. /*
  140. * Deal with matrices
  141. */
  142. /* HRESULT */ RLDDICreateMatrix, /* 0, LPD3DMATRIXHANDLE */
  143. /* HRESULT */ RLDDISetMatrix, /* D3DMATRIXHANDLE, LPD3DMATRIX */
  144. /* HRESULT */ RLDDIGetMatrix, /* D3DMATRIXHANDLE, LPD3DMATRIX */
  145. /* HRESULT */ RLDDIDeleteMatrix, /* D3DMATRIXHANDLE, NULL */
  146. /*
  147. * Set one of the transformation matrices
  148. */
  149. /* HRESULT */ RLDDISetMatrixView, /* type, D3DMATRIXHANDLE */
  150. /* HRESULT */ RLDDISetMatrixProj, /* type, D3DMATRIXHANDLE */
  151. /* HRESULT */ RLDDISetMatrixWorld, /* type, D3DMATRIXHANDLE */
  152. #if 0
  153. /* HRESULT */ RLDDISetMatrixTrans, /* type, D3DMATRIXHANDLE */
  154. #endif
  155. /* HRESULT */ RLDDIMultiplyMatrices, /* count, RLDDIMatrix** */
  156. /*
  157. * Transform some vertices.
  158. */
  159. /* ClipFlags */ RLDDITransform, /* count, RLDDITransformData* */
  160. /* ClipFlags */ RLDDITransformClipped, /* count, RLDDITransformData* */
  161. /* ClipFlags */ RLDDITransformUnclipped, /* count, RLDDITransformData* */
  162. /*
  163. * Set the current lighting configuration. All normals are given
  164. * in the current model coordinate system.
  165. */
  166. /* HRESULT */ RLDDISetLight, /* which_light, D3DI_LIGHTDATA* */
  167. /*
  168. * Set the current fog configuration.
  169. */
  170. /* HRESULT */ RLDDISetFogMode, /* 0, D3DFOGMODE* */
  171. /* HRESULT */ RLDDISetFogStart, /* 0, RLDDIValue* */
  172. /* HRESULT */ RLDDISetFogEnd, /* 0, RLDDIValue* */
  173. /* HRESULT */ RLDDISetFogDensity, /* 0, RLDDIValue* */
  174. /* HRESULT */ RLDDISetFogEnable, /* 0, D3DFOGMODE* */
  175. /* HRESULT */ RLDDISetFogColor, /* 0, D3DFOGMODE* */
  176. /*
  177. * Calculate pixel values for some primitives with lighting.
  178. */
  179. /* HRESULT */ RLDDIApplyMaterialsLit, /* count, D3DLIGHTDATA* */
  180. /*
  181. * Calculate pixel values for some primitives without lighting.
  182. */
  183. /* HRESULT */ RLDDIApplyMaterialsUnlit, /* count, D3DLIGHTDATA* */
  184. /*
  185. * Calculate vertex values for some primitives without lighting.
  186. */
  187. /* HRESULT */ RLDDIApplyMaterialShade, /* count, D3DLIGHTDATA* */
  188. /*
  189. * Called to update dynamic color allocation state for materials
  190. * which are still being used but not lit. Returns TRUE if the
  191. * results of the previous lighting calls can be reused or FALSE
  192. * if the object should be relit anyway due to color entries being
  193. * reclaimed.
  194. */
  195. /* Boolean */ RLDDIUpdateMaterial,
  196. /*
  197. * Clear a drivers pick records
  198. */
  199. /* HRESULT */ RLDDIClearPickRecords, /* 0, NULL */
  200. /* HRESULT */ RLDDIGetPickRecords, /* 0, NULL */
  201. /*
  202. * pick a display list.
  203. */
  204. /* HRESULT */ RLDDIPickExecuteBuffer, /* stak top, RLDDIPickData* */
  205. /*
  206. * Execute a display list.
  207. */
  208. /* HRESULT */ RLDDIExecuteUnclipped, /* stak top, RLDDIExecuteData* */
  209. /* HRESULT */ RLDDIExecuteClipped, /* stak top, RLDDIExecuteData* */
  210. /*
  211. * Get the current pixmaps used for drawing (used by software
  212. * renderers to interface with low level drivers).
  213. */
  214. /* HRESULT */ RLDDIGetColorPixmap, /* NULL, &pixmap */
  215. /* HRESULT */ RLDDIGetDepthPixmap, /* NULL, &pixmap */
  216. /*
  217. * Release the current pixmaps used for drawing (used by software
  218. * renderers to interface with low level drivers).
  219. */
  220. /* HRESULT */ RLDDIReleaseColorPixmap, /* NULL NULL */
  221. /* HRESULT */ RLDDIReleaseDepthPixmap, /* NULL NULL */
  222. /*
  223. * Find a color allocator to use for mapping rgb values to pixels.
  224. */
  225. /* HRESULT */ RLDDIFindColorAllocator, /* NULL, &alloc */
  226. /*
  227. * Find a rampmap to use for color allocation in color index
  228. * drivers. This does not need to be supported if color index
  229. * rendering is not used.
  230. */
  231. /* HRESULT */ RLDDIFindRampmap, /* NULL, &rampmap */
  232. /*
  233. * Release a rampmap (from RLDDIFindRampmap), freeing all
  234. * resources.
  235. */
  236. /* HRESULT */ RLDDIReleaseRampmap, /* NULL, rampmap */
  237. /*
  238. * Get the color index -> pixel value mapping (if any).
  239. */
  240. /* HRESULT */ RLDDIGetColorMapping, /* NULL, &unsigned_long_ptr */
  241. /*
  242. * Convert a texture handle into a pointer (private to ramp driver)
  243. */
  244. /* HRESULT */ RLDDILookupTexture, /* NULL, handle */
  245. /*
  246. * Update the screen with a region which has changed. May involve
  247. * copying into the window, swapping double buffers, etc.
  248. */
  249. /* HRESULT */ RLDDIUpdate, /* count, D3DRECTANGLE* */
  250. /*
  251. * Lock against vsync, if necessary, for a given driver.
  252. */
  253. /* HRESULT */ RLDDISync,
  254. /*
  255. * Clear the viewport.
  256. */
  257. /* HRESULT */ RLDDIClear, /* */
  258. /*
  259. * Clear the zbuffer.
  260. */
  261. /* HRESULT */ RLDDIClearZ, /* */
  262. /*
  263. * Clear the both the z and viewport.
  264. */
  265. /* HRESULT */ RLDDIClearBoth, /* */
  266. /*
  267. * Get the dimensions of the device.
  268. */
  269. /* HRESULT */ RLDDIGetDriverParams, /* 0, RLDDIDriverParams* */
  270. /*
  271. * Set a material to be used to clear the viewport in RLDDIClear.
  272. */
  273. /* HRESULT */ RLDDISetBackgroundMaterial, /* 0, D3DMATERIALHANDLE */
  274. /*
  275. * Set an image to be used to clear the viewport depth planes
  276. * in RLDDIClear.
  277. */
  278. /* HRESULT */ RLDDISetBackgroundDepth, /* 0, RLImage* */
  279. /*
  280. * Ask the driver whether it can support the given RLImage as a
  281. * texture map. If the image can be supported directly, the
  282. * driver should return RLNoError. If another image format is
  283. * preferred, the driver should modify the pointer to point to an
  284. * RLImage structure of the required format and return RLNoError. Note
  285. * that this need not be a complete image. The buffer1 and
  286. * palette fields are ignored.
  287. *
  288. * If the driver does not support texture mapping at all, then it
  289. * should return RLBadDevice.
  290. *
  291. * If arg1 is not null, the driver will point at an array of DDSURFACEDESC
  292. * structures and return the size of the array.
  293. */
  294. /* HRESULT | int */ RLDDIQueryTextureFormat, /* LPDDSURFACEDESC*, RLImage** */
  295. /* HRESULT */ RLDDIActivatePalette, /* WM_ACTIVATE */
  296. /*
  297. * Set the current material for the lighting module.
  298. */
  299. /* HRESULT */ RLDDISetMaterial, /* 0, D3DMATERIALHANDLE */
  300. /*
  301. * Set the color of the ambient light. The format is:
  302. * (white << 24) | (red << 16) | (green << 8) | blue
  303. * where white is the equivalent white shade for monochrome lighting.
  304. */
  305. /* HRESULT */ RLDDISetAmbientLight, /* color, NULL */
  306. /*
  307. * Create a texture from the given image. The image must be in a format
  308. * approved by RLDDIQueryTextureFormat. The texture may use the memory
  309. * of the image for the pixel values or it may copy the image. Returns
  310. * a handle for the texture.
  311. */
  312. /* HRESULT */ RLDDICreateTexture, /* LPDIRECTDRAWSURFACE, &D3DTEXTUREHANDLE */
  313. /*
  314. * Destroy a texture previously created using RLDDICreateTexture.
  315. */
  316. /* HRESULT */ RLDDIDestroyTexture, /* D3DTEXTUREHANDLE, 0 */
  317. /*
  318. * Load a texture previously created using RLDDICreateTexture.
  319. * arg1 - src, arg2 = dst
  320. */
  321. /* HRESULT */ RLDDILoadTexture, /* D3DTEXTUREHANDLE, D3DTEXTUREHANDLE*/
  322. /*
  323. * Lock a texture previously created using RLDDICreateTexture.
  324. */
  325. /* HRESULT */ RLDDILockTexture, /* D3DTEXTUREHANDLE, 0 */
  326. /*
  327. * Unlock a texture previously created using RLDDICreateTexture.
  328. */
  329. /* HRESULT */ RLDDIUnlockTexture, /* D3DTEXTUREHANDLE, 0 */
  330. /*
  331. * Swap two textures.
  332. */
  333. /* HRESULT */ RLDDISwapTextureHandles, /* D3DTEXTUREHANDLE, D3DTEXTUREHANDLE */
  334. /*
  335. * Update any private copies of the pixels in a texture when it has been
  336. * changed by the application. The flags argument is a bitfield:
  337. *
  338. * flags & 1 the image pixels have changed
  339. * flags & 2 the image palette has changed
  340. */
  341. /* HRESULT */ RLDDIUpdateTexture, /* flags, handle */
  342. /*
  343. *
  344. */
  345. /* HRESULT */ RLDDISetTextureOpacity, /* 0, RLDDISetTextureOpacityParams */
  346. /*
  347. * Used in ramp color module for interfacing between renderer and
  348. * lighting.
  349. */
  350. /* HRESULT */ RLDDILookupMaterial,
  351. /*
  352. * Create a material
  353. */
  354. /* HRESULT */ RLDDICreateMaterial, /* D3DMATERIALHANDLE*, D3DMATERIAL* */
  355. /*
  356. * Destroy a material
  357. */
  358. /* HRESULT */ RLDDIDestroyMaterial, /* D3DMATERIALHANDLE, NULL */
  359. /*
  360. * Used by renderer to map material handles to materials.
  361. */
  362. /* HRESULT */ RLDDIFindMaterial, /* D3DMATERIALHANDLE, LPD3DMATERIAL* */
  363. /*
  364. * Used by Direct3D to inform the driver that a material has changed.
  365. */
  366. /* HRESULT */ RLDDIMaterialChanged, /* D3DMATERIALHANDLE, LPD3DMATERIAL */
  367. /*
  368. * Used by Direct3D to reserve a material
  369. */
  370. /* HRESULT */ RLDDIMaterialReserve, /* D3DMATERIALHANDLE, NULL */
  371. /*
  372. * Used by Direct3D to unreserve a material
  373. */
  374. /* HRESULT */ RLDDIMaterialUnreserve,/* D3DMATERIALHANDLE, NULL */
  375. /*
  376. * Used with frame materials to override the settings of a
  377. * display list.
  378. */
  379. /* HRESULT */ RLDDISetOverrideFillParams, /* 0, &override_params */
  380. /*
  381. * Used with frame materials to override the settings of a
  382. * display list.
  383. */
  384. /* HRESULT */ RLDDISetOverrideMaterial, /* 0, override_material */
  385. /*
  386. * Create an Execute Buffer
  387. */
  388. /* HRESULT */ RLDDIAllocateBuffer, /* LPD3DI_BUFFERHANDLE, LPD3DEXECUTEBUFFERDESC */
  389. /*
  390. * Destroy an Execute Buffer
  391. */
  392. /* HRESULT */ RLDDIDeallocateBuffer, /* D3DI_BUFFERHANDLE, (LPVOID)0 */
  393. /*
  394. * Lock an Execute Buffer
  395. */
  396. /* HRESULT */ RLDDILockBuffer, /* D3DI_BUFFERHANDLE, (LPVOID)0 */
  397. /*
  398. * Unlock an Execute Buffer
  399. */
  400. /* HRESULT */ RLDDIUnlockBuffer, /* D3DI_BUFFERHANDLE, (LPVOID)0 */
  401. /*
  402. * Set all 256 palette entries in an 8 bit device.
  403. */
  404. /* HRESULT */ RLDDISetPalette, /* 0, RLPalettEntry* */
  405. /*
  406. * Get all 256 palette entries of an 8 bit device.
  407. */
  408. /* HRESULT */ RLDDIGetPalette, /* 0, RLPaletteEntry* */
  409. /*
  410. * Generic platform specific driver extension type thing.
  411. */
  412. /* HRESULT */ RLDDIDriverExtension, /* code, (void *) */
  413. #ifdef __psx__
  414. /*
  415. * Set various PSX specific flags, to increase speed
  416. */
  417. /* HRESULT */ RLDDIPSXSetUpdateFlags,
  418. /*
  419. * allow people to reserve space in VRAM for their own use
  420. */
  421. /* HRESULT */ RLDDIPSXReserveTextureSpace,
  422. /* HRESULT */ RLDDIPSXReserveCLUTSpace,
  423. /*
  424. * so that people can access ordering table info
  425. */
  426. /* HRESULT */ RLDDIPSXQuery,
  427. #endif
  428. /*
  429. * Inform of beginning/end of a scene.
  430. */
  431. /* HRESULT */ RLDDISceneCapture, /* BOOL, NULL */
  432. /*
  433. * Get an item of state from a particular module.
  434. */
  435. /* HRESULT */ RLDDIGetState, /* long, LPD3DSTATE */
  436. /*
  437. * Get stats from a driver
  438. */
  439. /* HRESULT */ RLDDIGetStats, /* 0, LPD3DSTATS */
  440. /*
  441. * Not a service call
  442. */
  443. RLDDIServiceCount /* assumes none of the other enums are given initializers */
  444. } RLDDIServiceType;
  445. #ifdef D3D
  446. typedef enum _RLPaletteFlags {
  447. RLPaletteFree, /* renderer may use this entry freely */
  448. RLPaletteReadOnly, /* fixed but may be used by renderer */
  449. RLPaletteReserved /* may not be used by renderer */
  450. } RLPaletteFlags;
  451. typedef struct _RLPaletteEntry {
  452. unsigned char red; /* 0 .. 255 */
  453. unsigned char green; /* 0 .. 255 */
  454. unsigned char blue; /* 0 .. 255 */
  455. unsigned char flags; /* one of RLPaletteFlags */
  456. } RLPaletteEntry;
  457. typedef struct _RLImage {
  458. int width, height; /* width and height in pixels */
  459. int aspectx, aspecty; /* aspect ratio for non-square pixels */
  460. int depth; /* bits per pixel */
  461. int rgb; /* if false, pixels are indices into a
  462. palette otherwise, pixels encode
  463. RGB values. */
  464. int bytes_per_line; /* number of bytes of memory for a
  465. scanline. This must be a multiple
  466. of 4. */
  467. void* buffer1; /* memory to render into (first buffer). */
  468. void* buffer2; /* second rendering buffer for double
  469. buffering, set to NULL for single
  470. buffering. */
  471. unsigned long red_mask;
  472. unsigned long green_mask;
  473. unsigned long blue_mask;
  474. unsigned long alpha_mask;
  475. /* if rgb is true, these are masks for
  476. the red, green and blue parts of a
  477. pixel. Otherwise, these are masks
  478. for the significant bits of the
  479. red, green and blue elements in the
  480. palette. For instance, most SVGA
  481. displays use 64 intensities of red,
  482. green and blue, so the masks should
  483. all be set to 0xfc. */
  484. int palette_size; /* number of entries in palette */
  485. RLPaletteEntry* palette; /* description of the palette (only if
  486. rgb is false). Must be (1<<depth)
  487. elements. */
  488. } RLImage;
  489. #endif /* D3D */
  490. #ifdef WIN32
  491. #define RLDDIAPI __stdcall
  492. #else
  493. #define RLDDIAPI
  494. #endif
  495. typedef void (*RLDDIDestroyProc)(RLDDIDriver* driver);
  496. typedef long (*RLDDIServiceProc)(RLDDIDriver* driver,
  497. RLDDIServiceType type,
  498. long arg1,
  499. void* arg2);
  500. typedef HRESULT (RLDDIAPI *RLDDIMallocFn)(void**, size_t);
  501. typedef HRESULT (RLDDIAPI *RLDDIReallocFn)(void**, size_t);
  502. typedef void (RLDDIAPI *RLDDIFreeFn)(void*);
  503. typedef HRESULT (*RLDDIRaiseFn)(HRESULT);
  504. #ifndef DLL_IMPORTS_GEN
  505. __declspec( dllexport ) extern RLDDIRaiseFn RLDDIRaise;
  506. __declspec( dllexport ) extern RLDDIMallocFn RLDDIMalloc;
  507. __declspec( dllexport ) extern RLDDIReallocFn RLDDIRealloc;
  508. __declspec( dllexport ) extern RLDDIFreeFn RLDDIFree;
  509. #else
  510. __declspec( dllimport ) RLDDIRaiseFn RLDDIRaise;
  511. __declspec( dllimport ) RLDDIMallocFn RLDDIMalloc;
  512. __declspec( dllimport ) RLDDIReallocFn RLDDIRealloc;
  513. __declspec( dllimport ) RLDDIFreeFn RLDDIFree;
  514. #endif
  515. #include "d3di.h"
  516. #include "dditypes.h"
  517. typedef struct _RLDDIGlobalDriverData {
  518. /*
  519. * Pointers to driver modules
  520. */
  521. RLDDIDriver *transform;
  522. RLDDIDriver *lighting;
  523. RLDDIDriver *raster;
  524. } RLDDIGlobalDriverData;
  525. struct _RLDDIDriver {
  526. RLDDIDriver* prev;
  527. RLDDIDriver* next;
  528. RLDDIDriverStack* top; /* top of the driver stack */
  529. int width, height; /* dimensions */
  530. RLDDIDestroyProc destroy; /* clean up */
  531. RLDDIServiceProc service; /* do something */
  532. RLDDIGlobalDriverData* data; /* pointer to global data */
  533. /* Driver private data may follow */
  534. };
  535. struct _RLDDIDriverStack {
  536. RLDDIDriver *top;
  537. struct {
  538. RLDDIServiceProc call;
  539. RLDDIDriver *driver;
  540. } fastService[RLDDIServiceCount];
  541. int polygons_drawn;
  542. RLDDIGlobalDriverData data;
  543. };
  544. #include "d3drlddi.h"
  545. #include "dlist.h"
  546. #define RLDDIService(stackp, type, arg1, arg2) \
  547. (*((stackp)->fastService[type].call)) \
  548. ((stackp)->fastService[type].driver, (type), (arg1), (arg2))
  549. /* old macro
  550. (*((stackp)->top->service))((stackp)->top, (type), (arg1), (arg2))
  551. */
  552. #ifdef DLL_IMPORTS_GEN
  553. __declspec( dllimport ) int RLDDILog2[];
  554. #else
  555. extern int RLDDILog2[];
  556. #endif
  557. #ifdef _DLL
  558. void RLDDIInit2(RLDDIMallocFn, RLDDIReallocFn, RLDDIFreeFn, RLDDIRaiseFn, RLDDIValue**, int, int);
  559. #endif
  560. void RLDDIInit(RLDDIMallocFn, RLDDIReallocFn, RLDDIFreeFn, RLDDIRaiseFn, RLDDIValue**, int, int);
  561. void RLDDIPushDriver(RLDDIDriverStack* stack, RLDDIDriver* driver);
  562. void RLDDIPopDriver(RLDDIDriverStack* stack);
  563. HRESULT RLDDICreatePixmap(RLDDIPixmap** result,
  564. int width, int height, int depth);
  565. HRESULT RLDDICreatePixmapFrom(RLDDIPixmap** result,
  566. int width, int height, int depth,
  567. void RLFAR* data, int bytes_per_line);
  568. HRESULT RLDDICreatePixmapFromSurface(RLDDIPixmap** result,
  569. LPDIRECTDRAWSURFACE lpDDS);
  570. void RLDDIDestroyPixmap(RLDDIPixmap* pm);
  571. void RLDDIPixmapFill(RLDDIPixmap* pm, unsigned long value,
  572. int x1, int y1, int x2, int y2);
  573. void RLDDIPixmapCopy(RLDDIPixmap* dstpm, RLDDIPixmap* srcpm,
  574. int x1, int y1, int x2, int y2,
  575. int dstx, int dsty);
  576. void RLDDIPixmapScale(RLDDIPixmap* dstpm, LPDDSURFACEDESC srcim,
  577. RLDDIValue scalex, RLDDIValue scaley,
  578. int x1, int y1, int x2, int y2,
  579. int dstx, int dsty);
  580. HRESULT RLDDIPixmapLock(RLDDIPixmap* pm);
  581. void RLDDIPixmapUnlock(RLDDIPixmap* pm);
  582. void RLDDIPixmapUpdatePalette(RLDDIPixmap* pm);
  583. RLDDIDriver* RLDDICreateTransformDriver(int width, int height);
  584. RLDDIDriver* RLDDICreateRampLightingDriver(int width, int height);
  585. RLDDIDriver* RLDDICreateRampDriver(int width, int height);
  586. RLDDIDriver* RLDDICreateRGBLightingDriver(int width, int height);
  587. RLDDIDriver* RLDDICreateRGBDriver(int width, int height);
  588. extern HRESULT WINAPI DDInternalLock( LPDDRAWI_DDRAWSURFACE_LCL this_lcl, LPVOID* lpBits );
  589. extern HRESULT WINAPI DDInternalUnlock( LPDDRAWI_DDRAWSURFACE_LCL this_lcl );
  590. /*
  591. * RLDDIDriverExtension codes
  592. */
  593. #define RLDDIDDrawGetObjects 0x1234
  594. #define RLDDIDDrawWinMove 0x1235
  595. /*
  596. * Six standard clipping planes plus six user defined clipping planes.
  597. * See rl\d3d\d3d\d3dtypes.h.
  598. */
  599. #define MAX_CLIPPING_PLANES 12
  600. /* Space for vertices generated/copied while clipping one triangle */
  601. #define MAX_CLIP_VERTICES (( 2 * MAX_CLIPPING_PLANES ) + 3 )
  602. /* 3 verts. -> 1 tri, 4 v -> 2 t, N vertices -> (N - 2) triangles */
  603. #define MAX_CLIP_TRIANGLES ( MAX_CLIP_VERTICES - 2 )
  604. #endif /* driver.h */