Direct3D9.pas
上传用户:ctlcnc
上传日期:2021-12-10
资源大小:4933k
文件大小:234k
源码类别:

2D图形编程

开发平台:

Delphi

  1.     D3DFMT_FORCE_DWORD          = $7fffffff
  2.   );
  3. {$ENDIF}
  4.   {$EXTERNALSYM _D3DFORMAT}
  5.   D3DFORMAT = _D3DFORMAT;
  6.   {$EXTERNALSYM D3DFORMAT}
  7.   PD3DFormat = ^TD3DFormat;
  8.   TD3DFormat = _D3DFORMAT;
  9.   { Display Modes }
  10.   PD3DDisplayMode = ^TD3DDisplayMode;
  11.   _D3DDISPLAYMODE = packed record
  12.     Width: LongWord;
  13.     Height: LongWord;
  14.     RefreshRate: LongWord;
  15.     Format: TD3DFormat;
  16.   end {_D3DDISPLAYMODE};
  17.   {$EXTERNALSYM _D3DDISPLAYMODE}
  18.   D3DDISPLAYMODE = _D3DDISPLAYMODE;
  19.   {$EXTERNALSYM D3DDISPLAYMODE}
  20.   TD3DDisplayMode = _D3DDISPLAYMODE;
  21.   { Creation Parameters }
  22.   PD3DDeviceCreationParameters = ^TD3DDeviceCreationParameters;
  23.   _D3DDEVICE_CREATION_PARAMETERS = packed record
  24.     AdapterOrdinal: LongWord;
  25.     DeviceType: TD3DDevType;
  26.     hFocusWindow: HWND;
  27.     BehaviorFlags: LongInt;
  28.   end {_D3DDEVICE_CREATION_PARAMETERS};
  29.   {$EXTERNALSYM _D3DDEVICE_CREATION_PARAMETERS}
  30.   D3DDEVICE_CREATION_PARAMETERS = _D3DDEVICE_CREATION_PARAMETERS;
  31.   {$EXTERNALSYM D3DDEVICE_CREATION_PARAMETERS}
  32.   TD3DDeviceCreationParameters = _D3DDEVICE_CREATION_PARAMETERS;
  33.   { SwapEffects }
  34.   _D3DSWAPEFFECT = (
  35.   {$IFNDEF SUPPORTS_EXPL_ENUMS}
  36.     D3DSWAPEFFECT_INVALID_0     {= 0},
  37.     D3DSWAPEFFECT_DISCARD       {= 1},
  38.     D3DSWAPEFFECT_FLIP          {= 2},
  39.     D3DSWAPEFFECT_COPY          {= 3}
  40.   {$ELSE}
  41.     D3DSWAPEFFECT_DISCARD       = 1,
  42.     D3DSWAPEFFECT_FLIP          = 2,
  43.     D3DSWAPEFFECT_COPY          = 3
  44.   {$ENDIF}
  45.   );
  46.   {$EXTERNALSYM _D3DSWAPEFFECT}
  47.   D3DSWAPEFFECT = _D3DSWAPEFFECT;
  48.   {$EXTERNALSYM D3DSWAPEFFECT}
  49.   TD3DSwapEffect = _D3DSWAPEFFECT;
  50.   { Pool types }
  51.   _D3DPOOL = (
  52.     D3DPOOL_DEFAULT     {= 0},
  53.     D3DPOOL_MANAGED     {= 1},
  54.     D3DPOOL_SYSTEMMEM   {= 2},
  55.     D3DPOOL_SCRATCH     {= 3}
  56.   );
  57.   {$EXTERNALSYM _D3DPOOL}
  58.   D3DPOOL = _D3DPOOL;
  59.   {$EXTERNALSYM D3DPOOL}
  60.   TD3DPool = _D3DPOOL;
  61. const
  62.   { RefreshRate pre-defines }
  63.   D3DPRESENT_RATE_DEFAULT         = $00000000;
  64.   {$EXTERNALSYM D3DPRESENT_RATE_DEFAULT}
  65. type
  66.   { Resize Optional Parameters }
  67.   PD3DPresentParameters = ^TD3DPresentParameters;
  68.   _D3DPRESENT_PARAMETERS_ = packed record
  69.     BackBufferWidth:                    LongWord;
  70.     BackBufferHeight:                   LongWord;
  71.     BackBufferFormat:                   TD3DFormat;
  72.     BackBufferCount:                    LongWord;
  73.     MultiSampleType:                    TD3DMultiSampleType;
  74.     MultiSampleQuality:                 DWORD;
  75.     SwapEffect:                         TD3DSwapEffect;
  76.     hDeviceWindow:                      HWND;
  77.     Windowed:                           Bool;
  78.     EnableAutoDepthStencil:             Bool;
  79.     AutoDepthStencilFormat:             TD3DFormat;
  80.     Flags: LongInt;
  81.     { FullScreen_RefreshRateInHz must be zero for Windowed mode }
  82.     FullScreen_RefreshRateInHz:         LongWord;
  83.     PresentationInterval:               LongWord;
  84.   end {_D3DPRESENT_PARAMETERS_};
  85.   {$EXTERNALSYM _D3DPRESENT_PARAMETERS_}
  86.   D3DPRESENT_PARAMETERS = _D3DPRESENT_PARAMETERS_;
  87.   {$EXTERNALSYM D3DPRESENT_PARAMETERS}
  88.   TD3DPresentParameters = _D3DPRESENT_PARAMETERS_;
  89.   // Values for D3DPRESENT_PARAMETERS.Flags
  90. const
  91.   D3DPRESENTFLAG_LOCKABLE_BACKBUFFER  = $00000001;
  92.   {$EXTERNALSYM D3DPRESENTFLAG_LOCKABLE_BACKBUFFER}
  93.   D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL = $00000002;
  94.   {$EXTERNALSYM D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL}
  95.   D3DPRESENTFLAG_DEVICECLIP           = $00000004;
  96.   {$EXTERNALSYM D3DPRESENTFLAG_DEVICECLIP}
  97.   D3DPRESENTFLAG_VIDEO                = $00000010;
  98.   {$EXTERNALSYM D3DPRESENTFLAG_VIDEO}
  99. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  100.   D3DPRESENTFLAG_NOAUTOROTATE         = $00000020;
  101.   {$EXTERNALSYM D3DPRESENTFLAG_NOAUTOROTATE}
  102.   D3DPRESENTFLAG_UNPRUNEDMODE         = $00000040;
  103.   {$EXTERNALSYM D3DPRESENTFLAG_UNPRUNEDMODE}
  104. {$ENDIF}
  105.   { Gamma Ramp: Same as DX7 }
  106. type
  107.   PD3DGammaRamp = ^TD3DGammaRamp;
  108.   _D3DGAMMARAMP = packed record
  109.     red   : array [0..255] of Word;
  110.     green : array [0..255] of Word;
  111.     blue  : array [0..255] of Word;
  112.   end;
  113.   {$EXTERNALSYM _D3DGAMMARAMP}
  114.   D3DGAMMARAMP = _D3DGAMMARAMP;
  115.   {$EXTERNALSYM D3DGAMMARAMP}
  116.   TD3DGammaRamp = _D3DGAMMARAMP;
  117.   { Back buffer types }
  118.   _D3DBACKBUFFER_TYPE = (
  119.     D3DBACKBUFFER_TYPE_MONO         {= 0},
  120.     D3DBACKBUFFER_TYPE_LEFT         {= 1},
  121.     D3DBACKBUFFER_TYPE_RIGHT        {= 2}
  122.   );
  123.   {$EXTERNALSYM _D3DBACKBUFFER_TYPE}
  124.   D3DBACKBUFFER_TYPE = _D3DBACKBUFFER_TYPE;
  125.   {$EXTERNALSYM D3DBACKBUFFER_TYPE}
  126.   TD3DBackbufferType = _D3DBACKBUFFER_TYPE;
  127.   { Types }
  128.   _D3DRESOURCETYPE = (
  129.   {$IFNDEF SUPPORTS_EXPL_ENUMS}
  130.     D3DRTYPE_INVALID_0              {=  0},
  131.     D3DRTYPE_SURFACE                {=  1},
  132.     D3DRTYPE_VOLUME                 {=  2},
  133.     D3DRTYPE_TEXTURE                {=  3},
  134.     D3DRTYPE_VOLUMETEXTURE          {=  4},
  135.     D3DRTYPE_CUBETEXTURE            {=  5},
  136.     D3DRTYPE_VERTEXBUFFER           {=  6},
  137.     D3DRTYPE_INDEXBUFFER            {=  7}  //if this changes, change _D3DDEVINFO_RESOURCEMANAGER definition
  138.   {$ELSE}
  139.     D3DRTYPE_SURFACE                =  1,
  140.     D3DRTYPE_VOLUME                 =  2,
  141.     D3DRTYPE_TEXTURE                =  3,
  142.     D3DRTYPE_VOLUMETEXTURE          =  4,
  143.     D3DRTYPE_CUBETEXTURE            =  5,
  144.     D3DRTYPE_VERTEXBUFFER           =  6,
  145.     D3DRTYPE_INDEXBUFFER            =  7   //if this changes, change _D3DDEVINFO_RESOURCEMANAGER definition
  146.   {$ENDIF}
  147.   );
  148.   {$EXTERNALSYM _D3DRESOURCETYPE}
  149.   D3DRESOURCETYPE = _D3DRESOURCETYPE;
  150.   {$EXTERNALSYM D3DRESOURCETYPE}
  151.   TD3DResourceType = _D3DRESOURCETYPE;
  152. const
  153.   { Usages }
  154.   D3DUSAGE_RENDERTARGET       = $00000001;
  155.   {$EXTERNALSYM D3DUSAGE_RENDERTARGET}
  156.   D3DUSAGE_DEPTHSTENCIL       = $00000002;
  157.   {$EXTERNALSYM D3DUSAGE_DEPTHSTENCIL}
  158.   D3DUSAGE_DYNAMIC            = $00000200;
  159.   {$EXTERNALSYM D3DUSAGE_DYNAMIC}
  160. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  161.   D3DUSAGE_NONSECURE          = $00800000;
  162.   {$EXTERNALSYM D3DUSAGE_NONSECURE}
  163. {$ENDIF}
  164.   // When passed to CheckDeviceFormat, D3DUSAGE_AUTOGENMIPMAP may return
  165.   // D3DOK_NOAUTOGEN if the device doesn't support autogeneration for that format.
  166.   // D3DOK_NOAUTOGEN is a success code, not a failure code... the SUCCEEDED and FAILED macros
  167.   // will return true and false respectively for this code.
  168.   D3DUSAGE_AUTOGENMIPMAP      = $00000400;
  169.   {$EXTERNALSYM D3DUSAGE_AUTOGENMIPMAP}
  170.   D3DUSAGE_DMAP               = $00004000;
  171.   {$EXTERNALSYM D3DUSAGE_DMAP}
  172.   // The following usages are valid only for querying CheckDeviceFormat
  173.   D3DUSAGE_QUERY_LEGACYBUMPMAP            = $00008000;
  174.   {$EXTERNALSYM D3DUSAGE_QUERY_LEGACYBUMPMAP}
  175.   D3DUSAGE_QUERY_SRGBREAD                 = $00010000;
  176.   {$EXTERNALSYM D3DUSAGE_QUERY_SRGBREAD}
  177.   D3DUSAGE_QUERY_FILTER                   = $00020000;
  178.   {$EXTERNALSYM D3DUSAGE_QUERY_FILTER}
  179.   D3DUSAGE_QUERY_SRGBWRITE                = $00040000;
  180.   {$EXTERNALSYM D3DUSAGE_QUERY_SRGBWRITE}
  181.   D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING = $00080000;
  182.   {$EXTERNALSYM D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING}
  183.   D3DUSAGE_QUERY_VERTEXTEXTURE            = $00100000;
  184.   {$EXTERNALSYM D3DUSAGE_QUERY_VERTEXTEXTURE}
  185.   D3DUSAGE_QUERY_WRAPANDMIP               = $00200000;
  186.   {$EXTERNALSYM D3DUSAGE_QUERY_WRAPANDMIP}
  187.   { Usages for Vertex/Index buffers }
  188.   D3DUSAGE_WRITEONLY          = $00000008;
  189.   {$EXTERNALSYM D3DUSAGE_WRITEONLY}
  190.   D3DUSAGE_SOFTWAREPROCESSING = $00000010;
  191.   {$EXTERNALSYM D3DUSAGE_SOFTWAREPROCESSING}
  192.   D3DUSAGE_DONOTCLIP          = $00000020;
  193.   {$EXTERNALSYM D3DUSAGE_DONOTCLIP}
  194.   D3DUSAGE_POINTS             = $00000040;
  195.   {$EXTERNALSYM D3DUSAGE_POINTS}
  196.   D3DUSAGE_RTPATCHES          = $00000080;
  197.   {$EXTERNALSYM D3DUSAGE_RTPATCHES}
  198.   D3DUSAGE_NPATCHES           = $00000100;
  199.   {$EXTERNALSYM D3DUSAGE_NPATCHES}
  200. type
  201.   { CubeMap Face identifiers }
  202.   _D3DCUBEMAP_FACES = (
  203.     D3DCUBEMAP_FACE_POSITIVE_X     {= 0},
  204.     D3DCUBEMAP_FACE_NEGATIVE_X     {= 1},
  205.     D3DCUBEMAP_FACE_POSITIVE_Y     {= 2},
  206.     D3DCUBEMAP_FACE_NEGATIVE_Y     {= 3},
  207.     D3DCUBEMAP_FACE_POSITIVE_Z     {= 4},
  208.     D3DCUBEMAP_FACE_NEGATIVE_Z     {= 5}
  209.   );
  210.   {$EXTERNALSYM _D3DCUBEMAP_FACES}
  211.   D3DCUBEMAP_FACES = _D3DCUBEMAP_FACES;
  212.   {$EXTERNALSYM D3DCUBEMAP_FACES}
  213.   TD3DCubemapFaces = _D3DCUBEMAP_FACES;
  214. const
  215.   { Lock flags }
  216.   D3DLOCK_READONLY         = $00000010;
  217.   {$EXTERNALSYM D3DLOCK_READONLY}
  218.   D3DLOCK_DISCARD          = $00002000;
  219.   {$EXTERNALSYM D3DLOCK_DISCARD}
  220.   D3DLOCK_NOOVERWRITE      = $00001000;
  221.   {$EXTERNALSYM D3DLOCK_NOOVERWRITE}
  222.   D3DLOCK_NOSYSLOCK        = $00000800;
  223.   {$EXTERNALSYM D3DLOCK_NOSYSLOCK}
  224.   D3DLOCK_DONOTWAIT        = $00004000;
  225.   {$EXTERNALSYM D3DLOCK_DONOTWAIT}
  226.   D3DLOCK_NO_DIRTY_UPDATE  = $00008000;
  227.   {$EXTERNALSYM D3DLOCK_NO_DIRTY_UPDATE}
  228. type
  229.   { Vertex Buffer Description }
  230.   PD3DVertexBufferDesc = ^TD3DVertexBufferDesc;
  231.   _D3DVERTEXBUFFER_DESC = packed record
  232.     Format : TD3DFormat;
  233.     _Type  : TD3DResourceType;
  234.     Usage  : DWord;
  235.     Pool   : TD3DPool;
  236.     Size   : LongWord;
  237.     FVF    : DWord;
  238.   end;
  239.   {$EXTERNALSYM _D3DVERTEXBUFFER_DESC}
  240.   D3DVERTEXBUFFER_DESC = _D3DVERTEXBUFFER_DESC;
  241.   {$EXTERNALSYM D3DVERTEXBUFFER_DESC}
  242.   TD3DVertexBufferDesc = _D3DVERTEXBUFFER_DESC;
  243.   { Index Buffer Description }
  244.   PD3DIndexBufferDesc = ^TD3DIndexBufferDesc;
  245.   _D3DINDEXBUFFER_DESC = packed record
  246.     Format : TD3DFormat;
  247.     _Type  : TD3DResourceType;
  248.     Usage  : DWord;
  249.     Pool   : TD3DPool;
  250.     Size   : LongWord;
  251.   end {_D3DINDEXBUFFER_DESC};
  252.   {$EXTERNALSYM _D3DINDEXBUFFER_DESC}
  253.   D3DINDEXBUFFER_DESC = _D3DINDEXBUFFER_DESC;
  254.   {$EXTERNALSYM D3DINDEXBUFFER_DESC}
  255.   TD3DIndexBufferDesc = _D3DINDEXBUFFER_DESC;
  256.  { Surface Description }
  257.   PD3DSurfaceDesc = ^TD3DSurfaceDesc;
  258.   _D3DSURFACE_DESC = packed record
  259.     Format : TD3DFormat;
  260.     _Type  : TD3DResourceType;
  261.     Usage  : DWord;
  262.     Pool   : TD3DPool;
  263.     MultiSampleType: TD3DMultiSampleType;
  264.     MultiSampleQuality: DWORD;
  265.     Width  : LongWord;
  266.     Height : LongWord;
  267.   end {_D3DSURFACE_DESC};
  268.   {$EXTERNALSYM _D3DSURFACE_DESC}
  269.   D3DSURFACE_DESC = _D3DSURFACE_DESC;
  270.   {$EXTERNALSYM D3DSURFACE_DESC}
  271.   TD3DSurfaceDesc = _D3DSURFACE_DESC;
  272.   PD3DVolumeDesc = ^TD3DVolumeDesc;
  273.   _D3DVOLUME_DESC = packed record
  274.     Format : TD3DFormat;
  275.     _Type  : TD3DResourceType;
  276.     Usage  : DWord;
  277.     Pool   : TD3DPool;
  278.     Width  : LongWord;
  279.     Height : LongWord;
  280.     Depth  : LongWord;
  281.   end {_D3DVOLUME_DESC};
  282.   {$EXTERNALSYM _D3DVOLUME_DESC}
  283.   D3DVOLUME_DESC = _D3DVOLUME_DESC;
  284.   {$EXTERNALSYM D3DVOLUME_DESC}
  285.   TD3DVolumeDesc = _D3DVOLUME_DESC;
  286.   { Structure for LockRect }
  287.   PD3DLockedRect = ^TD3DLockedRect;
  288.   _D3DLOCKED_RECT = packed record
  289.     Pitch: Integer;
  290.     pBits: Pointer; // void*
  291.   end {_D3DLOCKED_RECT};
  292.   {$EXTERNALSYM _D3DLOCKED_RECT}
  293.   D3DLOCKED_RECT = _D3DLOCKED_RECT;
  294.   {$EXTERNALSYM D3DLOCKED_RECT}
  295.   TD3DLockedRect = _D3DLOCKED_RECT;
  296.   { Structures for LockBox }
  297.   PD3DBox = ^TD3DBox;
  298.   _D3DBOX = packed record
  299.     Left        : LongWord;
  300.     Top         : LongWord;
  301.     Right       : LongWord;
  302.     Bottom      : LongWord;
  303.     Front       : LongWord;
  304.     Back        : LongWord;
  305.   end {_D3DBOX};
  306.   {$EXTERNALSYM _D3DBOX}
  307.   D3DBOX = _D3DBOX;
  308.   {$EXTERNALSYM D3DBOX}
  309.   TD3DBox = _D3DBOX;
  310.   PD3DLockedBox = ^TD3DLockedBox;
  311.   _D3DLOCKED_BOX = packed record
  312.     RowPitch    : Integer;
  313.     SlicePitch  : Integer;
  314.     pBits       : Pointer; // void*
  315.   end {_D3DLOCKED_BOX};
  316.   {$EXTERNALSYM _D3DLOCKED_BOX}
  317.   D3DLOCKED_BOX = _D3DLOCKED_BOX;
  318.   {$EXTERNALSYM D3DLOCKED_BOX}
  319.   TD3DLockedBox = _D3DLOCKED_BOX;
  320.   { Structures for LockRange }
  321.   PD3DRange = ^TD3DRange;
  322.   _D3DRANGE = packed record
  323.     Offset      : LongWord;
  324.     Size        : LongWord;
  325.   end {_D3DRANGE};
  326.   {$EXTERNALSYM _D3DRANGE}
  327.   D3DRANGE = _D3DRANGE;
  328.   {$EXTERNALSYM D3DRANGE}
  329.   TD3DRange = _D3DRANGE;
  330.   { Structures for high order primitives }
  331.   PD3DRectPatchInfo = ^TD3DRectPatchInfo;
  332.   _D3DRECTPATCH_INFO = packed record
  333.     StartVertexOffsetWidth  : LongWord;
  334.     StartVertexOffsetHeight : LongWord;
  335.     Width                   : LongWord;
  336.     Height                  : LongWord;
  337.     Stride                  : LongWord;
  338.     Basis                   : TD3DBasisType;
  339.     Degree                  : TD3DDegreeType;
  340.   end;
  341.   {$EXTERNALSYM _D3DRECTPATCH_INFO}
  342.   D3DRECTPATCH_INFO = _D3DRECTPATCH_INFO;
  343.   {$EXTERNALSYM D3DRECTPATCH_INFO}
  344.   TD3DRectPatchInfo = _D3DRECTPATCH_INFO;
  345.   PD3DTriPatchInfo = ^TD3DTriPatchInfo;
  346.   _D3DTRIPATCH_INFO = packed record
  347.     StartVertexOffset : LongWord;
  348.     NumVertices       : LongWord;
  349.     Basis             : TD3DBasisType;
  350.     Degree            : TD3DDegreeType;
  351.   end;
  352.   {$EXTERNALSYM _D3DTRIPATCH_INFO}
  353.   D3DTRIPATCH_INFO = _D3DTRIPATCH_INFO;
  354.   {$EXTERNALSYM D3DTRIPATCH_INFO}
  355.   TD3DTriPatchInfo = _D3DTRIPATCH_INFO;
  356. const
  357.   { Adapter Identifier }
  358.   MAX_DEVICE_IDENTIFIER_STRING  = 512;
  359.   {$EXTERNALSYM MAX_DEVICE_IDENTIFIER_STRING}
  360. type
  361.   PD3DAdapterIdentifier9 = ^TD3DAdapterIdentifier9;
  362.   _D3DADAPTER_IDENTIFIER9 = packed record
  363.     Driver      : array [0..MAX_DEVICE_IDENTIFIER_STRING-1] of Char;
  364.     Description : array [0..MAX_DEVICE_IDENTIFIER_STRING-1] of Char;
  365.     DeviceName  : array [0..31] of Char;   { Device name for GDI (ex. \.DISPLAY1) }
  366. {$IFDEF WIN32}
  367.     DriverVersion               : Int64;   { Defined for 32 bit components }
  368. {$ELSE}
  369.     DriverVersionLowPart        : DWord;   { Defined for 16 bit driver components }
  370.     DriverVersionHighPart       : DWord;
  371. {$ENDIF}
  372.     VendorId    : DWord;
  373.     DeviceId    : DWord;
  374.     SubSysId    : DWord;
  375.     Revision    : DWord;
  376.     DeviceIdentifier : TGUID;
  377.     WHQLLevel   : DWord;
  378.   end;
  379.   {$EXTERNALSYM _D3DADAPTER_IDENTIFIER9}
  380.   D3DADAPTER_IDENTIFIER9 = _D3DADAPTER_IDENTIFIER9;
  381.   {$EXTERNALSYM D3DADAPTER_IDENTIFIER9}
  382.   TD3DAdapterIdentifier9 = _D3DADAPTER_IDENTIFIER9;
  383.   { Raster Status structure returned by GetRasterStatus }
  384.   PD3DRasterStatus = ^TD3DRasterStatus;
  385.   _D3DRASTER_STATUS = packed record
  386.     InVBlank : Bool;
  387.     ScanLine : LongWord;
  388.   end;
  389.   {$EXTERNALSYM _D3DRASTER_STATUS}
  390.   D3DRASTER_STATUS = _D3DRASTER_STATUS;
  391.   {$EXTERNALSYM D3DRASTER_STATUS}
  392.   TD3DRasterStatus = _D3DRASTER_STATUS;
  393. { Debug monitor tokens (DEBUG only)
  394.    Note that if D3DRS_DEBUGMONITORTOKEN is set, the call is treated as
  395.    passing a token to the debug monitor.  For example, if, after passing
  396.    D3DDMT_ENABLE/DISABLE to D3DRS_DEBUGMONITORTOKEN other token values
  397.    are passed in, the enabled/disabled state of the debug
  398.    monitor will still persist.
  399.    The debug monitor defaults to enabled.
  400.    Calling GetRenderState on D3DRS_DEBUGMONITORTOKEN is not of any use.
  401. }
  402.   _D3DDEBUGMONITORTOKENS = DWord;
  403.   {$EXTERNALSYM _D3DDEBUGMONITORTOKENS}
  404.   D3DDEBUGMONITORTOKENS = _D3DDEBUGMONITORTOKENS;
  405.   {$EXTERNALSYM D3DDEBUGMONITORTOKENS}
  406.   TD3DDebugMonitorTokens = _D3DDEBUGMONITORTOKENS;
  407. const
  408.   D3DDMT_ENABLE            = 0;    // enable debug monitor
  409.   {$EXTERNALSYM D3DDMT_ENABLE}
  410.   D3DDMT_DISABLE           = 1;    // disable debug monitor
  411.   {$EXTERNALSYM D3DDMT_DISABLE}
  412. {$IFNDEF SUPPORTS_EXPL_ENUMS}
  413. const
  414.   // Async feedback
  415.   D3DQUERYTYPE_VCACHE                 = 4; { D3DISSUE_END }
  416.   {$EXTERNALSYM D3DQUERYTYPE_VCACHE}
  417.   D3DQUERYTYPE_RESOURCEMANAGER        = 5; { D3DISSUE_END }
  418.   {$EXTERNALSYM D3DQUERYTYPE_RESOURCEMANAGER}
  419.   D3DQUERYTYPE_VERTEXSTATS            = 6; { D3DISSUE_END }
  420.   {$EXTERNALSYM D3DQUERYTYPE_VERTEXSTATS}
  421.   D3DQUERYTYPE_EVENT                  = 8; { D3DISSUE_END }
  422.   {$EXTERNALSYM D3DQUERYTYPE_EVENT}
  423.   D3DQUERYTYPE_OCCLUSION              = 9; { D3DISSUE_BEGIN, D3DISSUE_END }
  424.   {$EXTERNALSYM D3DQUERYTYPE_OCCLUSION}
  425.   D3DQUERYTYPE_TIMESTAMP              = 10; { D3DISSUE_END }
  426.   {$EXTERNALSYM D3DQUERYTYPE_TIMESTAMP}
  427.   D3DQUERYTYPE_TIMESTAMPDISJOINT      = 11; { D3DISSUE_BEGIN, D3DISSUE_END }
  428.   {$EXTERNALSYM D3DQUERYTYPE_TIMESTAMPDISJOINT}
  429.   D3DQUERYTYPE_TIMESTAMPFREQ          = 12; { D3DISSUE_END }
  430.   {$EXTERNALSYM D3DQUERYTYPE_TIMESTAMPFREQ}
  431.   D3DQUERYTYPE_PIPELINETIMINGS        = 13; { D3DISSUE_BEGIN, D3DISSUE_END }
  432.   {$EXTERNALSYM D3DQUERYTYPE_PIPELINETIMINGS}
  433.   D3DQUERYTYPE_INTERFACETIMINGS       = 14; { D3DISSUE_BEGIN, D3DISSUE_END }
  434.   {$EXTERNALSYM D3DQUERYTYPE_INTERFACETIMINGS}
  435.   D3DQUERYTYPE_VERTEXTIMINGS          = 15; { D3DISSUE_BEGIN, D3DISSUE_END }
  436.   {$EXTERNALSYM D3DQUERYTYPE_VERTEXTIMINGS}
  437.   D3DQUERYTYPE_PIXELTIMINGS           = 16; { D3DISSUE_BEGIN, D3DISSUE_END }
  438.   {$EXTERNALSYM D3DQUERYTYPE_PIXELTIMINGS}
  439.   D3DQUERYTYPE_BANDWIDTHTIMINGS       = 17; { D3DISSUE_BEGIN, D3DISSUE_END }
  440.   {$EXTERNALSYM D3DQUERYTYPE_BANDWIDTHTIMINGS}
  441.   D3DQUERYTYPE_CACHEUTILIZATION       = 18; { D3DISSUE_BEGIN, D3DISSUE_END }
  442.   {$EXTERNALSYM D3DQUERYTYPE_CACHEUTILIZATION}
  443. type
  444.   _D3DQUERYTYPE = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord;
  445. {$ELSE}
  446. type
  447.   // Async feedback
  448.   {$MINENUMSIZE 1} // Forces TD3DQueryType be 1 byte enum
  449.   _D3DQUERYTYPE = (
  450.     D3DQUERYTYPE_VCACHE                 = 4, { D3DISSUE_END }
  451.     D3DQUERYTYPE_RESOURCEMANAGER        = 5, { D3DISSUE_END }
  452.     D3DQUERYTYPE_VERTEXSTATS            = 6, { D3DISSUE_END }
  453.     D3DQUERYTYPE_EVENT                  = 8, { D3DISSUE_END }
  454.     D3DQUERYTYPE_OCCLUSION              = 9,  { D3DISSUE_BEGIN, D3DISSUE_END }
  455.     D3DQUERYTYPE_TIMESTAMP              = 10, { D3DISSUE_END }
  456.     D3DQUERYTYPE_TIMESTAMPDISJOINT      = 11, { D3DISSUE_BEGIN, D3DISSUE_END }
  457.     D3DQUERYTYPE_TIMESTAMPFREQ          = 12, { D3DISSUE_END }
  458.     D3DQUERYTYPE_PIPELINETIMINGS        = 13, { D3DISSUE_BEGIN, D3DISSUE_END }
  459.     D3DQUERYTYPE_INTERFACETIMINGS       = 14, { D3DISSUE_BEGIN, D3DISSUE_END }
  460.     D3DQUERYTYPE_VERTEXTIMINGS          = 15, { D3DISSUE_BEGIN, D3DISSUE_END }
  461.     D3DQUERYTYPE_PIXELTIMINGS           = 16, { D3DISSUE_BEGIN, D3DISSUE_END }
  462.     D3DQUERYTYPE_BANDWIDTHTIMINGS       = 17, { D3DISSUE_BEGIN, D3DISSUE_END }
  463.     D3DQUERYTYPE_CACHEUTILIZATION       = 18  { D3DISSUE_BEGIN, D3DISSUE_END }
  464.   );
  465.   {$MINENUMSIZE 4} // Restores enums to be 4 byte in size
  466. {$ENDIF}
  467.   {$EXTERNALSYM _D3DQUERYTYPE}
  468.   D3DQUERYTYPE = _D3DQUERYTYPE;
  469.   {$EXTERNALSYM D3DQUERYTYPE}
  470.   TD3DQueryType = _D3DQUERYTYPE;
  471. const
  472.   // Flags field for Issue
  473.   D3DISSUE_END     = (1 shl 0); // Tells the runtime to issue the end of a query, changing it's state to "non-signaled".
  474.   {$EXTERNALSYM D3DISSUE_END}
  475.   D3DISSUE_BEGIN   = (1 shl 1); // Tells the runtime to issue the beginng of a query.
  476.   {$EXTERNALSYM D3DISSUE_BEGIN}
  477.   // Flags field for GetData
  478.   D3DGETDATA_FLUSH = (1 shl 0); // Tells the runtime to flush if the query is outstanding.
  479.   {$EXTERNALSYM D3DGETDATA_FLUSH}
  480. type
  481.   PD3DResourceStats = ^TD3DResourceStats;
  482.   _D3DRESOURCESTATS = packed record
  483.   // Data collected since last Present()
  484.     bThrashing                  : BOOL;  (* indicates if thrashing *)
  485.     ApproxBytesDownloaded       : DWORD; (* Approximate number of bytes downloaded by resource manager *)
  486.     NumEvicts                   : DWORD; (* number of objects evicted *)
  487.     NumVidCreates               : DWORD; (* number of objects created in video memory *)
  488.     LastPri                     : DWORD; (* priority of last object evicted *)
  489.     NumUsed                     : DWORD; (* number of objects set to the device *)
  490.     NumUsedInVidMem             : DWORD; (* number of objects set to the device, which are already in video memory *)
  491.   // Persistent data
  492.     WorkingSet                  : DWORD; (* number of objects in video memory *)
  493.     WorkingSetBytes             : DWORD; (* number of bytes in video memory *)
  494.     TotalManaged                : DWORD; (* total number of managed objects *)
  495.     TotalBytes                  : DWORD; (* total number of bytes of managed objects *)
  496.   end;
  497.   {$EXTERNALSYM _D3DRESOURCESTATS}
  498.   D3DRESOURCESTATS = _D3DRESOURCESTATS;
  499.   {$EXTERNALSYM D3DRESOURCESTATS}
  500.   TD3DResourceStats = _D3DRESOURCESTATS;
  501. const
  502.   D3DRTYPECOUNT = (DWORD(D3DRTYPE_INDEXBUFFER) + 1);
  503.   {$EXTERNALSYM D3DRTYPECOUNT}
  504. type
  505.   PD3DDevInfoResourceManager = ^TD3DDevInfoResourceManager;
  506.   _D3DDEVINFO_RESOURCEMANAGER = packed record
  507. //#ifndef WOW64_ENUM_WORKAROUND
  508.     stats: array [0..D3DRTYPECOUNT-1] of TD3DResourceStats;
  509. //#else
  510. //  stats: array[0..7] of TD3DResourceStats; 
  511. //#endif
  512.   end;
  513.   {$EXTERNALSYM _D3DDEVINFO_RESOURCEMANAGER}
  514.   D3DDEVINFO_RESOURCEMANAGER = _D3DDEVINFO_RESOURCEMANAGER;
  515.   {$EXTERNALSYM D3DDEVINFO_RESOURCEMANAGER}
  516.   TD3DDevInfoResourceManager = _D3DDEVINFO_RESOURCEMANAGER;
  517.   PD3DDevInfoD3DVertexStats = ^TD3DDevInfoD3DVertexStats;
  518.   _D3DDEVINFO_D3DVERTEXSTATS = packed record
  519.     NumRenderedTriangles        : DWORD; (* total number of triangles that are not clipped in this frame *)
  520.     NumExtraClippingTriangles   : DWORD; (* Number of new triangles generated by clipping *)
  521.   end;
  522.   {$EXTERNALSYM _D3DDEVINFO_D3DVERTEXSTATS}
  523.   D3DDEVINFO_D3DVERTEXSTATS = _D3DDEVINFO_D3DVERTEXSTATS;
  524.   {$EXTERNALSYM D3DDEVINFO_D3DVERTEXSTATS}
  525.   TD3DDevInfoD3DVertexStats = _D3DDEVINFO_D3DVERTEXSTATS;
  526.   PD3DDevInfoVCache = ^TD3DDevInfoVCache;
  527.   _D3DDEVINFO_VCACHE = packed record
  528.     Pattern     : DWORD;        (* bit pattern, return value must be FOUR_CC('C', 'A', 'C', 'H') *)
  529.     OptMethod   : DWORD;        (* optimization method 0 means longest strips, 1 means vertex cache based *)
  530.     CacheSize   : DWORD;        (* cache size to optimize for  (only required if type is 1) *)
  531.     MagicNumber : DWORD;        (* used to determine when to restart strips (only required if type is 1)*)
  532.   end;
  533.   {$EXTERNALSYM _D3DDEVINFO_VCACHE}
  534.   D3DDEVINFO_VCACHE = _D3DDEVINFO_VCACHE;
  535.   {$EXTERNALSYM D3DDEVINFO_VCACHE}
  536.   TD3DDevInfoVCache = _D3DDEVINFO_VCACHE;
  537.   PD3DDevInfoD3D9PipelineTimings = ^TD3DDevInfoD3D9PipelineTimings;
  538.   _D3DDEVINFO_D3D9PIPELINETIMINGS = packed record
  539.     VertexProcessingTimePercent: Single;
  540.     PixelProcessingTimePercent: Single;
  541.     OtherGPUProcessingTimePercent: Single;
  542.     GPUIdleTimePercent: Single;
  543.   end;
  544.   {$EXTERNALSYM _D3DDEVINFO_D3D9PIPELINETIMINGS}
  545.   D3DDEVINFO_D3D9PIPELINETIMINGS = _D3DDEVINFO_D3D9PIPELINETIMINGS;
  546.   {$EXTERNALSYM D3DDEVINFO_D3D9PIPELINETIMINGS}
  547.   TD3DDevInfoD3D9PipelineTimings = _D3DDEVINFO_D3D9PIPELINETIMINGS;
  548.   PD3DDevInfoD3D9InterfaceTimings = ^TD3DDevInfoD3D9InterfaceTimings;
  549.   _D3DDEVINFO_D3D9INTERFACETIMINGS = packed record
  550.     WaitingForGPUToUseApplicationResourceTimePercent: Single;
  551.     WaitingForGPUToAcceptMoreCommandsTimePercent: Single;
  552.     WaitingForGPUToStayWithinLatencyTimePercent: Single;
  553.     WaitingForGPUExclusiveResourceTimePercent: Single;
  554.     WaitingForGPUOtherTimePercent: Single;
  555.   end;
  556.   {$EXTERNALSYM _D3DDEVINFO_D3D9INTERFACETIMINGS}
  557.   D3DDEVINFO_D3D9INTERFACETIMINGS = _D3DDEVINFO_D3D9INTERFACETIMINGS;
  558.   {$EXTERNALSYM D3DDEVINFO_D3D9INTERFACETIMINGS}
  559.   TD3DDevInfoD3D9InterfaceTimings = _D3DDEVINFO_D3D9INTERFACETIMINGS;
  560.   PD3DDevInfoD3D9StageTimings = ^TD3DDevInfoD3D9StageTimings;
  561.   _D3DDEVINFO_D3D9STAGETIMINGS = packed record
  562.     MemoryProcessingPercent: Single;
  563.     ComputationProcessingPercent: Single;
  564.   end;
  565.   {$EXTERNALSYM _D3DDEVINFO_D3D9STAGETIMINGS}
  566.   D3DDEVINFO_D3D9STAGETIMINGS = _D3DDEVINFO_D3D9STAGETIMINGS;
  567.   {$EXTERNALSYM D3DDEVINFO_D3D9STAGETIMINGS}
  568.   TD3DDevInfoD3D9StageTimings = _D3DDEVINFO_D3D9STAGETIMINGS;
  569.   PD3DDevInfoD3D9BandwidthTimings = ^TD3DDevInfoD3D9BandwidthTimings;
  570.   _D3DDEVINFO_D3D9BANDWIDTHTIMINGS = packed record
  571.     MaxBandwidthUtilized: Single;
  572.     FrontEndUploadMemoryUtilizedPercent: Single;
  573.     VertexRateUtilizedPercent: Single;
  574.     TriangleSetupRateUtilizedPercent: Single;
  575.     FillRateUtilizedPercent: Single;
  576.   end;
  577.   {$EXTERNALSYM _D3DDEVINFO_D3D9BANDWIDTHTIMINGS}
  578.   D3DDEVINFO_D3D9BANDWIDTHTIMINGS = _D3DDEVINFO_D3D9BANDWIDTHTIMINGS;
  579.   {$EXTERNALSYM D3DDEVINFO_D3D9BANDWIDTHTIMINGS}
  580.   TD3DDevInfoD3D9BandwidthTimings = _D3DDEVINFO_D3D9BANDWIDTHTIMINGS;
  581.   PD3DDevInfoD3D9CacheUtilization = ^TD3DDevInfoD3D9CacheUtilization;
  582.   _D3DDEVINFO_D3D9CACHEUTILIZATION = packed record
  583.     TextureCacheHitRate: Single; // Percentage of cache hits
  584.     PostTransformVertexCacheHitRate: Single;
  585.   end;
  586.   {$EXTERNALSYM _D3DDEVINFO_D3D9CACHEUTILIZATION}
  587.   D3DDEVINFO_D3D9CACHEUTILIZATION = _D3DDEVINFO_D3D9CACHEUTILIZATION;
  588.   {$EXTERNALSYM D3DDEVINFO_D3D9CACHEUTILIZATION}
  589.   TD3DDevInfoD3D9CacheUtilization = _D3DDEVINFO_D3D9CACHEUTILIZATION;
  590. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  591.   PD3DComposeRectsOp = ^TD3DComposeRectsOp;
  592.   _D3DCOMPOSERECTSOP =
  593.   (
  594.     D3DCOMPOSERECTS_INVALID_0,
  595.     D3DCOMPOSERECTS_COPY     {= 1},
  596.     D3DCOMPOSERECTS_OR       {= 2},
  597.     D3DCOMPOSERECTS_AND      {= 3},
  598.     D3DCOMPOSERECTS_NEG      {= 4}
  599.   );
  600.   {$EXTERNALSYM _D3DCOMPOSERECTSOP}
  601.   D3DCOMPOSERECTSOP = _D3DCOMPOSERECTSOP;
  602.   {$EXTERNALSYM D3DCOMPOSERECTSOP}
  603.   TD3DComposeRectsOp = _D3DCOMPOSERECTSOP;
  604.   PD3DComposeRectDesc = ^TD3DComposeRectDesc;
  605.   _D3DCOMPOSERECTDESC = record
  606.     X, Y: Word;           // Top-left coordinates of a rect in the source surface
  607.     Width, Height: Word;  // Dimensions of the rect
  608.   end;
  609.   {$EXTERNALSYM _D3DCOMPOSERECTDESC}
  610.   D3DCOMPOSERECTDESC = _D3DCOMPOSERECTDESC;
  611.   {$EXTERNALSYM D3DCOMPOSERECTDESC}
  612.   TD3DComposeRectDesc = _D3DCOMPOSERECTDESC;
  613.   PD3DComposeRectDestination = ^TD3DComposeRectDestination;
  614.   _D3DCOMPOSERECTDESTINATION = record
  615.     SrcRectIndex: Word;    // Index of D3DCOMPOSERECTDESC
  616.     Reserved: Word;        // For alignment
  617.     X, Y:  Smallint;       // Top-left coordinates of the rect in the destination surface
  618.   end;
  619.   {$EXTERNALSYM _D3DCOMPOSERECTDESTINATION}
  620.   D3DCOMPOSERECTDESTINATION = _D3DCOMPOSERECTDESTINATION;
  621.   {$EXTERNALSYM D3DCOMPOSERECTDESTINATION}
  622.   TD3DComposeRectDestination = _D3DCOMPOSERECTDESTINATION;
  623. const
  624.   D3DCOMPOSERECTS_MAXNUMRECTS = $FFFF;
  625.   {$EXTERNALSYM D3DCOMPOSERECTS_MAXNUMRECTS}
  626.   D3DCONVOLUTIONMONO_MAXWIDTH  = 7;
  627.   {$EXTERNALSYM D3DCONVOLUTIONMONO_MAXWIDTH}
  628.   D3DCONVOLUTIONMONO_MAXHEIGHT = D3DCONVOLUTIONMONO_MAXWIDTH;
  629.   {$EXTERNALSYM D3DCONVOLUTIONMONO_MAXHEIGHT}
  630.   D3DFMT_A1_SURFACE_MAXWIDTH  = 8192;
  631.   {$EXTERNALSYM D3DFMT_A1_SURFACE_MAXWIDTH}
  632.   D3DFMT_A1_SURFACE_MAXHEIGHT = 2048;
  633.   {$EXTERNALSYM D3DFMT_A1_SURFACE_MAXHEIGHT}
  634. type
  635.   PD3DPresentStats = ^TD3DPresentStats;
  636.   _D3DPRESENTSTATS = record
  637.     PresentCount: LongWord;
  638.     PresentRefreshCount: LongWord;
  639.     SyncRefreshCount: LongWord;
  640.     SyncQPCTime: LARGE_INTEGER;
  641.     SyncGPUTime: LARGE_INTEGER;
  642.   end;
  643.   {$EXTERNALSYM _D3DPRESENTSTATS}
  644.   D3DPRESENTSTATS = _D3DPRESENTSTATS;
  645.   {$EXTERNALSYM D3DPRESENTSTATS}
  646.   TD3DPresentStats = _D3DPRESENTSTATS;
  647.   PD3DScanlineOrdering = ^TD3DScanlineOrdering;
  648.   D3DSCANLINEORDERING = (
  649.     D3DSCANLINEORDERING_INVALID_0,
  650.     D3DSCANLINEORDERING_PROGRESSIVE                {= 1},
  651.     D3DSCANLINEORDERING_INTERLACED                 {= 2}
  652.   );
  653.   {$EXTERNALSYM D3DSCANLINEORDERING}
  654.   TD3DScanlineOrdering = D3DSCANLINEORDERING;
  655.   PD3DDisplayModeEx = ^TD3DDisplayModeEx;
  656.   D3DDISPLAYMODEEX = record
  657.     Size: LongWord;
  658.     Width: LongWord;
  659.     Height: LongWord;
  660.     RefreshRate: LongWord;
  661.     Format: TD3DFormat;
  662.     ScanLineOrdering: TD3DScanlineOrdering;
  663.   end;
  664.   {$EXTERNALSYM D3DDISPLAYMODEEX}
  665.   TD3DDisplayModeEx = D3DDISPLAYMODEEX;
  666.   PD3DDisplayModeFilter = ^TD3DDisplayModeFilter;
  667.   D3DDISPLAYMODEFILTER = record
  668.     Size: LongWord;
  669.     Format: TD3DFormat;
  670.     ScanLineOrdering: TD3DScanlineOrdering;
  671.   end;
  672.   {$EXTERNALSYM D3DDISPLAYMODEFILTER}
  673.   TD3DDisplayModeFilter = D3DDISPLAYMODEFILTER;
  674.   PD3DDisplayRotation = ^TD3DDisplayRotation;
  675.   D3DDISPLAYROTATION =
  676.   (
  677.   {$IFNDEF SUPPORTS_EXPL_ENUMS}
  678.     D3DDISPLAYROTATION_INVALID_0,
  679.     D3DDISPLAYROTATION_IDENTITY {= 1}, // No rotation.
  680.     D3DDISPLAYROTATION_90       {= 2}, // Rotated 90 degrees.
  681.     D3DDISPLAYROTATION_180      {= 3}, // Rotated 180 degrees.
  682.     D3DDISPLAYROTATION_270      {= 4}  // Rotated 270 degrees.
  683.   {$ELSE}
  684.     D3DDISPLAYROTATION_IDENTITY = 1, // No rotation.
  685.     D3DDISPLAYROTATION_90       = 2, // Rotated 90 degrees.
  686.     D3DDISPLAYROTATION_180      = 3, // Rotated 180 degrees.
  687.     D3DDISPLAYROTATION_270      = 4  // Rotated 270 degrees.
  688.   {$ENDIF}
  689.   );
  690.   {$EXTERNALSYM D3DDISPLAYROTATION}
  691.   TD3DDisplayRotation = D3DDISPLAYROTATION;
  692. {$ENDIF}
  693. (*==========================================================================;
  694.  *
  695.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  696.  *
  697.  *  File:       d3d9caps.h
  698.  *  Content:    Direct3D capabilities include file
  699.  *
  700.  ***************************************************************************)
  701. type
  702.   PD3DVShaderCaps2_0 = ^TD3DVShaderCaps2_0;
  703.   _D3DVSHADERCAPS2_0 = packed record
  704.     Caps:                     DWORD;
  705.     DynamicFlowControlDepth:  Integer;
  706.     NumTemps:                 Integer;
  707.     StaticFlowControlDepth:   Integer;
  708.   end;
  709.   {$EXTERNALSYM _D3DVSHADERCAPS2_0}
  710.   D3DVSHADERCAPS2_0 = _D3DVSHADERCAPS2_0;
  711.   {$EXTERNALSYM D3DVSHADERCAPS2_0}
  712.   TD3DVShaderCaps2_0 = _D3DVSHADERCAPS2_0;
  713. const
  714.   D3DVS20CAPS_PREDICATION              = (1 shl 0);
  715.   {$EXTERNALSYM D3DVS20CAPS_PREDICATION}
  716.   D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH  = 24;
  717.   {$EXTERNALSYM D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH}
  718.   D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH  = 0;
  719.   {$EXTERNALSYM D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH}
  720.   D3DVS20_MAX_NUMTEMPS                 = 32;
  721.   {$EXTERNALSYM D3DVS20_MAX_NUMTEMPS}
  722.   D3DVS20_MIN_NUMTEMPS                 = 12;
  723.   {$EXTERNALSYM D3DVS20_MIN_NUMTEMPS}
  724.   D3DVS20_MAX_STATICFLOWCONTROLDEPTH   = 4;
  725.   {$EXTERNALSYM D3DVS20_MAX_STATICFLOWCONTROLDEPTH}
  726.   D3DVS20_MIN_STATICFLOWCONTROLDEPTH   = 1;
  727.   {$EXTERNALSYM D3DVS20_MIN_STATICFLOWCONTROLDEPTH}
  728. type
  729.   PD3DPShaderCaps2_0 = ^TD3DPShaderCaps2_0;
  730.   _D3DPSHADERCAPS2_0 = packed record
  731.     Caps:                     DWORD;
  732.     DynamicFlowControlDepth:  Integer;
  733.     NumTemps:                 Integer;
  734.     StaticFlowControlDepth:   Integer;
  735.     NumInstructionSlots:      Integer;
  736.   end;
  737.   {$EXTERNALSYM _D3DPSHADERCAPS2_0}
  738.   D3DPSHADERCAPS2_0 = _D3DPSHADERCAPS2_0;
  739.   {$EXTERNALSYM D3DPSHADERCAPS2_0}
  740.   TD3DPShaderCaps2_0 = _D3DPSHADERCAPS2_0;
  741. const
  742.   D3DPS20CAPS_ARBITRARYSWIZZLE         = (1 shl 0);
  743.   {$EXTERNALSYM D3DPS20CAPS_ARBITRARYSWIZZLE}
  744.   D3DPS20CAPS_GRADIENTINSTRUCTIONS     = (1 shl 1);
  745.   {$EXTERNALSYM D3DPS20CAPS_GRADIENTINSTRUCTIONS}
  746.   D3DPS20CAPS_PREDICATION              = (1 shl 2);
  747.   {$EXTERNALSYM D3DPS20CAPS_PREDICATION}
  748.   D3DPS20CAPS_NODEPENDENTREADLIMIT     = (1 shl 3);
  749.   {$EXTERNALSYM D3DPS20CAPS_NODEPENDENTREADLIMIT}
  750.   D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT    = (1 shl 4);
  751.   {$EXTERNALSYM D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT}
  752.   D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH  = 24;
  753.   {$EXTERNALSYM D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH}
  754.   D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH  = 0;
  755.   {$EXTERNALSYM D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH}
  756.   D3DPS20_MAX_NUMTEMPS                 = 32;
  757.   {$EXTERNALSYM D3DPS20_MAX_NUMTEMPS}
  758.   D3DPS20_MIN_NUMTEMPS                 = 12;
  759.   {$EXTERNALSYM D3DPS20_MIN_NUMTEMPS}
  760.   D3DPS20_MAX_STATICFLOWCONTROLDEPTH   = 4;
  761.   {$EXTERNALSYM D3DPS20_MAX_STATICFLOWCONTROLDEPTH}
  762.   D3DPS20_MIN_STATICFLOWCONTROLDEPTH   = 0;
  763.   {$EXTERNALSYM D3DPS20_MIN_STATICFLOWCONTROLDEPTH}
  764.   D3DPS20_MAX_NUMINSTRUCTIONSLOTS      = 512;
  765.   {$EXTERNALSYM D3DPS20_MAX_NUMINSTRUCTIONSLOTS}
  766.   D3DPS20_MIN_NUMINSTRUCTIONSLOTS      = 96;
  767.   {$EXTERNALSYM D3DPS20_MIN_NUMINSTRUCTIONSLOTS}
  768.   D3DMIN30SHADERINSTRUCTIONS           = 512;
  769.   {$EXTERNALSYM D3DMIN30SHADERINSTRUCTIONS}
  770.   D3DMAX30SHADERINSTRUCTIONS           = 32768;
  771.   {$EXTERNALSYM D3DMAX30SHADERINSTRUCTIONS}
  772. type
  773.   PD3DCaps9 = ^TD3DCaps9;
  774.   _D3DCAPS9 = record
  775.     (* Device Info *)
  776.     DeviceType: TD3DDevType;
  777.     AdapterOrdinal: DWord;
  778.     (* Caps from DX7 Draw *)
  779.     Caps: DWord;
  780.     Caps2: DWord;
  781.     Caps3: DWord;
  782.     PresentationIntervals: DWord;
  783.     (* Cursor Caps *)
  784.     CursorCaps: DWORD;
  785.     (* 3D Device Caps *)
  786.     DevCaps: DWord;
  787.     PrimitiveMiscCaps: DWord;
  788.     RasterCaps: DWord;
  789.     ZCmpCaps: DWord;
  790.     SrcBlendCaps: DWord;
  791.     DestBlendCaps: DWord;
  792.     AlphaCmpCaps: DWord;
  793.     ShadeCaps: DWord;
  794.     TextureCaps: DWord;
  795.     TextureFilterCaps: DWord;           // D3DPTFILTERCAPS for IDirect3DTexture9's
  796.     CubeTextureFilterCaps: DWord;       // D3DPTFILTERCAPS for IDirect3DCubeTexture9's
  797.     VolumeTextureFilterCaps: DWord;     // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's
  798.     TextureAddressCaps: DWord;          // D3DPTADDRESSCAPS for IDirect3DTexture9's
  799.     VolumeTextureAddressCaps: DWord;    // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's
  800.     LineCaps: DWord;                    // D3DLINECAPS
  801.     MaxTextureWidth, MaxTextureHeight: DWord;
  802.     MaxVolumeExtent: DWord;
  803.     MaxTextureRepeat: DWord;
  804.     MaxTextureAspectRatio: DWord;
  805.     MaxAnisotropy: DWord;
  806.     MaxVertexW: Single;
  807.     GuardBandLeft: Single;
  808.     GuardBandTop: Single;
  809.     GuardBandRight: Single;
  810.     GuardBandBottom: Single;
  811.     ExtentsAdjust: Single;
  812.     StencilCaps: DWord;
  813.     FVFCaps: DWord;
  814.     TextureOpCaps: DWord;
  815.     MaxTextureBlendStages: DWord;
  816.     MaxSimultaneousTextures: DWord;
  817.     VertexProcessingCaps: DWord;
  818.     MaxActiveLights: DWord;
  819.     MaxUserClipPlanes: DWord;
  820.     MaxVertexBlendMatrices: DWord;
  821.     MaxVertexBlendMatrixIndex: DWord;
  822.     MaxPointSize: Single;
  823.     MaxPrimitiveCount: DWord;           // max number of primitives per DrawPrimitive call
  824.     MaxVertexIndex: DWord;
  825.     MaxStreams: DWord;
  826.     MaxStreamStride: DWord;             // max stride for SetStreamSource
  827.     VertexShaderVersion: DWord;
  828.     MaxVertexShaderConst: DWord;        // number of vertex shader constant registers
  829.     PixelShaderVersion: DWord;
  830.     PixelShader1xMaxValue: Single;      // max value storable in registers of ps.1.x shaders
  831.     // Here are the DX9 specific ones
  832.     DevCaps2: DWORD;
  833.     MaxNpatchTessellationLevel: Single;
  834.     Reserved5: DWORD;
  835.     MasterAdapterOrdinal: LongWord;     // ordinal of master adaptor for adapter group
  836.     AdapterOrdinalInGroup: LongWord;    // ordinal inside the adapter group
  837.     NumberOfAdaptersInGroup: LongWord;  // number of adapters in this adapter group (only if master)
  838.     DeclTypes: DWORD;                   // Data types, supported in vertex declarations
  839.     NumSimultaneousRTs: DWORD;          // Will be at least 1
  840.     StretchRectFilterCaps: DWORD;       // Filter caps supported by StretchRect
  841.     VS20Caps: TD3DVShaderCaps2_0;
  842.     PS20Caps: TD3DPShaderCaps2_0;
  843.     VertexTextureFilterCaps: DWORD;     // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used in vertex shaders
  844.     MaxVShaderInstructionsExecuted: DWORD; // maximum number of vertex shader instructions that can be executed
  845.     MaxPShaderInstructionsExecuted: DWORD; // maximum number of pixel shader instructions that can be executed
  846.     MaxVertexShader30InstructionSlots: DWORD;
  847.     MaxPixelShader30InstructionSlots: DWORD;
  848.   end {D3DCAPS9};
  849.   {$EXTERNALSYM _D3DCAPS9}
  850.   D3DCAPS9 = _D3DCAPS9;
  851.   {$EXTERNALSYM D3DCAPS9}
  852.   TD3DCaps9 = _D3DCAPS9;
  853.   //
  854.   // BIT DEFINES FOR D3DCAPS9 DWORD MEMBERS
  855.   //
  856. const
  857.   //
  858.   // Caps
  859.   //
  860.   D3DCAPS_READ_SCANLINE         = $00020000;
  861.   {$EXTERNALSYM D3DCAPS_READ_SCANLINE}
  862.   //
  863.   // Caps2
  864.   //
  865.   D3DCAPS2_FULLSCREENGAMMA      = $00020000;
  866.   {$EXTERNALSYM D3DCAPS2_FULLSCREENGAMMA}
  867.   D3DCAPS2_CANCALIBRATEGAMMA    = $00100000;
  868.   {$EXTERNALSYM D3DCAPS2_CANCALIBRATEGAMMA}
  869.   D3DCAPS2_RESERVED             = $02000000;
  870.   {$EXTERNALSYM D3DCAPS2_RESERVED}
  871.   D3DCAPS2_CANMANAGERESOURCE    = $10000000;
  872.   {$EXTERNALSYM D3DCAPS2_CANMANAGERESOURCE}
  873.   D3DCAPS2_DYNAMICTEXTURES      = $20000000;
  874.   {$EXTERNALSYM D3DCAPS2_DYNAMICTEXTURES}
  875.   D3DCAPS2_CANAUTOGENMIPMAP     = $40000000;
  876.   {$EXTERNALSYM D3DCAPS2_CANAUTOGENMIPMAP}
  877. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  878.   D3DCAPS2_CANSHARERESOURCE     = $80000000;
  879.   {$EXTERNALSYM D3DCAPS2_CANSHARERESOURCE}
  880. {$ENDIF}
  881.   //
  882.   // Caps3
  883.   //
  884.   D3DCAPS3_RESERVED             = $8000001F;
  885.   {$EXTERNALSYM D3DCAPS3_RESERVED}
  886.   // Indicates that the device can respect the ALPHABLENDENABLE render state
  887.   // when fullscreen while using the FLIP or DISCARD swap effect.
  888.   // COPY and COPYVSYNC swap effects work whether or not this flag is set.
  889.   D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD     = $00000020;
  890.   {$EXTERNALSYM D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD}
  891.   // Indicates that the device can perform a gamma correction from
  892.   // a windowed back buffer containing linear content to the sRGB desktop.
  893.   D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION  = $00000080;
  894.   {$EXTERNALSYM D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION}
  895.   D3DCAPS3_COPY_TO_VIDMEM         = $00000100; { Device can acclerate copies from sysmem to local vidmem }
  896.   {$EXTERNALSYM D3DCAPS3_COPY_TO_VIDMEM}
  897.   D3DCAPS3_COPY_TO_SYSTEMMEM      = $00000200; { Device can acclerate copies from local vidmem to sysmem }
  898.   {$EXTERNALSYM D3DCAPS3_COPY_TO_SYSTEMMEM}
  899.   //
  900.   // PresentationIntervals
  901.   //
  902.   D3DPRESENT_INTERVAL_DEFAULT   = $00000000;
  903.   {$EXTERNALSYM D3DPRESENT_INTERVAL_DEFAULT}
  904.   D3DPRESENT_INTERVAL_ONE       = $00000001;
  905.   {$EXTERNALSYM D3DPRESENT_INTERVAL_ONE}
  906.   D3DPRESENT_INTERVAL_TWO       = $00000002;
  907.   {$EXTERNALSYM D3DPRESENT_INTERVAL_TWO}
  908.   D3DPRESENT_INTERVAL_THREE     = $00000004;
  909.   {$EXTERNALSYM D3DPRESENT_INTERVAL_THREE}
  910.   D3DPRESENT_INTERVAL_FOUR      = $00000008;
  911.   {$EXTERNALSYM D3DPRESENT_INTERVAL_FOUR}
  912.   D3DPRESENT_INTERVAL_IMMEDIATE = $80000000;
  913.   {$EXTERNALSYM D3DPRESENT_INTERVAL_IMMEDIATE}
  914.   //
  915.   // CursorCaps
  916.   //
  917.   // Driver supports HW color cursor in at least hi-res modes(height >=400)
  918.   D3DCURSORCAPS_COLOR           = $00000001;
  919.   {$EXTERNALSYM D3DCURSORCAPS_COLOR}
  920.   // Driver supports HW cursor also in low-res modes(height < 400)
  921.   D3DCURSORCAPS_LOWRES          = $00000002;
  922.   {$EXTERNALSYM D3DCURSORCAPS_LOWRES}
  923.   //
  924.   // DevCaps
  925.   //
  926.   D3DDEVCAPS_EXECUTESYSTEMMEMORY        = $00000010; { Device can use execute buffers from system memory }
  927.   {$EXTERNALSYM D3DDEVCAPS_EXECUTESYSTEMMEMORY}
  928.   D3DDEVCAPS_EXECUTEVIDEOMEMORY         = $00000020; { Device can use execute buffers from video memory }
  929.   {$EXTERNALSYM D3DDEVCAPS_EXECUTEVIDEOMEMORY}
  930.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY       = $00000040; { Device can use TL buffers from system memory }
  931.   {$EXTERNALSYM D3DDEVCAPS_TLVERTEXSYSTEMMEMORY}
  932.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY        = $00000080; { Device can use TL buffers from video memory }
  933.   {$EXTERNALSYM D3DDEVCAPS_TLVERTEXVIDEOMEMORY}
  934.   D3DDEVCAPS_TEXTURESYSTEMMEMORY        = $00000100; { Device can texture from system memory }
  935.   {$EXTERNALSYM D3DDEVCAPS_TEXTURESYSTEMMEMORY}
  936.   D3DDEVCAPS_TEXTUREVIDEOMEMORY         = $00000200; { Device can texture from device memory }
  937.   {$EXTERNALSYM D3DDEVCAPS_TEXTUREVIDEOMEMORY}
  938.   D3DDEVCAPS_DRAWPRIMTLVERTEX           = $00000400; { Device can draw TLVERTEX primitives }
  939.   {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMTLVERTEX}
  940.   D3DDEVCAPS_CANRENDERAFTERFLIP         = $00000800; { Device can render without waiting for flip to complete }
  941.   {$EXTERNALSYM D3DDEVCAPS_CANRENDERAFTERFLIP}
  942.   D3DDEVCAPS_TEXTURENONLOCALVIDMEM      = $00001000; { Device can texture from nonlocal video memory }
  943.   {$EXTERNALSYM D3DDEVCAPS_TEXTURENONLOCALVIDMEM}
  944.   D3DDEVCAPS_DRAWPRIMITIVES2            = $00002000; { Device can support DrawPrimitives2 }
  945.   {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2}
  946.   D3DDEVCAPS_SEPARATETEXTUREMEMORIES    = $00004000; { Device is texturing from separate memory pools }
  947.   {$EXTERNALSYM D3DDEVCAPS_SEPARATETEXTUREMEMORIES}
  948.   D3DDEVCAPS_DRAWPRIMITIVES2EX          = $00008000; { Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver }
  949.   {$EXTERNALSYM D3DDEVCAPS_DRAWPRIMITIVES2EX}
  950.   D3DDEVCAPS_HWTRANSFORMANDLIGHT        = $00010000; { Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also }
  951.   {$EXTERNALSYM D3DDEVCAPS_HWTRANSFORMANDLIGHT}
  952.   D3DDEVCAPS_CANBLTSYSTONONLOCAL        = $00020000; { Device supports a Tex Blt from system memory to non-local vidmem }
  953.   {$EXTERNALSYM D3DDEVCAPS_CANBLTSYSTONONLOCAL}
  954.   D3DDEVCAPS_HWRASTERIZATION            = $00080000; { Device has HW acceleration for rasterization }
  955.   {$EXTERNALSYM D3DDEVCAPS_HWRASTERIZATION}
  956.   D3DDEVCAPS_PUREDEVICE                 = $00100000; { Device supports D3DCREATE_PUREDEVICE }
  957.   {$EXTERNALSYM D3DDEVCAPS_PUREDEVICE}
  958.   D3DDEVCAPS_QUINTICRTPATCHES           = $00200000; { Device supports quintic Beziers and BSplines }
  959.   {$EXTERNALSYM D3DDEVCAPS_QUINTICRTPATCHES}
  960.   D3DDEVCAPS_RTPATCHES                  = $00400000; { Device supports Rect and Tri patches }
  961.   {$EXTERNALSYM D3DDEVCAPS_RTPATCHES}
  962.   D3DDEVCAPS_RTPATCHHANDLEZERO          = $00800000; { Indicates that RT Patches may be drawn efficiently using handle 0 }
  963.   {$EXTERNALSYM D3DDEVCAPS_RTPATCHHANDLEZERO}
  964.   D3DDEVCAPS_NPATCHES                   = $01000000; { Device supports N-Patches }
  965.   {$EXTERNALSYM D3DDEVCAPS_NPATCHES}
  966.   //
  967.   // PrimitiveMiscCaps
  968.   //
  969.   D3DPMISCCAPS_MASKZ                    = $00000002;
  970.   {$EXTERNALSYM D3DPMISCCAPS_MASKZ}
  971.   D3DPMISCCAPS_CULLNONE                 = $00000010;
  972.   {$EXTERNALSYM D3DPMISCCAPS_CULLNONE}
  973.   D3DPMISCCAPS_CULLCW                   = $00000020;
  974.   {$EXTERNALSYM D3DPMISCCAPS_CULLCW}
  975.   D3DPMISCCAPS_CULLCCW                  = $00000040;
  976.   {$EXTERNALSYM D3DPMISCCAPS_CULLCCW}
  977.   D3DPMISCCAPS_COLORWRITEENABLE         = $00000080;
  978.   {$EXTERNALSYM D3DPMISCCAPS_COLORWRITEENABLE}
  979.   D3DPMISCCAPS_CLIPPLANESCALEDPOINTS    = $00000100; { Device correctly clips scaled points to clip planes }
  980.   {$EXTERNALSYM D3DPMISCCAPS_CLIPPLANESCALEDPOINTS}
  981.   D3DPMISCCAPS_CLIPTLVERTS              = $00000200; { device will clip post-transformed vertex primitives }
  982.   {$EXTERNALSYM D3DPMISCCAPS_CLIPTLVERTS}
  983.   D3DPMISCCAPS_TSSARGTEMP               = $00000400; { device supports D3DTA_TEMP for temporary register }
  984.   {$EXTERNALSYM D3DPMISCCAPS_TSSARGTEMP}
  985.   D3DPMISCCAPS_BLENDOP                  = $00000800; { device supports D3DRS_BLENDOP }
  986.   {$EXTERNALSYM D3DPMISCCAPS_BLENDOP}
  987.   D3DPMISCCAPS_NULLREFERENCE            = $00001000; { Reference Device that doesnt render }
  988.   {$EXTERNALSYM D3DPMISCCAPS_NULLREFERENCE}
  989.   D3DPMISCCAPS_INDEPENDENTWRITEMASKS    = $00004000; { Device supports independent write masks for MET or MRT }
  990.   {$EXTERNALSYM D3DPMISCCAPS_INDEPENDENTWRITEMASKS}
  991.   D3DPMISCCAPS_PERSTAGECONSTANT         = $00008000; { Device supports per-stage constants }
  992.   {$EXTERNALSYM D3DPMISCCAPS_PERSTAGECONSTANT}
  993.   D3DPMISCCAPS_FOGANDSPECULARALPHA      = $00010000; { Device supports separate fog and specular alpha (many devices
  994.                                                        use the specular alpha channel to store fog factor) }
  995.   {$EXTERNALSYM D3DPMISCCAPS_FOGANDSPECULARALPHA}
  996.   D3DPMISCCAPS_SEPARATEALPHABLEND       = $00020000; { Device supports separate blend settings for the alpha channel }
  997.   {$EXTERNALSYM D3DPMISCCAPS_SEPARATEALPHABLEND}
  998.   D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS    = $00040000; { Device supports different bit depths for MRT }
  999.   {$EXTERNALSYM D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS}
  1000.   D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING = $00080000; { Device supports post-pixel shader operations for MRT }
  1001.   {$EXTERNALSYM D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING}
  1002.   D3DPMISCCAPS_FOGVERTEXCLAMPED           = $00100000; { Device clamps fog blend factor per vertex }
  1003.   {$EXTERNALSYM D3DPMISCCAPS_FOGVERTEXCLAMPED}
  1004. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1005.   D3DPMISCCAPS_POSTBLENDSRGBCONVERT       = $00200000; { Indicates device can perform conversion to sRGB after blending. }
  1006.   {$EXTERNALSYM D3DPMISCCAPS_POSTBLENDSRGBCONVERT}
  1007. {$ENDIF}
  1008.   //
  1009.   // LineCaps
  1010.   //
  1011.   D3DLINECAPS_TEXTURE                   = $00000001;
  1012.   {$EXTERNALSYM D3DLINECAPS_TEXTURE}
  1013.   D3DLINECAPS_ZTEST                     = $00000002;
  1014.   {$EXTERNALSYM D3DLINECAPS_ZTEST}
  1015.   D3DLINECAPS_BLEND                     = $00000004;
  1016.   {$EXTERNALSYM D3DLINECAPS_BLEND}
  1017.   D3DLINECAPS_ALPHACMP                  = $00000008;
  1018.   {$EXTERNALSYM D3DLINECAPS_ALPHACMP}
  1019.   D3DLINECAPS_FOG                       = $00000010;
  1020.   {$EXTERNALSYM D3DLINECAPS_FOG}
  1021.   D3DLINECAPS_ANTIALIAS                 = $00000020;
  1022.   {$EXTERNALSYM D3DLINECAPS_ANTIALIAS}
  1023.   //
  1024.   // RasterCaps
  1025.   //
  1026.   D3DPRASTERCAPS_DITHER                 = $00000001;
  1027.   {$EXTERNALSYM D3DPRASTERCAPS_DITHER}
  1028.   D3DPRASTERCAPS_ZTEST                  = $00000010;
  1029.   {$EXTERNALSYM D3DPRASTERCAPS_ZTEST}
  1030.   D3DPRASTERCAPS_FOGVERTEX              = $00000080;
  1031.   {$EXTERNALSYM D3DPRASTERCAPS_FOGVERTEX}
  1032.   D3DPRASTERCAPS_FOGTABLE               = $00000100;
  1033.   {$EXTERNALSYM D3DPRASTERCAPS_FOGTABLE}
  1034.   D3DPRASTERCAPS_MIPMAPLODBIAS          = $00002000;
  1035.   {$EXTERNALSYM D3DPRASTERCAPS_MIPMAPLODBIAS}
  1036.   D3DPRASTERCAPS_ZBUFFERLESSHSR         = $00008000;
  1037.   {$EXTERNALSYM D3DPRASTERCAPS_ZBUFFERLESSHSR}
  1038.   D3DPRASTERCAPS_FOGRANGE               = $00010000;
  1039.   {$EXTERNALSYM D3DPRASTERCAPS_FOGRANGE}
  1040.   D3DPRASTERCAPS_ANISOTROPY             = $00020000;
  1041.   {$EXTERNALSYM D3DPRASTERCAPS_ANISOTROPY}
  1042.   D3DPRASTERCAPS_WBUFFER                = $00040000;
  1043.   {$EXTERNALSYM D3DPRASTERCAPS_WBUFFER}
  1044.   D3DPRASTERCAPS_WFOG                   = $00100000;
  1045.   {$EXTERNALSYM D3DPRASTERCAPS_WFOG}
  1046.   D3DPRASTERCAPS_ZFOG                   = $00200000;
  1047.   {$EXTERNALSYM D3DPRASTERCAPS_ZFOG}
  1048.   D3DPRASTERCAPS_COLORPERSPECTIVE       = $00400000; { Device iterates colors perspective correct }
  1049.   {$EXTERNALSYM D3DPRASTERCAPS_COLORPERSPECTIVE}
  1050.   D3DPRASTERCAPS_SCISSORTEST            = $01000000;
  1051.   {$EXTERNALSYM D3DPRASTERCAPS_SCISSORTEST}
  1052.   D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS    = $02000000;
  1053.   {$EXTERNALSYM D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS}
  1054.   D3DPRASTERCAPS_DEPTHBIAS              = $04000000;
  1055.   {$EXTERNALSYM D3DPRASTERCAPS_DEPTHBIAS}
  1056.   D3DPRASTERCAPS_MULTISAMPLE_TOGGLE     = $08000000;
  1057.   {$EXTERNALSYM D3DPRASTERCAPS_MULTISAMPLE_TOGGLE}
  1058.   //
  1059.   // ZCmpCaps, AlphaCmpCaps
  1060.   //
  1061.   D3DPCMPCAPS_NEVER                     = $00000001;
  1062.   {$EXTERNALSYM D3DPCMPCAPS_NEVER}
  1063.   D3DPCMPCAPS_LESS                      = $00000002;
  1064.   {$EXTERNALSYM D3DPCMPCAPS_LESS}
  1065.   D3DPCMPCAPS_EQUAL                     = $00000004;
  1066.   {$EXTERNALSYM D3DPCMPCAPS_EQUAL}
  1067.   D3DPCMPCAPS_LESSEQUAL                 = $00000008;
  1068.   {$EXTERNALSYM D3DPCMPCAPS_LESSEQUAL}
  1069.   D3DPCMPCAPS_GREATER                   = $00000010;
  1070.   {$EXTERNALSYM D3DPCMPCAPS_GREATER}
  1071.   D3DPCMPCAPS_NOTEQUAL                  = $00000020;
  1072.   {$EXTERNALSYM D3DPCMPCAPS_NOTEQUAL}
  1073.   D3DPCMPCAPS_GREATEREQUAL              = $00000040;
  1074.   {$EXTERNALSYM D3DPCMPCAPS_GREATEREQUAL}
  1075.   D3DPCMPCAPS_ALWAYS                    = $00000080;
  1076.   {$EXTERNALSYM D3DPCMPCAPS_ALWAYS}
  1077.   //
  1078.   // SourceBlendCaps, DestBlendCaps
  1079.   //
  1080.   D3DPBLENDCAPS_ZERO                    = $00000001;
  1081.   {$EXTERNALSYM D3DPBLENDCAPS_ZERO}
  1082.   D3DPBLENDCAPS_ONE                     = $00000002;
  1083.   {$EXTERNALSYM D3DPBLENDCAPS_ONE}
  1084.   D3DPBLENDCAPS_SRCCOLOR                = $00000004;
  1085.   {$EXTERNALSYM D3DPBLENDCAPS_SRCCOLOR}
  1086.   D3DPBLENDCAPS_INVSRCCOLOR             = $00000008;
  1087.   {$EXTERNALSYM D3DPBLENDCAPS_INVSRCCOLOR}
  1088.   D3DPBLENDCAPS_SRCALPHA                = $00000010;
  1089.   {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHA}
  1090.   D3DPBLENDCAPS_INVSRCALPHA             = $00000020;
  1091.   {$EXTERNALSYM D3DPBLENDCAPS_INVSRCALPHA}
  1092.   D3DPBLENDCAPS_DESTALPHA               = $00000040;
  1093.   {$EXTERNALSYM D3DPBLENDCAPS_DESTALPHA}
  1094.   D3DPBLENDCAPS_INVDESTALPHA            = $00000080;
  1095.   {$EXTERNALSYM D3DPBLENDCAPS_INVDESTALPHA}
  1096.   D3DPBLENDCAPS_DESTCOLOR               = $00000100;
  1097.   {$EXTERNALSYM D3DPBLENDCAPS_DESTCOLOR}
  1098.   D3DPBLENDCAPS_INVDESTCOLOR            = $00000200;
  1099.   {$EXTERNALSYM D3DPBLENDCAPS_INVDESTCOLOR}
  1100.   D3DPBLENDCAPS_SRCALPHASAT             = $00000400;
  1101.   {$EXTERNALSYM D3DPBLENDCAPS_SRCALPHASAT}
  1102.   D3DPBLENDCAPS_BOTHSRCALPHA            = $00000800;
  1103.   {$EXTERNALSYM D3DPBLENDCAPS_BOTHSRCALPHA}
  1104.   D3DPBLENDCAPS_BOTHINVSRCALPHA         = $00001000;
  1105.   {$EXTERNALSYM D3DPBLENDCAPS_BOTHINVSRCALPHA}
  1106.   D3DPBLENDCAPS_BLENDFACTOR             = $00002000; { Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR }
  1107.   {$EXTERNALSYM D3DPBLENDCAPS_BLENDFACTOR}
  1108.   //
  1109.   // ShadeCaps
  1110.   //
  1111.   D3DPSHADECAPS_COLORGOURAUDRGB         = $00000008;
  1112.   {$EXTERNALSYM D3DPSHADECAPS_COLORGOURAUDRGB}
  1113.   D3DPSHADECAPS_SPECULARGOURAUDRGB      = $00000200;
  1114.   {$EXTERNALSYM D3DPSHADECAPS_SPECULARGOURAUDRGB}
  1115.   D3DPSHADECAPS_ALPHAGOURAUDBLEND       = $00004000;
  1116.   {$EXTERNALSYM D3DPSHADECAPS_ALPHAGOURAUDBLEND}
  1117.   D3DPSHADECAPS_FOGGOURAUD              = $00080000;
  1118.   {$EXTERNALSYM D3DPSHADECAPS_FOGGOURAUD}
  1119.   //
  1120.   // TextureCaps
  1121.   //
  1122.   D3DPTEXTURECAPS_PERSPECTIVE           = $00000001; { Perspective-correct texturing is supported }
  1123.   {$EXTERNALSYM D3DPTEXTURECAPS_PERSPECTIVE}
  1124.   D3DPTEXTURECAPS_POW2                  = $00000002; { Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. }
  1125.   {$EXTERNALSYM D3DPTEXTURECAPS_POW2}
  1126.   D3DPTEXTURECAPS_ALPHA                 = $00000004; { Alpha in texture pixels is supported }
  1127.   {$EXTERNALSYM D3DPTEXTURECAPS_ALPHA}
  1128.   D3DPTEXTURECAPS_SQUAREONLY            = $00000020; { Only square textures are supported }
  1129.   {$EXTERNALSYM D3DPTEXTURECAPS_SQUAREONLY}
  1130.   D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = $00000040; { Texture indices are not scaled by the texture size prior to interpolation }
  1131.   {$EXTERNALSYM D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE}
  1132.   D3DPTEXTURECAPS_ALPHAPALETTE          = $00000080; { Device can draw alpha from texture palettes }
  1133.   {$EXTERNALSYM D3DPTEXTURECAPS_ALPHAPALETTE}
  1134.   // Device can use non-POW2 textures if:
  1135.   //  1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
  1136.   //  2) D3DRS_WRAP(N) is zero for this texture's coordinates
  1137.   //  3) mip mapping is not enabled (use magnification filter only)
  1138.   D3DPTEXTURECAPS_NONPOW2CONDITIONAL    = $00000100;
  1139.   {$EXTERNALSYM D3DPTEXTURECAPS_NONPOW2CONDITIONAL}
  1140.   D3DPTEXTURECAPS_PROJECTED             = $00000400; { Device can do D3DTTFF_PROJECTED }
  1141.   {$EXTERNALSYM D3DPTEXTURECAPS_PROJECTED}
  1142.   D3DPTEXTURECAPS_CUBEMAP               = $00000800; { Device can do cubemap textures }
  1143.   {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP}
  1144.   D3DPTEXTURECAPS_VOLUMEMAP             = $00002000; { Device can do volume textures }
  1145.   {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP}
  1146.   D3DPTEXTURECAPS_MIPMAP                = $00004000; { Device can do mipmapped textures }
  1147.   {$EXTERNALSYM D3DPTEXTURECAPS_MIPMAP}
  1148.   D3DPTEXTURECAPS_MIPVOLUMEMAP          = $00008000; { Device can do mipmapped volume textures }
  1149.   {$EXTERNALSYM D3DPTEXTURECAPS_MIPVOLUMEMAP}
  1150.   D3DPTEXTURECAPS_MIPCUBEMAP            = $00010000; { Device can do mipmapped cube maps }
  1151.   {$EXTERNALSYM D3DPTEXTURECAPS_MIPCUBEMAP}
  1152.   D3DPTEXTURECAPS_CUBEMAP_POW2          = $00020000; { Device requires that cubemaps be power-of-2 dimension }
  1153.   {$EXTERNALSYM D3DPTEXTURECAPS_CUBEMAP_POW2}
  1154.   D3DPTEXTURECAPS_VOLUMEMAP_POW2        = $00040000; { Device requires that volume maps be power-of-2 dimension }
  1155.   {$EXTERNALSYM D3DPTEXTURECAPS_VOLUMEMAP_POW2}
  1156.   D3DPTEXTURECAPS_NOPROJECTEDBUMPENV    = $00200000; { Device does not support projected bump env lookup operation
  1157.                                                        in programmable and fixed function pixel shaders }
  1158.   {$EXTERNALSYM D3DPTEXTURECAPS_NOPROJECTEDBUMPENV}
  1159.   //
  1160.   // TextureFilterCaps, StretchRectFilterCaps
  1161.   //
  1162.   D3DPTFILTERCAPS_MINFPOINT             = $00000100; { Min Filter }
  1163.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFPOINT}
  1164.   D3DPTFILTERCAPS_MINFLINEAR            = $00000200;
  1165.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFLINEAR}
  1166.   D3DPTFILTERCAPS_MINFANISOTROPIC       = $00000400;
  1167.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFANISOTROPIC}
  1168.   D3DPTFILTERCAPS_MINFPYRAMIDALQUAD     = $00000800;
  1169.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFPYRAMIDALQUAD}
  1170.   D3DPTFILTERCAPS_MINFGAUSSIANQUAD      = $00001000;
  1171.   {$EXTERNALSYM D3DPTFILTERCAPS_MINFGAUSSIANQUAD}
  1172.   D3DPTFILTERCAPS_MIPFPOINT             = $00010000; { Mip Filter }
  1173.   {$EXTERNALSYM D3DPTFILTERCAPS_MIPFPOINT}
  1174.   D3DPTFILTERCAPS_MIPFLINEAR            = $00020000;
  1175.   {$EXTERNALSYM D3DPTFILTERCAPS_MIPFLINEAR}
  1176. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1177.   D3DPTFILTERCAPS_CONVOLUTIONMONO       = $00040000; { Min and Mag for the convolution mono filter }
  1178.   {$EXTERNALSYM D3DPTFILTERCAPS_CONVOLUTIONMONO}
  1179. {$ENDIF}
  1180.   D3DPTFILTERCAPS_MAGFPOINT             = $01000000; { Mag Filter }
  1181.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFPOINT}
  1182.   D3DPTFILTERCAPS_MAGFLINEAR            = $02000000;
  1183.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFLINEAR}
  1184.   D3DPTFILTERCAPS_MAGFANISOTROPIC       = $04000000;
  1185.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFANISOTROPIC}
  1186.   D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD     = $08000000;
  1187.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD}
  1188.   D3DPTFILTERCAPS_MAGFGAUSSIANQUAD      = $10000000;
  1189.   {$EXTERNALSYM D3DPTFILTERCAPS_MAGFGAUSSIANQUAD}
  1190.   //
  1191.   // TextureAddressCaps
  1192.   //
  1193.   D3DPTADDRESSCAPS_WRAP                 = $00000001;
  1194.   {$EXTERNALSYM D3DPTADDRESSCAPS_WRAP}
  1195.   D3DPTADDRESSCAPS_MIRROR               = $00000002;
  1196.   {$EXTERNALSYM D3DPTADDRESSCAPS_MIRROR}
  1197.   D3DPTADDRESSCAPS_CLAMP                = $00000004;
  1198.   {$EXTERNALSYM D3DPTADDRESSCAPS_CLAMP}
  1199.   D3DPTADDRESSCAPS_BORDER               = $00000008;
  1200.   {$EXTERNALSYM D3DPTADDRESSCAPS_BORDER}
  1201.   D3DPTADDRESSCAPS_INDEPENDENTUV        = $00000010;
  1202.   {$EXTERNALSYM D3DPTADDRESSCAPS_INDEPENDENTUV}
  1203.   D3DPTADDRESSCAPS_MIRRORONCE           = $00000020;
  1204.   {$EXTERNALSYM D3DPTADDRESSCAPS_MIRRORONCE}
  1205.   //
  1206.   // StencilCaps
  1207.   //
  1208.   D3DSTENCILCAPS_KEEP                   = $00000001;
  1209.   {$EXTERNALSYM D3DSTENCILCAPS_KEEP}
  1210.   D3DSTENCILCAPS_ZERO                   = $00000002;
  1211.   {$EXTERNALSYM D3DSTENCILCAPS_ZERO}
  1212.   D3DSTENCILCAPS_REPLACE                = $00000004;
  1213.   {$EXTERNALSYM D3DSTENCILCAPS_REPLACE}
  1214.   D3DSTENCILCAPS_INCRSAT                = $00000008;
  1215.   {$EXTERNALSYM D3DSTENCILCAPS_INCRSAT}
  1216.   D3DSTENCILCAPS_DECRSAT                = $00000010;
  1217.   {$EXTERNALSYM D3DSTENCILCAPS_DECRSAT}
  1218.   D3DSTENCILCAPS_INVERT                 = $00000020;
  1219.   {$EXTERNALSYM D3DSTENCILCAPS_INVERT}
  1220.   D3DSTENCILCAPS_INCR                   = $00000040;
  1221.   {$EXTERNALSYM D3DSTENCILCAPS_INCR}
  1222.   D3DSTENCILCAPS_DECR                   = $00000080;
  1223.   {$EXTERNALSYM D3DSTENCILCAPS_DECR}
  1224.   D3DSTENCILCAPS_TWOSIDED               = $00000100;
  1225.   {$EXTERNALSYM D3DSTENCILCAPS_TWOSIDED}
  1226.   //
  1227.   // TextureOpCaps
  1228.   //
  1229.   D3DTEXOPCAPS_DISABLE                          = $00000001;
  1230.   {$EXTERNALSYM D3DTEXOPCAPS_DISABLE}
  1231.   D3DTEXOPCAPS_SELECTARG1                       = $00000002;
  1232.   {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG1}
  1233.   D3DTEXOPCAPS_SELECTARG2                       = $00000004;
  1234.   {$EXTERNALSYM D3DTEXOPCAPS_SELECTARG2}
  1235.   D3DTEXOPCAPS_MODULATE                         = $00000008;
  1236.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATE}
  1237.   D3DTEXOPCAPS_MODULATE2X                       = $00000010;
  1238.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATE2X}
  1239.   D3DTEXOPCAPS_MODULATE4X                       = $00000020;
  1240.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATE4X}
  1241.   D3DTEXOPCAPS_ADD                              = $00000040;
  1242.   {$EXTERNALSYM D3DTEXOPCAPS_ADD}
  1243.   D3DTEXOPCAPS_ADDSIGNED                        = $00000080;
  1244.   {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED}
  1245.   D3DTEXOPCAPS_ADDSIGNED2X                      = $00000100;
  1246.   {$EXTERNALSYM D3DTEXOPCAPS_ADDSIGNED2X}
  1247.   D3DTEXOPCAPS_SUBTRACT                         = $00000200;
  1248.   {$EXTERNALSYM D3DTEXOPCAPS_SUBTRACT}
  1249.   D3DTEXOPCAPS_ADDSMOOTH                        = $00000400;
  1250.   {$EXTERNALSYM D3DTEXOPCAPS_ADDSMOOTH}
  1251.   D3DTEXOPCAPS_BLENDDIFFUSEALPHA                = $00000800;
  1252.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDDIFFUSEALPHA}
  1253.   D3DTEXOPCAPS_BLENDTEXTUREALPHA                = $00001000;
  1254.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHA}
  1255.   D3DTEXOPCAPS_BLENDFACTORALPHA                 = $00002000;
  1256.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDFACTORALPHA}
  1257.   D3DTEXOPCAPS_BLENDTEXTUREALPHAPM              = $00004000;
  1258.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDTEXTUREALPHAPM}
  1259.   D3DTEXOPCAPS_BLENDCURRENTALPHA                = $00008000;
  1260.   {$EXTERNALSYM D3DTEXOPCAPS_BLENDCURRENTALPHA}
  1261.   D3DTEXOPCAPS_PREMODULATE                      = $00010000;
  1262.   {$EXTERNALSYM D3DTEXOPCAPS_PREMODULATE}
  1263.   D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR           = $00020000;
  1264.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR}
  1265.   D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA           = $00040000;
  1266.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA}
  1267.   D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR        = $00080000;
  1268.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR}
  1269.   D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA        = $00100000;
  1270.   {$EXTERNALSYM D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA}
  1271.   D3DTEXOPCAPS_BUMPENVMAP                       = $00200000;
  1272.   {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAP}
  1273.   D3DTEXOPCAPS_BUMPENVMAPLUMINANCE              = $00400000;
  1274.   {$EXTERNALSYM D3DTEXOPCAPS_BUMPENVMAPLUMINANCE}
  1275.   D3DTEXOPCAPS_DOTPRODUCT3                      = $00800000;
  1276.   {$EXTERNALSYM D3DTEXOPCAPS_DOTPRODUCT3}
  1277.   D3DTEXOPCAPS_MULTIPLYADD                      = $01000000;
  1278.   {$EXTERNALSYM D3DTEXOPCAPS_MULTIPLYADD}
  1279.   D3DTEXOPCAPS_LERP                             = $02000000;
  1280.   {$EXTERNALSYM D3DTEXOPCAPS_LERP}
  1281.   //
  1282.   // FVFCaps
  1283.   //
  1284.   D3DFVFCAPS_TEXCOORDCOUNTMASK  = $0000ffff; { mask for texture coordinate count field }
  1285.   {$EXTERNALSYM D3DFVFCAPS_TEXCOORDCOUNTMASK}
  1286.   D3DFVFCAPS_DONOTSTRIPELEMENTS = $00080000; { Device prefers that vertex elements not be stripped }
  1287.   {$EXTERNALSYM D3DFVFCAPS_DONOTSTRIPELEMENTS}
  1288.   D3DFVFCAPS_PSIZE              = $00100000; { Device can receive point size }
  1289.   {$EXTERNALSYM D3DFVFCAPS_PSIZE}
  1290.   //
  1291.   // VertexProcessingCaps
  1292.   //
  1293.   D3DVTXPCAPS_TEXGEN            = $00000001; { device can do texgen }
  1294.   {$EXTERNALSYM D3DVTXPCAPS_TEXGEN}
  1295.   D3DVTXPCAPS_MATERIALSOURCE7   = $00000002; { device can do DX7-level colormaterialsource ops }
  1296.   {$EXTERNALSYM D3DVTXPCAPS_MATERIALSOURCE7}
  1297.   D3DVTXPCAPS_DIRECTIONALLIGHTS = $00000008; { device can do directional lights }
  1298.   {$EXTERNALSYM D3DVTXPCAPS_DIRECTIONALLIGHTS}
  1299.   D3DVTXPCAPS_POSITIONALLIGHTS  = $00000010; { device can do positional lights (includes point and spot) }
  1300.   {$EXTERNALSYM D3DVTXPCAPS_POSITIONALLIGHTS}
  1301.   D3DVTXPCAPS_LOCALVIEWER       = $00000020; { device can do local viewer }
  1302.   {$EXTERNALSYM D3DVTXPCAPS_LOCALVIEWER}
  1303.   D3DVTXPCAPS_TWEENING          = $00000040; { device can do vertex tweening }
  1304.   {$EXTERNALSYM D3DVTXPCAPS_TWEENING}
  1305.   D3DVTXPCAPS_TEXGEN_SPHEREMAP  = $00000100; { device supports D3DTSS_TCI_SPHEREMAP }
  1306.   {$EXTERNALSYM D3DVTXPCAPS_TEXGEN_SPHEREMAP}
  1307.   D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER = $00000200; { device does not support TexGen in non-local
  1308.                                                       viewer mode }
  1309.   {$EXTERNALSYM D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER}
  1310.   //
  1311.   // DevCaps2
  1312.   //
  1313.   D3DDEVCAPS2_STREAMOFFSET                        = $00000001; { Device supports offsets in streams. Must be set by DX9 drivers }
  1314.   {$EXTERNALSYM D3DDEVCAPS2_STREAMOFFSET}
  1315.   D3DDEVCAPS2_DMAPNPATCH                          = $00000002; { Device supports displacement maps for N-Patches}
  1316.   {$EXTERNALSYM D3DDEVCAPS2_DMAPNPATCH}
  1317.   D3DDEVCAPS2_ADAPTIVETESSRTPATCH                 = $00000004; { Device supports adaptive tesselation of RT-patches}
  1318.   {$EXTERNALSYM D3DDEVCAPS2_ADAPTIVETESSRTPATCH}
  1319.   D3DDEVCAPS2_ADAPTIVETESSNPATCH                  = $00000008; { Device supports adaptive tesselation of N-patches}
  1320.   {$EXTERNALSYM D3DDEVCAPS2_ADAPTIVETESSNPATCH}
  1321.   D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES       = $00000010; { Device supports StretchRect calls with a texture as the source}
  1322.   {$EXTERNALSYM D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES}
  1323.   D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH                = $00000020; { Device supports presampled displacement maps for N-Patches }
  1324.   {$EXTERNALSYM D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH}
  1325.   D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET  = $00000040; { Vertex elements in a vertex declaration can share the same stream offset }
  1326.   {$EXTERNALSYM D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET}
  1327.   //
  1328.   // DeclTypes
  1329.   //
  1330.   D3DDTCAPS_UBYTE4     = $00000001;
  1331.   {$EXTERNALSYM D3DDTCAPS_UBYTE4}
  1332.   D3DDTCAPS_UBYTE4N    = $00000002;
  1333.   {$EXTERNALSYM D3DDTCAPS_UBYTE4N}
  1334.   D3DDTCAPS_SHORT2N    = $00000004;
  1335.   {$EXTERNALSYM D3DDTCAPS_SHORT2N}
  1336.   D3DDTCAPS_SHORT4N    = $00000008;
  1337.   {$EXTERNALSYM D3DDTCAPS_SHORT4N}
  1338.   D3DDTCAPS_USHORT2N   = $00000010;
  1339.   {$EXTERNALSYM D3DDTCAPS_USHORT2N}
  1340.   D3DDTCAPS_USHORT4N   = $00000020;
  1341.   {$EXTERNALSYM D3DDTCAPS_USHORT4N}
  1342.   D3DDTCAPS_UDEC3      = $00000040;
  1343.   {$EXTERNALSYM D3DDTCAPS_UDEC3}
  1344.   D3DDTCAPS_DEC3N      = $00000080;
  1345.   {$EXTERNALSYM D3DDTCAPS_DEC3N}
  1346.   D3DDTCAPS_FLOAT16_2  = $00000100;
  1347.   {$EXTERNALSYM D3DDTCAPS_FLOAT16_2}
  1348.   D3DDTCAPS_FLOAT16_4  = $00000200;
  1349.   {$EXTERNALSYM D3DDTCAPS_FLOAT16_4}
  1350. (*==========================================================================;
  1351.  *
  1352.  *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
  1353.  *
  1354.  *  File:   d3d9.h
  1355.  *  Content:    Direct3D include file
  1356.  *
  1357.  ****************************************************************************)
  1358. (* This identifier is passed to Direct3DCreate9 in order to ensure that an
  1359.  * application was built against the correct header files. This number is
  1360.  * incremented whenever a header (or other) change would require applications
  1361.  * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail.
  1362.  * (The number itself has no meaning.)*)
  1363. const
  1364.   D3D_SDK_VERSION   = (32 or $80000000);
  1365.   D3D9b_SDK_VERSION = (31 or $80000000);
  1366.   {$EXTERNALSYM D3D_SDK_VERSION}
  1367.   {$EXTERNALSYM D3D9b_SDK_VERSION}
  1368. type
  1369.   HMONITOR = THandle;
  1370.   {$EXTERNALSYM HMONITOR}
  1371. (*
  1372.  * Direct3D interfaces
  1373.  *)
  1374.   // forward interfaces declaration
  1375.   IDirect3D9 = interface;
  1376.   IDirect3DDevice9 = interface;
  1377. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1378.   IDirect3DDevice9Ex = interface;
  1379. {$ENDIF}
  1380.   IDirect3DStateBlock9 = interface;
  1381.   IDirect3DVertexDeclaration9 = interface;
  1382.   IDirect3DVertexShader9 = interface;
  1383.   IDirect3DPixelShader9 = interface;
  1384.   IDirect3DResource9 = interface;
  1385.   IDirect3DBaseTexture9 = interface;
  1386.   IDirect3DTexture9 = interface;
  1387.   IDirect3DVolumeTexture9 = interface;
  1388.   IDirect3DCubeTexture9 = interface;
  1389.   IDirect3DVertexBuffer9 = interface;
  1390.   IDirect3DIndexBuffer9 = interface;
  1391.   IDirect3DSurface9 = interface;
  1392.   IDirect3DVolume9 = interface;
  1393.   IDirect3DSwapChain9 = interface;
  1394.   IDirect3DQuery9 = interface;
  1395.   
  1396.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D9);'}
  1397.   {$EXTERNALSYM IDirect3D9}
  1398.   IDirect3D9 = interface(IUnknown)
  1399.     ['{81BDCBCA-64D4-426d-AE8D-AD0147F4275C}']
  1400.     (*** IDirect3D9 methods ***)
  1401.     function RegisterSoftwareDevice(pInitializeFunction: Pointer): HResult; stdcall;
  1402.     function GetAdapterCount: LongWord; stdcall;
  1403.     function GetAdapterIdentifier(Adapter: LongWord; Flags: DWord; out pIdentifier: TD3DAdapterIdentifier9): HResult; stdcall;
  1404.     function GetAdapterModeCount(Adapter: LongWord; Format: TD3DFormat): LongWord; stdcall;
  1405.     function EnumAdapterModes(Adapter: LongWord; Format: TD3DFormat; Mode: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall;
  1406.     function GetAdapterDisplayMode(Adapter: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall;
  1407.     function CheckDeviceType(Adapter: LongWord; CheckType: TD3DDevType; AdapterFormat, BackBufferFormat: TD3DFormat; Windowed: BOOL): HResult; stdcall;
  1408.     function CheckDeviceFormat(Adapter: LongWord; DeviceType: TD3DDevType; AdapterFormat: TD3DFormat; Usage: DWord; RType: TD3DResourceType; CheckFormat: TD3DFormat): HResult; stdcall;
  1409.     function CheckDeviceMultiSampleType(Adapter: LongWord; DeviceType: TD3DDevType; SurfaceFormat: TD3DFormat; Windowed: BOOL; MultiSampleType: TD3DMultiSampleType; pQualityLevels: PDWORD): HResult; stdcall;
  1410.     function CheckDepthStencilMatch(Adapter: LongWord; DeviceType: TD3DDevType; AdapterFormat, RenderTargetFormat, DepthStencilFormat: TD3DFormat): HResult; stdcall;
  1411.     function CheckDeviceFormatConversion(Adapter: LongWord; DeviceType: TD3DDevType; SourceFormat, TargetFormat: TD3DFormat): HResult; stdcall;
  1412.     function GetDeviceCaps(Adapter: LongWord; DeviceType: TD3DDevType; out pCaps: TD3DCaps9): HResult; stdcall;
  1413.     function GetAdapterMonitor(Adapter: LongWord): HMONITOR; stdcall;
  1414.     function CreateDevice(Adapter: LongWord; DeviceType: TD3DDevType; hFocusWindow: HWND; BehaviorFlags: DWord; pPresentationParameters: PD3DPresentParameters; out ppReturnedDeviceInterface: IDirect3DDevice9): HResult; stdcall;
  1415.   end;
  1416.   {$EXTERNALSYM IDirect3D9Helper}
  1417.   IDirect3D9Helper = class
  1418.     (*** helper information ***)
  1419.     szVersionString: PWideChar;
  1420.   end;
  1421. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1422.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3D9Ex);'}
  1423.   {$EXTERNALSYM IDirect3D9Ex}
  1424.   IDirect3D9Ex = interface(IDirect3D9)
  1425.     ['{02177241-69FC-400C-8FF1-93A44DF6861D}']
  1426.     (*** IDirect3D9Ex methods ***)
  1427.     function GetAdapterModeCountEx(Adapter: LongWord; const pFilter: PD3DDisplayModeFilter): LongWord; stdcall;
  1428.     function EnumAdapterModesEx(Adapter: LongWord; const pFilter: PD3DDisplayModeFilter; Mode: LongWord; pMode: PD3DDisplayModeEx): HResult; stdcall;
  1429.     function GetAdapterDisplayModeEx(Adapter: LongWord; pMode: PD3DDisplayModeEx; pRotation: PD3DDisplayRotation): HResult; stdcall;
  1430.     function CreateDeviceEx(Adapter: LongWord; DeviceType: TD3DDevType; hFocusWindow: HWND; BehaviorFlags: DWORD; pPresentationParameters: PD3DPresentParameters; pFullscreenDisplayMode: PD3DDisplayModeEx; out ppReturnedDeviceInterface: IDirect3DDevice9Ex): HResult; stdcall;
  1431.     function GetAdapterLUID(Adapter: LongWord; pLUID: PLargeInteger{*LUID}): HResult; stdcall;
  1432.   end;
  1433. {$ENDIF}
  1434. { SwapChain }
  1435.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice9);'}
  1436.   {$EXTERNALSYM IDirect3DDevice9}
  1437.   IDirect3DDevice9 = interface(IUnknown)
  1438.     ['{D0223B96-BF7A-43fd-92BD-A43B0D82B9EB}']
  1439.     (*** IDirect3DDevice9 methods ***)
  1440.     function TestCooperativeLevel: HResult; stdcall;
  1441.     function GetAvailableTextureMem: LongWord; stdcall;
  1442.     function EvictManagedResources: HResult; stdcall;
  1443.     function GetDirect3D(out ppD3D9: IDirect3D9): HResult; stdcall;
  1444.     function GetDeviceCaps(out pCaps: TD3DCaps9): HResult; stdcall;
  1445.     function GetDisplayMode(iSwapChain: LongWord; out pMode: TD3DDisplayMode): HResult; stdcall;
  1446.     function GetCreationParameters(out pParameters: TD3DDeviceCreationParameters): HResult; stdcall;
  1447.     function SetCursorProperties(XHotSpot, YHotSpot: LongWord; pCursorBitmap: IDirect3DSurface9): HResult; stdcall;
  1448.     procedure SetCursorPosition(XScreenSpace, YScreenSpace: LongWord; Flags: DWord); stdcall;
  1449.     function ShowCursor(bShow: BOOL): BOOL; stdcall;
  1450.     function CreateAdditionalSwapChain(const pPresentationParameters: TD3DPresentParameters; out pSwapChain: IDirect3DSwapChain9): HResult; stdcall;
  1451.     function GetSwapChain(iSwapChain: LongWord; out pSwapChain: IDirect3DSwapChain9): HResult; stdcall;
  1452.     function GetNumberOfSwapChains: LongWord; stdcall;
  1453.     function Reset(const pPresentationParameters: TD3DPresentParameters): HResult; stdcall;
  1454.     function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall;
  1455.     function GetBackBuffer(iSwapChain: LongWord; iBackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface9): HResult; stdcall;
  1456.     function GetRasterStatus(iSwapChain: LongWord; out pRasterStatus: TD3DRasterStatus): HResult; stdcall;
  1457.     function SetDialogBoxMode(bEnableDialogs: BOOL): HResult; stdcall;
  1458.     procedure SetGammaRamp(iSwapChain: LongWord; Flags: DWord; const pRamp: TD3DGammaRamp); stdcall;
  1459.     procedure GetGammaRamp(iSwapChain: LongWord; out pRamp: TD3DGammaRamp); stdcall;
  1460.     function CreateTexture(Width, Height, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppTexture: IDirect3DTexture9; pSharedHandle: PHandle): HResult; stdcall;
  1461.     function CreateVolumeTexture(Width, Height, Depth, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppVolumeTexture: IDirect3DVolumeTexture9; pSharedHandle: PHandle): HResult; stdcall;
  1462.     function CreateCubeTexture(EdgeLength, Levels: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppCubeTexture: IDirect3DCubeTexture9; pSharedHandle: PHandle): HResult; stdcall;
  1463.     function CreateVertexBuffer(Length: LongWord; Usage, FVF: DWord; Pool: TD3DPool; out ppVertexBuffer: IDirect3DVertexBuffer9; pSharedHandle: PHandle): HResult; stdcall;
  1464.     function CreateIndexBuffer(Length: LongWord; Usage: DWord; Format: TD3DFormat; Pool: TD3DPool; out ppIndexBuffer: IDirect3DIndexBuffer9; pSharedHandle: PHandle): HResult; stdcall;
  1465.     function CreateRenderTarget(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; MultisampleQuality: DWORD; Lockable: BOOL; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle): HResult; stdcall;
  1466.     function CreateDepthStencilSurface(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; MultisampleQuality: DWORD; Discard: BOOL; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle): HResult; stdcall;
  1467.     function UpdateSurface(pSourceSurface: IDirect3DSurface9; pSourceRect: PRect; pDestinationSurface: IDirect3DSurface9; pDestPoint: PPoint): HResult; stdcall;
  1468.     function UpdateTexture(pSourceTexture, pDestinationTexture: IDirect3DBaseTexture9): HResult; stdcall;
  1469.     function GetRenderTargetData(pRenderTarget, pDestSurface: IDirect3DSurface9): HResult; stdcall;
  1470.     function GetFrontBufferData(iSwapChain: LongWord; pDestSurface: IDirect3DSurface9): HResult; stdcall;
  1471.     function StretchRect(pSourceSurface: IDirect3DSurface9; pSourceRect: PRect; pDestSurface: IDirect3DSurface9; pDestRect: PRect; Filter: TD3DTextureFilterType): HResult; stdcall;
  1472.     function ColorFill(pSurface: IDirect3DSurface9; pRect: PRect; color: TD3DColor): HResult; stdcall;
  1473.     function CreateOffscreenPlainSurface(Width, Height: LongWord; Format: TD3DFormat; Pool: TD3DPool; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle): HResult; stdcall;
  1474.     function SetRenderTarget(RenderTargetIndex: DWORD; pRenderTarget: IDirect3DSurface9): HResult; stdcall;
  1475.     function GetRenderTarget(RenderTargetIndex: DWORD; out ppRenderTarget: IDirect3DSurface9): HResult; stdcall;
  1476.     function SetDepthStencilSurface(pNewZStencil: IDirect3DSurface9): HResult; stdcall;
  1477.     function GetDepthStencilSurface(out ppZStencilSurface: IDirect3DSurface9): HResult; stdcall;
  1478.     function BeginScene: HResult; stdcall;
  1479.     function EndScene: HResult; stdcall;
  1480.     function Clear(Count: DWord; pRects: PD3DRect; Flags: DWord; Color: TD3DColor; Z: Single; Stencil: DWord): HResult; stdcall;
  1481.     function SetTransform(State: TD3DTransformStateType; const pMatrix: TD3DMatrix): HResult; stdcall;
  1482.     function GetTransform(State: TD3DTransformStateType; out pMatrix: TD3DMatrix): HResult; stdcall;
  1483.     function MultiplyTransform(State: TD3DTransformStateType; const pMatrix: TD3DMatrix): HResult; stdcall;
  1484.     function SetViewport(const pViewport: TD3DViewport9): HResult; stdcall;
  1485.     function GetViewport(out pViewport: TD3DViewport9): HResult; stdcall;
  1486.     function SetMaterial(const pMaterial: TD3DMaterial9): HResult; stdcall;
  1487.     function GetMaterial(out pMaterial: TD3DMaterial9): HResult; stdcall;
  1488.     function SetLight(Index: DWord; const pLight: TD3DLight9): HResult; stdcall;
  1489.     function GetLight(Index: DWord; out pLight: TD3DLight9): HResult; stdcall;
  1490.     function LightEnable(Index: DWord; Enable: BOOL): HResult; stdcall;
  1491.     function GetLightEnable(Index: DWord; out pEnable: BOOL): HResult; stdcall;
  1492.     function SetClipPlane(Index: DWord; pPlane: PSingle): HResult; stdcall;
  1493.     function GetClipPlane(Index: DWord; pPlane: PSingle): HResult; stdcall;
  1494.     function SetRenderState(State: TD3DRenderStateType; Value: DWord): HResult; stdcall;
  1495.     function GetRenderState(State: TD3DRenderStateType; out pValue: DWord): HResult; stdcall;
  1496.     function CreateStateBlock(_Type: TD3DStateBlockType; out ppSB: IDirect3DStateBlock9): HResult; stdcall;
  1497.     function BeginStateBlock: HResult; stdcall;
  1498.     function EndStateBlock(out ppSB: IDirect3DStateBlock9): HResult; stdcall;
  1499.     function SetClipStatus(const pClipStatus: TD3DClipStatus9): HResult; stdcall;
  1500.     function GetClipStatus(out pClipStatus: TD3DClipStatus9): HResult; stdcall;
  1501.     function GetTexture(Stage: DWord; out ppTexture: IDirect3DBaseTexture9): HResult; stdcall;
  1502.     function SetTexture(Stage: DWord; pTexture: IDirect3DBaseTexture9): HResult; stdcall;
  1503.     function GetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; out pValue: DWord): HResult; stdcall;
  1504.     function SetTextureStageState(Stage: DWord; _Type: TD3DTextureStageStateType; Value: DWord): HResult; stdcall;
  1505.     function GetSamplerState(Sampler: DWORD; _Type: TD3DSamplerStateType; out pValue: DWORD): HResult; stdcall;
  1506.     function SetSamplerState(Sampler: DWORD; _Type: TD3DSamplerStateType; Value: DWORD): HResult; stdcall;
  1507.     function ValidateDevice(out pNumPasses: DWord): HResult; stdcall;
  1508.     function SetPaletteEntries(PaletteNumber: LongWord; pEntries: pPaletteEntry): HResult; stdcall;
  1509.     function GetPaletteEntries(PaletteNumber: LongWord; pEntries: pPaletteEntry): HResult; stdcall;
  1510.     function SetCurrentTexturePalette(PaletteNumber: LongWord): HResult; stdcall;
  1511.     function GetCurrentTexturePalette(out PaletteNumber: LongWord): HResult; stdcall;
  1512.     function SetScissorRect(pRect: PRect): HResult; stdcall;
  1513.     function GetScissorRect(out pRect: TRect): HResult; stdcall;
  1514.     function SetSoftwareVertexProcessing(bSoftware: BOOL): HResult; stdcall;
  1515.     function GetSoftwareVertexProcessing: BOOL; stdcall;
  1516.     function SetNPatchMode(nSegments: Single): HResult; stdcall;
  1517.     function GetNPatchMode: Single; stdcall;
  1518.     function DrawPrimitive(PrimitiveType: TD3DPrimitiveType; StartVertex, PrimitiveCount: LongWord): HResult; stdcall;
  1519.     function DrawIndexedPrimitive(_Type: TD3DPrimitiveType; BaseVertexIndex: Integer; MinVertexIndex, NumVertices, startIndex, primCount: LongWord): HResult; stdcall;
  1520.     function DrawPrimitiveUP(PrimitiveType: TD3DPrimitiveType; PrimitiveCount: LongWord; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall;
  1521.     function DrawIndexedPrimitiveUP(PrimitiveType: TD3DPrimitiveType; MinVertexIndex, NumVertice, PrimitiveCount: LongWord; const pIndexData; IndexDataFormat: TD3DFormat; const pVertexStreamZeroData; VertexStreamZeroStride: LongWord): HResult; stdcall;
  1522.     function ProcessVertices(SrcStartIndex, DestIndex, VertexCount: LongWord; pDestBuffer: IDirect3DVertexBuffer9; pVertexDecl: IDirect3DVertexDeclaration9; Flags: DWord): HResult; stdcall;
  1523.     function CreateVertexDeclaration(pVertexElements: PD3DVertexElement9; out ppDecl: IDirect3DVertexDeclaration9): HResult; stdcall;
  1524.     function SetVertexDeclaration(pDecl: IDirect3DVertexDeclaration9): HResult; stdcall;
  1525.     function GetVertexDeclaration(out ppDecl: IDirect3DVertexDeclaration9): HResult; stdcall;
  1526.     function SetFVF(FVF: DWORD): HResult; stdcall;
  1527.     function GetFVF(out FVF: DWORD): HResult; stdcall;
  1528.     function CreateVertexShader(pFunction: PDWord; out ppShader: IDirect3DVertexShader9): HResult; stdcall;
  1529.     function SetVertexShader(pShader: IDirect3DVertexShader9): HResult; stdcall;
  1530.     function GetVertexShader(out ppShader: IDirect3DVertexShader9): HResult; stdcall;
  1531.     function SetVertexShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall;
  1532.     function GetVertexShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall;
  1533.     function SetVertexShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall;
  1534.     function GetVertexShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall;
  1535.     function SetVertexShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall;
  1536.     function GetVertexShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall;
  1537.     function SetStreamSource(StreamNumber: LongWord; pStreamData: IDirect3DVertexBuffer9; OffsetInBytes, Stride: LongWord): HResult; stdcall;
  1538.     function GetStreamSource(StreamNumber: LongWord; out ppStreamData: IDirect3DVertexBuffer9; out pOffsetInBytes, pStride: LongWord): HResult; stdcall;
  1539.     function SetStreamSourceFreq(StreamNumber: LongWord; Setting: LongWord): HResult; stdcall;
  1540.     function GetStreamSourceFreq(StreamNumber: LongWord; out Setting: LongWord): HResult; stdcall;
  1541.     function SetIndices(pIndexData: IDirect3DIndexBuffer9): HResult; stdcall;
  1542.     function GetIndices(out ppIndexData: IDirect3DIndexBuffer9): HResult; stdcall;
  1543.     function CreatePixelShader(pFunction: PDWord; out ppShader: IDirect3DPixelShader9): HResult; stdcall;
  1544.     function SetPixelShader(pShader: IDirect3DPixelShader9): HResult; stdcall;
  1545.     function GetPixelShader(out ppShader: IDirect3DPixelShader9): HResult; stdcall;
  1546.     function SetPixelShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall;
  1547.     function GetPixelShaderConstantF(StartRegister: LongWord; pConstantData: PSingle; Vector4fCount: LongWord): HResult; stdcall;
  1548.     function SetPixelShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall;
  1549.     function GetPixelShaderConstantI(StartRegister: LongWord; pConstantData: PInteger; Vector4iCount: LongWord): HResult; stdcall;
  1550.     function SetPixelShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall;
  1551.     function GetPixelShaderConstantB(StartRegister: LongWord; pConstantData: PBOOL; BoolCount: LongWord): HResult; stdcall;
  1552.     function DrawRectPatch(Handle: LongWord; pNumSegs: PSingle; pTriPatchInfo: PD3DRectPatchInfo): HResult; stdcall;
  1553.     function DrawTriPatch(Handle: LongWord; pNumSegs: PSingle; pTriPatchInfo: PD3DTriPatchInfo): HResult; stdcall;
  1554.     function DeletePatch(Handle: LongWord): HResult; stdcall;
  1555.     function CreateQuery(_Type: TD3DQueryType; out ppQuery: IDirect3DQuery9): HResult; stdcall;
  1556.   end;
  1557.   {$EXTERNALSYM IDirect3DDevice9Helper}
  1558.   IDirect3DDevice9Helper = class
  1559.     (*** helper information ***)
  1560.     CreationParameters: TD3DDeviceCreationParameters;
  1561.     PresentParameters: TD3DPresentParameters;
  1562.     DisplayMode: TD3DDisplayMode;
  1563.     Caps: TD3DCaps9;
  1564.     AvailableTextureMem: LongWord;
  1565.     SwapChains: LongWord;
  1566.     Textures: LongWord;
  1567.     VertexBuffers: LongWord;
  1568.     IndexBuffers: LongWord;
  1569.     VertexShaders: LongWord;
  1570.     PixelShaders: LongWord;
  1571.     Viewport: TD3DViewport9;
  1572.     ProjectionMatrix: TD3DMatrix;
  1573.     ViewMatrix: TD3DMatrix;
  1574.     WorldMatrix: TD3DMatrix;
  1575.     TextureMatrices: array[0..7] of TD3DMatrix;
  1576.     FVF: DWORD;
  1577.     VertexSize: LongWord;
  1578.     VertexShaderVersion: DWORD;
  1579.     PixelShaderVersion: DWORD;
  1580.     SoftwareVertexProcessing: BOOL;
  1581.     Material: TD3DMaterial9;
  1582.     Lights: array[0..15] of  TD3DLight9;
  1583.     LightsEnabled: array[0..15] of BOOL;
  1584.     GammaRamp: TD3DGammaRamp;
  1585.     ScissorRect: TRect;
  1586.     DialogBoxMode: BOOL;
  1587.   end;
  1588. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1589.   PIDirect3DResource9 = ^IDirect3DResource9;
  1590.   {$EXTERNALSYM PIDirect3DResource9}
  1591.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DDevice9Ex);'}
  1592.   {$EXTERNALSYM IDirect3DDevice9Ex}
  1593.   IDirect3DDevice9Ex = interface(IDirect3DDevice9)
  1594.     ['{B18B10CE-2649-405a-870F-95F777D4313A}']
  1595.     (*** IDirect3DDevice9Ex methods ***)
  1596.     function SetConvolutionMonoKernel(Width, Height: LongWord; rows, columns: PSingle): HResult; stdcall;
  1597.     function ComposeRects(pSrc, pDst: IDirect3DSurface9; pSrcRectDescs: IDirect3DVertexBuffer9; NumRects: LongWord; pDstRectDescs: IDirect3DVertexBuffer9; Operation: TD3DComposeRectsOp; Xoffset, Yoffset: Integer): HResult; stdcall;
  1598.     function PresentEx(const pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; const pDirtyRegion: PRgnData; dwFlags: DWORD): HResult; stdcall;
  1599.     function GetGPUThreadPriority(out pPriority: Integer): HResult; stdcall;
  1600.     function SetGPUThreadPriority(Priority: Integer): HResult; stdcall;
  1601.     function WaitForVBlank(iSwapChain: LongWord): HResult; stdcall;
  1602.     function CheckResourceResidency(pResourceArray: PIDirect3DResource9; NumResources: LongWord): HResult; stdcall;
  1603.     function SetMaximumFrameLatency(MaxLatency: LongWord): HResult; stdcall;
  1604.     function GetMaximumFrameLatency(out pMaxLatency: LongWord): HResult; stdcall;
  1605.     function CheckDeviceState(hDestinationWindow: HWND): HResult; stdcall;
  1606.     function CreateRenderTargetEx(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; MultisampleQuality: DWORD; Lockable: BOOL; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle; Usage: DWORD): HResult; stdcall;
  1607.     function CreateOffscreenPlainSurfaceEx(Width, Height: LongWord; Format: TD3DFormat; Pool: TD3DPool; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle; Usage: DWORD): HResult; stdcall;
  1608.     function CreateDepthStencilSurfaceEx(Width, Height: LongWord; Format: TD3DFormat; MultiSample: TD3DMultiSampleType; MultisampleQuality: DWORD; Discard: BOOL; out ppSurface: IDirect3DSurface9; pSharedHandle: PHandle; Usage: DWORD): HResult; stdcall;
  1609.     function ResetEx(const pPresentationParameters: TD3DPresentParameters; const pFullscreenDisplayMode: TD3DDisplayModeEx): HResult; stdcall;
  1610.     function GetDisplayModeEx(iSwapChain: LongWord; pMode: PD3DDisplayModeEx; pRotation: PD3DDisplayRotation): HResult; stdcall;
  1611.   end;
  1612. {$ENDIF}
  1613.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DStateBlock9);'}
  1614.   {$EXTERNALSYM IDirect3DStateBlock9}
  1615.   IDirect3DStateBlock9 = interface(IUnknown)
  1616.     ['{B07C4FE5-310D-4ba8-A23C-4F0F206F218B}']
  1617.      (*** IDirect3DStateBlock9 methods ***)
  1618.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1619.     function Capture: HResult; stdcall;
  1620.     function Apply: HResult; stdcall;
  1621.   end;
  1622.   {$EXTERNALSYM IDirect3DStateBlock9Helper}
  1623.   IDirect3DStateBlock9Helper = class
  1624.     (*** helper information ***)
  1625.     CreationCallStack: PWideChar;
  1626.   end;
  1627.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSwapChain9);'}
  1628.   {$EXTERNALSYM IDirect3DSwapChain9}
  1629.   IDirect3DSwapChain9 = interface(IUnknown)
  1630.     ['{794950F2-ADFC-458a-905E-10A10B0B503B}']
  1631.     (*** IDirect3DSwapChain9 methods ***)
  1632.     function Present(pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData; dwFlags: DWORD): HResult; stdcall;
  1633.     function GetFrontBufferData(pDestSurface: IDirect3DSurface9): HResult; stdcall;
  1634.     function GetBackBuffer(iBackBuffer: LongWord; _Type: TD3DBackBufferType; out ppBackBuffer: IDirect3DSurface9): HResult; stdcall;
  1635.     function GetRasterStatus(out pRasterStatus: TD3DRasterStatus): HResult; stdcall;
  1636.     function GetDisplayMode(out pMode: TD3DDisplayMode): HResult; stdcall;
  1637.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1638.     function GetPresentParameters(out pPresentationParameters: TD3DPresentParameters): HResult; stdcall;
  1639.   end;
  1640.   {$EXTERNALSYM IDirect3DSwapChain9Helper}
  1641.   IDirect3DSwapChain9Helper = class
  1642.     (*** helper information ***)
  1643.     PresentParameters: TD3DPresentParameters;
  1644.     DisplayMode: TD3DDisplayMode;
  1645.     CreationCallStack: PWideChar;
  1646.   end;
  1647. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1648.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSwapChain9Ex);'}
  1649.   {$EXTERNALSYM IDirect3DSwapChain9Ex}
  1650.   IDirect3DSwapChain9Ex = interface(IDirect3DSwapChain9)
  1651.     ['{91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303}']
  1652.     (*** IDirect3DSwapChain9Ex methods ***)
  1653.     function GetLastPresentCount(out pLastPresentCount: LongWord): HResult; stdcall;
  1654.     function GetPresentStats(out pPresentationStatistics: TD3DPresentStats): HResult; stdcall;
  1655.     function GetDisplayModeEx(pMode: PD3DDisplayModeEx; pRotation: PD3DDisplayRotation): HResult; stdcall;
  1656.   end;
  1657. {$ENDIF}
  1658.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DResource9);'}
  1659.   {$EXTERNALSYM IDirect3DResource9}
  1660.   IDirect3DResource9 = interface(IUnknown)
  1661.     ['{05EEC05D-8F7D-4362-B999-D1BAF357C704}']
  1662.     (*** IDirect3DResource9 methods ***)
  1663.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1664.     function SetPrivateData(const refguid: TGUID; const pData: Pointer; SizeOfData, Flags: DWord): HResult; stdcall;
  1665.     function GetPrivateData(const refguid: TGUID; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall;
  1666.     function FreePrivateData(const refguid: TGUID): HResult; stdcall;
  1667.     function SetPriority(PriorityNew: DWord): DWord; stdcall;
  1668.     function GetPriority: DWord; stdcall;
  1669.     procedure PreLoad; stdcall;
  1670.     function GetType: TD3DResourceType; stdcall;
  1671.   end;
  1672.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexDeclaration9);'}
  1673.   {$EXTERNALSYM IDirect3DVertexDeclaration9}
  1674.   IDirect3DVertexDeclaration9 = interface(IUnknown)
  1675.     ['{DD13C59C-36FA-4098-A8FB-C7ED39DC8546}']
  1676.     (*** IDirect3DVertexDeclaration9 methods ***)
  1677.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1678.     function GetDeclaration(pElement: PD3DVertexElement9; out pNumElements: LongWord): HResult; stdcall;
  1679.   end;
  1680.   {$EXTERNALSYM IDirect3DVertexDeclaration9Helper}
  1681.   IDirect3DVertexDeclaration9Helper = class
  1682.     (*** helper information ***)
  1683.     CreationCallStack: PWideChar;
  1684.   end;
  1685.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexShader9);'}
  1686.   {$EXTERNALSYM IDirect3DVertexShader9}
  1687.   IDirect3DVertexShader9 = interface(IUnknown)
  1688.     ['{EFC5557E-6265-4613-8A94-43857889EB36}']
  1689.     (*** IDirect3DVertexShader9 methods ***)
  1690.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1691.     function GetFunction(pData: Pointer; out pSizeOfData: LongWord): HResult; stdcall;
  1692.   end;
  1693.   {$EXTERNALSYM IDirect3DVertexShader9Helper}
  1694.   IDirect3DVertexShader9Helper = class
  1695.     (*** helper information ***)
  1696.     Version: DWORD;
  1697.     CreationCallStack: PWideChar;
  1698.   end;
  1699.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DPixelShader9);'}
  1700.   {$EXTERNALSYM IDirect3DPixelShader9}
  1701.   IDirect3DPixelShader9 = interface(IUnknown)
  1702.     ['{6D3BDBDC-5B02-4415-B852-CE5E8BCCB289}']
  1703.     (*** IDirect3DPixelShader9 methods ***)
  1704.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1705.     function GetFunction(pData: Pointer; out pSizeOfData: LongWord): HResult; stdcall;
  1706.   end;
  1707.   {$EXTERNALSYM IDirect3DPixelShader9Helper}
  1708.   IDirect3DPixelShader9Helper = class
  1709.     (*** helper information ***)
  1710.     Version: DWORD;
  1711.     CreationCallStack: PWideChar;
  1712.   end;
  1713.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DBaseTexture9);'}
  1714.   {$EXTERNALSYM IDirect3DBaseTexture9}
  1715.   IDirect3DBaseTexture9 = interface(IDirect3DResource9)
  1716.     ['{580CA87E-1D3C-4d54-991D-B7D3E3C298CE}']
  1717.     (*** IDirect3DBaseTexture9 methods ***)
  1718.     function SetLOD(LODNew: DWord): DWord; stdcall;
  1719.     function GetLOD: DWord; stdcall;
  1720.     function GetLevelCount: DWord; stdcall;
  1721.     function SetAutoGenFilterType(FilterType: TD3DTextureFilterType): HResult; stdcall;
  1722.     function GetAutoGenFilterType: TD3DTextureFilterType; stdcall;
  1723.     procedure GenerateMipSubLevels; stdcall;
  1724.   end;
  1725.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DTexture9);'}
  1726.   {$EXTERNALSYM IDirect3DTexture9}
  1727.   IDirect3DTexture9 = interface(IDirect3DBaseTexture9)
  1728.     ['{85C31227-3DE5-4f00-9B3A-F11AC38C18B5}']
  1729.     (*** IDirect3DTexture9 methods ***)
  1730.     function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall;
  1731.     function GetSurfaceLevel(Level: LongWord; out ppSurfaceLevel: IDirect3DSurface9): HResult; stdcall;
  1732.     function LockRect(Level: LongWord; out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall;
  1733.     function UnlockRect(Level: LongWord): HResult; stdcall;
  1734.     function AddDirtyRect(pDirtyRect: PRect): HResult; stdcall;
  1735.   end;
  1736.   {$EXTERNALSYM IDirect3DTexture9Helper}
  1737.   IDirect3DTexture9Helper = class
  1738.     (*** helper information ***)
  1739.     Name: PWideChar;
  1740.     Width: LongWord;
  1741.     Height: LongWord;
  1742.     Levels: LongWord;
  1743.     Usage: DWORD;
  1744.     Format: TD3DFormat;
  1745.     Pool: TD3DPool;
  1746.     Priority: DWORD;
  1747.     LOD: DWORD;
  1748.     FilterType: TD3DTextureFilterType;
  1749.     LockCount: LongWord;
  1750.     CreationCallStack: PWideChar;
  1751.   end;
  1752.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolumeTexture9);'}
  1753.   {$EXTERNALSYM IDirect3DVolumeTexture9}
  1754.   IDirect3DVolumeTexture9 = interface(IDirect3DBaseTexture9)
  1755.     ['{2518526C-E789-4111-A7B9-47EF328D13E6}']
  1756.     (*** IDirect3DVolumeTexture9 methods ***)
  1757.     function GetLevelDesc(Level: LongWord; out pDesc: TD3DVolumeDesc): HResult; stdcall;
  1758.     function GetVolumeLevel(Level: LongWord; out ppVolumeLevel: IDirect3DVolume9): HResult; stdcall;
  1759.     function LockBox(Level: LongWord; out pLockedVolume: TD3DLockedBox; pBox: PD3DBox; Flags: DWord): HResult; stdcall;
  1760.     function UnlockBox(Level: LongWord): HResult; stdcall;
  1761.     function AddDirtyBox(pDirtyBox: PD3DBox): HResult; stdcall;
  1762.   end;
  1763.   {$EXTERNALSYM IDirect3DVolumeTexture9Helper}
  1764.   IDirect3DVolumeTexture9Helper = class
  1765.     (*** helper information ***)
  1766.     Name: PWideChar;
  1767.     Width: LongWord;
  1768.     Height: LongWord;
  1769.     Depth: LongWord;
  1770.     Levels: LongWord;
  1771.     Usage: DWORD;
  1772.     Format: TD3DFormat;
  1773.     Pool: TD3DPool;
  1774.     Priority: DWORD;
  1775.     LOD: DWORD;
  1776.     FilterType: TD3DTextureFilterType;
  1777.     LockCount: LongWord;
  1778.     CreationCallStack: PWideChar;
  1779.   end;
  1780.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DCubeTexture9);'}
  1781.   {$EXTERNALSYM IDirect3DCubeTexture9}
  1782.   IDirect3DCubeTexture9 = interface(IDirect3DBaseTexture9)
  1783.     ['{FFF32F81-D953-473a-9223-93D652ABA93F}']
  1784.     (*** IDirect3DCubeTexture9 methods ***)
  1785.     function GetLevelDesc(Level: LongWord; out pDesc: TD3DSurfaceDesc): HResult; stdcall;
  1786.     function GetCubeMapSurface(FaceType: TD3DCubeMapFaces; Level: LongWord; out ppCubeMapSurface: IDirect3DSurface9): HResult; stdcall;
  1787.     function LockRect(FaceType: TD3DCubeMapFaces; Level: LongWord; out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall;
  1788.     function UnlockRect(FaceType: TD3DCubeMapFaces; Level: LongWord): HResult; stdcall;
  1789.     function AddDirtyRect(FaceType: TD3DCubeMapFaces; pDirtyRect: PRect): HResult; stdcall;
  1790.   end;
  1791.   {$EXTERNALSYM IDirect3DCubeTexture9Helper}
  1792.   IDirect3DCubeTexture9Helper = class
  1793.     (*** helper information ***)
  1794.     Name: PWideChar;
  1795.     Width: LongWord;
  1796.     Height: LongWord;
  1797.     Depth: LongWord;
  1798.     Levels: LongWord;
  1799.     Usage: DWORD;
  1800.     Format: TD3DFormat;
  1801.     Pool: TD3DPool;
  1802.     Priority: DWORD;
  1803.     LOD: DWORD;
  1804.     FilterType: TD3DTextureFilterType;
  1805.     LockCount: LongWord;
  1806.     CreationCallStack: PWideChar;
  1807.   end;
  1808.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVertexBuffer9);'}
  1809.   {$EXTERNALSYM IDirect3DVertexBuffer9}
  1810.   IDirect3DVertexBuffer9 = interface(IDirect3DResource9)
  1811.     ['{B64BB1B5-FD70-4df6-BF91-19D0A12455E3}']
  1812.     (*** IDirect3DVertexBuffer9 methods ***)
  1813.     function Lock(OffsetToLock, SizeToLock: LongWord; out ppbData: Pointer; Flags: DWord): HResult; stdcall;
  1814.     function Unlock: HResult; stdcall;
  1815.     function GetDesc(out pDesc: TD3DVertexBufferDesc): HResult; stdcall;
  1816.   end;
  1817.   {$EXTERNALSYM IDirect3DVertexBuffer9Helper}
  1818.   IDirect3DVertexBuffer9Helper = class
  1819.     (*** helper information ***)
  1820.     Name: PWideChar;
  1821.     Length: LongWord;
  1822.     Usage: DWORD;
  1823.     FVF: DWORD;
  1824.     Pool: TD3DPool;
  1825.     Priority: DWORD;
  1826.     LockCount: LongWord;
  1827.     CreationCallStack: PWideChar;
  1828.   end;
  1829.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DIndexBuffer9);'}
  1830.   {$EXTERNALSYM IDirect3DIndexBuffer9}
  1831.   IDirect3DIndexBuffer9 = interface(IDirect3DResource9)
  1832.     ['{7C9DD65E-D3F7-4529-ACEE-785830ACDE35}']
  1833.     (*** IDirect3DIndexBuffer9 methods ***)
  1834.     function Lock(OffsetToLock, SizeToLock: DWord; out ppbData: Pointer; Flags: DWord): HResult; stdcall;
  1835.     function Unlock: HResult; stdcall;
  1836.     function GetDesc(out pDesc: TD3DIndexBufferDesc): HResult; stdcall;
  1837.   end;
  1838.   {$EXTERNALSYM IDirect3DIndexBuffer9Helper}
  1839.   IDirect3DIndexBuffer9Helper = class
  1840.     (*** helper information ***)
  1841.     Name: PWideChar;
  1842.     Length: LongWord;
  1843.     Usage: DWORD;
  1844.     Format: TD3DFormat;
  1845.     Pool: TD3DPool;
  1846.     Priority: DWORD;
  1847.     LockCount: LongWord;
  1848.     CreationCallStack: PWideChar;
  1849.   end;
  1850.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DSurface9);'}
  1851.   {$EXTERNALSYM IDirect3DSurface9}
  1852.   IDirect3DSurface9 = interface(IDirect3DResource9)
  1853.     ['{0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B}']
  1854.     (*** IDirect3DSurface9 methods ***)
  1855.     function GetContainer(const riid: TGUID; out ppContainer{: Pointer}): HResult; stdcall;
  1856.     function GetDesc(out pDesc: TD3DSurfaceDesc): HResult; stdcall;
  1857.     function LockRect(out pLockedRect: TD3DLockedRect; pRect: PRect; Flags: DWord): HResult; stdcall;
  1858.     function UnlockRect: HResult; stdcall;
  1859.     function GetDC(out phdc: HDC): HResult; stdcall;
  1860.     function ReleaseDC(hdc: HDC): HResult; stdcall;
  1861.   end;
  1862.   {$EXTERNALSYM IDirect3DSurface9Helper}
  1863.   IDirect3DSurface9Helper = class
  1864.     (*** helper information ***)
  1865.     Name: PWideChar;
  1866.     Width: LongWord;
  1867.     Height: LongWord;
  1868.     Usage: DWORD;
  1869.     Format: TD3DFormat;
  1870.     Pool: TD3DPool;
  1871.     MultiSampleType: TD3DMultiSampleType;
  1872.     MultiSampleQuality: DWORD;
  1873.     Priority: DWORD;
  1874.     LockCount: LongWord;
  1875.     DCCount: LongWord;
  1876.     CreationCallStack: PWideChar;
  1877.   end;
  1878.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DVolume9);'}
  1879.   {$EXTERNALSYM IDirect3DVolume9}
  1880.   IDirect3DVolume9 = interface (IUnknown)
  1881.     ['{24F416E6-1F67-4aa7-B88E-D33F6F3128A1}']
  1882.     (*** IDirect3DVolume9 methods ***)
  1883.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1884.     function SetPrivateData(const refguid: TGUID; const pData; SizeOfData, Flags: DWord): HResult; stdcall;
  1885.     function GetPrivateData(const refguid: TGUID; pData: Pointer; out pSizeOfData: DWord): HResult; stdcall;
  1886.     function FreePrivateData(const refguid: TGUID): HResult; stdcall;
  1887.     function GetContainer(const riid: TGUID; var ppContainer: Pointer): HResult; stdcall;
  1888.     function GetDesc(out pDesc: TD3DVolumeDesc): HResult; stdcall;
  1889.     function LockBox(out pLockedVolume: TD3DLockedBox; pBox: PD3DBox; Flags: DWord): HResult; stdcall;
  1890.     function UnlockBox: HResult; stdcall;
  1891.   end;
  1892.   {$EXTERNALSYM IDirect3DVolume9Helper}
  1893.   IDirect3DVolume9Helper = class
  1894.     (*** helper information ***)
  1895.     Name: PWideChar;
  1896.     Width: LongWord;
  1897.     Height: LongWord;
  1898.     Depth: LongWord;
  1899.     Usage: DWORD;
  1900.     Format: TD3DFormat;
  1901.     Pool: TD3DPool;
  1902.     LockCount: LongWord;
  1903.     CreationCallStack: PWideChar;
  1904.   end;
  1905.   {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirect3DQuery9);'}
  1906.   {$EXTERNALSYM IDirect3DQuery9}
  1907.   IDirect3DQuery9 = interface(IUnknown)
  1908.     ['{d9771460-a695-4f26-bbd3-27b840b541cc}']
  1909.     (*** IDirect3DQuery9 methods ***)
  1910.     function GetDevice(out ppDevice: IDirect3DDevice9): HResult; stdcall;
  1911.     function GetType: TD3DQueryType; stdcall;
  1912.     function GetDataSize: DWORD; stdcall;
  1913.     function Issue(dwIssueFlags: DWORD): HResult; stdcall;
  1914.     function GetData(pData: Pointer; dwSize: DWORD; dwGetDataFlags: DWORD): HResult; stdcall;
  1915.   end;
  1916.   {$EXTERNALSYM IDirect3DQuery9Helper}
  1917.   IDirect3DQuery9Helper = class
  1918.     (*** helper information ***)
  1919.     _Type: TD3DQueryType;
  1920.     DataSize: DWORD;
  1921.     CreationCallStack: PWideChar;
  1922.   end;
  1923. (*
  1924.  * Interface IID's
  1925.  *)
  1926. type
  1927.   IID_IDirect3D9              = IDirect3D9;
  1928.   {$EXTERNALSYM IID_IDirect3D9}
  1929. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1930.   IID_IDirect3D9Ex            = IDirect3D9Ex;
  1931.   {$EXTERNALSYM IID_IDirect3D9Ex}
  1932. {$ENDIF}
  1933.   IID_IDirect3DDevice9        = IDirect3DDevice9;
  1934.   {$EXTERNALSYM IID_IDirect3DDevice9}
  1935. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1936.   IID_IDirect3DDevice9Ex      = IDirect3DDevice9Ex;
  1937.   {$EXTERNALSYM IID_IDirect3DDevice9Ex}
  1938. {$ENDIF}
  1939.   IID_IDirect3DResource9      = IDirect3DResource9;
  1940.   {$EXTERNALSYM IID_IDirect3DResource9}
  1941.   IID_IDirect3DBaseTexture9   = IDirect3DBaseTexture9;
  1942.   {$EXTERNALSYM IID_IDirect3DBaseTexture9}
  1943.   IID_IDirect3DTexture9       = IDirect3DTexture9;
  1944.   {$EXTERNALSYM IID_IDirect3DTexture9}
  1945.   IID_IDirect3DCubeTexture9   = IDirect3DCubeTexture9;
  1946.   {$EXTERNALSYM IID_IDirect3DCubeTexture9}
  1947.   IID_IDirect3DVolumeTexture9 = IDirect3DVolumeTexture9;
  1948.   {$EXTERNALSYM IID_IDirect3DVolumeTexture9}
  1949.   IID_IDirect3DVertexBuffer9  = IDirect3DVertexBuffer9;
  1950.   {$EXTERNALSYM IID_IDirect3DVertexBuffer9}
  1951.   IID_IDirect3DIndexBuffer9   = IDirect3DIndexBuffer9;
  1952.   {$EXTERNALSYM IID_IDirect3DIndexBuffer9}
  1953.   IID_IDirect3DSurface9       = IDirect3DSurface9;
  1954.   {$EXTERNALSYM IID_IDirect3DSurface9}
  1955.   IID_IDirect3DVolume9        = IDirect3DVolume9;
  1956.   {$EXTERNALSYM IID_IDirect3DVolume9}
  1957.   IID_IDirect3DSwapChain9     = IDirect3DSwapChain9;
  1958.   {$EXTERNALSYM IID_IDirect3DSwapChain9}
  1959. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  1960.   IID_IDirect3DSwapChain9Ex   = IDirect3DSwapChain9Ex;
  1961.   {$EXTERNALSYM IID_IDirect3DSwapChain9Ex}
  1962. {$ENDIF}
  1963.   IID_IDirect3DVertexDeclaration9 = IDirect3DVertexDeclaration9;
  1964.   {$EXTERNALSYM IID_IDirect3DVertexDeclaration9}
  1965.   IID_IDirect3DVertexShader9  = IDirect3DVertexShader9;
  1966.   {$EXTERNALSYM IID_IDirect3DVertexShader9}
  1967.   IID_IDirect3DPixelShader9   = IDirect3DPixelShader9;
  1968.   {$EXTERNALSYM IID_IDirect3DPixelShader9}
  1969.   IID_IDirect3DStateBlock9    = IDirect3DStateBlock9;
  1970.   {$EXTERNALSYM IID_IDirect3DStateBlock9}
  1971.   IID_IDirect3DQuery9         = IDirect3DQuery9;
  1972.   {$EXTERNALSYM IID_IDirect3DQuery9}
  1973. const
  1974.   IID_HelperName : TGUID = '{E4A36723-FDFE-4b22-B146-3C04C07F4CC8}';
  1975.   {$EXTERNALSYM IID_HelperName}
  1976. const
  1977. {****************************************************************************
  1978.  * Flags for SetPrivateData method on all D3D9 interfaces
  1979.  *
  1980.  * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData
  1981.  * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this
  1982.  * pointer and Release when the private data is destroyed. The data will be
  1983.  * destroyed when another SetPrivateData with the same GUID is set, when
  1984.  * FreePrivateData is called, or when the D3D9 object is freed.
  1985.  ****************************************************************************}
  1986.   D3DSPD_IUNKNOWN                         = $00000001;
  1987.   {$EXTERNALSYM D3DSPD_IUNKNOWN}
  1988. (****************************************************************************
  1989.  *
  1990.  * Flags for IDirect3D9::CreateDevice's BehaviorFlags
  1991.  *
  1992.  ****************************************************************************)
  1993.   D3DCREATE_FPU_PRESERVE                  = $00000002;
  1994.   {$EXTERNALSYM D3DCREATE_FPU_PRESERVE}
  1995.   D3DCREATE_MULTITHREADED                 = $00000004;
  1996.   {$EXTERNALSYM D3DCREATE_MULTITHREADED}
  1997.   D3DCREATE_PUREDEVICE                    = $00000010;
  1998.   {$EXTERNALSYM D3DCREATE_PUREDEVICE}
  1999.   D3DCREATE_SOFTWARE_VERTEXPROCESSING     = $00000020;
  2000.   {$EXTERNALSYM D3DCREATE_SOFTWARE_VERTEXPROCESSING}
  2001.   D3DCREATE_HARDWARE_VERTEXPROCESSING     = $00000040;
  2002.   {$EXTERNALSYM D3DCREATE_HARDWARE_VERTEXPROCESSING}
  2003.   D3DCREATE_MIXED_VERTEXPROCESSING        = $00000080;
  2004.   {$EXTERNALSYM D3DCREATE_MIXED_VERTEXPROCESSING}
  2005.   D3DCREATE_DISABLE_DRIVER_MANAGEMENT     = $00000100;
  2006.   {$EXTERNALSYM D3DCREATE_DISABLE_DRIVER_MANAGEMENT}
  2007.   D3DCREATE_ADAPTERGROUP_DEVICE           = $00000200;
  2008.   {$EXTERNALSYM D3DCREATE_ADAPTERGROUP_DEVICE}
  2009.   D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX  = $00000400;
  2010.   {$EXTERNALSYM D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX}
  2011.   // This flag causes the D3D runtime not to alter the focus
  2012.   // window in any way. Use with caution- the burden of supporting
  2013.   // focus management events (alt-tab, etc.) falls on the
  2014.   // application, and appropriate responses (switching display
  2015.   // mode, etc.) should be coded.
  2016.   D3DCREATE_NOWINDOWCHANGES               = $00000800;
  2017.   {$EXTERNALSYM D3DCREATE_NOWINDOWCHANGES}
  2018. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2019.   // Disable multithreading for software vertex processing
  2020.   D3DCREATE_DISABLE_PSGP_THREADING        = $00002000;
  2021.   {$EXTERNALSYM D3DCREATE_DISABLE_PSGP_THREADING}
  2022.   // This flag enables present statistics on device.
  2023.   D3DCREATE_ENABLE_PRESENTSTATS           = $00004000;
  2024.   {$EXTERNALSYM D3DCREATE_ENABLE_PRESENTSTATS}
  2025.   // This flag disables printscreen support in the runtime for this device
  2026.   D3DCREATE_DISABLE_PRINTSCREEN           = $00008000;
  2027.   {$EXTERNALSYM D3DCREATE_DISABLE_PRINTSCREEN}
  2028.   D3DCREATE_SCREENSAVER                   = $10000000;
  2029.   {$EXTERNALSYM D3DCREATE_SCREENSAVER}
  2030. {$ENDIF}
  2031. (****************************************************************************
  2032.  *
  2033.  * Parameter for IDirect3D9::CreateDevice's Adapter argument
  2034.  *
  2035.  ****************************************************************************)
  2036.   D3DADAPTER_DEFAULT                      = 0;
  2037.   {$EXTERNALSYM D3DADAPTER_DEFAULT}
  2038. (****************************************************************************
  2039.  *
  2040.  * Flags for IDirect3D9::EnumAdapters
  2041.  *
  2042.  ****************************************************************************)
  2043. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2044. (*
  2045.  * The D3DENUM_WHQL_LEVEL value has been retired for this and future versions.
  2046.  * See the DirectX SDK for sample code on discovering driver signatures.
  2047.  *)
  2048. (* NO_DRIVERVERSION will not fill out the DriverVersion field, nor will the
  2049.    DriverVersion be incorporated into the DeviceIdentifier GUID. WINNT only *)
  2050.   D3DENUM_NO_DRIVERVERSION                = $00000004;
  2051.   {$EXTERNALSYM D3DENUM_NO_DRIVERVERSION}
  2052. {$ELSE}
  2053.   D3DENUM_WHQL_LEVEL                      = $00000002;
  2054.   {$EXTERNALSYM D3DENUM_WHQL_LEVEL}
  2055. {$ENDIF}
  2056. (****************************************************************************
  2057.  *
  2058.  * Maximum number of back-buffers supported in DX9
  2059.  *
  2060.  ****************************************************************************)
  2061.   D3DPRESENT_BACK_BUFFERS_MAX             = 3;
  2062.   {$EXTERNALSYM D3DPRESENT_BACK_BUFFERS_MAX}
  2063. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2064. (****************************************************************************
  2065.  *
  2066.  * Maximum number of back-buffers supported when apps use CreateDeviceEx
  2067.  *
  2068.  ****************************************************************************)
  2069.   D3DPRESENT_BACK_BUFFERS_MAX_EX          = 30;
  2070.   {$EXTERNALSYM D3DPRESENT_BACK_BUFFERS_MAX_EX}
  2071. {$ENDIF}
  2072. (****************************************************************************
  2073.  *
  2074.  * Flags for IDirect3DDevice9::SetGammaRamp
  2075.  *
  2076.  ****************************************************************************)
  2077.   D3DSGR_NO_CALIBRATION                  = $00000000;
  2078.   {$EXTERNALSYM D3DSGR_NO_CALIBRATION}
  2079.   D3DSGR_CALIBRATE                       = $00000001;
  2080.   {$EXTERNALSYM D3DSGR_CALIBRATE}
  2081. (****************************************************************************
  2082.  *
  2083.  * Flags for IDirect3DDevice9::SetCursorPosition
  2084.  *
  2085.  ****************************************************************************)
  2086.   D3DCURSOR_IMMEDIATE_UPDATE             = $00000001;
  2087.   {$EXTERNALSYM D3DCURSOR_IMMEDIATE_UPDATE}
  2088. (****************************************************************************
  2089.  *
  2090.  * Flags for IDirect3DSwapChain9::Present
  2091.  *
  2092.  ****************************************************************************)
  2093.   D3DPRESENT_DONOTWAIT                   = $00000001;
  2094.   {$EXTERNALSYM D3DPRESENT_DONOTWAIT}
  2095.   D3DPRESENT_LINEAR_CONTENT              = $00000002;
  2096.   {$EXTERNALSYM D3DPRESENT_LINEAR_CONTENT}
  2097. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2098.   D3DPRESENT_DONOTFLIP                   = $00000004;
  2099.   {$EXTERNALSYM D3DPRESENT_DONOTFLIP}
  2100.   D3DPRESENT_FLIPRESTART                 = $00000008;
  2101.   {$EXTERNALSYM D3DPRESENT_FLIPRESTART}
  2102. {$ENDIF}
  2103. (****************************************************************************
  2104.  *
  2105.  * Flags for DrawPrimitive/DrawIndexedPrimitive
  2106.  *   Also valid for Begin/BeginIndexed
  2107.  *   Also valid for VertexBuffer::CreateVertexBuffer
  2108.  ****************************************************************************)
  2109. (*
  2110.  *  DirectDraw error codes
  2111.  *)
  2112.   _FACD3D = $876;
  2113.   {$EXTERNALSYM _FACD3D}
  2114. //#define MAKE_D3DHRESULT( code )  MAKE_HRESULT( 1, _FACD3D, code )
  2115. function MAKE_D3DHRESULT(Code: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF}
  2116. {$EXTERNALSYM MAKE_D3DHRESULT}
  2117. //#define MAKE_D3DSTATUS( code )  MAKE_HRESULT( 0, _FACD3D, code )
  2118. function MAKE_D3DSTATUS(Code: DWord): DWord;{$IFDEF SUPPORTS_INLINE} inline;{$ENDIF}
  2119. {$EXTERNALSYM MAKE_D3DSTATUS}
  2120. const
  2121.   MAKE_D3DHRESULT_R     = (1 shl 31) or (_FACD3D shl 16);
  2122.   MAKE_D3DSTATUS_R      = (0 shl 31) or (_FACD3D shl 16);
  2123. (*
  2124.  * Direct3D Errors
  2125.  *)
  2126.   D3D_OK                                  = S_OK;
  2127.   {$EXTERNALSYM D3D_OK}
  2128.   D3DERR_WRONGTEXTUREFORMAT               = HResult(MAKE_D3DHRESULT_R or 2072);
  2129.   {$EXTERNALSYM D3DERR_WRONGTEXTUREFORMAT}
  2130.   D3DERR_UNSUPPORTEDCOLOROPERATION        = HResult(MAKE_D3DHRESULT_R or 2073);
  2131.   {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLOROPERATION}
  2132.   D3DERR_UNSUPPORTEDCOLORARG              = HResult(MAKE_D3DHRESULT_R or 2074);
  2133.   {$EXTERNALSYM D3DERR_UNSUPPORTEDCOLORARG}
  2134.   D3DERR_UNSUPPORTEDALPHAOPERATION        = HResult(MAKE_D3DHRESULT_R or 2075);
  2135.   {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAOPERATION}
  2136.   D3DERR_UNSUPPORTEDALPHAARG              = HResult(MAKE_D3DHRESULT_R or 2076);
  2137.   {$EXTERNALSYM D3DERR_UNSUPPORTEDALPHAARG}
  2138.   D3DERR_TOOMANYOPERATIONS                = HResult(MAKE_D3DHRESULT_R or 2077);
  2139.   {$EXTERNALSYM D3DERR_TOOMANYOPERATIONS}
  2140.   D3DERR_CONFLICTINGTEXTUREFILTER         = HResult(MAKE_D3DHRESULT_R or 2078);
  2141.   {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREFILTER}
  2142.   D3DERR_UNSUPPORTEDFACTORVALUE           = HResult(MAKE_D3DHRESULT_R or 2079);
  2143.   {$EXTERNALSYM D3DERR_UNSUPPORTEDFACTORVALUE}
  2144.   D3DERR_CONFLICTINGRENDERSTATE           = HResult(MAKE_D3DHRESULT_R or 2081);
  2145.   {$EXTERNALSYM D3DERR_CONFLICTINGRENDERSTATE}
  2146.   D3DERR_UNSUPPORTEDTEXTUREFILTER         = HResult(MAKE_D3DHRESULT_R or 2082);
  2147.   {$EXTERNALSYM D3DERR_UNSUPPORTEDTEXTUREFILTER}
  2148.   D3DERR_CONFLICTINGTEXTUREPALETTE        = HResult(MAKE_D3DHRESULT_R or 2086);
  2149.   {$EXTERNALSYM D3DERR_CONFLICTINGTEXTUREPALETTE}
  2150.   D3DERR_DRIVERINTERNALERROR              = HResult(MAKE_D3DHRESULT_R or 2087);
  2151.   {$EXTERNALSYM D3DERR_DRIVERINTERNALERROR}
  2152.   D3DERR_NOTFOUND                         = HResult(MAKE_D3DHRESULT_R or 2150);
  2153.   {$EXTERNALSYM D3DERR_NOTFOUND}
  2154.   D3DERR_MOREDATA                         = HResult(MAKE_D3DHRESULT_R or 2151);
  2155.   {$EXTERNALSYM D3DERR_MOREDATA}
  2156.   D3DERR_DEVICELOST                       = HResult(MAKE_D3DHRESULT_R or 2152);
  2157.   {$EXTERNALSYM D3DERR_DEVICELOST}
  2158.   D3DERR_DEVICENOTRESET                   = HResult(MAKE_D3DHRESULT_R or 2153);
  2159.   {$EXTERNALSYM D3DERR_DEVICENOTRESET}
  2160.   D3DERR_NOTAVAILABLE                     = HResult(MAKE_D3DHRESULT_R or 2154);
  2161.   {$EXTERNALSYM D3DERR_NOTAVAILABLE}
  2162.   D3DERR_OUTOFVIDEOMEMORY                 = HResult(MAKE_D3DHRESULT_R or 380);
  2163.   {$EXTERNALSYM D3DERR_OUTOFVIDEOMEMORY}
  2164.   D3DERR_INVALIDDEVICE                    = HResult(MAKE_D3DHRESULT_R or 2155);
  2165.   {$EXTERNALSYM D3DERR_INVALIDDEVICE}
  2166.   D3DERR_INVALIDCALL                      = HResult(MAKE_D3DHRESULT_R or 2156);
  2167.   {$EXTERNALSYM D3DERR_INVALIDCALL}
  2168.   D3DERR_DRIVERINVALIDCALL                = HResult(MAKE_D3DHRESULT_R or 2157);
  2169.   {$EXTERNALSYM D3DERR_DRIVERINVALIDCALL}
  2170.   D3DERR_WASSTILLDRAWING                  = HResult(MAKE_D3DHRESULT_R or 540);
  2171.   {$EXTERNALSYM D3DERR_WASSTILLDRAWING}
  2172. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2173.   D3DERR_DEVICEREMOVED                    = HResult(MAKE_D3DHRESULT_R or 2160);
  2174.   {$EXTERNALSYM D3DERR_DEVICEREMOVED}
  2175. {$ENDIF}
  2176.   D3DOK_NOAUTOGEN                         = HResult(MAKE_D3DSTATUS_R or 2159);
  2177.   {$EXTERNALSYM D3DOK_NOAUTOGEN}
  2178. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2179.   S_NOT_RESIDENT                          = HResult(MAKE_D3DSTATUS_R or 2165);
  2180.   {$EXTERNALSYM S_NOT_RESIDENT}
  2181.   S_RESIDENT_IN_SHARED_MEMORY             = HResult(MAKE_D3DSTATUS_R or 2166);
  2182.   {$EXTERNALSYM S_RESIDENT_IN_SHARED_MEMORY}
  2183.   S_PRESENT_MODE_CHANGED                  = HResult(MAKE_D3DSTATUS_R or 2167);
  2184.   {$EXTERNALSYM S_PRESENT_MODE_CHANGED}
  2185.   S_PRESENT_OCCLUDED                      = HResult(MAKE_D3DSTATUS_R or 2168);
  2186.   {$EXTERNALSYM S_PRESENT_OCCLUDED}
  2187.   D3DERR_DEVICEHUNG                       = HResult(MAKE_D3DHRESULT_R or 2164);
  2188.   {$EXTERNALSYM D3DERR_DEVICEHUNG}
  2189. {$ENDIF}
  2190. (*
  2191.  * DLL Function for creating a Direct3D9 object. This object supports
  2192.  * enumeration and allows the creation of Direct3DDevice9 objects.
  2193.  * Pass the value of the constant D3D_SDK_VERSION to this function, so
  2194.  * that the run-time can validate that your application was compiled
  2195.  * against the right headers.
  2196.  *)
  2197. function Direct3D9Loaded: Boolean;
  2198. function LoadDirect3D9: Boolean;
  2199. function UnLoadDirect3D9: Boolean;
  2200. const
  2201.   Direct3D9dll = 'd3d9.dll';
  2202. // Due to the way Object Pascal handles functions resulting in 'native' interface
  2203. // pointer we should declare result not as interface but as usial pointer
  2204. {$IFDEF DIRECT3D9_DYNAMIC_LINK}
  2205. type
  2206.   TDirect3DCreate9 = function (SDKVersion: LongWord): Pointer; stdcall;
  2207.   {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2208.   TDirect3DCreate9Ex = function (SDKVersion: LongWord; out d3d9ex: IDirect3D9Ex): HRESULT; stdcall;
  2209.   {$ENDIF}
  2210. var
  2211.   _Direct3DCreate9: TDirect3DCreate9 = nil;
  2212.   {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2213.   Direct3DCreate9Ex: TDirect3DCreate9Ex = nil;
  2214.   {$ENDIF}
  2215. {$ELSE}
  2216. function _Direct3DCreate9(SDKVersion: LongWord): Pointer; stdcall;
  2217. {$ENDIF}
  2218. function Direct3DCreate9(SDKVersion: LongWord): IDirect3D9; stdcall;
  2219. {$EXTERNALSYM Direct3DCreate9}
  2220. {$IFNDEF DIRECT3D9_DYNAMIC_LINK}
  2221. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2222. function Direct3DCreate9Ex(SDKVersion: LongWord; out d3d9ex: IDirect3D9Ex): HRESULT; stdcall;
  2223. {$EXTERNALSYM Direct3DCreate9Ex}
  2224. {$ENDIF}
  2225. {$ENDIF}
  2226. (*
  2227.  * Stubs for graphics profiling.
  2228.  *)
  2229. function D3DPERF_BeginEvent(col: TD3DColor; wszName: PWideChar): Integer; stdcall; external Direct3D9dll;
  2230. {$EXTERNALSYM D3DPERF_BeginEvent}
  2231. function D3DPERF_EndEvent: Integer; stdcall; external Direct3D9dll;
  2232. {$EXTERNALSYM D3DPERF_EndEvent}
  2233. procedure D3DPERF_SetMarker(col: TD3DColor; wszName: PWideChar); stdcall; external Direct3D9dll;
  2234. {$EXTERNALSYM D3DPERF_SetMarker}
  2235. procedure D3DPERF_SetRegion(col: TD3DColor; wszName: PWideChar); stdcall; external Direct3D9dll;
  2236. {$EXTERNALSYM D3DPERF_SetRegion}
  2237. function D3DPERF_QueryRepeatFrame: BOOL; stdcall; external Direct3D9dll;
  2238. {$EXTERNALSYM D3DPERF_QueryRepeatFrame}
  2239. procedure D3DPERF_SetOptions(dwOptions: DWORD); stdcall; external Direct3D9dll;
  2240. {$EXTERNALSYM D3DPERF_SetOptions}
  2241. function D3DPERF_GetStatus: DWORD; stdcall; external Direct3D9dll;
  2242. {$EXTERNALSYM D3DPERF_GetStatus}
  2243. //********************************************************************
  2244. // Introduced types for compatibility with non-Borland compliant translation
  2245. // by Ampaze (Tim Baumgarten) from http://www.crazyentertainment.net
  2246. type
  2247.   PD3DAdapter_Identifier9               = PD3DAdapterIdentifier9;
  2248.   PD3DDevice_Creation_Parameters        = PD3DDeviceCreationParameters;
  2249.   PD3DDevInfo_D3DVertexStats            = PD3DDevInfoD3DVertexStats;
  2250.   PD3DDevInfo_ResourceManager           = PD3DDevInfoResourceManager;
  2251.   PD3DDevInfo_VCache                    = PD3DDevInfoVCache;
  2252.   PD3DIndexBuffer_Desc                  = PD3DIndexBufferDesc;
  2253.   PD3DLocked_Box                        = PD3DLockedBox;
  2254.   PD3DLocked_Rect                       = PD3DLockedRect;
  2255.   PD3DPresent_Parameters                = PD3DPresentParameters;
  2256.   PD3DRaster_Status                     = PD3DRasterStatus;
  2257.   PD3DRectPatch_Info                    = PD3DRectPatchInfo;
  2258.   PD3DSurface_Desc                      = PD3DSurfaceDesc;
  2259.   PD3DTriPatch_Info                     = PD3DTriPatchInfo;
  2260.   PD3DVertexBuffer_Desc                 = PD3DVertexBufferDesc;
  2261.   PD3DVolume_Desc                       = PD3DVolumeDesc;
  2262.   TD3DAdapter_Identifier9               = TD3DAdapterIdentifier9;
  2263.   TD3DBackBuffer_Type                   = TD3DBackBufferType;
  2264.   TD3DCubeMap_Faces                     = TD3DCubeMapFaces;
  2265.   TD3DDevice_Creation_Parameters        = TD3DDeviceCreationParameters;
  2266.   TD3DDevInfo_D3DVertexStats            = TD3DDevInfoD3DVertexStats;
  2267.   TD3DDevInfo_ResourceManager           = TD3DDevInfoResourceManager;
  2268.   TD3DDevInfo_VCache                    = TD3DDevInfoVCache;
  2269.   TD3DIndexBuffer_Desc                  = TD3DIndexBufferDesc;
  2270.   TD3DLocked_Box                        = TD3DLockedBox;
  2271.   TD3DLocked_Rect                       = TD3DLockedRect;
  2272.   TD3DMultiSample_Type                  = TD3DMultiSampleType;
  2273.   TD3DPresent_Parameters                = TD3DPresentParameters;
  2274.   TD3DRaster_Status                     = TD3DRasterStatus;
  2275.   TD3DRectPatch_Info                    = TD3DRectPatchInfo;
  2276.   TD3DSampler_Texture_Type              = TD3DSamplerTextureType;
  2277.   TD3DShader_AddressMode_Type           = TD3DShaderAddressModeType;
  2278.   TD3DShader_Comparison                 = TD3DShaderComparison;
  2279.   TD3DShader_Instruction_Opcode_Type    = TD3DShaderInstructionOpcodeType;
  2280.   TD3DShader_MiscType_Offsets           = TD3DShaderMiscTypeOffsets;
  2281.   TD3DShader_Param_Register_Type        = TD3DShaderParamRegisterType;
  2282.   TD3DShader_Param_SRCMod_Type          = TD3DShaderParamSRCModType;
  2283.   TD3DSurface_Desc                      = TD3DSurfaceDesc;
  2284.   TD3DTriPatch_Info                     = TD3DTriPatchInfo;
  2285.   TD3DVertexBuffer_Desc                 = TD3DVertexBufferDesc;
  2286.   TD3DVolume_Desc                       = TD3DVolumeDesc;
  2287.   TD3DVS_AddressMode_Type               = TD3DVSAddressModeType;
  2288.   TD3DVS_RastOut_Offsets                = TD3DVSRastOutOffsets;
  2289. implementation
  2290. (*==========================================================================;
  2291.  *  File:       d3d9types.h
  2292.  *  Content:    Direct3D capabilities include file
  2293.  ***************************************************************************)
  2294. // #define D3DCOLOR_ARGB(a,r,g,b) 
  2295. //     ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
  2296. function D3DCOLOR_ARGB(a,r,g,b: DWord): TD3DColor;
  2297. begin
  2298.   Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
  2299. end;
  2300. // #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
  2301. function D3DCOLOR_RGBA(r,g,b,a: DWord): TD3DColor;
  2302. begin
  2303.   Result := (a shl 24) or (r shl 16) or (g shl 8) or b;
  2304. end;
  2305. // #define D3DCOLOR_XRGB(r,g,b)   D3DCOLOR_ARGB(0xff,r,g,b)
  2306. function D3DCOLOR_XRGB(r,g,b: DWord): TD3DColor;
  2307. begin
  2308.   Result := DWORD($FF shl 24) or (r shl 16) or (g shl 8) or b;
  2309. end;
  2310. // #define D3DCOLOR_XYUV(y,u,v)   D3DCOLOR_ARGB(0xff,y,u,v)
  2311. function D3DCOLOR_XYUV(y,u,v: DWord): TD3DColor;
  2312. begin
  2313.   Result := DWORD($FF shl 24) or (y shl 16) or (u shl 8) or v;
  2314. end;
  2315. // #define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v)
  2316. function D3DCOLOR_AYUV(a,y,u,v: DWord): TD3DColor;
  2317. begin
  2318.   Result := (a shl 24) or (y shl 16) or (u shl 8) or v;
  2319. end;
  2320. // #define D3DCOLOR_COLORVALUE(r,g,b,a) 
  2321. //     D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
  2322. function D3DCOLOR_COLORVALUE(r,g,b,a: Single): TD3DColor;
  2323. begin
  2324.   Result := (round(a * 255) shl 24) or
  2325.     (round(r * 255) shl 16) or
  2326.     (round(g * 255) shl 8) or
  2327.     (round(b * 255));
  2328. end;
  2329. // #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
  2330. function D3DTS_WORLDMATRIX(index: Byte): TD3DTransformStateType;
  2331. begin
  2332.   Result:= TD3DTransformStateType(index + 256);
  2333. end;
  2334. //#define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor))
  2335. function D3DPS_VERSION(_Major, _Minor : Cardinal) : Cardinal;
  2336. begin
  2337.   Result:= $FFFF0000 or (_Major shl 8 ) or _Minor;
  2338. end;
  2339. //#define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor))
  2340. function D3DVS_VERSION(_Major, _Minor : Cardinal) : Cardinal;
  2341. begin
  2342.   Result:= $FFFE0000 or (_Major shl 8 ) or _Minor;
  2343. end;
  2344. //#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF)
  2345. function D3DSHADER_VERSION_MAJOR(_Version : Cardinal) : Cardinal;
  2346. begin
  2347.   Result:= (_Version shr 8 ) and $FF;
  2348. end;
  2349. //#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF)
  2350. function D3DSHADER_VERSION_MINOR(_Version : Cardinal) : Cardinal;
  2351. begin
  2352.   Result:= (_Version shr 0) and $FF;
  2353. end;
  2354. //#define D3DSHADER_COMMENT(_DWordSize) 
  2355. //    ((((_DWordSize)<<D3DSI_COMMENTSIZE_SHIFT)&D3DSI_COMMENTSIZE_MASK)|D3DSIO_COMMENT)
  2356. function D3DSHADER_COMMENT(_DWordSize: DWord) : DWord;
  2357. begin
  2358.   Result:= ((_DWordSize shl D3DSI_COMMENTSIZE_SHIFT) and D3DSI_COMMENTSIZE_MASK) or D3DSIO_COMMENT;
  2359. end;
  2360. //#define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
  2361. function D3DFVF_TEXCOORDSIZE3(CoordIndex: DWord): DWord;
  2362. begin
  2363.   Result:= D3DFVF_TEXTUREFORMAT3 shl (CoordIndex * 2 + 16)
  2364. end;
  2365. //#define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
  2366. function D3DFVF_TEXCOORDSIZE2(CoordIndex: DWord): DWord;
  2367. begin
  2368.   Result:= D3DFVF_TEXTUREFORMAT2;
  2369. end;
  2370. //#define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
  2371. function D3DFVF_TEXCOORDSIZE4(CoordIndex: DWord): DWord;
  2372. begin
  2373.   Result:= D3DFVF_TEXTUREFORMAT4 shl (CoordIndex * 2 + 16)
  2374. end;
  2375. //#define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
  2376. function D3DFVF_TEXCOORDSIZE1(CoordIndex: DWord): DWord;
  2377. begin
  2378.   Result:= D3DFVF_TEXTUREFORMAT1 shl (CoordIndex * 2 + 16)
  2379. end;
  2380. //    #define MAKEFOURCC(ch0, ch1, ch2, ch3)                              
  2381. //                ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) |       
  2382. //                ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
  2383. function MAKEFOURCC(ch0, ch1, ch2, ch3: Char): DWord;
  2384. begin
  2385.   Result:= Byte(ch0) or (Byte(ch1) shl 8) or (Byte(ch2) shl 16) or (Byte(ch3) shl 24 );
  2386. end;
  2387. (*==========================================================================;
  2388.  *  File:   d3d9.h
  2389.  *  Content:    Direct3D include file
  2390.  ****************************************************************************)
  2391. //#define MAKE_D3DHRESULT( code )  MAKE_HRESULT( 1, _FACD3D, code )
  2392. function MAKE_D3DHRESULT(Code: DWord): DWord;
  2393. begin
  2394.   Result:= DWord((1 shl 31) or (_FACD3D shl 16)) or Code;
  2395. end;
  2396. //#define MAKE_D3DSTATUS( code )  MAKE_HRESULT( 0, _FACD3D, code )
  2397. function MAKE_D3DSTATUS(Code: DWord): DWord;
  2398. begin
  2399.   Result:= DWord((0 shl 31) or (_FACD3D shl 16)) or Code;
  2400. end;
  2401. {$IFDEF DIRECT3D9_DYNAMIC_LINK}
  2402. var
  2403.   Direct3D9Lib: THandle = 0;
  2404. function Direct3D9Loaded: Boolean;
  2405. begin
  2406.   Result:= Direct3D9Lib <> 0;
  2407. end;
  2408. function UnLoadDirect3D9: Boolean;
  2409. begin
  2410.   Result:= True;
  2411.   if Direct3D9Loaded then
  2412.   begin
  2413.     Result:= FreeLibrary(Direct3D9Lib);
  2414.     _Direct3DCreate9:= nil;
  2415.     Direct3D9Lib:= 0;
  2416.   end;
  2417. end;
  2418. function LoadDirect3D9: Boolean;
  2419. const
  2420.   ProcName = 'Direct3DCreate9';
  2421.   ProcNameEx = 'Direct3DCreate9Ex';
  2422. begin
  2423.   Result:= Direct3D9Loaded;
  2424.   if (not Result) then
  2425.   begin
  2426.     Direct3D9Lib:= LoadLibrary(Direct3D9dll);
  2427.     if Direct3D9Loaded then
  2428.     begin
  2429.       _Direct3DCreate9:= GetProcAddress(Direct3D9Lib, ProcName);
  2430.       Result:= Assigned(_Direct3DCreate9);
  2431.       if not Result then UnLoadDirect3D9;
  2432.       {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2433.       
  2434.       Direct3DCreate9Ex:= GetProcAddress(Direct3D9Lib, ProcNameEx);
  2435.       {$ENDIF}
  2436.     end;
  2437.   end;
  2438. end;
  2439. {$ELSE}
  2440. function Direct3D9Loaded: Boolean;
  2441. begin // Stub function for static linking
  2442.   Result:= True;
  2443. end;
  2444. function UnLoadDirect3D9: Boolean;
  2445. begin // Stub function for static linking
  2446.   Result:= True; // should emulate "normal" behaviour
  2447. end;
  2448. function LoadDirect3D9: Boolean;
  2449. begin // Stub function for static linking
  2450.   Result:= True;
  2451. end;
  2452. function _Direct3DCreate9(SDKVersion: LongWord): Pointer; external Direct3D9dll name 'Direct3DCreate9';
  2453. {$IFDEF DIRECT3D_VERSION_9_VISTA}
  2454. function Direct3DCreate9Ex(SDKVersion: LongWord; out d3d9ex: IDirect3D9Ex): HRESULT; stdcall; external Direct3D9dll;
  2455. {$ENDIF}
  2456. {$ENDIF}
  2457. function Direct3DCreate9(SDKVersion: LongWord): IDirect3D9; stdcall;
  2458. begin
  2459. {$IFDEF DIRECT3D9_DYNAMIC_LINK}
  2460. {$IFDEF DIRECT3D9_DYNAMIC_LINK_EXPLICIT}
  2461.   LoadDirect3D9;
  2462. {$ENDIF}
  2463. {$ENDIF}
  2464.   Result:= IDirect3D9(_Direct3DCreate9(SDKVersion));
  2465.   if Assigned(Result) then Result._Release; // Delphi autoincrement reference count
  2466. end;
  2467. {$IFDEF DIRECT3D9_DYNAMIC_LINK}
  2468. initialization
  2469. {$IFNDEF DIRECT3D9_DYNAMIC_LINK_EXPLICIT}
  2470.   LoadDirect3D9;
  2471. {$ENDIF}
  2472. finalization
  2473.   UnLoadDirect3D9;
  2474. {$ENDIF}
  2475. end.