IDirect3D9 Interface

 

 

' ****************************************************************************************
' IDirect3D9 interface
' $IID_IDirect3D9 = GUID$("{81BDCBCA-64D4-426d-AE8D-AD0147F4275C}")
' ****************************************************************************************
' Applications use the methods of the IDirect3D9 interface to create Microsoft Direct3D
' objects and set up the environment. This interface includes methods for enumerating and
' retrieving capabilities of the device.
' Remarks
'    The IDirect3D9 interface is obtained by calling the Direct3DCreate9 function.
' Interface Information
'    Stock Implementation   d3d9.dll
'    Custom Implementation  No
'    Inherits from  IUnknown
'    Header     d3d9.h
'    Import library     d3d9.lib
'    Minimum operating systems  Windows 98
' ****************************************************************************************

' ****************************************************************************************
' DECLARE_INTERFACE_(IDirect3D9, IUnknown)
' {
'    /*** IUnknown methods ***/
'  0.  STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
'  1.  STDMETHOD_(ULONG,AddRef)(THIS) PURE;
'  2.  STDMETHOD_(ULONG,Release)(THIS) PURE;

'    /*** IDirect3D9 methods ***/
'  3.  STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE;
'  4.  STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE;
'  5.  STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE;
'  6.  STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE;
'  7.  STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE;
'  8.  STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE;
'  9.  STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE;
' 10.  STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE;
' 11.  STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE;
' 12.  STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE;
' 13.  STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE;
' 14.  STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE;
' 15.  STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE;
' 16.  STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE;
' };
' ****************************************************************************************

' ****************************************************************************************
' RegisterSoftwareDevice method
' Registers a pluggable software device. Software devices provide software rasterization
' enabling applications to access a variety of software rasterizers.
' HRESULT RegisterSoftwareDevice(
'   void * pInitializeFunction
' );
' ****************************************************************************************
FUNCTION IDirect3D9_RegisterSoftwareDevice ALIAS "IDirect3D9_RegisterSoftwareDevice" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pInitializeFunction AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[3] USING IDirect3D9_RegisterSoftwareDevice(pthis, pInitializeFunction) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetAdapterCount method
' Returns the number of adapters on the system.
' UINT GetAdapterCount();
' ****************************************************************************************
FUNCTION IDirect3D9_GetAdapterCount ALIAS "IDirect3D9_GetAdapterCount" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[4] USING IDirect3D9_GetAdapterCount(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetAdapterIdentifier method
' Describes the physical display adapters present in the system when the IDirect3D9
' interface was instantiated.
' HRESULT GetAdapterIdentifier(
'   UINT Adapter,
'   DWORD Flags,
'   D3DADAPTER_IDENTIFIER9 * pIdentifier
' );
' ****************************************************************************************
FUNCTION IDirect3D9_GetAdapterIdentifier ALIAS "IDirect3D9_GetAdapterIdentifier" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL flags AS DWORD, _
    BYREF pIdentifier AS D3DADAPTER_IDENTIFIER9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[5] USING IDirect3D9_GetAdapterIdentifier(pthis, Adapter, flags, pIdentifier) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetAdapterModeCount method
' Returns the number of display modes available on this adapter.
' UINT GetAdapterModeCount(
'   UINT Adapter,
'   D3DFORMAT Format
' );
' ****************************************************************************************
FUNCTION IDirect3D9_GetAdapterModeCount ALIAS "IDirect3D9_GetAdapterModeCount" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL prmFormat AS DWORD) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[6] USING IDirect3D9_GetAdapterModeCount(pthis, Adapter, prmFormat) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' EnumAdapterModes method
' Queries the device to determine whether the specified adapter supports the requested
' format and display mode. This method could be used in a loop to enumerate all the
' available adapter modes.
' HRESULT EnumAdapterModes(
'   UINT Adapter,
'   D3DFORMAT Format,
'   UINT Mode,
'   D3DDISPLAYMODE* pMode
' );
' ****************************************************************************************
FUNCTION IDirect3D9_EnumAdapterModes ALIAS "IDirect3D9_EnumAdapterModes" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL prmFormat AS DWORD, _
    BYVAL Mode AS DWORD, BYREF pMode AS D3DDISPLAYMODE) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[7] USING IDirect3D9_EnumAdapterModes(pthis, Adapter, prmFormat, Mode, pMode) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetAdapterDisplayMode method
' Retrieves the current display mode of the adapter.
' HRESULT GetAdapterDisplayMode(
'   UINT Adapter,
'   D3DDISPLAYMODE * pMode
' );
' ****************************************************************************************
FUNCTION IDirect3D9_GetAdapterDisplayMode ALIAS "IDirect3D9_GetAdapterDisplayMode" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYREF pMode AS D3DDISPLAYMODE) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[8] USING IDirect3D9_GetAdapterDisplayMode(pthis, Adapter, pMode) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CheckDeviceType method
' Verifies whether a hardware accelerated device type can be used on this adapter.
' HRESULT CheckDeviceType(
'   UINT Adapter,
'   D3DDEVTYPE DeviceType,
'   D3DFORMAT DisplayFormat,
'   D3DFORMAT BackBufferFormat,
'   BOOL Windowed
' );
' ****************************************************************************************
FUNCTION IDirect3D9_CheckDeviceType ALIAS "IDirect3D9_CheckDeviceType" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL DeviceType AS DWORD, _
    BYVAL DisplayFormat AS DWORD, BYVAL BackBufferFormat AS DWORD, _
    BYVAL Windowed AS LONG) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[9] USING IDirect3D9_CheckDeviceType(pthis, Adapter, DeviceType, DisplayFormat, BackBufferFormat, Windowed) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CheckDeviceFormat method
' Determines whether a surface format is available as a specified resource type and can be
' used as a texture, depth-stencil buffer, or render target, or any combination of the
' three, on a device representing this adapter.
' HRESULT CheckDeviceFormat(
'   UINT Adapter,
'   D3DDEVTYPE DeviceType,
'   D3DFORMAT AdapterFormat,
'   DWORD Usage,
'   D3DRESOURCETYPE RType,
'   D3DFORMAT CheckFormat
' );
' ****************************************************************************************
FUNCTION IDirect3D9_CheckDeviceFormat ALIAS "IDirect3D9_CheckDeviceFormat" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL DeviceType AS DWORD, _
    BYVAL AdapterFormat AS DWORD, BYVAL Usage AS DWORD, BYVAL RType AS DWORD, _
    BYVAL CheckFormat AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[10] USING IDirect3D9_CheckDeviceFormat(pthis, Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CheckDeviceMultiSampleType method
' Determines if a multisampling technique is available on this device.
' HRESULT CheckDeviceMultiSampleType(
'   UINT Adapter,
'   D3DDEVTYPE DeviceType,
'   D3DFORMAT SurfaceFormat,
'   BOOL Windowed,
'   D3DMULTISAMPLE_TYPE MultiSampleType,
'   DWORD* pQualityLevels
' );
' ****************************************************************************************
FUNCTION IDirect3D9_CheckDeviceMultiSampleType ALIAS "IDirect3D9_CheckDeviceMultiSampleType" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL DeviceType AS DWORD, _
    BYVAL SurfaceFormat AS DWORD, BYVAL Windowed AS LONG, BYVAL MultiSampleType AS DWORD, _
    BYREF pQualityLevels AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[11] USING IDirect3D9_CheckDeviceMultiSampleType(pthis, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CheckDepthStencilMatch method
' Determines whether a depth-stencil format is compatible with a render-target format in
' a particular display mode.
' HRESULT CheckDepthStencilMatch(
'   UINT Adapter,
'   D3DDEVTYPE DeviceType,
'   D3DFORMAT AdapterFormat,
'   D3DFORMAT RenderTargetFormat,
'   D3DFORMAT DepthStencilFormat
' );
' ****************************************************************************************
FUNCTION IDirect3D9_CheckDepthStencilMatch ALIAS "IDirect3D9_CheckDepthStencilMatch" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL DeviceType AS DWORD, _
    BYVAL AdapterFormat AS DWORD, BYVAL RenderTargetFormat AS DWORD, _
    BYVAL DepthStencilFormat AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[12] USING IDirect3D9_CheckDepthStencilMatch(pthis, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CheckDeviceFormatConversion Method
' Tests the device to see if it supports conversion from one display format to another.
' HRESULT CheckDeviceFormatConversion(
'   UINT Adapter,
'   D3DDEVTYPE DeviceType,
'   D3DFORMAT SourceFormat,
'   D3DFORMAT TargetFormat
' );
' ****************************************************************************************
FUNCTION IDirect3D9_CheckDeviceFormatConversion ALIAS "IDirect3D9_CheckDeviceFormatConversion" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL DeviceType AS DWORD, _
    BYVAL SourceFormat AS DWORD, BYVAL TargetFormat AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[13] USING IDirect3D9_CheckDeviceFormatConversion(pthis, Adapter, DeviceType, SourceFormat, TargetFormat) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetDeviceCaps method
' Retrieves device-specific information about a device.
' HRESULT GetDeviceCaps(
'   UINT Adapter,
'   D3DDEVTYPE DeviceType,
'   D3DCAPS9 * pCaps
' );
' ****************************************************************************************
FUNCTION IDirect3D9_GetDeviceCaps ALIAS "IDirect3D9_GetDeviceCaps" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL DeviceType AS DWORD, _
    BYREF pCaps AS D3DCAPS9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[14] USING IDirect3D9_GetDeviceCaps(pthis, Adapter, DeviceType, pCaps) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetAdapterMonitor method
' Returns the handle of the monitor associated with the Microsoft Direct3D object.
' HMONITOR GetAdapterMonitor(
'   UINT Adapter
' );
' ****************************************************************************************
FUNCTION IDirect3D9_GetAdapterMonitor ALIAS "IDirect3D9_GetAdapterMonitor" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[15] USING IDirect3D9_GetAdapterMonitor(pthis, Adapter) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateDevice method
' Creates a device to represent the display adapter.
' HRESULT CreateDevice(
'   UINT Adapter,
'   D3DDEVTYPE DeviceType,
'   HWND hFocusWindow,
'   DWORD BehaviorFlags,
'   D3DPRESENT_PARAMETERS * pPresentationParameters,
'   IDirect3DDevice9 ** ppReturnedDeviceInterface
' );
' ****************************************************************************************
FUNCTION IDirect3D9_CreateDevice ALIAS "IDirect3D9_CreateDevice" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Adapter AS DWORD, BYVAL DeviceType AS DWORD, _
    BYVAL hFocusWindow AS DWORD, BYVAL BehaviorFlags AS DWORD, _
    BYREF pPresentationParameters AS D3DPRESENT_PARAMETERS, _
    BYREF ppReturnedDeviceInterface AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[16] USING IDirect3D9_CreateDevice(pthis, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Tuesday, 14 March 2006 19:49:38 +0100