Direct3D8.pas
上传用户:yj_qiu
上传日期:2022-08-08
资源大小:23636k
文件大小:173k
源码类别:

游戏引擎

开发平台:

Delphi

  1. {$EXTERNALSYM D3DFVF_TEXCOORDSIZE1}
  2. //---------------------------------------------------------------------
  3. type
  4.   { Direct3D8 Device types }
  5.   _D3DDEVTYPE = (
  6.   {$IFNDEF COMPILER6_UP}
  7.     D3DDEVTYPE_INVALID_0,
  8.     D3DDEVTYPE_HAL         {= 1},
  9.     D3DDEVTYPE_REF         {= 2},
  10.     D3DDEVTYPE_SW          {= 3}
  11.   {$ELSE}
  12.     D3DDEVTYPE_HAL         = 1,
  13.     D3DDEVTYPE_REF         = 2,
  14.     D3DDEVTYPE_SW          = 3
  15.   {$ENDIF}
  16.   );
  17.   {$EXTERNALSYM _D3DDEVTYPE}
  18.   D3DDEVTYPE = _D3DDEVTYPE;
  19.   {$EXTERNALSYM D3DDEVTYPE}
  20.   TD3DDevType = _D3DDEVTYPE;
  21.   { Multi-Sample buffer types }
  22.   _D3DMULTISAMPLE_TYPE = (
  23.   {$IFNDEF COMPILER6_UP}
  24.     D3DMULTISAMPLE_NONE            {=  0},
  25.     D3DMULTISAMPLE_INVALID_1       {=  1},
  26.     D3DMULTISAMPLE_2_SAMPLES       {=  2},
  27.     D3DMULTISAMPLE_3_SAMPLES       {=  3},
  28.     D3DMULTISAMPLE_4_SAMPLES       {=  4},
  29.     D3DMULTISAMPLE_5_SAMPLES       {=  5},
  30.     D3DMULTISAMPLE_6_SAMPLES       {=  6},
  31.     D3DMULTISAMPLE_7_SAMPLES       {=  7},
  32.     D3DMULTISAMPLE_8_SAMPLES       {=  8},
  33.     D3DMULTISAMPLE_9_SAMPLES       {=  9},
  34.     D3DMULTISAMPLE_10_SAMPLES      {= 10},
  35.     D3DMULTISAMPLE_11_SAMPLES      {= 11},
  36.     D3DMULTISAMPLE_12_SAMPLES      {= 12},
  37.     D3DMULTISAMPLE_13_SAMPLES      {= 13},
  38.     D3DMULTISAMPLE_14_SAMPLES      {= 14},
  39.     D3DMULTISAMPLE_15_SAMPLES      {= 15},
  40.     D3DMULTISAMPLE_16_SAMPLES      {= 16}
  41.   {$ELSE}
  42.     D3DMULTISAMPLE_NONE            =  0,
  43.     D3DMULTISAMPLE_2_SAMPLES       =  2,
  44.     D3DMULTISAMPLE_3_SAMPLES       =  3,
  45.     D3DMULTISAMPLE_4_SAMPLES       =  4,
  46.     D3DMULTISAMPLE_5_SAMPLES       =  5,
  47.     D3DMULTISAMPLE_6_SAMPLES       =  6,
  48.     D3DMULTISAMPLE_7_SAMPLES       =  7,
  49.     D3DMULTISAMPLE_8_SAMPLES       =  8,
  50.     D3DMULTISAMPLE_9_SAMPLES       =  9,
  51.     D3DMULTISAMPLE_10_SAMPLES      = 10,
  52.     D3DMULTISAMPLE_11_SAMPLES      = 11,
  53.     D3DMULTISAMPLE_12_SAMPLES      = 12,
  54.     D3DMULTISAMPLE_13_SAMPLES      = 13,
  55.     D3DMULTISAMPLE_14_SAMPLES      = 14,
  56.     D3DMULTISAMPLE_15_SAMPLES      = 15,
  57.     D3DMULTISAMPLE_16_SAMPLES      = 16
  58.   {$ENDIF}
  59.   );
  60.   {$EXTERNALSYM _D3DMULTISAMPLE_TYPE}
  61.   D3DMULTISAMPLE_TYPE = _D3DMULTISAMPLE_TYPE;
  62.   {$EXTERNALSYM D3DMULTISAMPLE_TYPE}
  63.   TD3DMultiSampleType = _D3DMULTISAMPLE_TYPE;
  64. (* Formats
  65.  * Most of these names have the following convention:
  66.  *      A = Alpha
  67.  *      R = Red
  68.  *      G = Green
  69.  *      B = Blue
  70.  *      X = Unused Bits
  71.  *      P = Palette
  72.  *      L = Luminance
  73.  *      U = dU coordinate for BumpMap
  74.  *      V = dV coordinate for BumpMap
  75.  *      S = Stencil
  76.  *      D = Depth (e.g. Z or W buffer)
  77.  *
  78.  *      Further, the order of the pieces are from MSB first; hence
  79.  *      D3DFMT_A8L8 indicates that the high byte of this two byte
  80.  *      format is alpha.
  81.  *
  82.  *      D16 indicates:
  83.  *           - An integer 16-bit value.
  84.  *           - An app-lockable surface.
  85.  *
  86.  *      All Depth/Stencil formats except D3DFMT_D16_LOCKABLE indicate:
  87.  *          - no particular bit ordering per pixel, and
  88.  *          - are not app lockable, and
  89.  *          - the driver is allowed to consume more than the indicated
  90.  *            number of bits per Depth channel (but not Stencil channel).
  91.  *)
  92. //#ifndef MAKEFOURCC
  93. //    #define MAKEFOURCC(ch0, ch1, ch2, ch3)                              
  94. //                ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) |       
  95. //                ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
  96. //#endif /* defined(MAKEFOURCC) */
  97. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWord;
  98. {$EXTERNALSYM MAKEFOURCC}
  99. {$IFNDEF COMPILER6_UP}
  100. const
  101.   D3DFMT_UNKNOWN              =  0;
  102.   {$EXTERNALSYM D3DFMT_UNKNOWN}
  103.   D3DFMT_R8G8B8               = 20;
  104.   {$EXTERNALSYM D3DFMT_R8G8B8}
  105.   D3DFMT_A8R8G8B8             = 21;
  106.   {$EXTERNALSYM D3DFMT_A8R8G8B8}
  107.   D3DFMT_X8R8G8B8             = 22;
  108.   {$EXTERNALSYM D3DFMT_X8R8G8B8}
  109.   D3DFMT_R5G6B5               = 23;
  110.   {$EXTERNALSYM D3DFMT_R5G6B5}
  111.   D3DFMT_X1R5G5B5             = 24;
  112.   {$EXTERNALSYM D3DFMT_X1R5G5B5}
  113.   D3DFMT_A1R5G5B5             = 25;
  114.   {$EXTERNALSYM D3DFMT_A1R5G5B5}
  115.   D3DFMT_A4R4G4B4             = 26;
  116.   {$EXTERNALSYM D3DFMT_A4R4G4B4}
  117.   D3DFMT_R3G3B2               = 27;
  118.   {$EXTERNALSYM D3DFMT_R3G3B2}
  119.   D3DFMT_A8                   = 28;
  120.   {$EXTERNALSYM D3DFMT_A8}
  121.   D3DFMT_A8R3G3B2             = 29;
  122.   {$EXTERNALSYM D3DFMT_A8R3G3B2}
  123.   D3DFMT_X4R4G4B4             = 30;
  124.   {$EXTERNALSYM D3DFMT_X4R4G4B4}
  125.   D3DFMT_A2B10G10R10          = 31;
  126.   {$EXTERNALSYM D3DFMT_A2B10G10R10}
  127.   D3DFMT_G16R16               = 34;
  128.   {$EXTERNALSYM D3DFMT_G16R16}
  129.   D3DFMT_A8P8                 = 40;
  130.   {$EXTERNALSYM D3DFMT_A8P8}
  131.   D3DFMT_P8                   = 41;
  132.   {$EXTERNALSYM D3DFMT_P8}
  133.   D3DFMT_L8                   = 50;
  134.   {$EXTERNALSYM D3DFMT_L8}
  135.   D3DFMT_A8L8                 = 51;
  136.   {$EXTERNALSYM D3DFMT_A8L8}
  137.   D3DFMT_A4L4                 = 52;
  138.   {$EXTERNALSYM D3DFMT_A4L4}
  139.   D3DFMT_V8U8                 = 60;
  140.   {$EXTERNALSYM D3DFMT_V8U8}
  141.   D3DFMT_L6V5U5               = 61;
  142.   {$EXTERNALSYM D3DFMT_L6V5U5}
  143.   D3DFMT_X8L8V8U8             = 62;
  144.   {$EXTERNALSYM D3DFMT_X8L8V8U8}
  145.   D3DFMT_Q8W8V8U8             = 63;
  146.   {$EXTERNALSYM D3DFMT_Q8W8V8U8}
  147.   D3DFMT_V16U16               = 64;
  148.   {$EXTERNALSYM D3DFMT_V16U16}
  149.   D3DFMT_W11V11U10            = 65;
  150.   {$EXTERNALSYM D3DFMT_W11V11U10}
  151.   D3DFMT_A2W10V10U10          = 67;
  152.   {$EXTERNALSYM D3DFMT_A2W10V10U10}
  153.   // D3DFMT_UYVY                 = MAKEFOURCC('U', 'Y', 'V', 'Y');
  154.   D3DFMT_UYVY                 = Byte('U') or (Byte('Y') shl 8) or (Byte('V') shl 16) or (Byte('Y') shl 24);
  155.   {$EXTERNALSYM D3DFMT_UYVY}
  156.   // D3DFMT_YUY2                 = MAKEFOURCC('Y', 'U', 'Y', '2'),
  157.   D3DFMT_YUY2                 = Byte('Y') or (Byte('U') shl 8) or (Byte('Y') shl 16) or (Byte('2') shl 24);
  158.   {$EXTERNALSYM D3DFMT_YUY2}
  159.   // D3DFMT_DXT1                 = MAKEFOURCC('D', 'X', 'T', '1'),
  160.   D3DFMT_DXT1                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('1') shl 24);
  161.   {$EXTERNALSYM D3DFMT_DXT1}
  162.   // D3DFMT_DXT2                 = MAKEFOURCC('D', 'X', 'T', '2'),
  163.   D3DFMT_DXT2                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('2') shl 24);
  164.   {$EXTERNALSYM D3DFMT_DXT2}
  165.   // D3DFMT_DXT3                 = MAKEFOURCC('D', 'X', 'T', '3'),
  166.   D3DFMT_DXT3                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('3') shl 24);
  167.   {$EXTERNALSYM D3DFMT_DXT3}
  168.   // D3DFMT_DXT4                 = MAKEFOURCC('D', 'X', 'T', '4'),
  169.   D3DFMT_DXT4                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('4') shl 24);
  170.   {$EXTERNALSYM D3DFMT_DXT4}
  171.   // D3DFMT_DXT5                 = MAKEFOURCC('D', 'X', 'T', '5'),
  172.   D3DFMT_DXT5                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('5') shl 24);
  173.   {$EXTERNALSYM D3DFMT_DXT5}
  174.   D3DFMT_D16_LOCKABLE         = 70;
  175.   {$EXTERNALSYM D3DFMT_D16_LOCKABLE}
  176.   D3DFMT_D32                  = 71;
  177.   {$EXTERNALSYM D3DFMT_D32}
  178.   D3DFMT_D15S1                = 73;
  179.   {$EXTERNALSYM D3DFMT_D15S1}
  180.   D3DFMT_D24S8                = 75;
  181.   {$EXTERNALSYM D3DFMT_D24S8}
  182.   D3DFMT_D16                  = 80;
  183.   {$EXTERNALSYM D3DFMT_D16}
  184.   D3DFMT_D24X8                = 77;
  185.   {$EXTERNALSYM D3DFMT_D24X8}
  186.   D3DFMT_D24X4S4              = 79;
  187.   {$EXTERNALSYM D3DFMT_D24X4S4}
  188.   D3DFMT_VERTEXDATA           =100;
  189.   {$EXTERNALSYM D3DFMT_VERTEXDATA}
  190.   D3DFMT_INDEX16              =101;
  191.   {$EXTERNALSYM D3DFMT_INDEX16}
  192.   D3DFMT_INDEX32              =102;
  193.   {$EXTERNALSYM D3DFMT_INDEX32}
  194.   D3DFMT_FORCE_DWORD          = $7fffffff;
  195.   {$EXTERNALSYM D3DFMT_FORCE_DWORD}
  196. type
  197.   _D3DFORMAT = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord;
  198. {$ELSE}
  199. type
  200.   _D3DFORMAT = (
  201.   {$IFDEF BCB}
  202.     D3DFMT_DUMMY
  203.   {$ELSE}
  204.     D3DFMT_UNKNOWN              =  0,
  205.     D3DFMT_R8G8B8               = 20,
  206.     D3DFMT_A8R8G8B8             = 21,
  207.     D3DFMT_X8R8G8B8             = 22,
  208.     D3DFMT_R5G6B5               = 23,
  209.     D3DFMT_X1R5G5B5             = 24,
  210.     D3DFMT_A1R5G5B5             = 25,
  211.     D3DFMT_A4R4G4B4             = 26,
  212.     D3DFMT_R3G3B2               = 27,
  213.     D3DFMT_A8                   = 28,
  214.     D3DFMT_A8R3G3B2             = 29,
  215.     D3DFMT_X4R4G4B4             = 30,
  216.     D3DFMT_A2B10G10R10          = 31,
  217.     D3DFMT_G16R16               = 34,
  218.     D3DFMT_A8P8                 = 40,
  219.     D3DFMT_P8                   = 41,
  220.     D3DFMT_L8                   = 50,
  221.     D3DFMT_A8L8                 = 51,
  222.     D3DFMT_A4L4                 = 52,
  223.     D3DFMT_V8U8                 = 60,
  224.     D3DFMT_L6V5U5               = 61,
  225.     D3DFMT_X8L8V8U8             = 62,
  226.     D3DFMT_Q8W8V8U8             = 63,
  227.     D3DFMT_V16U16               = 64,
  228.     D3DFMT_W11V11U10            = 65,
  229.     D3DFMT_A2W10V10U10          = 67,
  230.     // D3DFMT_UYVY                 = MAKEFOURCC('U', 'Y', 'V', 'Y'),
  231.     D3DFMT_UYVY                 = Byte('U') or (Byte('Y') shl 8) or (Byte('V') shl 16) or (Byte('Y') shl 24),
  232.     // D3DFMT_YUY2                 = MAKEFOURCC('Y', 'U', 'Y', '2'),
  233.     D3DFMT_YUY2                 = Byte('Y') or (Byte('U') shl 8) or (Byte('Y') shl 16) or (Byte('2') shl 24),
  234.     // D3DFMT_DXT1                 = MAKEFOURCC('D', 'X', 'T', '1'),
  235.     D3DFMT_DXT1                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('1') shl 24),
  236.     // D3DFMT_DXT2                 = MAKEFOURCC('D', 'X', 'T', '2'),
  237.     D3DFMT_DXT2                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('2') shl 24),
  238.     // D3DFMT_DXT3                 = MAKEFOURCC('D', 'X', 'T', '3'),
  239.     D3DFMT_DXT3                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('3') shl 24),
  240.     // D3DFMT_DXT4                 = MAKEFOURCC('D', 'X', 'T', '4'),
  241.     D3DFMT_DXT4                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('4') shl 24),
  242.     // D3DFMT_DXT5                 = MAKEFOURCC('D', 'X', 'T', '5'),
  243.     D3DFMT_DXT5                 = Byte('D') or (Byte('X') shl 8) or (Byte('T') shl 16) or (Byte('5') shl 24),
  244.     D3DFMT_D16_LOCKABLE         = 70,
  245.     D3DFMT_D32                  = 71,
  246.     D3DFMT_D15S1                = 73,
  247.     D3DFMT_D24S8                = 75,
  248.     D3DFMT_D16                  = 80,
  249.     D3DFMT_D24X8                = 77,
  250.     D3DFMT_D24X4S4              = 79,
  251.     D3DFMT_VERTEXDATA           =100,
  252.     D3DFMT_INDEX16              =101,
  253.     D3DFMT_INDEX32              =102,
  254.     D3DFMT_FORCE_DWORD          = $7fffffff
  255.   {$ENDIF}
  256.   );
  257. {$ENDIF}
  258.   {$EXTERNALSYM _D3DFORMAT}
  259.   D3DFORMAT = _D3DFORMAT;
  260.   {$EXTERNALSYM D3DFORMAT}
  261.   PD3DFormat = ^TD3DFormat;
  262.   TD3DFormat = _D3DFORMAT;
  263.   { Display Modes }
  264.   PD3DDisplayMode = ^TD3DDisplayMode;
  265.   _D3DDISPLAYMODE = packed record
  266.     Width: LongWord;
  267.     Height: LongWord;
  268.     RefreshRate: LongWord;
  269.     Format: TD3DFormat;
  270.   end {_D3DDISPLAYMODE};
  271.   {$EXTERNALSYM _D3DDISPLAYMODE}
  272.   D3DDISPLAYMODE = _D3DDISPLAYMODE;
  273.   {$EXTERNALSYM D3DDISPLAYMODE}
  274.   TD3DDisplayMode = _D3DDISPLAYMODE;
  275.   { Creation Parameters }
  276.   PD3DDeviceCreationParameters = ^TD3DDeviceCreationParameters;
  277.   _D3DDEVICE_CREATION_PARAMETERS = packed record
  278.     AdapterOrdinal: LongWord;
  279.     DeviceType: TD3DDevType;
  280.     hFocusWindow: HWND;
  281.     BehaviorFlags: LongInt;
  282.   end {_D3DDEVICE_CREATION_PARAMETERS};
  283.   {$EXTERNALSYM _D3DDEVICE_CREATION_PARAMETERS}
  284.   D3DDEVICE_CREATION_PARAMETERS = _D3DDEVICE_CREATION_PARAMETERS;
  285.   {$EXTERNALSYM D3DDEVICE_CREATION_PARAMETERS}
  286.   TD3DDeviceCreationParameters = _D3DDEVICE_CREATION_PARAMETERS;
  287.   { SwapEffects }
  288.   _D3DSWAPEFFECT = (
  289.   {$IFNDEF COMPILER6_UP}
  290.     D3DSWAPEFFECT_INVALID_0     {= 0},
  291.     D3DSWAPEFFECT_DISCARD       {= 1},
  292.     D3DSWAPEFFECT_FLIP          {= 2},
  293.     D3DSWAPEFFECT_COPY          {= 3},
  294.     D3DSWAPEFFECT_COPY_VSYNC    {= 4}
  295.   {$ELSE}
  296.     D3DSWAPEFFECT_DISCARD       = 1,
  297.     D3DSWAPEFFECT_FLIP          = 2,
  298.     D3DSWAPEFFECT_COPY          = 3,
  299.     D3DSWAPEFFECT_COPY_VSYNC    = 4
  300.   {$ENDIF}
  301.   );
  302.   {$EXTERNALSYM _D3DSWAPEFFECT}
  303.   D3DSWAPEFFECT = _D3DSWAPEFFECT;
  304.   {$EXTERNALSYM D3DSWAPEFFECT}
  305.   TD3DSwapEffect = _D3DSWAPEFFECT;
  306.   { Pool types }
  307.   _D3DPOOL = (
  308.     D3DPOOL_DEFAULT     {= 0},
  309.     D3DPOOL_MANAGED     {= 1},
  310.     D3DPOOL_SYSTEMMEM   {= 2},
  311.     D3DPOOL_SCRATCH     {= 3}
  312.   );
  313.   {$EXTERNALSYM _D3DPOOL}
  314.   D3DPOOL = _D3DPOOL;
  315.   {$EXTERNALSYM D3DPOOL}
  316.   TD3DPool = _D3DPOOL;
  317. const
  318.   { RefreshRate pre-defines }
  319.   D3DPRESENT_RATE_DEFAULT         = $00000000;
  320.   {$EXTERNALSYM D3DPRESENT_RATE_DEFAULT}
  321.   D3DPRESENT_RATE_UNLIMITED       = $7fffffff;
  322.   {$EXTERNALSYM D3DPRESENT_RATE_UNLIMITED}
  323. type
  324.   { Resize Optional Parameters }
  325.   PD3DPresentParameters = ^TD3DPresentParameters;
  326.   _D3DPRESENT_PARAMETERS_ = packed record
  327.     BackBufferWidth:                    LongWord;
  328.     BackBufferHeight:                   LongWord;
  329.     BackBufferFormat:                   TD3DFormat;
  330.     BackBufferCount:                    LongWord;
  331.     MultiSampleType:                    TD3DMultiSampleType;
  332.     SwapEffect:                         TD3DSwapEffect;
  333.     hDeviceWindow:                      HWND;
  334.     Windowed:                           Bool;
  335.     EnableAutoDepthStencil:             Bool;
  336.     AutoDepthStencilFormat:             TD3DFormat;
  337.     Flags: LongInt;
  338.     { Following elements must be zero for Windowed mode }
  339.     FullScreen_RefreshRateInHz:         LongWord;
  340.     FullScreen_PresentationInterval:    LongWord;
  341.   end {_D3DPRESENT_PARAMETERS_};
  342.   {$EXTERNALSYM _D3DPRESENT_PARAMETERS_}
  343.   D3DPRESENT_PARAMETERS = _D3DPRESENT_PARAMETERS_;
  344.   {$EXTERNALSYM D3DPRESENT_PARAMETERS}
  345.   TD3DPresentParameters = _D3DPRESENT_PARAMETERS_;
  346.   // Values for D3DPRESENT_PARAMETERS.Flags
  347. const
  348.   D3DPRESENTFLAG_LOCKABLE_BACKBUFFER  = $00000001;
  349.   {$EXTERNALSYM D3DPRESENTFLAG_LOCKABLE_BACKBUFFER}
  350.   { Gamma Ramp: Same as DX7 }
  351. type
  352.   PD3DGammaRamp = ^TD3DGammaRamp;
  353.   _D3DGAMMARAMP = packed record
  354.     red   : array [0..255] of Word;
  355.     green : array [0..255] of Word;
  356.     blue  : array [0..255] of Word;
  357.   end;
  358.   {$EXTERNALSYM _D3DGAMMARAMP}
  359.   D3DGAMMARAMP = _D3DGAMMARAMP;
  360.   {$EXTERNALSYM D3DGAMMARAMP}
  361.   TD3DGammaRamp = _D3DGAMMARAMP;
  362.   { Back buffer types }
  363.   _D3DBACKBUFFER_TYPE = (
  364.     D3DBACKBUFFER_TYPE_MONO         {= 0},
  365.     D3DBACKBUFFER_TYPE_LEFT         {= 1},
  366.     D3DBACKBUFFER_TYPE_RIGHT        {= 2}
  367.   );
  368.   {$EXTERNALSYM _D3DBACKBUFFER_TYPE}
  369.   D3DBACKBUFFER_TYPE = _D3DBACKBUFFER_TYPE;
  370.   {$EXTERNALSYM D3DBACKBUFFER_TYPE}
  371.   TD3DBackbufferType = _D3DBACKBUFFER_TYPE;
  372.   { Types }
  373.   _D3DRESOURCETYPE = (
  374.   {$IFNDEF COMPILER6_UP}
  375.     D3DRTYPE_INVALID_0              {=  0},
  376.     D3DRTYPE_SURFACE                {=  1},
  377.     D3DRTYPE_VOLUME                 {=  2},
  378.     D3DRTYPE_TEXTURE                {=  3},
  379.     D3DRTYPE_VOLUMETEXTURE          {=  4},
  380.     D3DRTYPE_CUBETEXTURE            {=  5},
  381.     D3DRTYPE_VERTEXBUFFER           {=  6},
  382.     D3DRTYPE_INDEXBUFFER            {=  7}
  383.   {$ELSE}
  384.     D3DRTYPE_SURFACE                =  1,
  385.     D3DRTYPE_VOLUME                 =  2,
  386.     D3DRTYPE_TEXTURE                =  3,
  387.     D3DRTYPE_VOLUMETEXTURE          =  4,
  388.     D3DRTYPE_CUBETEXTURE            =  5,
  389.     D3DRTYPE_VERTEXBUFFER           =  6,
  390.     D3DRTYPE_INDEXBUFFER            =  7
  391.   {$ENDIF}
  392.   );
  393.   {$EXTERNALSYM _D3DRESOURCETYPE}
  394.   D3DRESOURCETYPE = _D3DRESOURCETYPE;
  395.   {$EXTERNALSYM D3DRESOURCETYPE}
  396.   TD3DResourceType = _D3DRESOURCETYPE;
  397. const
  398.   { Usages }
  399.   D3DUSAGE_RENDERTARGET       = $00000001;
  400.   {$EXTERNALSYM D3DUSAGE_RENDERTARGET}
  401.   D3DUSAGE_DEPTHSTENCIL       = $00000002;
  402.   {$EXTERNALSYM D3DUSAGE_DEPTHSTENCIL}
  403.   { Usages for Vertex/Index buffers }
  404.   D3DUSAGE_WRITEONLY          = $00000008;
  405.   {$EXTERNALSYM D3DUSAGE_WRITEONLY}
  406.   D3DUSAGE_SOFTWAREPROCESSING = $00000010;
  407.   {$EXTERNALSYM D3DUSAGE_SOFTWAREPROCESSING}
  408.   D3DUSAGE_DONOTCLIP          = $00000020;
  409.   {$EXTERNALSYM D3DUSAGE_DONOTCLIP}
  410.   D3DUSAGE_POINTS             = $00000040;
  411.   {$EXTERNALSYM D3DUSAGE_POINTS}
  412.   D3DUSAGE_RTPATCHES          = $00000080;
  413.   {$EXTERNALSYM D3DUSAGE_RTPATCHES}
  414.   D3DUSAGE_NPATCHES           = $00000100;
  415.   {$EXTERNALSYM D3DUSAGE_NPATCHES}
  416.   D3DUSAGE_DYNAMIC            = $00000200;
  417.   {$EXTERNALSYM D3DUSAGE_DYNAMIC}
  418. type
  419.   { CubeMap Face identifiers }
  420.   _D3DCUBEMAP_FACES = (
  421.     D3DCUBEMAP_FACE_POSITIVE_X     {= 0},
  422.     D3DCUBEMAP_FACE_NEGATIVE_X     {= 1},
  423.     D3DCUBEMAP_FACE_POSITIVE_Y     {= 2},
  424.     D3DCUBEMAP_FACE_NEGATIVE_Y     {= 3},
  425.     D3DCUBEMAP_FACE_POSITIVE_Z     {= 4},
  426.     D3DCUBEMAP_FACE_NEGATIVE_Z     {= 5}
  427.   );
  428.   {$EXTERNALSYM _D3DCUBEMAP_FACES}
  429.   D3DCUBEMAP_FACES = _D3DCUBEMAP_FACES;
  430.   {$EXTERNALSYM D3DCUBEMAP_FACES}
  431.   TD3DCubemapFaces = _D3DCUBEMAP_FACES;
  432. const
  433.   { Lock flags }
  434.   D3DLOCK_READONLY         = $00000010;
  435.   {$EXTERNALSYM D3DLOCK_READONLY}
  436.   D3DLOCK_DISCARD          = $00002000;
  437.   {$EXTERNALSYM D3DLOCK_DISCARD}
  438.   D3DLOCK_NOOVERWRITE      = $00001000;
  439.   {$EXTERNALSYM D3DLOCK_NOOVERWRITE}
  440.   D3DLOCK_NOSYSLOCK        = $00000800;
  441.   {$EXTERNALSYM D3DLOCK_NOSYSLOCK}
  442.   D3DLOCK_NO_DIRTY_UPDATE  = $00008000;
  443.   {$EXTERNALSYM D3DLOCK_NO_DIRTY_UPDATE}
  444. type
  445.   { Vertex Buffer Description }
  446.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  447.   _D3DVERTEXBUFFER_DESC = packed record
  448.     Format : TD3DFormat;
  449.     _Type  : TD3DResourceType;
  450.     Usage  : DWord;
  451.     Pool   : TD3DPool;
  452.     Size   : LongWord;
  453.     FVF    : DWord;
  454.   end;
  455.   {$EXTERNALSYM _D3DVERTEXBUFFER_DESC}
  456.   D3DVERTEXBUFFER_DESC = _D3DVERTEXBUFFER_DESC;
  457.   {$EXTERNALSYM D3DVERTEXBUFFER_DESC}
  458.   TD3DVertexBufferDesc = _D3DVERTEXBUFFER_DESC;
  459.   { Index Buffer Description }
  460.   PD3DIndexBufferDesc = ^TD3DIndexBufferDesc;
  461.   _D3DINDEXBUFFER_DESC = packed record
  462.     Format : TD3DFormat;
  463.     _Type  : TD3DResourceType;
  464.     Usage  : DWord;
  465.     Pool   : TD3DPool;
  466.     Size   : LongWord;
  467.   end {_D3DINDEXBUFFER_DESC};
  468.   {$EXTERNALSYM _D3DINDEXBUFFER_DESC}
  469.   D3DINDEXBUFFER_DESC = _D3DINDEXBUFFER_DESC;
  470.   {$EXTERNALSYM D3DINDEXBUFFER_DESC}
  471.   TD3DIndexBufferDesc = _D3DINDEXBUFFER_DESC;
  472.  { Surface Description }
  473.   PD3DSurfaceDesc = ^TD3DSurfaceDesc;
  474.   _D3DSURFACE_DESC = packed record
  475.     Format : TD3DFormat;
  476.     _Type  : TD3DResourceType;
  477.     Usage  : DWord;
  478.     Pool   : TD3DPool;
  479.     Size   : LongWord;
  480.     MultiSampleType: TD3DMultiSampleType;
  481.     Width  : LongWord;
  482.     Height : LongWord;
  483.   end {_D3DSURFACE_DESC};
  484.   {$EXTERNALSYM _D3DSURFACE_DESC}
  485.   D3DSURFACE_DESC = _D3DSURFACE_DESC;
  486.   {$EXTERNALSYM D3DSURFACE_DESC}
  487.   TD3DSurfaceDesc = _D3DSURFACE_DESC;
  488.   PD3DVolumeDesc = ^TD3DVolumeDesc;
  489.   _D3DVOLUME_DESC = packed record
  490.     Format : TD3DFormat;
  491.     _Type  : TD3DResourceType;
  492.     Usage  : DWord;
  493.     Pool   : TD3DPool;
  494.     Size   : LongWord;
  495.     Width  : LongWord;
  496.     Height : LongWord;
  497.     Depth  : LongWord;
  498.   end {_D3DVOLUME_DESC};
  499.   {$EXTERNALSYM _D3DVOLUME_DESC}
  500.   D3DVOLUME_DESC = _D3DVOLUME_DESC;
  501.   {$EXTERNALSYM D3DVOLUME_DESC}
  502.   TD3DVolumeDesc = _D3DVOLUME_DESC;
  503.   { Structure for LockRect }
  504.   PD3DLockedRect = ^TD3DLockedRect;
  505.   _D3DLOCKED_RECT = packed record
  506.     Pitch: Integer;
  507.     pBits: Pointer; // void*
  508.   end {_D3DLOCKED_RECT};
  509.   {$EXTERNALSYM _D3DLOCKED_RECT}
  510.   D3DLOCKED_RECT = _D3DLOCKED_RECT;
  511.   {$EXTERNALSYM D3DLOCKED_RECT}
  512.   TD3DLockedRect = _D3DLOCKED_RECT;
  513.   { Structures for LockBox }
  514.   PD3DBox = ^TD3DBox;
  515.   _D3DBOX = packed record
  516.     Left        : LongWord;
  517.     Top         : LongWord;
  518.     Right       : LongWord;
  519.     Bottom      : LongWord;
  520.     Front       : LongWord;
  521.     Back        : LongWord;
  522.   end {_D3DBOX};
  523.   {$EXTERNALSYM _D3DBOX}
  524.   D3DBOX = _D3DBOX;
  525.   {$EXTERNALSYM D3DBOX}
  526.   TD3DBox = _D3DBOX;
  527.   PD3DLockedBox = ^TD3DLockedBox;
  528.   _D3DLOCKED_BOX = packed record
  529.     RowPitch    : Integer;
  530.     SlicePitch  : Integer;
  531.     pBits       : Pointer; // void*
  532.   end {_D3DLOCKED_BOX};
  533.   {$EXTERNALSYM _D3DLOCKED_BOX}
  534.   D3DLOCKED_BOX = _D3DLOCKED_BOX;
  535.   {$EXTERNALSYM D3DLOCKED_BOX}
  536.   TD3DLockedBox = _D3DLOCKED_BOX;
  537.   { Structures for LockRange }
  538.   PD3DRange = ^TD3DRange;
  539.   _D3DRANGE = packed record
  540.     Offset      : LongWord;
  541.     Size        : LongWord;
  542.   end {_D3DRANGE};
  543.   {$EXTERNALSYM _D3DRANGE}
  544.   D3DRANGE = _D3DRANGE;
  545.   {$EXTERNALSYM D3DRANGE}
  546.   TD3DRange = _D3DRANGE;
  547.   { Structures for high order primitives }
  548.   PD3DRectPatchInfo = ^TD3DRectPatchInfo;
  549.   _D3DRECTPATCH_INFO = packed record
  550.     StartVertexOffsetWidth  : LongWord;
  551.     StartVertexOffsetHeight : LongWord;
  552.     Width                   : LongWord;
  553.     Height                  : LongWord;
  554.     Stride                  : LongWord;
  555.     Basis                   : TD3DBasisType;
  556.     Order                   : TD3DOrderType;
  557.   end;
  558.   {$EXTERNALSYM _D3DRECTPATCH_INFO}
  559.   D3DRECTPATCH_INFO = _D3DRECTPATCH_INFO;
  560.   {$EXTERNALSYM D3DRECTPATCH_INFO}
  561.   TD3DRectPatchInfo = _D3DRECTPATCH_INFO;
  562.   PD3DTriPatchInfo = ^TD3DTriPatchInfo;
  563.   _D3DTRIPATCH_INFO = packed record
  564.     StartVertexOffset : LongWord;
  565.     NumVertices       : LongWord;
  566.     Basis             : TD3DBasisType;
  567.     Order             : TD3DOrderType;
  568.   end;
  569.   {$EXTERNALSYM _D3DTRIPATCH_INFO}
  570.   D3DTRIPATCH_INFO = _D3DTRIPATCH_INFO;
  571.   {$EXTERNALSYM D3DTRIPATCH_INFO}
  572.   TD3DTriPatchInfo = _D3DTRIPATCH_INFO;
  573. const
  574.   { Adapter Identifier }
  575.   MAX_DEVICE_IDENTIFIER_STRING  = 512;
  576.   {$EXTERNALSYM MAX_DEVICE_IDENTIFIER_STRING}
  577. type
  578.   PD3DAdapterIdentifier8 = ^TD3DAdapterIdentifier8;
  579.   _D3DADAPTER_IDENTIFIER8 = packed record
  580.     Driver      : array [0..MAX_DEVICE_IDENTIFIER_STRING-1] of Char;
  581.     Description : array [0..MAX_DEVICE_IDENTIFIER_STRING-1] of Char;
  582. {$IFDEF WIN32}
  583.     DriverVersion               : Int64;     { Defined for 32 bit components }
  584. {$ELSE}
  585.     DriverVersionLowPart        : DWord;     { Defined for 16 bit driver components }
  586.     DriverVersionHighPart       : DWord;
  587. {$ENDIF}
  588.     VendorId    : DWord;
  589.     DeviceId    : DWord;
  590.     SubSysId    : DWord;
  591.     Revision    : DWord;
  592.     DeviceIdentifier : TGUID;
  593.     WHQLLevel   : DWord;
  594.   end;
  595.   {$EXTERNALSYM _D3DADAPTER_IDENTIFIER8}
  596.   D3DADAPTER_IDENTIFIER8 = _D3DADAPTER_IDENTIFIER8;
  597.   {$EXTERNALSYM D3DADAPTER_IDENTIFIER8}
  598.   TD3DAdapterIdentifier8 = _D3DADAPTER_IDENTIFIER8;
  599.   { Raster Status structure returned by GetRasterStatus }
  600.   PD3DRasterStatus = ^TD3DRasterStatus;
  601.   _D3DRASTER_STATUS = packed record
  602.     InVBlank : Bool;
  603.     ScanLine : LongWord;
  604.   end;
  605.   {$EXTERNALSYM _D3DRASTER_STATUS}
  606.   D3DRASTER_STATUS = _D3DRASTER_STATUS;
  607.   {$EXTERNALSYM D3DRASTER_STATUS}
  608.   TD3DRasterStatus = _D3DRASTER_STATUS;
  609. { Debug monitor tokens (DEBUG only)
  610.    Note that if D3DRS_DEBUGMONITORTOKEN is set, the call is treated as
  611.    passing a token to the debug monitor.  For example, if, after passing
  612.    D3DDMT_ENABLE/DISABLE to D3DRS_DEBUGMONITORTOKEN other token values
  613.    are passed in, the enabled/disabled state of the debug
  614.    monitor will still persist.
  615.    The debug monitor defaults to enabled.
  616.    Calling GetRenderState on D3DRS_DEBUGMONITORTOKEN is not of any use.
  617. }
  618.   _D3DDEBUGMONITORTOKENS = DWord;
  619.   {$EXTERNALSYM _D3DDEBUGMONITORTOKENS}
  620.   D3DDEBUGMONITORTOKENS = _D3DDEBUGMONITORTOKENS;
  621.   {$EXTERNALSYM D3DDEBUGMONITORTOKENS}
  622.   TD3DDebugMonitorTokens = _D3DDEBUGMONITORTOKENS;
  623. const
  624.   D3DDMT_ENABLE            = 0;    // enable debug monitor
  625.   {$EXTERNALSYM D3DDMT_ENABLE}
  626.   D3DDMT_DISABLE           = 1;    // disable debug monitor
  627.   {$EXTERNALSYM D3DDMT_DISABLE}
  628. const
  629.   // GetInfo IDs
  630.   D3DDEVINFOID_RESOURCEMANAGER  = 5; (* Used with D3DDEVINFO_RESOURCEMANAGER *)
  631.   {$EXTERNALSYM D3DDEVINFOID_RESOURCEMANAGER}
  632.   D3DDEVINFOID_VERTEXSTATS      = 6; (* Used with D3DDEVINFO_D3DVERTEXSTATS *)
  633.   {$EXTERNALSYM D3DDEVINFOID_VERTEXSTATS}
  634. type
  635.   PD3DResourceStats = ^TD3DResourceStats;
  636.   _D3DRESOURCESTATS = packed record
  637.   // Data collected since last Present()
  638.     bThrashing                  : BOOL;  (* indicates if thrashing *)
  639.     ApproxBytesDownloaded       : DWORD; (* Approximate number of bytes downloaded by resource manager *)
  640.     NumEvicts                   : DWORD; (* number of objects evicted *)
  641.     NumVidCreates               : DWORD; (* number of objects created in video memory *)
  642.     LastPri                     : DWORD; (* priority of last object evicted *)
  643.     NumUsed                     : DWORD; (* number of objects set to the device *)
  644.     NumUsedInVidMem             : DWORD; (* number of objects set to the device, which are already in video memory *)
  645.   // Persistent data
  646.     WorkingSet                  : DWORD; (* number of objects in video memory *)
  647.     WorkingSetBytes             : DWORD; (* number of bytes in video memory *)
  648.     TotalManaged                : DWORD; (* total number of managed objects *)
  649.     TotalBytes                  : DWORD; (* total number of bytes of managed objects *)
  650.   end;
  651.   {$EXTERNALSYM _D3DRESOURCESTATS}
  652.   D3DRESOURCESTATS = _D3DRESOURCESTATS;
  653.   {$EXTERNALSYM D3DRESOURCESTATS}
  654.   TD3DResourceStats = _D3DRESOURCESTATS;
  655. const
  656.   D3DRTYPECOUNT = (DWORD(D3DRTYPE_INDEXBUFFER) + 1);
  657.   {$EXTERNALSYM D3DRTYPECOUNT}
  658. type
  659.   PD3DDevInfoResourceManager = ^TD3DDevInfoResourceManager;
  660.   _D3DDEVINFO_RESOURCEMANAGER = packed record
  661.     stats: array [0..D3DRTYPECOUNT-1] of TD3DResourceStats;
  662.   end;
  663.   {$EXTERNALSYM _D3DDEVINFO_RESOURCEMANAGER}
  664.   D3DDEVINFO_RESOURCEMANAGER = _D3DDEVINFO_RESOURCEMANAGER;
  665.   {$EXTERNALSYM D3DDEVINFO_RESOURCEMANAGER}
  666.   TD3DDevInfoResourceManager = _D3DDEVINFO_RESOURCEMANAGER;
  667.   PD3DDevInfoD3DVertexStats = ^TD3DDevInfoD3DVertexStats;
  668.   _D3DDEVINFO_D3DVERTEXSTATS = packed record
  669.     NumRenderedTriangles        : DWORD; (* total number of triangles that are not clipped in this frame *)
  670.     NumExtraClippingTriangles   : DWORD; (* Number of new triangles generated by clipping *)
  671.   end;
  672.   {$EXTERNALSYM _D3DDEVINFO_D3DVERTEXSTATS}
  673.   D3DDEVINFO_D3DVERTEXSTATS = _D3DDEVINFO_D3DVERTEXSTATS;
  674.   {$EXTERNALSYM D3DDEVINFO_D3DVERTEXSTATS}
  675.   TD3DDevInfoD3DVertexStats = _D3DDEVINFO_D3DVERTEXSTATS;
  676. (*==========================================================================;
  677.  *
  678.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  679.  *
  680.  *  File:       d3d8caps.h
  681.  *  Content:    Direct3D capabilities include file
  682.  *
  683.  ***************************************************************************)
  684. type
  685.   PD3DCaps8 = ^TD3DCaps8;
  686.   _D3DCAPS8 = record
  687.     (* Device Info *)
  688.     DeviceType: TD3DDevType;
  689.     AdapterOrdinal: DWord;
  690.     (* Caps from DX7 Draw *)
  691.     Caps: DWord;
  692.     Caps2: DWord;
  693.     Caps3: DWord;
  694.     PresentationIntervals: DWord;
  695.     (* Cursor Caps *)
  696.     CursorCaps: DWORD;
  697.     (* 3D Device Caps *)
  698.     DevCaps: DWord;
  699.     PrimitiveMiscCaps: DWord;
  700.     RasterCaps: DWord;
  701.     ZCmpCaps: DWord;
  702.     SrcBlendCaps: DWord;
  703.     DestBlendCaps: DWord;
  704.     AlphaCmpCaps: DWord;
  705.     ShadeCaps: DWord;
  706.     TextureCaps: DWord;
  707.     TextureFilterCaps: DWord;           // D3DPTFILTERCAPS for IDirect3DTexture8's
  708.     CubeTextureFilterCaps: DWord;       // D3DPTFILTERCAPS for IDirect3DCubeTexture8's
  709.     VolumeTextureFilterCaps: DWord;     // D3DPTFILTERCAPS for IDirect3DVolumeTexture8's
  710.     TextureAddressCaps: DWord;          // D3DPTADDRESSCAPS for IDirect3DTexture8's
  711.     VolumeTextureAddressCaps: DWord;    // D3DPTADDRESSCAPS for IDirect3DVolumeTexture8's
  712.     LineCaps: DWord;                    // D3DLINECAPS
  713.     MaxTextureWidth, MaxTextureHeight: DWord;
  714.     MaxVolumeExtent: DWord;
  715.     MaxTextureRepeat: DWord;
  716.     MaxTextureAspectRatio: DWord;
  717.     MaxAnisotropy: DWord;
  718.     MaxVertexW: Single;
  719.     GuardBandLeft: Single;
  720.     GuardBandTop: Single;
  721.     GuardBandRight: Single;
  722.     GuardBandBottom: Single;
  723.     ExtentsAdjust: Single;
  724.     StencilCaps: DWord;
  725.     FVFCaps: DWord;
  726.     TextureOpCaps: DWord;
  727.     MaxTextureBlendStages: DWord;
  728.     MaxSimultaneousTextures: DWord;
  729.     VertexProcessingCaps: DWord;
  730.     MaxActiveLights: DWord;
  731.     MaxUserClipPlanes: DWord;
  732.     MaxVertexBlendMatrices: DWord;
  733.     MaxVertexBlendMatrixIndex: DWord;
  734.     MaxPointSize: Single;
  735.     MaxPrimitiveCount: DWord;           // max number of primitives per DrawPrimitive call
  736.     MaxVertexIndex: DWord;
  737.     MaxStreams: DWord;
  738.     MaxStreamStride: DWord;             // max stride for SetStreamSource
  739.     VertexShaderVersion: DWord;
  740.     MaxVertexShaderConst: DWord;        // number of vertex shader constant registers
  741.     PixelShaderVersion: DWord;
  742.     MaxPixelShaderValue: Single;        // max value of pixel shader arithmetic component
  743.   end {D3DCAPS8};
  744.   {$EXTERNALSYM _D3DCAPS8}
  745.   D3DCAPS8 = _D3DCAPS8;
  746.   {$EXTERNALSYM D3DCAPS8}
  747.   TD3DCaps8 = _D3DCAPS8;
  748.   //
  749.   // BIT DEFINES FOR D3DCAPS8 DWORD MEMBERS
  750.   //
  751. const
  752.   //
  753.   // Caps
  754.   //
  755.   D3DCAPS_READ_SCANLINE         = $00020000;
  756.   {$EXTERNALSYM D3DCAPS_READ_SCANLINE}
  757.   //
  758.   // Caps2
  759.   //
  760.   D3DCAPS2_NO2DDURING3DSCENE    = $00000002;
  761.   {$EXTERNALSYM D3DCAPS2_NO2DDURING3DSCENE}
  762.   D3DCAPS2_FULLSCREENGAMMA      = $00020000;
  763.   {$EXTERNALSYM D3DCAPS2_FULLSCREENGAMMA}
  764.   D3DCAPS2_CANRENDERWINDOWED    = $00080000;
  765.   {$EXTERNALSYM D3DCAPS2_CANRENDERWINDOWED}
  766.   D3DCAPS2_CANCALIBRATEGAMMA    = $00100000;
  767.   {$EXTERNALSYM D3DCAPS2_CANCALIBRATEGAMMA}
  768.   D3DCAPS2_RESERVED             = $02000000;
  769.   {$EXTERNALSYM D3DCAPS2_RESERVED}
  770.   D3DCAPS2_CANMANAGERESOURCE    = $10000000;
  771.   {$EXTERNALSYM D3DCAPS2_CANMANAGERESOURCE}
  772.   D3DCAPS2_DYNAMICTEXTURES      = $20000000;
  773.   {$EXTERNALSYM D3DCAPS2_DYNAMICTEXTURES}
  774.   //
  775.   // Caps3
  776.   //
  777.   D3DCAPS3_RESERVED             = $8000001F;
  778.   {$EXTERNALSYM D3DCAPS3_RESERVED}
  779.   // Indicates that the device can respect the ALPHABLENDENABLE render state
  780.   // when fullscreen while using the FLIP or DISCARD swap effect.
  781.   // COPY and COPYVSYNC swap effects work whether or not this flag is set.
  782.   D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD     = $00000020;
  783.   {$EXTERNALSYM D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD}
  784.   //
  785.   // PresentationIntervals
  786.   //
  787.   D3DPRESENT_INTERVAL_DEFAULT   = $00000000;
  788.   {$EXTERNALSYM D3DPRESENT_INTERVAL_DEFAULT}
  789.   D3DPRESENT_INTERVAL_ONE       = $00000001;
  790.   {$EXTERNALSYM D3DPRESENT_INTERVAL_ONE}
  791.   D3DPRESENT_INTERVAL_TWO       = $00000002;
  792.   {$EXTERNALSYM D3DPRESENT_INTERVAL_TWO}
  793.   D3DPRESENT_INTERVAL_THREE     = $00000004;
  794.   {$EXTERNALSYM D3DPRESENT_INTERVAL_THREE}
  795.   D3DPRESENT_INTERVAL_FOUR      = $00000008;
  796.   {$EXTERNALSYM D3DPRESENT_INTERVAL_FOUR}
  797.   D3DPRESENT_INTERVAL_IMMEDIATE = $80000000;
  798.   {$EXTERNALSYM D3DPRESENT_INTERVAL_IMMEDIATE}
  799.   //
  800.   // CursorCaps
  801.   //
  802.   // Driver supports HW color cursor in at least hi-res modes(height >=400)
  803.   D3DCURSORCAPS_COLOR           = $00000001;
  804.   {$EXTERNALSYM D3DCURSORCAPS_COLOR}
  805.   // Driver supports HW cursor also in low-res modes(height < 400)
  806.   D3DCURSORCAPS_LOWRES          = $00000002;
  807.   {$EXTERNALSYM D3DCURSORCAPS_LOWRES}
  808.   //
  809.   // DevCaps
  810.   //
  811.   D3DDEVCAPS_EXECUTESYSTEMMEMORY        = $00000010; { Device can use execute buffers from system memory }
  812.   {$EXTERNALSYM D3DDEVCAPS_EXECUTESYSTEMMEMORY}
  813.   D3DDEVCAPS_EXECUTEVIDEOMEMORY         = $00000020; { Device can use execute buffers from video memory }
  814.   {$EXTERNALSYM D3DDEVCAPS_EXECUTEVIDEOMEMORY}
  815.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY       = $00000040; { Device can use TL buffers from system memory }
  816.   {$EXTERNALSYM D3DDEVCAPS_TLVERTEXSYSTEMMEMORY}
  817.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY        = $00000080; { Device can use TL buffers from video memory }
  818.   {$EXTERNALSYM D3DDEVCAPS_TLVERTEXVIDEOMEMORY}
  819.   D3DDEVCAPS_TEXTURESYSTEMMEMORY        = $00000100; { Device can texture from system memory }
  820.   {$EXTERNALSYM D3DDEVCAPS_TEXTURESYSTEMMEMORY}
  821.   D3DDEVCAPS_TEXTUREVIDEOMEMORY         = $00000200; { Device can texture from device memory }
  822.   {$EXTERNALSYM D3DDEVCAPS_TEXTUREVIDEOMEMORY}
  823.   D3DDEVCAPS_DRAWPRIMTLVERTEX           = $00000400; { Device can draw TLVERTEX primitives }
  824.   {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMTLVERTEX}
  825.   D3DDEVCAPS_CANRENDERAFTERFLIP         = $00000800; { Device can render without waiting for flip to complete }
  826.   {$EXTERNALSYM D3DDEVCAPS_CANRENDERAFTERFLIP}
  827.   D3DDEVCAPS_TEXTURENONLOCALVIDMEM      = $00001000; { Device can texture from nonlocal video memory }
  828.   {$EXTERNALSYM D3DDEVCAPS_TEXTURENONLOCALVIDMEM}
  829.   D3DDEVCAPS_DRAWPRIMITIVES2            = $00002000; { Device can support DrawPrimitives2 }
  830.   {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2}
  831.   D3DDEVCAPS_SEPARATETEXTUREMEMORIES    = $00004000; { Device is texturing from separate memory pools }
  832.   {$EXTERNALSYM D3DDEVCAPS_SEPARATETEXTUREMEMORIES}
  833.   D3DDEVCAPS_DRAWPRIMITIVES2EX          = $00008000; { Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver }
  834.   {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2EX}
  835.   D3DDEVCAPS_HWTRANSFORMANDLIGHT        = $00010000; { Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also }
  836.   {$EXTERNALSYM D3DDEVCAPS_HWTRANSFORMANDLIGHT}
  837.   D3DDEVCAPS_CANBLTSYSTONONLOCAL        = $00020000; { Device supports a Tex Blt from system memory to non-local vidmem }
  838.   {$EXTERNALSYM D3DDEVCAPS_CANBLTSYSTONONLOCAL}
  839.   D3DDEVCAPS_HWRASTERIZATION            = $00080000; { Device has HW acceleration for rasterization }
  840.   {$EXTERNALSYM D3DDEVCAPS_HWRASTERIZATION}
  841.   D3DDEVCAPS_PUREDEVICE                 = $00100000; { Device supports D3DCREATE_PUREDEVICE }
  842.   {$EXTERNALSYM D3DDEVCAPS_PUREDEVICE}
  843.   D3DDEVCAPS_QUINTICRTPATCHES           = $00200000; { Device supports quintic Beziers and BSplines }
  844.   {$EXTERNALSYM D3DDEVCAPS_QUINTICRTPATCHES}
  845.   D3DDEVCAPS_RTPATCHES                  = $00400000; { Device supports Rect and Tri patches }
  846.   {$EXTERNALSYM D3DDEVCAPS_RTPATCHES}
  847.   D3DDEVCAPS_RTPATCHHANDLEZERO          = $00800000; { Indicates that RT Patches may be drawn efficiently using handle 0 }
  848.   {$EXTERNALSYM D3DDEVCAPS_RTPATCHHANDLEZERO}
  849.   D3DDEVCAPS_NPATCHES                   = $01000000; { Device supports N-Patches }
  850.   {$EXTERNALSYM D3DDEVCAPS_NPATCHES}
  851.   //
  852.   // PrimitiveMiscCaps
  853.   //
  854.   D3DPMISCCAPS_MASKZ                    = $00000002;
  855.   {$EXTERNALSYM D3DPMISCCAPS_MASKZ}
  856.   D3DPMISCCAPS_LINEPATTERNREP           = $00000004;
  857.   {$EXTERNALSYM D3DPMISCCAPS_LINEPATTERNREP}
  858.   D3DPMISCCAPS_CULLNONE                 = $00000010;
  859.   {$EXTERNALSYM D3DPMISCCAPS_CULLNONE}
  860.   D3DPMISCCAPS_CULLCW                   = $00000020;
  861.   {$EXTERNALSYM D3DPMISCCAPS_CULLCW}
  862.   D3DPMISCCAPS_CULLCCW                  = $00000040;
  863.   {$EXTERNALSYM D3DPMISCCAPS_CULLCCW}
  864.   D3DPMISCCAPS_COLORWRITEENABLE         = $00000080;
  865.   {$EXTERNALSYM D3DPMISCCAPS_COLORWRITEENABLE}
  866.   D3DPMISCCAPS_CLIPPLANESCALEDPOINTS    = $00000100; { Device correctly clips scaled points to clip planes }
  867.   {$EXTERNALSYM D3DPMISCCAPS_CLIPPLANESCALEDPOINTS}
  868.   D3DPMISCCAPS_CLIPTLVERTS              = $00000200; { device will clip post-transformed vertex primitives }
  869.   {$EXTERNALSYM D3DPMISCCAPS_CLIPTLVERTS}
  870.   D3DPMISCCAPS_TSSARGTEMP               = $00000400; { device supports D3DTA_TEMP for temporary register }
  871.   {$EXTERNALSYM D3DPMISCCAPS_TSSARGTEMP}
  872.   D3DPMISCCAPS_BLENDOP                  = $00000800; { device supports D3DRS_BLENDOP }
  873.   {$EXTERNALSYM D3DPMISCCAPS_BLENDOP}
  874.   D3DPMISCCAPS_NULLREFERENCE            = $00001000; { Reference Device that doesnt render }
  875.   {$EXTERNALSYM D3DPMISCCAPS_NULLREFERENCE}
  876.   //
  877.   // LineCaps
  878.   //
  879.   D3DLINECAPS_TEXTURE                   = $00000001;
  880.   {$EXTERNALSYM D3DLINECAPS_TEXTURE}
  881.   D3DLINECAPS_ZTEST                     = $00000002;
  882.   {$EXTERNALSYM D3DLINECAPS_ZTEST}
  883.   D3DLINECAPS_BLEND                     = $00000004;
  884.   {$EXTERNALSYM D3DLINECAPS_BLEND}
  885.   D3DLINECAPS_ALPHACMP                  = $00000008;
  886.   {$EXTERNALSYM D3DLINECAPS_ALPHACMP}
  887.   D3DLINECAPS_FOG                       = $00000010;
  888.   {$EXTERNALSYM D3DLINECAPS_FOG}
  889.   //
  890.   // RasterCaps
  891.   //
  892.   D3DPRASTERCAPS_DITHER                 = $00000001;
  893.   {$EXTERNALSYM D3DPRASTERCAPS_DITHER}
  894.   D3DPRASTERCAPS_PAT                    = $00000008;
  895.   {$EXTERNALSYM D3DPRASTERCAPS_PAT}
  896.   D3DPRASTERCAPS_ZTEST                  = $00000010;
  897.   {$EXTERNALSYM D3DPRASTERCAPS_ZTEST}
  898.   D3DPRASTERCAPS_FOGVERTEX              = $00000080;
  899.   {$EXTERNALSYM D3DPRASTERCAPS_FOGVERTEX}
  900.   D3DPRASTERCAPS_FOGTABLE               = $00000100;
  901.   {$EXTERNALSYM D3DPRASTERCAPS_FOGTABLE}
  902.   D3DPRASTERCAPS_ANTIALIASEDGES         = $00001000;
  903.   {$EXTERNALSYM D3DPRASTERCAPS_ANTIALIASEDGES}
  904.   D3DPRASTERCAPS_MIPMAPLODBIAS          = $00002000;
  905.   {$EXTERNALSYM D3DPRASTERCAPS_MIPMAPLODBIAS}
  906.   D3DPRASTERCAPS_ZBIAS                  = $00004000;
  907.   {$EXTERNALSYM D3DPRASTERCAPS_ZBIAS}
  908.   D3DPRASTERCAPS_ZBUFFERLESSHSR         = $00008000;
  909.   {$EXTERNALSYM D3DPRASTERCAPS_ZBUFFERLESSHSR}
  910.   D3DPRASTERCAPS_FOGRANGE               = $00010000;
  911.   {$EXTERNALSYM D3DPRASTERCAPS_FOGRANGE}
  912.   D3DPRASTERCAPS_ANISOTROPY             = $00020000;
  913.   {$EXTERNALSYM D3DPRASTERCAPS_ANISOTROPY}
  914.   D3DPRASTERCAPS_WBUFFER                = $00040000;
  915.   {$EXTERNALSYM D3DPRASTERCAPS_WBUFFER}
  916.   D3DPRASTERCAPS_WFOG                   = $00100000;
  917.   {$EXTERNALSYM D3DPRASTERCAPS_WFOG}
  918.   D3DPRASTERCAPS_ZFOG                   = $00200000;
  919.   {$EXTERNALSYM D3DPRASTERCAPS_ZFOG}
  920.   D3DPRASTERCAPS_COLORPERSPECTIVE       = $00400000; { Device iterates colors perspective correct }
  921.   {$EXTERNALSYM D3DPRASTERCAPS_COLORPERSPECTIVE}
  922.   D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE  = $00800000;
  923.   {$EXTERNALSYM D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE}
  924.   //
  925.   // ZCmpCaps, AlphaCmpCaps
  926.   //
  927.   D3DPCMPCAPS_NEVER                     = $00000001;
  928.   {$EXTERNALSYM D3DPCMPCAPS_NEVER}
  929.   D3DPCMPCAPS_LESS                      = $00000002;
  930.   {$EXTERNALSYM D3DPCMPCAPS_LESS}
  931.   D3DPCMPCAPS_EQUAL                     = $00000004;
  932.   {$EXTERNALSYM D3DPCMPCAPS_EQUAL}
  933.   D3DPCMPCAPS_LESSEQUAL                 = $00000008;
  934.   {$EXTERNALSYM D3DPCMPCAPS_LESSEQUAL}
  935.   D3DPCMPCAPS_GREATER                   = $00000010;
  936.   {$EXTERNALSYM D3DPCMPCAPS_GREATER}
  937.   D3DPCMPCAPS_NOTEQUAL                  = $00000020;
  938.   {$EXTERNALSYM D3DPCMPCAPS_NOTEQUAL}
  939.   D3DPCMPCAPS_GREATEREQUAL              = $00000040;
  940.   {$EXTERNALSYM D3DPCMPCAPS_GREATEREQUAL}
  941.   D3DPCMPCAPS_ALWAYS                    = $00000080;
  942.   {$EXTERNALSYM D3DPCMPCAPS_ALWAYS}
  943.   //
  944.   // SourceBlendCaps, DestBlendCaps
  945.   //
  946.   D3DPBLENDCAPS_ZERO                    = $00000001;
  947.   {$EXTERNALSYM D3DPBLENDCAPS_ZERO}
  948.   D3DPBLENDCAPS_ONE                     = $00000002;
  949.   {$EXTERNALSYM D3DPBLENDCAPS_ONE}
  950.   D3DPBLENDCAPS_SRCCOLOR                = $00000004;
  951.   {$EXTERNALSYM D3DPBLENDCAPS_SRCCOLOR}
  952.   D3DPBLENDCAPS_INVSRCCOLOR             = $00000008;
  953.   {$EXTERNALSYM D3DPBLENDCAPS_INVSRCCOLOR}
  954.   D3DPBLENDCAPS_SRCALPHA                = $00000010;
  955.   {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHA}
  956.   D3DPBLENDCAPS_INVSRCALPHA             = $00000020;
  957.   {$EXTERNALSYM D3DPBLENDCAPS_INVSRCALPHA}
  958.   D3DPBLENDCAPS_DESTALPHA               = $00000040;
  959.   {$EXTERNALSYM D3DPBLENDCAPS_DESTALPHA}
  960.   D3DPBLENDCAPS_INVDESTALPHA            = $00000080;
  961.   {$EXTERNALSYM D3DPBLENDCAPS_INVDESTALPHA}
  962.   D3DPBLENDCAPS_DESTCOLOR               = $00000100;
  963.   {$EXTERNALSYM D3DPBLENDCAPS_DESTCOLOR}
  964.   D3DPBLENDCAPS_INVDESTCOLOR            = $00000200;
  965.   {$EXTERNALSYM D3DPBLENDCAPS_INVDESTCOLOR}
  966.   D3DPBLENDCAPS_SRCALPHASAT             = $00000400;
  967.   {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHASAT}
  968.   D3DPBLENDCAPS_BOTHSRCALPHA            = $00000800;
  969.   {$EXTERNALSYM D3DPBLENDCAPS_BOTHSRCALPHA}
  970.   D3DPBLENDCAPS_BOTHINVSRCALPHA         = $00001000;
  971.   {$EXTERNALSYM D3DPBLENDCAPS_BOTHINVSRCALPHA}
  972.   //
  973.   // ShadeCaps
  974.   //
  975.   D3DPSHADECAPS_COLORGOURAUDRGB         = $00000008;
  976.   {$EXTERNALSYM D3DPSHADECAPS_COLORGOURAUDRGB}
  977.   D3DPSHADECAPS_SPECULARGOURAUDRGB      = $00000200;
  978.   {$EXTERNALSYM D3DPSHADECAPS_SPECULARGOURAUDRGB}
  979.   D3DPSHADECAPS_ALPHAGOURAUDBLEND       = $00004000;
  980.   {$EXTERNALSYM D3DPSHADECAPS_ALPHAGOURAUDBLEND}
  981.   D3DPSHADECAPS_FOGGOURAUD              = $00080000;
  982.   {$EXTERNALSYM D3DPSHADECAPS_FOGGOURAUD}
  983.   //
  984.   // TextureCaps
  985.   //
  986.   D3DPTEXTURECAPS_PERSPECTIVE           = $00000001; { Perspective-correct texturing is supported }
  987.   {$EXTERNALSYM D3DPTEXTURECAPS_PERSPECTIVE}
  988.   D3DPTEXTURECAPS_POW2                  = $00000002; { Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. }
  989.   {$EXTERNALSYM D3DPTEXTURECAPS_POW2}
  990.   D3DPTEXTURECAPS_ALPHA                 = $00000004; { Alpha in texture pixels is supported }
  991.   {$EXTERNALSYM D3DPTEXTURECAPS_ALPHA}
  992.   D3DPTEXTURECAPS_SQUAREONLY            = $00000020; { Only square textures are supported }
  993.   {$EXTERNALSYM D3DPTEXTURECAPS_SQUAREONLY}
  994.   D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040; { Texture indices are not scaled by the texture size prior to interpolation }
  995.   {$EXTERNALSYM D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE}
  996.   D3DPTEXTURECAPS_ALPHAPALETTE          = $00000080; { Device can draw alpha from texture palettes }
  997.   {$EXTERNALSYM D3DPTEXTURECAPS_ALPHAPALETTE}
  998.   // Device can use non-POW2 textures if:
  999.   //  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
  1000.   //  2) D3DRS_WRAP(N) is zero for this texture's coordinates
  1001.   //  3) mip mapping is not enabled (use magnification filter only)
  1002.   D3DPTEXTURECAPS_NONPOW2CONDITIONAL    = $00000100;
  1003.   {$EXTERNALSYM D3DPTEXTURECAPS_NONPOW2CONDITIONAL}
  1004.   D3DPTEXTURECAPS_PROJECTED             = $00000400; { Device can do D3DTTFF_PROJECTED }
  1005.   {$EXTERNALSYM D3DPTEXTURECAPS_PROJECTED}
  1006.   D3DPTEXTURECAPS_CUBEMAP               = $00000800; { Device can do cubemap textures }
  1007.   {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP}
  1008.   D3DPTEXTURECAPS_VOLUMEMAP             = $00002000; { Device can do volume textures }
  1009.   {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP}
  1010.   D3DPTEXTURECAPS_MIPMAP                = $00004000; { Device can do mipmapped textures }
  1011.   {$EXTERNALSYM D3DPTEXTURECAPS_MIPMAP}
  1012.   D3DPTEXTURECAPS_MIPVOLUMEMAP          = $00008000; { Device can do mipmapped volume textures }
  1013.   {$EXTERNALSYM D3DPTEXTURECAPS_MIPVOLUMEMAP}
  1014.   D3DPTEXTURECAPS_MIPCUBEMAP            = $00010000; { Device can do mipmapped cube maps }
  1015.   {$EXTERNALSYM D3DPTEXTURECAPS_MIPCUBEMAP}
  1016.   D3DPTEXTURECAPS_CUBEMAP_POW2          = $00020000; { Device requires that cubemaps be power-of-2 dimension }
  1017.   {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP_POW2}
  1018.   D3DPTEXTURECAPS_VOLUMEMAP_POW2        = $00040000; { Device requires that volume maps be power-of-2 dimension }
  1019.   {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP_POW2}
  1020.   //
  1021.   // TextureFilterCaps
  1022.   //
  1023.   D3DPTFILTERCAPS_MINFPOINT             = $00000100; { Min Filter }
  1024.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFPOINT}
  1025.   D3DPTFILTERCAPS_MINFLINEAR            = $00000200;
  1026.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFLINEAR}
  1027.   D3DPTFILTERCAPS_MINFANISOTROPIC       = $00000400;
  1028.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFANISOTROPIC}
  1029.   D3DPTFILTERCAPS_MIPFPOINT             = $00010000; { Mip Filter }
  1030.   {$EXTERNALSYM D3DPTFILTERCAPS_MIPFPOINT}
  1031.   D3DPTFILTERCAPS_MIPFLINEAR            = $00020000;
  1032.   {$EXTERNALSYM D3DPTFILTERCAPS_MIPFLINEAR}
  1033.   D3DPTFILTERCAPS_MAGFPOINT             = $01000000; { Mag Filter }
  1034.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFPOINT}
  1035.   D3DPTFILTERCAPS_MAGFLINEAR            = $02000000;
  1036.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFLINEAR}
  1037.   D3DPTFILTERCAPS_MAGFANISOTROPIC       = $04000000;
  1038.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFANISOTROPIC}
  1039.   D3DPTFILTERCAPS_MAGFAFLATCUBIC        = $08000000;
  1040.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFAFLATCUBIC}
  1041.   D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC     = $10000000;
  1042.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC}
  1043.   //
  1044.   // TextureAddressCaps
  1045.   //
  1046.   D3DPTADDRESSCAPS_WRAP                 = $00000001;
  1047.   {$EXTERNALSYM D3DPTADDRESSCAPS_WRAP}
  1048.   D3DPTADDRESSCAPS_MIRROR               = $00000002;
  1049.   {$EXTERNALSYM D3DPTADDRESSCAPS_MIRROR}
  1050.   D3DPTADDRESSCAPS_CLAMP                = $00000004;
  1051.   {$EXTERNALSYM D3DPTADDRESSCAPS_CLAMP}
  1052.   D3DPTADDRESSCAPS_BORDER               = $00000008;
  1053.   {$EXTERNALSYM D3DPTADDRESSCAPS_BORDER}
  1054.   D3DPTADDRESSCAPS_INDEPENDENTUV        = $00000010;
  1055.   {$EXTERNALSYM D3DPTADDRESSCAPS_INDEPENDENTUV}
  1056.   D3DPTADDRESSCAPS_MIRRORONCE           = $00000020;
  1057.   {$EXTERNALSYM D3DPTADDRESSCAPS_MIRRORONCE}
  1058.   //
  1059.   // StencilCaps
  1060.   //
  1061.   D3DSTENCILCAPS_KEEP                   = $00000001;
  1062.   {$EXTERNALSYM D3DSTENCILCAPS_KEEP}
  1063.   D3DSTENCILCAPS_ZERO                   = $00000002;
  1064.   {$EXTERNALSYM D3DSTENCILCAPS_ZERO}
  1065.   D3DSTENCILCAPS_REPLACE                = $00000004;
  1066.   {$EXTERNALSYM D3DSTENCILCAPS_REPLACE}
  1067.   D3DSTENCILCAPS_INCRSAT                = $00000008;
  1068.   {$EXTERNALSYM D3DSTENCILCAPS_INCRSAT}
  1069.   D3DSTENCILCAPS_DECRSAT                = $00000010;
  1070.   {$EXTERNALSYM D3DSTENCILCAPS_DECRSAT}
  1071.   D3DSTENCILCAPS_INVERT                 = $00000020;
  1072.   {$EXTERNALSYM D3DSTENCILCAPS_INVERT}
  1073.   D3DSTENCILCAPS_INCR                   = $00000040;
  1074.   {$EXTERNALSYM D3DSTENCILCAPS_INCR}
  1075.   D3DSTENCILCAPS_DECR                   = $00000080;
  1076.   {$EXTERNALSYM D3DSTENCILCAPS_DECR}
  1077.   //
  1078.   // TextureOpCaps
  1079.   //
  1080.   D3DTEXOPCAPS_DISABLE                          = $00000001;
  1081.   {$EXTERNALSYM D3DTEXOPCAPS_DISABLE}
  1082.   D3DTEXOPCAPS_SELECTARG1                       = $00000002;
  1083.   {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG1}
  1084.   D3DTEXOPCAPS_SELECTARG2                       = $00000004;
  1085.   {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG2}
  1086.   D3DTEXOPCAPS_MODULATE                         = $00000008;
  1087.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATE}
  1088.   D3DTEXOPCAPS_MODULATE2X                       = $00000010;
  1089.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATE2X}
  1090.   D3DTEXOPCAPS_MODULATE4X                       = $00000020;
  1091.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATE4X}
  1092.   D3DTEXOPCAPS_ADD                              = $00000040;
  1093.   {$EXTERNALSYM D3DTEXOPCAPS_ADD}
  1094.   D3DTEXOPCAPS_ADDSIGNED                        = $00000080;
  1095.   {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED}
  1096.   D3DTEXOPCAPS_ADDSIGNED2X                      = $00000100;
  1097.   {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED2X}
  1098.   D3DTEXOPCAPS_SUBTRACT                         = $00000200;
  1099.   {$EXTERNALSYM D3DTEXOPCAPS_SUBTRACT}
  1100.   D3DTEXOPCAPS_ADDSMOOTH                        = $00000400;
  1101.   {$EXTERNALSYM D3DTEXOPCAPS_ADDSMOOTH}
  1102.   D3DTEXOPCAPS_BLENDDIFFUSEALPHA                = $00000800;
  1103.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDDIFFUSEALPHA}
  1104.   D3DTEXOPCAPS_BLENDTEXTUREALPHA                = $00001000;
  1105.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHA}
  1106.   D3DTEXOPCAPS_BLENDFACTORALPHA                 = $00002000;
  1107.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDFACTORALPHA}
  1108.   D3DTEXOPCAPS_BLENDTEXTUREALPHAPM              = $00004000;
  1109.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHAPM}
  1110.   D3DTEXOPCAPS_BLENDCURRENTALPHA                = $00008000;
  1111.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDCURRENTALPHA}
  1112.   D3DTEXOPCAPS_PREMODULATE                      = $00010000;
  1113.   {$EXTERNALSYM D3DTEXOPCAPS_PREMODULATE}
  1114.   D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR           = $00020000;
  1115.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR}
  1116.   D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA           = $00040000;
  1117.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA}
  1118.   D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR        = $00080000;
  1119.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR}
  1120.   D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA        = $00100000;
  1121.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA}
  1122.   D3DTEXOPCAPS_BUMPENVMAP                       = $00200000;
  1123.   {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAP}
  1124.   D3DTEXOPCAPS_BUMPENVMAPLUMINANCE              = $00400000;
  1125.   {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAPLUMINANCE}
  1126.   D3DTEXOPCAPS_DOTPRODUCT3                      = $00800000;
  1127.   {$EXTERNALSYM D3DTEXOPCAPS_DOTPRODUCT3}
  1128.   D3DTEXOPCAPS_MULTIPLYADD                      = $01000000;
  1129.   {$EXTERNALSYM D3DTEXOPCAPS_MULTIPLYADD}
  1130.   D3DTEXOPCAPS_LERP                             = $02000000;
  1131.   {$EXTERNALSYM D3DTEXOPCAPS_LERP}
  1132.   //
  1133.   // FVFCaps
  1134.   //
  1135.   D3DFVFCAPS_TEXCOORDCOUNTMASK  = $0000ffff; { mask for texture coordinate count field }
  1136.   {$EXTERNALSYM D3DFVFCAPS_TEXCOORDCOUNTMASK}
  1137.   D3DFVFCAPS_DONOTSTRIPELEMENTS = $00080000; { Device prefers that vertex elements not be stripped }
  1138.   {$EXTERNALSYM D3DFVFCAPS_DONOTSTRIPELEMENTS}
  1139.   D3DFVFCAPS_PSIZE              = $00100000; { Device can receive point size }
  1140.   {$EXTERNALSYM D3DFVFCAPS_PSIZE}
  1141.   //
  1142.   // VertexProcessingCaps
  1143.   //
  1144.   D3DVTXPCAPS_TEXGEN            = $00000001; { device can do texgen }
  1145.   {$EXTERNALSYM D3DVTXPCAPS_TEXGEN}
  1146.   D3DVTXPCAPS_MATERIALSOURCE7   = $00000002; { device can do DX7-level colormaterialsource ops }
  1147.   {$EXTERNALSYM D3DVTXPCAPS_MATERIALSOURCE7}
  1148.   D3DVTXPCAPS_DIRECTIONALLIGHTS = $00000008; { device can do directional lights }
  1149.   {$EXTERNALSYM D3DVTXPCAPS_DIRECTIONALLIGHTS}
  1150.   D3DVTXPCAPS_POSITIONALLIGHTS  = $00000010; { device can do positional lights (includes point and spot) }
  1151.   {$EXTERNALSYM D3DVTXPCAPS_POSITIONALLIGHTS}
  1152.   D3DVTXPCAPS_LOCALVIEWER       = $00000020; { device can do local viewer }
  1153.   {$EXTERNALSYM D3DVTXPCAPS_LOCALVIEWER}
  1154.   D3DVTXPCAPS_TWEENING          = $00000040; { device can do vertex tweening }
  1155.   {$EXTERNALSYM D3DVTXPCAPS_TWEENING}
  1156.   D3DVTXPCAPS_NO_VSDT_UBYTE4    = $00000080; { device does not support D3DVSDT_UBYTE4 }
  1157.   {$EXTERNALSYM D3DVTXPCAPS_NO_VSDT_UBYTE4}
  1158. (*==========================================================================;
  1159.  *
  1160.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  1161.  *
  1162.  *  File:   d3d8.h
  1163.  *  Content:    Direct3D include file
  1164.  *
  1165.  ****************************************************************************)
  1166. (* This identifier is passed to Direct3DCreate8 in order to ensure that an
  1167.  * application was built against the correct header files. This number is
  1168.  * incremented whenever a header (or other) change would require applications
  1169.  * to be rebuilt. If the version doesn't match, Direct3DCreate8 will fail.
  1170.  * (The number itself has no meaning.)*)
  1171. const
  1172.   D3D_SDK_VERSION = DWord(220);
  1173.   {$EXTERNALSYM D3D_SDK_VERSION}
  1174. type
  1175.   HMONITOR = THandle;
  1176.   {$EXTERNALSYM HMONITOR}
  1177. (*
  1178.  * Direct3D interfaces
  1179.  *)
  1180.   // forward interfaces declaration
  1181.   IDirect3D8 = interface;
  1182.   IDirect3DDevice8 = interface;
  1183.   IDirect3DResource8 = interface;
  1184.   IDirect3DBaseTexture8 = interface;
  1185.   IDirect3DTexture8 = interface;
  1186.   IDirect3DVolumeTexture8 = interface;
  1187.   IDirect3DCubeTexture8 = interface;
  1188.   IDirect3DVertexBuffer8 = interface;
  1189.   IDirect3DIndexBuffer8 = interface;
  1190.   IDirect3DSurface8 = interface;
  1191.   IDirect3DVolume8 = interface;
  1192.   IDirect3DSwapChain8 = interface;
  1193.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D8);'}
  1194.   {$EXTERNALSYM IDirect3D8}
  1195.   IDirect3D8 = interface(IUnknown)
  1196.     ['{1DD9E8DA-1C77-4d40-B0CF-98FEFDFF9512}']
  1197.     (*** IDirect3D8 methods ***)
  1198.     function RegisterSoftwareDevice(pInitializeFunction: Pointer): HResult; stdcall;
  1199.     function GetAdapterCount: LongWord; stdcall;
  1200.     function GetAdapterIdentifier(Adapter: LongWord; Flags: DWord; out pIdentifier: TD3DAdapterIdentifier8): HResult; stdcall;
  1201.     function GetAdapterModeCount (Adapter: LongWord): LongWord; stdcall;
  1202.     function EnumAdapterModes(Adapter, Mode: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall;
  1203.     function GetAdapterDisplayMode(Adapter: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall;
  1204.     function CheckDeviceType(Adapter: LongWord; CheckType: TD3DDevType; DisplayFormat, BackBufferFormat: TD3DFormat; Windowed: BOOL): HResult; stdcall;
  1205.     function CheckDeviceFormat(Adapter: LongWord; DeviceType: TD3DDevType; AdapterFormat: TD3DFormat; Usage: DWord; RType: TD3DResourceType; CheckFormat: TD3DFormat): HResult; stdcall;
  1206.     function CheckDeviceMultiSampleType(Adapter: LongWord; DeviceType: TD3DDevType; SurfaceFormat: TD3DFormat; Windowed: BOOL; MultiSampleType: TD3DMultiSampleType): HResult; stdcall;
  1207.     function CheckDepthStencilMatch(Adapter: LongWord; DeviceType: TD3DDevType; AdapterFormat, RenderTargetFormat, DepthStencilFormat: TD3DFormat): HResult; stdcall;
  1208.     function GetDeviceCaps(Adapter: LongWord; DeviceType: TD3DDevType; out pCaps: TD3DCaps8): HResult; stdcall;
  1209.     function GetAdapterMonitor(Adapter: LongWord): HMONITOR; stdcall;
  1210.     function CreateDevice(Adapter: LongWord; DeviceType: TD3DDevType; hFocusWindow: HWND; BehaviorFlags: DWord; var pPresentationParameters: TD3DPresentParameters; out ppReturnedDeviceInterface: IDirect3DDevice8): HResult; stdcall;
  1211.   end;
  1212.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice8);'}
  1213.   {$EXTERNALSYM IDirect3DDevice8}
  1214.   IDirect3DDevice8 = interface(IUnknown)
  1215.     ['{7385E5DF-8FE8-41D5-86B6-D7B48547B6CF}']
  1216.      (*** IDirect3DDevice8 methods ***)
  1217.     function TestCooperativeLevel: HResult; stdcall;
  1218.     function GetAvailableTextureMem: LongWord; stdcall;
  1219.     function ResourceManagerDiscardBytes(Bytes: DWord): HResult; stdcall;
  1220.     function GetDirect3D(out ppD3D8: IDirect3D8): HResult; stdcall;
  1221.     function GetDeviceCaps(out pCaps: TD3DCaps8): HResult; stdcall;
  1222.     function GetDisplayMode(out pMode: TD3DDisplayMode): HResult; stdcall;
  1223.     function GetCreationParameters(out pParameters: TD3DDeviceCreationParameters): HResult; stdcall;
  1224.     function SetCursorProperties(XHotSpot, YHotSpot: LongWord; pCursorBitmap: IDirect3DSurface8): HResult; stdcall;
  1225.     procedure SetCursorPosition(XScreenSpace, YScreenSpace: Integer; Flags: DWord); stdcall;
  1226.     function ShowCursor(bShow: BOOL): BOOL; stdcall;
  1227.     function CreateAdditionalSwapChain(const pPresentationParameters: TD3DPresentParameters; out pSwapChain: IDirect3DSwapChain8): HResult; stdcall;
  1228.     function Reset(const pPresentationParameters: TD3DPresentParameters): HResult; stdcall;
  1229.     function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall;
  1230.     function GetBackBuffer(BackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface8): HResult; stdcall;
  1231.     function GetRasterStatus(out pRasterStatus: TD3DRasterStatus): HResult; stdcall;
  1232.     procedure SetGammaRamp(Flags: DWord; const pRamp: TD3DGammaRamp); stdcall;
  1233.     procedure GetGammaRamp(out pRamp: TD3DGammaRamp); stdcall;
  1234.     function CreateTexture(Width, Height, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppTexture: IDirect3DTexture8): HResult; stdcall;
  1235.     function CreateVolumeTexture(Width, Height, Depth, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppVolumeTexture: IDirect3DVolumeTexture8): HResult; stdcall;
  1236.     function CreateCubeTexture(EdgeLength, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppCubeTexture: IDirect3DCubeTexture8): HResult; stdcall;
  1237.     function CreateVertexBuffer(Length: LongWord; Usage, FVF: DWord; Pool: TD3DPool; out ppVertexBuffer: IDirect3DVertexBuffer8): HResult; stdcall;
  1238.     function CreateIndexBuffer(Length: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppIndexBuffer: IDirect3DIndexBuffer8): HResult; stdcall;
  1239.     function CreateRenderTarget(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; Lockable: BOOL; out ppSurface: IDirect3DSurface8): HResult; stdcall;
  1240.     function CreateDepthStencilSurface(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; out ppSurface: IDirect3DSurface8): HResult; stdcall;
  1241.     function CreateImageSurface(Width, Height: LongWord; Format: TD3DFormat; out ppSurface: IDirect3DSurface8): HResult; stdcall;
  1242.     function CopyRects(pSourceSurface: IDirect3DSurface8; pSourceRectsArray: PRect; cRects: LongWord; out pDestinationSurface: IDirect3DSurface8; pDestPointsArray: PPoint): HResult; stdcall;
  1243.     function UpdateTexture(pSourceTexture, pDestinationTexture: IDirect3DBaseTexture8): HResult; stdcall;
  1244.     function GetFrontBuffer(pDestSurface: IDirect3DSurface8): HResult; stdcall;
  1245.     function SetRenderTarget(pRenderTarget, pNewZStencil: IDirect3DSurface8): HResult; stdcall;
  1246.     function GetRenderTarget(out ppRenderTarget: IDirect3DSurface8): HResult; stdcall;
  1247.     function GetDepthStencilSurface(out ppZStencilSurface: IDirect3DSurface8): HResult; stdcall;
  1248.     function BeginScene: HResult; stdcall;
  1249.     function EndScene: HResult; stdcall;
  1250.     function Clear(Count: DWord; pRects: PD3DRect; Flags: DWord; Color: TD3DColor; Z: Single; Stencil: DWord): HResult; stdcall;
  1251.     function SetTransform(State: TD3DTransformStateType; const pMatrix: TD3DMatrix): HResult; stdcall;
  1252.     function GetTransform(State: TD3DTransformStateType; out pMatrix: TD3DMatrix): HResult; stdcall;
  1253.     function MultiplyTransform(State: TD3DTransformStateType; const pMatrix: TD3DMatrix): HResult; stdcall;
  1254.     function SetViewport(const pViewport: TD3DViewport8): HResult; stdcall;
  1255.     function GetViewport(out pViewport: TD3DViewport8): HResult; stdcall;
  1256.     function SetMaterial(const pMaterial: TD3DMaterial8): HResult; stdcall;
  1257.     function GetMaterial(out pMaterial: TD3DMaterial8): HResult; stdcall;
  1258.     function SetLight(Index: DWord; const pLight: TD3DLight8): HResult; stdcall;
  1259.     function GetLight(Index: DWord; out pLight: TD3DLight8): HResult; stdcall;
  1260.     function LightEnable(Index: DWord; Enable: BOOL): HResult; stdcall;
  1261.     function GetLightEnable(Index: DWord; out pEnable: BOOL): HResult; stdcall;
  1262.     function SetClipPlane(Index: DWord; pPlane: PSingle): HResult; stdcall;
  1263.     function GetClipPlane(Index: DWord; pPlane: PSingle): HResult; stdcall;
  1264.     function SetRenderState(State: TD3DRenderStateType; Value: DWord): HResult; stdcall;
  1265.     function GetRenderState(State: TD3DRenderStateType; out pValue: DWord): HResult; stdcall;
  1266.     function BeginStateBlock: HResult; stdcall;
  1267.     function EndStateBlock(out pToken: DWord): HResult; stdcall;
  1268.     function ApplyStateBlock(Token: DWord): HResult; stdcall;
  1269.     function CaptureStateBlock(Token: DWord): HResult; stdcall;
  1270.     function DeleteStateBlock(Token: DWord): HResult; stdcall;
  1271.     function CreateStateBlock(_Type: TD3DStateBlockType; out Token: DWord): HResult; stdcall;
  1272.     function SetClipStatus(const pClipStatus: TD3DClipStatus8): HResult; stdcall;
  1273.     function GetClipStatus(out pClipStatus: TD3DClipStatus8): HResult; stdcall;
  1274.     function GetTexture(Stage: DWord; out ppTexture: IDirect3DBaseTexture8): HResult; stdcall;
  1275.     function SetTexture(Stage: DWord; pTexture: IDirect3DBaseTexture8): HResult; stdcall;
  1276.     function GetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; out pValue: DWord): HResult; stdcall;
  1277.     function SetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; Value: DWord): HResult; stdcall;
  1278.     function ValidateDevice(out pNumPasses: DWord): HResult; stdcall;
  1279.     function GetInfo(DevInfoID: DWord; out pDevInfoStruct; DevInfoStructSize: DWord): HResult; stdcall;
  1280.     function SetPaletteEntries(PaletteNumber: LongWord; pEntries: pPaletteEntry): HResult; stdcall;
  1281.     function GetPaletteEntries(PaletteNumber: LongWord; pEntries: pPaletteEntry): HResult; stdcall;
  1282.     function SetCurrentTexturePalette(PaletteNumber: LongWord): HResult; stdcall;
  1283.     function GetCurrentTexturePalette(out PaletteNumber: LongWord): HResult; stdcall;
  1284.     function DrawPrimitive(PrimitiveType: TD3DPrimitiveType; StartVertex, PrimitiveCount: LongWord): HResult; stdcall;
  1285.     function DrawIndexedPrimitive(_Type: TD3DPrimitiveType; minIndex, NumVertices, startIndex, primCount: LongWord): HResult; stdcall;
  1286.     function DrawPrimitiveUP(PrimitiveType: TD3DPrimitiveType; PrimitiveCount: LongWord; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall;
  1287.     function DrawIndexedPrimitiveUP(PrimitiveType: TD3DPrimitiveType; MinVertexIndex, NumVertexIndices, PrimitiveCount: LongWord; const pIndexData; IndexDataFormat: TD3DFormat; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall;
  1288.     function ProcessVertices(SrcStartIndex, DestIndex, VertexCount: LongWord; pDestBuffer: IDirect3DVertexBuffer8; Flags: DWord): HResult; stdcall;
  1289.     function CreateVertexShader(pDeclaration, pFunction: PDWord; out pHandle: DWord; Usage: DWord): HResult; stdcall;
  1290.     function SetVertexShader(Handle: DWord): HResult; stdcall;
  1291.     function GetVertexShader(out pHandle: DWord): HResult; stdcall;
  1292.     function DeleteVertexShader(Handle: DWord): HResult; stdcall;
  1293.     function SetVertexShaderConstant(_Register: DWord; const pConstantData; ConstantCount: DWord): HResult; stdcall;
  1294.     function GetVertexShaderConstant(_Register: DWord; out pConstantData; ConstantCount: DWord): HResult; stdcall;
  1295.     function GetVertexShaderDeclaration(Handle: DWord; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall;
  1296.     function GetVertexShaderFunction(Handle: DWord; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall;
  1297.     function SetStreamSource(StreamNumber: LongWord; pStreamData: IDirect3DVertexBuffer8; Stride: LongWord): HResult; stdcall;
  1298.     function GetStreamSource(StreamNumber: LongWord; out ppStreamData: IDirect3DVertexBuffer8; out pStride: LongWord): HResult; stdcall;
  1299.     function SetIndices(pIndexData: IDirect3DIndexBuffer8; BaseVertexIndex: LongWord): HResult; stdcall;
  1300.     function GetIndices(out ppIndexData: IDirect3DIndexBuffer8; out pBaseVertexIndex: LongWord): HResult; stdcall;
  1301.     function CreatePixelShader(pFunction: PDWord; out pHandle: DWord): HResult; stdcall;
  1302.     function SetPixelShader(Handle: DWord): HResult; stdcall;
  1303.     function GetPixelShader(out Handle: DWord): HResult; stdcall;
  1304.     function DeletePixelShader(Handle: DWord): HResult; stdcall;
  1305.     function SetPixelShaderConstant(_Register: DWord; const pConstantData; ConstantCount: DWord): HResult; stdcall;
  1306.     function GetPixelShaderConstant(_Register: DWord; out pConstantData; ConstantCount: DWord): HResult; stdcall;
  1307.     function GetPixelShaderFunction(Handle: DWord; pData: Pointer; var pSizeOfData: DWord): HResult; stdcall;
  1308.     function DrawRectPatch(Handle: LongWord; pNumSegs: PSingle; pTriPatchInfo: PD3DRectPatchInfo): HResult; stdcall;
  1309.     function DrawTriPatch(Handle: LongWord; pNumSegs: PSingle; pTriPatchInfo: PD3DTriPatchInfo): HResult; stdcall;
  1310.     function DeletePatch(Handle: LongWord): HResult; stdcall;
  1311.   end;
  1312.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSwapChain8);'}
  1313.   {$EXTERNALSYM IDirect3DSwapChain8}
  1314.   IDirect3DSwapChain8 = interface(IUnknown)
  1315.     ['{928C088B-76B9-4C6B-A536-A590853876CD}']
  1316.     (*** IDirect3DSwapChain8 methods ***)
  1317.     function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall;
  1318.     function GetBackBuffer(BackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface8): HResult; stdcall;
  1319.   end;
  1320.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DResource8);'}
  1321.   {$EXTERNALSYM IDirect3DResource8}
  1322.   IDirect3DResource8 = interface(IUnknown)
  1323.     ['{1B36BB7B-09B7-410a-B445-7D1430D7B33F}']
  1324.     (*** IDirect3DResource8 methods ***)
  1325.     function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall;
  1326.     function SetPrivateData(const refguid: TGUID; const pData; SizeOfData, Flags: DWord): HResult; stdcall;
  1327.     function GetPrivateData(const refguid: TGUID; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall;
  1328.     function FreePrivateData(const refguid: TGUID): HResult; stdcall;
  1329.     function SetPriority(PriorityNew: DWord): DWord; stdcall;
  1330.     function GetPriority: DWord; stdcall;
  1331.     procedure PreLoad; stdcall;
  1332.     function GetType: TD3DResourceType; stdcall;
  1333.   end;
  1334.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DBaseTexture8);'}
  1335.   {$EXTERNALSYM IDirect3DBaseTexture8}
  1336.   IDirect3DBaseTexture8 = interface(IDirect3DResource8)
  1337.     ['{B4211CFA-51B9-4a9f-AB78-DB99B2BB678E}']
  1338.     (*** IDirect3DBaseTexture8 methods ***)
  1339.     function SetLOD(LODNew: DWord): DWord; stdcall;
  1340.     function GetLOD: DWord; stdcall;
  1341.     function GetLevelCount: DWord; stdcall;
  1342.   end;
  1343.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DTexture8);'}
  1344.   {$EXTERNALSYM IDirect3DTexture8}
  1345.   IDirect3DTexture8 = interface(IDirect3DBaseTexture8)
  1346.     ['{E4CDD575-2866-4f01-B12E-7EECE1EC9358}']
  1347.     (*** IDirect3DTexture8 methods ***)
  1348.     function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall;
  1349.     function GetSurfaceLevel(Level: LongWord; out ppSurfaceLevel: IDirect3DSurface8): HResult; stdcall;
  1350.     function LockRect(Level: LongWord; out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall;
  1351.     function UnlockRect(Level: LongWord): HResult; stdcall;
  1352.     function AddDirtyRect(pDirtyRect: PRect): HResult; stdcall;
  1353.   end;
  1354.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolumeTexture8);'}
  1355.   {$EXTERNALSYM IDirect3DVolumeTexture8}
  1356.   IDirect3DVolumeTexture8 = interface(IDirect3DBaseTexture8)
  1357.     ['{E4CDD575-2866-4f01-B12E-7EECE1EC9358}']
  1358.     (*** IDirect3DVolumeTexture8 methods ***)
  1359.     function GetLevelDesc(Level: LongWord; out pDesc: TD3DVolumeDesc): HResult; stdcall;
  1360.     function GetVolumeLevel(Level: LongWord; out ppVolumeLevel: IDirect3DVolume8): HResult; stdcall;
  1361.     function LockBox(Level: LongWord; out pLockedVolume: TD3DLockedBox; pBox: PD3DBox; Flags: DWord): HResult; stdcall;
  1362.     function UnlockBox(Level: LongWord): HResult; stdcall;
  1363.     function AddDirtyBox(pDirtyBox: PD3DBox): HResult; stdcall;
  1364.   end;
  1365.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DCubeTexture8);'}
  1366.   {$EXTERNALSYM IDirect3DCubeTexture8}
  1367.   IDirect3DCubeTexture8 = interface(IDirect3DBaseTexture8)
  1368.     ['{3EE5B968-2ACA-4c34-8BB5-7E0C3D19B750}']
  1369.     (*** IDirect3DCubeTexture8 methods ***)
  1370.     function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall;
  1371.     function GetCubeMapSurface(FaceType: TD3DCubeMapFaces; Level: LongWord; out ppCubeMapSurface: IDirect3DSurface8): HResult; stdcall;
  1372.     function LockRect(FaceType: TD3DCubeMapFaces; Level: LongWord; out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall;
  1373.     function UnlockRect(FaceType: TD3DCubeMapFaces; Level: LongWord): HResult; stdcall;
  1374.     function AddDirtyRect(FaceType: TD3DCubeMapFaces; pDirtyRect: PRect): HResult; stdcall;
  1375.   end;
  1376.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexBuffer8);'}
  1377.   {$EXTERNALSYM IDirect3DVertexBuffer8}
  1378.   IDirect3DVertexBuffer8 = interface(IDirect3DResource8)
  1379.     ['{8AEEEAC7-05F9-44d4-B591-000B0DF1CB95}']
  1380.     (*** IDirect3DVertexBuffer8 methods ***)
  1381.     function Lock(OffsetToLock, SizeToLock: LongWord; out ppbData: PByte; Flags: DWord): HResult; stdcall;
  1382.     function Unlock: HResult; stdcall;
  1383.     function GetDesc(out pDesc: TD3DVertexBufferDesc): HResult; stdcall;
  1384.   end;
  1385.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DIndexBuffer8);'}
  1386.   {$EXTERNALSYM IDirect3DIndexBuffer8}
  1387.   IDirect3DIndexBuffer8 = interface(IDirect3DResource8)
  1388.     ['{0E689C9A-053D-44a0-9D92-DB0E3D750F86}']
  1389.     (*** IDirect3DIndexBuffer8 methods ***)
  1390.     function Lock(OffsetToLock, SizeToLock: DWord; out ppbData: PByte; Flags: DWord): HResult; stdcall;
  1391.     function Unlock: HResult; stdcall;
  1392.     function GetDesc(out pDesc: TD3DIndexBufferDesc): HResult; stdcall;
  1393.   end;
  1394.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSurface8);'}
  1395.   {$EXTERNALSYM IDirect3DSurface8}
  1396.   IDirect3DSurface8 = interface(IUnknown)
  1397.     ['{B96EEBCA-B326-4ea5-882F-2FF5BAE021DD}']
  1398.     (*** IDirect3DSurface8 methods ***)
  1399.     function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall;
  1400.     function SetPrivateData(const refguid: TGUID; const pData; SizeOfData, Flags: DWord): HResult; stdcall;
  1401.     function GetPrivateData(const refguid: TGUID; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall;
  1402.     function FreePrivateData(const refguid: TGUID): HResult; stdcall;
  1403.     function GetContainer(const riid: TGUID; out ppContainer: Pointer): HResult; stdcall;
  1404.     function GetDesc(out pDesc: TD3DSurfaceDesc): HResult; stdcall;
  1405.     function LockRect(out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall;
  1406.     function UnlockRect: HResult; stdcall;
  1407.   end;
  1408.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolume8);'}
  1409.   {$EXTERNALSYM IDirect3DVolume8}
  1410.   IDirect3DVolume8 = interface(IUnknown)
  1411.     ['{BD7349F5-14F1-42e4-9C79-972380DB40C0}']
  1412.     (*** IDirect3DVolume8 methods ***)
  1413.     function GetDevice(out ppDevice: IDirect3DDevice8): HResult; stdcall;
  1414.     function SetPrivateData(const refguid: TGUID; const pData; SizeOfData, Flags: DWord): HResult; stdcall;
  1415.     function GetPrivateData(const refguid: TGUID; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall;
  1416.     function FreePrivateData(const refguid: TGUID): HResult; stdcall;
  1417.     function GetContainer(const riid: TGUID; var ppContainer: Pointer): HResult; stdcall;
  1418.     function GetDesc(out pDesc: TD3DVolumeDesc): HResult; stdcall;
  1419.     function LockBox(out pLockedVolume: TD3DLockedBox; pBox: PD3DBox; Flags: DWord): HResult; stdcall;
  1420.     function UnlockBox: HResult; stdcall;
  1421.   end;
  1422. (*
  1423.  * Interface IID's
  1424.  *)
  1425. type
  1426.   IID_IDirect3D8              = IDirect3D8;
  1427.   {$EXTERNALSYM IID_IDirect3D8}
  1428.   IID_IDirect3DDevice8        = IDirect3DDevice8;
  1429.   {$EXTERNALSYM IID_IDirect3DDevice8}
  1430.   IID_IDirect3DResource8      = IDirect3DResource8;
  1431.   {$EXTERNALSYM IID_IDirect3DResource8}
  1432.   IID_IDirect3DBaseTexture8   = IDirect3DBaseTexture8;
  1433.   {$EXTERNALSYM IID_IDirect3DBaseTexture8}
  1434.   IID_IDirect3DTexture8       = IDirect3DTexture8;
  1435.   {$EXTERNALSYM IID_IDirect3DTexture8}
  1436.   IID_IDirect3DCubeTexture8   = IDirect3DCubeTexture8;
  1437.   {$EXTERNALSYM IID_IDirect3DCubeTexture8}
  1438.   IID_IDirect3DVolumeTexture8 = IDirect3DVolumeTexture8;
  1439.   {$EXTERNALSYM IID_IDirect3DVolumeTexture8}
  1440.   IID_IDirect3DVertexBuffer8  = IDirect3DVertexBuffer8;
  1441.   {$EXTERNALSYM IID_IDirect3DVertexBuffer8}
  1442.   IID_IDirect3DIndexBuffer8   = IDirect3DIndexBuffer8;
  1443.   {$EXTERNALSYM IID_IDirect3DIndexBuffer8}
  1444.   IID_IDirect3DSurface8       = IDirect3DSurface8;
  1445.   {$EXTERNALSYM IID_IDirect3DSurface8}
  1446.   IID_IDirect3DVolume8        = IDirect3DVolume8;
  1447.   {$EXTERNALSYM IID_IDirect3DVolume8}
  1448.   IID_IDirect3DSwapChain8     = IDirect3DSwapChain8;
  1449.   {$EXTERNALSYM IID_IDirect3DSwapChain8}
  1450. const
  1451. {****************************************************************************
  1452.  * Flags for SetPrivateData method on all D3D8 interfaces
  1453.  *
  1454.  * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData
  1455.  * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this
  1456.  * pointer and Release when the private data is destroyed. The data will be
  1457.  * destroyed when another SetPrivateData with the same GUID is set, when
  1458.  * FreePrivateData is called, or when the D3D8 object is freed.
  1459.  ****************************************************************************}
  1460.   D3DSPD_IUNKNOWN                         = $00000001;
  1461.   {$EXTERNALSYM D3DSPD_IUNKNOWN}
  1462. (****************************************************************************
  1463.  *
  1464.  * Parameter for IDirect3D8 Enum and GetCaps8 functions to get the info for
  1465.  * the current mode only.
  1466.  *
  1467.  ****************************************************************************)
  1468.   D3DCURRENT_DISPLAY_MODE                 = $00EFFFFF;
  1469.   {$EXTERNALSYM D3DCURRENT_DISPLAY_MODE}
  1470. (****************************************************************************
  1471.  *
  1472.  * Flags for IDirect3D8::CreateDevice's BehaviorFlags
  1473.  *
  1474.  ****************************************************************************)
  1475.   D3DCREATE_FPU_PRESERVE                  = $00000002;
  1476.   {$EXTERNALSYM D3DCREATE_FPU_PRESERVE}
  1477.   D3DCREATE_MULTITHREADED                 = $00000004;
  1478.   {$EXTERNALSYM D3DCREATE_MULTITHREADED}
  1479.   D3DCREATE_PUREDEVICE                    = $00000010;
  1480.   {$EXTERNALSYM D3DCREATE_PUREDEVICE}
  1481.   D3DCREATE_SOFTWARE_VERTEXPROCESSING     = $00000020;
  1482.   {$EXTERNALSYM D3DCREATE_SOFTWARE_VERTEXPROCESSING}
  1483.   D3DCREATE_HARDWARE_VERTEXPROCESSING     = $00000040;
  1484.   {$EXTERNALSYM D3DCREATE_HARDWARE_VERTEXPROCESSING}
  1485.   D3DCREATE_MIXED_VERTEXPROCESSING        = $00000080;
  1486.   {$EXTERNALSYM D3DCREATE_MIXED_VERTEXPROCESSING}
  1487.   D3DCREATE_DISABLE_DRIVER_MANAGEMENT     = $00000100;
  1488.   {$EXTERNALSYM D3DCREATE_DISABLE_DRIVER_MANAGEMENT}
  1489. (****************************************************************************
  1490.  *
  1491.  * Parameter for IDirect3D8::CreateDevice's iAdapter
  1492.  *
  1493.  ****************************************************************************)
  1494.   D3DADAPTER_DEFAULT                      = 0;
  1495.   {$EXTERNALSYM D3DADAPTER_DEFAULT}
  1496. (****************************************************************************
  1497.  *
  1498.  * Flags for IDirect3D8::EnumAdapters
  1499.  *
  1500.  ****************************************************************************)
  1501.   D3DENUM_NO_WHQL_LEVEL                   = $00000002;
  1502.   {$EXTERNALSYM D3DENUM_NO_WHQL_LEVEL}
  1503. (****************************************************************************
  1504.  *
  1505.  * Maximum number of back-buffers supported in DX8
  1506.  *
  1507.  ****************************************************************************)
  1508.   D3DPRESENT_BACK_BUFFERS_MAX             = 3;
  1509.   {$EXTERNALSYM D3DPRESENT_BACK_BUFFERS_MAX}
  1510. (****************************************************************************
  1511.  *
  1512.  * Flags for IDirect3DDevice8::SetGammaRamp
  1513.  *
  1514.  ****************************************************************************)
  1515.   D3DSGR_NO_CALIBRATION                  = $00000000;
  1516.   {$EXTERNALSYM D3DSGR_NO_CALIBRATION}
  1517.   D3DSGR_CALIBRATE                       = $00000001;
  1518.   {$EXTERNALSYM D3DSGR_CALIBRATE}
  1519. (****************************************************************************
  1520.  *
  1521.  * Flags for IDirect3DDevice8::SetCursorPosition
  1522.  *
  1523.  ****************************************************************************)
  1524.   D3DCURSOR_IMMEDIATE_UPDATE             = $00000001;
  1525.   {$EXTERNALSYM D3DCURSOR_IMMEDIATE_UPDATE}
  1526. (****************************************************************************
  1527.  *
  1528.  * Flags for DrawPrimitive/DrawIndexedPrimitive
  1529.  *   Also valid for Begin/BeginIndexed
  1530.  *   Also valid for VertexBuffer::CreateVertexBuffer
  1531.  ****************************************************************************)
  1532. (*
  1533.  *  DirectDraw error codes
  1534.  *)
  1535.   _FACD3D = $876;
  1536.   {$EXTERNALSYM _FACD3D}
  1537. //#define MAKE_D3DHRESULT( code )  MAKE_HRESULT( 1, _FACD3D, code )
  1538. function MAKE_D3DHRESULT(Code: DWord): DWord;
  1539. {$EXTERNALSYM MAKE_D3DHRESULT}
  1540. const
  1541.   MAKE_D3DHRESULT_R     = (1 shl 31) or (_FACD3D shl 16);
  1542. (*
  1543.  * Direct3D Errors
  1544.  *)
  1545.   D3D_OK                                  = S_OK;
  1546.   {$EXTERNALSYM D3D_OK}
  1547.   D3DERR_WRONGTEXTUREFORMAT               = HResult(MAKE_D3DHRESULT_R or 2072);
  1548.   {$EXTERNALSYM D3DERR_WRONGTEXTUREFORMAT}
  1549.   D3DERR_UNSUPPORTEDCOLOROPERATION        = HResult(MAKE_D3DHRESULT_R or 2073);
  1550.   {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLOROPERATION}
  1551.   D3DERR_UNSUPPORTEDCOLORARG              = HResult(MAKE_D3DHRESULT_R or 2074);
  1552.   {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLORARG}
  1553.   D3DERR_UNSUPPORTEDALPHAOPERATION        = HResult(MAKE_D3DHRESULT_R or 2075);
  1554.   {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAOPERATION}
  1555.   D3DERR_UNSUPPORTEDALPHAARG              = HResult(MAKE_D3DHRESULT_R or 2076);
  1556.   {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAARG}
  1557.   D3DERR_TOOMANYOPERATIONS                = HResult(MAKE_D3DHRESULT_R or 2077);
  1558.   {$EXTERNALSYM D3DERR_TOOMANYOPERATIONS}
  1559.   D3DERR_CONFLICTINGTEXTUREFILTER         = HResult(MAKE_D3DHRESULT_R or 2078);
  1560.   {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREFILTER}
  1561.   D3DERR_UNSUPPORTEDFACTORVALUE           = HResult(MAKE_D3DHRESULT_R or 2079);
  1562.   {$EXTERNALSYM D3DERR_UNSUPPORTEDFACTORVALUE}
  1563.   D3DERR_CONFLICTINGRENDERSTATE           = HResult(MAKE_D3DHRESULT_R or 2081);
  1564.   {$EXTERNALSYM D3DERR_CONFLICTINGRENDERSTATE}
  1565.   D3DERR_UNSUPPORTEDTEXTUREFILTER         = HResult(MAKE_D3DHRESULT_R or 2082);
  1566.   {$EXTERNALSYM D3DERR_UNSUPPORTEDTEXTUREFILTER}
  1567.   D3DERR_CONFLICTINGTEXTUREPALETTE        = HResult(MAKE_D3DHRESULT_R or 2086);
  1568.   {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREPALETTE}
  1569.   D3DERR_DRIVERINTERNALERROR              = HResult(MAKE_D3DHRESULT_R or 2087);
  1570.   {$EXTERNALSYM D3DERR_DRIVERINTERNALERROR}
  1571.   D3DERR_NOTFOUND                         = HResult(MAKE_D3DHRESULT_R or 2150);
  1572.   {$EXTERNALSYM D3DERR_NOTFOUND}
  1573.   D3DERR_MOREDATA                         = HResult(MAKE_D3DHRESULT_R or 2151);
  1574.   {$EXTERNALSYM D3DERR_MOREDATA}
  1575.   D3DERR_DEVICELOST                       = HResult(MAKE_D3DHRESULT_R or 2152);
  1576.   {$EXTERNALSYM D3DERR_DEVICELOST}
  1577.   D3DERR_DEVICENOTRESET                   = HResult(MAKE_D3DHRESULT_R or 2153);
  1578.   {$EXTERNALSYM D3DERR_DEVICENOTRESET}
  1579.   D3DERR_NOTAVAILABLE                     = HResult(MAKE_D3DHRESULT_R or 2154);
  1580.   {$EXTERNALSYM D3DERR_NOTAVAILABLE}
  1581.   D3DERR_OUTOFVIDEOMEMORY                 = HResult(MAKE_D3DHRESULT_R or 380);
  1582.   {$EXTERNALSYM D3DERR_OUTOFVIDEOMEMORY}
  1583.   D3DERR_INVALIDDEVICE                    = HResult(MAKE_D3DHRESULT_R or 2155);
  1584.   {$EXTERNALSYM D3DERR_INVALIDDEVICE}
  1585.   D3DERR_INVALIDCALL                      = HResult(MAKE_D3DHRESULT_R or 2156);
  1586.   {$EXTERNALSYM D3DERR_INVALIDCALL}
  1587.   D3DERR_DRIVERINVALIDCALL                = HResult(MAKE_D3DHRESULT_R or 2157);
  1588.   {$EXTERNALSYM D3DERR_DRIVERINVALIDCALL}
  1589. (*
  1590.  * DLL Function for creating a Direct3D8 object. This object supports
  1591.  * enumeration and allows the creation of Direct3DDevice8 objects.
  1592.  * Pass the value of the constant D3D_SDK_VERSION to this function, so
  1593.  * that the run-time can validate that your application was compiled
  1594.  * against the right headers.
  1595.  *)
  1596. function Direct3D8Loaded: Boolean;
  1597. function LoadDirect3D8: Boolean;
  1598. function UnLoadDirect3D8: Boolean;
  1599. // Due to the way Object Pascal handles functions resulting in 'native' interface
  1600. // pointer we should declare result not as interface but as usial pointer
  1601. {$IFDEF DIRECT3D8_DYNAMIC_LINK}
  1602. type
  1603.   TDirect3DCreate8 = function (SDKVersion: LongWord): Pointer; stdcall;
  1604. var
  1605.   _Direct3DCreate8: TDirect3DCreate8 = nil;
  1606. {$ELSE}
  1607. function _Direct3DCreate8(SDKVersion: LongWord): Pointer; stdcall;
  1608. {$ENDIF}
  1609. function Direct3DCreate8(SDKVersion: LongWord): IDirect3D8; stdcall;
  1610. {$EXTERNALSYM Direct3DCreate8}
  1611. //********************************************************************
  1612. // Introduced types for compatibility with DirectXGraphics.pas translation
  1613. // by Ampaze (Tim Baumgarten) from http://www.crazyentertainment.net
  1614. type
  1615.   PD3DAdapter_Identifier8               = PD3DAdapterIdentifier8;
  1616.   PD3DDevice_Creation_Parameters        = PD3DDeviceCreationParameters;
  1617.   PD3DIndexBuffer_Desc                  = PD3DIndexBufferDesc;
  1618.   PD3DLocked_Box                        = PD3DLockedBox;
  1619.   PD3DLocked_Rect                       = PD3DLockedRect;
  1620.   PD3DPresent_Parameters                = PD3DPresentParameters;
  1621.   PD3DRaster_Status                     = PD3DRasterStatus;
  1622.   PD3DRectPatch_Info                    = PD3DRectPatchInfo;
  1623.   PD3DSurface_Desc                      = PD3DSurfaceDesc;
  1624.   PD3DTriPatch_Info                     = PD3DTriPatchInfo;
  1625.   PD3DVertexBuffer_Desc                 = PD3DVertexBufferDesc;
  1626.   PD3DVolume_Desc                       = PD3DVolumeDesc;
  1627.   TD3DAdapter_Identifier8               = TD3DAdapterIdentifier8;
  1628.   TD3DBackBuffer_Type                   = TD3DBackBufferType;
  1629.   TD3DCubeMap_Faces                     = TD3DCubeMapFaces;
  1630.   TD3DDevice_Creation_Parameters        = TD3DDeviceCreationParameters;
  1631.   TD3DIndexBuffer_Desc                  = TD3DIndexBufferDesc;
  1632.   TD3DLocked_Box                        = TD3DLockedBox;
  1633.   TD3DLocked_Rect                       = TD3DLockedRect;
  1634.   TD3DMultiSample_Type                  = TD3DMultiSampleType;
  1635.   TD3DPresent_Parameters                = TD3DPresentParameters;
  1636.   TD3DRaster_Status                     = TD3DRasterStatus;
  1637.   TD3DRectPatch_Info                    = TD3DRectPatchInfo;
  1638.   TD3DShader_Instruction_Opcode_Type    = TD3DShaderInstructionOpcodeType;
  1639.   TD3DShader_Param_DSTMod_Type          = TD3DShaderParamDSTModType;
  1640.   TD3DShader_Param_Register_Type        = TD3DShaderParamRegisterType;
  1641.   TD3DShader_Param_SRCMod_Type          = TD3DShaderParamSRCModType;
  1642.   TD3DSurface_Desc                      = TD3DSurfaceDesc;
  1643.   TD3DTriPatch_Info                     = TD3DTriPatchInfo;
  1644.   TD3DVertexBuffer_Desc                 = TD3DVertexBufferDesc;
  1645.   TD3DVolume_Desc                       = TD3DVolumeDesc;
  1646.   TD3DVSD_TokenType                     = TD3DVSDTokenType;
  1647.   TD3DVS_AddressMode_Type               = TD3DVSAddressModeType;
  1648.   TD3DVS_RastOut_Offsets                = TD3DVSRastOutOffsets;
  1649.   TD3DDevInfo_ResourceManager           = TD3DDevInfoResourceManager;
  1650.   TD3DDevInfo_D3DVertexStats            = TD3DDevInfoD3DVertexStats;
  1651.   PD3DDevInfo_ResourceManager           = PD3DDevInfoResourceManager;
  1652.   PD3DDevInfo_D3DVertexStats            = PD3DDevInfoD3DVertexStats;
  1653. implementation
  1654. (*==========================================================================;
  1655.  *  File:       d3d8types.h
  1656.  *  Content:    Direct3D capabilities include file
  1657.  ***************************************************************************)
  1658. // #define D3DCOLOR_ARGB(a,r,g,b) 
  1659. //     ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
  1660. function D3DCOLOR_ARGB(a,r,g,b: DWord): TD3DColor;
  1661. begin
  1662.   Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
  1663. end;
  1664. // #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
  1665. function D3DCOLOR_RGBA(r,g,b,a: DWord): TD3DColor;
  1666. begin
  1667.   Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
  1668. end;
  1669. // #define D3DCOLOR_XRGB(r,g,b)   D3DCOLOR_ARGB(0xff,r,g,b)
  1670. function D3DCOLOR_XRGB(r,g,b: DWord): TD3DColor;
  1671. begin
  1672.   Result := DWORD($FF shl 24) or (r shl 16) or (g shl 8) or b;
  1673. end;
  1674. // #define D3DCOLOR_COLORVALUE(r,g,b,a) 
  1675. //     D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
  1676. function D3DCOLOR_COLORVALUE(r,g,b,a: Single): TD3DColor;
  1677. begin
  1678.   Result :=
  1679.     (round(a * 255) shl 24) or
  1680.     (round(r * 255) shl 16) or
  1681.     (round(g * 255) shl 8) or
  1682.     (round(b * 255));
  1683. end;
  1684. // #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
  1685. function D3DTS_WORLDMATRIX(index: Byte): TD3DTransformStateType;
  1686. begin
  1687.   Result:= TD3DTransformStateType(index + 256);
  1688. end;
  1689. // D3DVSD_MAKETOKENTYPE(tokenType) ((tokenType << D3DVSD_TOKENTYPESHIFT) & D3DVSD_TOKENTYPEMASK)
  1690. function D3DVSD_MAKETOKENTYPE(tokenType: TD3DVSDTokenType): DWord;
  1691. begin
  1692.   Result:= ((DWord(tokenType) shl D3DVSD_TOKENTYPESHIFT) and D3DVSD_TOKENTYPEMASK);
  1693. end;
  1694. //#define D3DVSD_STREAM( _StreamNumber ) 
  1695. //    (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) | (_StreamNumber))
  1696. function D3DVSD_STREAM(_StreamNumber: DWord): DWord;
  1697. begin
  1698.   Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) or _StreamNumber;
  1699. end;
  1700. //#define D3DVSD_REG( _VertexRegister, _Type ) 
  1701. //    (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) |            
  1702. //     ((_Type) << D3DVSD_DATATYPESHIFT) | (_VertexRegister))
  1703. function D3DVSD_REG( _VertexRegister, _Type: DWord): DWord;
  1704. begin
  1705.   Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) or ((_Type shl D3DVSD_DATATYPESHIFT) or _VertexRegister);
  1706. end;
  1707. //#define D3DVSD_SKIP( _DWORDCount ) 
  1708. //    (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) | 0x10000000 | 
  1709. //     ((_DWORDCount) << D3DVSD_SKIPCOUNTSHIFT))
  1710. function D3DVSD_SKIP(_DWORDCount: DWord): DWord;
  1711. begin
  1712.   Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) or $10000000 or (_DWORDCount shl D3DVSD_SKIPCOUNTSHIFT);
  1713. end;
  1714. //#define D3DVSD_CONST( _ConstantAddress, _Count ) 
  1715. //    (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) | 
  1716. //     ((_Count) << D3DVSD_CONSTCOUNTSHIFT) | (_ConstantAddress))
  1717. function D3DVSD_CONST(_ConstantAddress, _Count: DWord): DWord;
  1718. begin
  1719.   Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) or (_Count shl D3DVSD_CONSTCOUNTSHIFT) or _ConstantAddress;
  1720. end;
  1721. //#define D3DVSD_TESSNORMAL( _VertexRegisterIn, _VertexRegisterOut ) 
  1722. //    (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 
  1723. //     ((_VertexRegisterIn) << D3DVSD_VERTEXREGINSHIFT) | 
  1724. //     ((0x02) << D3DVSD_DATATYPESHIFT) | (_VertexRegisterOut))
  1725. function D3DVSD_TESSNORMAL(_VertexRegisterIn, _VertexRegisterOut: DWord): DWord;
  1726. begin
  1727.   Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) or
  1728.            (_VertexRegisterIn shl D3DVSD_VERTEXREGINSHIFT) or
  1729.            ($02 shl D3DVSD_DATATYPESHIFT) or _VertexRegisterOut;
  1730. end;
  1731. //#define D3DVSD_TESSUV( _VertexRegister ) 
  1732. //    (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) | 0x10000000 | 
  1733. //     ((0x01) << D3DVSD_DATATYPESHIFT) | (_VertexRegister))
  1734. function D3DVSD_TESSUV(_VertexRegister: DWord): DWord;
  1735. begin
  1736.   Result:= D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) or $10000000 or
  1737.            ($01 shl D3DVSD_DATATYPESHIFT) or _VertexRegister;
  1738. end;
  1739. //#define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor))
  1740. function D3DPS_VERSION(_Major, _Minor : Cardinal) : Cardinal;
  1741. begin
  1742.   Result:= $FFFF0000 or (_Major shl 8 ) or _Minor;
  1743. end;
  1744. //#define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor))
  1745. function D3DVS_VERSION(_Major, _Minor : Cardinal) : Cardinal;
  1746. begin
  1747.   Result:= $FFFE0000 or (_Major shl 8 ) or _Minor;
  1748. end;
  1749. //#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF)
  1750. function D3DSHADER_VERSION_MAJOR(_Version : Cardinal) : Cardinal;
  1751. begin
  1752.   Result:= (_Version shr 8 ) and $FF;
  1753. end;
  1754. //#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF)
  1755. function D3DSHADER_VERSION_MINOR(_Version : Cardinal) : Cardinal;
  1756. begin
  1757.   Result:= (_Version shr 0) and $FF;
  1758. end;
  1759. //#define D3DSHADER_COMMENT(_DWordSize) 
  1760. //    ((((_DWordSize)<<D3DSI_COMMENTSIZE_SHIFT)&D3DSI_COMMENTSIZE_MASK)|D3DSIO_COMMENT)
  1761. function D3DSHADER_COMMENT(_DWordSize: DWord) : DWord;
  1762. begin
  1763.   Result:= ((_DWordSize shl D3DSI_COMMENTSIZE_SHIFT) and D3DSI_COMMENTSIZE_MASK) or D3DSIO_COMMENT;
  1764. end;
  1765. //#define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
  1766. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWord): DWord;
  1767. begin
  1768.   Result:= D3DFVF_TEXTUREFORMAT3 shl (CoordIndex * 2 + 16)
  1769. end;
  1770. //#define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
  1771. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWord): DWord;
  1772. begin
  1773.   Result:= D3DFVF_TEXTUREFORMAT2;
  1774. end;
  1775. //#define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
  1776. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWord): DWord;
  1777. begin
  1778.   Result:= D3DFVF_TEXTUREFORMAT4 shl (CoordIndex * 2 + 16)
  1779. end;
  1780. //#define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
  1781. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWord): DWord;
  1782. begin
  1783.   Result:= D3DFVF_TEXTUREFORMAT1 shl (CoordIndex * 2 + 16)
  1784. end;
  1785. //#ifndef MAKEFOURCC
  1786. //    #define MAKEFOURCC(ch0, ch1, ch2, ch3)                              
  1787. //                ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) |       
  1788. //                ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
  1789. //#endif /* defined(MAKEFOURCC) */
  1790. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWord;
  1791. begin
  1792.   Result:= Byte(ch0) or (Byte(ch1) shl 8) or (Byte(ch2) shl 16) or (Byte(ch3) shl 24 );
  1793. end;
  1794. (*==========================================================================;
  1795.  *  File:   d3d8.h
  1796.  *  Content:    Direct3D include file
  1797.  ****************************************************************************)
  1798. //#define MAKE_D3DHRESULT( code )  MAKE_HRESULT( 1, _FACD3D, code )
  1799. function MAKE_D3DHRESULT(Code: DWord): DWord;
  1800. begin
  1801.   Result:= DWord((1 shl 31) or (_FACD3D shl 16)) or Code;
  1802. end;
  1803. const
  1804.   Direct3D8dll = 'd3d8.dll';
  1805. {$IFDEF DIRECT3D8_DYNAMIC_LINK}
  1806. var
  1807.   Direct3D8Lib: THandle = 0;
  1808. function Direct3D8Loaded: Boolean;
  1809. begin
  1810.   Result:= Direct3D8Lib <> 0;
  1811. end;
  1812. function UnLoadDirect3D8: Boolean;
  1813. begin
  1814.   Result:= True;
  1815.   if Direct3D8Loaded then
  1816.   begin
  1817.     Result:= FreeLibrary(Direct3D8Lib);
  1818.     _Direct3DCreate8:= nil;
  1819.     Direct3D8Lib:= 0;
  1820.   end;
  1821. end;
  1822. function LoadDirect3D8: Boolean;
  1823. const
  1824.   ProcName = 'Direct3DCreate8';
  1825. begin
  1826.   Result:= Direct3D8Loaded;
  1827.   if (not Result) then
  1828.   begin
  1829.     Direct3D8Lib:= LoadLibrary(Direct3D8dll);
  1830.     if Direct3D8Loaded then
  1831.     begin
  1832.       _Direct3DCreate8:= GetProcAddress(Direct3D8Lib, ProcName);
  1833.       Result:= Assigned(_Direct3DCreate8);
  1834.       if not Result then UnLoadDirect3D8;
  1835.     end;
  1836.   end;
  1837. end;
  1838. {$ELSE}
  1839. function Direct3D8Loaded: Boolean;
  1840. begin // Stub function for static linking
  1841.   Result:= True;
  1842. end;
  1843. function UnLoadDirect3D8: Boolean;
  1844. begin // Stub function for static linking
  1845.   Result:= True; // should emulate "normal" behaviour
  1846. end;
  1847. function LoadDirect3D8: Boolean;
  1848. begin // Stub function for static linking
  1849.   Result:= True;
  1850. end;
  1851. function _Direct3DCreate8(SDKVersion: LongWord): Pointer; external Direct3D8dll name 'Direct3DCreate8';
  1852. {$ENDIF}
  1853. function Direct3DCreate8(SDKVersion: LongWord): IDirect3D8;
  1854. begin
  1855. {$IFDEF DIRECT3D8_DYNAMIC_LINK}
  1856. {$IFDEF DIRECT3D8_DYNAMIC_LINK_EXPLICIT}
  1857.   LoadDirect3D8;
  1858. {$ENDIF}
  1859. {$ENDIF}
  1860.   Result:= IDirect3D8(_Direct3DCreate8(SDKVersion));
  1861.   if Assigned(Result) then Result._Release; // Delphi autoincrement reference count
  1862. end;
  1863. {$IFDEF DIRECT3D8_DYNAMIC_LINK}
  1864. initialization
  1865. {$IFNDEF DIRECT3D8_DYNAMIC_LINK_EXPLICIT}
  1866.   LoadDirect3D8;
  1867. {$ENDIF}
  1868. finalization
  1869.   UnLoadDirect3D8;
  1870. {$ENDIF}
  1871. end.