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.

232 lines
7.2 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * *******************
  4. * * D3D SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: glint.h
  8. *
  9. * Content: DX Driver high level definitions and includes
  10. *
  11. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  13. \*****************************************************************************/
  14. #ifndef __GLINT_H
  15. #define __GLINT_H
  16. //*****************************************************
  17. // DRIVER FEATURES CONTROLLED BY DEFINED SYMBOLS
  18. //*****************************************************
  19. #define COMPILE_AS_DX8_DRIVER 1
  20. #if COMPILE_AS_DX8_DRIVER
  21. #define DIRECT3D_VERSION 0x0800
  22. // DX8_DDI is 1 if the driver is going to advertise itself as a DX8 driver to
  23. // the runtime. Notice that if we are a DX8 driver, we HAVE TO support the
  24. // multisteraming command tokens and a limited semantic of the vertex shader
  25. // tokens to interpret correctly the VertexType being processed
  26. #define DX8_DDI 1
  27. #define DX8_MULTSTREAMS 1
  28. #define DX8_VERTEXSHADERS 1
  29. // These other #defines enable and disable specific DX8 features
  30. // they are included mainly in order to help driver writers locate most of the
  31. // the code specific to the named features. Pixel shaders can't be supported on
  32. // this hardware, only stub functions are offered.
  33. #define DX8_POINTSPRITES 1
  34. #define DX8_PIXELSHADERS 1
  35. #define DX8_3DTEXTURES 1
  36. #if WNT_DDRAW
  37. #define DX8_MULTISAMPLING 1
  38. #else
  39. // On Win9x, AA buffers must be released during Alt-tab switch. Since
  40. // Perm3 driver doesn't share the D3D context with the 16bit side, this
  41. // feature is disabled to prevent corrupted rendering.
  42. #endif
  43. #else
  44. #define DIRECT3D_VERSION 0x0700
  45. #define DX8_DDI 0
  46. #define DX8_MULTSTREAMS 0
  47. #define DX8_VERTEXSHADERS 0
  48. #define DX8_POINTSPRITES 0
  49. #define DX8_PIXELSHADERS 0
  50. #define DX8_3DTEXTURES 0
  51. #define DX8_MULTISAMPLING 0
  52. #endif // COMPILE_AS_DX8_DRIVER
  53. // DX7 features which have been highlighted in order to
  54. // ease their implementation for other hardware parts.
  55. #if WNT_DDRAW
  56. #define DX7_ANTIALIAS 1
  57. #else
  58. // On Win9x, AA buffers must be released during Alt-tab switch. Since
  59. // Perm3 driver doesn't share the D3D context with the 16bit side, this
  60. // feature is disabled to prevent corrupted rendering.
  61. #endif
  62. #define DX7_D3DSTATEBLOCKS 1
  63. #define DX7_PALETTETEXTURE 1
  64. #define DX7_STEREO 1
  65. // Texture management enables DX8 resource management features
  66. #define DX7_TEXMANAGEMENT 0
  67. //@@BEGIN_DDKSPLIT
  68. //azn W-Buffer disabled because of DCT problems
  69. #define DX7_WBUFFER 0
  70. #define DX7_VERTEXBUFFERS 0
  71. //@@END_DDKSPLIT
  72. // The below symbol is used only to ifdef code which is demonstrative for
  73. // other DX drivers but which for specific reasons is not part of the
  74. // current sample driver
  75. #define DX_NOT_SUPPORTED_FEATURE 0
  76. #if DX7_D3DSTATEBLOCKS
  77. // These #defines bracket code or comments which would be important for
  78. // TnL capable / pixel shader capable / vertex shader capable parts
  79. // when processing state blocks commands.
  80. #define DX7_SB_TNL 0
  81. #define DX8_SB_SHADERS 0
  82. #endif // DX7_D3DSTATEBLOCKS
  83. //*****************************************************
  84. // PORTING WIN9X-WINNT
  85. //*****************************************************
  86. // On IA64 , the following Macro sorts out the PCI bus caching problem.
  87. // X86 doesn't need this, but it is handled by the same macro defined in
  88. // ioaccess.h on Win2K/XP. For Win9x we need to define it ourselves as
  89. // doing nothing.
  90. #if W95_DDRAW
  91. #define MEMORY_BARRIER()
  92. #endif
  93. #if WNT_DDRAW
  94. #define WANT_DMA 1
  95. #endif // WNT_DDRAW
  96. //*****************************************************
  97. // INCLUDE FILES FOR ALL
  98. //*****************************************************
  99. //@@BEGIN_DDKSPLIT
  100. // For internal Win2K build, we can include d3d{8}.h without problem, but
  101. // we have troubles to do so for internal Win9x build, so a couple of error
  102. // codes are patched below. For external DDK builds, both platforms can use
  103. // d3d{8}.h which is what we want to encourage IHVs to do.
  104. #if WNT_DDRAW
  105. //@@END_DDKSPLIT
  106. #if DX8_DDI
  107. #include <d3d8.h>
  108. #else
  109. #include <d3d.h>
  110. #endif
  111. //@@BEGIN_DDKSPLIT
  112. #else
  113. #ifndef D3DERR_WRONGTEXTUREFORMAT
  114. #define D3DERR_WRONGTEXTUREFORMAT MAKE_DDHRESULT(2072)
  115. #define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_DDHRESULT(2073)
  116. #define D3DERR_UNSUPPORTEDCOLORARG MAKE_DDHRESULT(2074)
  117. #define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_DDHRESULT(2075)
  118. #define D3DERR_UNSUPPORTEDALPHAARG MAKE_DDHRESULT(2076)
  119. #define D3DERR_TOOMANYOPERATIONS MAKE_DDHRESULT(2077)
  120. #define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_DDHRESULT(2078)
  121. #define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_DDHRESULT(2079)
  122. #define D3DERR_CONFLICTINGRENDERSTATE MAKE_DDHRESULT(2081)
  123. #define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_DDHRESULT(2082)
  124. #define D3DERR_TOOMANYPRIMITIVES MAKE_DDHRESULT(2083)
  125. #define D3DERR_INVALIDMATRIX MAKE_DDHRESULT(2084)
  126. #define D3DERR_TOOMANYVERTICES MAKE_DDHRESULT(2085)
  127. #define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_DDHRESULT(2086)
  128. #define D3DERR_DRIVERINVALIDCALL MAKE_DDHRESULT(2157)
  129. #endif
  130. #endif
  131. //@@END_DDKSPLIT
  132. #if WNT_DDRAW
  133. #include <stddef.h>
  134. #include <windows.h>
  135. #include <winddi.h> // This includes d3dnthal.h and ddrawint.h
  136. #include <devioctl.h>
  137. #include <ntddvdeo.h>
  138. #include <ioaccess.h>
  139. #define DX8DDK_DX7HAL_DEFINES
  140. #include <dx95type.h> // For Win 2000 include dx95type which allows
  141. // us to work almost as if we were on Win9x
  142. #include "driver.h"
  143. #else // WNT_DDRAW
  144. // These need to be included in Win9x
  145. #include <windows.h>
  146. #include <ddraw.h>
  147. #ifndef __cplusplus
  148. #include <dciman.h>
  149. #endif
  150. #include <ddrawi.h>
  151. #ifdef __cplusplus
  152. #include <dciman.h> // dciman.h must be included before ddrawi.h,
  153. #endif // and it needs windows.h
  154. #include <d3dhal.h>
  155. typedef struct tagLinearAllocatorInfo LinearAllocatorInfo, *pLinearAllocatorInfo;
  156. #endif // WNT_DDRAW
  157. #if DX8_DDI
  158. // This include file has some utility macros to process
  159. // the new GetDriverInfo2 GUID calls
  160. #include <d3dhalex.h>
  161. #endif
  162. // Our drivers include files
  163. #include "debug.h"
  164. #include "softcopy.h"
  165. #include "glglobal.h"
  166. #include "glintreg.h"
  167. #include "d3dstrct.h"
  168. #include "linalloc.h"
  169. #include "glddtk.h"
  170. #include "directx.h"
  171. #include "bitmac2.h"
  172. #include "direct3d.h"
  173. #include "dcontext.h"
  174. #include "d3dsurf.h"
  175. #include "dltamacr.h"
  176. //*****************************************************
  177. // TEXTURE MANAGEMENT DEFINITIONS
  178. //*****************************************************
  179. #if DX7_TEXMANAGEMENT
  180. #if COMPILE_AS_DX8_DRIVER
  181. // We will only collect stats in the DX7 driver
  182. #define DX7_TEXMANAGEMENT_STATS 0
  183. #else
  184. #define DX7_TEXMANAGEMENT_STATS 1
  185. #endif // COMPILE_AS_DX8_DRIVER
  186. #include "d3dtxman.h"
  187. #endif // DX7_TEXMANAGEMENT
  188. #endif __GLINT_H