diff --git a/3rdparty/directx-headers/include/directx/d3d9.h b/3rdparty/directx-headers/include/directx/d3d9.h deleted file mode 100644 index 3a604072256..00000000000 --- a/3rdparty/directx-headers/include/directx/d3d9.h +++ /dev/null @@ -1,2794 +0,0 @@ -/*==========================================================================; - * - * Copyright (C) Microsoft Corporation. All Rights Reserved. - * - * File: d3d9.h - * Content: Direct3D include file - * - ****************************************************************************/ - -#ifndef _D3D9_H_ -#define _D3D9_H_ - -#ifndef DIRECT3D_VERSION -#define DIRECT3D_VERSION 0x0900 -#endif //DIRECT3D_VERSION - -// include this file content only if compiling for DX9 interfaces -#if(DIRECT3D_VERSION >= 0x0900) - - - -/* This identifier is passed to Direct3DCreate9 in order to ensure that an - * application was built against the correct header files. This number is - * incremented whenever a header (or other) change would require applications - * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail. - * (The number itself has no meaning.)*/ - -#ifdef D3D_DEBUG_INFO -#define D3D_SDK_VERSION (32 | 0x80000000) -#define D3D9b_SDK_VERSION (31 | 0x80000000) - -#else -#define D3D_SDK_VERSION 32 -#define D3D9b_SDK_VERSION 31 -#endif - - -#include - -#define COM_NO_WINDOWS_H -#include - -#include - -#if !defined(HMONITOR_DECLARED) && (!defined(WINVER) || WINVER < 0x0500) - #define HMONITOR_DECLARED - DECLARE_HANDLE(HMONITOR); -#endif - -#define D3DAPI WINAPI -/* - * Interface IID's - */ -#if defined( _WIN32 ) && !defined( _NO_COM) - -/* IID_IDirect3D9 */ -/* {81BDCBCA-64D4-426d-AE8D-AD0147F4275C} */ -DEFINE_GUID(IID_IDirect3D9, 0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c); - -/* IID_IDirect3DDevice9 */ -// {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB} */ -DEFINE_GUID(IID_IDirect3DDevice9, 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb); - -/* IID_IDirect3DResource9 */ -// {05EEC05D-8F7D-4362-B999-D1BAF357C704} -DEFINE_GUID(IID_IDirect3DResource9, 0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4); - -/* IID_IDirect3DBaseTexture9 */ -/* {580CA87E-1D3C-4d54-991D-B7D3E3C298CE} */ -DEFINE_GUID(IID_IDirect3DBaseTexture9, 0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce); - -/* IID_IDirect3DTexture9 */ -/* {85C31227-3DE5-4f00-9B3A-F11AC38C18B5} */ -DEFINE_GUID(IID_IDirect3DTexture9, 0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5); - -/* IID_IDirect3DCubeTexture9 */ -/* {FFF32F81-D953-473a-9223-93D652ABA93F} */ -DEFINE_GUID(IID_IDirect3DCubeTexture9, 0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f); - -/* IID_IDirect3DVolumeTexture9 */ -/* {2518526C-E789-4111-A7B9-47EF328D13E6} */ -DEFINE_GUID(IID_IDirect3DVolumeTexture9, 0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6); - -/* IID_IDirect3DVertexBuffer9 */ -/* {B64BB1B5-FD70-4df6-BF91-19D0A12455E3} */ -DEFINE_GUID(IID_IDirect3DVertexBuffer9, 0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3); - -/* IID_IDirect3DIndexBuffer9 */ -/* {7C9DD65E-D3F7-4529-ACEE-785830ACDE35} */ -DEFINE_GUID(IID_IDirect3DIndexBuffer9, 0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35); - -/* IID_IDirect3DSurface9 */ -/* {0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B} */ -DEFINE_GUID(IID_IDirect3DSurface9, 0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b); - -/* IID_IDirect3DVolume9 */ -/* {24F416E6-1F67-4aa7-B88E-D33F6F3128A1} */ -DEFINE_GUID(IID_IDirect3DVolume9, 0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1); - -/* IID_IDirect3DSwapChain9 */ -/* {794950F2-ADFC-458a-905E-10A10B0B503B} */ -DEFINE_GUID(IID_IDirect3DSwapChain9, 0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b); - -/* IID_IDirect3DVertexDeclaration9 */ -/* {DD13C59C-36FA-4098-A8FB-C7ED39DC8546} */ -DEFINE_GUID(IID_IDirect3DVertexDeclaration9, 0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46); - -/* IID_IDirect3DVertexShader9 */ -/* {EFC5557E-6265-4613-8A94-43857889EB36} */ -DEFINE_GUID(IID_IDirect3DVertexShader9, 0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36); - -/* IID_IDirect3DPixelShader9 */ -/* {6D3BDBDC-5B02-4415-B852-CE5E8BCCB289} */ -DEFINE_GUID(IID_IDirect3DPixelShader9, 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89); - -/* IID_IDirect3DStateBlock9 */ -/* {B07C4FE5-310D-4ba8-A23C-4F0F206F218B} */ -DEFINE_GUID(IID_IDirect3DStateBlock9, 0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b); - -/* IID_IDirect3DQuery9 */ -/* {d9771460-a695-4f26-bbd3-27b840b541cc} */ -DEFINE_GUID(IID_IDirect3DQuery9, 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc); - - -/* IID_HelperName */ -/* {E4A36723-FDFE-4b22-B146-3C04C07F4CC8} */ -DEFINE_GUID(IID_HelperName, 0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x4, 0xc0, 0x7f, 0x4c, 0xc8); - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -/* IID_IDirect3D9Ex */ -/* {02177241-69FC-400C-8FF1-93A44DF6861D} */ -DEFINE_GUID(IID_IDirect3D9Ex, 0x02177241, 0x69FC, 0x400C, 0x8F, 0xF1, 0x93, 0xA4, 0x4D, 0xF6, 0x86, 0x1D); - -/* IID_IDirect3DDevice9Ex */ -// {B18B10CE-2649-405a-870F-95F777D4313A} -DEFINE_GUID(IID_IDirect3DDevice9Ex, 0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a); - -/* IID_IDirect3DSwapChain9Ex */ -/* {91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303} */ -DEFINE_GUID(IID_IDirect3DSwapChain9Ex, 0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x3); - -/* IID_IDirect3D9ExOverlayExtension */ -/* {187aeb13-aaf5-4c59-876d-e059088c0df8} */ -DEFINE_GUID(IID_IDirect3D9ExOverlayExtension, 0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x8, 0x8c, 0xd, 0xf8); - -/* IID_IDirect3DDevice9Video */ -// {26DC4561-A1EE-4ae7-96DA-118A36C0EC95} -DEFINE_GUID(IID_IDirect3DDevice9Video, 0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95); - -/* IID_IDirect3D9AuthenticatedChannel */ -// {FF24BEEE-DA21-4beb-98B5-D2F899F98AF9} -DEFINE_GUID(IID_IDirect3DAuthenticatedChannel9, 0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9); - -/* IID_IDirect3DCryptoSession9 */ -// {FA0AB799-7A9C-48ca-8C5B-237E71A54434} -DEFINE_GUID(IID_IDirect3DCryptoSession9, 0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34); - - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -#endif - -#ifdef __cplusplus - -#ifndef DECLSPEC_UUID -#if _MSC_VER >= 1100 -#define DECLSPEC_UUID(x) __declspec(uuid(x)) -#else -#define DECLSPEC_UUID(x) -#endif -#endif - -interface DECLSPEC_UUID("81BDCBCA-64D4-426d-AE8D-AD0147F4275C") IDirect3D9; -interface DECLSPEC_UUID("D0223B96-BF7A-43fd-92BD-A43B0D82B9EB") IDirect3DDevice9; - -interface DECLSPEC_UUID("B07C4FE5-310D-4ba8-A23C-4F0F206F218B") IDirect3DStateBlock9; -interface DECLSPEC_UUID("05EEC05D-8F7D-4362-B999-D1BAF357C704") IDirect3DResource9; -interface DECLSPEC_UUID("DD13C59C-36FA-4098-A8FB-C7ED39DC8546") IDirect3DVertexDeclaration9; -interface DECLSPEC_UUID("EFC5557E-6265-4613-8A94-43857889EB36") IDirect3DVertexShader9; -interface DECLSPEC_UUID("6D3BDBDC-5B02-4415-B852-CE5E8BCCB289") IDirect3DPixelShader9; -interface DECLSPEC_UUID("580CA87E-1D3C-4d54-991D-B7D3E3C298CE") IDirect3DBaseTexture9; -interface DECLSPEC_UUID("85C31227-3DE5-4f00-9B3A-F11AC38C18B5") IDirect3DTexture9; -interface DECLSPEC_UUID("2518526C-E789-4111-A7B9-47EF328D13E6") IDirect3DVolumeTexture9; -interface DECLSPEC_UUID("FFF32F81-D953-473a-9223-93D652ABA93F") IDirect3DCubeTexture9; - -interface DECLSPEC_UUID("B64BB1B5-FD70-4df6-BF91-19D0A12455E3") IDirect3DVertexBuffer9; -interface DECLSPEC_UUID("7C9DD65E-D3F7-4529-ACEE-785830ACDE35") IDirect3DIndexBuffer9; - -interface DECLSPEC_UUID("0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B") IDirect3DSurface9; -interface DECLSPEC_UUID("24F416E6-1F67-4aa7-B88E-D33F6F3128A1") IDirect3DVolume9; - -interface DECLSPEC_UUID("794950F2-ADFC-458a-905E-10A10B0B503B") IDirect3DSwapChain9; -interface DECLSPEC_UUID("d9771460-a695-4f26-bbd3-27b840b541cc") IDirect3DQuery9; - - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -interface DECLSPEC_UUID("02177241-69FC-400C-8FF1-93A44DF6861D") IDirect3D9Ex; -interface DECLSPEC_UUID("B18B10CE-2649-405a-870F-95F777D4313A") IDirect3DDevice9Ex; -interface DECLSPEC_UUID("91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303") IDirect3DSwapChain9Ex; -interface DECLSPEC_UUID("187AEB13-AAF5-4C59-876D-E059088C0DF8") IDirect3D9ExOverlayExtension; -interface DECLSPEC_UUID("26DC4561-A1EE-4ae7-96DA-118A36C0EC95") IDirect3DDevice9Video; -interface DECLSPEC_UUID("FF24BEEE-DA21-4beb-98B5-D2F899F98AF9") IDirect3DAuthenticatedChannel9; -interface DECLSPEC_UUID("FA0AB799-7A9C-48CA-8C5B-237E71A54434") IDirect3DCryptoSession9; - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -#if defined(_COM_SMARTPTR_TYPEDEF) -_COM_SMARTPTR_TYPEDEF(IDirect3D9, __uuidof(IDirect3D9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9, __uuidof(IDirect3DDevice9)); - -_COM_SMARTPTR_TYPEDEF(IDirect3DStateBlock9, __uuidof(IDirect3DStateBlock9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DResource9, __uuidof(IDirect3DResource9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DVertexDeclaration9, __uuidof(IDirect3DVertexDeclaration9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DVertexShader9, __uuidof(IDirect3DVertexShader9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DPixelShader9, __uuidof(IDirect3DPixelShader9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DBaseTexture9, __uuidof(IDirect3DBaseTexture9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DTexture9, __uuidof(IDirect3DTexture9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DVolumeTexture9, __uuidof(IDirect3DVolumeTexture9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DCubeTexture9, __uuidof(IDirect3DCubeTexture9)); - -_COM_SMARTPTR_TYPEDEF(IDirect3DVertexBuffer9, __uuidof(IDirect3DVertexBuffer9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DIndexBuffer9, __uuidof(IDirect3DIndexBuffer9)); - -_COM_SMARTPTR_TYPEDEF(IDirect3DSurface9, __uuidof(IDirect3DSurface9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DVolume9, __uuidof(IDirect3DVolume9)); - -_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9, __uuidof(IDirect3DSwapChain9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DQuery9, __uuidof(IDirect3DQuery9)); - - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -_COM_SMARTPTR_TYPEDEF(IDirect3D9Ex, __uuidof(IDirect3D9Ex)); -_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9Ex, __uuidof(IDirect3DDevice9Ex)); -_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9Ex, __uuidof(IDirect3DSwapChain9Ex)); -_COM_SMARTPTR_TYPEDEF(IDirect3D9ExOverlayExtension, __uuidof(IDirect3D9ExOverlayExtension)); -_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9Video, __uuidof(IDirect3DDevice9Video)); -_COM_SMARTPTR_TYPEDEF(IDirect3DAuthenticatedChannel9, __uuidof(IDirect3DAuthenticatedChannel9)); -_COM_SMARTPTR_TYPEDEF(IDirect3DCryptoSession9, __uuidof(IDirect3DCryptoSession9)); - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -#endif - -#endif - - -typedef interface IDirect3D9 IDirect3D9; -typedef interface IDirect3DDevice9 IDirect3DDevice9; -typedef interface IDirect3DStateBlock9 IDirect3DStateBlock9; -typedef interface IDirect3DVertexDeclaration9 IDirect3DVertexDeclaration9; -typedef interface IDirect3DVertexShader9 IDirect3DVertexShader9; -typedef interface IDirect3DPixelShader9 IDirect3DPixelShader9; -typedef interface IDirect3DResource9 IDirect3DResource9; -typedef interface IDirect3DBaseTexture9 IDirect3DBaseTexture9; -typedef interface IDirect3DTexture9 IDirect3DTexture9; -typedef interface IDirect3DVolumeTexture9 IDirect3DVolumeTexture9; -typedef interface IDirect3DCubeTexture9 IDirect3DCubeTexture9; -typedef interface IDirect3DVertexBuffer9 IDirect3DVertexBuffer9; -typedef interface IDirect3DIndexBuffer9 IDirect3DIndexBuffer9; -typedef interface IDirect3DSurface9 IDirect3DSurface9; -typedef interface IDirect3DVolume9 IDirect3DVolume9; -typedef interface IDirect3DSwapChain9 IDirect3DSwapChain9; -typedef interface IDirect3DQuery9 IDirect3DQuery9; - - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - - -typedef interface IDirect3D9Ex IDirect3D9Ex; -typedef interface IDirect3DDevice9Ex IDirect3DDevice9Ex; -typedef interface IDirect3DSwapChain9Ex IDirect3DSwapChain9Ex; -typedef interface IDirect3D9ExOverlayExtension IDirect3D9ExOverlayExtension; -typedef interface IDirect3DDevice9Video IDirect3DDevice9Video; -typedef interface IDirect3DAuthenticatedChannel9 IDirect3DAuthenticatedChannel9; -typedef interface IDirect3DCryptoSession9 IDirect3DCryptoSession9; - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -#include "d3d9types.h" -#include "d3d9caps.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * DLL Function for creating a Direct3D9 object. This object supports - * enumeration and allows the creation of Direct3DDevice9 objects. - * Pass the value of the constant D3D_SDK_VERSION to this function, so - * that the run-time can validate that your application was compiled - * against the right headers. - */ - -IDirect3D9 * WINAPI Direct3DCreate9(UINT SDKVersion); - -/* - * Stubs for graphics profiling. - */ - -int WINAPI D3DPERF_BeginEvent( D3DCOLOR col, LPCWSTR wszName ); -int WINAPI D3DPERF_EndEvent( void ); -void WINAPI D3DPERF_SetMarker( D3DCOLOR col, LPCWSTR wszName ); -void WINAPI D3DPERF_SetRegion( D3DCOLOR col, LPCWSTR wszName ); -BOOL WINAPI D3DPERF_QueryRepeatFrame( void ); - -void WINAPI D3DPERF_SetOptions( DWORD dwOptions ); -DWORD WINAPI D3DPERF_GetStatus( void ); - -/* - * Direct3D interfaces - */ - - - - - - -#undef INTERFACE -#define INTERFACE IDirect3D9 - -DECLARE_INTERFACE_(IDirect3D9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3D9 methods ***/ - STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; - STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; - STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; - STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; - STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; - STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; - STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; - STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; - STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; - STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; - STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; - STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Version; - #endif -}; - -typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3D9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3D9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3D9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) -#define IDirect3D9_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) -#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) -#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) -#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) -#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) -#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) -#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) -#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) -#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) -#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) -#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) -#define IDirect3D9_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) -#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) -#else -#define IDirect3D9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3D9_AddRef(p) (p)->AddRef() -#define IDirect3D9_Release(p) (p)->Release() -#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) -#define IDirect3D9_GetAdapterCount(p) (p)->GetAdapterCount() -#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) -#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) -#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) -#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) -#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) -#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) -#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) -#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) -#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) -#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) -#define IDirect3D9_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) -#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) -#endif - - - - - - - -/* SwapChain */ - - - - - - - - - - - - - - - -#undef INTERFACE -#define INTERFACE IDirect3DDevice9 - -DECLARE_INTERFACE_(IDirect3DDevice9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DDevice9 methods ***/ - STDMETHOD(TestCooperativeLevel)(THIS) PURE; - STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; - STDMETHOD(EvictManagedResources)(THIS) PURE; - STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; - STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; - STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; - STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; - STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; - STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; - STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; - STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; - STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; - STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; - STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; - STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; - STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; - STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; - STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; - STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; - STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; - STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; - STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; - STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; - STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; - STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; - STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; - STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; - STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; - STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; - STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; - STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; - STDMETHOD(BeginScene)(THIS) PURE; - STDMETHOD(EndScene)(THIS) PURE; - STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; - STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; - STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; - STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; - STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; - STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; - STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; - STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; - STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; - STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; - STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; - STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; - STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; - STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; - STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; - STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; - STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; - STDMETHOD(BeginStateBlock)(THIS) PURE; - STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; - STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; - STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; - STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; - STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; - STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; - STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; - STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; - STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; - STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; - STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; - STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; - STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; - STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; - STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; - STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; - STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; - STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; - STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; - STDMETHOD_(float, GetNPatchMode)(THIS) PURE; - STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; - STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; - STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; - STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; - STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; - STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; - STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; - STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; - STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; - STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; - STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; - STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; - STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; - STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; - STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE; - STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE; - STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE; - STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; - STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; - STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; - STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; - STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; - STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; - STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; - STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; - STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; - - #ifdef D3D_DEBUG_INFO - D3DDEVICE_CREATION_PARAMETERS CreationParameters; - D3DPRESENT_PARAMETERS PresentParameters; - D3DDISPLAYMODE DisplayMode; - D3DCAPS9 Caps; - - UINT AvailableTextureMem; - UINT SwapChains; - UINT Textures; - UINT VertexBuffers; - UINT IndexBuffers; - UINT VertexShaders; - UINT PixelShaders; - - D3DVIEWPORT9 Viewport; - D3DMATRIX ProjectionMatrix; - D3DMATRIX ViewMatrix; - D3DMATRIX WorldMatrix; - D3DMATRIX TextureMatrices[8]; - - DWORD FVF; - UINT VertexSize; - DWORD VertexShaderVersion; - DWORD PixelShaderVersion; - BOOL SoftwareVertexProcessing; - - D3DMATERIAL9 Material; - D3DLIGHT9 Lights[16]; - BOOL LightsEnabled[16]; - - D3DGAMMARAMP GammaRamp; - RECT ScissorRect; - BOOL DialogBoxMode; - #endif -}; - -typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DDevice9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DDevice9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) -#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) -#define IDirect3DDevice9_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) -#define IDirect3DDevice9_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) -#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) -#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) -#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) -#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) -#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) -#define IDirect3DDevice9_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) -#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) -#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) -#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) -#define IDirect3DDevice9_Reset(p,a) (p)->lpVtbl->Reset(p,a) -#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) -#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) -#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) -#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) -#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) -#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) -#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) -#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) -#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) -#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) -#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) -#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) -#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) -#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) -#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) -#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) -#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) -#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) -#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) -#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) -#define IDirect3DDevice9_BeginScene(p) (p)->lpVtbl->BeginScene(p) -#define IDirect3DDevice9_EndScene(p) (p)->lpVtbl->EndScene(p) -#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) -#define IDirect3DDevice9_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) -#define IDirect3DDevice9_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) -#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) -#define IDirect3DDevice9_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) -#define IDirect3DDevice9_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) -#define IDirect3DDevice9_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) -#define IDirect3DDevice9_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) -#define IDirect3DDevice9_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) -#define IDirect3DDevice9_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) -#define IDirect3DDevice9_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) -#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) -#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) -#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) -#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) -#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) -#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) -#define IDirect3DDevice9_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) -#define IDirect3DDevice9_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) -#define IDirect3DDevice9_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) -#define IDirect3DDevice9_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) -#define IDirect3DDevice9_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) -#define IDirect3DDevice9_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) -#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) -#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) -#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) -#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) -#define IDirect3DDevice9_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) -#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) -#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) -#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) -#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) -#define IDirect3DDevice9_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) -#define IDirect3DDevice9_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) -#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) -#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) -#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) -#define IDirect3DDevice9_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) -#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) -#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) -#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) -#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) -#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) -#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) -#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) -#define IDirect3DDevice9_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) -#define IDirect3DDevice9_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) -#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) -#define IDirect3DDevice9_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) -#define IDirect3DDevice9_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) -#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) -#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) -#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) -#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) -#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) -#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) -#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) -#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) -#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) -#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) -#define IDirect3DDevice9_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) -#define IDirect3DDevice9_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) -#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) -#define IDirect3DDevice9_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) -#define IDirect3DDevice9_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) -#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) -#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) -#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) -#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) -#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) -#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) -#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) -#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) -#define IDirect3DDevice9_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) -#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) -#else -#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DDevice9_AddRef(p) (p)->AddRef() -#define IDirect3DDevice9_Release(p) (p)->Release() -#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->TestCooperativeLevel() -#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() -#define IDirect3DDevice9_EvictManagedResources(p) (p)->EvictManagedResources() -#define IDirect3DDevice9_GetDirect3D(p,a) (p)->GetDirect3D(a) -#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) -#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) -#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->GetCreationParameters(a) -#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) -#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) -#define IDirect3DDevice9_ShowCursor(p,a) (p)->ShowCursor(a) -#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) -#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) -#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() -#define IDirect3DDevice9_Reset(p,a) (p)->Reset(a) -#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->Present(a,b,c,d) -#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) -#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) -#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) -#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) -#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) -#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) -#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) -#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) -#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) -#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) -#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) -#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) -#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) -#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) -#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) -#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) -#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) -#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) -#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) -#define IDirect3DDevice9_BeginScene(p) (p)->BeginScene() -#define IDirect3DDevice9_EndScene(p) (p)->EndScene() -#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) -#define IDirect3DDevice9_SetTransform(p,a,b) (p)->SetTransform(a,b) -#define IDirect3DDevice9_GetTransform(p,a,b) (p)->GetTransform(a,b) -#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) -#define IDirect3DDevice9_SetViewport(p,a) (p)->SetViewport(a) -#define IDirect3DDevice9_GetViewport(p,a) (p)->GetViewport(a) -#define IDirect3DDevice9_SetMaterial(p,a) (p)->SetMaterial(a) -#define IDirect3DDevice9_GetMaterial(p,a) (p)->GetMaterial(a) -#define IDirect3DDevice9_SetLight(p,a,b) (p)->SetLight(a,b) -#define IDirect3DDevice9_GetLight(p,a,b) (p)->GetLight(a,b) -#define IDirect3DDevice9_LightEnable(p,a,b) (p)->LightEnable(a,b) -#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) -#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) -#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) -#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->SetRenderState(a,b) -#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->GetRenderState(a,b) -#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) -#define IDirect3DDevice9_BeginStateBlock(p) (p)->BeginStateBlock() -#define IDirect3DDevice9_EndStateBlock(p,a) (p)->EndStateBlock(a) -#define IDirect3DDevice9_SetClipStatus(p,a) (p)->SetClipStatus(a) -#define IDirect3DDevice9_GetClipStatus(p,a) (p)->GetClipStatus(a) -#define IDirect3DDevice9_GetTexture(p,a,b) (p)->GetTexture(a,b) -#define IDirect3DDevice9_SetTexture(p,a,b) (p)->SetTexture(a,b) -#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) -#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) -#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) -#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) -#define IDirect3DDevice9_ValidateDevice(p,a) (p)->ValidateDevice(a) -#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) -#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) -#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) -#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) -#define IDirect3DDevice9_SetScissorRect(p,a) (p)->SetScissorRect(a) -#define IDirect3DDevice9_GetScissorRect(p,a) (p)->GetScissorRect(a) -#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) -#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() -#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->SetNPatchMode(a) -#define IDirect3DDevice9_GetNPatchMode(p) (p)->GetNPatchMode() -#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) -#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) -#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) -#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) -#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) -#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) -#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) -#define IDirect3DDevice9_SetFVF(p,a) (p)->SetFVF(a) -#define IDirect3DDevice9_GetFVF(p,a) (p)->GetFVF(a) -#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) -#define IDirect3DDevice9_SetVertexShader(p,a) (p)->SetVertexShader(a) -#define IDirect3DDevice9_GetVertexShader(p,a) (p)->GetVertexShader(a) -#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) -#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) -#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) -#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) -#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) -#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) -#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) -#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) -#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) -#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) -#define IDirect3DDevice9_SetIndices(p,a) (p)->SetIndices(a) -#define IDirect3DDevice9_GetIndices(p,a) (p)->GetIndices(a) -#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) -#define IDirect3DDevice9_SetPixelShader(p,a) (p)->SetPixelShader(a) -#define IDirect3DDevice9_GetPixelShader(p,a) (p)->GetPixelShader(a) -#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) -#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) -#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) -#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) -#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) -#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) -#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) -#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) -#define IDirect3DDevice9_DeletePatch(p,a) (p)->DeletePatch(a) -#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->CreateQuery(a,b) -#endif - - - - - -#undef INTERFACE -#define INTERFACE IDirect3DStateBlock9 - -DECLARE_INTERFACE_(IDirect3DStateBlock9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DStateBlock9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(Capture)(THIS) PURE; - STDMETHOD(Apply)(THIS) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DStateBlock9 *LPDIRECT3DSTATEBLOCK9, *PDIRECT3DSTATEBLOCK9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DStateBlock9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DStateBlock9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DStateBlock9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DStateBlock9_Capture(p) (p)->lpVtbl->Capture(p) -#define IDirect3DStateBlock9_Apply(p) (p)->lpVtbl->Apply(p) -#else -#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DStateBlock9_AddRef(p) (p)->AddRef() -#define IDirect3DStateBlock9_Release(p) (p)->Release() -#define IDirect3DStateBlock9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DStateBlock9_Capture(p) (p)->Capture() -#define IDirect3DStateBlock9_Apply(p) (p)->Apply() -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DSwapChain9 - -DECLARE_INTERFACE_(IDirect3DSwapChain9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DSwapChain9 methods ***/ - STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; - STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; - STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; - STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; - STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; - - #ifdef D3D_DEBUG_INFO - D3DPRESENT_PARAMETERS PresentParameters; - D3DDISPLAYMODE DisplayMode; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DSwapChain9 *LPDIRECT3DSWAPCHAIN9, *PDIRECT3DSWAPCHAIN9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DSwapChain9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DSwapChain9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) -#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) -#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) -#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) -#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) -#define IDirect3DSwapChain9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) -#else -#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DSwapChain9_AddRef(p) (p)->AddRef() -#define IDirect3DSwapChain9_Release(p) (p)->Release() -#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) -#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) -#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) -#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->GetRasterStatus(a) -#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->GetDisplayMode(a) -#define IDirect3DSwapChain9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->GetPresentParameters(a) -#endif - - - -#undef INTERFACE -#define INTERFACE IDirect3DResource9 - -DECLARE_INTERFACE_(IDirect3DResource9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DResource9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; -}; - -typedef struct IDirect3DResource9 *LPDIRECT3DRESOURCE9, *PDIRECT3DRESOURCE9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DResource9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DResource9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DResource9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DResource9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DResource9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DResource9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DResource9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DResource9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DResource9_GetType(p) (p)->lpVtbl->GetType(p) -#else -#define IDirect3DResource9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DResource9_AddRef(p) (p)->AddRef() -#define IDirect3DResource9_Release(p) (p)->Release() -#define IDirect3DResource9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DResource9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DResource9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DResource9_GetPriority(p) (p)->GetPriority() -#define IDirect3DResource9_PreLoad(p) (p)->PreLoad() -#define IDirect3DResource9_GetType(p) (p)->GetType() -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DVertexDeclaration9 - -DECLARE_INTERFACE_(IDirect3DVertexDeclaration9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DVertexDeclaration9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9* pElement,UINT* pNumElements) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DVertexDeclaration9 *LPDIRECT3DVERTEXDECLARATION9, *PDIRECT3DVERTEXDECLARATION9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DVertexDeclaration9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DVertexDeclaration9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->lpVtbl->GetDeclaration(p,a,b) -#else -#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DVertexDeclaration9_AddRef(p) (p)->AddRef() -#define IDirect3DVertexDeclaration9_Release(p) (p)->Release() -#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->GetDeclaration(a,b) -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DVertexShader9 - -DECLARE_INTERFACE_(IDirect3DVertexShader9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DVertexShader9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; - - #ifdef D3D_DEBUG_INFO - DWORD Version; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DVertexShader9 *LPDIRECT3DVERTEXSHADER9, *PDIRECT3DVERTEXSHADER9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DVertexShader9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DVertexShader9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DVertexShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) -#else -#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DVertexShader9_AddRef(p) (p)->AddRef() -#define IDirect3DVertexShader9_Release(p) (p)->Release() -#define IDirect3DVertexShader9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DPixelShader9 - -DECLARE_INTERFACE_(IDirect3DPixelShader9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DPixelShader9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; - - #ifdef D3D_DEBUG_INFO - DWORD Version; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DPixelShader9 *LPDIRECT3DPIXELSHADER9, *PDIRECT3DPIXELSHADER9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DPixelShader9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DPixelShader9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DPixelShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) -#else -#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DPixelShader9_AddRef(p) (p)->AddRef() -#define IDirect3DPixelShader9_Release(p) (p)->Release() -#define IDirect3DPixelShader9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DBaseTexture9 - -DECLARE_INTERFACE_(IDirect3DBaseTexture9, IDirect3DResource9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DResource9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; - STDMETHOD_(DWORD, GetLOD)(THIS) PURE; - STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; - STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; - STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; - STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; -}; - -typedef struct IDirect3DBaseTexture9 *LPDIRECT3DBASETEXTURE9, *PDIRECT3DBASETEXTURE9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DBaseTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DBaseTexture9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DBaseTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DBaseTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DBaseTexture9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) -#define IDirect3DBaseTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) -#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) -#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) -#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) -#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) -#else -#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DBaseTexture9_AddRef(p) (p)->AddRef() -#define IDirect3DBaseTexture9_Release(p) (p)->Release() -#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DBaseTexture9_GetPriority(p) (p)->GetPriority() -#define IDirect3DBaseTexture9_PreLoad(p) (p)->PreLoad() -#define IDirect3DBaseTexture9_GetType(p) (p)->GetType() -#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->SetLOD(a) -#define IDirect3DBaseTexture9_GetLOD(p) (p)->GetLOD() -#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->GetLevelCount() -#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) -#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() -#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() -#endif - - - - - -#undef INTERFACE -#define INTERFACE IDirect3DTexture9 - -DECLARE_INTERFACE_(IDirect3DTexture9, IDirect3DBaseTexture9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DBaseTexture9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; - STDMETHOD_(DWORD, GetLOD)(THIS) PURE; - STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; - STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; - STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; - STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; - STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; - STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface9** ppSurfaceLevel) PURE; - STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; - STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; - STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Name; - UINT Width; - UINT Height; - UINT Levels; - DWORD Usage; - D3DFORMAT Format; - D3DPOOL Pool; - DWORD Priority; - DWORD LOD; - D3DTEXTUREFILTERTYPE FilterType; - UINT LockCount; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DTexture9 *LPDIRECT3DTEXTURE9, *PDIRECT3DTEXTURE9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DTexture9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DTexture9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) -#define IDirect3DTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) -#define IDirect3DTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) -#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) -#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) -#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) -#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) -#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) -#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) -#define IDirect3DTexture9_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) -#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) -#else -#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DTexture9_AddRef(p) (p)->AddRef() -#define IDirect3DTexture9_Release(p) (p)->Release() -#define IDirect3DTexture9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DTexture9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DTexture9_GetPriority(p) (p)->GetPriority() -#define IDirect3DTexture9_PreLoad(p) (p)->PreLoad() -#define IDirect3DTexture9_GetType(p) (p)->GetType() -#define IDirect3DTexture9_SetLOD(p,a) (p)->SetLOD(a) -#define IDirect3DTexture9_GetLOD(p) (p)->GetLOD() -#define IDirect3DTexture9_GetLevelCount(p) (p)->GetLevelCount() -#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) -#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() -#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() -#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) -#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) -#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) -#define IDirect3DTexture9_UnlockRect(p,a) (p)->UnlockRect(a) -#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->AddDirtyRect(a) -#endif - - - - - -#undef INTERFACE -#define INTERFACE IDirect3DVolumeTexture9 - -DECLARE_INTERFACE_(IDirect3DVolumeTexture9, IDirect3DBaseTexture9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DBaseTexture9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; - STDMETHOD_(DWORD, GetLOD)(THIS) PURE; - STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; - STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; - STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; - STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; - STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; - STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume9** ppVolumeLevel) PURE; - STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; - STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; - STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Name; - UINT Width; - UINT Height; - UINT Depth; - UINT Levels; - DWORD Usage; - D3DFORMAT Format; - D3DPOOL Pool; - DWORD Priority; - DWORD LOD; - D3DTEXTUREFILTERTYPE FilterType; - UINT LockCount; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DVolumeTexture9 *LPDIRECT3DVOLUMETEXTURE9, *PDIRECT3DVOLUMETEXTURE9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DVolumeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DVolumeTexture9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DVolumeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DVolumeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DVolumeTexture9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) -#define IDirect3DVolumeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) -#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) -#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) -#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) -#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) -#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) -#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) -#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) -#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) -#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) -#else -#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DVolumeTexture9_AddRef(p) (p)->AddRef() -#define IDirect3DVolumeTexture9_Release(p) (p)->Release() -#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DVolumeTexture9_GetPriority(p) (p)->GetPriority() -#define IDirect3DVolumeTexture9_PreLoad(p) (p)->PreLoad() -#define IDirect3DVolumeTexture9_GetType(p) (p)->GetType() -#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->SetLOD(a) -#define IDirect3DVolumeTexture9_GetLOD(p) (p)->GetLOD() -#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->GetLevelCount() -#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) -#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() -#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() -#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) -#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) -#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) -#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->UnlockBox(a) -#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->AddDirtyBox(a) -#endif - - - - - -#undef INTERFACE -#define INTERFACE IDirect3DCubeTexture9 - -DECLARE_INTERFACE_(IDirect3DCubeTexture9, IDirect3DBaseTexture9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DBaseTexture9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; - STDMETHOD_(DWORD, GetLOD)(THIS) PURE; - STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; - STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; - STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; - STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; - STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; - STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface9** ppCubeMapSurface) PURE; - STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; - STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; - STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Name; - UINT Width; - UINT Height; - UINT Levels; - DWORD Usage; - D3DFORMAT Format; - D3DPOOL Pool; - DWORD Priority; - DWORD LOD; - D3DTEXTUREFILTERTYPE FilterType; - UINT LockCount; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DCubeTexture9 *LPDIRECT3DCUBETEXTURE9, *PDIRECT3DCUBETEXTURE9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DCubeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DCubeTexture9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DCubeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DCubeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DCubeTexture9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) -#define IDirect3DCubeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) -#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) -#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) -#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) -#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) -#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) -#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) -#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) -#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) -#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) -#else -#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DCubeTexture9_AddRef(p) (p)->AddRef() -#define IDirect3DCubeTexture9_Release(p) (p)->Release() -#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DCubeTexture9_GetPriority(p) (p)->GetPriority() -#define IDirect3DCubeTexture9_PreLoad(p) (p)->PreLoad() -#define IDirect3DCubeTexture9_GetType(p) (p)->GetType() -#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->SetLOD(a) -#define IDirect3DCubeTexture9_GetLOD(p) (p)->GetLOD() -#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->GetLevelCount() -#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) -#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() -#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() -#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) -#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) -#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) -#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->UnlockRect(a,b) -#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DVertexBuffer9 - -DECLARE_INTERFACE_(IDirect3DVertexBuffer9, IDirect3DResource9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DResource9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; - STDMETHOD(Unlock)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Name; - UINT Length; - DWORD Usage; - DWORD FVF; - D3DPOOL Pool; - DWORD Priority; - UINT LockCount; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DVertexBuffer9 *LPDIRECT3DVERTEXBUFFER9, *PDIRECT3DVERTEXBUFFER9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DVertexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DVertexBuffer9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DVertexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DVertexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DVertexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) -#define IDirect3DVertexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) -#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) -#else -#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DVertexBuffer9_AddRef(p) (p)->AddRef() -#define IDirect3DVertexBuffer9_Release(p) (p)->Release() -#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DVertexBuffer9_GetPriority(p) (p)->GetPriority() -#define IDirect3DVertexBuffer9_PreLoad(p) (p)->PreLoad() -#define IDirect3DVertexBuffer9_GetType(p) (p)->GetType() -#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) -#define IDirect3DVertexBuffer9_Unlock(p) (p)->Unlock() -#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->GetDesc(a) -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DIndexBuffer9 - -DECLARE_INTERFACE_(IDirect3DIndexBuffer9, IDirect3DResource9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DResource9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; - STDMETHOD(Unlock)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Name; - UINT Length; - DWORD Usage; - D3DFORMAT Format; - D3DPOOL Pool; - DWORD Priority; - UINT LockCount; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DIndexBuffer9 *LPDIRECT3DINDEXBUFFER9, *PDIRECT3DINDEXBUFFER9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DIndexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DIndexBuffer9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DIndexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DIndexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DIndexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) -#define IDirect3DIndexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) -#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) -#else -#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DIndexBuffer9_AddRef(p) (p)->AddRef() -#define IDirect3DIndexBuffer9_Release(p) (p)->Release() -#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DIndexBuffer9_GetPriority(p) (p)->GetPriority() -#define IDirect3DIndexBuffer9_PreLoad(p) (p)->PreLoad() -#define IDirect3DIndexBuffer9_GetType(p) (p)->GetType() -#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) -#define IDirect3DIndexBuffer9_Unlock(p) (p)->Unlock() -#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->GetDesc(a) -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DSurface9 - -DECLARE_INTERFACE_(IDirect3DSurface9, IDirect3DResource9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DResource9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; - STDMETHOD_(DWORD, GetPriority)(THIS) PURE; - STDMETHOD_(void, PreLoad)(THIS) PURE; - STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; - STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; - STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; - STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; - STDMETHOD(UnlockRect)(THIS) PURE; - STDMETHOD(GetDC)(THIS_ HDC *phdc) PURE; - STDMETHOD(ReleaseDC)(THIS_ HDC hdc) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Name; - UINT Width; - UINT Height; - DWORD Usage; - D3DFORMAT Format; - D3DPOOL Pool; - D3DMULTISAMPLE_TYPE MultiSampleType; - DWORD MultiSampleQuality; - DWORD Priority; - UINT LockCount; - UINT DCCount; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DSurface9 *LPDIRECT3DSURFACE9, *PDIRECT3DSURFACE9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DSurface9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DSurface9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DSurface9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DSurface9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DSurface9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) -#define IDirect3DSurface9_GetPriority(p) (p)->lpVtbl->GetPriority(p) -#define IDirect3DSurface9_PreLoad(p) (p)->lpVtbl->PreLoad(p) -#define IDirect3DSurface9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DSurface9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) -#define IDirect3DSurface9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) -#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) -#define IDirect3DSurface9_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) -#define IDirect3DSurface9_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) -#define IDirect3DSurface9_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) -#else -#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DSurface9_AddRef(p) (p)->AddRef() -#define IDirect3DSurface9_Release(p) (p)->Release() -#define IDirect3DSurface9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DSurface9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DSurface9_SetPriority(p,a) (p)->SetPriority(a) -#define IDirect3DSurface9_GetPriority(p) (p)->GetPriority() -#define IDirect3DSurface9_PreLoad(p) (p)->PreLoad() -#define IDirect3DSurface9_GetType(p) (p)->GetType() -#define IDirect3DSurface9_GetContainer(p,a,b) (p)->GetContainer(a,b) -#define IDirect3DSurface9_GetDesc(p,a) (p)->GetDesc(a) -#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->LockRect(a,b,c) -#define IDirect3DSurface9_UnlockRect(p) (p)->UnlockRect() -#define IDirect3DSurface9_GetDC(p,a) (p)->GetDC(a) -#define IDirect3DSurface9_ReleaseDC(p,a) (p)->ReleaseDC(a) -#endif - - - - - -#undef INTERFACE -#define INTERFACE IDirect3DVolume9 - -DECLARE_INTERFACE_(IDirect3DVolume9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DVolume9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; - STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; - STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; - STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; - STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; - STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; - STDMETHOD(UnlockBox)(THIS) PURE; - - #ifdef D3D_DEBUG_INFO - LPCWSTR Name; - UINT Width; - UINT Height; - UINT Depth; - DWORD Usage; - D3DFORMAT Format; - D3DPOOL Pool; - UINT LockCount; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DVolume9 *LPDIRECT3DVOLUME9, *PDIRECT3DVOLUME9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DVolume9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DVolume9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DVolume9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) -#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) -#define IDirect3DVolume9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) -#define IDirect3DVolume9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) -#define IDirect3DVolume9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) -#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) -#define IDirect3DVolume9_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) -#else -#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DVolume9_AddRef(p) (p)->AddRef() -#define IDirect3DVolume9_Release(p) (p)->Release() -#define IDirect3DVolume9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) -#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) -#define IDirect3DVolume9_FreePrivateData(p,a) (p)->FreePrivateData(a) -#define IDirect3DVolume9_GetContainer(p,a,b) (p)->GetContainer(a,b) -#define IDirect3DVolume9_GetDesc(p,a) (p)->GetDesc(a) -#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->LockBox(a,b,c) -#define IDirect3DVolume9_UnlockBox(p) (p)->UnlockBox() -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DQuery9 - -DECLARE_INTERFACE_(IDirect3DQuery9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DQuery9 methods ***/ - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD_(D3DQUERYTYPE, GetType)(THIS) PURE; - STDMETHOD_(DWORD, GetDataSize)(THIS) PURE; - STDMETHOD(Issue)(THIS_ DWORD dwIssueFlags) PURE; - STDMETHOD(GetData)(THIS_ void* pData,DWORD dwSize,DWORD dwGetDataFlags) PURE; - - #ifdef D3D_DEBUG_INFO - D3DQUERYTYPE Type; - DWORD DataSize; - LPCWSTR CreationCallStack; - #endif -}; - -typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DQuery9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DQuery9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DQuery9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DQuery9_GetType(p) (p)->lpVtbl->GetType(p) -#define IDirect3DQuery9_GetDataSize(p) (p)->lpVtbl->GetDataSize(p) -#define IDirect3DQuery9_Issue(p,a) (p)->lpVtbl->Issue(p,a) -#define IDirect3DQuery9_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c) -#else -#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DQuery9_AddRef(p) (p)->AddRef() -#define IDirect3DQuery9_Release(p) (p)->Release() -#define IDirect3DQuery9_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DQuery9_GetType(p) (p)->GetType() -#define IDirect3DQuery9_GetDataSize(p) (p)->GetDataSize() -#define IDirect3DQuery9_Issue(p,a) (p)->Issue(a) -#define IDirect3DQuery9_GetData(p,a,b,c) (p)->GetData(a,b,c) -#endif - -/**************************************************************************** - * Flags for SetPrivateData method on all D3D9 interfaces - * - * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData - * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this - * pointer and Release when the private data is destroyed. The data will be - * destroyed when another SetPrivateData with the same GUID is set, when - * FreePrivateData is called, or when the D3D9 object is freed. - ****************************************************************************/ -#define D3DSPD_IUNKNOWN 0x00000001L - -/**************************************************************************** - * - * Flags for IDirect3D9::CreateDevice's BehaviorFlags - * - ****************************************************************************/ - -#define D3DCREATE_FPU_PRESERVE 0x00000002L -#define D3DCREATE_MULTITHREADED 0x00000004L - -#define D3DCREATE_PUREDEVICE 0x00000010L -#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L -#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L -#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L - -#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L -#define D3DCREATE_ADAPTERGROUP_DEVICE 0x00000200L -#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX 0x00000400L - -// This flag causes the D3D runtime not to alter the focus -// window in any way. Use with caution- the burden of supporting -// focus management events (alt-tab, etc.) falls on the -// application, and appropriate responses (switching display -// mode, etc.) should be coded. -#define D3DCREATE_NOWINDOWCHANGES 0x00000800L - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -// Disable multithreading for software vertex processing -#define D3DCREATE_DISABLE_PSGP_THREADING 0x00002000L -// This flag enables present statistics on device. -#define D3DCREATE_ENABLE_PRESENTSTATS 0x00004000L -// This flag disables printscreen support in the runtime for this device -#define D3DCREATE_DISABLE_PRINTSCREEN 0x00008000L - -#define D3DCREATE_SCREENSAVER 0x10000000L - - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - - - -/**************************************************************************** - * - * Parameter for IDirect3D9::CreateDevice's Adapter argument - * - ****************************************************************************/ - -#define D3DADAPTER_DEFAULT 0 - -/**************************************************************************** - * - * Flags for IDirect3D9::EnumAdapters - * - ****************************************************************************/ - -/* - * The D3DENUM_WHQL_LEVEL value has been retired for 9Ex and future versions, - * but it needs to be defined here for compatibility with DX9 and earlier versions. - * See the DirectX SDK for sample code on discovering driver signatures. - */ -#define D3DENUM_WHQL_LEVEL 0x00000002L - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -/* NO_DRIVERVERSION will not fill out the DriverVersion field, nor will the - DriverVersion be incorporated into the DeviceIdentifier GUID. WINNT only */ -#define D3DENUM_NO_DRIVERVERSION 0x00000004L - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - - -/**************************************************************************** - * - * Maximum number of back-buffers supported in DX9 - * - ****************************************************************************/ - -#define D3DPRESENT_BACK_BUFFERS_MAX 3L - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -/**************************************************************************** - * - * Maximum number of back-buffers supported when apps use CreateDeviceEx - * - ****************************************************************************/ - -#define D3DPRESENT_BACK_BUFFERS_MAX_EX 30L - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -/**************************************************************************** - * - * Flags for IDirect3DDevice9::SetGammaRamp - * - ****************************************************************************/ - -#define D3DSGR_NO_CALIBRATION 0x00000000L -#define D3DSGR_CALIBRATE 0x00000001L - -/**************************************************************************** - * - * Flags for IDirect3DDevice9::SetCursorPosition - * - ****************************************************************************/ - -#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L - -/**************************************************************************** - * - * Flags for IDirect3DSwapChain9::Present - * - ****************************************************************************/ - -#define D3DPRESENT_DONOTWAIT 0x00000001L -#define D3DPRESENT_LINEAR_CONTENT 0x00000002L - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -#define D3DPRESENT_DONOTFLIP 0x00000004L -#define D3DPRESENT_FLIPRESTART 0x00000008L -#define D3DPRESENT_VIDEO_RESTRICT_TO_MONITOR 0x00000010L -#define D3DPRESENT_UPDATEOVERLAYONLY 0x00000020L -#define D3DPRESENT_HIDEOVERLAY 0x00000040L -#define D3DPRESENT_UPDATECOLORKEY 0x00000080L -#define D3DPRESENT_FORCEIMMEDIATE 0x00000100L - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - - -/**************************************************************************** - * - * Flags for DrawPrimitive/DrawIndexedPrimitive - * Also valid for Begin/BeginIndexed - * Also valid for VertexBuffer::CreateVertexBuffer - ****************************************************************************/ - - -/* - * DirectDraw error codes - */ -#define _FACD3D 0x876 -#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) -#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) - -/* - * Direct3D Errors - */ -#define D3D_OK S_OK - -#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) -#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) -#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) -#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) -#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) -#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) -#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) -#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) -#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) -#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) -#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) -#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) - -#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) -#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) -#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) -#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) -#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) -#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) -#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) -#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) -#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) -#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) -#define D3DOK_NOAUTOGEN MAKE_D3DSTATUS(2159) - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - - -#define D3DERR_DEVICEREMOVED MAKE_D3DHRESULT(2160) -#define S_NOT_RESIDENT MAKE_D3DSTATUS(2165) -#define S_RESIDENT_IN_SHARED_MEMORY MAKE_D3DSTATUS(2166) -#define S_PRESENT_MODE_CHANGED MAKE_D3DSTATUS(2167) -#define S_PRESENT_OCCLUDED MAKE_D3DSTATUS(2168) -#define D3DERR_DEVICEHUNG MAKE_D3DHRESULT(2164) -#define D3DERR_UNSUPPORTEDOVERLAY MAKE_D3DHRESULT(2171) -#define D3DERR_UNSUPPORTEDOVERLAYFORMAT MAKE_D3DHRESULT(2172) -#define D3DERR_CANNOTPROTECTCONTENT MAKE_D3DHRESULT(2173) -#define D3DERR_UNSUPPORTEDCRYPTO MAKE_D3DHRESULT(2174) -#define D3DERR_PRESENT_STATISTICS_DISJOINT MAKE_D3DHRESULT(2180) - - -/********************* - * D3D9Ex interfaces - *********************/ - -HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**); - - - - -#undef INTERFACE -#define INTERFACE IDirect3D9Ex - -DECLARE_INTERFACE_(IDirect3D9Ex, IDirect3D9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3D9 methods ***/ - STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; - STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; - STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; - STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; - STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; - STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; - STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; - STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; - STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; - STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; - STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; - STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; - STDMETHOD_(UINT, GetAdapterModeCountEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter ) PURE; - STDMETHOD(EnumAdapterModesEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter,UINT Mode,D3DDISPLAYMODEEX* pMode) PURE; - STDMETHOD(GetAdapterDisplayModeEx)(THIS_ UINT Adapter,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; - STDMETHOD(CreateDeviceEx)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX* pFullscreenDisplayMode,IDirect3DDevice9Ex** ppReturnedDeviceInterface) PURE; - STDMETHOD(GetAdapterLUID)(THIS_ UINT Adapter,LUID * pLUID) PURE; -}; - -typedef struct IDirect3D9Ex *LPDIRECT3D9EX, *PDIRECT3D9EX; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3D9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3D9Ex_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3D9Ex_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) -#define IDirect3D9Ex_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) -#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) -#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) -#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) -#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) -#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) -#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) -#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) -#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) -#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) -#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) -#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) -#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) -#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->lpVtbl->GetAdapterModeCountEx(p,a,b) -#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModesEx(p,a,b,c,d) -#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetAdapterDisplayModeEx(p,a,b,c) -#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d,e,f,g) -#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->lpVtbl->GetAdapterLUID(p,a,b) -#else -#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3D9Ex_AddRef(p) (p)->AddRef() -#define IDirect3D9Ex_Release(p) (p)->Release() -#define IDirect3D9Ex_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) -#define IDirect3D9Ex_GetAdapterCount(p) (p)->GetAdapterCount() -#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) -#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) -#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) -#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) -#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) -#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) -#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) -#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) -#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) -#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) -#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) -#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) -#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->GetAdapterModeCountEx(a,b) -#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->EnumAdapterModesEx(a,b,c,d) -#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->GetAdapterDisplayModeEx(a,b,c) -#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->CreateDeviceEx(a,b,c,d,e,f,g) -#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->GetAdapterLUID(a,b) -#endif - - - - - - - - - - - - - - - - - - - - - - - - -#undef INTERFACE -#define INTERFACE IDirect3DDevice9Ex - -DECLARE_INTERFACE_(IDirect3DDevice9Ex, IDirect3DDevice9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DDevice9 methods ***/ - STDMETHOD(TestCooperativeLevel)(THIS) PURE; - STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; - STDMETHOD(EvictManagedResources)(THIS) PURE; - STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; - STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; - STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; - STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; - STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; - STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; - STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; - STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; - STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; - STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; - STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; - STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; - STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; - STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; - STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; - STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; - STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; - STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; - STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; - STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; - STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; - STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; - STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; - STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; - STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; - STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; - STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; - STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; - STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; - STDMETHOD(BeginScene)(THIS) PURE; - STDMETHOD(EndScene)(THIS) PURE; - STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; - STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; - STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; - STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; - STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; - STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; - STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; - STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; - STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; - STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; - STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; - STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; - STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; - STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; - STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; - STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; - STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; - STDMETHOD(BeginStateBlock)(THIS) PURE; - STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; - STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; - STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; - STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; - STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; - STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; - STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; - STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; - STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; - STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; - STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; - STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; - STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; - STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; - STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; - STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; - STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; - STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; - STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; - STDMETHOD_(float, GetNPatchMode)(THIS) PURE; - STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; - STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; - STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; - STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; - STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; - STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; - STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; - STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; - STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; - STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; - STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; - STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; - STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; - STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; - STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE; - STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE; - STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE; - STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; - STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; - STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; - STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; - STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; - STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; - STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; - STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; - STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; - STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; - STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; - STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; - STDMETHOD(SetConvolutionMonoKernel)(THIS_ UINT width,UINT height,float* rows,float* columns) PURE; - STDMETHOD(ComposeRects)(THIS_ IDirect3DSurface9* pSrc,IDirect3DSurface9* pDst,IDirect3DVertexBuffer9* pSrcRectDescs,UINT NumRects,IDirect3DVertexBuffer9* pDstRectDescs,D3DCOMPOSERECTSOP Operation,int Xoffset,int Yoffset) PURE; - STDMETHOD(PresentEx)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; - STDMETHOD(GetGPUThreadPriority)(THIS_ INT* pPriority) PURE; - STDMETHOD(SetGPUThreadPriority)(THIS_ INT Priority) PURE; - STDMETHOD(WaitForVBlank)(THIS_ UINT iSwapChain) PURE; - STDMETHOD(CheckResourceResidency)(THIS_ IDirect3DResource9** pResourceArray,UINT32 NumResources) PURE; - STDMETHOD(SetMaximumFrameLatency)(THIS_ UINT MaxLatency) PURE; - STDMETHOD(GetMaximumFrameLatency)(THIS_ UINT* pMaxLatency) PURE; - STDMETHOD(CheckDeviceState)(THIS_ HWND hDestinationWindow) PURE; - STDMETHOD(CreateRenderTargetEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; - STDMETHOD(CreateOffscreenPlainSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; - STDMETHOD(CreateDepthStencilSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; - STDMETHOD(ResetEx)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX *pFullscreenDisplayMode) PURE; - STDMETHOD(GetDisplayModeEx)(THIS_ UINT iSwapChain,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; -}; - -typedef struct IDirect3DDevice9Ex *LPDIRECT3DDEVICE9EX, *PDIRECT3DDEVICE9EX; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DDevice9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DDevice9Ex_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) -#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) -#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) -#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) -#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) -#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) -#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) -#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) -#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) -#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) -#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) -#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) -#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) -#define IDirect3DDevice9Ex_Reset(p,a) (p)->lpVtbl->Reset(p,a) -#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) -#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) -#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) -#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) -#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) -#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) -#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) -#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) -#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) -#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) -#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) -#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) -#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) -#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) -#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) -#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) -#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) -#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) -#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) -#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) -#define IDirect3DDevice9Ex_BeginScene(p) (p)->lpVtbl->BeginScene(p) -#define IDirect3DDevice9Ex_EndScene(p) (p)->lpVtbl->EndScene(p) -#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) -#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) -#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) -#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) -#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) -#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) -#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) -#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) -#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) -#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) -#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) -#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) -#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) -#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) -#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) -#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) -#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) -#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) -#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) -#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) -#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) -#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) -#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) -#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) -#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) -#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) -#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) -#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) -#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) -#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) -#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) -#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) -#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) -#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) -#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) -#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) -#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) -#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) -#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) -#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) -#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) -#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) -#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) -#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) -#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) -#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) -#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) -#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) -#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) -#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) -#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) -#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) -#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) -#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) -#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) -#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) -#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) -#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) -#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) -#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) -#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) -#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) -#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) -#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) -#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) -#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) -#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) -#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) -#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) -#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) -#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) -#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) -#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) -#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) -#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) -#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->lpVtbl->SetConvolutionMonoKernel(p,a,b,c,d) -#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->ComposeRects(p,a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->lpVtbl->PresentEx(p,a,b,c,d,e) -#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->lpVtbl->GetGPUThreadPriority(p,a) -#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->lpVtbl->SetGPUThreadPriority(p,a) -#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->lpVtbl->WaitForVBlank(p,a) -#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->lpVtbl->CheckResourceResidency(p,a,b) -#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->lpVtbl->SetMaximumFrameLatency(p,a) -#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->lpVtbl->GetMaximumFrameLatency(p,a) -#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->lpVtbl->CheckDeviceState(p,a) -#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) -#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->lpVtbl->ResetEx(p,a,b) -#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetDisplayModeEx(p,a,b,c) -#else -#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DDevice9Ex_AddRef(p) (p)->AddRef() -#define IDirect3DDevice9Ex_Release(p) (p)->Release() -#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->TestCooperativeLevel() -#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() -#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->EvictManagedResources() -#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->GetDirect3D(a) -#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) -#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) -#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->GetCreationParameters(a) -#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) -#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) -#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->ShowCursor(a) -#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) -#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) -#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() -#define IDirect3DDevice9Ex_Reset(p,a) (p)->Reset(a) -#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->Present(a,b,c,d) -#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) -#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) -#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) -#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) -#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) -#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) -#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) -#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) -#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) -#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) -#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) -#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) -#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) -#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) -#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) -#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) -#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) -#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) -#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) -#define IDirect3DDevice9Ex_BeginScene(p) (p)->BeginScene() -#define IDirect3DDevice9Ex_EndScene(p) (p)->EndScene() -#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) -#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->SetTransform(a,b) -#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->GetTransform(a,b) -#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) -#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->SetViewport(a) -#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->GetViewport(a) -#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->SetMaterial(a) -#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->GetMaterial(a) -#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->SetLight(a,b) -#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->GetLight(a,b) -#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->LightEnable(a,b) -#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) -#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) -#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) -#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->SetRenderState(a,b) -#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->GetRenderState(a,b) -#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) -#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->BeginStateBlock() -#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->EndStateBlock(a) -#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->SetClipStatus(a) -#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->GetClipStatus(a) -#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->GetTexture(a,b) -#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->SetTexture(a,b) -#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) -#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) -#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) -#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) -#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->ValidateDevice(a) -#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) -#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) -#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) -#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) -#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->SetScissorRect(a) -#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->GetScissorRect(a) -#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) -#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() -#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->SetNPatchMode(a) -#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->GetNPatchMode() -#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) -#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) -#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) -#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) -#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) -#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) -#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) -#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->SetFVF(a) -#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->GetFVF(a) -#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) -#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->SetVertexShader(a) -#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->GetVertexShader(a) -#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) -#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) -#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) -#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) -#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) -#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) -#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) -#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) -#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) -#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) -#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->SetIndices(a) -#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->GetIndices(a) -#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) -#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->SetPixelShader(a) -#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->GetPixelShader(a) -#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) -#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) -#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) -#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) -#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) -#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) -#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) -#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) -#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->DeletePatch(a) -#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->CreateQuery(a,b) -#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->SetConvolutionMonoKernel(a,b,c,d) -#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->ComposeRects(a,b,c,d,e,f,g,h) -#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->PresentEx(a,b,c,d,e) -#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->GetGPUThreadPriority(a) -#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->SetGPUThreadPriority(a) -#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->WaitForVBlank(a) -#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->CheckResourceResidency(a,b) -#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->SetMaximumFrameLatency(a) -#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->GetMaximumFrameLatency(a) -#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->CheckDeviceState(a) -#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateRenderTargetEx(a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->CreateOffscreenPlainSurfaceEx(a,b,c,d,e,f,g) -#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateDepthStencilSurfaceEx(a,b,c,d,e,f,g,h,i) -#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->ResetEx(a,b) -#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->GetDisplayModeEx(a,b,c) -#endif - - - -#undef INTERFACE -#define INTERFACE IDirect3DSwapChain9Ex - -DECLARE_INTERFACE_(IDirect3DSwapChain9Ex, IDirect3DSwapChain9) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DSwapChain9 methods ***/ - STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; - STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; - STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; - STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; - STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; - STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; - STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; - STDMETHOD(GetLastPresentCount)(THIS_ UINT* pLastPresentCount) PURE; - STDMETHOD(GetPresentStats)(THIS_ D3DPRESENTSTATS* pPresentationStatistics) PURE; - STDMETHOD(GetDisplayModeEx)(THIS_ D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; -}; - -typedef struct IDirect3DSwapChain9Ex *LPDIRECT3DSWAPCHAIN9EX, *PDIRECT3DSWAPCHAIN9EX; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DSwapChain9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DSwapChain9Ex_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) -#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) -#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) -#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) -#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) -#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) -#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->lpVtbl->GetLastPresentCount(p,a) -#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a) -#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->lpVtbl->GetDisplayModeEx(p,a,b) -#else -#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DSwapChain9Ex_AddRef(p) (p)->AddRef() -#define IDirect3DSwapChain9Ex_Release(p) (p)->Release() -#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) -#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) -#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) -#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->GetRasterStatus(a) -#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->GetDisplayMode(a) -#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->GetDevice(a) -#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->GetPresentParameters(a) -#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->GetLastPresentCount(a) -#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->GetPresentStats(a) -#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->GetDisplayModeEx(a,b) -#endif - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - - - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - - - -#undef INTERFACE -#define INTERFACE IDirect3D9ExOverlayExtension - -DECLARE_INTERFACE_(IDirect3D9ExOverlayExtension, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3D9ExOverlayExtension methods ***/ - STDMETHOD(CheckDeviceOverlayType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,UINT OverlayWidth,UINT OverlayHeight,D3DFORMAT OverlayFormat,D3DDISPLAYMODEEX* pDisplayMode,D3DDISPLAYROTATION DisplayRotation,D3DOVERLAYCAPS* pOverlayCaps) PURE; -}; - -typedef struct IDirect3D9ExOverlayExtension *LPDIRECT3D9EXOVERLAYEXTENSION, *PDIRECT3D9EXOVERLAYEXTENSION; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3D9ExOverlayExtension_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3D9ExOverlayExtension_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3D9ExOverlayExtension_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3D9ExOverlayExtension_CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) -#else -#define IDirect3D9ExOverlayExtension_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3D9ExOverlayExtension_AddRef(p) (p)->AddRef() -#define IDirect3D9ExOverlayExtension_Release(p) (p)->Release() -#define IDirect3D9ExOverlayExtension_CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) (p)->CheckDeviceOverlayType(a,b,c,d,e,f,g,h) -#endif - - - -#undef INTERFACE -#define INTERFACE IDirect3DDevice9Video - -DECLARE_INTERFACE_(IDirect3DDevice9Video, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DDevice9Video methods ***/ - STDMETHOD(GetContentProtectionCaps)(THIS_ CONST GUID* pCryptoType,CONST GUID* pDecodeProfile,D3DCONTENTPROTECTIONCAPS* pCaps) PURE; - STDMETHOD(CreateAuthenticatedChannel)(THIS_ D3DAUTHENTICATEDCHANNELTYPE ChannelType,IDirect3DAuthenticatedChannel9** ppAuthenticatedChannel,HANDLE* pChannelHandle) PURE; - STDMETHOD(CreateCryptoSession)(THIS_ CONST GUID* pCryptoType,CONST GUID* pDecodeProfile,IDirect3DCryptoSession9** ppCryptoSession,HANDLE* pCryptoHandle) PURE; -}; - -typedef struct IDirect3DDevice9Video *LPDIRECT3DDEVICE9VIDEO, *PDIRECT3DDEVICE9VIDEO; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DDevice9Video_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DDevice9Video_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DDevice9Video_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DDevice9Video_GetContentProtectionCaps(p,a,b,c) (p)->lpVtbl->GetContentProtectionCaps(p,a,b,c) -#define IDirect3DDevice9Video_CreateAuthenticatedChannel(p,a,b,c) (p)->lpVtbl->CreateAuthenticatedChannel(p,a,b,c) -#define IDirect3DDevice9Video_CreateCryptoSession(p,a,b,c,d) (p)->lpVtbl->CreateCryptoSession(p,a,b,c,d) -#else -#define IDirect3DDevice9Video_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DDevice9Video_AddRef(p) (p)->AddRef() -#define IDirect3DDevice9Video_Release(p) (p)->Release() -#define IDirect3DDevice9Video_GetContentProtectionCaps(p,a,b,c) (p)->GetContentProtectionCaps(a,b,c) -#define IDirect3DDevice9Video_CreateAuthenticatedChannel(p,a,b,c) (p)->CreateAuthenticatedChannel(a,b,c) -#define IDirect3DDevice9Video_CreateCryptoSession(p,a,b,c,d) (p)->CreateCryptoSession(a,b,c,d) -#endif - - - - -#undef INTERFACE -#define INTERFACE IDirect3DAuthenticatedChannel9 - -DECLARE_INTERFACE_(IDirect3DAuthenticatedChannel9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DAuthenticatedChannel9 methods ***/ - STDMETHOD(GetCertificateSize)(THIS_ UINT* pCertificateSize) PURE; - STDMETHOD(GetCertificate)(THIS_ UINT CertifacteSize,BYTE* ppCertificate) PURE; - STDMETHOD(NegotiateKeyExchange)(THIS_ UINT DataSize,VOID* pData) PURE; - STDMETHOD(Query)(THIS_ UINT InputSize,CONST VOID* pInput,UINT OutputSize,VOID* pOutput) PURE; - STDMETHOD(Configure)(THIS_ UINT InputSize,CONST VOID* pInput,D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT* pOutput) PURE; -}; - -typedef struct IDirect3DAuthenticatedChannel9 *LPDIRECT3DAUTHENTICATEDCHANNEL9, *PDIRECT3DAUTHENTICATEDCHANNEL9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DAuthenticatedChannel9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DAuthenticatedChannel9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DAuthenticatedChannel9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DAuthenticatedChannel9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a) -#define IDirect3DAuthenticatedChannel9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b) -#define IDirect3DAuthenticatedChannel9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b) -#define IDirect3DAuthenticatedChannel9_Query(p,a,b,c,d) (p)->lpVtbl->Query(p,a,b,c,d) -#define IDirect3DAuthenticatedChannel9_Configure(p,a,b,c) (p)->lpVtbl->Configure(p,a,b,c) -#else -#define IDirect3DAuthenticatedChannel9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DAuthenticatedChannel9_AddRef(p) (p)->AddRef() -#define IDirect3DAuthenticatedChannel9_Release(p) (p)->Release() -#define IDirect3DAuthenticatedChannel9_GetCertificateSize(p,a) (p)->GetCertificateSize(a) -#define IDirect3DAuthenticatedChannel9_GetCertificate(p,a,b) (p)->GetCertificate(a,b) -#define IDirect3DAuthenticatedChannel9_NegotiateKeyExchange(p,a,b) (p)->NegotiateKeyExchange(a,b) -#define IDirect3DAuthenticatedChannel9_Query(p,a,b,c,d) (p)->Query(a,b,c,d) -#define IDirect3DAuthenticatedChannel9_Configure(p,a,b,c) (p)->Configure(a,b,c) -#endif - - - -#undef INTERFACE -#define INTERFACE IDirect3DCryptoSession9 - -DECLARE_INTERFACE_(IDirect3DCryptoSession9, IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - - /*** IDirect3DCryptoSession9 methods ***/ - STDMETHOD(GetCertificateSize)(THIS_ UINT* pCertificateSize) PURE; - STDMETHOD(GetCertificate)(THIS_ UINT CertifacteSize,BYTE* ppCertificate) PURE; - STDMETHOD(NegotiateKeyExchange)(THIS_ UINT DataSize,VOID* pData) PURE; - STDMETHOD(EncryptionBlt)(THIS_ IDirect3DSurface9* pSrcSurface,IDirect3DSurface9* pDstSurface,UINT DstSurfaceSize,VOID* pIV) PURE; - STDMETHOD(DecryptionBlt)(THIS_ IDirect3DSurface9* pSrcSurface,IDirect3DSurface9* pDstSurface,UINT SrcSurfaceSize,D3DENCRYPTED_BLOCK_INFO* pEncryptedBlockInfo,VOID* pContentKey,VOID* pIV) PURE; - STDMETHOD(GetSurfacePitch)(THIS_ IDirect3DSurface9* pSrcSurface,UINT* pSurfacePitch) PURE; - STDMETHOD(StartSessionKeyRefresh)(THIS_ VOID* pRandomNumber,UINT RandomNumberSize) PURE; - STDMETHOD(FinishSessionKeyRefresh)(THIS) PURE; - STDMETHOD(GetEncryptionBltKey)(THIS_ VOID* pReadbackKey,UINT KeySize) PURE; -}; - -typedef struct IDirect3DCryptoSession9 *LPDIRECT3DCRYPTOSESSION9, *PDIRECT3DCRYPTOSESSION9; - -#if !defined(__cplusplus) || defined(CINTERFACE) -#define IDirect3DCryptoSession9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IDirect3DCryptoSession9_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IDirect3DCryptoSession9_Release(p) (p)->lpVtbl->Release(p) -#define IDirect3DCryptoSession9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a) -#define IDirect3DCryptoSession9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b) -#define IDirect3DCryptoSession9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b) -#define IDirect3DCryptoSession9_EncryptionBlt(p,a,b,c,d) (p)->lpVtbl->EncryptionBlt(p,a,b,c,d) -#define IDirect3DCryptoSession9_DecryptionBlt(p,a,b,c,d,e,f) (p)->lpVtbl->DecryptionBlt(p,a,b,c,d,e,f) -#define IDirect3DCryptoSession9_GetSurfacePitch(p,a,b) (p)->lpVtbl->GetSurfacePitch(p,a,b) -#define IDirect3DCryptoSession9_StartSessionKeyRefresh(p,a,b) (p)->lpVtbl->StartSessionKeyRefresh(p,a,b) -#define IDirect3DCryptoSession9_FinishSessionKeyRefresh(p) (p)->lpVtbl->FinishSessionKeyRefresh(p) -#define IDirect3DCryptoSession9_GetEncryptionBltKey(p,a,b) (p)->lpVtbl->GetEncryptionBltKey(p,a,b) -#else -#define IDirect3DCryptoSession9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) -#define IDirect3DCryptoSession9_AddRef(p) (p)->AddRef() -#define IDirect3DCryptoSession9_Release(p) (p)->Release() -#define IDirect3DCryptoSession9_GetCertificateSize(p,a) (p)->GetCertificateSize(a) -#define IDirect3DCryptoSession9_GetCertificate(p,a,b) (p)->GetCertificate(a,b) -#define IDirect3DCryptoSession9_NegotiateKeyExchange(p,a,b) (p)->NegotiateKeyExchange(a,b) -#define IDirect3DCryptoSession9_EncryptionBlt(p,a,b,c,d) (p)->EncryptionBlt(a,b,c,d) -#define IDirect3DCryptoSession9_DecryptionBlt(p,a,b,c,d,e,f) (p)->DecryptionBlt(a,b,c,d,e,f) -#define IDirect3DCryptoSession9_GetSurfacePitch(p,a,b) (p)->GetSurfacePitch(a,b) -#define IDirect3DCryptoSession9_StartSessionKeyRefresh(p,a,b) (p)->StartSessionKeyRefresh(a,b) -#define IDirect3DCryptoSession9_FinishSessionKeyRefresh(p) (p)->FinishSessionKeyRefresh() -#define IDirect3DCryptoSession9_GetEncryptionBltKey(p,a,b) (p)->GetEncryptionBltKey(a,b) -#endif - -/* -- D3D9Ex only */ -#endif // !D3D_DISABLE_9EX - - -#ifdef __cplusplus -}; -#endif - - -#endif /* (DIRECT3D_VERSION >= 0x0900) */ -#endif /* _D3D_H_ */ - diff --git a/3rdparty/directx-headers/include/directx/d3d9caps.h b/3rdparty/directx-headers/include/directx/d3d9caps.h deleted file mode 100644 index 8298cc4f558..00000000000 --- a/3rdparty/directx-headers/include/directx/d3d9caps.h +++ /dev/null @@ -1,571 +0,0 @@ -/*==========================================================================; - * - * Copyright (C) Microsoft Corporation. All Rights Reserved. - * - * File: d3d9caps.h - * Content: Direct3D capabilities include file - * - ***************************************************************************/ - -#ifndef _d3d9CAPS_H -#define _d3d9CAPS_H - -#ifndef DIRECT3D_VERSION -#define DIRECT3D_VERSION 0x0900 -#endif //DIRECT3D_VERSION - -// include this file content only if compiling for DX9 interfaces -#if(DIRECT3D_VERSION >= 0x0900) - - - -#if defined(_X86_) || defined(_IA64_) -#pragma pack(4) -#endif - -typedef struct _D3DVSHADERCAPS2_0 -{ - DWORD Caps; - INT DynamicFlowControlDepth; - INT NumTemps; - INT StaticFlowControlDepth; -} D3DVSHADERCAPS2_0; - -#define D3DVS20CAPS_PREDICATION (1<<0) - -#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 -#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 -#define D3DVS20_MAX_NUMTEMPS 32 -#define D3DVS20_MIN_NUMTEMPS 12 -#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4 -#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1 - -typedef struct _D3DPSHADERCAPS2_0 -{ - DWORD Caps; - INT DynamicFlowControlDepth; - INT NumTemps; - INT StaticFlowControlDepth; - INT NumInstructionSlots; -} D3DPSHADERCAPS2_0; - -#define D3DPS20CAPS_ARBITRARYSWIZZLE (1<<0) -#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1<<1) -#define D3DPS20CAPS_PREDICATION (1<<2) -#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1<<3) -#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1<<4) - -#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 -#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 -#define D3DPS20_MAX_NUMTEMPS 32 -#define D3DPS20_MIN_NUMTEMPS 12 -#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4 -#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0 -#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512 -#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96 - -#define D3DMIN30SHADERINSTRUCTIONS 512 -#define D3DMAX30SHADERINSTRUCTIONS 32768 - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -typedef struct _D3DOVERLAYCAPS -{ - UINT Caps; - UINT MaxOverlayDisplayWidth; - UINT MaxOverlayDisplayHeight; -} D3DOVERLAYCAPS; - -#define D3DOVERLAYCAPS_FULLRANGERGB 0x00000001 -#define D3DOVERLAYCAPS_LIMITEDRANGERGB 0x00000002 -#define D3DOVERLAYCAPS_YCbCr_BT601 0x00000004 -#define D3DOVERLAYCAPS_YCbCr_BT709 0x00000008 -#define D3DOVERLAYCAPS_YCbCr_BT601_xvYCC 0x00000010 -#define D3DOVERLAYCAPS_YCbCr_BT709_xvYCC 0x00000020 -#define D3DOVERLAYCAPS_STRETCHX 0x00000040 -#define D3DOVERLAYCAPS_STRETCHY 0x00000080 - - -typedef struct _D3DCONTENTPROTECTIONCAPS -{ - DWORD Caps; - GUID KeyExchangeType; - UINT BufferAlignmentStart; - UINT BlockAlignmentSize; - ULONGLONG ProtectedMemorySize; -} D3DCONTENTPROTECTIONCAPS; - -#define D3DCPCAPS_SOFTWARE 0x00000001 -#define D3DCPCAPS_HARDWARE 0x00000002 -#define D3DCPCAPS_PROTECTIONALWAYSON 0x00000004 -#define D3DCPCAPS_PARTIALDECRYPTION 0x00000008 -#define D3DCPCAPS_CONTENTKEY 0x00000010 -#define D3DCPCAPS_FRESHENSESSIONKEY 0x00000020 -#define D3DCPCAPS_ENCRYPTEDREADBACK 0x00000040 -#define D3DCPCAPS_ENCRYPTEDREADBACKKEY 0x00000080 -#define D3DCPCAPS_SEQUENTIAL_CTR_IV 0x00000100 -#define D3DCPCAPS_ENCRYPTSLICEDATAONLY 0x00000200 - -DEFINE_GUID(D3DCRYPTOTYPE_AES128_CTR, -0x9b6bd711, 0x4f74, 0x41c9, 0x9e, 0x7b, 0xb, 0xe2, 0xd7, 0xd9, 0x3b, 0x4f); -DEFINE_GUID(D3DCRYPTOTYPE_PROPRIETARY, -0xab4e9afd, 0x1d1c, 0x46e6, 0xa7, 0x2f, 0x8, 0x69, 0x91, 0x7b, 0xd, 0xe8); - -DEFINE_GUID(D3DKEYEXCHANGE_RSAES_OAEP, -0xc1949895, 0xd72a, 0x4a1d, 0x8e, 0x5d, 0xed, 0x85, 0x7d, 0x17, 0x15, 0x20); -DEFINE_GUID(D3DKEYEXCHANGE_DXVA, -0x43d3775c, 0x38e5, 0x4924, 0x8d, 0x86, 0xd3, 0xfc, 0xcf, 0x15, 0x3e, 0x9b); - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -typedef struct _D3DCAPS9 -{ - /* Device Info */ - D3DDEVTYPE DeviceType; - UINT AdapterOrdinal; - - /* Caps from DX7 Draw */ - DWORD Caps; - DWORD Caps2; - DWORD Caps3; - DWORD PresentationIntervals; - - /* Cursor Caps */ - DWORD CursorCaps; - - /* 3D Device Caps */ - DWORD DevCaps; - - DWORD PrimitiveMiscCaps; - DWORD RasterCaps; - DWORD ZCmpCaps; - DWORD SrcBlendCaps; - DWORD DestBlendCaps; - DWORD AlphaCmpCaps; - DWORD ShadeCaps; - DWORD TextureCaps; - DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's - DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture9's - DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's - DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture9's - DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's - - DWORD LineCaps; // D3DLINECAPS - - DWORD MaxTextureWidth, MaxTextureHeight; - DWORD MaxVolumeExtent; - - DWORD MaxTextureRepeat; - DWORD MaxTextureAspectRatio; - DWORD MaxAnisotropy; - float MaxVertexW; - - float GuardBandLeft; - float GuardBandTop; - float GuardBandRight; - float GuardBandBottom; - - float ExtentsAdjust; - DWORD StencilCaps; - - DWORD FVFCaps; - DWORD TextureOpCaps; - DWORD MaxTextureBlendStages; - DWORD MaxSimultaneousTextures; - - DWORD VertexProcessingCaps; - DWORD MaxActiveLights; - DWORD MaxUserClipPlanes; - DWORD MaxVertexBlendMatrices; - DWORD MaxVertexBlendMatrixIndex; - - float MaxPointSize; - - DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call - DWORD MaxVertexIndex; - DWORD MaxStreams; - DWORD MaxStreamStride; // max stride for SetStreamSource - - DWORD VertexShaderVersion; - DWORD MaxVertexShaderConst; // number of vertex shader constant registers - - DWORD PixelShaderVersion; - float PixelShader1xMaxValue; // max value storable in registers of ps.1.x shaders - - // Here are the DX9 specific ones - DWORD DevCaps2; - - float MaxNpatchTessellationLevel; - DWORD Reserved5; - - UINT MasterAdapterOrdinal; // ordinal of master adaptor for adapter group - UINT AdapterOrdinalInGroup; // ordinal inside the adapter group - UINT NumberOfAdaptersInGroup; // number of adapters in this adapter group (only if master) - DWORD DeclTypes; // Data types, supported in vertex declarations - DWORD NumSimultaneousRTs; // Will be at least 1 - DWORD StretchRectFilterCaps; // Filter caps supported by StretchRect - D3DVSHADERCAPS2_0 VS20Caps; - D3DPSHADERCAPS2_0 PS20Caps; - DWORD VertexTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used in vertex shaders - DWORD MaxVShaderInstructionsExecuted; // maximum number of vertex shader instructions that can be executed - DWORD MaxPShaderInstructionsExecuted; // maximum number of pixel shader instructions that can be executed - DWORD MaxVertexShader30InstructionSlots; - DWORD MaxPixelShader30InstructionSlots; -} D3DCAPS9; - -// -// BIT DEFINES FOR D3DCAPS9 DWORD MEMBERS -// - -// -// Caps -// -#define D3DCAPS_OVERLAY 0x00000800L -#define D3DCAPS_READ_SCANLINE 0x00020000L - -// -// Caps2 -// -#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L -#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L -#define D3DCAPS2_RESERVED 0x02000000L -#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L -#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L -#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -#define D3DCAPS2_CANSHARERESOURCE 0x80000000L - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -// -// Caps3 -// -#define D3DCAPS3_RESERVED 0x8000001fL - -// Indicates that the device can respect the ALPHABLENDENABLE render state -// when fullscreen while using the FLIP or DISCARD swap effect. -// COPY and COPYVSYNC swap effects work whether or not this flag is set. -#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L - -// Indicates that the device can perform a gamma correction from -// a windowed back buffer containing linear content to the sRGB desktop. -#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080L - -#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L /* Device can acclerate copies from sysmem to local vidmem */ -#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L /* Device can acclerate copies from local vidmem to sysmem */ -#define D3DCAPS3_DXVAHD 0x00000400L -#define D3DCAPS3_DXVAHD_LIMITED 0x00000800L - - -// -// PresentationIntervals -// -#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L -#define D3DPRESENT_INTERVAL_ONE 0x00000001L -#define D3DPRESENT_INTERVAL_TWO 0x00000002L -#define D3DPRESENT_INTERVAL_THREE 0x00000004L -#define D3DPRESENT_INTERVAL_FOUR 0x00000008L -#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L - -// -// CursorCaps -// -// Driver supports HW color cursor in at least hi-res modes(height >=400) -#define D3DCURSORCAPS_COLOR 0x00000001L -// Driver supports HW cursor also in low-res modes(height < 400) -#define D3DCURSORCAPS_LOWRES 0x00000002L - -// -// DevCaps -// -#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ -#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ -#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ -#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ -#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ -#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ -#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */ -#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */ -#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */ -#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */ -#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */ -#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/ -#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */ -#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */ -#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */ -#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */ -#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */ -#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */ -#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */ -#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */ - -// -// PrimitiveMiscCaps -// -#define D3DPMISCCAPS_MASKZ 0x00000002L -#define D3DPMISCCAPS_CULLNONE 0x00000010L -#define D3DPMISCCAPS_CULLCW 0x00000020L -#define D3DPMISCCAPS_CULLCCW 0x00000040L -#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L -#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */ -#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */ -#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */ -#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */ -#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */ -#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000L /* Device supports independent write masks for MET or MRT */ -#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000L /* Device supports per-stage constants */ -#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000L /* Device supports separate fog and specular alpha (many devices - use the specular alpha channel to store fog factor) */ -#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000L /* Device supports separate blend settings for the alpha channel */ -#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000L /* Device supports different bit depths for MRT */ -#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L /* Device supports post-pixel shader operations for MRT */ -#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L /* Device clamps fog blend factor per vertex */ - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -#define D3DPMISCCAPS_POSTBLENDSRGBCONVERT 0x00200000L /* Indicates device can perform conversion to sRGB after blending. */ - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - - -// -// LineCaps -// -#define D3DLINECAPS_TEXTURE 0x00000001L -#define D3DLINECAPS_ZTEST 0x00000002L -#define D3DLINECAPS_BLEND 0x00000004L -#define D3DLINECAPS_ALPHACMP 0x00000008L -#define D3DLINECAPS_FOG 0x00000010L -#define D3DLINECAPS_ANTIALIAS 0x00000020L - -// -// RasterCaps -// -#define D3DPRASTERCAPS_DITHER 0x00000001L -#define D3DPRASTERCAPS_ZTEST 0x00000010L -#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L -#define D3DPRASTERCAPS_FOGTABLE 0x00000100L -#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L -#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L -#define D3DPRASTERCAPS_FOGRANGE 0x00010000L -#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L -#define D3DPRASTERCAPS_WBUFFER 0x00040000L -#define D3DPRASTERCAPS_WFOG 0x00100000L -#define D3DPRASTERCAPS_ZFOG 0x00200000L -#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */ -#define D3DPRASTERCAPS_SCISSORTEST 0x01000000L -#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000L -#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000L -#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000L - -// -// ZCmpCaps, AlphaCmpCaps -// -#define D3DPCMPCAPS_NEVER 0x00000001L -#define D3DPCMPCAPS_LESS 0x00000002L -#define D3DPCMPCAPS_EQUAL 0x00000004L -#define D3DPCMPCAPS_LESSEQUAL 0x00000008L -#define D3DPCMPCAPS_GREATER 0x00000010L -#define D3DPCMPCAPS_NOTEQUAL 0x00000020L -#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L -#define D3DPCMPCAPS_ALWAYS 0x00000080L - -// -// SourceBlendCaps, DestBlendCaps -// -#define D3DPBLENDCAPS_ZERO 0x00000001L -#define D3DPBLENDCAPS_ONE 0x00000002L -#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L -#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L -#define D3DPBLENDCAPS_SRCALPHA 0x00000010L -#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L -#define D3DPBLENDCAPS_DESTALPHA 0x00000040L -#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L -#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L -#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L -#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L -#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L -#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L -#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000L /* Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR */ - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -#define D3DPBLENDCAPS_SRCCOLOR2 0x00004000L -#define D3DPBLENDCAPS_INVSRCCOLOR2 0x00008000L - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - - -// -// ShadeCaps -// -#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L -#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L -#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L -#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L - -// -// TextureCaps -// -#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */ -#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */ -#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */ -#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */ -#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */ -#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */ -// Device can use non-POW2 textures if: -// 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage -// 2) D3DRS_WRAP(N) is zero for this texture's coordinates -// 3) mip mapping is not enabled (use magnification filter only) -#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L -#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */ -#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */ -#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */ -#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */ -#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */ -#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */ -#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */ -#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */ -#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000L /* Device does not support projected bump env lookup operation - in programmable and fixed function pixel shaders */ - -// -// TextureFilterCaps, StretchRectFilterCaps -// -#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ -#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L -#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L -#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD 0x00000800L -#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000L -#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ -#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L - -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - -#define D3DPTFILTERCAPS_CONVOLUTIONMONO 0x00040000L /* Min and Mag for the convolution mono filter */ - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - -#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ -#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L -#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L -#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000L -#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000L - -// -// TextureAddressCaps -// -#define D3DPTADDRESSCAPS_WRAP 0x00000001L -#define D3DPTADDRESSCAPS_MIRROR 0x00000002L -#define D3DPTADDRESSCAPS_CLAMP 0x00000004L -#define D3DPTADDRESSCAPS_BORDER 0x00000008L -#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L -#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L - -// -// StencilCaps -// -#define D3DSTENCILCAPS_KEEP 0x00000001L -#define D3DSTENCILCAPS_ZERO 0x00000002L -#define D3DSTENCILCAPS_REPLACE 0x00000004L -#define D3DSTENCILCAPS_INCRSAT 0x00000008L -#define D3DSTENCILCAPS_DECRSAT 0x00000010L -#define D3DSTENCILCAPS_INVERT 0x00000020L -#define D3DSTENCILCAPS_INCR 0x00000040L -#define D3DSTENCILCAPS_DECR 0x00000080L -#define D3DSTENCILCAPS_TWOSIDED 0x00000100L - -// -// TextureOpCaps -// -#define D3DTEXOPCAPS_DISABLE 0x00000001L -#define D3DTEXOPCAPS_SELECTARG1 0x00000002L -#define D3DTEXOPCAPS_SELECTARG2 0x00000004L -#define D3DTEXOPCAPS_MODULATE 0x00000008L -#define D3DTEXOPCAPS_MODULATE2X 0x00000010L -#define D3DTEXOPCAPS_MODULATE4X 0x00000020L -#define D3DTEXOPCAPS_ADD 0x00000040L -#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L -#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L -#define D3DTEXOPCAPS_SUBTRACT 0x00000200L -#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L -#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L -#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L -#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L -#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L -#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L -#define D3DTEXOPCAPS_PREMODULATE 0x00010000L -#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L -#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L -#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L -#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L -#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L -#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L -#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L -#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L -#define D3DTEXOPCAPS_LERP 0x02000000L - -// -// FVFCaps -// -#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ -#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ -#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */ - -// -// VertexProcessingCaps -// -#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */ -#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */ -#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */ -#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */ -#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */ -#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */ -#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100L /* device supports D3DTSS_TCI_SPHEREMAP */ -#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200L /* device does not support TexGen in non-local - viewer mode */ - -// -// DevCaps2 -// -#define D3DDEVCAPS2_STREAMOFFSET 0x00000001L /* Device supports offsets in streams. Must be set by DX9 drivers */ -#define D3DDEVCAPS2_DMAPNPATCH 0x00000002L /* Device supports displacement maps for N-Patches*/ -#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004L /* Device supports adaptive tesselation of RT-patches*/ -#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008L /* Device supports adaptive tesselation of N-patches*/ -#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010L /* Device supports StretchRect calls with a texture as the source*/ -#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020L /* Device supports presampled displacement maps for N-Patches */ -#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040L /* Vertex elements in a vertex declaration can share the same stream offset */ - -// -// DeclTypes -// -#define D3DDTCAPS_UBYTE4 0x00000001L -#define D3DDTCAPS_UBYTE4N 0x00000002L -#define D3DDTCAPS_SHORT2N 0x00000004L -#define D3DDTCAPS_SHORT4N 0x00000008L -#define D3DDTCAPS_USHORT2N 0x00000010L -#define D3DDTCAPS_USHORT4N 0x00000020L -#define D3DDTCAPS_UDEC3 0x00000040L -#define D3DDTCAPS_DEC3N 0x00000080L -#define D3DDTCAPS_FLOAT16_2 0x00000100L -#define D3DDTCAPS_FLOAT16_4 0x00000200L - - -#pragma pack() - - -#endif /* (DIRECT3D_VERSION >= 0x0900) */ -#endif /* _d3d9CAPS_H_ */ - diff --git a/3rdparty/directx-headers/include/directx/d3d9types.h b/3rdparty/directx-headers/include/directx/d3d9types.h deleted file mode 100644 index d16102bdf54..00000000000 --- a/3rdparty/directx-headers/include/directx/d3d9types.h +++ /dev/null @@ -1,2444 +0,0 @@ -/*==========================================================================; - * - * Copyright (C) Microsoft Corporation. All Rights Reserved. - * - * File: d3d9types.h - * Content: Direct3D capabilities include file - * - ***************************************************************************/ - -#ifndef _d3d9TYPES_H_ -#define _d3d9TYPES_H_ - - -#ifndef DIRECT3D_VERSION -#define DIRECT3D_VERSION 0x0900 -#endif //DIRECT3D_VERSION - -// include this file content only if compiling for DX9 interfaces -#if(DIRECT3D_VERSION >= 0x0900) - -#include - -#ifdef _MSC_VER -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4201) // anonymous unions warning -#if defined(_X86_) || defined(_IA64_) -#pragma pack(4) -#endif -#endif // _MSC_VER - -// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 -#ifndef D3DCOLOR_DEFINED -typedef DWORD D3DCOLOR; -#define D3DCOLOR_DEFINED -#endif - -// maps unsigned 8 bits/channel to D3DCOLOR -#define D3DCOLOR_ARGB(a,r,g,b) \ - ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) -#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) -#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) - -#define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) -#define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) - -// maps floating point channels (0.f to 1.f range) to D3DCOLOR -#define D3DCOLOR_COLORVALUE(r,g,b,a) \ - D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) - - -#ifndef D3DVECTOR_DEFINED -typedef struct _D3DVECTOR { - float x; - float y; - float z; -} D3DVECTOR; -#define D3DVECTOR_DEFINED -#endif - -#ifndef D3DCOLORVALUE_DEFINED -typedef struct _D3DCOLORVALUE { - float r; - float g; - float b; - float a; -} D3DCOLORVALUE; -#define D3DCOLORVALUE_DEFINED -#endif - -#ifndef D3DRECT_DEFINED -typedef struct _D3DRECT { - LONG x1; - LONG y1; - LONG x2; - LONG y2; -} D3DRECT; -#define D3DRECT_DEFINED -#endif - - - -#ifndef D3DMATRIX_DEFINED -typedef struct _D3DMATRIX { - union { - struct { - float _11, _12, _13, _14; - float _21, _22, _23, _24; - float _31, _32, _33, _34; - float _41, _42, _43, _44; - - }; - float m[4][4]; - }; -} D3DMATRIX; -#define D3DMATRIX_DEFINED -#endif - - - -typedef struct _D3DVIEWPORT9 { - DWORD X; - DWORD Y; /* Viewport Top left */ - DWORD Width; - DWORD Height; /* Viewport Dimensions */ - float MinZ; /* Min/max of clip Volume */ - float MaxZ; -} D3DVIEWPORT9; - -/* - * Values for clip fields. - */ - -// Max number of user clipping planes, supported in D3D. -#define D3DMAXUSERCLIPPLANES 32 - -// These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE -// -#define D3DCLIPPLANE0 (1 << 0) -#define D3DCLIPPLANE1 (1 << 1) -#define D3DCLIPPLANE2 (1 << 2) -#define D3DCLIPPLANE3 (1 << 3) -#define D3DCLIPPLANE4 (1 << 4) -#define D3DCLIPPLANE5 (1 << 5) - -// The following bits are used in the ClipUnion and ClipIntersection -// members of the D3DCLIPSTATUS9 -// - -#define D3DCS_LEFT 0x00000001L -#define D3DCS_RIGHT 0x00000002L -#define D3DCS_TOP 0x00000004L -#define D3DCS_BOTTOM 0x00000008L -#define D3DCS_FRONT 0x00000010L -#define D3DCS_BACK 0x00000020L -#define D3DCS_PLANE0 0x00000040L -#define D3DCS_PLANE1 0x00000080L -#define D3DCS_PLANE2 0x00000100L -#define D3DCS_PLANE3 0x00000200L -#define D3DCS_PLANE4 0x00000400L -#define D3DCS_PLANE5 0x00000800L - -#define D3DCS_ALL (D3DCS_LEFT | \ - D3DCS_RIGHT | \ - D3DCS_TOP | \ - D3DCS_BOTTOM | \ - D3DCS_FRONT | \ - D3DCS_BACK | \ - D3DCS_PLANE0 | \ - D3DCS_PLANE1 | \ - D3DCS_PLANE2 | \ - D3DCS_PLANE3 | \ - D3DCS_PLANE4 | \ - D3DCS_PLANE5) - -typedef struct _D3DCLIPSTATUS9 { - DWORD ClipUnion; - DWORD ClipIntersection; -} D3DCLIPSTATUS9; - -typedef struct _D3DMATERIAL9 { - D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ - D3DCOLORVALUE Ambient; /* Ambient color RGB */ - D3DCOLORVALUE Specular; /* Specular 'shininess' */ - D3DCOLORVALUE Emissive; /* Emissive color RGB */ - float Power; /* Sharpness if specular highlight */ -} D3DMATERIAL9; - -typedef enum _D3DLIGHTTYPE { - D3DLIGHT_POINT = 1, - D3DLIGHT_SPOT = 2, - D3DLIGHT_DIRECTIONAL = 3, - D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DLIGHTTYPE; - -typedef struct _D3DLIGHT9 { - D3DLIGHTTYPE Type; /* Type of light source */ - D3DCOLORVALUE Diffuse; /* Diffuse color of light */ - D3DCOLORVALUE Specular; /* Specular color of light */ - D3DCOLORVALUE Ambient; /* Ambient color of light */ - D3DVECTOR Position; /* Position in world space */ - D3DVECTOR Direction; /* Direction in world space */ - float Range; /* Cutoff range */ - float Falloff; /* Falloff */ - float Attenuation0; /* Constant attenuation */ - float Attenuation1; /* Linear attenuation */ - float Attenuation2; /* Quadratic attenuation */ - float Theta; /* Inner angle of spotlight cone */ - float Phi; /* Outer angle of spotlight cone */ -} D3DLIGHT9; - -/* - * Options for clearing - */ -#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ -#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ -#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ - -/* - * The following defines the rendering states - */ - -typedef enum _D3DSHADEMODE { - D3DSHADE_FLAT = 1, - D3DSHADE_GOURAUD = 2, - D3DSHADE_PHONG = 3, - D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DSHADEMODE; - -typedef enum _D3DFILLMODE { - D3DFILL_POINT = 1, - D3DFILL_WIREFRAME = 2, - D3DFILL_SOLID = 3, - D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DFILLMODE; - -typedef enum _D3DBLEND { - D3DBLEND_ZERO = 1, - D3DBLEND_ONE = 2, - D3DBLEND_SRCCOLOR = 3, - D3DBLEND_INVSRCCOLOR = 4, - D3DBLEND_SRCALPHA = 5, - D3DBLEND_INVSRCALPHA = 6, - D3DBLEND_DESTALPHA = 7, - D3DBLEND_INVDESTALPHA = 8, - D3DBLEND_DESTCOLOR = 9, - D3DBLEND_INVDESTCOLOR = 10, - D3DBLEND_SRCALPHASAT = 11, - D3DBLEND_BOTHSRCALPHA = 12, - D3DBLEND_BOTHINVSRCALPHA = 13, - D3DBLEND_BLENDFACTOR = 14, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ - D3DBLEND_INVBLENDFACTOR = 15, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - - D3DBLEND_SRCCOLOR2 = 16, - D3DBLEND_INVSRCCOLOR2 = 17, - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DBLEND; - -typedef enum _D3DBLENDOP { - D3DBLENDOP_ADD = 1, - D3DBLENDOP_SUBTRACT = 2, - D3DBLENDOP_REVSUBTRACT = 3, - D3DBLENDOP_MIN = 4, - D3DBLENDOP_MAX = 5, - D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DBLENDOP; - -typedef enum _D3DTEXTUREADDRESS { - D3DTADDRESS_WRAP = 1, - D3DTADDRESS_MIRROR = 2, - D3DTADDRESS_CLAMP = 3, - D3DTADDRESS_BORDER = 4, - D3DTADDRESS_MIRRORONCE = 5, - D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DTEXTUREADDRESS; - -typedef enum _D3DCULL { - D3DCULL_NONE = 1, - D3DCULL_CW = 2, - D3DCULL_CCW = 3, - D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DCULL; - -typedef enum _D3DCMPFUNC { - D3DCMP_NEVER = 1, - D3DCMP_LESS = 2, - D3DCMP_EQUAL = 3, - D3DCMP_LESSEQUAL = 4, - D3DCMP_GREATER = 5, - D3DCMP_NOTEQUAL = 6, - D3DCMP_GREATEREQUAL = 7, - D3DCMP_ALWAYS = 8, - D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DCMPFUNC; - -typedef enum _D3DSTENCILOP { - D3DSTENCILOP_KEEP = 1, - D3DSTENCILOP_ZERO = 2, - D3DSTENCILOP_REPLACE = 3, - D3DSTENCILOP_INCRSAT = 4, - D3DSTENCILOP_DECRSAT = 5, - D3DSTENCILOP_INVERT = 6, - D3DSTENCILOP_INCR = 7, - D3DSTENCILOP_DECR = 8, - D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DSTENCILOP; - -typedef enum _D3DFOGMODE { - D3DFOG_NONE = 0, - D3DFOG_EXP = 1, - D3DFOG_EXP2 = 2, - D3DFOG_LINEAR = 3, - D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DFOGMODE; - -typedef enum _D3DZBUFFERTYPE { - D3DZB_FALSE = 0, - D3DZB_TRUE = 1, // Z buffering - D3DZB_USEW = 2, // W buffering - D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DZBUFFERTYPE; - -// Primitives supported by draw-primitive API -typedef enum _D3DPRIMITIVETYPE { - D3DPT_POINTLIST = 1, - D3DPT_LINELIST = 2, - D3DPT_LINESTRIP = 3, - D3DPT_TRIANGLELIST = 4, - D3DPT_TRIANGLESTRIP = 5, - D3DPT_TRIANGLEFAN = 6, - D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DPRIMITIVETYPE; - -typedef enum _D3DTRANSFORMSTATETYPE { - D3DTS_VIEW = 2, - D3DTS_PROJECTION = 3, - D3DTS_TEXTURE0 = 16, - D3DTS_TEXTURE1 = 17, - D3DTS_TEXTURE2 = 18, - D3DTS_TEXTURE3 = 19, - D3DTS_TEXTURE4 = 20, - D3DTS_TEXTURE5 = 21, - D3DTS_TEXTURE6 = 22, - D3DTS_TEXTURE7 = 23, - D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DTRANSFORMSTATETYPE; - -#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) -#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) -#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) -#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) -#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) - -typedef enum _D3DRENDERSTATETYPE { - D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ - D3DRS_FILLMODE = 8, /* D3DFILLMODE */ - D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ - D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ - D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ - D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ - D3DRS_SRCBLEND = 19, /* D3DBLEND */ - D3DRS_DESTBLEND = 20, /* D3DBLEND */ - D3DRS_CULLMODE = 22, /* D3DCULL */ - D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ - D3DRS_ALPHAREF = 24, /* D3DFIXED */ - D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ - D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ - D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ - D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ - D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ - D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ - D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ - D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ - D3DRS_FOGEND = 37, /* Fog end */ - D3DRS_FOGDENSITY = 38, /* Fog density */ - D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ - D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ - D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ - D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ - D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ - D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ - D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ - D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ - D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ - D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ - D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ - D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ - D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ - D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ - D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ - D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ - D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ - D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ - D3DRS_CLIPPING = 136, - D3DRS_LIGHTING = 137, - D3DRS_AMBIENT = 139, - D3DRS_FOGVERTEXMODE = 140, - D3DRS_COLORVERTEX = 141, - D3DRS_LOCALVIEWER = 142, - D3DRS_NORMALIZENORMALS = 143, - D3DRS_DIFFUSEMATERIALSOURCE = 145, - D3DRS_SPECULARMATERIALSOURCE = 146, - D3DRS_AMBIENTMATERIALSOURCE = 147, - D3DRS_EMISSIVEMATERIALSOURCE = 148, - D3DRS_VERTEXBLEND = 151, - D3DRS_CLIPPLANEENABLE = 152, - D3DRS_POINTSIZE = 154, /* float point size */ - D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ - D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ - D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ - D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ - D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ - D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ - D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer - D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable - D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation - D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor - D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ - D3DRS_INDEXEDVERTEXBLENDENABLE = 167, - D3DRS_COLORWRITEENABLE = 168, // per-channel write enable - D3DRS_TWEENFACTOR = 170, // float tween factor - D3DRS_BLENDOP = 171, // D3DBLENDOP setting - D3DRS_POSITIONDEGREE = 172, // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) - D3DRS_NORMALDEGREE = 173, // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC - D3DRS_SCISSORTESTENABLE = 174, - D3DRS_SLOPESCALEDEPTHBIAS = 175, - D3DRS_ANTIALIASEDLINEENABLE = 176, - D3DRS_MINTESSELLATIONLEVEL = 178, - D3DRS_MAXTESSELLATIONLEVEL = 179, - D3DRS_ADAPTIVETESS_X = 180, - D3DRS_ADAPTIVETESS_Y = 181, - D3DRS_ADAPTIVETESS_Z = 182, - D3DRS_ADAPTIVETESS_W = 183, - D3DRS_ENABLEADAPTIVETESSELLATION = 184, - D3DRS_TWOSIDEDSTENCILMODE = 185, /* BOOL enable/disable 2 sided stenciling */ - D3DRS_CCW_STENCILFAIL = 186, /* D3DSTENCILOP to do if ccw stencil test fails */ - D3DRS_CCW_STENCILZFAIL = 187, /* D3DSTENCILOP to do if ccw stencil test passes and Z test fails */ - D3DRS_CCW_STENCILPASS = 188, /* D3DSTENCILOP to do if both ccw stencil and Z tests pass */ - D3DRS_CCW_STENCILFUNC = 189, /* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ - D3DRS_COLORWRITEENABLE1 = 190, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ - D3DRS_COLORWRITEENABLE2 = 191, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ - D3DRS_COLORWRITEENABLE3 = 192, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ - D3DRS_BLENDFACTOR = 193, /* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR */ - D3DRS_SRGBWRITEENABLE = 194, /* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) */ - D3DRS_DEPTHBIAS = 195, - D3DRS_WRAP8 = 198, /* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD */ - D3DRS_WRAP9 = 199, - D3DRS_WRAP10 = 200, - D3DRS_WRAP11 = 201, - D3DRS_WRAP12 = 202, - D3DRS_WRAP13 = 203, - D3DRS_WRAP14 = 204, - D3DRS_WRAP15 = 205, - D3DRS_SEPARATEALPHABLENDENABLE = 206, /* TRUE to enable a separate blending function for the alpha channel */ - D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ - D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ - D3DRS_BLENDOPALPHA = 209, /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ - - - D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DRENDERSTATETYPE; - -// Maximum number of simultaneous render targets D3D supports -#define D3D_MAX_SIMULTANEOUS_RENDERTARGETS 4 - -// Values for material source -typedef enum _D3DMATERIALCOLORSOURCE -{ - D3DMCS_MATERIAL = 0, // Color from material is used - D3DMCS_COLOR1 = 1, // Diffuse vertex color is used - D3DMCS_COLOR2 = 2, // Specular vertex color is used - D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum -} D3DMATERIALCOLORSOURCE; - -// Bias to apply to the texture coordinate set to apply a wrap to. -#define D3DRENDERSTATE_WRAPBIAS 128UL - -/* Flags to construct the WRAP render states */ -#define D3DWRAP_U 0x00000001L -#define D3DWRAP_V 0x00000002L -#define D3DWRAP_W 0x00000004L - -/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ -#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U -#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V -#define D3DWRAPCOORD_2 0x00000004L // same as D3DWRAP_W -#define D3DWRAPCOORD_3 0x00000008L - -/* Flags to construct D3DRS_COLORWRITEENABLE */ -#define D3DCOLORWRITEENABLE_RED (1L<<0) -#define D3DCOLORWRITEENABLE_GREEN (1L<<1) -#define D3DCOLORWRITEENABLE_BLUE (1L<<2) -#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) - -/* - * State enumerants for per-stage processing of fixed function pixel processing - * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX. - */ -typedef enum _D3DTEXTURESTAGESTATETYPE -{ - D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ - D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ - D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ - D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ - D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ - D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ - D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */ - D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ - D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ - D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ - D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ - D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ - D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ - D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ - D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ - D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ - D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ - D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */ - - - D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DTEXTURESTAGESTATETYPE; - -/* - * State enumerants for per-sampler texture processing. - */ -typedef enum _D3DSAMPLERSTATETYPE -{ - D3DSAMP_ADDRESSU = 1, /* D3DTEXTUREADDRESS for U coordinate */ - D3DSAMP_ADDRESSV = 2, /* D3DTEXTUREADDRESS for V coordinate */ - D3DSAMP_ADDRESSW = 3, /* D3DTEXTUREADDRESS for W coordinate */ - D3DSAMP_BORDERCOLOR = 4, /* D3DCOLOR */ - D3DSAMP_MAGFILTER = 5, /* D3DTEXTUREFILTER filter to use for magnification */ - D3DSAMP_MINFILTER = 6, /* D3DTEXTUREFILTER filter to use for minification */ - D3DSAMP_MIPFILTER = 7, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ - D3DSAMP_MIPMAPLODBIAS = 8, /* float Mipmap LOD bias */ - D3DSAMP_MAXMIPLEVEL = 9, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ - D3DSAMP_MAXANISOTROPY = 10, /* DWORD maximum anisotropy */ - D3DSAMP_SRGBTEXTURE = 11, /* Default = 0 (which means Gamma 1.0, - no correction required.) else correct for - Gamma = 2.2 */ - D3DSAMP_ELEMENTINDEX = 12, /* When multi-element texture is assigned to sampler, this - indicates which element index to use. Default = 0. */ - D3DSAMP_DMAPOFFSET = 13, /* Offset in vertices in the pre-sampled displacement map. - Only valid for D3DDMAPSAMPLER sampler */ - D3DSAMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ -} D3DSAMPLERSTATETYPE; - -/* Special sampler which is used in the tesselator */ -#define D3DDMAPSAMPLER 256 - -// Samplers used in vertex shaders -#define D3DVERTEXTEXTURESAMPLER0 (D3DDMAPSAMPLER+1) -#define D3DVERTEXTEXTURESAMPLER1 (D3DDMAPSAMPLER+2) -#define D3DVERTEXTEXTURESAMPLER2 (D3DDMAPSAMPLER+3) -#define D3DVERTEXTEXTURESAMPLER3 (D3DDMAPSAMPLER+4) - -// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position -// and normal in the camera space) should be taken as texture coordinates -// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from -// -#define D3DTSS_TCI_PASSTHRU 0x00000000 -#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 -#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 -#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 -#define D3DTSS_TCI_SPHEREMAP 0x00040000 - -/* - * Enumerations for COLOROP and ALPHAOP texture blending operations set in - * texture processing stage controls in D3DTSS. - */ -typedef enum _D3DTEXTUREOP -{ - // Control - D3DTOP_DISABLE = 1, // disables stage - D3DTOP_SELECTARG1 = 2, // the default - D3DTOP_SELECTARG2 = 3, - - // Modulate - D3DTOP_MODULATE = 4, // multiply args together - D3DTOP_MODULATE2X = 5, // multiply and 1 bit - D3DTOP_MODULATE4X = 6, // multiply and 2 bits - - // Add - D3DTOP_ADD = 7, // add arguments together - D3DTOP_ADDSIGNED = 8, // add with -0.5 bias - D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit - D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation - D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product - // Arg1 + Arg2 - Arg1*Arg2 - // = Arg1 + (1-Arg1)*Arg2 - - // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) - D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha - D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha - D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR - - // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) - D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha - D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color - - // Specular mapping - D3DTOP_PREMODULATE = 17, // modulate with next texture before use - D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB - // COLOROP only - D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A - // COLOROP only - D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB - // COLOROP only - D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A - // COLOROP only - - // Bump mapping - D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation - D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel - - // This can do either diffuse or specular bump mapping with correct input. - // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) - // where each component has been scaled and offset to make it signed. - // The result is replicated into all four (including alpha) channels. - // This is a valid COLOROP only. - D3DTOP_DOTPRODUCT3 = 24, - - // Triadic ops - D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 - D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 - - D3DTOP_FORCE_DWORD = 0x7fffffff, -} D3DTEXTUREOP; - -/* - * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending - * operations set in texture processing stage controls in D3DRENDERSTATE. - */ -#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector -#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only) -#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) -#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) -#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) -#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) -#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) -#define D3DTA_CONSTANT 0x00000006 // select texture stage constant -#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) -#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) - -// -// Values for D3DSAMP_***FILTER texture stage states -// -typedef enum _D3DTEXTUREFILTERTYPE -{ - D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) - D3DTEXF_POINT = 1, // nearest - D3DTEXF_LINEAR = 2, // linear interpolation - D3DTEXF_ANISOTROPIC = 3, // anisotropic - D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent - D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian -/* D3D9Ex only -- */ -#if !defined(D3D_DISABLE_9EX) - - D3DTEXF_CONVOLUTIONMONO = 8, // Convolution filter for monochrome textures - -#endif // !D3D_DISABLE_9EX -/* -- D3D9Ex only */ - D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum -} D3DTEXTUREFILTERTYPE; - -/* Bits for Flags in ProcessVertices call */ - -#define D3DPV_DONOTCOPYDATA (1 << 0) - -//------------------------------------------------------------------- - -// Flexible vertex format bits -// -#define D3DFVF_RESERVED0 0x001 -#define D3DFVF_POSITION_MASK 0x400E -#define D3DFVF_XYZ 0x002 -#define D3DFVF_XYZRHW 0x004 -#define D3DFVF_XYZB1 0x006 -#define D3DFVF_XYZB2 0x008 -#define D3DFVF_XYZB3 0x00a -#define D3DFVF_XYZB4 0x00c -#define D3DFVF_XYZB5 0x00e -#define D3DFVF_XYZW 0x4002 - -#define D3DFVF_NORMAL 0x010 -#define D3DFVF_PSIZE 0x020 -#define D3DFVF_DIFFUSE 0x040 -#define D3DFVF_SPECULAR 0x080 - -#define D3DFVF_TEXCOUNT_MASK 0xf00 -#define D3DFVF_TEXCOUNT_SHIFT 8 -#define D3DFVF_TEX0 0x000 -#define D3DFVF_TEX1 0x100 -#define D3DFVF_TEX2 0x200 -#define D3DFVF_TEX3 0x300 -#define D3DFVF_TEX4 0x400 -#define D3DFVF_TEX5 0x500 -#define D3DFVF_TEX6 0x600 -#define D3DFVF_TEX7 0x700 -#define D3DFVF_TEX8 0x800 - -#define D3DFVF_LASTBETA_UBYTE4 0x1000 -#define D3DFVF_LASTBETA_D3DCOLOR 0x8000 - -#define D3DFVF_RESERVED2 0x6000 // 2 reserved bits - -//--------------------------------------------------------------------- -// Vertex Shaders -// - -// Vertex shader declaration - -// Vertex element semantics -// -typedef enum _D3DDECLUSAGE -{ - D3DDECLUSAGE_POSITION = 0, - D3DDECLUSAGE_BLENDWEIGHT, // 1 - D3DDECLUSAGE_BLENDINDICES, // 2 - D3DDECLUSAGE_NORMAL, // 3 - D3DDECLUSAGE_PSIZE, // 4 - D3DDECLUSAGE_TEXCOORD, // 5 - D3DDECLUSAGE_TANGENT, // 6 - D3DDECLUSAGE_BINORMAL, // 7 - D3DDECLUSAGE_TESSFACTOR, // 8 - D3DDECLUSAGE_POSITIONT, // 9 - D3DDECLUSAGE_COLOR, // 10 - D3DDECLUSAGE_FOG, // 11 - D3DDECLUSAGE_DEPTH, // 12 - D3DDECLUSAGE_SAMPLE, // 13 -} D3DDECLUSAGE; - -#define MAXD3DDECLUSAGE D3DDECLUSAGE_SAMPLE -#define MAXD3DDECLUSAGEINDEX 15 -#define MAXD3DDECLLENGTH 64 // does not include "end" marker vertex element - -typedef enum _D3DDECLMETHOD -{ - D3DDECLMETHOD_DEFAULT = 0, - D3DDECLMETHOD_PARTIALU, - D3DDECLMETHOD_PARTIALV, - D3DDECLMETHOD_CROSSUV, // Normal - D3DDECLMETHOD_UV, - D3DDECLMETHOD_LOOKUP, // Lookup a displacement map - D3DDECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map -} D3DDECLMETHOD; - -#define MAXD3DDECLMETHOD D3DDECLMETHOD_LOOKUPPRESAMPLED - -// Declarations for _Type fields -// -typedef enum _D3DDECLTYPE -{ - D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) - D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) - D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) - D3DDECLTYPE_FLOAT4 = 3, // 4D float - D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range - // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) - D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte - D3DDECLTYPE_SHORT2 = 6, // 2D signed short expanded to (value, value, 0., 1.) - D3DDECLTYPE_SHORT4 = 7, // 4D signed short - -// The following types are valid only with vertex shaders >= 2.0 - - - D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 - D3DDECLTYPE_SHORT2N = 9, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1) - D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) - D3DDECLTYPE_USHORT2N = 11, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1) - D3DDECLTYPE_USHORT4N = 12, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0) - D3DDECLTYPE_UDEC3 = 13, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1) - D3DDECLTYPE_DEC3N = 14, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1) - D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) - D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values - D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. -} D3DDECLTYPE; - -#define MAXD3DDECLTYPE D3DDECLTYPE_UNUSED - -typedef struct _D3DVERTEXELEMENT9 -{ - WORD Stream; // Stream index - WORD Offset; // Offset in the stream in bytes - BYTE Type; // Data type - BYTE Method; // Processing method - BYTE Usage; // Semantics - BYTE UsageIndex; // Semantic index -} D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9; - -// This is used to initialize the last vertex element in a vertex declaration -// array -// -#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0} - -// Maximum supported number of texture coordinate sets -#define D3DDP_MAXTEXCOORD 8 - -//--------------------------------------------------------------------- -// Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter -//--------------------------------------------------------------------- -#define D3DSTREAMSOURCE_INDEXEDDATA (1<<30) -#define D3DSTREAMSOURCE_INSTANCEDATA (2<<30) - - - -//--------------------------------------------------------------------- -// -// The internal format of Pixel Shader (PS) & Vertex Shader (VS) -// Instruction Tokens is defined in the Direct3D Device Driver Kit -// -//--------------------------------------------------------------------- - -// -// Instruction Token Bit Definitions -// -#define D3DSI_OPCODE_MASK 0x0000FFFF - -#define D3DSI_INSTLENGTH_MASK 0x0F000000 -#define D3DSI_INSTLENGTH_SHIFT 24 - -typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE -{ - D3DSIO_NOP = 0, - D3DSIO_MOV , - D3DSIO_ADD , - D3DSIO_SUB , - D3DSIO_MAD , - D3DSIO_MUL , - D3DSIO_RCP , - D3DSIO_RSQ , - D3DSIO_DP3 , - D3DSIO_DP4 , - D3DSIO_MIN , - D3DSIO_MAX , - D3DSIO_SLT , - D3DSIO_SGE , - D3DSIO_EXP , - D3DSIO_LOG , - D3DSIO_LIT , - D3DSIO_DST , - D3DSIO_LRP , - D3DSIO_FRC , - D3DSIO_M4x4 , - D3DSIO_M4x3 , - D3DSIO_M3x4 , - D3DSIO_M3x3 , - D3DSIO_M3x2 , - D3DSIO_CALL , - D3DSIO_CALLNZ , - D3DSIO_LOOP , - D3DSIO_RET , - D3DSIO_ENDLOOP , - D3DSIO_LABEL , - D3DSIO_DCL , - D3DSIO_POW , - D3DSIO_CRS , - D3DSIO_SGN , - D3DSIO_ABS , - D3DSIO_NRM , - D3DSIO_SINCOS , - D3DSIO_REP , - D3DSIO_ENDREP , - D3DSIO_IF , - D3DSIO_IFC , - D3DSIO_ELSE , - D3DSIO_ENDIF , - D3DSIO_BREAK , - D3DSIO_BREAKC , - D3DSIO_MOVA , - D3DSIO_DEFB , - D3DSIO_DEFI , - - D3DSIO_TEXCOORD = 64, - D3DSIO_TEXKILL , - D3DSIO_TEX , - D3DSIO_TEXBEM , - D3DSIO_TEXBEML , - D3DSIO_TEXREG2AR , - D3DSIO_TEXREG2GB , - D3DSIO_TEXM3x2PAD , - D3DSIO_TEXM3x2TEX , - D3DSIO_TEXM3x3PAD , - D3DSIO_TEXM3x3TEX , - D3DSIO_RESERVED0 , - D3DSIO_TEXM3x3SPEC , - D3DSIO_TEXM3x3VSPEC , - D3DSIO_EXPP , - D3DSIO_LOGP , - D3DSIO_CND , - D3DSIO_DEF , - D3DSIO_TEXREG2RGB , - D3DSIO_TEXDP3TEX , - D3DSIO_TEXM3x2DEPTH , - D3DSIO_TEXDP3 , - D3DSIO_TEXM3x3 , - D3DSIO_TEXDEPTH , - D3DSIO_CMP , - D3DSIO_BEM , - D3DSIO_DP2ADD , - D3DSIO_DSX , - D3DSIO_DSY , - D3DSIO_TEXLDD , - D3DSIO_SETP , - D3DSIO_TEXLDL , - D3DSIO_BREAKP , - - D3DSIO_PHASE = 0xFFFD, - D3DSIO_COMMENT = 0xFFFE, - D3DSIO_END = 0xFFFF, - - D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum -} D3DSHADER_INSTRUCTION_OPCODE_TYPE; - -//--------------------------------------------------------------------- -// Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3 -// -#define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f -#define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f - -//--------------------------------------------------------------------- -// Co-Issue Instruction Modifier - if set then this instruction is to be -// issued in parallel with the previous instruction(s) for which this bit -// is not set. -// -#define D3DSI_COISSUE 0x40000000 - -//--------------------------------------------------------------------- -// Opcode specific controls - -#define D3DSP_OPCODESPECIFICCONTROL_MASK 0x00ff0000 -#define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16 - -// ps_2_0 texld controls -#define D3DSI_TEXLD_PROJECT (0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) -#define D3DSI_TEXLD_BIAS (0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) - -// Comparison for dynamic conditional instruction opcodes (i.e. if, breakc) -typedef enum _D3DSHADER_COMPARISON -{ - // < = > - D3DSPC_RESERVED0= 0, // 0 0 0 - D3DSPC_GT = 1, // 0 0 1 - D3DSPC_EQ = 2, // 0 1 0 - D3DSPC_GE = 3, // 0 1 1 - D3DSPC_LT = 4, // 1 0 0 - D3DSPC_NE = 5, // 1 0 1 - D3DSPC_LE = 6, // 1 1 0 - D3DSPC_RESERVED1= 7 // 1 1 1 -} D3DSHADER_COMPARISON; - -// Comparison is part of instruction opcode token: -#define D3DSHADER_COMPARISON_SHIFT D3DSP_OPCODESPECIFICCONTROL_SHIFT -#define D3DSHADER_COMPARISON_MASK (0x7<>8)&0xFF) -#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) - -// destination/source parameter register type -#define D3DSI_COMMENTSIZE_SHIFT 16 -#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 -#define D3DSHADER_COMMENT(_DWordSize) \ - ((((_DWordSize)<= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4201) -#endif -#endif // _MSC_VER - -#endif /* (DIRECT3D_VERSION >= 0x0900) */ -#endif /* _d3d9TYPES(P)_H_ */ - diff --git a/README.md b/README.md index 6bb68341dd8..9a48731a615 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ rendering library. Supported rendering backends: - * Direct3D 9 * Direct3D 11 * Direct3D 12 * GNM (only for licensed PS4 developers, search DevNet forums for source) diff --git a/bindings/bf/bgfx.bf b/bindings/bf/bgfx.bf index cc13110fcc1..8863838bbc5 100644 --- a/bindings/bf/bgfx.bf +++ b/bindings/bf/bgfx.bf @@ -1374,11 +1374,6 @@ public static class bgfx /// Agc, - /// - /// Direct3D 9.0 - /// - Direct3D9, - /// /// Direct3D 11.0 /// diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index baccff2c34d..ba23a0e8904 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -1371,11 +1371,6 @@ public enum RendererType /// Agc, - /// - /// Direct3D 9.0 - /// - Direct3D9, - /// /// Direct3D 11.0 /// diff --git a/bindings/d/fakeenum.d b/bindings/d/fakeenum.d index 4fdc6135462..6cc10fa5cbb 100644 --- a/bindings/d/fakeenum.d +++ b/bindings/d/fakeenum.d @@ -14,7 +14,7 @@ extern(C++, "bgfx") package final abstract class Fatal{ } extern(C++, "bgfx") package final abstract class RendererType{ enum Enum{ - noop,agc,direct3D9,direct3D11,direct3D12,gnm,metal,nvn,openGLES,openGL,vulkan,webGPU,count + noop,agc,direct3D11,direct3D12,gnm,metal,nvn,openGLES,openGL,vulkan,webGPU,count } } extern(C++, "bgfx") package final abstract class Access{ @@ -72,6 +72,11 @@ extern(C++, "bgfx") package final abstract class ViewMode{ default_,sequential,depthAscending,depthDescending,count } } +extern(C++, "bgfx") package final abstract class NativeWindowHandleType{ + enum Enum{ + default_,wayland,count + } +} extern(C++, "bgfx") package final abstract class RenderFrame{ enum Enum{ noContext,render,timeout,exiting,count diff --git a/bindings/d/package.d b/bindings/d/package.d index 606959c60fa..67e94e890d0 100644 --- a/bindings/d/package.d +++ b/bindings/d/package.d @@ -10,7 +10,7 @@ import bindbc.bgfx.config; import bindbc.common.types: va_list; static import bgfx.fakeenum; -enum uint apiVersion = 122; +enum uint apiVersion = 123; alias ViewID = ushort; deprecated("Please use `ViewID` instead.") alias ViewId = ushort; @@ -592,7 +592,6 @@ enum Fatal: bgfx.fakeenum.Fatal.Enum{ enum RendererType: bgfx.fakeenum.RendererType.Enum{ noop = bgfx.fakeenum.RendererType.Enum.noop, agc = bgfx.fakeenum.RendererType.Enum.agc, - direct3D9 = bgfx.fakeenum.RendererType.Enum.direct3D9, direct3D11 = bgfx.fakeenum.RendererType.Enum.direct3D11, direct3D12 = bgfx.fakeenum.RendererType.Enum.direct3D12, gnm = bgfx.fakeenum.RendererType.Enum.gnm, diff --git a/bindings/zig/bgfx.zig b/bindings/zig/bgfx.zig index 5929268583d..e4c8ef4566f 100644 --- a/bindings/zig/bgfx.zig +++ b/bindings/zig/bgfx.zig @@ -840,9 +840,6 @@ pub const RendererType = enum(c_int) { /// AGC Agc, - /// Direct3D 9.0 - Direct3D9, - /// Direct3D 11.0 Direct3D11, diff --git a/docs/overview.rst b/docs/overview.rst index 58335373c87..e7b3c71979c 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -17,7 +17,6 @@ licensed under permissive BSD-2 clause open source license. Supported rendering backends ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Direct3D 9 - Direct3D 11 - Direct3D 12 - GNM (only for licensed PS4 developers, search DevNet forums for source) diff --git a/examples/09-hdr/hdr.cpp b/examples/09-hdr/hdr.cpp index 626f10aabd6..6db19d1c830 100644 --- a/examples/09-hdr/hdr.cpp +++ b/examples/09-hdr/hdr.cpp @@ -11,8 +11,6 @@ namespace { -static float s_texelHalf = 0.0f; - struct PosColorTexCoord0Vertex { float m_x; @@ -37,7 +35,7 @@ struct PosColorTexCoord0Vertex bgfx::VertexLayout PosColorTexCoord0Vertex::ms_layout; -void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft = false, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_layout) ) { @@ -52,13 +50,11 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBott const float miny = 0.0f; const float maxy = _height*2.0f; - const float texelHalfW = s_texelHalf/_textureWidth; - const float texelHalfH = s_texelHalf/_textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfW; + const float minu = -1.0f; + const float maxu = 1.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -107,8 +103,8 @@ void setOffsets2x2Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _he { for (uint32_t xx = 0; xx < 3; ++xx) { - offsets[num][0] = (xx - s_texelHalf) * du; - offsets[num][1] = (yy - s_texelHalf) * dv; + offsets[num][0] = xx * du; + offsets[num][1] = yy * dv; ++num; } } @@ -128,8 +124,8 @@ void setOffsets4x4Lum(bgfx::UniformHandle _handle, uint32_t _width, uint32_t _he { for (uint32_t xx = 0; xx < 4; ++xx) { - offsets[num][0] = (xx - 1.0f - s_texelHalf) * du; - offsets[num][1] = (yy - 1.0f - s_texelHalf) * dv; + offsets[num][0] = (xx - 1.0f) * du; + offsets[num][1] = (yy - 1.0f) * dv; ++num; } } @@ -221,7 +217,6 @@ class ExampleHDR : public entry::AppI imguiCreate(); m_caps = bgfx::getCaps(); - s_texelHalf = bgfx::RendererType::Direct3D9 == m_caps->rendererType ? 0.5f : 0.0f; m_oldWidth = 0; m_oldHeight = 0; @@ -496,7 +491,7 @@ class ExampleHDR : public entry::AppI bgfx::setTexture(0, s_texCube, m_uffizi); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); bgfx::setUniform(u_mtx, mtx); - screenSpaceQuad( (float)m_width, (float)m_height, true); + screenSpaceQuad(true); bgfx::submit(hdrSkybox, m_skyProgram); // Render m_mesh into view hdrMesh. @@ -508,35 +503,35 @@ class ExampleHDR : public entry::AppI setOffsets2x2Lum(u_offset, 128, 128); bgfx::setTexture(0, s_texColor, m_fbtextures[0]); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(128.0f, 128.0f, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrLuminance, m_lumProgram); // Downscale luminance 0. setOffsets4x4Lum(u_offset, 128, 128); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[0]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(64.0f, 64.0f, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrLumScale0, m_lumAvgProgram); // Downscale luminance 1. setOffsets4x4Lum(u_offset, 64, 64); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[1]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(16.0f, 16.0f, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrLumScale1, m_lumAvgProgram); // Downscale luminance 2. setOffsets4x4Lum(u_offset, 16, 16); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[2]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(4.0f, 4.0f, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrLumScale2, m_lumAvgProgram); // Downscale luminance 3. setOffsets4x4Lum(u_offset, 4, 4); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[3]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(1.0f, 1.0f, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrLumScale3, m_lumAvgProgram); // m_bright pass m_threshold is tonemap[3]. @@ -545,14 +540,14 @@ class ExampleHDR : public entry::AppI bgfx::setTexture(1, s_texLum, bgfx::getTexture(m_lum[4]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); bgfx::setUniform(u_tonemap, tonemap); - screenSpaceQuad( (float)m_width/2.0f, (float)m_height/2.0f, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrBrightness, m_brightProgram); // m_blur m_bright pass vertically. bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_bright) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); bgfx::setUniform(u_tonemap, tonemap); - screenSpaceQuad( (float)m_width/8.0f, (float)m_height/8.0f, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrVBlur, m_blurProgram); // m_blur m_bright pass horizontally, do tonemaping and combine. @@ -560,7 +555,7 @@ class ExampleHDR : public entry::AppI bgfx::setTexture(1, s_texLum, bgfx::getTexture(m_lum[4]) ); bgfx::setTexture(2, s_texBlur, bgfx::getTexture(m_blur) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad( (float)m_width, (float)m_height, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(hdrHBlurTonemap, m_tonemapProgram); if (bgfx::isValid(m_rb) ) diff --git a/examples/10-font/font.cpp b/examples/10-font/font.cpp index 0a886594ce0..71921ca3d03 100644 --- a/examples/10-font/font.cpp +++ b/examples/10-font/font.cpp @@ -269,21 +269,16 @@ class ExampleFont : public entry::AppI float view[16]; bx::mtxLookAt(view, eye, at); - float centering = 0.0f; - if (bgfx::getRendererType() == bgfx::RendererType::Direct3D9) { - centering = -0.5f; - } - // Setup a top-left ortho matrix for screen space drawing. const bgfx::Caps* caps = bgfx::getCaps(); { float ortho[16]; bx::mtxOrtho( ortho - , centering - , m_width + centering - , m_height + centering - , centering + , 0.0f + , m_width + , m_height + , 0.0f , 0.0f , 100.0f , 0.0f diff --git a/examples/11-fontsdf/fontsdf.cpp b/examples/11-fontsdf/fontsdf.cpp index 08a2dbf5372..8154e356b89 100644 --- a/examples/11-fontsdf/fontsdf.cpp +++ b/examples/11-fontsdf/fontsdf.cpp @@ -256,16 +256,11 @@ class ExampleFontSDF : public entry::AppI float view[16]; bx::mtxLookAt(view, eye, at); - float centering = 0.0f; - if (bgfx::getRendererType() == bgfx::RendererType::Direct3D9) { - centering = -0.5f; - } - // Setup a top-left ortho matrix for screen space drawing. const bgfx::Caps* caps = bgfx::getCaps(); { float ortho[16]; - bx::mtxOrtho(ortho, centering, m_width + centering, m_height + centering, centering, -1.0f, 1.0f, 0.0f, caps->homogeneousDepth); + bx::mtxOrtho(ortho, 0.0f, m_width, m_height, 0.0f, -1.0f, 1.0f, 0.0f, caps->homogeneousDepth); bgfx::setViewTransform(0, view, ortho); bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); } diff --git a/examples/14-shadowvolumes/shadowvolumes.cpp b/examples/14-shadowvolumes/shadowvolumes.cpp index 48828eba6a1..f90aec05dfa 100644 --- a/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/examples/14-shadowvolumes/shadowvolumes.cpp @@ -89,7 +89,6 @@ static const uint16_t s_planeIndices[] = }; static bool s_oglNdc = false; -static float s_texelHalf = 0.0f; static uint32_t s_viewMask = 0; @@ -1797,7 +1796,6 @@ class ExampleShadowVolumes : public entry::AppI const bgfx::Caps* caps = bgfx::getCaps(); s_oglNdc = caps->homogeneousDepth; - s_texelHalf = bgfx::RendererType::Direct3D9 == caps->rendererType ? 0.5f : 0.0f; // Imgui imguiCreate(); @@ -2187,7 +2185,7 @@ class ExampleShadowVolumes : public entry::AppI //update settings s_uniforms.m_params.m_ambientPass = 1.0f; s_uniforms.m_params.m_lightingPass = 1.0f; - s_uniforms.m_params.m_texelHalf = s_texelHalf; + s_uniforms.m_params.m_texelHalf = 0.0f; s_uniforms.m_svparams.m_useStencilTex = float(m_useStencilTexture); //set picked bunny model diff --git a/examples/16-shadowmaps/shadowmaps.cpp b/examples/16-shadowmaps/shadowmaps.cpp index e85f6dfab81..03ef90e9963 100644 --- a/examples/16-shadowmaps/shadowmaps.cpp +++ b/examples/16-shadowmaps/shadowmaps.cpp @@ -177,8 +177,7 @@ static const uint16_t s_planeIndices[] = 1, 3, 2, }; -static bool s_flipV = false; -static float s_texelHalf = 0.0f; +static bool s_originBottomLeft = false; static bgfx::UniformHandle s_texColor; static bgfx::UniformHandle s_shadowMap[ShadowMapRenderTargets::Count]; @@ -858,7 +857,7 @@ struct PosColorTexCoord0Vertex bgfx::VertexLayout PosColorTexCoord0Vertex::ms_layout; -void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBottomLeft = true, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft = true, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosColorTexCoord0Vertex::ms_layout) ) { @@ -873,13 +872,11 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBott const float miny = 0.0f; const float maxy = _height*2.0f; - const float texelHalfW = s_texelHalf/_textureWidth; - const float texelHalfH = s_texelHalf/_textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfW; + const float minu = -1.0f; + const float maxu = 1.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -1168,22 +1165,7 @@ class ExampleShadowmaps : public entry::AppI // Enable debug text. bgfx::setDebug(m_debug); - // Setup root path for binary shaders. Shader binaries are different - // for each renderer. - switch (bgfx::getRendererType() ) - { - case bgfx::RendererType::Direct3D9: - s_texelHalf = 0.5f; - break; - - case bgfx::RendererType::OpenGL: - case bgfx::RendererType::OpenGLES: - s_flipV = true; - break; - - default: - break; - } + s_originBottomLeft = bgfx::getCaps()->originBottomLeft; // Imgui. imguiCreate(); @@ -2784,12 +2766,12 @@ class ExampleShadowmaps : public entry::AppI { bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[0]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); + screenSpaceQuad(s_originBottomLeft); bgfx::submit(RENDERVIEW_VBLUR_0_ID, s_programs.m_vBlur[depthType]); bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtBlur) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); + screenSpaceQuad(s_originBottomLeft); bgfx::submit(RENDERVIEW_HBLUR_0_ID, s_programs.m_hBlur[depthType]); if (LightType::DirectionalLight == m_settings.m_lightType) @@ -2800,12 +2782,12 @@ class ExampleShadowmaps : public entry::AppI bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[ii]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); + screenSpaceQuad(s_originBottomLeft); bgfx::submit(viewId, s_programs.m_vBlur[depthType]); bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtBlur) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); + screenSpaceQuad(s_originBottomLeft); bgfx::submit(viewId+1, s_programs.m_hBlur[depthType]); } } @@ -2816,7 +2798,7 @@ class ExampleShadowmaps : public entry::AppI // Setup shadow mtx. float mtxShadow[16]; - const float ymul = (s_flipV) ? 0.5f : -0.5f; + const float ymul = (s_originBottomLeft) ? 0.5f : -0.5f; float zadd = (DepthImpl::Linear == m_settings.m_depthImpl) ? 0.0f : 0.5f; const float mtxBias[16] = @@ -2835,7 +2817,7 @@ class ExampleShadowmaps : public entry::AppI } else if (LightType::PointLight == m_settings.m_lightType) { - const float s = (s_flipV) ? 1.0f : -1.0f; //sign + const float s = (s_originBottomLeft) ? 1.0f : -1.0f; //sign zadd = (DepthImpl::Linear == m_settings.m_depthImpl) ? 0.0f : 0.5f; const float mtxCropBias[2][TetrahedronFaces::Count][16] = @@ -2912,7 +2894,7 @@ class ExampleShadowmaps : public entry::AppI for (uint8_t ii = 0; ii < TetrahedronFaces::Count; ++ii) { ProjType::Enum projType = (m_settings.m_stencilPack) ? ProjType::Enum(ii>1) : ProjType::Horizontal; - uint8_t biasIndex = cropBiasIndices[m_settings.m_stencilPack][uint8_t(s_flipV)][ii]; + uint8_t biasIndex = cropBiasIndices[m_settings.m_stencilPack][uint8_t(s_originBottomLeft)][ii]; float mtxTmp[16]; bx::mtxMul(mtxTmp, mtxYpr[ii], lightProj[projType]); @@ -3040,7 +3022,7 @@ class ExampleShadowmaps : public entry::AppI { bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[0]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); + screenSpaceQuad(s_originBottomLeft); bgfx::submit(RENDERVIEW_DRAWDEPTH_0_ID, s_programs.m_drawDepth[depthType]); if (LightType::DirectionalLight == m_settings.m_lightType) @@ -3049,7 +3031,7 @@ class ExampleShadowmaps : public entry::AppI { bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[ii]) ); bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); - screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); + screenSpaceQuad(s_originBottomLeft); bgfx::submit(RENDERVIEW_DRAWDEPTH_0_ID+ii, s_programs.m_drawDepth[depthType]); } } diff --git a/examples/21-deferred/deferred.cpp b/examples/21-deferred/deferred.cpp index 5fa1636c190..c77c4f79b3f 100644 --- a/examples/21-deferred/deferred.cpp +++ b/examples/21-deferred/deferred.cpp @@ -19,8 +19,6 @@ constexpr bgfx::ViewId kRenderPassCombine = 3; constexpr bgfx::ViewId kRenderPassDebugLights = 4; constexpr bgfx::ViewId kRenderPassDebugGBuffer = 5; -static float s_texelHalf = 0.0f; - struct PosNormalTangentTexcoordVertex { float m_x; @@ -136,7 +134,7 @@ static const uint16_t s_cubeIndices[36] = 21, 23, 22, }; -void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout) ) { @@ -149,15 +147,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf const float miny = 0.0f; const float maxy = _height*2.0f; - const float texelHalfW = _texelHalf/_textureWidth; - const float texelHalfH = _texelHalf/_textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfH; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -334,8 +330,6 @@ class ExampleDeferred : public entry::AppI imguiCreate(); m_timeOffset = bx::getHPCounter(); - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - s_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; // Get renderer capabilities info. m_caps = bgfx::getCaps(); @@ -690,7 +684,7 @@ class ExampleDeferred : public entry::AppI // Clear UAV texture if (m_useUav) { - screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::setViewFrameBuffer(kRenderPassClearUav, BGFX_INVALID_HANDLE); bgfx::setState(0); bgfx::setImage(2, m_lightBufferTex, 0, bgfx::Access::ReadWrite, bgfx::TextureFormat::RGBA8); @@ -817,7 +811,7 @@ class ExampleDeferred : public entry::AppI | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_ADD ); - screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); if (bgfx::isValid(m_lightTaProgram) && m_useTArray) @@ -846,7 +840,7 @@ class ExampleDeferred : public entry::AppI | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A ); - screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); if (bgfx::isValid(m_lightTaProgram) && m_useTArray) diff --git a/examples/23-vectordisplay/main.cpp b/examples/23-vectordisplay/main.cpp index 213f917b617..5b2903d31a4 100644 --- a/examples/23-vectordisplay/main.cpp +++ b/examples/23-vectordisplay/main.cpp @@ -60,11 +60,7 @@ class ExampleVectorDisplay : public entry::AppI init.resolution.reset = m_reset; bgfx::init(init); - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - float texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; - bool originBottomLeft = bgfx::RendererType::OpenGL == renderer - || bgfx::RendererType::OpenGLES == renderer; - m_vd.init(originBottomLeft, texelHalf); + m_vd.init(bgfx::getCaps()->originBottomLeft); m_vd.setup(uint16_t(m_width), uint16_t(m_height) ); // Enable debug text. diff --git a/examples/23-vectordisplay/vectordisplay.cpp b/examples/23-vectordisplay/vectordisplay.cpp index 719556a8996..3b18a98bd54 100644 --- a/examples/23-vectordisplay/vectordisplay.cpp +++ b/examples/23-vectordisplay/vectordisplay.cpp @@ -52,14 +52,12 @@ inline float normalizef(float _a) VectorDisplay::VectorDisplay() : m_originBottomLeft(false) - , m_texelHalf(false) { } -void VectorDisplay::init(bool _originBottomLeft, float _texelHalf) +void VectorDisplay::init(bool _originBottomLeft) { m_originBottomLeft = _originBottomLeft; - m_texelHalf = _texelHalf; } @@ -238,7 +236,7 @@ void VectorDisplay::endFrame() bgfx::setUniform(u_params, ¶ms); bgfx::setViewTransform(viewCounter, NULL, proj); - screenSpaceQuad(m_glowWidth, m_glowHeight); + screenSpaceQuad(); bgfx::setViewName(viewCounter, "BlendPassA"); bgfx::submit(viewCounter, m_blurShader); @@ -249,7 +247,7 @@ void VectorDisplay::endFrame() bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_glow0FrameBuffer) ); bgfx::setViewTransform(viewCounter, NULL, proj); - screenSpaceQuad(m_glowWidth, m_glowHeight); + screenSpaceQuad(); params[0] = 0.0f; params[1] = 1.0f / m_glowHeight; @@ -288,7 +286,7 @@ void VectorDisplay::endFrame() params[3] = 1.0f; bgfx::setUniform(u_params, params); bgfx::setViewName(viewCounter, "BlendVectorToDisplay"); - screenSpaceQuad(m_screenWidth, m_screenHeight); + screenSpaceQuad(); bgfx::submit(viewCounter, m_blitShader); viewCounter++; @@ -307,7 +305,7 @@ void VectorDisplay::endFrame() params[2] = glow_fin_mult; bgfx::setUniform(u_params, params); bgfx::setViewName(viewCounter, "BlendBlurToDisplay"); - screenSpaceQuad(m_screenWidth, m_screenHeight); + screenSpaceQuad(); bgfx::submit(viewCounter, m_blitShader); viewCounter++; } @@ -767,7 +765,7 @@ void VectorDisplay::getSize(float* _outWidth, float* _outHeight) *_outHeight = m_screenHeight; } -void VectorDisplay::screenSpaceQuad(float _textureWidth, float _textureHeight, float _width, float _height) +void VectorDisplay::screenSpaceQuad(float _width, float _height) { if (3 == getAvailTransientVertexBuffer(3, PosColorUvVertex::ms_layout) ) { @@ -782,13 +780,11 @@ void VectorDisplay::screenSpaceQuad(float _textureWidth, float _textureHeight, f const float miny = 0.0f; const float maxy = _height * 2.0f; - const float texelHalfW = m_texelHalf / _textureWidth; - const float texelHalfH = m_texelHalf / _textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfW; + const float minu = -1.0f; + const float maxu = 1.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (m_originBottomLeft) { diff --git a/examples/23-vectordisplay/vectordisplay.h b/examples/23-vectordisplay/vectordisplay.h index 3cfc57fa525..d98fcce0dca 100644 --- a/examples/23-vectordisplay/vectordisplay.h +++ b/examples/23-vectordisplay/vectordisplay.h @@ -34,7 +34,7 @@ class VectorDisplay { } - void init(bool _originBottomLeft, float _texelHalf); + void init(bool _originBottomLeft); void setup(uint16_t _width, uint16_t _height, uint8_t _view = 2); void resize(uint16_t _width, uint16_t _height); @@ -110,7 +110,7 @@ class VectorDisplay void getSize(float* _outWidth, float* _outHeight); protected: - void screenSpaceQuad(float _textureWidth, float _textureHeight, float _width = 1.0f, float _height = 1.0f); + void screenSpaceQuad(float _width = 1.0f, float _height = 1.0f); struct PendingPoint { diff --git a/examples/30-picking/picking.cpp b/examples/30-picking/picking.cpp index 9a5c36d8fd8..a9387ecfbe3 100644 --- a/examples/30-picking/picking.cpp +++ b/examples/30-picking/picking.cpp @@ -336,14 +336,6 @@ class ExamplePicking : public entry::AppI uint8_t bb = *x++; uint8_t aa = *x++; - if (bgfx::RendererType::Direct3D9 == caps->rendererType) - { - // Comes back as BGRA - uint8_t temp = rr; - rr = bb; - bb = temp; - } - if (0 == (rr|gg|bb) ) // Skip background { continue; diff --git a/examples/31-rsm/reflectiveshadowmap.cpp b/examples/31-rsm/reflectiveshadowmap.cpp index 65dfe345c2e..3d055f80e65 100644 --- a/examples/31-rsm/reflectiveshadowmap.cpp +++ b/examples/31-rsm/reflectiveshadowmap.cpp @@ -128,7 +128,7 @@ struct PosTexCoord0Vertex bgfx::VertexLayout PosTexCoord0Vertex::ms_layout; // Utility function to draw a screen space quad for deferred rendering -void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout) ) { @@ -141,15 +141,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf const float miny = 0.0f; const float maxy = _height*2.0f; - const float texelHalfW = _texelHalf/_textureWidth; - const float texelHalfH = _texelHalf/_textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfH; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -195,7 +193,6 @@ class ExampleRSM : public entry::AppI , m_lightAzimuth(215.0f) , m_rsmAmount(0.25f) , m_vplRadius(3.0f) - , m_texelHalf(0.0f) { } @@ -374,8 +371,6 @@ class ExampleRSM : public entry::AppI // Get renderer capabilities info. m_caps = bgfx::getCaps(); - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - m_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; imguiCreate(); } @@ -580,7 +575,7 @@ class ExampleRSM : public entry::AppI bgfx::setViewTransform(RENDER_PASS_COMBINE, NULL, orthoProj); bgfx::setViewRect(RENDER_PASS_COMBINE, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // Bind vertex buffer and draw quad - screenSpaceQuad( (float)m_width, (float)m_height, m_texelHalf, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(RENDER_PASS_COMBINE, m_combineProgram); // Draw UI @@ -754,8 +749,6 @@ class ExampleRSM : public entry::AppI float m_rsmAmount; // Amount of rsm float m_vplRadius; // Radius of virtual point light - - float m_texelHalf; }; } // namespace diff --git a/examples/38-bloom/bloom.cpp b/examples/38-bloom/bloom.cpp index 99dcb730730..33a89170a76 100644 --- a/examples/38-bloom/bloom.cpp +++ b/examples/38-bloom/bloom.cpp @@ -32,8 +32,6 @@ namespace // number of downsampled and then upsampled textures(used for bloom.) #define TEX_CHAIN_LEN 5 -static float s_texelHalf = 0.0f; - struct PosVertex { float m_x; @@ -123,7 +121,7 @@ static const uint16_t s_cubeIndices[36] = 21, 23, 22, }; -void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout) ) { @@ -136,15 +134,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf const float miny = 0.0f; const float maxy = _height*2.0f; - const float texelHalfW = _texelHalf/_textureWidth; - const float texelHalfH = _texelHalf/_textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfH; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -270,8 +266,6 @@ class ExampleBloom : public entry::AppI imguiCreate(); m_timeOffset = bx::getHPCounter(); - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - s_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; // Get renderer capabilities info. m_caps = bgfx::getCaps(); @@ -554,7 +548,7 @@ class ExampleBloom : public entry::AppI | BGFX_STATE_WRITE_A ); - screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(RENDER_PASS_DOWNSAMPLE0_ID + ii, m_downsampleProgram); } @@ -584,7 +578,7 @@ class ExampleBloom : public entry::AppI | BGFX_STATE_BLEND_ADD ); - screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(RENDER_PASS_UPSAMPLE0_ID + ii, m_upsampleProgram); } @@ -595,7 +589,7 @@ class ExampleBloom : public entry::AppI | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A ); - screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + screenSpaceQuad(m_caps->originBottomLeft); bgfx::submit(RENDER_PASS_COMBINE_ID, m_combineProgram); } diff --git a/examples/39-assao/assao.cpp b/examples/39-assao/assao.cpp index fbff0f29c98..6dc1de27ce5 100644 --- a/examples/39-assao/assao.cpp +++ b/examples/39-assao/assao.cpp @@ -84,7 +84,7 @@ namespace bgfx::VertexLayout PosTexCoord0Vertex::ms_layout; // Utility function to draw a screen space quad for deferred rendering - void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) + void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout)) { @@ -97,15 +97,13 @@ namespace const float miny = 0.0f; const float maxy = _height * 2.0f; - const float texelHalfW = _texelHalf / _textureWidth; - const float texelHalfH = _texelHalf / _textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfH; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -252,7 +250,6 @@ namespace , m_currFrame(UINT32_MAX) , m_enableSSAO(true) , m_enableTexturing(true) - , m_texelHalf(0.0f) , m_framebufferGutter(true) { } @@ -376,10 +373,6 @@ namespace cameraSetVerticalAngle(-0.3f); m_fovY = 60.0f; - // Get renderer capabilities info. - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - m_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; - imguiCreate(); } @@ -495,7 +488,7 @@ namespace bgfx::setViewTransform(RENDER_PASS_COMBINE, NULL, orthoProj); bgfx::setViewRect(RENDER_PASS_COMBINE, 0, 0, uint16_t(m_width), uint16_t(m_height)); // Bind vertex buffer and draw quad - screenSpaceQuad((float)m_width, (float)m_height, m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); //bgfx::submit(RENDER_PASS_COMBINE, m_combineProgram); bgfx::touch(RENDER_PASS_COMBINE); @@ -754,7 +747,7 @@ namespace (float)(m_size[0]-2*m_border) / (float)m_size[0], (float)(m_size[1] - 2 * m_border) / (float)m_size[1], (float)m_border / (float)m_size[0], (float)m_border / (float)m_size[1] }; bgfx::setUniform(u_combineParams, combineParams, 2); - screenSpaceQuad((float)m_width, (float)m_height, m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS); bgfx::submit(view, m_combineProgram); ++view; @@ -1183,7 +1176,6 @@ namespace bool m_enableSSAO; bool m_enableTexturing; - float m_texelHalf; float m_fovY; bool m_framebufferGutter; diff --git a/examples/43-denoise/denoise.cpp b/examples/43-denoise/denoise.cpp index f9ff556a001..3fd2eca7ba0 100644 --- a/examples/43-denoise/denoise.cpp +++ b/examples/43-denoise/denoise.cpp @@ -160,7 +160,7 @@ struct RenderTarget bgfx::FrameBufferHandle m_buffer; }; -void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout) ) { @@ -173,15 +173,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf const float miny = 0.0f; const float maxy = _height * 2.0f; - const float texelHalfW = _texelHalf / _textureWidth; - const float texelHalfH = _texelHalf / _textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfW; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -235,7 +233,6 @@ class ExampleDenoise : public entry::AppI ExampleDenoise(const char* _name, const char* _description) : entry::AppI(_name, _description) , m_currFrame(UINT32_MAX) - , m_texelHalf(0.0f) { } @@ -329,10 +326,6 @@ class ExampleDenoise : public entry::AppI // Track whether previous results are valid m_havePrevious = false; - // Get renderer capabilities info. - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - m_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; - imguiCreate(); } @@ -480,7 +473,7 @@ class ExampleDenoise : public entry::AppI m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_combineProgram); @@ -512,7 +505,7 @@ class ExampleDenoise : public entry::AppI m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_denoiseTemporalProgram); @@ -558,7 +551,7 @@ class ExampleDenoise : public entry::AppI m_uniforms.m_denoiseStep = denoiseStepScale; m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); const bgfx::ProgramHandle spatialProgram = (0 == m_spatialSampleType) ? m_denoiseSpatialProgram3x3 @@ -593,7 +586,7 @@ class ExampleDenoise : public entry::AppI bgfx::setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS); bgfx::setTexture(0, s_color, lastTex); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_copyProgram); ++view; @@ -620,7 +613,7 @@ class ExampleDenoise : public entry::AppI bgfx::setTexture(1, s_albedo, m_gbufferTex[GBUFFER_RT_COLOR]); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_denoiseApplyLighting); ++view; @@ -651,7 +644,7 @@ class ExampleDenoise : public entry::AppI bgfx::setTexture(3, s_depth, m_gbufferTex[GBUFFER_RT_DEPTH]); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_txaaProgram); ++view; @@ -671,7 +664,7 @@ class ExampleDenoise : public entry::AppI ); bgfx::setTexture(0, s_color, m_txaaColor.m_texture); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_copyProgram); ++view; @@ -691,7 +684,7 @@ class ExampleDenoise : public entry::AppI ); bgfx::setTexture(0, s_color, m_txaaColor.m_texture); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_copyProgram); ++view; @@ -718,7 +711,7 @@ class ExampleDenoise : public entry::AppI ); bgfx::setTexture(0, s_color, lastTex); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_copyProgram); ++view; @@ -734,7 +727,7 @@ class ExampleDenoise : public entry::AppI bgfx::setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS); bgfx::setTexture(0, s_color, m_gbufferTex[GBUFFER_RT_NORMAL]); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_copyProgram); ++view; @@ -1095,7 +1088,6 @@ class ExampleDenoise : public entry::AppI bgfx::TextureHandle m_normalTexture; uint32_t m_currFrame; - float m_texelHalf = 0.0f; float m_fovY = 60.0f; bool m_recreateFrameBuffers = false; bool m_havePrevious = false; diff --git a/examples/44-sss/screen_space_shadows.cpp b/examples/44-sss/screen_space_shadows.cpp index 1bf85b0e973..186a64619d7 100644 --- a/examples/44-sss/screen_space_shadows.cpp +++ b/examples/44-sss/screen_space_shadows.cpp @@ -172,7 +172,7 @@ struct RenderTarget bgfx::FrameBufferHandle m_buffer; }; -void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout)) { @@ -185,15 +185,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf const float miny = 0.0f; const float maxy = _height * 2.0f; - const float texelHalfW = _texelHalf / _textureWidth; - const float texelHalfH = _texelHalf / _textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfW; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -247,7 +245,6 @@ class ExampleScreenSpaceShadows : public entry::AppI ExampleScreenSpaceShadows(const char* _name, const char* _description) : entry::AppI(_name, _description) , m_currFrame(UINT32_MAX) - , m_texelHalf(0.0f) { } @@ -336,10 +333,6 @@ class ExampleScreenSpaceShadows : public entry::AppI // Track whether previous results are valid m_havePrevious = false; - // Get renderer capabilities info. - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - m_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; - imguiCreate(); } @@ -502,7 +495,7 @@ class ExampleScreenSpaceShadows : public entry::AppI ); bgfx::setTexture(0, s_depth, m_gbufferTex[GBUFFER_RT_DEPTH]); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_linearDepthProgram); ++view; } @@ -521,7 +514,7 @@ class ExampleScreenSpaceShadows : public entry::AppI ); bgfx::setTexture(0, s_depth, m_linearDepth.m_texture); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_shadowsProgram); ++view; } @@ -543,7 +536,7 @@ class ExampleScreenSpaceShadows : public entry::AppI bgfx::setTexture(2, s_depth, m_linearDepth.m_texture); bgfx::setTexture(3, s_shadows, m_shadows.m_texture); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_combineProgram); ++view; } @@ -818,7 +811,6 @@ class ExampleScreenSpaceShadows : public entry::AppI uint32_t m_currFrame; float m_lightRotation = 0.0f; - float m_texelHalf = 0.0f; float m_fovY = 60.0f; bool m_recreateFrameBuffers = false; bool m_havePrevious = false; diff --git a/examples/45-bokeh/bokeh.cpp b/examples/45-bokeh/bokeh.cpp index 965db747586..edb8bc87029 100644 --- a/examples/45-bokeh/bokeh.cpp +++ b/examples/45-bokeh/bokeh.cpp @@ -36,9 +36,9 @@ namespace { -#define FRAMEBUFFER_RT_COLOR 0 -#define FRAMEBUFFER_RT_DEPTH 1 -#define FRAMEBUFFER_RENDER_TARGETS 2 +#define FRAMEBUFFER_RT_COLOR 0 +#define FRAMEBUFFER_RT_DEPTH 1 +#define FRAMEBUFFER_RENDER_TARGETS 2 enum Meshes { @@ -162,7 +162,7 @@ struct RenderTarget bgfx::FrameBufferHandle m_buffer; }; -void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout)) { @@ -175,15 +175,13 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf const float miny = 0.0f; const float maxy = _height * 2.0f; - const float texelHalfW = _texelHalf / _textureWidth; - const float texelHalfH = _texelHalf / _textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfW; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -229,7 +227,6 @@ class ExampleBokeh : public entry::AppI ExampleBokeh(const char* _name, const char* _description) : entry::AppI(_name, _description) , m_currFrame(UINT32_MAX) - , m_texelHalf(0.0f) { } @@ -304,10 +301,6 @@ class ExampleBokeh : public entry::AppI cameraGetViewMtx(m_view); bx::mtxProj(m_proj, m_fovY, float(m_size[0]) / float(m_size[1]), 0.01f, 100.0f, bgfx::getCaps()->homogeneousDepth); - // Get renderer capabilities info. - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - m_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; - m_bokehTexture.idx = bgfx::kInvalidHandle; updateDisplayBokehTexture(m_radiusScale, m_maxBlurSize, m_lobeCount, (1.0f-m_lobePinch), 1.0f, m_lobeRotation); @@ -452,7 +445,7 @@ class ExampleBokeh : public entry::AppI ); bgfx::setTexture(0, s_depth, m_frameBufferTex[FRAMEBUFFER_RT_DEPTH]); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_linearDepthProgram); ++view; } @@ -481,7 +474,7 @@ class ExampleBokeh : public entry::AppI | BGFX_STATE_WRITE_A ); bgfx::setTexture(0, s_color, m_frameBufferTex[FRAMEBUFFER_RT_COLOR]); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_copyLinearToGammaProgram); ++view; } @@ -701,7 +694,7 @@ class ExampleBokeh : public entry::AppI bgfx::setTexture(0, s_color, lastTex); bgfx::setTexture(1, s_depth, m_linearDepth.m_texture); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, _originBottomLeft); + screenSpaceQuad(_originBottomLeft); bgfx::submit(view, m_dofDebugProgram); ++view; } @@ -719,7 +712,7 @@ class ExampleBokeh : public entry::AppI bgfx::setTexture(0, s_color, lastTex); bgfx::setTexture(1, s_depth, m_linearDepth.m_texture); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, _originBottomLeft); + screenSpaceQuad(_originBottomLeft); bgfx::submit(view, m_dofSinglePassProgram); ++view; } @@ -740,7 +733,7 @@ class ExampleBokeh : public entry::AppI bgfx::setTexture(0, s_color, lastTex); bgfx::setTexture(1, s_depth, m_linearDepth.m_texture); m_uniforms.submit(); - screenSpaceQuad(float(halfWidth), float(halfHeight), m_texelHalf, _originBottomLeft); + screenSpaceQuad(_originBottomLeft); bgfx::submit(view, m_dofDownsampleProgram); ++view; lastTex = m_dofQuarterInput.m_texture; @@ -763,7 +756,7 @@ class ExampleBokeh : public entry::AppI ); bgfx::setTexture(0, s_color, lastTex); m_uniforms.submit(); - screenSpaceQuad(float(halfWidth), float(halfHeight), m_texelHalf, _originBottomLeft); + screenSpaceQuad(_originBottomLeft); bgfx::submit(view, m_dofQuarterProgram); ++view; lastTex = m_dofQuarterOutput.m_texture; @@ -780,7 +773,7 @@ class ExampleBokeh : public entry::AppI bgfx::setTexture(0, s_color, _colorTexture); bgfx::setTexture(1, s_blurredColor, lastTex); m_uniforms.submit(); - screenSpaceQuad(float(m_width), float(m_height), m_texelHalf, _originBottomLeft); + screenSpaceQuad(_originBottomLeft); bgfx::submit(view, m_dofCombineProgram); ++view; } @@ -1022,7 +1015,6 @@ class ExampleBokeh : public entry::AppI uint32_t m_currFrame; float m_lightRotation = 0.0f; - float m_texelHalf = 0.0f; float m_fovY = 60.0f; bool m_recreateFrameBuffers = false; float m_animationTime = 0.0f; diff --git a/examples/46-fsr/app.cpp b/examples/46-fsr/app.cpp index 4049d3e1e7e..31e009b42c9 100644 --- a/examples/46-fsr/app.cpp +++ b/examples/46-fsr/app.cpp @@ -63,7 +63,7 @@ struct PosTexCoord0Vertex bgfx::VertexLayout PosTexCoord0Vertex::ms_layout; -void screenSpaceTriangle(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f, float _offsetX = 0.0f, float _offsetY = 0.0f) +void screenSpaceQuad(bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f, float _offsetX = 0.0f, float _offsetY = 0.0f) { if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_layout) ) { @@ -76,15 +76,13 @@ void screenSpaceTriangle(float _textureWidth, float _textureHeight, float _texel const float miny = 0.0f - _offsetY; const float maxy = _height * 2.0f - _offsetY; - const float texelHalfW = _texelHalf / _textureWidth; - const float texelHalfH = _texelHalf / _textureHeight; - const float minu = -1.0f + texelHalfW; - const float maxu = 1.0f + texelHalfW; + const float minu = -1.0f; + const float maxu = 1.0f; const float zz = 0.0f; - float minv = texelHalfH; - float maxv = 2.0f + texelHalfH; + float minv = 0.0f; + float maxv = 2.0f; if (_originBottomLeft) { @@ -193,7 +191,6 @@ struct AppState uint32_t m_currFrame{UINT32_MAX}; float m_lightRotation = 0.0f; - float m_texelHalf = 0.0f; float m_fovY = 60.0f; float m_animationTime = 0.0f; @@ -262,7 +259,7 @@ struct MagnifierWidget bgfx::setState(0 | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS | BGFX_STATE_BLEND_ALPHA); bgfx::setTexture(0, state.s_color, m_widgetTexture); - screenSpaceTriangle(float(m_widgetWidth), float(m_widgetHeight), state.m_texelHalf, false, scaleX, scaleY, offsetX, offsetY); + screenSpaceQuad(false, scaleX, scaleY, offsetX, offsetY); bgfx::submit(view, state.m_copyLinearToGammaProgram); } @@ -291,7 +288,7 @@ struct MagnifierWidget bgfx::setViewFrameBuffer(view, m_content.m_buffer); bgfx::setState(0 | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A); bgfx::setTexture(0, state.s_color, srcTexture, BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP); - screenSpaceTriangle(float(state.m_width), float(state.m_height), state.m_texelHalf, false, scaleX, scaleY, offsetX, offsetY); + screenSpaceQuad(false, scaleX, scaleY, offsetX, offsetY); bgfx::submit(view, state.m_copyLinearToGammaProgram); ++view; } @@ -421,10 +418,6 @@ class ExampleFsr : public entry::AppI cameraGetViewMtx(m_state.m_view); bx::mtxProj(m_state.m_proj, m_state.m_fovY, float(m_state.m_size[0]) / float(m_state.m_size[1]), 0.01f, 100.0f, bgfx::getCaps()->homogeneousDepth); - // Get renderer capabilities info. - const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); - m_state.m_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; - const uint32_t magnifierSize = 32; m_magnifierWidget.init(magnifierSize, magnifierSize); m_magnifierWidget.setPosition(m_state.m_width * 0.5f, m_state.m_height * 0.5f); @@ -600,7 +593,7 @@ class ExampleFsr : public entry::AppI bgfx::setViewFrameBuffer(view, BGFX_INVALID_HANDLE); bgfx::setState(0 | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A); bgfx::setTexture(0, m_state.s_color, srcTexture, BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP); - screenSpaceTriangle(float(m_state.m_width), float(m_state.m_height), m_state.m_texelHalf, caps->originBottomLeft); + screenSpaceQuad(caps->originBottomLeft); bgfx::submit(view, m_state.m_copyLinearToGammaProgram); } diff --git a/examples/common/bgfx_utils.cpp b/examples/common/bgfx_utils.cpp index fd9cfe9ab17..f4e5cdb9519 100644 --- a/examples/common/bgfx_utils.cpp +++ b/examples/common/bgfx_utils.cpp @@ -105,7 +105,6 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name switch (bgfx::getRendererType() ) { case bgfx::RendererType::Noop: - case bgfx::RendererType::Direct3D9: shaderPath = "shaders/dx9/"; break; case bgfx::RendererType::Direct3D11: case bgfx::RendererType::Direct3D12: shaderPath = "shaders/dx11/"; break; case bgfx::RendererType::Agc: @@ -712,7 +711,6 @@ static RendererTypeRemap s_rendererTypeRemap[] = { { "d3d11", bgfx::RendererType::Direct3D11 }, { "d3d12", bgfx::RendererType::Direct3D12 }, - { "d3d9", bgfx::RendererType::Direct3D9 }, { "gl", bgfx::RendererType::OpenGL }, { "mtl", bgfx::RendererType::Metal }, { "noop", bgfx::RendererType::Noop }, @@ -767,10 +765,6 @@ Args::Args(int _argc, const char* const* _argv) { m_type = bgfx::RendererType::Noop; } - if (cmdLine.hasArg("d3d9") ) - { - m_type = bgfx::RendererType::Direct3D9; - } else if (cmdLine.hasArg("d3d11") ) { m_type = bgfx::RendererType::Direct3D11; diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 3446e405834..adcaededca0 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -137,7 +137,6 @@ namespace bgfx::UniformHandle u_scissorExtScale; bgfx::UniformHandle u_extentRadius; bgfx::UniformHandle u_params; - bgfx::UniformHandle u_halfTexel; bgfx::UniformHandle s_tex; @@ -268,15 +267,6 @@ namespace gl->u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4); gl->s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Sampler); - if (bgfx::getRendererType() == bgfx::RendererType::Direct3D9) - { - gl->u_halfTexel = bgfx::createUniform("u_halfTexel", bgfx::UniformType::Vec4); - } - else - { - gl->u_halfTexel.idx = bgfx::kInvalidHandle; - } - s_nvgLayout .begin() .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) @@ -549,12 +539,6 @@ namespace if (tex != NULL) { handle = tex->id; - - if (bgfx::isValid(gl->u_halfTexel) ) - { - float halfTexel[4] = { 0.5f / tex->width, 0.5f / tex->height }; - bgfx::setUniform(gl->u_halfTexel, halfTexel); - } } } @@ -1084,11 +1068,6 @@ namespace bgfx::destroy(gl->u_params); bgfx::destroy(gl->s_tex); - if (bgfx::isValid(gl->u_halfTexel) ) - { - bgfx::destroy(gl->u_halfTexel); - } - for (uint32_t ii = 0, num = gl->ntextures; ii < num; ++ii) { if (bgfx::isValid(gl->textures[ii].id) diff --git a/examples/runtime/shaders/dx9/fs_albedo_output.bin b/examples/runtime/shaders/dx9/fs_albedo_output.bin deleted file mode 100644 index 6f1296ea362..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_albedo_output.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bloom_combine.bin b/examples/runtime/shaders/dx9/fs_bloom_combine.bin deleted file mode 100644 index 329af459c7f..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bloom_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_copy.bin b/examples/runtime/shaders/dx9/fs_bokeh_copy.bin deleted file mode 100644 index 84f6e01e4ef..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_copy.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_copy_linear_to_gamma.bin b/examples/runtime/shaders/dx9/fs_bokeh_copy_linear_to_gamma.bin deleted file mode 100644 index 10757dadc7d..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_copy_linear_to_gamma.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_dof_combine.bin b/examples/runtime/shaders/dx9/fs_bokeh_dof_combine.bin deleted file mode 100644 index b43090a07c8..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_dof_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_dof_debug.bin b/examples/runtime/shaders/dx9/fs_bokeh_dof_debug.bin deleted file mode 100644 index 881abf8960b..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_dof_debug.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_dof_downsample.bin b/examples/runtime/shaders/dx9/fs_bokeh_dof_downsample.bin deleted file mode 100644 index 66a9c5589c2..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_dof_downsample.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_dof_second_pass.bin b/examples/runtime/shaders/dx9/fs_bokeh_dof_second_pass.bin deleted file mode 100644 index 213a9269287..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_dof_second_pass.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_dof_single_pass.bin b/examples/runtime/shaders/dx9/fs_bokeh_dof_single_pass.bin deleted file mode 100644 index 4d6eea4035a..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_dof_single_pass.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_forward.bin b/examples/runtime/shaders/dx9/fs_bokeh_forward.bin deleted file mode 100644 index d68d902a2eb..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_forward.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_forward_grid.bin b/examples/runtime/shaders/dx9/fs_bokeh_forward_grid.bin deleted file mode 100644 index 7d37c87af54..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_forward_grid.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bokeh_linear_depth.bin b/examples/runtime/shaders/dx9/fs_bokeh_linear_depth.bin deleted file mode 100644 index 6ba477aea77..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bokeh_linear_depth.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bump.bin b/examples/runtime/shaders/dx9/fs_bump.bin deleted file mode 100644 index 8593e324937..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bump.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_bunnylod.bin b/examples/runtime/shaders/dx9/fs_bunnylod.bin deleted file mode 100644 index 3114620167e..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_bunnylod.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_callback.bin b/examples/runtime/shaders/dx9/fs_callback.bin deleted file mode 100644 index 3114620167e..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_callback.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_cubes.bin b/examples/runtime/shaders/dx9/fs_cubes.bin deleted file mode 100644 index 700d4073931..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_cubes.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_deferred_combine.bin b/examples/runtime/shaders/dx9/fs_deferred_combine.bin deleted file mode 100644 index d87b5e3d6b1..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_deferred_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_deferred_debug.bin b/examples/runtime/shaders/dx9/fs_deferred_debug.bin deleted file mode 100644 index 3408ef77eb7..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_deferred_debug.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin b/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin deleted file mode 100644 index 700d4073931..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_deferred_debug_line.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_deferred_geom.bin b/examples/runtime/shaders/dx9/fs_deferred_geom.bin deleted file mode 100644 index 2827cd7ad13..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_deferred_geom.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_deferred_light.bin b/examples/runtime/shaders/dx9/fs_deferred_light.bin deleted file mode 100644 index 61a7797e60d..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_deferred_light.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_apply_lighting.bin b/examples/runtime/shaders/dx9/fs_denoise_apply_lighting.bin deleted file mode 100644 index 147f365ad34..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_apply_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_copy.bin b/examples/runtime/shaders/dx9/fs_denoise_copy.bin deleted file mode 100644 index 84f6e01e4ef..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_copy.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_deferred_combine.bin b/examples/runtime/shaders/dx9/fs_denoise_deferred_combine.bin deleted file mode 100644 index f11653a6587..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_deferred_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_gbuffer.bin b/examples/runtime/shaders/dx9/fs_denoise_gbuffer.bin deleted file mode 100644 index 69a94009fcc..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_gbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_spatial_3x3.bin b/examples/runtime/shaders/dx9/fs_denoise_spatial_3x3.bin deleted file mode 100644 index b2979d364ff..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_spatial_3x3.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_spatial_5x5.bin b/examples/runtime/shaders/dx9/fs_denoise_spatial_5x5.bin deleted file mode 100644 index a001e8adf71..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_spatial_5x5.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_temporal.bin b/examples/runtime/shaders/dx9/fs_denoise_temporal.bin deleted file mode 100644 index f39a8e424b4..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_temporal.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_denoise_txaa.bin b/examples/runtime/shaders/dx9/fs_denoise_txaa.bin deleted file mode 100644 index ef144b84a43..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_denoise_txaa.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_downsample.bin b/examples/runtime/shaders/dx9/fs_downsample.bin deleted file mode 100644 index 8606727837f..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_downsample.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_hdr_blur.bin b/examples/runtime/shaders/dx9/fs_hdr_blur.bin deleted file mode 100644 index a124b8745cc..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_hdr_blur.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_hdr_bright.bin b/examples/runtime/shaders/dx9/fs_hdr_bright.bin deleted file mode 100644 index 33d94212843..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_hdr_bright.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_hdr_lum.bin b/examples/runtime/shaders/dx9/fs_hdr_lum.bin deleted file mode 100644 index daab41603a9..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_hdr_lum.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin b/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin deleted file mode 100644 index 87de810b517..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_hdr_lumavg.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_hdr_mesh.bin b/examples/runtime/shaders/dx9/fs_hdr_mesh.bin deleted file mode 100644 index ea8e437c181..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_hdr_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_hdr_skybox.bin b/examples/runtime/shaders/dx9/fs_hdr_skybox.bin deleted file mode 100644 index de5fcfdbcae..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_hdr_skybox.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin b/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin deleted file mode 100644 index 4c9bff1f770..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_hdr_tonemap.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_ibl_mesh.bin b/examples/runtime/shaders/dx9/fs_ibl_mesh.bin deleted file mode 100644 index 944f4c57f6a..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_ibl_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_ibl_skybox.bin b/examples/runtime/shaders/dx9/fs_ibl_skybox.bin deleted file mode 100644 index cc1c38598dc..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_ibl_skybox.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_instancing.bin b/examples/runtime/shaders/dx9/fs_instancing.bin deleted file mode 100644 index 55df9e53120..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_instancing.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_mesh.bin b/examples/runtime/shaders/dx9/fs_mesh.bin deleted file mode 100644 index 6b1375fc1e3..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_oit.bin b/examples/runtime/shaders/dx9/fs_oit.bin deleted file mode 100644 index ac01fa755f2..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_oit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_oit_wb.bin b/examples/runtime/shaders/dx9/fs_oit_wb.bin deleted file mode 100644 index 765033b3aac..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_oit_wb.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin b/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin deleted file mode 100644 index 568e282c75e..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_oit_wb_blit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin b/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin deleted file mode 100644 index ee88e29bb52..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_oit_wb_separate.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin b/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin deleted file mode 100644 index 6ae21a41f85..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_oit_wb_separate_blit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_particle.bin b/examples/runtime/shaders/dx9/fs_particle.bin deleted file mode 100644 index bb6a308829a..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_particle.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_picking_id.bin b/examples/runtime/shaders/dx9/fs_picking_id.bin deleted file mode 100644 index 716a5005ce5..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_picking_id.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_picking_shaded.bin b/examples/runtime/shaders/dx9/fs_picking_shaded.bin deleted file mode 100644 index 943c5475e79..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_picking_shaded.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_pom.bin b/examples/runtime/shaders/dx9/fs_pom.bin deleted file mode 100644 index 70e545bf8ab..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_pom.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_raymarching.bin b/examples/runtime/shaders/dx9/fs_raymarching.bin deleted file mode 100644 index fa500228645..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_raymarching.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_rsm_combine.bin b/examples/runtime/shaders/dx9/fs_rsm_combine.bin deleted file mode 100644 index 5ba1650aeda..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_rsm_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_rsm_gbuffer.bin b/examples/runtime/shaders/dx9/fs_rsm_gbuffer.bin deleted file mode 100644 index ef34b3636e4..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_rsm_gbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_rsm_lbuffer.bin b/examples/runtime/shaders/dx9/fs_rsm_lbuffer.bin deleted file mode 100644 index bbbc8ca3378..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_rsm_lbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_rsm_shadow.bin b/examples/runtime/shaders/dx9/fs_rsm_shadow.bin deleted file mode 100644 index 764c7d73e79..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_rsm_shadow.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_screen_space_shadows.bin b/examples/runtime/shaders/dx9/fs_screen_space_shadows.bin deleted file mode 100644 index e3b1e33ce59..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_screen_space_shadows.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin deleted file mode 100644 index b1b4264e191..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_black.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin deleted file mode 100644 index 1b2c351cdc5..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin deleted file mode 100644 index b9f9afe3f89..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin deleted file mode 100644 index ed59592c0b1..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin deleted file mode 100644 index 1dfd0f854a0..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin deleted file mode 100644 index 77536d1c0e2..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin deleted file mode 100644 index d37dc753ba3..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin deleted file mode 100644 index 74af5f3e9ed..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin deleted file mode 100644 index b5da6ecc751..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin deleted file mode 100644 index 079cce87ca6..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin deleted file mode 100644 index 268c84921f2..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin deleted file mode 100644 index 12bac8dd1f8..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin deleted file mode 100644 index 08e480e538d..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin deleted file mode 100644 index c92e5744896..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin deleted file mode 100644 index e16e59c950a..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin deleted file mode 100644 index db06beeb4a9..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin deleted file mode 100644 index bd9c4d94efd..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin deleted file mode 100644 index ed9396928d9..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin deleted file mode 100644 index 686647e1f66..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin deleted file mode 100644 index 9556bf4d8fc..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin deleted file mode 100644 index 2794791c808..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin deleted file mode 100644 index 9f1a20e14ad..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin deleted file mode 100644 index 2e95a18ad08..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin deleted file mode 100644 index 5d9b9a74b90..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin deleted file mode 100644 index c7e51a18c3f..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin deleted file mode 100644 index ad50ba47f97..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_color_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin deleted file mode 100644 index 37abb8238a8..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_hblur.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin deleted file mode 100644 index 7f275b11952..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_hblur_vsm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin deleted file mode 100644 index d1f651fcb31..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin deleted file mode 100644 index 63e0f78f083..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin deleted file mode 100644 index 954f0eadf56..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin deleted file mode 100644 index 239405a48cd..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_packdepth_vsm_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin deleted file mode 100644 index 3408ef77eb7..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin deleted file mode 100644 index 44c3a348785..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin deleted file mode 100644 index cb0fe6851f2..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_unpackdepth_vsm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin deleted file mode 100644 index 37abb8238a8..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_vblur.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin b/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin deleted file mode 100644 index 7f275b11952..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowmaps_vblur_vsm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin deleted file mode 100644 index ef6bf60473e..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_color_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin deleted file mode 100644 index ad50ba47f97..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_color_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin deleted file mode 100644 index d7362dfd947..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svbackblank.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin deleted file mode 100644 index 58a70bbebd6..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svbackcolor.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin deleted file mode 100644 index 2cb49d20142..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin deleted file mode 100644 index b2223d72e8e..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin deleted file mode 100644 index 65dcdd0fba7..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontblank.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin deleted file mode 100644 index 58a70bbebd6..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svfrontcolor.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin deleted file mode 100644 index 2cb49d20142..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin deleted file mode 100644 index b2223d72e8e..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin deleted file mode 100644 index 3e69e0785c9..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin deleted file mode 100644 index dd05e0d91ac..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svsideblank.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin deleted file mode 100644 index 95e0ad9a217..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svsidecolor.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin deleted file mode 100644 index 4bcfb148e46..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin deleted file mode 100644 index 3408ef77eb7..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin b/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin deleted file mode 100644 index 0724e37ad1e..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_shadowvolume_texture_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sky.bin b/examples/runtime/shaders/dx9/fs_sky.bin deleted file mode 100644 index 5064b58d931..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sky.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sky_color_banding_fix.bin b/examples/runtime/shaders/dx9/fs_sky_color_banding_fix.bin deleted file mode 100644 index 5afafb2cd4a..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sky_color_banding_fix.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sky_landscape.bin b/examples/runtime/shaders/dx9/fs_sky_landscape.bin deleted file mode 100644 index b25b43547ad..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sky_landscape.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sms_mesh.bin b/examples/runtime/shaders/dx9/fs_sms_mesh.bin deleted file mode 100644 index 41a0d91c259..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sms_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin b/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin deleted file mode 100644 index e645628c945..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sms_mesh_pd.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sms_shadow.bin b/examples/runtime/shaders/dx9/fs_sms_shadow.bin deleted file mode 100644 index b1b4264e191..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sms_shadow.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin b/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin deleted file mode 100644 index dd24490ccf2..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sms_shadow_pd.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sss_deferred_combine.bin b/examples/runtime/shaders/dx9/fs_sss_deferred_combine.bin deleted file mode 100644 index 9223fb96b0b..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sss_deferred_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sss_gbuffer.bin b/examples/runtime/shaders/dx9/fs_sss_gbuffer.bin deleted file mode 100644 index f2b1affdb68..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sss_gbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sss_linear_depth.bin b/examples/runtime/shaders/dx9/fs_sss_linear_depth.bin deleted file mode 100644 index d917ae3a2a1..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sss_linear_depth.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_sss_unlit.bin b/examples/runtime/shaders/dx9/fs_sss_unlit.bin deleted file mode 100644 index 2b8dd1d182f..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_sss_unlit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_stencil_color_black.bin b/examples/runtime/shaders/dx9/fs_stencil_color_black.bin deleted file mode 100644 index b1b4264e191..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_stencil_color_black.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin b/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin deleted file mode 100644 index 222d68989ef..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_stencil_color_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin b/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin deleted file mode 100644 index ad50ba47f97..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_stencil_color_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_stencil_texture.bin b/examples/runtime/shaders/dx9/fs_stencil_texture.bin deleted file mode 100644 index 3408ef77eb7..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_stencil_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin b/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin deleted file mode 100644 index e1e169b68b3..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_stencil_texture_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_terrain.bin b/examples/runtime/shaders/dx9/fs_terrain.bin deleted file mode 100644 index 6642221c13a..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_terrain.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_tree.bin b/examples/runtime/shaders/dx9/fs_tree.bin deleted file mode 100644 index 3a994d45c58..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_tree.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_update.bin b/examples/runtime/shaders/dx9/fs_update.bin deleted file mode 100644 index 1f0eedd0db3..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_update.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_update_3d.bin b/examples/runtime/shaders/dx9/fs_update_3d.bin deleted file mode 100644 index f3563c9e639..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_update_3d.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_update_cmp.bin b/examples/runtime/shaders/dx9/fs_update_cmp.bin deleted file mode 100644 index ec0c1e4a640..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_update_cmp.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_upsample.bin b/examples/runtime/shaders/dx9/fs_upsample.bin deleted file mode 100644 index 08dbea040f2..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_upsample.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin b/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin deleted file mode 100644 index a5fb6ea02dd..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_vectordisplay_blit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin b/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin deleted file mode 100644 index 4560d9a5e91..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_vectordisplay_blur.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin b/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin deleted file mode 100644 index 476ad6e53d6..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_vectordisplay_fb.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_vt_mip.bin b/examples/runtime/shaders/dx9/fs_vt_mip.bin deleted file mode 100644 index 789adf25709..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_vt_mip.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_vt_unlit.bin b/examples/runtime/shaders/dx9/fs_vt_unlit.bin deleted file mode 100644 index eb46ab810fa..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_vt_unlit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_wf_mesh.bin b/examples/runtime/shaders/dx9/fs_wf_mesh.bin deleted file mode 100644 index 6bd8a8b5143..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_wf_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/fs_wf_wireframe.bin b/examples/runtime/shaders/dx9/fs_wf_wireframe.bin deleted file mode 100644 index 7f206c30ab0..00000000000 Binary files a/examples/runtime/shaders/dx9/fs_wf_wireframe.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_albedo_output.bin b/examples/runtime/shaders/dx9/vs_albedo_output.bin deleted file mode 100644 index 2b9543debaf..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_albedo_output.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_bokeh_forward.bin b/examples/runtime/shaders/dx9/vs_bokeh_forward.bin deleted file mode 100644 index 6eb0f438d42..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_bokeh_forward.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_bokeh_screenquad.bin b/examples/runtime/shaders/dx9/vs_bokeh_screenquad.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_bokeh_screenquad.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_bump.bin b/examples/runtime/shaders/dx9/vs_bump.bin deleted file mode 100644 index 3124c71b34e..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_bump.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_bump_instanced.bin b/examples/runtime/shaders/dx9/vs_bump_instanced.bin deleted file mode 100644 index 5205244584e..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_bump_instanced.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_bunnylod.bin b/examples/runtime/shaders/dx9/vs_bunnylod.bin deleted file mode 100644 index 7b0b30845ae..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_bunnylod.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_callback.bin b/examples/runtime/shaders/dx9/vs_callback.bin deleted file mode 100644 index 07698c2d168..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_callback.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_cubes.bin b/examples/runtime/shaders/dx9/vs_cubes.bin deleted file mode 100644 index 95fd67dd3be..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_cubes.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_deferred_combine.bin b/examples/runtime/shaders/dx9/vs_deferred_combine.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_deferred_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_deferred_debug.bin b/examples/runtime/shaders/dx9/vs_deferred_debug.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_deferred_debug.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin b/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin deleted file mode 100644 index 95fd67dd3be..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_deferred_debug_line.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_deferred_geom.bin b/examples/runtime/shaders/dx9/vs_deferred_geom.bin deleted file mode 100644 index 87bb0ca34e3..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_deferred_geom.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_deferred_light.bin b/examples/runtime/shaders/dx9/vs_deferred_light.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_deferred_light.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_denoise_gbuffer.bin b/examples/runtime/shaders/dx9/vs_denoise_gbuffer.bin deleted file mode 100644 index 0895188f2b3..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_denoise_gbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_denoise_screenquad.bin b/examples/runtime/shaders/dx9/vs_denoise_screenquad.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_denoise_screenquad.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_fullscreen.bin b/examples/runtime/shaders/dx9/vs_fullscreen.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_fullscreen.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_hdr_blur.bin b/examples/runtime/shaders/dx9/vs_hdr_blur.bin deleted file mode 100644 index 50df71ea1a5..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_hdr_blur.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_hdr_bright.bin b/examples/runtime/shaders/dx9/vs_hdr_bright.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_hdr_bright.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_hdr_lum.bin b/examples/runtime/shaders/dx9/vs_hdr_lum.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_hdr_lum.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin b/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_hdr_lumavg.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_hdr_mesh.bin b/examples/runtime/shaders/dx9/vs_hdr_mesh.bin deleted file mode 100644 index 8fd46441520..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_hdr_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_hdr_skybox.bin b/examples/runtime/shaders/dx9/vs_hdr_skybox.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_hdr_skybox.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin b/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin deleted file mode 100644 index 0fd8092de83..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_hdr_tonemap.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_ibl_mesh.bin b/examples/runtime/shaders/dx9/vs_ibl_mesh.bin deleted file mode 100644 index 99ef558ad3b..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_ibl_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_ibl_skybox.bin b/examples/runtime/shaders/dx9/vs_ibl_skybox.bin deleted file mode 100644 index 3571f1b5e94..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_ibl_skybox.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_instancing.bin b/examples/runtime/shaders/dx9/vs_instancing.bin deleted file mode 100644 index ab2bfe0a6c2..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_instancing.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_mesh.bin b/examples/runtime/shaders/dx9/vs_mesh.bin deleted file mode 100644 index 4bbac813cb9..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_oit.bin b/examples/runtime/shaders/dx9/vs_oit.bin deleted file mode 100644 index 2ab4489a9d7..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_oit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_oit_blit.bin b/examples/runtime/shaders/dx9/vs_oit_blit.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_oit_blit.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_particle.bin b/examples/runtime/shaders/dx9/vs_particle.bin deleted file mode 100644 index fe36bb2f120..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_particle.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_picking_shaded.bin b/examples/runtime/shaders/dx9/vs_picking_shaded.bin deleted file mode 100644 index a43a35802fa..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_picking_shaded.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_pom.bin b/examples/runtime/shaders/dx9/vs_pom.bin deleted file mode 100644 index c72f0c7b59a..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_pom.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_raymarching.bin b/examples/runtime/shaders/dx9/vs_raymarching.bin deleted file mode 100644 index 74a58a5affd..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_raymarching.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_rsm_combine.bin b/examples/runtime/shaders/dx9/vs_rsm_combine.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_rsm_combine.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_rsm_gbuffer.bin b/examples/runtime/shaders/dx9/vs_rsm_gbuffer.bin deleted file mode 100644 index 32f847f09ba..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_rsm_gbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_rsm_lbuffer.bin b/examples/runtime/shaders/dx9/vs_rsm_lbuffer.bin deleted file mode 100644 index 26adca04aa0..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_rsm_lbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_rsm_shadow.bin b/examples/runtime/shaders/dx9/vs_rsm_shadow.bin deleted file mode 100644 index b7f527de79d..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_rsm_shadow.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin deleted file mode 100644 index 40836a0ffc8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin deleted file mode 100644 index 2b2ad369247..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin deleted file mode 100644 index d7ee0a3272e..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin deleted file mode 100644 index 52c34d5925b..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin deleted file mode 100644 index 53953187115..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_csm.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin deleted file mode 100644 index fd3ead2c532..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_linear_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin deleted file mode 100644 index c385b45349b..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color_lighting_omni.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_color_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin deleted file mode 100644 index 40836a0ffc8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_depth.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin deleted file mode 100644 index 8136301919f..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_hblur.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin deleted file mode 100644 index e34df08be0e..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin deleted file mode 100644 index f18c87c640d..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_packdepth_linear.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin deleted file mode 100644 index f71bff7e0e1..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_texture_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_unpackdepth.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin b/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin deleted file mode 100644 index 7793d9ee8eb..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowmaps_vblur.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin b/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin deleted file mode 100644 index 3023ca0ae73..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowvolume_color_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin b/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowvolume_color_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin b/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin deleted file mode 100644 index 26c6ba09904..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowvolume_svback.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin b/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin deleted file mode 100644 index 40836a0ffc8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowvolume_svfront.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin b/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin deleted file mode 100644 index 9af4c93d743..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowvolume_svside.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin b/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowvolume_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin b/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin deleted file mode 100644 index eb98db90014..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_shadowvolume_texture_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_sky.bin b/examples/runtime/shaders/dx9/vs_sky.bin deleted file mode 100644 index bebd3006ecc..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_sky.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_sky_landscape.bin b/examples/runtime/shaders/dx9/vs_sky_landscape.bin deleted file mode 100644 index d8735fdc7d0..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_sky_landscape.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_sms_mesh.bin b/examples/runtime/shaders/dx9/vs_sms_mesh.bin deleted file mode 100644 index 0c66d23215b..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_sms_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_sms_shadow.bin b/examples/runtime/shaders/dx9/vs_sms_shadow.bin deleted file mode 100644 index 40836a0ffc8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_sms_shadow.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin b/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin deleted file mode 100644 index c9940da4b0d..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_sms_shadow_pd.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_sss_gbuffer.bin b/examples/runtime/shaders/dx9/vs_sss_gbuffer.bin deleted file mode 100644 index 2525e1e383c..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_sss_gbuffer.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_sss_screenquad.bin b/examples/runtime/shaders/dx9/vs_sss_screenquad.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_sss_screenquad.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_stencil_color.bin b/examples/runtime/shaders/dx9/vs_stencil_color.bin deleted file mode 100644 index 40836a0ffc8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_stencil_color.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin b/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin deleted file mode 100644 index d3f9665eef9..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_stencil_color_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin b/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_stencil_color_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_stencil_texture.bin b/examples/runtime/shaders/dx9/vs_stencil_texture.bin deleted file mode 100644 index 0f8b5da33b8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_stencil_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin b/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin deleted file mode 100644 index c2d56e09b41..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_stencil_texture_lighting.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_terrain.bin b/examples/runtime/shaders/dx9/vs_terrain.bin deleted file mode 100644 index 8542fc840cd..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_terrain.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_terrain_height_texture.bin b/examples/runtime/shaders/dx9/vs_terrain_height_texture.bin deleted file mode 100644 index 6d8f02f54b2..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_terrain_height_texture.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_tree.bin b/examples/runtime/shaders/dx9/vs_tree.bin deleted file mode 100644 index 061b530e0a6..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_tree.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_update.bin b/examples/runtime/shaders/dx9/vs_update.bin deleted file mode 100644 index f2abef754c2..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_update.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin b/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin deleted file mode 100644 index 74a58a5affd..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_vectordisplay_fb.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_vt_generic.bin b/examples/runtime/shaders/dx9/vs_vt_generic.bin deleted file mode 100644 index cf2fa64ddf8..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_vt_generic.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_wf_mesh.bin b/examples/runtime/shaders/dx9/vs_wf_mesh.bin deleted file mode 100644 index b6dd72c53ae..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_wf_mesh.bin and /dev/null differ diff --git a/examples/runtime/shaders/dx9/vs_wf_wireframe.bin b/examples/runtime/shaders/dx9/vs_wf_wireframe.bin deleted file mode 100644 index dcc4697d674..00000000000 Binary files a/examples/runtime/shaders/dx9/vs_wf_wireframe.bin and /dev/null differ diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index 46347c383ec..06f837731ec 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -53,7 +53,6 @@ namespace bgfx { Noop, //!< No rendering. Agc, //!< AGC - Direct3D9, //!< Direct3D 9.0 Direct3D11, //!< Direct3D 11.0 Direct3D12, //!< Direct3D 12.0 Gnm, //!< GNM diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index f79e93241a0..bdcd6b4af3a 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -82,16 +82,15 @@ typedef enum bgfx_renderer_type { BGFX_RENDERER_TYPE_NOOP, /** ( 0) No rendering. */ BGFX_RENDERER_TYPE_AGC, /** ( 1) AGC */ - BGFX_RENDERER_TYPE_DIRECT3D9, /** ( 2) Direct3D 9.0 */ - BGFX_RENDERER_TYPE_DIRECT3D11, /** ( 3) Direct3D 11.0 */ - BGFX_RENDERER_TYPE_DIRECT3D12, /** ( 4) Direct3D 12.0 */ - BGFX_RENDERER_TYPE_GNM, /** ( 5) GNM */ - BGFX_RENDERER_TYPE_METAL, /** ( 6) Metal */ - BGFX_RENDERER_TYPE_NVN, /** ( 7) NVN */ - BGFX_RENDERER_TYPE_OPENGLES, /** ( 8) OpenGL ES 2.0+ */ - BGFX_RENDERER_TYPE_OPENGL, /** ( 9) OpenGL 2.1+ */ - BGFX_RENDERER_TYPE_VULKAN, /** (10) Vulkan */ - BGFX_RENDERER_TYPE_WEBGPU, /** (11) WebGPU */ + BGFX_RENDERER_TYPE_DIRECT3D11, /** ( 2) Direct3D 11.0 */ + BGFX_RENDERER_TYPE_DIRECT3D12, /** ( 3) Direct3D 12.0 */ + BGFX_RENDERER_TYPE_GNM, /** ( 4) GNM */ + BGFX_RENDERER_TYPE_METAL, /** ( 5) Metal */ + BGFX_RENDERER_TYPE_NVN, /** ( 6) NVN */ + BGFX_RENDERER_TYPE_OPENGLES, /** ( 7) OpenGL ES 2.0+ */ + BGFX_RENDERER_TYPE_OPENGL, /** ( 8) OpenGL 2.1+ */ + BGFX_RENDERER_TYPE_VULKAN, /** ( 9) Vulkan */ + BGFX_RENDERER_TYPE_WEBGPU, /** (10) WebGPU */ BGFX_RENDERER_TYPE_COUNT @@ -392,13 +391,13 @@ typedef enum bgfx_view_mode } bgfx_view_mode_t; /** - * Native window handle type.. + * Native window handle type. * */ typedef enum bgfx_native_window_handle_type { - BGFX_NATIVE_WINDOW_HANDLE_TYPE_DEFAULT, /** ( 0) Platform default handle type (X11 on Linux) */ - BGFX_NATIVE_WINDOW_HANDLE_TYPE_WAYLAND, /** ( 1) Wayland. */ + BGFX_NATIVE_WINDOW_HANDLE_TYPE_DEFAULT, /** ( 0) Platform default handle type (X11 on Linux). */ + BGFX_NATIVE_WINDOW_HANDLE_TYPE_WAYLAND, /** ( 1) Wayland. */ BGFX_NATIVE_WINDOW_HANDLE_TYPE_COUNT @@ -637,11 +636,7 @@ typedef struct bgfx_platform_data_s * depth/stencil surface. */ void* backBufferDS; - - /** - * Handle type. Needed for platforms having more than one option. - */ - bgfx_native_window_handle_type_t type; + bgfx_native_window_handle_type_t type; /** Handle type. Needed for platforms having more than one option. */ } bgfx_platform_data_t; diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index 0b7d1d6b38b..e3e364e2b09 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -15,7 +15,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(122) +#define BGFX_API_VERSION UINT32_C(123) /** * Color RGB/alpha/depth write. When it's not specified write will be disabled. diff --git a/include/bgfx/embedded_shader.h b/include/bgfx/embedded_shader.h index 525f47c1fb1..6c8db4f80a0 100644 --- a/include/bgfx/embedded_shader.h +++ b/include/bgfx/embedded_shader.h @@ -10,7 +10,6 @@ #include "bgfx.h" #define BGFX_EMBEDDED_SHADER_DXBC(...) -#define BGFX_EMBEDDED_SHADER_DX9BC(...) #define BGFX_EMBEDDED_SHADER_PSSL(...) #define BGFX_EMBEDDED_SHADER_ESSL(...) #define BGFX_EMBEDDED_SHADER_GLSL(...) @@ -18,10 +17,6 @@ #define BGFX_EMBEDDED_SHADER_NVN(...) #define BGFX_EMBEDDED_SHADER_SPIRV(...) -#define BGFX_PLATFORM_SUPPORTS_DX9BC (0 \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_WINDOWS \ - ) #define BGFX_PLATFORM_SUPPORTS_DXBC (0 \ || BX_PLATFORM_LINUX \ || BX_PLATFORM_WINDOWS \ @@ -62,12 +57,6 @@ || BX_PLATFORM_OSX \ ) -#if BGFX_PLATFORM_SUPPORTS_DX9BC -# undef BGFX_EMBEDDED_SHADER_DX9BC -# define BGFX_EMBEDDED_SHADER_DX9BC(_renderer, _name) \ - { _renderer, BX_CONCATENATE(_name, _dx9 ), BX_COUNTOF(BX_CONCATENATE(_name, _dx9 ) ) }, -#endif // BGFX_PLATFORM_SUPPORTS_DX9BC - #if BGFX_PLATFORM_SUPPORTS_DXBC # undef BGFX_EMBEDDED_SHADER_DXBC # define BGFX_EMBEDDED_SHADER_DXBC(_renderer, _name) \ @@ -109,7 +98,6 @@ #_name, \ { \ BGFX_EMBEDDED_SHADER_PSSL (bgfx::RendererType::Agc, _name) \ - BGFX_EMBEDDED_SHADER_DX9BC(bgfx::RendererType::Direct3D9, _name) \ BGFX_EMBEDDED_SHADER_DXBC (bgfx::RendererType::Direct3D11, _name) \ BGFX_EMBEDDED_SHADER_DXBC (bgfx::RendererType::Direct3D12, _name) \ BGFX_EMBEDDED_SHADER_PSSL (bgfx::RendererType::Gnm, _name) \ diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 32f143d236d..436b6bbb08b 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -1,7 +1,7 @@ -- vim: syntax=lua -- bgfx interface -version(122) +version(123) typedef "bool" typedef "char" @@ -458,7 +458,6 @@ enum.Fatal { underscore, comment = "" } enum.RendererType { comment = "Renderer types:" } .Noop --- No rendering. .Agc --- AGC - .Direct3D9 --- Direct3D 9.0 .Direct3D11 --- Direct3D 11.0 .Direct3D12 --- Direct3D 12.0 .Gnm --- GNM diff --git a/scripts/shader.mk b/scripts/shader.mk index 467cd39625e..c580194f5ec 100644 --- a/scripts/shader.mk +++ b/scripts/shader.mk @@ -15,7 +15,7 @@ ifndef TARGET .PHONY: all all: @echo Usage: make TARGET=# [clean, all, rebuild] - @echo " TARGET=0 (hlsl - d3d9 / Windows only!)" + @echo " TARGET=0 (hlsl - d3d11 / Windows only!)" @echo " TARGET=1 (hlsl - d3d11 / Windows only!)" @echo " TARGET=3 (essl - android)" @echo " TARGET=4 (glsl)" @@ -52,12 +52,7 @@ else ADDITIONAL_INCLUDES?= -ifeq ($(TARGET), 0) -VS_FLAGS=--platform windows -p s_3_0 -O 3 -FS_FLAGS=--platform windows -p s_3_0 -O 3 -SHADER_PATH=shaders/dx9 -else -ifeq ($(TARGET), 1) +ifeq ($(TARGET), $(filter $(TARGET), 0 1)) VS_FLAGS=--platform windows -p s_5_0 -O 3 FS_FLAGS=--platform windows -p s_5_0 -O 3 CS_FLAGS=--platform windows -p s_5_0 -O 1 @@ -98,7 +93,6 @@ endif endif endif endif -endif THISDIR := $(dir $(lastword $(MAKEFILE_LIST))) VS_FLAGS+=-i $(THISDIR)../src/ $(ADDITIONAL_INCLUDES) diff --git a/src/amalgamated.cpp b/src/amalgamated.cpp index a829512b633..eaf450340fe 100644 --- a/src/amalgamated.cpp +++ b/src/amalgamated.cpp @@ -13,7 +13,6 @@ #include "renderer_agc.cpp" #include "renderer_d3d11.cpp" #include "renderer_d3d12.cpp" -#include "renderer_d3d9.cpp" #include "renderer_gl.cpp" #include "renderer_gnm.cpp" #include "renderer_noop.cpp" @@ -21,7 +20,6 @@ #include "renderer_vk.cpp" #include "renderer_webgpu.cpp" #include "shader.cpp" -#include "shader_dx9bc.cpp" #include "shader_dxbc.cpp" #include "shader_spirv.cpp" #include "topology.cpp" diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 9b70b9dba98..3f3c88037bb 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -784,14 +784,12 @@ namespace bgfx uint32_t yy = 0; uint32_t xx = 0; - const float texelWidth = 1.0f/2048.0f; - const float texelWidthHalf = RendererType::Direct3D9 == g_caps.rendererType ? 0.0f : texelWidth*0.5f; - const float texelHeight = 1.0f/24.0f; - const float texelHeightHalf = RendererType::Direct3D9 == g_caps.rendererType ? texelHeight*0.5f : 0.0f; - const float utop = (_mem.m_small ? 0.0f : 8.0f)*texelHeight + texelHeightHalf; - const float ubottom = (_mem.m_small ? 8.0f : 24.0f)*texelHeight + texelHeightHalf; - const float fontHeight = (_mem.m_small ? 8.0f : 16.0f)*_blitter.m_scale; - const float fontWidth = 8.0f * _blitter.m_scale; + const float texelWidth = 1.0f/2048.0f; + const float texelHeight = 1.0f/24.0f; + const float utop = (_mem.m_small ? 0.0f : 8.0f)*texelHeight; + const float ubottom = (_mem.m_small ? 8.0f : 24.0f)*texelHeight; + const float fontHeight = (_mem.m_small ? 8.0f : 16.0f)*_blitter.m_scale; + const float fontWidth = 8.0f * _blitter.m_scale; _renderCtx->blitSetup(_blitter); @@ -830,10 +828,10 @@ namespace bgfx Vertex vert[4] = { - { (xx )*fontWidth, (yy )*fontHeight, 0.0f, fg, bg, (ch )*8.0f*texelWidth - texelWidthHalf, utop }, - { (xx+1)*fontWidth, (yy )*fontHeight, 0.0f, fg, bg, (ch+1)*8.0f*texelWidth - texelWidthHalf, utop }, - { (xx+1)*fontWidth, (yy+1)*fontHeight, 0.0f, fg, bg, (ch+1)*8.0f*texelWidth - texelWidthHalf, ubottom }, - { (xx )*fontWidth, (yy+1)*fontHeight, 0.0f, fg, bg, (ch )*8.0f*texelWidth - texelWidthHalf, ubottom }, + { (xx )*fontWidth, (yy )*fontHeight, 0.0f, fg, bg, (ch )*8.0f*texelWidth, utop }, + { (xx+1)*fontWidth, (yy )*fontHeight, 0.0f, fg, bg, (ch+1)*8.0f*texelWidth, utop }, + { (xx+1)*fontWidth, (yy+1)*fontHeight, 0.0f, fg, bg, (ch+1)*8.0f*texelWidth, ubottom }, + { (xx )*fontWidth, (yy+1)*fontHeight, 0.0f, fg, bg, (ch )*8.0f*texelWidth, ubottom }, }; bx::memCopy(vertex, vert, sizeof(vert) ); @@ -2618,7 +2616,6 @@ namespace bgfx BGFX_RENDERER_CONTEXT(noop); BGFX_RENDERER_CONTEXT(agc); - BGFX_RENDERER_CONTEXT(d3d9); BGFX_RENDERER_CONTEXT(d3d11); BGFX_RENDERER_CONTEXT(d3d12); BGFX_RENDERER_CONTEXT(gnm); @@ -2642,7 +2639,6 @@ namespace bgfx { { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NOOP_NAME, true }, // Noop { agc::rendererCreate, agc::rendererDestroy, BGFX_RENDERER_AGC_NAME, !!BGFX_CONFIG_RENDERER_AGC }, // GNM - { d3d9::rendererCreate, d3d9::rendererDestroy, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9 { d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11 { d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12 { gnm::rendererCreate, gnm::rendererDestroy, BGFX_RENDERER_GNM_NAME, !!BGFX_CONFIG_RENDERER_GNM }, // GNM @@ -2715,7 +2711,6 @@ namespace bgfx else if (windowsVersionIs(Condition::GreaterEqual, 0x0601) ) { score += RendererType::Direct3D11 == renderer ? 20 : 0; - score += RendererType::Direct3D9 == renderer ? 10 : 0; score += RendererType::Direct3D12 == renderer ? -100 : 0; } else @@ -2730,7 +2725,6 @@ namespace bgfx score += RendererType::OpenGLES == renderer ? 30 : 0; score += RendererType::Direct3D12 == renderer ? 20 : 0; score += RendererType::Direct3D11 == renderer ? 10 : 0; - score += RendererType::Direct3D9 == renderer ? 5 : 0; } else if (BX_ENABLED(BX_PLATFORM_OSX) ) { diff --git a/src/bgfx_p.h b/src/bgfx_p.h index a6ae7ed0988..d104f33b628 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -236,7 +236,6 @@ namespace stl = std; #define BGFX_RENDERER_NOOP_NAME "Noop" #define BGFX_RENDERER_AGC_NAME "AGC" -#define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9" #define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11" #define BGFX_RENDERER_DIRECT3D12_NAME "Direct3D 12" #define BGFX_RENDERER_GNM_NAME "GNM" diff --git a/src/config.h b/src/config.h index 36fb4ebad54..1014a06d2d3 100644 --- a/src/config.h +++ b/src/config.h @@ -20,7 +20,6 @@ #endif // BX_CONFIG_DEBUG #if !defined(BGFX_CONFIG_RENDERER_AGC) \ - && !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \ && !defined(BGFX_CONFIG_RENDERER_DIRECT3D11) \ && !defined(BGFX_CONFIG_RENDERER_DIRECT3D12) \ && !defined(BGFX_CONFIG_RENDERER_GNM) \ @@ -37,13 +36,6 @@ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_AGC -# ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 -# define BGFX_CONFIG_RENDERER_DIRECT3D9 (0 \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_WINDOWS \ - ? 1 : 0) -# endif // BGFX_CONFIG_RENDERER_DIRECT3D9 - # ifndef BGFX_CONFIG_RENDERER_DIRECT3D11 # define BGFX_CONFIG_RENDERER_DIRECT3D11 (0 \ || BX_PLATFORM_LINUX \ @@ -128,10 +120,6 @@ # define BGFX_CONFIG_RENDERER_AGC 0 # endif // BGFX_CONFIG_RENDERER_AGC -# ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 -# define BGFX_CONFIG_RENDERER_DIRECT3D9 0 -# endif // BGFX_CONFIG_RENDERER_DIRECT3D9 - # ifndef BGFX_CONFIG_RENDERER_DIRECT3D11 # define BGFX_CONFIG_RENDERER_DIRECT3D11 0 # endif // BGFX_CONFIG_RENDERER_DIRECT3D11 diff --git a/src/makefile b/src/makefile index d8380dc7fbb..c8e22b8c39e 100644 --- a/src/makefile +++ b/src/makefile @@ -28,12 +28,10 @@ define shader-embedded $(SILENT) $(SHADERC) --type $(1) --platform linux -p 120 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_glsl @cat "$(SHADER_TMP)" > $(@) -$(SILENT) $(SHADERC) --type $(1) --platform android -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_essl - -@cat "$(SHADER_TMP)" >> $(@) - -$(SILENT) $(SHADERC) --type $(1) --platform linux -p spirv -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_spv -@cat "$(SHADER_TMP)" >> $(@) - -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(2) -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_dx9 + -$(SILENT) $(SHADERC) --type $(1) --platform linux -p spirv -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_spv -@cat "$(SHADER_TMP)" >> $(@) - -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(3) -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_dx11 + -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(2) -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_dx11 -@cat "$(SHADER_TMP)" >> $(@) -$(SILENT) $(SHADERC) --type $(1) --platform ios -p metal -O 3 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_mtl -@cat "$(SHADER_TMP)" >> $(@) @@ -42,37 +40,37 @@ define shader-embedded endef vs_debugfont.bin.h : vs_debugfont.sc - $(call shader-embedded, v, vs_3_0, vs_4_0) + $(call shader-embedded, v, vs_4_0) fs_debugfont.bin.h : fs_debugfont.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) vs_clear.bin.h : vs_clear.sc - $(call shader-embedded, v, vs_3_0, vs_4_0) + $(call shader-embedded, v, vs_4_0) fs_clear0.bin.h : fs_clear0.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) fs_clear1.bin.h : fs_clear1.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) fs_clear2.bin.h : fs_clear2.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) fs_clear3.bin.h : fs_clear3.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) fs_clear4.bin.h : fs_clear4.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) fs_clear5.bin.h : fs_clear5.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) fs_clear6.bin.h : fs_clear6.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) fs_clear7.bin.h : fs_clear7.sc - $(call shader-embedded, f, ps_3_0, ps_4_0) + $(call shader-embedded, f, ps_4_0) .PHONY: clean clean: diff --git a/src/renderer_d3d.h b/src/renderer_d3d.h index ae54f56d798..8f843d9fa65 100644 --- a/src/renderer_d3d.h +++ b/src/renderer_d3d.h @@ -6,18 +6,8 @@ #ifndef BGFX_RENDERER_D3D_H_HEADER_GUARD #define BGFX_RENDERER_D3D_H_HEADER_GUARD -#if 0 // BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9 && !(BX_COMPILER_GCC || BX_COMPILER_CLANG) -# include -# include -# if BX_COMPILER_MSVC -# pragma comment(lib, "dxerr.lib") -# endif // BX_COMPILER_MSVC -# define DX_CHECK_EXTRA_F " (%s): %s" -# define DX_CHECK_EXTRA_ARGS , DXGetErrorString(__hr__), DXGetErrorDescription(__hr__) -#else -# define DX_CHECK_EXTRA_F "" -# define DX_CHECK_EXTRA_ARGS -#endif // BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9 +#define DX_CHECK_EXTRA_F "" +#define DX_CHECK_EXTRA_ARGS #ifndef DXGI_ERROR_NOT_CURRENTLY_AVAILABLE # define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE HRESULT(0x887A0022) diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp deleted file mode 100644 index 915406b623e..00000000000 --- a/src/renderer_d3d9.cpp +++ /dev/null @@ -1,4606 +0,0 @@ -/* - * Copyright 2011-2023 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE - */ - -#include "bgfx_p.h" - -#if BGFX_CONFIG_RENDERER_DIRECT3D9 -# include "renderer_d3d9.h" -# include - -namespace bgfx { namespace d3d9 -{ - static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; - static char s_viewName [BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; - - struct PrimInfo - { - D3DPRIMITIVETYPE m_type; - uint32_t m_min; - uint32_t m_div; - uint32_t m_sub; - }; - - static const PrimInfo s_primInfo[] = - { - { D3DPT_TRIANGLELIST, 3, 3, 0 }, - { D3DPT_TRIANGLESTRIP, 3, 1, 2 }, - { D3DPT_LINELIST, 2, 2, 0 }, - { D3DPT_LINESTRIP, 2, 1, 1 }, - { D3DPT_POINTLIST, 1, 1, 0 }, - { D3DPRIMITIVETYPE(0), 0, 0, 0 }, - }; - BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_primInfo)-1); - - static const D3DMULTISAMPLE_TYPE s_checkMsaa[] = - { - D3DMULTISAMPLE_NONE, - D3DMULTISAMPLE_2_SAMPLES, - D3DMULTISAMPLE_4_SAMPLES, - D3DMULTISAMPLE_8_SAMPLES, - D3DMULTISAMPLE_16_SAMPLES, - }; - - static Msaa s_msaa[] = - { - { D3DMULTISAMPLE_NONE, 0 }, - { D3DMULTISAMPLE_2_SAMPLES, 0 }, - { D3DMULTISAMPLE_4_SAMPLES, 0 }, - { D3DMULTISAMPLE_8_SAMPLES, 0 }, - { D3DMULTISAMPLE_16_SAMPLES, 0 }, - }; - - struct Blend - { - D3DBLEND m_src; - D3DBLEND m_dst; - bool m_factor; - }; - - static const Blend s_blendFactor[] = - { - { (D3DBLEND)0, (D3DBLEND)0, false }, // ignored - { D3DBLEND_ZERO, D3DBLEND_ZERO, false }, // ZERO - { D3DBLEND_ONE, D3DBLEND_ONE, false }, // ONE - { D3DBLEND_SRCCOLOR, D3DBLEND_SRCCOLOR, false }, // SRC_COLOR - { D3DBLEND_INVSRCCOLOR, D3DBLEND_INVSRCCOLOR, false }, // INV_SRC_COLOR - { D3DBLEND_SRCALPHA, D3DBLEND_SRCALPHA, false }, // SRC_ALPHA - { D3DBLEND_INVSRCALPHA, D3DBLEND_INVSRCALPHA, false }, // INV_SRC_ALPHA - { D3DBLEND_DESTALPHA, D3DBLEND_DESTALPHA, false }, // DST_ALPHA - { D3DBLEND_INVDESTALPHA, D3DBLEND_INVDESTALPHA, false }, // INV_DST_ALPHA - { D3DBLEND_DESTCOLOR, D3DBLEND_DESTCOLOR, false }, // DST_COLOR - { D3DBLEND_INVDESTCOLOR, D3DBLEND_INVDESTCOLOR, false }, // INV_DST_COLOR - { D3DBLEND_SRCALPHASAT, D3DBLEND_ONE, false }, // SRC_ALPHA_SAT - { D3DBLEND_BLENDFACTOR, D3DBLEND_BLENDFACTOR, true }, // FACTOR - { D3DBLEND_INVBLENDFACTOR, D3DBLEND_INVBLENDFACTOR, true }, // INV_FACTOR - }; - - static const D3DBLENDOP s_blendEquation[] = - { - D3DBLENDOP_ADD, - D3DBLENDOP_SUBTRACT, - D3DBLENDOP_REVSUBTRACT, - D3DBLENDOP_MIN, - D3DBLENDOP_MAX, - }; - - static const D3DCMPFUNC s_cmpFunc[] = - { - (D3DCMPFUNC)0, // ignored - D3DCMP_LESS, - D3DCMP_LESSEQUAL, - D3DCMP_EQUAL, - D3DCMP_GREATEREQUAL, - D3DCMP_GREATER, - D3DCMP_NOTEQUAL, - D3DCMP_NEVER, - D3DCMP_ALWAYS, - }; - - static const D3DSTENCILOP s_stencilOp[] = - { - D3DSTENCILOP_ZERO, - D3DSTENCILOP_KEEP, - D3DSTENCILOP_REPLACE, - D3DSTENCILOP_INCR, - D3DSTENCILOP_INCRSAT, - D3DSTENCILOP_DECR, - D3DSTENCILOP_DECRSAT, - D3DSTENCILOP_INVERT, - }; - - static const D3DRENDERSTATETYPE s_stencilFuncRs[] = - { - D3DRS_STENCILFUNC, - D3DRS_CCW_STENCILFUNC, - }; - - static const D3DRENDERSTATETYPE s_stencilFailRs[] = - { - D3DRS_STENCILFAIL, - D3DRS_CCW_STENCILFAIL, - }; - - static const D3DRENDERSTATETYPE s_stencilZFailRs[] = - { - D3DRS_STENCILZFAIL, - D3DRS_CCW_STENCILZFAIL, - }; - - static const D3DRENDERSTATETYPE s_stencilZPassRs[] = - { - D3DRS_STENCILPASS, - D3DRS_CCW_STENCILPASS, - }; - - static const D3DCULL s_cullMode[] = - { - D3DCULL_NONE, - D3DCULL_CW, - D3DCULL_CCW, - }; - - static const D3DTEXTUREADDRESS s_textureAddress[] = - { - D3DTADDRESS_WRAP, - D3DTADDRESS_MIRROR, - D3DTADDRESS_CLAMP, - D3DTADDRESS_BORDER, - }; - - static const D3DTEXTUREFILTERTYPE s_textureFilter[] = - { - D3DTEXF_LINEAR, - D3DTEXF_POINT, - D3DTEXF_ANISOTROPIC, - }; - - struct TextureFormatInfo - { - D3DFORMAT m_fmt; - }; - - static TextureFormatInfo s_textureFormat[] = - { - { D3DFMT_DXT1 }, // BC1 - { D3DFMT_DXT3 }, // BC2 - { D3DFMT_DXT5 }, // BC3 - { D3DFMT_UNKNOWN }, // BC4 - { D3DFMT_UNKNOWN }, // BC5 - { D3DFMT_UNKNOWN }, // BC6H - { D3DFMT_UNKNOWN }, // BC7 - { D3DFMT_UNKNOWN }, // ETC1 - { D3DFMT_UNKNOWN }, // ETC2 - { D3DFMT_UNKNOWN }, // ETC2A - { D3DFMT_UNKNOWN }, // ETC2A1 - { D3DFMT_UNKNOWN }, // PTC12 - { D3DFMT_UNKNOWN }, // PTC14 - { D3DFMT_UNKNOWN }, // PTC12A - { D3DFMT_UNKNOWN }, // PTC14A - { D3DFMT_UNKNOWN }, // PTC22 - { D3DFMT_UNKNOWN }, // PTC24 - { D3DFMT_UNKNOWN }, // ATC, - { D3DFMT_UNKNOWN }, // ATCE, - { D3DFMT_UNKNOWN }, // ATCI, - { D3DFMT_UNKNOWN }, // ASTC4x4 - { D3DFMT_UNKNOWN }, // ASTC5x4 - { D3DFMT_UNKNOWN }, // ASTC5x5 - { D3DFMT_UNKNOWN }, // ASTC6x5 - { D3DFMT_UNKNOWN }, // ASTC6x6 - { D3DFMT_UNKNOWN }, // ASTC8x5 - { D3DFMT_UNKNOWN }, // ASTC8x6 - { D3DFMT_UNKNOWN }, // ASTC8x8 - { D3DFMT_UNKNOWN }, // ASTC10x5 - { D3DFMT_UNKNOWN }, // ASTC10x6 - { D3DFMT_UNKNOWN }, // ASTC10x8 - { D3DFMT_UNKNOWN }, // ASTC10x10 - { D3DFMT_UNKNOWN }, // ASTC12x10 - { D3DFMT_UNKNOWN }, // ASTC12x12 - { D3DFMT_UNKNOWN }, // Unknown - { D3DFMT_A1 }, // R1 - { D3DFMT_A8 }, // A8 - { D3DFMT_L8 }, // R8 - { D3DFMT_UNKNOWN }, // R8I - { D3DFMT_UNKNOWN }, // R8U - { D3DFMT_UNKNOWN }, // R8S - { D3DFMT_L16 }, // R16 - { D3DFMT_UNKNOWN }, // R16I - { D3DFMT_UNKNOWN }, // R16U - { D3DFMT_R16F }, // R16F - { D3DFMT_UNKNOWN }, // R16S - { D3DFMT_UNKNOWN }, // R32I - { D3DFMT_UNKNOWN }, // R32U - { D3DFMT_R32F }, // R32F - { D3DFMT_A8L8 }, // RG8 - { D3DFMT_UNKNOWN }, // RG8I - { D3DFMT_UNKNOWN }, // RG8U - { D3DFMT_UNKNOWN }, // RG8S - { D3DFMT_G16R16 }, // RG16 - { D3DFMT_UNKNOWN }, // RG16I - { D3DFMT_UNKNOWN }, // RG16U - { D3DFMT_G16R16F }, // RG16F - { D3DFMT_UNKNOWN }, // RG16S - { D3DFMT_UNKNOWN }, // RG32I - { D3DFMT_UNKNOWN }, // RG32U - { D3DFMT_G32R32F }, // RG32F - { D3DFMT_UNKNOWN }, // RGB8 - { D3DFMT_UNKNOWN }, // RGB8I - { D3DFMT_UNKNOWN }, // RGB8U - { D3DFMT_UNKNOWN }, // RGB8S - { D3DFMT_UNKNOWN }, // RGB9E5F - { D3DFMT_A8R8G8B8 }, // BGRA8 - { D3DFMT_UNKNOWN }, // RGBA8 - { D3DFMT_UNKNOWN }, // RGBA8I - { D3DFMT_UNKNOWN }, // RGBA8U - { D3DFMT_UNKNOWN }, // RGBA8S - { D3DFMT_A16B16G16R16 }, // RGBA16 - { D3DFMT_UNKNOWN }, // RGBA16I - { D3DFMT_UNKNOWN }, // RGBA16U - { D3DFMT_A16B16G16R16F }, // RGBA16F - { D3DFMT_UNKNOWN }, // RGBA16S - { D3DFMT_UNKNOWN }, // RGBA32I - { D3DFMT_UNKNOWN }, // RGBA32U - { D3DFMT_A32B32G32R32F }, // RGBA32F - { D3DFMT_R5G6B5 }, // B5G6R5 - { D3DFMT_R5G6B5 }, // R5G6B5 - { D3DFMT_A4R4G4B4 }, // BGRA4 - { D3DFMT_A4R4G4B4 }, // RGBA4 - { D3DFMT_A1R5G5B5 }, // BGR5A1 - { D3DFMT_A1R5G5B5 }, // RGB5A1 - { D3DFMT_A2B10G10R10 }, // RGB10A2 - { D3DFMT_UNKNOWN }, // RG11B10F - { D3DFMT_UNKNOWN }, // UnknownDepth - { D3DFMT_D16 }, // D16 - { D3DFMT_D24X8 }, // D24 - { D3DFMT_D24S8 }, // D24S8 - { D3DFMT_D32 }, // D32 - { D3DFMT_DF16 }, // D16F - { D3DFMT_DF24 }, // D24F - { D3DFMT_D32F_LOCKABLE }, // D32F - { D3DFMT_S8_LOCKABLE }, // D0S8 - }; - BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) ); - - static ExtendedFormat s_extendedFormats[ExtendedFormat::Count] = - { - { D3DFMT_ATI1, 0, D3DRTYPE_TEXTURE, false }, - { D3DFMT_ATI2, 0, D3DRTYPE_TEXTURE, false }, - { D3DFMT_DF16, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false }, - { D3DFMT_DF24, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false }, - { D3DFMT_INST, 0, D3DRTYPE_SURFACE, false }, - { D3DFMT_INTZ, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false }, - { D3DFMT_NULL, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, false }, - { D3DFMT_RESZ, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, false }, - { D3DFMT_RAWZ, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false }, - { D3DFMT_ATOC, 0, D3DRTYPE_SURFACE, false }, - }; - - static const GUID IID_IDirect3D9 = { 0x81bdcbca, 0x64d4, 0x426d, { 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c } }; - static const GUID IID_IDirect3DDevice9Ex = { 0xb18b10ce, 0x2649, 0x405a, { 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a } }; - - typedef HRESULT (WINAPI *Direct3DCreate9ExFn)(UINT SDKVersion, IDirect3D9Ex**); - static Direct3DCreate9ExFn Direct3DCreate9Ex; - typedef IDirect3D9* (WINAPI *Direct3DCreate9Fn)(UINT SDKVersion); - static Direct3DCreate9Fn Direct3DCreate9; - static PFN_D3DPERF_SET_MARKER D3DPERF_SetMarker; - static PFN_D3DPERF_BEGIN_EVENT D3DPERF_BeginEvent; - static PFN_D3DPERF_END_EVENT D3DPERF_EndEvent; - - static const D3DVERTEXELEMENT9 s_attrib[] = - { - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 0 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 2 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 3 }, - { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 4 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 5 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 6 }, - { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 7 }, - D3DDECL_END() - }; - BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib)-1); - - static const uint8_t s_attribType[][4][2] = - { - { // Uint8 - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, - }, - { // Uint10 - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - { D3DDECLTYPE_UDEC3, D3DDECLTYPE_DEC3N }, - }, - { // Int16 - { D3DDECLTYPE_SHORT2, D3DDECLTYPE_SHORT2N }, - { D3DDECLTYPE_SHORT2, D3DDECLTYPE_SHORT2N }, - { D3DDECLTYPE_SHORT4, D3DDECLTYPE_SHORT4N }, - { D3DDECLTYPE_SHORT4, D3DDECLTYPE_SHORT4N }, - }, - { // Half - { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 }, - { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 }, - { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 }, - { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 }, - }, - { // Float - { D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT1 }, - { D3DDECLTYPE_FLOAT2, D3DDECLTYPE_FLOAT2 }, - { D3DDECLTYPE_FLOAT3, D3DDECLTYPE_FLOAT3 }, - { D3DDECLTYPE_FLOAT4, D3DDECLTYPE_FLOAT4 }, - }, - }; - BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - - static D3DVERTEXELEMENT9* fillVertexLayout(uint8_t _stream, D3DVERTEXELEMENT9* _out, const VertexLayout& _layout) - { - D3DVERTEXELEMENT9* elem = _out; - - for (uint32_t attr = 0; attr < Attrib::Count; ++attr) - { - if (UINT16_MAX != _layout.m_attributes[attr]) - { - uint8_t num; - AttribType::Enum type; - bool normalized; - bool asInt; - _layout.decode(Attrib::Enum(attr), num, type, normalized, asInt); - - bx::memCopy(elem, &s_attrib[attr], sizeof(D3DVERTEXELEMENT9) ); - - elem->Stream = _stream; - elem->Type = s_attribType[type][num-1][normalized]; - elem->Offset = _layout.m_offset[attr]; - ++elem; - } - } - - return elem; - } - - inline bool isLost(HRESULT _hr) - { - return false - || _hr == D3DERR_DEVICELOST - || _hr == D3DERR_DRIVERINTERNALERROR -#if !defined(D3D_DISABLE_9EX) - || _hr == D3DERR_DEVICEHUNG - || _hr == D3DERR_DEVICEREMOVED -#endif // !defined(D3D_DISABLE_9EX) - ; - } - - inline bool useD3D9Pitch(bimg::TextureFormat::Enum _format) - { - // Reference(s): - // - For BC4 and B5 in DX9 LockRect returns wrong number of - // bytes. If actual mip size is used it causes memory corruption. - // https://web.archive.org/web/20190207230133/http://www.aras-p.info/texts/D3D9GPUHacks.html - return true - && _format != bimg::TextureFormat::BC4 - && _format != bimg::TextureFormat::BC5 - ; - } - - static inline uint32_t calcRowPitch(const bimg::ImageBlockInfo& _blockInfo, uint8_t _lod, uint32_t _width) - { - const uint8_t blockWidth = _blockInfo.blockWidth; - const uint8_t blockHeight = _blockInfo.blockHeight; - const uint8_t minBlockX = _blockInfo.minBlockX; - const uint8_t bitsPerPixel = _blockInfo.bitsPerPixel; - - // Calculate the row pitch - const uint32_t minBlkWidth = minBlockX; - const uint32_t lodBlkWidth = (((_width >> _lod) + blockWidth - 1) / blockWidth); - const uint32_t rowBlkWidth = bx::max(minBlkWidth, lodBlkWidth); - const uint32_t pixBlkWidth = rowBlkWidth * blockWidth * blockHeight; - const uint32_t rowPitch = pixBlkWidth * bitsPerPixel / 8u; - - return rowPitch; - } - - struct RendererContextD3D9 : public RendererContextI - { - RendererContextD3D9() - : m_d3d9(NULL) - , m_device(NULL) - , m_flushQuery(NULL) - , m_swapChain(NULL) - , m_captureTexture(NULL) - , m_captureSurface(NULL) - , m_captureResolve(NULL) - , m_maxAnisotropy(1) - , m_initialized(false) - , m_amd(false) - , m_nvidia(false) - , m_atocSupport(false) - , m_instancingSupport(false) - , m_occlusionQuerySupport(false) - , m_timerQuerySupport(false) - , m_rtMsaa(false) - { - } - - ~RendererContextD3D9() - { - } - - bool init(const Init& _init) - { - struct ErrorState - { - enum Enum - { - Default, - LoadedD3D9, - CreatedD3D9, - CreatedDevice, - }; - }; - - ErrorState::Enum errorState = ErrorState::Default; - - m_fbh.idx = kInvalidHandle; - bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); - bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); - - D3DFORMAT adapterFormat = D3DFMT_X8R8G8B8; - - // Reference(s): - // - https://web.archive.org/web/20190207230309/https://docs.microsoft.com/en-us/windows/desktop/direct3d9/d3dpresent-parameters - bx::memSet(&m_params, 0, sizeof(m_params) ); - m_params.BackBufferWidth = _init.resolution.width; - m_params.BackBufferHeight = _init.resolution.height; - m_params.BackBufferFormat = adapterFormat; - m_params.BackBufferCount = bx::clamp(_init.resolution.numBackBuffers, 2, BGFX_CONFIG_MAX_BACK_BUFFERS); - m_params.MultiSampleType = D3DMULTISAMPLE_NONE; - m_params.MultiSampleQuality = 0; - m_params.EnableAutoDepthStencil = TRUE; - m_params.AutoDepthStencilFormat = D3DFMT_D24S8; - m_params.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL; - - m_params.FullScreen_RefreshRateInHz = 0; - m_params.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - m_params.SwapEffect = D3DSWAPEFFECT_DISCARD; - m_params.hDeviceWindow = NULL; - m_params.Windowed = true; - m_params.BackBufferWidth = _init.resolution.width; - m_params.BackBufferHeight = _init.resolution.height; - - const char* d3d9DllName = -#if BX_PLATFORM_LINUX - "d3d9.so" -#else - "d3d9.dll" -#endif // BX_PLATFORM_LINUX - ; - - m_d3d9Dll = bx::dlopen(d3d9DllName); - - if (NULL == m_d3d9Dll) - { - BX_TRACE("Init error: Failed to load %s.", d3d9DllName); - goto error; - } - - errorState = ErrorState::LoadedD3D9; - - m_nvapi.init(); - - if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) ) - { - D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9Dll, "D3DPERF_SetMarker"); - D3DPERF_BeginEvent = (PFN_D3DPERF_BEGIN_EVENT)bx::dlsym(m_d3d9Dll, "D3DPERF_BeginEvent"); - D3DPERF_EndEvent = (PFN_D3DPERF_END_EVENT )bx::dlsym(m_d3d9Dll, "D3DPERF_EndEvent"); - - if (NULL == D3DPERF_SetMarker - || NULL == D3DPERF_BeginEvent - || NULL == D3DPERF_EndEvent) - { - BX_TRACE("Failed to initialize PIX events."); - - D3DPERF_SetMarker = NULL; - D3DPERF_BeginEvent = NULL; - D3DPERF_EndEvent = NULL; - } - } - - m_d3d9ex = NULL; - m_deviceEx = NULL; - - Direct3DCreate9Ex = (Direct3DCreate9ExFn)bx::dlsym(m_d3d9Dll, "Direct3DCreate9Ex"); - if (BX_ENABLED(BGFX_CONFIG_RENDERER_DIRECT3D9EX) - && NULL != Direct3DCreate9Ex) - { - Direct3DCreate9Ex(D3D_SDK_VERSION, &m_d3d9ex); - if (NULL != m_d3d9ex) - { - HRESULT hr = m_d3d9ex->QueryInterface(IID_IDirect3D9, (void**)&m_d3d9); - if (FAILED(hr) ) - { - BX_TRACE("Failed to query D3D9 interface 0x%08x.", hr); - DX_RELEASE(m_d3d9ex, 0); - } - else - { - m_pool = D3DPOOL_DEFAULT; - } - } - } - - if (NULL == m_d3d9) - { - Direct3DCreate9 = (Direct3DCreate9Fn)bx::dlsym(m_d3d9Dll, "Direct3DCreate9"); - - if (NULL == Direct3DCreate9) - { - BX_TRACE("Init error: Function Direct3DCreate9 not found."); - goto error; - } - - m_d3d9 = Direct3DCreate9(D3D_SDK_VERSION); - m_pool = D3DPOOL_MANAGED; - } - - if (NULL == m_d3d9) - { - BX_TRACE("Init error: Unable to create Direct3D."); - goto error; - } - - errorState = ErrorState::CreatedD3D9; - - { - m_adapter = D3DADAPTER_DEFAULT; - m_deviceType = BGFX_PCI_ID_SOFTWARE_RASTERIZER == g_caps.vendorId - ? D3DDEVTYPE_REF - : D3DDEVTYPE_HAL - ; - - uint8_t numGPUs = uint8_t(bx::uint32_min(BX_COUNTOF(g_caps.gpu), m_d3d9->GetAdapterCount() ) ); - for (uint32_t ii = 0; ii < numGPUs; ++ii) - { - D3DADAPTER_IDENTIFIER9 desc; - HRESULT hr = m_d3d9->GetAdapterIdentifier(ii, 0, &desc); - if (SUCCEEDED(hr) ) - { - BX_TRACE("Adapter #%d", ii); - BX_TRACE("\tDriver: %s", desc.Driver); - BX_TRACE("\tDescription: %s", desc.Description); - BX_TRACE("\tDeviceName: %s", desc.DeviceName); - BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x" - , desc.VendorId - , desc.DeviceId - , desc.SubSysId - , desc.Revision - ); - - g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; - g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; - - if (D3DADAPTER_DEFAULT == m_adapter) - { - if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) - && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) - && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) - { - m_adapter = ii; - } - - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && !bx::strFind(desc.Description, "PerfHUD").isEmpty() ) - { - m_adapter = ii; - m_deviceType = D3DDEVTYPE_REF; - } - } - } - } - - DX_CHECK(m_d3d9->GetAdapterIdentifier(m_adapter, 0, &m_identifier) ); - m_amd = m_identifier.VendorId == BGFX_PCI_ID_AMD; - m_nvidia = m_identifier.VendorId == BGFX_PCI_ID_NVIDIA; - g_caps.vendorId = 0 == m_identifier.VendorId - ? BGFX_PCI_ID_SOFTWARE_RASTERIZER - : (uint16_t)m_identifier.VendorId - ; - g_caps.deviceId = (uint16_t)m_identifier.DeviceId; - - uint32_t behaviorFlags[] = - { - D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE | D3DCREATE_PUREDEVICE, - D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, - D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, - }; - - for (uint32_t ii = 0; ii < BX_COUNTOF(behaviorFlags) && NULL == m_device; ++ii) - { - if (NULL != m_d3d9ex) - { - DX_CHECK(m_d3d9ex->CreateDeviceEx(m_adapter - , m_deviceType - , (HWND)g_platformData.nwh - , behaviorFlags[ii] - , &m_params - , NULL - , &m_deviceEx - ) ); - - m_device = m_deviceEx; - } - else - { - DX_CHECK(m_d3d9->CreateDevice(m_adapter - , m_deviceType - , (HWND)g_platformData.nwh - , behaviorFlags[ii] - , &m_params - , &m_device - ) ); - } - } - } - - if (NULL == m_device) - { - BX_TRACE("Init error: Unable to create Direct3D9 device."); - goto error; - } - - errorState = ErrorState::CreatedDevice; - - m_numWindows = 1; - - if (NULL != m_d3d9ex) - { - DX_CHECK(m_device->QueryInterface(IID_IDirect3DDevice9Ex, (void**)&m_deviceEx) ); - } - - { - IDirect3DQuery9* timerQueryTest[3] = {}; - m_timerQuerySupport = true - && SUCCEEDED(m_device->CreateQuery(D3DQUERYTYPE_TIMESTAMPDISJOINT, &timerQueryTest[0]) ) - && SUCCEEDED(m_device->CreateQuery(D3DQUERYTYPE_TIMESTAMP, &timerQueryTest[1]) ) - && SUCCEEDED(m_device->CreateQuery(D3DQUERYTYPE_TIMESTAMPFREQ, &timerQueryTest[2]) ) - ; - DX_RELEASE(timerQueryTest[0], 0); - DX_RELEASE(timerQueryTest[1], 0); - DX_RELEASE(timerQueryTest[2], 0); - } - - { - IDirect3DQuery9* occlusionQueryTest; - m_occlusionQuerySupport = true - && SUCCEEDED(m_device->CreateQuery(D3DQUERYTYPE_OCCLUSION, &occlusionQueryTest) ) - ; - DX_RELEASE(occlusionQueryTest, 0); - } - - DX_CHECK(m_device->GetDeviceCaps(&m_caps) ); - - // For shit GPUs that can create DX9 device but can't do simple stuff. GTFO! - BX_WARN( (D3DPTEXTURECAPS_SQUAREONLY & m_caps.TextureCaps) == 0, "D3DPTEXTURECAPS_SQUAREONLY"); - BX_WARN( (D3DPTEXTURECAPS_MIPMAP & m_caps.TextureCaps) == D3DPTEXTURECAPS_MIPMAP, "D3DPTEXTURECAPS_MIPMAP"); - BX_WARN( (D3DPTEXTURECAPS_ALPHA & m_caps.TextureCaps) == D3DPTEXTURECAPS_ALPHA, "D3DPTEXTURECAPS_ALPHA"); - BX_WARN(m_caps.VertexShaderVersion >= D3DVS_VERSION(2, 0) && m_caps.PixelShaderVersion >= D3DPS_VERSION(2, 1) - , "Shader Model Version (vs: %x, ps: %x)." - , m_caps.VertexShaderVersion - , m_caps.PixelShaderVersion - ); - - if ( (D3DPTEXTURECAPS_SQUAREONLY & m_caps.TextureCaps) != 0 - || (D3DPTEXTURECAPS_MIPMAP & m_caps.TextureCaps) != D3DPTEXTURECAPS_MIPMAP - || (D3DPTEXTURECAPS_ALPHA & m_caps.TextureCaps) != D3DPTEXTURECAPS_ALPHA - || !(m_caps.VertexShaderVersion >= D3DVS_VERSION(2, 0) && m_caps.PixelShaderVersion >= D3DPS_VERSION(2, 1) ) ) - { - BX_TRACE("Init error: Min spec not satisfied."); - goto error; - } - - BX_TRACE("Max vertex shader 3.0 instr. slots: %d", m_caps.MaxVertexShader30InstructionSlots); - BX_TRACE("Max vertex shader constants: %d", m_caps.MaxVertexShaderConst); - BX_TRACE("Max fragment shader 2.0 instr. slots: %d", m_caps.PS20Caps.NumInstructionSlots); - BX_TRACE("Max fragment shader 3.0 instr. slots: %d", m_caps.MaxPixelShader30InstructionSlots); - BX_TRACE("Num simultaneous render targets: %d", m_caps.NumSimultaneousRTs); - BX_TRACE("Max vertex index: %d", m_caps.MaxVertexIndex); - BX_TRACE("Max streams: %d", m_caps.MaxStreams); - - g_caps.supported |= ( 0 - | BGFX_CAPS_TEXTURE_3D - | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL - | BGFX_CAPS_VERTEX_ATTRIB_HALF - | BGFX_CAPS_VERTEX_ATTRIB_UINT10 - | BGFX_CAPS_FRAGMENT_DEPTH - | BGFX_CAPS_SWAP_CHAIN - | ( (m_caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) ? BGFX_CAPS_TEXTURE_BLIT : 0) - | BGFX_CAPS_TEXTURE_READ_BACK - | (m_occlusionQuerySupport ? BGFX_CAPS_OCCLUSION_QUERY : 0) - | ((m_caps.MaxVertexIndex > UINT16_MAX) ? BGFX_CAPS_INDEX32 : 0) - ); - - m_caps.NumSimultaneousRTs = bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS); - m_caps.MaxStreams = bx::uint32_min(m_caps.MaxStreams, BGFX_CONFIG_MAX_VERTEX_STREAMS); - m_caps.MaxAnisotropy = bx::uint32_max(m_caps.MaxAnisotropy, 1); - - g_caps.limits.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) ); - g_caps.limits.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs); - g_caps.limits.maxVertexStreams = uint8_t(m_caps.MaxStreams); - - if (BX_ENABLED(BGFX_CONFIG_RENDERER_USE_EXTENSIONS) ) - { - BX_TRACE("Extended formats:"); - for (uint32_t ii = 0; ii < ExtendedFormat::Count; ++ii) - { - ExtendedFormat& fmt = s_extendedFormats[ii]; - fmt.m_supported = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, fmt.m_usage, fmt.m_type, fmt.m_fmt) ); - const char* fourcc = (const char*)&fmt.m_fmt; - BX_TRACE("\t%2d: %c%c%c%c %s", ii, fourcc[0], fourcc[1], fourcc[2], fourcc[3], fmt.m_supported ? "supported" : ""); - BX_UNUSED(fourcc); - } - - m_instancingSupport = false - || s_extendedFormats[ExtendedFormat::Inst].m_supported - || (m_caps.VertexShaderVersion >= D3DVS_VERSION(3, 0) ) - ; - - m_atocSupport = false - || s_extendedFormats[ExtendedFormat::Atoc].m_supported - ; - - if (m_amd - && s_extendedFormats[ExtendedFormat::Inst].m_supported) - { // AMD only - m_device->SetRenderState(D3DRS_POINTSIZE, D3DFMT_INST); - } - - if (s_extendedFormats[ExtendedFormat::Intz].m_supported) - { - s_textureFormat[TextureFormat::D24].m_fmt = D3DFMT_INTZ; - s_textureFormat[TextureFormat::D32].m_fmt = D3DFMT_INTZ; - } - - s_textureFormat[TextureFormat::BC4].m_fmt = s_extendedFormats[ExtendedFormat::Ati1].m_supported ? D3DFMT_ATI1 : D3DFMT_UNKNOWN; - s_textureFormat[TextureFormat::BC5].m_fmt = s_extendedFormats[ExtendedFormat::Ati2].m_supported ? D3DFMT_ATI2 : D3DFMT_UNKNOWN; - - g_caps.supported |= m_instancingSupport ? BGFX_CAPS_INSTANCING : 0; - g_caps.supported |= m_atocSupport ? BGFX_CAPS_ALPHA_TO_COVERAGE : 0; - } - - for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) - { - uint16_t support = BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , 0 - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_SRGBREAD - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , 0 - , D3DRTYPE_VOLUMETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_SRGBREAD - , D3DRTYPE_VOLUMETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , 0 - , D3DRTYPE_CUBETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_SRGBREAD - , D3DRTYPE_CUBETEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , D3DUSAGE_QUERY_VERTEXTEXTURE - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , bimg::isDepth(bimg::TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceMultiSampleType(m_adapter - , m_deviceType - , s_textureFormat[ii].m_fmt - , true - , D3DMULTISAMPLE_2_SAMPLES - , NULL - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - support |= SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter - , m_deviceType - , adapterFormat - , bimg::isDepth(bimg::TextureFormat::Enum(ii) ) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET - , D3DRTYPE_TEXTURE - , s_textureFormat[ii].m_fmt - ) ) ? BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN : BGFX_CAPS_FORMAT_TEXTURE_NONE; - - g_caps.formats[ii] = support; - } - - m_fmtDepth = D3DFMT_D24S8; - - { - IDirect3DSwapChain9* swapChain; - DX_CHECK(m_device->GetSwapChain(0, &swapChain) ); - - // GPA increases swapchain ref count. - // - // This causes assert in debug. When debugger is present refcount - // checks are off. - setGraphicsDebuggerPresent(1 != getRefCount(swapChain) ); - - DX_RELEASE(swapChain, 0); - } - - // Init reserved part of view name. - for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) - { - bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + 1, "%3d ", ii); - mbstowcs(s_viewNameW[ii], s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED); - } - - if (NULL != m_deviceEx) - { - int32_t gpuPriority; - DX_CHECK(m_deviceEx->GetGPUThreadPriority(&gpuPriority) ); - BX_TRACE("GPU thread priority: %d", gpuPriority); - - uint32_t maxLatency; - DX_CHECK(m_deviceEx->GetMaximumFrameLatency(&maxLatency) ); - BX_TRACE("GPU max frame latency: %d", maxLatency); - } - - postReset(); - - m_initialized = true; - - g_internalData.context = m_device; - return true; - - error: - switch (errorState) - { - case ErrorState::CreatedDevice: - if (NULL != m_d3d9ex) - { - DX_RELEASE(m_deviceEx, 1); - DX_RELEASE(m_device, 0); - } - else - { - DX_RELEASE(m_device, 0); - } - BX_FALLTHROUGH; - - case ErrorState::CreatedD3D9: - if (NULL != m_d3d9ex) - { - DX_RELEASE(m_d3d9, 1); - DX_RELEASE(m_d3d9ex, 0); - } - else - { - DX_RELEASE(m_d3d9, 0); - } - BX_FALLTHROUGH; - - case ErrorState::LoadedD3D9: - m_nvapi.shutdown(); - bx::dlclose(m_d3d9Dll); - BX_FALLTHROUGH; - - case ErrorState::Default: - break; - } - - return false; - } - - void shutdown() - { - preReset(); - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii) - { - m_indexBuffers[ii].destroy(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexBuffers); ++ii) - { - m_vertexBuffers[ii].destroy(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_shaders); ++ii) - { - m_shaders[ii].destroy(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii) - { - m_textures[ii].destroy(); - } - - if (NULL != m_d3d9ex) - { - DX_RELEASE(m_deviceEx, 1); - DX_RELEASE(m_device, 0); - DX_RELEASE(m_d3d9, 1); - DX_RELEASE(m_d3d9ex, 0); - } - else - { - DX_RELEASE(m_device, 0); - DX_RELEASE(m_d3d9, 0); - } - - m_nvapi.shutdown(); - bx::dlclose(m_d3d9Dll); - - m_initialized = false; - } - - RendererType::Enum getRendererType() const override - { - return RendererType::Direct3D9; - } - - const char* getRendererName() const override - { - if (NULL != m_d3d9ex) - { - return BGFX_RENDERER_DIRECT3D9_NAME " Ex"; - } - - return BGFX_RENDERER_DIRECT3D9_NAME; - } - - void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) override - { - m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); - } - - void destroyIndexBuffer(IndexBufferHandle _handle) override - { - m_indexBuffers[_handle.idx].destroy(); - } - - void createVertexLayout(VertexLayoutHandle _handle, const VertexLayout& _layout) override - { - VertexLayout& layout = m_vertexLayouts[_handle.idx]; - bx::memCopy(&layout, &_layout, sizeof(VertexLayout) ); - dump(layout); - } - - void destroyVertexLayout(VertexLayoutHandle /*_handle*/) override - { - } - - void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexLayoutHandle _layoutHandle, uint16_t /*_flags*/) override - { - m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _layoutHandle); - } - - void destroyVertexBuffer(VertexBufferHandle _handle) override - { - m_vertexBuffers[_handle.idx].destroy(); - } - - void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) override - { - m_indexBuffers[_handle.idx].create(_size, NULL, _flags); - } - - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override - { - m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); - } - - void destroyDynamicIndexBuffer(IndexBufferHandle _handle) override - { - m_indexBuffers[_handle.idx].destroy(); - } - - void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t /*_flags*/) override - { - VertexLayoutHandle layoutHandle = BGFX_INVALID_HANDLE; - m_vertexBuffers[_handle.idx].create(_size, NULL, layoutHandle); - } - - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override - { - m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); - } - - void destroyDynamicVertexBuffer(VertexBufferHandle _handle) override - { - m_vertexBuffers[_handle.idx].destroy(); - } - - void createShader(ShaderHandle _handle, const Memory* _mem) override - { - m_shaders[_handle.idx].create(_mem); - } - - void destroyShader(ShaderHandle _handle) override - { - m_shaders[_handle.idx].destroy(); - } - - void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override - { - m_program[_handle.idx].create(&m_shaders[_vsh.idx], isValid(_fsh) ? &m_shaders[_fsh.idx] : NULL); - } - - void destroyProgram(ProgramHandle _handle) override - { - m_program[_handle.idx].destroy(); - } - - void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override - { - m_textures[_handle.idx].create(_mem, _flags, _skip); - return NULL; - } - - void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) override - { - m_updateTexture = &m_textures[_handle.idx]; - m_updateTexture->updateBegin(_side, _mip); - } - - void updateTexture(TextureHandle /*_handle*/, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) override - { - m_updateTexture->update(_side, _mip, _rect, _z, _depth, _pitch, _mem); - } - - void updateTextureEnd() override - { - m_updateTexture->updateEnd(); - m_updateTexture = NULL; - } - - void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) override - { - TextureD3D9& texture = m_textures[_handle.idx]; - - D3DLOCKED_RECT lockedRect; - DX_CHECK(texture.m_texture2d->LockRect(_mip - , &lockedRect - , NULL - , D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY - ) ); - - uint32_t srcWidth = bx::uint32_max(1, texture.m_width >>_mip); - uint32_t srcHeight = bx::uint32_max(1, texture.m_height>>_mip); - uint32_t srcPitch = lockedRect.Pitch; - uint8_t* src = (uint8_t*)lockedRect.pBits; - - const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); - uint8_t* dst = (uint8_t*)_data; - uint32_t dstPitch = srcWidth*bpp/8; - - uint32_t pitch = bx::uint32_min(srcPitch, dstPitch); - - for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy) - { - bx::memCopy(dst, src, pitch); - - src += srcPitch; - dst += dstPitch; - } - - DX_CHECK(texture.m_texture2d->UnlockRect(_mip) ); - } - - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override - { - TextureD3D9& texture = m_textures[_handle.idx]; - - uint32_t size = sizeof(uint32_t) + sizeof(TextureCreate); - const Memory* mem = alloc(size); - - bx::StaticMemoryBlockWriter writer(mem->data, mem->size); - uint32_t magic = BGFX_CHUNK_MAGIC_TEX; - bx::write(&writer, magic, bx::ErrorAssert{}); - - TextureCreate tc; - tc.m_width = _width; - tc.m_height = _height; - tc.m_depth = 0; - tc.m_numLayers = _numLayers; - tc.m_numMips = _numMips; - tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); - tc.m_cubeMap = false; - tc.m_mem = NULL; - bx::write(&writer, tc, bx::ErrorAssert{}); - - texture.destroy(true); - texture.create(mem, texture.m_flags, 0); - - release(mem); - } - - void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override - { - // Resource ref. counts might be messed up outside of bgfx. - // Disabling ref. count check once texture is overridden. - setGraphicsDebuggerPresent(true); - m_textures[_handle.idx].overrideInternal(_ptr); - } - - uintptr_t getInternal(TextureHandle _handle) override - { - // Resource ref. counts might be messed up outside of bgfx. - // Disabling ref. count check once texture is overridden. - setGraphicsDebuggerPresent(true); - return uintptr_t(m_textures[_handle.idx].m_ptr); - } - - void destroyTexture(TextureHandle _handle) override - { - m_textures[_handle.idx].destroy(); - } - - void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) override - { - m_frameBuffers[_handle.idx].create(_num, _attachment); - } - - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) override - { - uint16_t denseIdx = m_numWindows++; - m_windows[denseIdx] = _handle; - m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _format, _depthFormat); - } - - void destroyFrameBuffer(FrameBufferHandle _handle) override - { - uint16_t denseIdx = m_frameBuffers[_handle.idx].destroy(); - if (UINT16_MAX != denseIdx) - { - --m_numWindows; - if (m_numWindows > 1) - { - FrameBufferHandle handle = m_windows[m_numWindows]; - m_windows[m_numWindows] = {kInvalidHandle}; - if (m_numWindows != denseIdx) - { - m_windows[denseIdx] = handle; - m_frameBuffers[handle.idx].m_denseIdx = denseIdx; - } - } - } - } - - void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) override - { - if (NULL != m_uniforms[_handle.idx]) - { - bx::free(g_allocator, m_uniforms[_handle.idx]); - } - - const uint32_t size = bx::alignUp(g_uniformTypeSize[_type]*_num, 16); - void* data = bx::alloc(g_allocator, size); - bx::memSet(data, 0, size); - m_uniforms[_handle.idx] = data; - m_uniformReg.add(_handle, _name); - } - - void destroyUniform(UniformHandle _handle) override - { - bx::free(g_allocator, m_uniforms[_handle.idx]); - m_uniforms[_handle.idx] = NULL; - m_uniformReg.remove(_handle); - } - - void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override - { -#if BX_PLATFORM_WINDOWS - IDirect3DSwapChain9* swapChain = isValid(_handle) - ? m_frameBuffers[_handle.idx].m_swapChain - : m_swapChain - ; - - if (NULL == swapChain) - { - BX_TRACE("Unable to capture screenshot %s.", _filePath); - return; - } - - D3DPRESENT_PARAMETERS params; - DX_CHECK(swapChain->GetPresentParameters(¶ms)); - - IDirect3DSurface9* surface; - D3DDEVICE_CREATION_PARAMETERS dcp; - DX_CHECK(m_device->GetCreationParameters(&dcp) ); - - D3DDISPLAYMODE dm; - DX_CHECK(m_d3d9->GetAdapterDisplayMode(dcp.AdapterOrdinal, &dm) ); - - DX_CHECK(m_device->CreateOffscreenPlainSurface(dm.Width - , dm.Height - , D3DFMT_A8R8G8B8 - , D3DPOOL_SCRATCH - , &surface - , NULL - ) ); - - HWND nwh = params.hDeviceWindow; - - SetWindowPos(nwh, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - - DX_CHECK(m_device->GetFrontBufferData(0, surface) ); - - SetWindowPos(nwh, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - - D3DLOCKED_RECT rect; - DX_CHECK(surface->LockRect(&rect - , NULL - , D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY - ) ); - - RECT rc; - GetClientRect(nwh, &rc); - POINT point; - point.x = rc.left; - point.y = rc.top; - ClientToScreen(nwh, &point); - uint8_t* data = (uint8_t*)rect.pBits; - uint32_t bytesPerPixel = rect.Pitch/dm.Width; - - g_callback->screenShot(_filePath - , params.BackBufferWidth - , params.BackBufferHeight - , rect.Pitch - , &data[point.y*rect.Pitch+point.x*bytesPerPixel] - , params.BackBufferHeight*rect.Pitch - , false - ); - - DX_CHECK(surface->UnlockRect() ); - DX_RELEASE(surface, 0); -#else - BX_TRACE("Screenshot not supported!"); - BX_UNUSED(_handle, _filePath); -#endif // BX_PLATFORM_WINDOWS - } - - void updateViewName(ViewId _id, const char* _name) override - { - if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) ) - { - mbstowcs(&s_viewNameW[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name - , BX_COUNTOF(s_viewNameW[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED - ); - } - - bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED - , _name - ); - } - - void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) override - { - bx::memCopy(m_uniforms[_loc], _data, _size); - } - - void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override - { - m_occlusionQuery.invalidate(_handle); - } - - void setMarker(const char* _marker, uint16_t _len) override - { - if (BX_ENABLED(BGFX_CONFIG_DEBUG_ANNOTATION) ) - { - uint32_t size = _len*sizeof(wchar_t); - wchar_t* name = (wchar_t*)alloca(size+2); - mbstowcs(name, _marker, size); - name[_len] = L'\0'; - PIX_SETMARKER(kColorMarker, name); - } - } - - virtual void setName(Handle _handle, const char* _name, uint16_t _len) override - { - BX_UNUSED(_handle, _name, _len) - } - - void submitBlit(BlitState& _bs, uint16_t _view); - - void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override; - - void blitSetup(TextVideoMemBlitter& _blitter) override - { - uint32_t width = m_params.BackBufferWidth; - uint32_t height = m_params.BackBufferHeight; - - FrameBufferHandle fbh = BGFX_INVALID_HANDLE; - setFrameBuffer(fbh, false, false); - - D3DVIEWPORT9 vp; - vp.X = 0; - vp.Y = 0; - vp.Width = width; - vp.Height = height; - vp.MinZ = 0.0f; - vp.MaxZ = 1.0f; - - IDirect3DDevice9* device = m_device; - DX_CHECK(device->SetViewport(&vp) ); - DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, FALSE) ); - DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, FALSE) ); - DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS) ); - DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) ); - DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); - DX_CHECK(device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) ); - DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE) ); - DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID) ); - - ProgramD3D9& program = m_program[_blitter.m_program.idx]; - DX_CHECK(device->SetVertexShader(program.m_vsh->m_vertexShader) ); - DX_CHECK(device->SetPixelShader(program.m_fsh->m_pixelShader) ); - - VertexBufferD3D9& vb = m_vertexBuffers[_blitter.m_vb->handle.idx]; - VertexLayout& layout = m_vertexLayouts[_blitter.m_vb->layoutHandle.idx]; - DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, layout.m_stride) ); - setInputLayout(layout, 0); - - IndexBufferD3D9& ib = m_indexBuffers[_blitter.m_ib->handle.idx]; - DX_CHECK(device->SetIndices(ib.m_ptr) ); - - float proj[16]; - bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f, 0.0f, false); - - PredefinedUniform& predefined = program.m_predefined[0]; - uint8_t flags = predefined.m_type; - setShaderUniform(flags, predefined.m_loc, proj, 4); - - m_textures[_blitter.m_texture.idx].commit(0, BGFX_SAMPLER_INTERNAL_DEFAULT, NULL); - } - - void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override - { - const uint32_t numVertices = _numIndices*4/6; - if (0 < numVertices) - { - m_indexBuffers[_blitter.m_ib->handle.idx].update(0, _numIndices * 2, _blitter.m_ib->data, true); - m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_layout.m_stride, _blitter.m_vb->data, true); - - DX_CHECK(m_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST - , 0 - , 0 - , numVertices - , 0 - , _numIndices / 3 - ) ); - } - } - - void updateMsaa() - { - for (uint32_t ii = 1, last = 0; ii < BX_COUNTOF(s_checkMsaa); ++ii) - { - D3DMULTISAMPLE_TYPE msaa = s_checkMsaa[ii]; - DWORD quality; - - HRESULT hr = m_d3d9->CheckDeviceMultiSampleType(m_adapter - , m_deviceType - , m_params.BackBufferFormat - , m_params.Windowed - , msaa - , &quality - ); - - if (SUCCEEDED(hr) ) - { - s_msaa[ii].m_type = msaa; - s_msaa[ii].m_quality = bx::uint32_imax(0, quality-1); - last = ii; - } - else - { - s_msaa[ii] = s_msaa[last]; - } - } - } - - void updateResolution(const Resolution& _resolution) - { - m_maxAnisotropy = !!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) - ? m_caps.MaxAnisotropy - : 1 - ; - const uint32_t maskFlags = ~(0 - | BGFX_RESET_MAXANISOTROPY - | BGFX_RESET_DEPTH_CLAMP - | BGFX_RESET_SUSPEND - ); - - if (m_resolution.width != _resolution.width - || m_resolution.height != _resolution.height - || (m_resolution.reset&maskFlags) != (_resolution.reset&maskFlags) ) - { - uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); - - m_resolution = _resolution; - m_resolution.reset = flags; - - m_textVideoMem.resize(false, _resolution.width, _resolution.height); - m_textVideoMem.clear(); - - D3DDEVICE_CREATION_PARAMETERS dcp; - DX_CHECK(m_device->GetCreationParameters(&dcp) ); - - D3DDISPLAYMODE dm; - DX_CHECK(m_d3d9->GetAdapterDisplayMode(dcp.AdapterOrdinal, &dm) ); - - m_params.BackBufferFormat = dm.Format; - - m_params.BackBufferWidth = _resolution.width; - m_params.BackBufferHeight = _resolution.height; - m_params.FullScreen_RefreshRateInHz = BGFX_RESET_FULLSCREEN == (m_resolution.reset&BGFX_RESET_FULLSCREEN_MASK) ? 60 : 0; - m_params.PresentationInterval = !!(m_resolution.reset&BGFX_RESET_VSYNC) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; - - updateMsaa(); - - Msaa& msaa = s_msaa[(m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; - m_params.MultiSampleType = msaa.m_type; - m_params.MultiSampleQuality = msaa.m_quality; - - preReset(); - DX_CHECK(m_device->Reset(&m_params) ); - postReset(); - } - } - - void setFrameBuffer(FrameBufferHandle _fbh, bool _msaa = true, bool _needPresent = true) - { - if (isValid(m_fbh) - && m_fbh.idx != _fbh.idx) - { - FrameBufferD3D9& frameBuffer = m_frameBuffers[m_fbh.idx]; - frameBuffer.resolve(); - } - - if (!isValid(_fbh) ) - { - m_needPresent |= _needPresent; - DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) ); - for (uint32_t ii = 1, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) - { - DX_CHECK(m_device->SetRenderTarget(ii, NULL) ); - } - DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) ); - - DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER) ) ); - } - else - { - m_frameBuffers[_fbh.idx].set(); - } - - m_fbh = _fbh; - m_rtMsaa = _msaa; - } - - void setShaderUniform(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs) - { - if (_flags&kUniformFragmentBit) - { - DX_CHECK(m_device->SetPixelShaderConstantF(_regIndex, (const float*)_val, _numRegs) ); - } - else - { - DX_CHECK(m_device->SetVertexShaderConstantF(_regIndex, (const float*)_val, _numRegs) ); - } - } - - void setShaderUniform4f(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs) - { - setShaderUniform(_flags, _regIndex, _val, _numRegs); - } - - void setShaderUniform4x4f(uint8_t _flags, uint32_t _regIndex, const void* _val, uint32_t _numRegs) - { - setShaderUniform(_flags, _regIndex, _val, _numRegs); - } - - void reset() - { - preReset(); - - HRESULT hr; - - do - { - hr = m_device->Reset(&m_params); - } while (FAILED(hr) ); - - postReset(); - } - - void flush() - { - m_flushQuery->Issue(D3DISSUE_END); - m_flushQuery->GetData(NULL, 0, D3DGETDATA_FLUSH); - } - - bool isDeviceRemoved() override - { - return false; - } - - void flip() override - { - if (NULL != m_swapChain) - { - for (uint32_t ii = 0, num = m_numWindows; ii < num; ++ii) - { - HRESULT hr = S_OK; - if (0 == ii) - { - if (m_needPresent) - { - hr = m_swapChain->Present(NULL, NULL, (HWND)g_platformData.nwh, NULL, 0); - m_needPresent = false; - } - else - { - flush(); - } - } - else - { - hr = m_frameBuffers[m_windows[ii].idx].present(); - } - - if (isLost(hr) ) - { - do - { - do - { - hr = m_device->TestCooperativeLevel(); - } - while (D3DERR_DEVICENOTRESET != hr); - - reset(); - hr = m_device->TestCooperativeLevel(); - } - while (FAILED(hr) ); - - break; - } - else if (FAILED(hr) ) - { - BX_TRACE("Present failed with err 0x%08x.", hr); - } - } - } - } - - void preReset() - { - m_needPresent = false; - - invalidateSamplerState(); - m_inputLayoutCache.invalidate(); - - for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) - { - DX_CHECK(m_device->SetTexture(stage, NULL) ); - } - - DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) ); - for (uint32_t ii = 1, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) - { - DX_CHECK(m_device->SetRenderTarget(ii, NULL) ); - } - DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) ); - DX_CHECK(m_device->SetVertexShader(NULL) ); - DX_CHECK(m_device->SetPixelShader(NULL) ); - DX_CHECK(m_device->SetStreamSource(0, NULL, 0, 0) ); - DX_CHECK(m_device->SetIndices(NULL) ); - - DX_RELEASE(m_backBufferColor, 0); - DX_RELEASE(m_backBufferDepthStencil, 0); - DX_RELEASE(m_swapChain, 0); - - capturePreReset(); - - DX_RELEASE(m_flushQuery, 0); - if (m_timerQuerySupport) - { - m_gpuTimer.preReset(); - } - - if (m_occlusionQuerySupport) - { - m_occlusionQuery.preReset(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii) - { - m_indexBuffers[ii].preReset(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexBuffers); ++ii) - { - m_vertexBuffers[ii].preReset(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) - { - m_frameBuffers[ii].preReset(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii) - { - m_textures[ii].preReset(); - } - } - - void postReset() - { - DX_CHECK(m_device->GetSwapChain(0, &m_swapChain) ); - DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_backBufferColor) ); - DX_CHECK(m_device->GetDepthStencilSurface(&m_backBufferDepthStencil) ); - - DX_CHECK(m_device->CreateQuery(D3DQUERYTYPE_EVENT, &m_flushQuery) ); - if (m_timerQuerySupport) - { - m_gpuTimer.postReset(); - } - - if (m_occlusionQuerySupport) - { - m_occlusionQuery.postReset(); - } - - capturePostReset(); - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii) - { - m_indexBuffers[ii].postReset(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexBuffers); ++ii) - { - m_vertexBuffers[ii].postReset(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii) - { - m_textures[ii].postReset(); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) - { - m_frameBuffers[ii].postReset(); - } - } - - void invalidateSamplerState() - { - for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) - { - m_samplerFlags[stage] = UINT32_MAX; - } - } - - static void setSamplerState(IDirect3DDevice9* _device, DWORD _stage, D3DSAMPLERSTATETYPE _type, DWORD _value) - { - DX_CHECK(_device->SetSamplerState(_stage, _type, _value) ); - if (4 > _stage) - { - DX_CHECK(_device->SetSamplerState(D3DVERTEXTEXTURESAMPLER0 + _stage, _type, _value) ); - } - } - - void setSamplerState(uint8_t _stage, uint64_t _flags, const float _rgba[4]) - { - const uint64_t flags = _flags&( (~BGFX_SAMPLER_RESERVED_MASK) | BGFX_SAMPLER_BITS_MASK | BGFX_TEXTURE_SRGB); - BX_ASSERT(_stage < BX_COUNTOF(m_samplerFlags), ""); - if (m_samplerFlags[_stage] != flags) - { - m_samplerFlags[_stage] = flags; - IDirect3DDevice9* device = m_device; - D3DTEXTUREADDRESS tau = s_textureAddress[(_flags&BGFX_SAMPLER_U_MASK)>>BGFX_SAMPLER_U_SHIFT]; - D3DTEXTUREADDRESS tav = s_textureAddress[(_flags&BGFX_SAMPLER_V_MASK)>>BGFX_SAMPLER_V_SHIFT]; - D3DTEXTUREADDRESS taw = s_textureAddress[(_flags&BGFX_SAMPLER_W_MASK)>>BGFX_SAMPLER_W_SHIFT]; - D3DTEXTUREFILTERTYPE minFilter = s_textureFilter[(_flags&BGFX_SAMPLER_MIN_MASK)>>BGFX_SAMPLER_MIN_SHIFT]; - D3DTEXTUREFILTERTYPE magFilter = s_textureFilter[(_flags&BGFX_SAMPLER_MAG_MASK)>>BGFX_SAMPLER_MAG_SHIFT]; - D3DTEXTUREFILTERTYPE mipFilter = s_textureFilter[(_flags&BGFX_SAMPLER_MIP_MASK)>>BGFX_SAMPLER_MIP_SHIFT]; - - setSamplerState(device, _stage, D3DSAMP_ADDRESSU, tau); - setSamplerState(device, _stage, D3DSAMP_ADDRESSV, tav); - setSamplerState(device, _stage, D3DSAMP_ADDRESSW, taw); - setSamplerState(device, _stage, D3DSAMP_MINFILTER, minFilter); - setSamplerState(device, _stage, D3DSAMP_MAGFILTER, magFilter); - setSamplerState(device, _stage, D3DSAMP_MIPFILTER, mipFilter); - setSamplerState(device, _stage, D3DSAMP_MAXANISOTROPY, m_maxAnisotropy); - setSamplerState(device, _stage, D3DSAMP_SRGBTEXTURE, 0 != (flags & BGFX_TEXTURE_SRGB) ); - if (NULL != _rgba) - { - if (needBorderColor(_flags) ) - { - DWORD bc = D3DCOLOR_COLORVALUE(_rgba[0], _rgba[1], _rgba[2], _rgba[3]); - setSamplerState(device - , _stage - , D3DSAMP_BORDERCOLOR - , bc - ); - } - } - } - } - - bool isVisible(Frame* _render, OcclusionQueryHandle _handle, bool _visible) - { - m_occlusionQuery.resolve(_render); - return _visible == (0 != _render->m_occlusion[_handle.idx]); - } - - void capturePreReset() - { - if (NULL != m_captureSurface) - { - g_callback->captureEnd(); - } - DX_RELEASE(m_captureSurface, 1); - DX_RELEASE(m_captureTexture, 0); - DX_RELEASE(m_captureResolve, 0); - } - - void capturePostReset() - { - if (m_resolution.reset&BGFX_RESET_CAPTURE) - { - uint32_t width = m_params.BackBufferWidth; - uint32_t height = m_params.BackBufferHeight; - D3DFORMAT fmt = m_params.BackBufferFormat; - - DX_CHECK(m_device->CreateTexture(width - , height - , 1 - , 0 - , fmt - , D3DPOOL_SYSTEMMEM - , &m_captureTexture - , NULL - ) ); - - DX_CHECK(m_captureTexture->GetSurfaceLevel(0 - , &m_captureSurface - ) ); - - if (m_params.MultiSampleType != D3DMULTISAMPLE_NONE) - { - DX_CHECK(m_device->CreateRenderTarget(width - , height - , fmt - , D3DMULTISAMPLE_NONE - , 0 - , false - , &m_captureResolve - , NULL - ) ); - } - - g_callback->captureBegin(width, height, width*4, TextureFormat::BGRA8, false); - } - } - - void capture() - { - if (NULL != m_captureSurface) - { - IDirect3DSurface9* resolve = m_backBufferColor; - - if (NULL != m_captureResolve) - { - resolve = m_captureResolve; - DX_CHECK(m_device->StretchRect(m_backBufferColor - , 0 - , m_captureResolve - , NULL - , D3DTEXF_NONE - ) ); - } - - HRESULT hr = m_device->GetRenderTargetData(resolve, m_captureSurface); - if (SUCCEEDED(hr) ) - { - D3DLOCKED_RECT rect; - DX_CHECK(m_captureSurface->LockRect(&rect - , NULL - , D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY - ) ); - - g_callback->captureFrame(rect.pBits, m_params.BackBufferHeight*rect.Pitch); - - DX_CHECK(m_captureSurface->UnlockRect() ); - } - } - } - - void commit(UniformBuffer& _uniformBuffer) - { - _uniformBuffer.reset(); - - IDirect3DDevice9* device = m_device; - - for (;;) - { - uint32_t opcode = _uniformBuffer.read(); - - if (UniformType::End == opcode) - { - break; - } - - UniformType::Enum type; - uint16_t loc; - uint16_t num; - uint16_t copy; - UniformBuffer::decodeOpcode(opcode, type, loc, num, copy); - - const char* data; - if (copy) - { - data = _uniformBuffer.read(g_uniformTypeSize[type]*num); - } - else - { - UniformHandle handle; - bx::memCopy(&handle, _uniformBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) ); - data = (const char*)m_uniforms[handle.idx]; - } - -#define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \ - case UniformType::_uniform: \ - { \ - _type* value = (_type*)data; \ - DX_CHECK(device->SetVertexShaderConstant##_dxsuffix(loc, value, num) ); \ - } \ - break; \ - \ - case UniformType::_uniform|kUniformFragmentBit: \ - { \ - _type* value = (_type*)data; \ - DX_CHECK(device->SetPixelShaderConstant##_dxsuffix(loc, value, num) ); \ - } \ - break - - switch ( (int32_t)type) - { - case UniformType::Mat3: - { - float* value = (float*)data; - for (uint32_t ii = 0, count = num/3; ii < count; ++ii, loc += 3, value += 9) - { - Matrix4 mtx; - mtx.un.val[ 0] = value[0]; - mtx.un.val[ 1] = value[1]; - mtx.un.val[ 2] = value[2]; - mtx.un.val[ 3] = 0.0f; - mtx.un.val[ 4] = value[3]; - mtx.un.val[ 5] = value[4]; - mtx.un.val[ 6] = value[5]; - mtx.un.val[ 7] = 0.0f; - mtx.un.val[ 8] = value[6]; - mtx.un.val[ 9] = value[7]; - mtx.un.val[10] = value[8]; - mtx.un.val[11] = 0.0f; - DX_CHECK(device->SetVertexShaderConstantF(loc, &mtx.un.val[0], 3) ); - } - } - break; - - case UniformType::Mat3|kUniformFragmentBit: - { - float* value = (float*)data; - for (uint32_t ii = 0, count = num/3; ii < count; ++ii, loc += 3, value += 9) - { - Matrix4 mtx; - mtx.un.val[ 0] = value[0]; - mtx.un.val[ 1] = value[1]; - mtx.un.val[ 2] = value[2]; - mtx.un.val[ 3] = 0.0f; - mtx.un.val[ 4] = value[3]; - mtx.un.val[ 5] = value[4]; - mtx.un.val[ 6] = value[5]; - mtx.un.val[ 7] = 0.0f; - mtx.un.val[ 8] = value[6]; - mtx.un.val[ 9] = value[7]; - mtx.un.val[10] = value[8]; - mtx.un.val[11] = 0.0f; - DX_CHECK(device->SetPixelShaderConstantF(loc, &mtx.un.val[0], 3) ); - } - } - break; - - CASE_IMPLEMENT_UNIFORM(Sampler, I, int); - CASE_IMPLEMENT_UNIFORM(Vec4, F, float); - CASE_IMPLEMENT_UNIFORM(Mat4, F, float); - - case UniformType::End: - break; - - default: - BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _uniformBuffer.getPos(), opcode, type, loc, num, copy); - break; - } -#undef CASE_IMPLEMENT_UNIFORM - } - } - - void clearQuad(ClearQuad& _clearQuad, const Rect& _rect, const Clear& _clear, const float _palette[][4]) - { - IDirect3DDevice9* device = m_device; - - uint32_t numMrt = 1; - FrameBufferHandle fbh = m_fbh; - if (isValid(fbh) ) - { - const FrameBufferD3D9& fb = m_frameBuffers[fbh.idx]; - numMrt = bx::uint32_max(1, fb.m_num); - } - - if (1 == numMrt) - { - D3DCOLOR color = 0; - DWORD flags = 0; - - if (BGFX_CLEAR_COLOR & _clear.m_flags) - { - if (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags) - { - uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE-1, _clear.m_index[0]); - const float* rgba = _palette[index]; - const float rr = rgba[0]; - const float gg = rgba[1]; - const float bb = rgba[2]; - const float aa = rgba[3]; - color = D3DCOLOR_COLORVALUE(rr, gg, bb, aa); - } - else - { - color = D3DCOLOR_RGBA(_clear.m_index[0], _clear.m_index[1], _clear.m_index[2], _clear.m_index[3]); - } - - flags |= D3DCLEAR_TARGET; - DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE - , D3DCOLORWRITEENABLE_RED - | D3DCOLORWRITEENABLE_GREEN - | D3DCOLORWRITEENABLE_BLUE - | D3DCOLORWRITEENABLE_ALPHA - ) ); - } - - if (BGFX_CLEAR_DEPTH & _clear.m_flags) - { - flags |= D3DCLEAR_ZBUFFER; - DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) ); - } - - if (BGFX_CLEAR_STENCIL & _clear.m_flags) - { - flags |= D3DCLEAR_STENCIL; - } - - if (0 != flags) - { - RECT rc; - rc.left = _rect.m_x; - rc.top = _rect.m_y; - rc.right = _rect.m_x + _rect.m_width; - rc.bottom = _rect.m_y + _rect.m_height; - DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE) ); - DX_CHECK(device->SetScissorRect(&rc) ); - DX_CHECK(device->Clear(0, NULL, flags, color, _clear.m_depth, _clear.m_stencil) ); - DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE) ); - } - } - else - { - DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE) ); - DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) ); - DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); - - if (BGFX_CLEAR_COLOR & _clear.m_flags) - { - DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE - , D3DCOLORWRITEENABLE_RED - | D3DCOLORWRITEENABLE_GREEN - | D3DCOLORWRITEENABLE_BLUE - | D3DCOLORWRITEENABLE_ALPHA - ) ); - } - else - { - DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, 0) ); - } - - if (BGFX_CLEAR_DEPTH & _clear.m_flags) - { - DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) ); - DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, TRUE) ); - DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS) ); - } - else - { - DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE) ); - DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, FALSE) ); - } - - if (BGFX_CLEAR_STENCIL & _clear.m_flags) - { - DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, TRUE) ); - DX_CHECK(device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, TRUE) ); - DX_CHECK(device->SetRenderState(D3DRS_STENCILREF, _clear.m_stencil) ); - DX_CHECK(device->SetRenderState(D3DRS_STENCILMASK, 0xff) ); - DX_CHECK(device->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS) ); - DX_CHECK(device->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE) ); - DX_CHECK(device->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_REPLACE) ); - DX_CHECK(device->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE) ); - } - else - { - DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, FALSE) ); - } - - VertexBufferD3D9& vb = m_vertexBuffers[_clearQuad.m_vb.idx]; - VertexLayout& layout = _clearQuad.m_layout; - uint32_t stride = _clearQuad.m_layout.m_stride; - - ProgramD3D9& program = m_program[_clearQuad.m_program[numMrt-1].idx]; - device->SetVertexShader(program.m_vsh->m_vertexShader); - device->SetPixelShader(program.m_fsh->m_pixelShader); - - float mrtClearDepth[4] = { _clear.m_depth }; - DX_CHECK(device->SetVertexShaderConstantF(0, mrtClearDepth, 1)); - - float mrtClearColor[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS][4]; - - if (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags) - { - for (uint32_t ii = 0; ii < numMrt; ++ii) - { - uint8_t index = (uint8_t)bx::uint32_min(BGFX_CONFIG_MAX_COLOR_PALETTE - 1, _clear.m_index[ii]); - bx::memCopy(mrtClearColor[ii], _palette[index], 16); - } - } - else - { - float rgba[4] = - { - _clear.m_index[0] * 1.0f / 255.0f, - _clear.m_index[1] * 1.0f / 255.0f, - _clear.m_index[2] * 1.0f / 255.0f, - _clear.m_index[3] * 1.0f / 255.0f, - }; - - for (uint32_t ii = 0; ii < numMrt; ++ii) - { - bx::memCopy(mrtClearColor[ii], rgba, 16); - } - } - - DX_CHECK(device->SetPixelShaderConstantF(0, mrtClearColor[0], numMrt)); - - DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, stride) ); - DX_CHECK(device->SetStreamSourceFreq(0, 1) ); - DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); - setInputLayout(layout, 0); - DX_CHECK(device->SetIndices(NULL) ); - DX_CHECK(device->DrawPrimitive(D3DPT_TRIANGLESTRIP - , 0 - , 2 - ) ); - } - } - - void setInputLayout(uint8_t _numStreams, const VertexLayout** _layouts, uint16_t _numInstanceData) - { - bx::HashMurmur2A murmur; - murmur.begin(); - murmur.add(_numInstanceData); - for (uint8_t stream = 0; stream < _numStreams; ++stream) - { - murmur.add(_layouts[stream]->m_hash); - } - uint64_t layoutHash = murmur.end(); - - IDirect3DVertexDeclaration9* layout = m_inputLayoutCache.find(layoutHash); - if (NULL == layout) - { - D3DVERTEXELEMENT9 vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; - D3DVERTEXELEMENT9* elem = vertexElements; - - for (uint8_t stream = 0; stream < _numStreams; ++stream) - { - elem = fillVertexLayout(stream, elem, *_layouts[stream]); - } - - const D3DVERTEXELEMENT9 inst = { _numStreams, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }; - - for (uint8_t ii = 0; ii < _numInstanceData; ++ii) - { - bx::memCopy(elem, &inst, sizeof(D3DVERTEXELEMENT9) ); - elem->UsageIndex = uint8_t(7-ii); // TEXCOORD7 = i_data0, TEXCOORD6 = i_data1, etc. - elem->Offset = ii*16; - ++elem; - } - - bx::memCopy(elem, &s_attrib[Attrib::Count], sizeof(D3DVERTEXELEMENT9) ); - - DX_CHECK(m_device->CreateVertexDeclaration(vertexElements, &layout) ); - - m_inputLayoutCache.add(layoutHash, layout); - } - - DX_CHECK(m_device->SetVertexDeclaration(layout) ); - } - - void setInputLayout(const VertexLayout& _layout, uint16_t _numInstanceData) - { - const VertexLayout* layouts[1] = { &_layout }; - setInputLayout(BX_COUNTOF(layouts), layouts, _numInstanceData); - } - - D3DCAPS9 m_caps; - - IDirect3D9Ex* m_d3d9ex; - IDirect3DDevice9Ex* m_deviceEx; - - IDirect3D9* m_d3d9; - IDirect3DDevice9* m_device; - IDirect3DQuery9* m_flushQuery; - TimerQueryD3D9 m_gpuTimer; - OcclusionQueryD3D9 m_occlusionQuery; - D3DPOOL m_pool; - - IDirect3DSwapChain9* m_swapChain; - - bool m_needPresent; - uint16_t m_numWindows; - FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS]; - - IDirect3DSurface9* m_backBufferColor; - IDirect3DSurface9* m_backBufferDepthStencil; - - IDirect3DTexture9* m_captureTexture; - IDirect3DSurface9* m_captureSurface; - IDirect3DSurface9* m_captureResolve; - - IDirect3DVertexDeclaration9* m_instanceDataDecls[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; - - void* m_d3d9Dll; - NvApi m_nvapi; - uint32_t m_adapter; - D3DDEVTYPE m_deviceType; - D3DPRESENT_PARAMETERS m_params; - uint32_t m_maxAnisotropy; - D3DADAPTER_IDENTIFIER9 m_identifier; - Resolution m_resolution; - - bool m_initialized; - bool m_amd; - bool m_nvidia; - bool m_atocSupport; - bool m_instancingSupport; - bool m_occlusionQuerySupport; - bool m_timerQuerySupport; - - D3DFORMAT m_fmtDepth; - - IndexBufferD3D9 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS]; - VertexBufferD3D9 m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; - ShaderD3D9 m_shaders[BGFX_CONFIG_MAX_SHADERS]; - ProgramD3D9 m_program[BGFX_CONFIG_MAX_PROGRAMS]; - TextureD3D9 m_textures[BGFX_CONFIG_MAX_TEXTURES]; - VertexLayout m_vertexLayouts[BGFX_CONFIG_MAX_VERTEX_LAYOUTS]; - FrameBufferD3D9 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; - UniformRegistry m_uniformReg; - void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; - - uint64_t m_samplerFlags[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; - - TextureD3D9* m_updateTexture; - uint8_t* m_updateTextureBits; - uint32_t m_updateTexturePitch; - uint8_t m_updateTextureSide; - uint8_t m_updateTextureMip; - - StateCacheT m_inputLayoutCache; - - TextVideoMem m_textVideoMem; - - FrameBufferHandle m_fbh; - bool m_rtMsaa; - }; - - static RendererContextD3D9* s_renderD3D9; - - RendererContextI* rendererCreate(const Init& _init) - { - s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9); - if (!s_renderD3D9->init(_init) ) - { - bx::deleteObject(g_allocator, s_renderD3D9); - s_renderD3D9 = NULL; - } - return s_renderD3D9; - } - - void rendererDestroy() - { - s_renderD3D9->shutdown(); - bx::deleteObject(g_allocator, s_renderD3D9); - s_renderD3D9 = NULL; - } - - void IndexBufferD3D9::create(uint32_t _size, void* _data, uint16_t _flags) - { - m_size = _size; - m_flags = _flags; - - uint32_t usage = D3DUSAGE_WRITEONLY; - D3DPOOL pool = s_renderD3D9->m_pool; - - if (NULL == _data) - { - usage |= D3DUSAGE_DYNAMIC; - pool = D3DPOOL_DEFAULT; - m_dynamic = (uint8_t*)bx::alloc(g_allocator, _size); - } - - const D3DFORMAT format = 0 == (_flags & BGFX_BUFFER_INDEX32) - ? D3DFMT_INDEX16 - : D3DFMT_INDEX32 - ; - - DX_CHECK(s_renderD3D9->m_device->CreateIndexBuffer(m_size - , usage - , format - , pool - , &m_ptr - , NULL - ) ); - - if (NULL != _data) - { - update(0, _size, _data); - } - } - - void IndexBufferD3D9::preReset() - { - if (NULL != m_dynamic) - { - DX_RELEASE(m_ptr, 0); - } - } - - void IndexBufferD3D9::postReset() - { - if (NULL != m_dynamic) - { - const D3DFORMAT format = 0 == (m_flags & BGFX_BUFFER_INDEX32) - ? D3DFMT_INDEX16 - : D3DFMT_INDEX32 - ; - - DX_CHECK(s_renderD3D9->m_device->CreateIndexBuffer(m_size - , D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC - , format - , D3DPOOL_DEFAULT - , &m_ptr - , NULL - ) ); - - update(0, m_size, m_dynamic); - } - } - - void VertexBufferD3D9::create(uint32_t _size, void* _data, VertexLayoutHandle _layoutHandle) - { - m_size = _size; - m_layoutHandle = _layoutHandle; - - uint32_t usage = D3DUSAGE_WRITEONLY; - D3DPOOL pool = s_renderD3D9->m_pool; - - if (NULL == _data) - { - usage |= D3DUSAGE_DYNAMIC; - pool = D3DPOOL_DEFAULT; - m_dynamic = (uint8_t*)bx::alloc(g_allocator, _size); - } - - DX_CHECK(s_renderD3D9->m_device->CreateVertexBuffer(m_size - , usage - , 0 - , pool - , &m_ptr - , NULL - ) ); - - if (NULL != _data) - { - update(0, _size, _data); - } - } - - void VertexBufferD3D9::preReset() - { - if (NULL != m_dynamic) - { - DX_RELEASE(m_ptr, 0); - } - } - - void VertexBufferD3D9::postReset() - { - if (NULL != m_dynamic) - { - DX_CHECK(s_renderD3D9->m_device->CreateVertexBuffer(m_size - , D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC - , 0 - , D3DPOOL_DEFAULT - , &m_ptr - , NULL - ) ); - - update(0, m_size, m_dynamic); - } - } - - void ShaderD3D9::create(const Memory* _mem) - { - bx::MemoryReader reader(_mem->data, _mem->size); - - bx::ErrorAssert err; - - uint32_t magic; - bx::read(&reader, magic, &err); - - const bool fragment = isShaderType(magic, 'F'); - - uint32_t hashIn; - bx::read(&reader, hashIn, &err); - - uint32_t hashOut; - - if (isShaderVerLess(magic, 6) ) - { - hashOut = hashIn; - } - else - { - bx::read(&reader, hashOut, &err); - } - - uint16_t count; - bx::read(&reader, count, &err); - - m_numPredefined = 0; - - BX_TRACE("Shader consts %d", count); - - uint8_t fragmentBit = fragment ? kUniformFragmentBit : 0; - - if (0 < count) - { - for (uint32_t ii = 0; ii < count; ++ii) - { - uint8_t nameSize = 0; - bx::read(&reader, nameSize, &err); - - char name[256] = {}; - bx::read(&reader, &name, nameSize, &err); - name[nameSize] = '\0'; - - uint8_t type = 0; - bx::read(&reader, type, &err); - - uint8_t num = 0; - bx::read(&reader, num, &err); - - uint16_t regIndex = 0; - bx::read(&reader, regIndex, &err); - - uint16_t regCount = 0; - bx::read(&reader, regCount, &err); - - if (!isShaderVerLess(magic, 8) ) - { - uint16_t texInfo = 0; - bx::read(&reader, texInfo, &err); - } - - if (!isShaderVerLess(magic, 10) ) - { - uint16_t texFormat = 0; - bx::read(&reader, texFormat, &err); - } - - const char* kind = "invalid"; - - PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name); - if (PredefinedUniform::Count != predefined) - { - kind = "predefined"; - m_predefined[m_numPredefined].m_loc = regIndex; - m_predefined[m_numPredefined].m_count = regCount; - m_predefined[m_numPredefined].m_type = uint8_t(predefined|fragmentBit); - m_numPredefined++; - } - else if (0 == (kUniformSamplerBit & type) ) - { - const UniformRegInfo* info = s_renderD3D9->m_uniformReg.find(name); - BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); - - if (NULL != info) - { - if (NULL == m_constantBuffer) - { - m_constantBuffer = UniformBuffer::create(1024); - } - - kind = "user"; - m_constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), regIndex, info->m_handle, regCount); - } - } - else - { - kind = "sampler"; - } - - BX_TRACE("\t%s: %s (%s), num %2d, r.index %3d, r.count %2d" - , kind - , name - , getUniformTypeName(UniformType::Enum(type&~kUniformMask) ) - , num - , regIndex - , regCount - ); - BX_UNUSED(kind); - } - - if (NULL != m_constantBuffer) - { - m_constantBuffer->finish(); - } - } - - uint32_t shaderSize; - bx::read(&reader, shaderSize, &err); - - const DWORD* code = (const DWORD*)reader.getDataPtr(); - - if (fragment) - { - m_type = 1; - DX_CHECK(s_renderD3D9->m_device->CreatePixelShader(code, &m_pixelShader) ); - BGFX_FATAL(NULL != m_pixelShader, bgfx::Fatal::InvalidShader, "Failed to create fragment shader."); - } - else - { - m_type = 0; - DX_CHECK(s_renderD3D9->m_device->CreateVertexShader(code, &m_vertexShader) ); - BGFX_FATAL(NULL != m_vertexShader, bgfx::Fatal::InvalidShader, "Failed to create vertex shader."); - } - } - - void TextureD3D9::createTexture(uint32_t _width, uint32_t _height, uint8_t _numMips) - { - m_type = Texture2D; - const bimg::TextureFormat::Enum fmt = (bimg::TextureFormat::Enum)m_textureFormat; - - DWORD usage = 0; - D3DPOOL pool = D3DPOOL_DEFAULT; - - const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); - const bool blit = 0 != (m_flags&BGFX_TEXTURE_BLIT_DST); - const bool readBack = 0 != (m_flags&BGFX_TEXTURE_READ_BACK); - if (bimg::isDepth(fmt) ) - { - usage = D3DUSAGE_DEPTHSTENCIL; - } - else if (readBack) - { - usage = 0; - pool = D3DPOOL_SYSTEMMEM; - } - else if (renderTarget || blit) - { - usage = 0 - | D3DUSAGE_RENDERTARGET - | (1 < _numMips ? D3DUSAGE_AUTOGENMIPMAP : 0) - ; - } - - IDirect3DDevice9* device = s_renderD3D9->m_device; - - if (renderTarget) - { - uint32_t msaaQuality = ( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT); - msaaQuality = bx::uint32_satsub(msaaQuality, 1); - - bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); - - if (0 != msaaQuality - || writeOnly) - { - const Msaa& msaa = s_msaa[msaaQuality]; - - if (bimg::isDepth(fmt) ) - { - DX_CHECK(device->CreateDepthStencilSurface( - m_width - , m_height - , s_textureFormat[m_textureFormat].m_fmt - , msaa.m_type - , msaa.m_quality - , FALSE - , &m_surface - , NULL - ) ); - } - else - { - DX_CHECK(device->CreateRenderTarget( - m_width - , m_height - , s_textureFormat[m_textureFormat].m_fmt - , msaa.m_type - , msaa.m_quality - , FALSE - , &m_surface - , NULL - ) ); - } - - if (writeOnly) - { - // This is render buffer, there is no sampling, no need - // to create texture. - return; - } - } - } - - DX_CHECK(device->CreateTexture(_width - , _height - , _numMips - , usage - , s_textureFormat[fmt].m_fmt - , pool - , &m_texture2d - , NULL - ) ); - - if (!renderTarget - && !readBack) - { - if (NULL == m_staging) - { - DX_CHECK(device->CreateTexture(_width - , _height - , _numMips - , 0 - , s_textureFormat[fmt].m_fmt - , D3DPOOL_SYSTEMMEM - , &m_staging2d - , NULL - ) ); - } - else - { - DX_CHECK(m_staging2d->AddDirtyRect(NULL)); - DX_CHECK(device->UpdateTexture(m_staging2d, m_texture2d)); - } - } - - BGFX_FATAL(NULL != m_texture2d, Fatal::UnableToCreateTexture, "Failed to create texture (size: %dx%d, mips: %d, fmt: %d)." - , _width - , _height - , _numMips - , bimg::getName(fmt) - ); - } - - void TextureD3D9::createVolumeTexture(uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips) - { - m_type = Texture3D; - const TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat; - - IDirect3DDevice9* device = s_renderD3D9->m_device; - DX_CHECK(device->CreateVolumeTexture(_width - , _height - , _depth - , _numMips - , 0 - , s_textureFormat[fmt].m_fmt - , D3DPOOL_DEFAULT - , &m_texture3d - , NULL - ) ); - - if (NULL == m_staging) - { - DX_CHECK(device->CreateVolumeTexture(_width - , _height - , _depth - , _numMips - , 0 - , s_textureFormat[fmt].m_fmt - , D3DPOOL_SYSTEMMEM - , &m_staging3d - , NULL - ) ); - } - else - { - DX_CHECK(m_staging3d->AddDirtyBox(NULL) ); - DX_CHECK(device->UpdateTexture(m_staging3d, m_texture3d) ); - } - - BGFX_FATAL(NULL != m_texture3d, Fatal::UnableToCreateTexture, "Failed to create volume texture (size: %dx%dx%d, mips: %d, fmt: %s)." - , _width - , _height - , _depth - , _numMips - , getName(fmt) - ); - } - - void TextureD3D9::createCubeTexture(uint32_t _width, uint8_t _numMips) - { - m_type = TextureCube; - const bimg::TextureFormat::Enum fmt = (bimg::TextureFormat::Enum)m_textureFormat; - - DWORD usage = 0; - - const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); - const bool blit = 0 != (m_flags&BGFX_TEXTURE_BLIT_DST); - if (bimg::isDepth(fmt) ) - { - usage = D3DUSAGE_DEPTHSTENCIL; - } - else if (renderTarget || blit) - { - usage = D3DUSAGE_RENDERTARGET; - } - - IDirect3DDevice9* device = s_renderD3D9->m_device; - DX_CHECK(device->CreateCubeTexture(_width - , _numMips - , usage - , s_textureFormat[fmt].m_fmt - , D3DPOOL_DEFAULT - , &m_textureCube - , NULL - ) ); - - if (!renderTarget) - { - if (NULL == m_staging) - { - DX_CHECK(device->CreateCubeTexture(_width - , _numMips - , 0 - , s_textureFormat[fmt].m_fmt - , D3DPOOL_SYSTEMMEM - , &m_stagingCube - , NULL - ) ); - } - else - { - for (uint8_t ii = 0; ii < 6; ++ii) - { - DX_CHECK(m_stagingCube->AddDirtyRect(D3DCUBEMAP_FACES(ii), NULL) ); - } - DX_CHECK(device->UpdateTexture(m_stagingCube, m_textureCube) ); - } - } - - BGFX_FATAL(NULL != m_textureCube, Fatal::UnableToCreateTexture, "Failed to create cube texture (edge: %d, mips: %d, fmt: %s)." - , _width - , _numMips - , getName(fmt) - ); - } - - uint8_t* TextureD3D9::lock(uint8_t _side, uint8_t _lod, uint32_t& _pitch, uint32_t& _slicePitch, const Rect* _rect) - { - switch (m_type) - { - case Texture2D: - { - D3DLOCKED_RECT lockedRect; - - if (NULL != _rect) - { - RECT rect; - rect.left = _rect->m_x; - rect.top = _rect->m_y; - rect.right = rect.left + _rect->m_width; - rect.bottom = rect.top + _rect->m_height; - DX_CHECK(m_staging2d->LockRect(_lod, &lockedRect, &rect, 0) ); - DX_CHECK(m_staging2d->AddDirtyRect(&rect) ); - } - else - { - DX_CHECK(m_staging2d->LockRect(_lod, &lockedRect, NULL, 0) ); - DX_CHECK(m_staging2d->AddDirtyRect(NULL) ); - } - - _pitch = lockedRect.Pitch; - _slicePitch = 0; - return (uint8_t*)lockedRect.pBits; - } - - case Texture3D: - { - D3DLOCKED_BOX box; - DX_CHECK(m_staging3d->LockBox(_lod, &box, NULL, 0) ); - DX_CHECK(m_staging3d->AddDirtyBox(NULL) ); - _pitch = box.RowPitch; - _slicePitch = box.SlicePitch; - return (uint8_t*)box.pBits; - } - - case TextureCube: - { - D3DLOCKED_RECT lockedRect; - - if (NULL != _rect) - { - RECT rect; - rect.left = _rect->m_x; - rect.top = _rect->m_y; - rect.right = rect.left + _rect->m_width; - rect.bottom = rect.top + _rect->m_height; - DX_CHECK(m_stagingCube->LockRect(D3DCUBEMAP_FACES(_side), _lod, &lockedRect, &rect, 0) ); - DX_CHECK(m_textureCube->AddDirtyRect(D3DCUBEMAP_FACES(_side), &rect) ); - } - else - { - DX_CHECK(m_stagingCube->LockRect(D3DCUBEMAP_FACES(_side), _lod, &lockedRect, NULL, 0) ); - DX_CHECK(m_textureCube->AddDirtyRect(D3DCUBEMAP_FACES(_side), NULL) ); - } - - _pitch = lockedRect.Pitch; - _slicePitch = 0; - return (uint8_t*)lockedRect.pBits; - } - } - - BX_ASSERT(false, "You should not be here."); - _pitch = 0; - _slicePitch = 0; - return NULL; - } - - void TextureD3D9::unlock(uint8_t _side, uint8_t _lod) - { - IDirect3DDevice9* device = s_renderD3D9->m_device; - - switch (m_type) - { - case Texture2D: - { - DX_CHECK(m_staging2d->UnlockRect(_lod) ); - DX_CHECK(device->UpdateTexture(m_staging2d, m_texture2d) ); - } - return; - - case Texture3D: - { - DX_CHECK(m_staging3d->UnlockBox(_lod) ); - DX_CHECK(device->UpdateTexture(m_staging3d, m_texture3d) ); - } - return; - - case TextureCube: - { - DX_CHECK(m_stagingCube->UnlockRect(D3DCUBEMAP_FACES(_side), _lod) ); - DX_CHECK(device->UpdateTexture(m_stagingCube, m_textureCube) ); - } - return; - } - - BX_ASSERT(false, "You should not be here."); - } - - void TextureD3D9::dirty(uint8_t _side, const Rect& _rect, uint16_t _z, uint16_t _depth) - { - switch (m_type) - { - case Texture2D: - { - RECT rect; - rect.left = _rect.m_x; - rect.top = _rect.m_y; - rect.right = rect.left + _rect.m_width; - rect.bottom = rect.top + _rect.m_height; - DX_CHECK(m_texture2d->AddDirtyRect(&rect) ); - } - return; - - case Texture3D: - { - D3DBOX box; - box.Left = _rect.m_x; - box.Top = _rect.m_y; - box.Right = box.Left + _rect.m_width; - box.Bottom = box.Top + _rect.m_height; - box.Front = _z; - box.Back = box.Front + _depth; - DX_CHECK(m_texture3d->AddDirtyBox(&box) ); - } - return; - - case TextureCube: - { - RECT rect; - rect.left = _rect.m_x; - rect.top = _rect.m_y; - rect.right = rect.left + _rect.m_width; - rect.bottom = rect.top + _rect.m_height; - DX_CHECK(m_textureCube->AddDirtyRect(D3DCUBEMAP_FACES(_side), &rect) ); - } - return; - } - - BX_ASSERT(false, "You should not be here."); - } - - IDirect3DSurface9* TextureD3D9::getSurface(uint8_t _side, uint8_t _mip) const - { - IDirect3DSurface9* surface = NULL; - - switch (m_type) - { - case Texture2D: - DX_CHECK(m_texture2d->GetSurfaceLevel(_mip, &surface) ); - break; - - case Texture3D: - BX_ASSERT(false, ""); - break; - - case TextureCube: - DX_CHECK(m_textureCube->GetCubeMapSurface(D3DCUBEMAP_FACES(_side), _mip, &surface) ); - break; - } - - return surface; - } - - void TextureD3D9::create(const Memory* _mem, uint64_t _flags, uint8_t _skip) - { - bimg::ImageContainer imageContainer; - - if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) - { - const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(bimg::TextureFormat::Enum(imageContainer.m_format) ); - - const uint8_t startLod = bx::min(_skip, imageContainer.m_numMips-1); - - bimg::TextureInfo ti; - bimg::imageGetSize( - &ti - , uint16_t(imageContainer.m_width >>startLod) - , uint16_t(imageContainer.m_height>>startLod) - , uint16_t(imageContainer.m_depth >>startLod) - , imageContainer.m_cubeMap - , 1 < imageContainer.m_numMips - , imageContainer.m_numLayers - , imageContainer.m_format - ); - ti.numMips = bx::min(imageContainer.m_numMips-startLod, ti.numMips); - - m_flags = _flags; - m_width = ti.width; - m_height = ti.height; - m_depth = ti.depth; - m_numMips = ti.numMips; - m_requestedFormat = uint8_t(imageContainer.m_format); - m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); - const bool convert = m_textureFormat != m_requestedFormat; - - uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); - - if (imageContainer.m_cubeMap) - { - createCubeTexture(ti.width, ti.numMips); - } - else if (imageContainer.m_depth > 1) - { - createVolumeTexture(ti.width, ti.height, ti.depth, ti.numMips); - } - else - { - createTexture(ti.width, ti.height, ti.numMips); - } - - BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s." - , this - s_renderD3D9->m_textures - , getName( (TextureFormat::Enum)m_textureFormat) - , getName( (TextureFormat::Enum)m_requestedFormat) - , ti.width - , ti.height - , imageContainer.m_cubeMap ? "x6" : "" - , 0 != (m_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : "" - ); - - if (0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY) ) - { - return; - } - - const bool useMipSize = useD3D9Pitch(imageContainer.m_format); - for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side) - { - uint32_t width = ti.width; - uint32_t height = ti.height; - uint32_t depth = ti.depth; - uint32_t mipWidth = ti.width; - uint32_t mipHeight = ti.height; - - for (uint8_t lod = 0, num = ti.numMips; lod < num; ++lod) - { - width = bx::max(1, width); - height = bx::max(1, height); - depth = bx::max(1, depth); - mipWidth = bx::max(blockInfo.blockWidth, mipWidth); - mipHeight = bx::max(blockInfo.blockHeight, mipHeight); - uint32_t mipSize = width*height*depth*bpp/8; - - bimg::ImageMip mip; - if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) - { - uint32_t pitch; - uint32_t slicePitch; - uint8_t* bits = lock(side, lod, pitch, slicePitch); - - if (convert) - { - if (width != mipWidth - || height != mipHeight) - { - uint32_t srcpitch = mipWidth*bpp/8; - - uint8_t* temp = (uint8_t*)bx::alloc(g_allocator, srcpitch*mipHeight); - bimg::imageDecodeToBgra8( - g_allocator - , temp - , mip.m_data - , mip.m_width - , mip.m_height - , srcpitch - , mip.m_format - ); - - bx::memCopy(bits, pitch, temp, srcpitch, pitch, height); - - bx::free(g_allocator, temp); - } - else - { - bimg::imageDecodeToBgra8(g_allocator, bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format); - } - } - else - { - uint32_t size = useMipSize ? mip.m_size : mipSize; - switch (m_textureFormat) - { - case TextureFormat::R5G6B5: - bimg::imageConvert(bits, 16, bx::packB5G6R5, mip.m_data, bx::unpackR5G6B5, size); - break; - - case TextureFormat::RGBA4: - bimg::imageConvert(bits, 16, bx::packBgra4, mip.m_data, bx::unpackRgba4, size); - break; - - case TextureFormat::RGB5A1: - bimg::imageConvert(bits, 16, bx::packBgr5a1, mip.m_data, bx::unpackRgb5a1, size); - break; - - default: - bx::memCopy(bits, mip.m_data, size); - break; - } - } - - unlock(side, lod); - } - - width >>= 1; - height >>= 1; - depth >>= 1; - mipWidth >>= 1; - mipHeight >>= 1; - } - } - } - } - - void TextureD3D9::updateBegin(uint8_t _side, uint8_t _mip) - { - uint32_t slicePitch; - s_renderD3D9->m_updateTextureSide = _side; - s_renderD3D9->m_updateTextureMip = _mip; - s_renderD3D9->m_updateTextureBits = lock(_side, _mip, s_renderD3D9->m_updateTexturePitch, slicePitch); - } - - void TextureD3D9::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) - { - const bimg::ImageBlockInfo & blockInfo = bimg::getBlockInfo(bimg::TextureFormat::Enum(m_textureFormat) ); - const uint16_t blockHeight = blockInfo.blockHeight; - const uint16_t bpp = blockInfo.bitsPerPixel; - const bool useLockedPitch = useD3D9Pitch(bimg::TextureFormat::Enum(m_textureFormat) ); - const uint32_t rectpitch = calcRowPitch(blockInfo, 0, _rect.m_width); - const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch; - const uint32_t dstpitch = (useLockedPitch) ? s_renderD3D9->m_updateTexturePitch : calcRowPitch(blockInfo, _mip, m_width); - uint8_t* bits = s_renderD3D9->m_updateTextureBits + _rect.m_y*dstpitch/blockHeight + _rect.m_x*blockHeight*bpp/8; - - const bool convert = m_textureFormat != m_requestedFormat; - - uint8_t* data = _mem->data; - uint8_t* temp = NULL; - - if (convert) - { - temp = (uint8_t*)bx::alloc(g_allocator, rectpitch*_rect.m_height); - bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); - data = temp; - } - - { - uint8_t* src = data; - uint8_t* dst = bits; - for (uint32_t yy = 0, height = _rect.m_height; yy < height; yy += blockHeight) - { - switch (m_textureFormat) - { - case TextureFormat::R5G6B5: - bimg::imageConvert(dst, 16, bx::packB5G6R5, src, bx::unpackR5G6B5, rectpitch); - break; - - case TextureFormat::RGBA4: - bimg::imageConvert(dst, 16, bx::packBgra4, src, bx::unpackRgba4, rectpitch); - break; - - case TextureFormat::RGB5A1: - bimg::imageConvert(dst, 16, bx::packBgr5a1, src, bx::unpackRgb5a1, rectpitch); - break; - - default: - bx::memCopy(dst, src, rectpitch); - break; - } - src += srcpitch; - dst += dstpitch; - } - } - - if (NULL != temp) - { - bx::free(g_allocator, temp); - } - - if (0 == _mip) - { - dirty(_side, _rect, _z, _depth); - } - } - - void TextureD3D9::updateEnd() - { - unlock(s_renderD3D9->m_updateTextureSide, s_renderD3D9->m_updateTextureMip); - } - - void TextureD3D9::commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]) - { - const uint64_t flags = (m_flags & BGFX_TEXTURE_SRGB) - | (0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ? _flags : uint32_t(m_flags) ) - ; - uint32_t index = (flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; - s_renderD3D9->setSamplerState(_stage, flags, _palette[index]); - - IDirect3DDevice9* device = s_renderD3D9->m_device; - DX_CHECK(device->SetTexture(_stage, m_ptr) ); - if (4 > _stage) - { - DX_CHECK(device->SetTexture(D3DVERTEXTEXTURESAMPLER0 + _stage, m_ptr) ); - } - } - - void TextureD3D9::resolve(uint8_t _resolve) const - { - if (NULL != m_surface - && NULL != m_ptr) - { - IDirect3DSurface9* surface = getSurface(); - DX_CHECK(s_renderD3D9->m_device->StretchRect(m_surface - , NULL - , surface - , NULL - , D3DTEXF_LINEAR - ) ); - DX_RELEASE(surface, 1); - - if (1 < m_numMips - && 0 != (_resolve & BGFX_RESOLVE_AUTO_GEN_MIPS) ) - { - m_ptr->GenerateMipSubLevels(); - } - } - } - - void TextureD3D9::preReset() - { - TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat; - if (TextureFormat::Unknown != fmt) - { - DX_RELEASE(m_ptr, 0); - DX_RELEASE(m_surface, 0); - } - } - - void TextureD3D9::postReset() - { - TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat; - if (TextureFormat::Unknown != fmt) - { - switch (m_type) - { - default: - case Texture2D: - createTexture(m_width, m_height, m_numMips); - break; - - case Texture3D: - createVolumeTexture(m_width, m_height, m_depth, m_numMips); - break; - - case TextureCube: - createCubeTexture(m_width, m_numMips); - break; - } - } - } - - void FrameBufferD3D9::create(uint8_t _num, const Attachment* _attachment) - { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_surface); ++ii) - { - m_surface[ii] = NULL; - } - - m_denseIdx = UINT16_MAX; - m_dsIdx = UINT8_MAX; - m_num = 0; - m_numTh = _num; - m_needResolve = false; - bx::memCopy(m_attachment, _attachment, _num*sizeof(Attachment) ); - - for (uint32_t ii = 0; ii < _num; ++ii) - { - const Attachment& at = m_attachment[ii]; - - if (isValid(at.handle) ) - { - const TextureD3D9& texture = s_renderD3D9->m_textures[at.handle.idx]; - - if (NULL != texture.m_surface) - { - m_surface[ii] = texture.m_surface; - m_surface[ii]->AddRef(); - } - else - { - m_surface[ii] = texture.getSurface(uint8_t(at.layer), uint8_t(at.mip) ); - } - - if (0 == m_num) - { - m_width = texture.m_width; - m_height = texture.m_height; - } - - if (bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) ) - { - m_dsIdx = uint8_t(ii); - } - else - { - ++m_num; - } - - m_needResolve |= true - && (NULL != texture.m_surface) - && (NULL != texture.m_texture2d) - ; - } - } - - if (0 == m_num) - { - createNullColorRT(); - } - } - - void FrameBufferD3D9::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) - { - BX_UNUSED(_depthFormat); - - m_hwnd = (HWND)_nwh; - - m_width = bx::uint32_max(_width, 16); - m_height = bx::uint32_max(_height, 16); - - D3DPRESENT_PARAMETERS params; - bx::memCopy(¶ms, &s_renderD3D9->m_params, sizeof(D3DPRESENT_PARAMETERS) ); - params.BackBufferFormat = TextureFormat::Count == _format ? params.BackBufferFormat : s_textureFormat[_format].m_fmt; - params.BackBufferWidth = m_width; - params.BackBufferHeight = m_height; - params.MultiSampleType = s_msaa[0].m_type; - params.MultiSampleQuality = s_msaa[0].m_quality; - - DX_CHECK(s_renderD3D9->m_device->CreateAdditionalSwapChain(¶ms, &m_swapChain) ); - DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_surface[0]) ); - - DX_CHECK(s_renderD3D9->m_device->CreateDepthStencilSurface( - params.BackBufferWidth - , params.BackBufferHeight - , params.AutoDepthStencilFormat - , params.MultiSampleType - , params.MultiSampleQuality - , FALSE - , &m_surface[1] - , NULL - ) ); - - m_dsIdx = 1; - m_denseIdx = _denseIdx; - m_num = 1; - m_needResolve = false; - m_needPresent = false; - } - - uint16_t FrameBufferD3D9::destroy() - { - if (NULL != m_hwnd) - { - DX_RELEASE(m_surface[0], 0); - DX_RELEASE(m_surface[1], 0); - DX_RELEASE(m_swapChain, 0); - } - else - { - uint32_t num = m_numTh; - num += uint32_t(0 < m_numTh && 0 == m_num); - - for (uint32_t ii = 0; ii < num; ++ii) - { - IDirect3DSurface9* ptr = m_surface[ii]; - if (NULL != ptr) - { - ptr->Release(); - m_surface[ii] = NULL; - } - } - } - - m_hwnd = NULL; - m_num = 0; - m_numTh = 0; - m_needPresent = false; - - uint16_t denseIdx = m_denseIdx; - m_denseIdx = UINT16_MAX; - - return denseIdx; - } - - HRESULT FrameBufferD3D9::present() - { - if (m_needPresent) - { - HRESULT hr = m_swapChain->Present(NULL, NULL, m_hwnd, NULL, 0); - m_needPresent = false; - return hr; - } - - return S_OK; - } - - void FrameBufferD3D9::resolve() const - { - if (m_needResolve) - { - for (uint32_t ii = 0, num = m_numTh; ii < num; ++ii) - { - const Attachment& at = m_attachment[ii]; - - if (isValid(at.handle) ) - { - const TextureD3D9& texture = s_renderD3D9->m_textures[at.handle.idx]; - texture.resolve(at.resolve); - } - } - } - } - - void FrameBufferD3D9::preReset() - { - if (NULL != m_hwnd) - { - DX_RELEASE(m_surface[0], 0); - DX_RELEASE(m_surface[1], 0); - DX_RELEASE(m_swapChain, 0); - } - else - { - uint32_t num = m_numTh; - num += uint32_t(0 < m_numTh && 0 == m_num); - - for (uint32_t ii = 0; ii < num; ++ii) - { - m_surface[ii]->Release(); - m_surface[ii] = NULL; - } - } - } - - void FrameBufferD3D9::postReset() - { - if (NULL != m_hwnd) - { - D3DPRESENT_PARAMETERS params; - bx::memCopy(¶ms, &s_renderD3D9->m_params, sizeof(D3DPRESENT_PARAMETERS) ); - params.BackBufferWidth = m_width; - params.BackBufferHeight = m_height; - - DX_CHECK(s_renderD3D9->m_device->CreateAdditionalSwapChain(¶ms, &m_swapChain) ); - DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_surface[0]) ); - DX_CHECK(s_renderD3D9->m_device->CreateDepthStencilSurface(params.BackBufferWidth - , params.BackBufferHeight - , params.AutoDepthStencilFormat - , params.MultiSampleType - , params.MultiSampleQuality - , FALSE - , &m_surface[1] - , NULL - ) ); - } - else if (0 < m_numTh) - { - for (uint32_t ii = 0, num = m_numTh; ii < num; ++ii) - { - const Attachment& at = m_attachment[ii]; - - if (isValid(at.handle) ) - { - TextureD3D9& texture = s_renderD3D9->m_textures[at.handle.idx]; - - if (NULL != texture.m_surface) - { - m_surface[ii] = texture.m_surface; - m_surface[ii]->AddRef(); - } - else if (Access::Write == at.access) - { - m_surface[ii] = texture.getSurface(uint8_t(at.layer), uint8_t(at.mip) ); - } - else - { - BX_ASSERT(false, ""); - } - } - } - - if (0 == m_num) - { - createNullColorRT(); - } - } - } - - void FrameBufferD3D9::createNullColorRT() - { - DX_CHECK(s_renderD3D9->m_device->CreateRenderTarget( - m_width - , m_height - , D3DFMT_NULL - , D3DMULTISAMPLE_NONE - , 0 - , false - , &m_surface[1] - , NULL - ) ); - } - - void FrameBufferD3D9::set() - { - m_needPresent = UINT16_MAX != m_denseIdx; - - // If frame buffer has only depth attachment D3DFMT_NULL - // render target is created. - const uint32_t fbnum = bx::uint32_max(2, m_numTh); - const uint8_t dsIdx = m_dsIdx; - - IDirect3DDevice9* device = s_renderD3D9->m_device; - - DX_CHECK(device->SetDepthStencilSurface(UINT8_MAX == dsIdx - ? s_renderD3D9->m_backBufferDepthStencil - : m_surface[dsIdx] - ) ); - - uint32_t rtIdx = 0; - for (uint32_t ii = 0; ii < fbnum; ++ii) - { - IDirect3DSurface9* surface = m_surface[ii]; - if (ii != dsIdx) - { - DX_CHECK(device->SetRenderTarget(rtIdx, surface) ); - ++rtIdx; - } - } - - for (uint32_t ii = rtIdx, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) - { - DX_CHECK(device->SetRenderTarget(ii, NULL) ); - } - - DX_CHECK(device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE) ); - } - - void TimerQueryD3D9::postReset() - { - IDirect3DDevice9* device = s_renderD3D9->m_device; - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) - { - Query& frame = m_query[ii]; - DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMPDISJOINT, &frame.m_disjoint) ); - DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMP, &frame.m_begin) ); - DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMP, &frame.m_end) ); - DX_CHECK(device->CreateQuery(D3DQUERYTYPE_TIMESTAMPFREQ, &frame.m_freq) ); - } - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_result); ++ii) - { - Result& result = m_result[ii]; - result.reset(); - } - - m_control.reset(); - } - - void TimerQueryD3D9::preReset() - { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) - { - Query& frame = m_query[ii]; - DX_RELEASE(frame.m_disjoint, 0); - DX_RELEASE(frame.m_begin, 0); - DX_RELEASE(frame.m_end, 0); - DX_RELEASE(frame.m_freq, 0); - } - } - - uint32_t TimerQueryD3D9::begin(uint32_t _resultIdx, uint32_t _frameNum) - { - while (0 == m_control.reserve(1) ) - { - update(); - } - - Result& result = m_result[_resultIdx]; - ++result.m_pending; - - const uint32_t idx = m_control.m_current; - Query& query = m_query[idx]; - query.m_resultIdx = _resultIdx; - query.m_ready = false; - query.m_frameNum = _frameNum; - - query.m_disjoint->Issue(D3DISSUE_BEGIN); - query.m_begin->Issue(D3DISSUE_END); - - m_control.commit(1); - - return idx; - } - - void TimerQueryD3D9::end(uint32_t _idx) - { - Query& query = m_query[_idx]; - query.m_ready = true; - - query.m_disjoint->Issue(D3DISSUE_END); - query.m_freq->Issue(D3DISSUE_END); - query.m_end->Issue(D3DISSUE_END); - - while (update() ) - { - } - } - - bool TimerQueryD3D9::update() - { - if (0 != m_control.available() ) - { - Query& query = m_query[m_control.m_read]; - - if (!query.m_ready) - { - return false; - } - - uint64_t timeEnd; - const bool flush = BX_COUNTOF(m_query)-1 == m_control.available(); - HRESULT hr = query.m_end->GetData(&timeEnd, sizeof(timeEnd), flush ? D3DGETDATA_FLUSH : 0); - if (S_OK == hr - || isLost(hr) ) - { - m_control.consume(1); - - uint64_t timeBegin; - DX_CHECK(query.m_begin->GetData(&timeBegin, sizeof(timeBegin), 0) ); - - uint64_t freq; - DX_CHECK(query.m_freq->GetData(&freq, sizeof(freq), 0) ); - - Result& result = m_result[query.m_resultIdx]; - --result.m_pending; - result.m_frameNum = query.m_frameNum; - - result.m_frequency = freq; - result.m_begin = timeBegin; - result.m_end = timeEnd; - - return true; - } - } - - return false; - } - - void OcclusionQueryD3D9::postReset() - { - IDirect3DDevice9* device = s_renderD3D9->m_device; - - for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) - { - Query& query = m_query[ii]; - DX_CHECK(device->CreateQuery(D3DQUERYTYPE_OCCLUSION, &query.m_ptr) ); - } - } - - void OcclusionQueryD3D9::preReset() - { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_query); ++ii) - { - Query& query = m_query[ii]; - DX_RELEASE(query.m_ptr, 0); - } - } - - void OcclusionQueryD3D9::begin(Frame* _render, OcclusionQueryHandle _handle) - { - while (0 == m_control.reserve(1) ) - { - resolve(_render, true); - } - - Query& query = m_query[m_control.m_current]; - query.m_ptr->Issue(D3DISSUE_BEGIN); - query.m_handle = _handle; - } - - void OcclusionQueryD3D9::end() - { - Query& query = m_query[m_control.m_current]; - query.m_ptr->Issue(D3DISSUE_END); - m_control.commit(1); - } - - void OcclusionQueryD3D9::resolve(Frame* _render, bool) - { - while (0 != m_control.available() ) - { - Query& query = m_query[m_control.m_read]; - - if (isValid(query.m_handle) ) - { - uint32_t result; - HRESULT hr = query.m_ptr->GetData(&result, sizeof(result), 0); - if (S_FALSE == hr) - { - break; - } - - _render->m_occlusion[query.m_handle.idx] = int32_t(result); - } - - m_control.consume(1); - } - } - - void OcclusionQueryD3D9::invalidate(OcclusionQueryHandle _handle) - { - const uint32_t size = m_control.m_size; - - for (uint32_t ii = 0, num = m_control.available(); ii < num; ++ii) - { - Query& query = m_query[(m_control.m_read + ii) % size]; - if (query.m_handle.idx == _handle.idx) - { - query.m_handle.idx = bgfx::kInvalidHandle; - } - } - } - - void RendererContextD3D9::submitBlit(BlitState& _bs, uint16_t _view) - { - while (_bs.hasItem(_view) ) - { - const BlitItem& blit = _bs.advance(); - - const TextureD3D9& src = m_textures[blit.m_src.idx]; - const TextureD3D9& dst = m_textures[blit.m_dst.idx]; - - RECT srcRect = { LONG(blit.m_srcX), LONG(blit.m_srcY), LONG(blit.m_srcX + blit.m_width), LONG(blit.m_srcY + blit.m_height) }; - RECT dstRect = { LONG(blit.m_dstX), LONG(blit.m_dstY), LONG(blit.m_dstX + blit.m_width), LONG(blit.m_dstY + blit.m_height) }; - - IDirect3DSurface9* srcSurface = src.getSurface(uint8_t(blit.m_srcZ), blit.m_srcMip); - IDirect3DSurface9* dstSurface = dst.getSurface(uint8_t(blit.m_dstZ), blit.m_dstMip); - - // UpdateSurface (pool src: SYSTEMMEM, dst: DEFAULT) - // s/d T RTT RT - // T y y y - // RTT - - - - // RT - - - - // - // StretchRect (pool src and dst must be DEFAULT) - // s/d T RTT RT - // T - y y - // RTT - y y - // RT - y y - // - // GetRenderTargetData (dst must be SYSTEMMEM) - - bool depth = bimg::isDepth(bimg::TextureFormat::Enum(src.m_textureFormat) ); - HRESULT hr = m_device->StretchRect(srcSurface - , depth ? NULL : &srcRect - , dstSurface - , depth ? NULL : &dstRect - , D3DTEXF_NONE - ); - if (FAILED(hr) ) - { - hr = m_device->GetRenderTargetData(srcSurface, dstSurface); - BX_WARN(SUCCEEDED(hr), "StretchRect and GetRenderTargetData failed %x.", hr); - } - - srcSurface->Release(); - dstSurface->Release(); - } - } - - void RendererContextD3D9::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) - { - IDirect3DDevice9* device = m_device; - - updateResolution(_render->m_resolution); - - BGFX_D3D9_PROFILER_BEGIN_LITERAL("rendererSubmit", kColorView); - - int64_t timeBegin = bx::getHPCounter(); - int64_t captureElapsed = 0; - - uint32_t frameQueryIdx = UINT32_MAX; - - device->BeginScene(); - if (m_timerQuerySupport) - { - frameQueryIdx = m_gpuTimer.begin(BGFX_CONFIG_MAX_VIEWS, _render->m_frameNum); - } - - if (0 < _render->m_iboffset) - { - BGFX_PROFILER_SCOPE("bgfx/Update transient index buffer", kColorResource); - TransientIndexBuffer* ib = _render->m_transientIb; - m_indexBuffers[ib->handle.idx].update(0, _render->m_iboffset, ib->data, true); - } - - if (0 < _render->m_vboffset) - { - BGFX_PROFILER_SCOPE("bgfx/Update transient vertex buffer", kColorResource); - TransientVertexBuffer* vb = _render->m_transientVb; - m_vertexBuffers[vb->handle.idx].update(0, _render->m_vboffset, vb->data, true); - } - - _render->sort(); - - RenderDraw currentState; - currentState.clear(); - currentState.m_stateFlags = BGFX_STATE_NONE; - currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); - - RenderBind currentBind; - currentBind.clear(); - - static ViewState viewState; - viewState.reset(_render); - - DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, _render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) ); - ProgramHandle currentProgram = BGFX_INVALID_HANDLE; - SortKey key; - uint16_t view = UINT16_MAX; - FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; - uint32_t blendFactor = 0; - - BlitState bs(_render); - - uint8_t primIndex; - { - const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0; - primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); - } - PrimInfo prim = s_primInfo[primIndex]; - - bool viewHasScissor = false; - Rect viewScissorRect; - viewScissorRect.clear(); - - uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {}; - uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {}; - uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {}; - uint32_t statsNumIndices = 0; - uint32_t statsKeyType[2] = {}; - - invalidateSamplerState(); - - Profiler profiler( - _render - , m_gpuTimer - , s_viewName - , m_timerQuerySupport - ); - - if (m_occlusionQuerySupport) - { - m_occlusionQuery.resolve(_render); - } - - if (0 == (_render->m_debug&BGFX_DEBUG_IFH) ) - { - for (uint32_t item = 0, numItems = _render->m_numRenderItems; item < numItems; ++item) - { - const uint64_t encodedKey = _render->m_sortKeys[item]; - const bool isCompute = key.decode(encodedKey, _render->m_viewRemap); - statsKeyType[isCompute]++; - - if (isCompute) - { - BX_ASSERT(false, "Compute is not supported on DirectX 9."); - continue; - } - - const uint32_t itemIdx = _render->m_sortValues[item]; - const RenderDraw& draw = _render->m_renderItem[itemIdx].draw; - const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; - - const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); - { - const bool occluded = true - && isValid(draw.m_occlusionQuery) - && !hasOcclusionQuery - && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) - ; - - if (occluded - || _render->m_frameCache.isZeroArea(viewScissorRect, draw.m_scissor) ) - { - continue; - } - } - - const uint64_t newFlags = draw.m_stateFlags; - uint64_t changedFlags = currentState.m_stateFlags ^ draw.m_stateFlags; - currentState.m_stateFlags = newFlags; - - const uint64_t newStencil = draw.m_stencil; - uint64_t changedStencil = currentState.m_stencil ^ draw.m_stencil; - currentState.m_stencil = newStencil; - - if (key.m_view != view) - { - currentState.clear(); - currentState.m_scissor = !draw.m_scissor; - changedFlags = BGFX_STATE_MASK; - changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); - currentState.m_stateFlags = newFlags; - currentState.m_stencil = newStencil; - - view = key.m_view; - currentProgram = BGFX_INVALID_HANDLE; - - if (item > 0) - { - profiler.end(); - } - - BGFX_D3D9_PROFILER_END(); - BGFX_D3D9_PROFILER_BEGIN(view, kColorView); - - profiler.begin(view); - - if (_render->m_view[view].m_fbh.idx != fbh.idx) - { - fbh = _render->m_view[view].m_fbh; - setFrameBuffer(fbh); - } - - viewState.m_rect = _render->m_view[view].m_rect; - const Rect& scissorRect = _render->m_view[view].m_scissor; - viewHasScissor = !scissorRect.isZero(); - viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect; - - D3DVIEWPORT9 vp; - vp.X = viewState.m_rect.m_x; - vp.Y = viewState.m_rect.m_y; - vp.Width = viewState.m_rect.m_width; - vp.Height = viewState.m_rect.m_height; - vp.MinZ = 0.0f; - vp.MaxZ = 1.0f; - DX_CHECK(device->SetViewport(&vp) ); - - Clear& clear = _render->m_view[view].m_clear; - - if (BGFX_CLEAR_NONE != (clear.m_flags & BGFX_CLEAR_MASK) ) - { - clearQuad(_clearQuad, viewState.m_rect, clear, _render->m_colorPalette); - } - - DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, FALSE) ); - DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, TRUE) ); - DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS) ); - DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) ); - DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) ); - DX_CHECK(device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) ); - - submitBlit(bs, view); - } - - uint16_t scissor = draw.m_scissor; - if (currentState.m_scissor != scissor) - { - currentState.m_scissor = scissor; - - if (UINT16_MAX == scissor) - { - DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, viewHasScissor) ); - if (viewHasScissor) - { - RECT rc; - rc.left = viewScissorRect.m_x; - rc.top = viewScissorRect.m_y; - rc.right = viewScissorRect.m_x + viewScissorRect.m_width; - rc.bottom = viewScissorRect.m_y + viewScissorRect.m_height; - DX_CHECK(device->SetScissorRect(&rc) ); - } - } - else - { - Rect scissorRect; - scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); - - DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, true) ); - RECT rc; - rc.left = scissorRect.m_x; - rc.top = scissorRect.m_y; - rc.right = scissorRect.m_x + scissorRect.m_width; - rc.bottom = scissorRect.m_y + scissorRect.m_height; - DX_CHECK(device->SetScissorRect(&rc) ); - } - } - - if (0 != changedStencil) - { - bool enable = 0 != newStencil; - DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, enable) ); - - if (0 != newStencil) - { - uint32_t fstencil = unpackStencil(0, newStencil); - uint32_t bstencil = unpackStencil(1, newStencil); - uint8_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != fstencil; - DX_CHECK(device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, 0 != frontAndBack) ); - - uint32_t fchanged = unpackStencil(0, changedStencil); - if ( (BGFX_STENCIL_FUNC_REF_MASK|BGFX_STENCIL_FUNC_RMASK_MASK) & fchanged) - { - uint32_t ref = (fstencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT; - DX_CHECK(device->SetRenderState(D3DRS_STENCILREF, ref) ); - - uint32_t rmask = (fstencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT; - DX_CHECK(device->SetRenderState(D3DRS_STENCILMASK, rmask) ); - } - -// uint32_t bchanged = unpackStencil(1, changedStencil); -// if (BGFX_STENCIL_FUNC_RMASK_MASK & bchanged) -// { -// uint32_t wmask = (bstencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT; -// DX_CHECK(device->SetRenderState(D3DRS_STENCILWRITEMASK, wmask) ); -// } - - for (uint8_t ii = 0, num = frontAndBack+1; ii < num; ++ii) - { - uint32_t stencil = unpackStencil(ii, newStencil); - uint32_t changed = unpackStencil(ii, changedStencil); - - if ( (BGFX_STENCIL_TEST_MASK|BGFX_STENCIL_FUNC_REF_MASK|BGFX_STENCIL_FUNC_RMASK_MASK) & changed) - { - uint32_t func = (stencil&BGFX_STENCIL_TEST_MASK)>>BGFX_STENCIL_TEST_SHIFT; - DX_CHECK(device->SetRenderState(s_stencilFuncRs[ii], s_cmpFunc[func]) ); - } - - if ( (BGFX_STENCIL_OP_FAIL_S_MASK|BGFX_STENCIL_OP_FAIL_Z_MASK|BGFX_STENCIL_OP_PASS_Z_MASK) & changed) - { - uint32_t sfail = (stencil&BGFX_STENCIL_OP_FAIL_S_MASK)>>BGFX_STENCIL_OP_FAIL_S_SHIFT; - DX_CHECK(device->SetRenderState(s_stencilFailRs[ii], s_stencilOp[sfail]) ); - - uint32_t zfail = (stencil&BGFX_STENCIL_OP_FAIL_Z_MASK)>>BGFX_STENCIL_OP_FAIL_Z_SHIFT; - DX_CHECK(device->SetRenderState(s_stencilZFailRs[ii], s_stencilOp[zfail]) ); - - uint32_t zpass = (stencil&BGFX_STENCIL_OP_PASS_Z_MASK)>>BGFX_STENCIL_OP_PASS_Z_SHIFT; - DX_CHECK(device->SetRenderState(s_stencilZPassRs[ii], s_stencilOp[zpass]) ); - } - } - } - } - - if ( (0 - | BGFX_STATE_CULL_MASK -// | BGFX_STATE_FRONT_CCW - | BGFX_STATE_WRITE_Z - | BGFX_STATE_DEPTH_TEST_MASK - | BGFX_STATE_WRITE_RGB - | BGFX_STATE_WRITE_A - | BGFX_STATE_BLEND_MASK - | BGFX_STATE_BLEND_EQUATION_MASK - | BGFX_STATE_ALPHA_REF_MASK - | BGFX_STATE_PT_MASK - | BGFX_STATE_POINT_SIZE_MASK - | BGFX_STATE_MSAA - ) & changedFlags) - { - if (BGFX_STATE_CULL_MASK & changedFlags) - { - uint32_t cull = (newFlags&BGFX_STATE_CULL_MASK)>>BGFX_STATE_CULL_SHIFT; - DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, s_cullMode[cull]) ); - } - - if (BGFX_STATE_WRITE_Z & changedFlags) - { - DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, !!(BGFX_STATE_WRITE_Z & newFlags) ) ); - } - - if (BGFX_STATE_DEPTH_TEST_MASK & changedFlags) - { - uint32_t func = (newFlags&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT; - DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, 0 != func) ); - - if (0 != func) - { - DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, s_cmpFunc[func]) ); - } - } - - if (BGFX_STATE_ALPHA_REF_MASK & changedFlags) - { - uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT; - viewState.m_alphaRef = ref/255.0f; - } - - if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags) - { - DX_CHECK(device->SetRenderState(D3DRS_POINTSIZE, castfu( (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) ) ) ); - } - - if (BGFX_STATE_MSAA & changedFlags) - { - DX_CHECK(device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, (newFlags&BGFX_STATE_MSAA) == BGFX_STATE_MSAA) ); - } - - if (BGFX_STATE_LINEAA & changedFlags) - { - DX_CHECK(m_device->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, !!(newFlags&BGFX_STATE_LINEAA) ) ); - } - - if ( (BGFX_STATE_WRITE_A|BGFX_STATE_WRITE_RGB) & changedFlags) - { - uint32_t writeEnable = 0; - writeEnable |= (newFlags&BGFX_STATE_WRITE_R) ? D3DCOLORWRITEENABLE_RED : 0; - writeEnable |= (newFlags&BGFX_STATE_WRITE_G) ? D3DCOLORWRITEENABLE_GREEN : 0; - writeEnable |= (newFlags&BGFX_STATE_WRITE_B) ? D3DCOLORWRITEENABLE_BLUE : 0; - writeEnable |= (newFlags&BGFX_STATE_WRITE_A) ? D3DCOLORWRITEENABLE_ALPHA : 0; - DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, writeEnable) ); - } - - if ( ( (0 - | BGFX_STATE_BLEND_MASK - | BGFX_STATE_BLEND_EQUATION_MASK - | BGFX_STATE_BLEND_ALPHA_TO_COVERAGE - ) & changedFlags) - || blendFactor != draw.m_rgba) - { - bool enabled = !!(BGFX_STATE_BLEND_MASK & newFlags); - DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, enabled) ); - - if (m_atocSupport - && BGFX_STATE_BLEND_ALPHA_TO_COVERAGE & changedFlags) - { - DX_CHECK(m_device->SetRenderState(D3DRS_ADAPTIVETESS_Y - , !!(newFlags&BGFX_STATE_BLEND_ALPHA_TO_COVERAGE) - ? D3DFMT_ATOC - : 0 - ) ); - } - - if (enabled) - { - const uint32_t blend = uint32_t( (newFlags&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT); - const uint32_t equation = uint32_t( (newFlags&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT); - - const uint32_t srcRGB = (blend )&0xf; - const uint32_t dstRGB = (blend>> 4)&0xf; - const uint32_t srcA = (blend>> 8)&0xf; - const uint32_t dstA = (blend>>12)&0xf; - - const uint32_t equRGB = (equation )&0x7; - const uint32_t equA = (equation>>3)&0x7; - - DX_CHECK(device->SetRenderState(D3DRS_SRCBLEND, s_blendFactor[srcRGB].m_src) ); - DX_CHECK(device->SetRenderState(D3DRS_DESTBLEND, s_blendFactor[dstRGB].m_dst) ); - DX_CHECK(device->SetRenderState(D3DRS_BLENDOP, s_blendEquation[equRGB]) ); - - const bool separate = srcRGB != srcA || dstRGB != dstA || equRGB != equA; - - DX_CHECK(device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, separate) ); - if (separate) - { - DX_CHECK(device->SetRenderState(D3DRS_SRCBLENDALPHA, s_blendFactor[srcA].m_src) ); - DX_CHECK(device->SetRenderState(D3DRS_DESTBLENDALPHA, s_blendFactor[dstA].m_dst) ); - DX_CHECK(device->SetRenderState(D3DRS_BLENDOPALPHA, s_blendEquation[equA]) ); - } - - if ( (s_blendFactor[srcRGB].m_factor || s_blendFactor[dstRGB].m_factor) - && blendFactor != draw.m_rgba) - { - const uint32_t rgba = draw.m_rgba; - D3DCOLOR color = D3DCOLOR_RGBA( - rgba>>24 - , (rgba>>16)&0xff - , (rgba>> 8)&0xff - , (rgba )&0xff - ); - DX_CHECK(device->SetRenderState(D3DRS_BLENDFACTOR, color) ); - } - } - - blendFactor = draw.m_rgba; - } - - const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : newFlags&BGFX_STATE_PT_MASK; - primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); - prim = s_primInfo[primIndex]; - } - - bool programChanged = false; - bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; - rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); - - if (key.m_program.idx != currentProgram.idx) - { - currentProgram = key.m_program; - - if (!isValid(currentProgram) ) - { - device->SetVertexShader(NULL); - device->SetPixelShader(NULL); - } - else - { - ProgramD3D9& program = m_program[currentProgram.idx]; - device->SetVertexShader(program.m_vsh->m_vertexShader); - device->SetPixelShader(NULL == program.m_fsh - ? NULL - : program.m_fsh->m_pixelShader - ); - } - - programChanged = - constantsChanged = true; - } - - if (isValid(currentProgram) ) - { - ProgramD3D9& program = m_program[currentProgram.idx]; - - if (constantsChanged) - { - UniformBuffer* vcb = program.m_vsh->m_constantBuffer; - if (NULL != vcb) - { - commit(*vcb); - } - - if (NULL != program.m_fsh) - { - UniformBuffer* fcb = program.m_fsh->m_constantBuffer; - if (NULL != fcb) - { - commit(*fcb); - } - } - } - - viewState.setPredefined<4>(this, view, program, _render, draw); - } - - { - for (uint8_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) - { - const Binding& bind = renderBind.m_bind[stage]; - Binding& current = currentBind.m_bind[stage]; - - if (current.m_idx != bind.m_idx - || current.m_samplerFlags != bind.m_samplerFlags - || programChanged) - { - if (kInvalidHandle != bind.m_idx) - { - m_textures[bind.m_idx].commit(stage, bind.m_samplerFlags, _render->m_colorPalette); - } - else - { - DX_CHECK(device->SetTexture(stage, NULL) ); - } - } - - current = bind; - } - } - - bool vertexStreamChanged = hasVertexStreamChanged(currentState, draw); - - if (programChanged - || vertexStreamChanged) - { - currentState.m_streamMask = draw.m_streamMask; - currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; - currentState.m_instanceDataOffset = draw.m_instanceDataOffset; - currentState.m_instanceDataStride = draw.m_instanceDataStride; - - const VertexLayout* layouts[BGFX_CONFIG_MAX_VERTEX_STREAMS]; - - const bool instanced = true - && isValid(draw.m_instanceDataBuffer) - && m_instancingSupport - ; - - const uint32_t freq = instanced - ? D3DSTREAMSOURCE_INDEXEDDATA|draw.m_numInstances - : 1 - ; - - uint32_t numVertices = draw.m_numVertices; - uint8_t numStreams = 0; - for (uint32_t idx = 0, streamMask = draw.m_streamMask - ; 0 != streamMask - ; streamMask >>= 1, idx += 1, ++numStreams - ) - { - const uint32_t ntz = bx::uint32_cnttz(streamMask); - streamMask >>= ntz; - idx += ntz; - - currentState.m_stream[idx].m_layoutHandle = draw.m_stream[idx].m_layoutHandle; - currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle; - currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; - - const uint16_t handle = draw.m_stream[idx].m_handle.idx; - const VertexBufferD3D9& vb = m_vertexBuffers[handle]; - const uint16_t layoutIdx = isValid(draw.m_stream[idx].m_layoutHandle) - ? draw.m_stream[idx].m_layoutHandle.idx - : vb.m_layoutHandle.idx; - const VertexLayout& layout = m_vertexLayouts[layoutIdx]; - const uint32_t stride = layout.m_stride; - - layouts[numStreams] = &layout; - - numVertices = bx::uint32_min(UINT32_MAX == draw.m_numVertices - ? vb.m_size/stride - : draw.m_numVertices - , numVertices - ); - - DX_CHECK(device->SetStreamSourceFreq(0, freq) ); - DX_CHECK(device->SetStreamSource(numStreams, vb.m_ptr, 0, stride) ); - } - - if (0 < numStreams) - { - if (instanced) - { - const VertexBufferD3D9& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; - DX_CHECK(device->SetStreamSourceFreq(numStreams, UINT(D3DSTREAMSOURCE_INSTANCEDATA|1) ) ); - DX_CHECK(device->SetStreamSource(numStreams, inst.m_ptr, draw.m_instanceDataOffset, draw.m_instanceDataStride) ); - setInputLayout(numStreams, layouts, draw.m_instanceDataStride/16); - } - else - { - DX_CHECK(device->SetStreamSource(numStreams, NULL, 0, 0) ); - setInputLayout(numStreams, layouts, 0); - } - } - else - { - DX_CHECK(device->SetStreamSource(0, NULL, 0, 0) ); - DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) ); - } - } - - if (currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx) - { - currentState.m_indexBuffer = draw.m_indexBuffer; - - uint16_t handle = draw.m_indexBuffer.idx; - if (kInvalidHandle != handle) - { - const IndexBufferD3D9& ib = m_indexBuffers[handle]; - DX_CHECK(device->SetIndices(ib.m_ptr) ); - } - else - { - DX_CHECK(device->SetIndices(NULL) ); - } - } - - if (0 != currentState.m_streamMask) - { - uint32_t numVertices = draw.m_numVertices; - uint32_t numIndices = 0; - uint32_t numPrimsSubmitted = 0; - uint32_t numInstances = 0; - uint32_t numPrimsRendered = 0; - - if (hasOcclusionQuery) - { - m_occlusionQuery.begin(_render, draw.m_occlusionQuery); - } - - if (isValid(draw.m_indexBuffer) ) - { - if (UINT32_MAX == draw.m_numIndices) - { - const IndexBufferD3D9& ib = m_indexBuffers[draw.m_indexBuffer.idx]; - const bool isIndex16 = draw.isIndex16(); - const uint32_t indexSize = isIndex16 ? 2 : 4; - numIndices = ib.m_size/indexSize; - numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub; - numInstances = draw.m_numInstances; - numPrimsRendered = numPrimsSubmitted*draw.m_numInstances; - - DX_CHECK(device->DrawIndexedPrimitive(prim.m_type - , draw.m_stream[0].m_startVertex - , 0 - , numVertices - , 0 - , numPrimsSubmitted - ) ); - } - else if (prim.m_min <= draw.m_numIndices) - { - numIndices = draw.m_numIndices; - numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub; - numInstances = draw.m_numInstances; - numPrimsRendered = numPrimsSubmitted*draw.m_numInstances; - - DX_CHECK(device->DrawIndexedPrimitive(prim.m_type - , draw.m_stream[0].m_startVertex - , 0 - , numVertices - , draw.m_startIndex - , numPrimsSubmitted - ) ); - } - } - else - { - numPrimsSubmitted = numVertices/prim.m_div - prim.m_sub; - numInstances = draw.m_numInstances; - numPrimsRendered = numPrimsSubmitted*draw.m_numInstances; - - DX_CHECK(device->DrawPrimitive(prim.m_type - , draw.m_stream[0].m_startVertex - , numPrimsSubmitted - ) ); - } - - if (hasOcclusionQuery) - { - m_occlusionQuery.end(); - } - - statsNumPrimsSubmitted[primIndex] += numPrimsSubmitted; - statsNumPrimsRendered[primIndex] += numPrimsRendered; - statsNumInstances[primIndex] += numInstances; - statsNumIndices += numIndices; - } - } - - submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); - - if (0 < _render->m_numRenderItems) - { - if (0 != (m_resolution.reset & BGFX_RESET_FLUSH_AFTER_RENDER) ) - { - flush(); - } - - captureElapsed = -bx::getHPCounter(); - capture(); - captureElapsed += bx::getHPCounter(); - - profiler.end(); - } - } - - BGFX_D3D9_PROFILER_END(); - - int64_t timeEnd = bx::getHPCounter(); - int64_t frameTime = timeEnd - timeBegin; - - static int64_t min = frameTime; - static int64_t max = frameTime; - min = min > frameTime ? frameTime : min; - max = max < frameTime ? frameTime : max; - - static uint32_t maxGpuLatency = 0; - static double maxGpuElapsed = 0.0f; - double elapsedGpuMs = 0.0; - - if (UINT32_MAX != frameQueryIdx) - { - m_gpuTimer.end(frameQueryIdx); - - const TimerQueryD3D9::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; - double toGpuMs = 1000.0 / double(result.m_frequency); - elapsedGpuMs = (result.m_end - result.m_begin) * toGpuMs; - maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; - - maxGpuLatency = bx::uint32_imax(maxGpuLatency, result.m_pending-1); - } - - const int64_t timerFreq = bx::getHPFrequency(); - - Stats& perfStats = _render->m_perfStats; - perfStats.cpuTimeBegin = timeBegin; - perfStats.cpuTimeEnd = timeEnd; - perfStats.cpuTimerFreq = timerFreq; - const TimerQueryD3D9::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS]; - perfStats.gpuTimeBegin = result.m_begin; - perfStats.gpuTimeEnd = result.m_end; - perfStats.gpuTimerFreq = result.m_frequency; - perfStats.numDraw = statsKeyType[0]; - perfStats.numCompute = statsKeyType[1]; - perfStats.numBlit = _render->m_numBlitItems; - perfStats.maxGpuLatency = maxGpuLatency; - perfStats.gpuFrameNum = result.m_frameNum; - bx::memCopy(perfStats.numPrims, statsNumPrimsRendered, sizeof(perfStats.numPrims) ); - m_nvapi.getMemoryInfo(perfStats.gpuMemoryUsed, perfStats.gpuMemoryMax); - - if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) - { - BGFX_D3D9_PROFILER_BEGIN_LITERAL("debugstats", kColorFrame); - - m_needPresent = true; - TextVideoMem& tvm = m_textVideoMem; - - static int64_t next = timeEnd; - - if (timeEnd >= next) - { - next = timeEnd + timerFreq; - - double freq = double(timerFreq); - double toMs = 1000.0/freq; - - tvm.clear(); - uint16_t pos = 0; - tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x8c : 0x8f - , " %s / " BX_COMPILER_NAME - " / " BX_CPU_NAME - " / " BX_ARCH_NAME - " / " BX_PLATFORM_NAME - " / Version 1.%d.%d (commit: " BGFX_REV_SHA1 ")" - , getRendererName() - , BGFX_API_VERSION - , BGFX_REV_NUMBER - ); - - const D3DADAPTER_IDENTIFIER9& identifier = m_identifier; - tvm.printf(0, pos++, 0x8f, " Device: %s (%s)", identifier.Description, identifier.Driver); - - char processMemoryUsed[16]; - bx::prettify(processMemoryUsed, BX_COUNTOF(processMemoryUsed), bx::getProcessMemoryUsed() ); - tvm.printf(0, pos++, 0x8f, " Memory: %s (process) ", processMemoryUsed); - - pos = 10; - tvm.printf(10, pos++, 0x8b, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " - , double(frameTime)*toMs - , double(min)*toMs - , double(max)*toMs - , freq/frameTime - ); - - const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " - , !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' ' - , 0 != msaa ? '\xfe' : ' ' - , 1<m_numRenderItems - , statsKeyType[0] - , statsKeyType[1] - , elapsedCpuMs - , elapsedCpuMs > maxGpuElapsed ? '>' : '<' - , maxGpuElapsed - , maxGpuLatency - ); - maxGpuLatency = 0; - maxGpuElapsed = 0.0; - - for (uint32_t ii = 0; ii < Topology::Count; ++ii) - { - tvm.printf(10, pos++, 0x8b, " %10s: %7d (#inst: %5d), submitted: %7d" - , getName(Topology::Enum(ii) ) - , statsNumPrimsRendered[ii] - , statsNumInstances[ii] - , statsNumPrimsSubmitted[ii] - ); - } - - tvm.printf(10, pos++, 0x8b, " Indices: %7d ", statsNumIndices); -// tvm.printf(10, pos++, 0x8b, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); - tvm.printf(10, pos++, 0x8b, " DVB size: %7d ", _render->m_vboffset); - tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset); - - pos++; - tvm.printf(10, pos++, 0x8b, " Occlusion queries: %3d ", m_occlusionQuery.m_control.available() ); - - pos++; - tvm.printf(10, pos++, 0x8b, " State cache: "); - tvm.printf(10, pos++, 0x8b, " Input "); - tvm.printf(10, pos++, 0x8b, " %6d " - , m_inputLayoutCache.getCount() - ); - pos++; - - double captureMs = double(captureElapsed)*toMs; - tvm.printf(10, pos++, 0x8b, " Capture: %7.4f [ms]", captureMs); - - uint8_t attr[2] = { 0x8c, 0x8a }; - uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender; - - tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %7.4f [ms]", _render->m_waitSubmit*toMs); - tvm.printf(10, pos++, attr[(attrIndex+1)&1], " Render wait: %7.4f [ms]", _render->m_waitRender*toMs); - - min = frameTime; - max = frameTime; - } - - blit(this, _textVideoMemBlitter, tvm); - - BGFX_D3D9_PROFILER_END(); - } - else if (_render->m_debug & BGFX_DEBUG_TEXT) - { - BGFX_D3D9_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame); - - blit(this, _textVideoMemBlitter, _render->m_textVideoMem); - - BGFX_D3D9_PROFILER_END(); - } - - device->EndScene(); - } -} /* namespace d3d9 */ } // namespace bgfx - -#else - -namespace bgfx { namespace d3d9 -{ - RendererContextI* rendererCreate(const Init& _init) - { - BX_UNUSED(_init); - return NULL; - } - - void rendererDestroy() - { - } -} /* namespace d3d9 */ } // namespace bgfx - -#endif // BGFX_CONFIG_RENDERER_DIRECT3D9 diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h deleted file mode 100644 index 52c803f003a..00000000000 --- a/src/renderer_d3d9.h +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright 2011-2023 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE - */ - -#ifndef BGFX_RENDERER_D3D9_H_HEADER_GUARD -#define BGFX_RENDERER_D3D9_H_HEADER_GUARD - -#define BGFX_CONFIG_RENDERER_DIRECT3D9EX (BX_PLATFORM_LINUX || BX_PLATFORM_WINDOWS) - -#include -#include -#include - -#ifndef D3DSTREAMSOURCE_INDEXEDDATA -# define D3DSTREAMSOURCE_INDEXEDDATA (1<<30) -#endif// D3DSTREAMSOURCE_INDEXEDDATA - -#ifndef D3DSTREAMSOURCE_INSTANCEDATA -# define D3DSTREAMSOURCE_INSTANCEDATA (2<<30) -#endif // D3DSTREAMSOURCE_INSTANCEDATA - -#include "renderer.h" -#include "renderer_d3d.h" -#include "nvapi.h" - -#define BGFX_D3D9_PROFILER_BEGIN(_view, _abgr) \ - BX_MACRO_BLOCK_BEGIN \ - PIX_BEGINEVENT(_abgr, s_viewNameW[_view]); \ - BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \ - BX_MACRO_BLOCK_END - -#define BGFX_D3D9_PROFILER_BEGIN_LITERAL(_name, _abgr) \ - BX_MACRO_BLOCK_BEGIN \ - PIX_BEGINEVENT(_abgr, L"" _name); \ - BGFX_PROFILER_BEGIN_LITERAL("" _name, _abgr); \ - BX_MACRO_BLOCK_END - -#define BGFX_D3D9_PROFILER_END() \ - BX_MACRO_BLOCK_BEGIN \ - BGFX_PROFILER_END(); \ - PIX_ENDEVENT(); \ - BX_MACRO_BLOCK_END - -namespace bgfx { namespace d3d9 -{ -# if defined(D3D_DISABLE_9EX) -# define D3DFMT_S8_LOCKABLE D3DFORMAT( 85) -# define D3DFMT_A1 D3DFORMAT(118) -# endif // defined(D3D_DISABLE_9EX) - -# ifndef D3DFMT_ATI1 -# define D3DFMT_ATI1 ( (D3DFORMAT)BX_MAKEFOURCC('A', 'T', 'I', '1') ) -# endif // D3DFMT_ATI1 - -# ifndef D3DFMT_ATI2 -# define D3DFMT_ATI2 ( (D3DFORMAT)BX_MAKEFOURCC('A', 'T', 'I', '2') ) -# endif // D3DFMT_ATI2 - -# ifndef D3DFMT_ATOC -# define D3DFMT_ATOC ( (D3DFORMAT)BX_MAKEFOURCC('A', 'T', 'O', 'C') ) -# endif // D3DFMT_ATOC - -# ifndef D3DFMT_DF16 -# define D3DFMT_DF16 ( (D3DFORMAT)BX_MAKEFOURCC('D', 'F', '1', '6') ) -# endif // D3DFMT_DF16 - -# ifndef D3DFMT_DF24 -# define D3DFMT_DF24 ( (D3DFORMAT)BX_MAKEFOURCC('D', 'F', '2', '4') ) -# endif // D3DFMT_DF24 - -# ifndef D3DFMT_INST -# define D3DFMT_INST ( (D3DFORMAT)BX_MAKEFOURCC('I', 'N', 'S', 'T') ) -# endif // D3DFMT_INST - -# ifndef D3DFMT_INTZ -# define D3DFMT_INTZ ( (D3DFORMAT)BX_MAKEFOURCC('I', 'N', 'T', 'Z') ) -# endif // D3DFMT_INTZ - -# ifndef D3DFMT_NULL -# define D3DFMT_NULL ( (D3DFORMAT)BX_MAKEFOURCC('N', 'U', 'L', 'L') ) -# endif // D3DFMT_NULL - -# ifndef D3DFMT_RESZ -# define D3DFMT_RESZ ( (D3DFORMAT)BX_MAKEFOURCC('R', 'E', 'S', 'Z') ) -# endif // D3DFMT_RESZ - -# ifndef D3DFMT_RAWZ -# define D3DFMT_RAWZ ( (D3DFORMAT)BX_MAKEFOURCC('R', 'A', 'W', 'Z') ) -# endif // D3DFMT_RAWZ - -# ifndef D3DFMT_S8_LOCKABLE -# define D3DFMT_S8_LOCKABLE ( (D3DFORMAT)85) -# endif // D3DFMT_S8_LOCKABLE - -# ifndef D3DFMT_A1 -# define D3DFMT_A1 ( (D3DFORMAT)118) -# endif // D3DFMT_A1 - - struct ExtendedFormat - { - enum Enum - { - Ati1, - Ati2, - Df16, - Df24, - Inst, - Intz, - Null, - Resz, - Rawz, - Atoc, - - Count, - }; - - D3DFORMAT m_fmt; - DWORD m_usage; - D3DRESOURCETYPE m_type; - bool m_supported; - }; - - struct Msaa - { - D3DMULTISAMPLE_TYPE m_type; - DWORD m_quality; - }; - - struct IndexBufferD3D9 - { - IndexBufferD3D9() - : m_ptr(NULL) - , m_dynamic(NULL) - , m_size(0) - , m_flags(BGFX_BUFFER_NONE) - { - } - - void create(uint32_t _size, void* _data, uint16_t _flags); - void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false) - { - if (NULL != m_dynamic - && _data != m_dynamic) - { - bx::memCopy(&m_dynamic[_offset], _data, _size); - } - - void* buffer; - DX_CHECK(m_ptr->Lock(_offset - , _size - , &buffer - , _discard || (m_dynamic && 0 == _offset && m_size == _size) ? D3DLOCK_DISCARD : 0 - ) ); - - bx::memCopy(buffer, _data, _size); - - DX_CHECK(m_ptr->Unlock() ); - } - - void destroy() - { - if (NULL != m_ptr) - { - DX_RELEASE(m_ptr, 0); - - if (NULL != m_dynamic) - { - bx::free(g_allocator, m_dynamic); - m_dynamic = NULL; - } - } - } - - void preReset(); - void postReset(); - - IDirect3DIndexBuffer9* m_ptr; - uint8_t* m_dynamic; - uint32_t m_size; - uint16_t m_flags; - }; - - struct VertexBufferD3D9 - { - VertexBufferD3D9() - : m_ptr(NULL) - , m_dynamic(NULL) - , m_size(0) - { - } - - void create(uint32_t _size, void* _data, VertexLayoutHandle _layoutHandle); - void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false) - { - if (NULL != m_dynamic - && _data != m_dynamic) - { - bx::memCopy(&m_dynamic[_offset], _data, _size); - } - - void* buffer; - DX_CHECK(m_ptr->Lock(_offset - , _size - , &buffer - , _discard || (m_dynamic && 0 == _offset && m_size == _size) ? D3DLOCK_DISCARD : 0 - ) ); - - bx::memCopy(buffer, _data, _size); - - DX_CHECK(m_ptr->Unlock() ); - } - - void destroy() - { - if (NULL != m_ptr) - { - DX_RELEASE(m_ptr, 0); - - if (NULL != m_dynamic) - { - bx::free(g_allocator, m_dynamic); - m_dynamic = NULL; - } - } - } - - void preReset(); - void postReset(); - - IDirect3DVertexBuffer9* m_ptr; - uint8_t* m_dynamic; - uint32_t m_size; - VertexLayoutHandle m_layoutHandle; - }; - - struct ShaderD3D9 - { - ShaderD3D9() - : m_vertexShader(NULL) - , m_constantBuffer(NULL) - , m_numPredefined(0) - , m_type(0) - { - } - - void create(const Memory* _mem); - - void destroy() - { - if (NULL != m_constantBuffer) - { - UniformBuffer::destroy(m_constantBuffer); - m_constantBuffer = NULL; - } - m_numPredefined = 0; - - switch (m_type) - { - case 0: DX_RELEASE(m_vertexShader, 0); BX_FALLTHROUGH; - default: DX_RELEASE(m_pixelShader, 0); - } - } - - union - { - // X360 doesn't have interface inheritance (can't use IUnknown*). - IDirect3DVertexShader9* m_vertexShader; - IDirect3DPixelShader9* m_pixelShader; - }; - UniformBuffer* m_constantBuffer; - PredefinedUniform m_predefined[PredefinedUniform::Count]; - uint8_t m_numPredefined; - uint8_t m_type; - }; - - struct ProgramD3D9 - { - void create(const ShaderD3D9* _vsh, const ShaderD3D9* _fsh) - { - m_vsh = _vsh; - m_fsh = _fsh; - - bx::memCopy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform) ); - m_numPredefined = _vsh->m_numPredefined; - - if (NULL != _fsh) - { - bx::memCopy(&m_predefined[_vsh->m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform) ); - m_numPredefined += _fsh->m_numPredefined; - } - } - - void destroy() - { - m_numPredefined = 0; - m_vsh = NULL; - m_fsh = NULL; - } - - const ShaderD3D9* m_vsh; - const ShaderD3D9* m_fsh; - - PredefinedUniform m_predefined[PredefinedUniform::Count*2]; - uint8_t m_numPredefined; - }; - - struct TextureD3D9 - { - enum Enum - { - Texture2D, - Texture3D, - TextureCube, - }; - - TextureD3D9() - : m_ptr(NULL) - , m_surface(NULL) - , m_staging(NULL) - , m_textureFormat(TextureFormat::Unknown) - { - } - - void createTexture(uint32_t _width, uint32_t _height, uint8_t _numMips); - void createVolumeTexture(uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips); - void createCubeTexture(uint32_t _width, uint8_t _numMips); - - uint8_t* lock(uint8_t _side, uint8_t _lod, uint32_t& _pitch, uint32_t& _slicePitch, const Rect* _rect = NULL); - void unlock(uint8_t _side, uint8_t _lod); - void dirty(uint8_t _side, const Rect& _rect, uint16_t _z, uint16_t _depth); - IDirect3DSurface9* getSurface(uint8_t _side = 0, uint8_t _mip = 0) const; - - void create(const Memory* _mem, uint64_t _flags, uint8_t _skip); - - void destroy(bool _resize = false) - { - if (0 == (m_flags & BGFX_SAMPLER_INTERNAL_SHARED) ) - { - if (_resize) - { - // BK - at the time of resize there might be one reference held by frame buffer - // surface. This frame buffer will be recreated later, and release reference - // to existing surface. That's why here we don't care about ref count. - m_ptr->Release(); - } - else - { - DX_RELEASE(m_ptr, 0); - } - } - DX_RELEASE(m_surface, 0); - DX_RELEASE(m_staging, 0); - m_textureFormat = TextureFormat::Unknown; - } - - void overrideInternal(uintptr_t _ptr) - { - destroy(); - m_flags |= BGFX_SAMPLER_INTERNAL_SHARED; - m_ptr = (IDirect3DBaseTexture9*)_ptr; - } - - void updateBegin(uint8_t _side, uint8_t _mip); - void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); - void updateEnd(); - void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]); - void resolve(uint8_t _resolve) const; - - void preReset(); - void postReset(); - - union - { - IDirect3DBaseTexture9* m_ptr; - IDirect3DTexture9* m_texture2d; - IDirect3DVolumeTexture9* m_texture3d; - IDirect3DCubeTexture9* m_textureCube; - }; - - IDirect3DSurface9* m_surface; - - union - { - IDirect3DBaseTexture9* m_staging; - IDirect3DTexture9* m_staging2d; - IDirect3DVolumeTexture9* m_staging3d; - IDirect3DCubeTexture9* m_stagingCube; - }; - - uint64_t m_flags; - uint32_t m_width; - uint32_t m_height; - uint32_t m_depth; - uint8_t m_numMips; - uint8_t m_type; - uint8_t m_requestedFormat; - uint8_t m_textureFormat; - }; - - struct FrameBufferD3D9 - { - FrameBufferD3D9() - : m_hwnd(NULL) - , m_denseIdx(UINT16_MAX) - , m_num(0) - , m_numTh(0) - , m_dsIdx(UINT8_MAX) - , m_needResolve(false) - , m_needPresent(false) - { - } - - void create(uint8_t _num, const Attachment* _attachment); - void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat); - uint16_t destroy(); - HRESULT present(); - void resolve() const; - void preReset(); - void postReset(); - void createNullColorRT(); - void set(); - - IDirect3DSurface9* m_surface[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; - IDirect3DSwapChain9* m_swapChain; - HWND m_hwnd; - uint32_t m_width; - uint32_t m_height; - - Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; - uint16_t m_denseIdx; - uint8_t m_num; - uint8_t m_numTh; - uint8_t m_dsIdx; - bool m_needResolve; - bool m_needPresent; - }; - - struct TimerQueryD3D9 - { - TimerQueryD3D9() - : m_control(BX_COUNTOF(m_query) ) - { - } - - void postReset(); - void preReset(); - uint32_t begin(uint32_t _resultIdx, uint32_t _frameNum); - void end(uint32_t _idx); - bool update(); - - struct Query - { - IDirect3DQuery9* m_disjoint; - IDirect3DQuery9* m_begin; - IDirect3DQuery9* m_end; - IDirect3DQuery9* m_freq; - uint32_t m_resultIdx; - uint32_t m_frameNum; - bool m_ready; - }; - - struct Result - { - void reset() - { - m_begin = 0; - m_end = 0; - m_frequency = 1; - m_pending = 0; - m_frameNum = 0; - } - - uint64_t m_begin; - uint64_t m_end; - uint64_t m_frequency; - uint32_t m_pending; - uint32_t m_frameNum; - }; - - Result m_result[BGFX_CONFIG_MAX_VIEWS+1]; - - Query m_query[BGFX_CONFIG_MAX_VIEWS*4]; - bx::RingBufferControl m_control; - }; - - struct OcclusionQueryD3D9 - { - OcclusionQueryD3D9() - : m_control(BX_COUNTOF(m_query) ) - { - } - - void postReset(); - void preReset(); - void begin(Frame* _render, OcclusionQueryHandle _handle); - void end(); - void resolve(Frame* _render, bool _wait = false); - void invalidate(OcclusionQueryHandle _handle); - - struct Query - { - IDirect3DQuery9* m_ptr; - OcclusionQueryHandle m_handle; - }; - - Query m_query[BGFX_CONFIG_MAX_OCCLUSION_QUERIES]; - bx::RingBufferControl m_control; - }; - -} /* namespace d3d9 */ } // namespace bgfx - -#endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD diff --git a/src/shader.cpp b/src/shader.cpp index 9e0ba24c273..97de1fe2610 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -5,7 +5,6 @@ #include "bgfx_p.h" #include "shader_dxbc.h" -#include "shader_dx9bc.h" #include "shader_spirv.h" namespace bgfx @@ -128,19 +127,6 @@ namespace bgfx return true; } - static bool printAsm(uint32_t _offset, const Dx9bcInstruction& _instruction, void* _userData) - { - BX_UNUSED(_offset); - bx::WriterI* writer = reinterpret_cast(_userData); - char temp[512]; - toString(temp, sizeof(temp), _instruction); - - bx::Error err; - bx::write(writer, temp, (int32_t)bx::strLen(temp), &err); - bx::write(writer, '\n', &err); - return true; - } - static bool printAsm(uint32_t _offset, const SpvInstruction& _instruction, void* _userData) { BX_UNUSED(_offset); @@ -173,9 +159,8 @@ namespace bgfx } else { - Dx9bc dx9bc; - read(_reader, dx9bc, _err); - parse(dx9bc.shader, printAsm, _writer, _err); + BX_TRACE("Unrecognized shader binary format (magic: 0x%08x)!", magic); + BX_ERROR_SET(_err, kShaderInvalidHeader, "Failed to read shader binary. Invalid magic number."); } } diff --git a/src/shader.h b/src/shader.h index 0a2f507ebae..29f6b71a985 100644 --- a/src/shader.h +++ b/src/shader.h @@ -10,6 +10,9 @@ namespace bgfx { + BX_ERROR_RESULT(kShaderInvalidHeader, BX_MAKEFOURCC('S', 'H', 0, 1) ); + BX_ERROR_RESULT(kShaderInvalidInstruction, BX_MAKEFOURCC('S', 'H', 0, 2) ); + struct DescriptorType { enum Enum diff --git a/src/shader_dx9bc.cpp b/src/shader_dx9bc.cpp deleted file mode 100644 index 4501435c64a..00000000000 --- a/src/shader_dx9bc.cpp +++ /dev/null @@ -1,755 +0,0 @@ -/* - * Copyright 2011-2023 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE - */ - -#include "bgfx_p.h" -#include "shader_dx9bc.h" - -BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-parameter"); -BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunneeded-internal-declaration"); - -namespace bgfx -{ - struct Dx9bcOpcodeInfo - { - uint8_t numOperands; - uint8_t numValues; - }; - - static const Dx9bcOpcodeInfo s_dx9bcOpcodeInfo[] = - { - { 0, 0 }, // NOP - { 2, 0 }, // MOV - { 3, 0 }, // ADD - { 1, 0 }, // SUB - { 4, 0 }, // MAD - { 3, 0 }, // MUL - { 2, 0 }, // RCP - { 2, 0 }, // RSQ - { 3, 0 }, // DP3 - { 3, 0 }, // DP4 - { 3, 0 }, // MIN - { 3, 0 }, // MAX - { 3, 0 }, // SLT - { 3, 0 }, // SGE - { 2, 0 }, // EXP - { 2, 0 }, // LOG - { 1, 0 }, // LIT - { 1, 0 }, // DST - { 4, 0 }, // LRP - { 2, 0 }, // FRC - { 1, 0 }, // M4X4 - { 1, 0 }, // M4X3 - { 1, 0 }, // M3X4 - { 1, 0 }, // M3X3 - { 1, 0 }, // M3X2 - { 0, 0 }, // CALL - { 0, 0 }, // CALLNZ - { 0, 0 }, // LOOP - { 0, 0 }, // RET - { 0, 0 }, // ENDLOOP - { 0, 0 }, // LABEL - { 1, 1 }, // DCL - { 3, 0 }, // POW - { 1, 0 }, // CRS - { 1, 0 }, // SGN - { 1, 0 }, // ABS - { 2, 0 }, // NRM - { 4, 0 }, // SINCOS - { 1, 0 }, // REP - { 0, 0 }, // ENDREP - { 1, 0 }, // IF - { 2, 0 }, // IFC - { 0, 0 }, // ELSE - { 0, 0 }, // ENDIF - { 0, 0 }, // BREAK - { 2, 0 }, // BREAKC - { 2, 0 }, // MOVA - { 1, 4 }, // DEFB - { 1, 4 }, // DEFI - { 0, 0 }, // 0 - { 0, 0 }, // 1 - { 0, 0 }, // 2 - { 0, 0 }, // 3 - { 0, 0 }, // 4 - { 0, 0 }, // 5 - { 0, 0 }, // 6 - { 0, 0 }, // 7 - { 0, 0 }, // 8 - { 0, 0 }, // 9 - { 0, 0 }, // 10 - { 0, 0 }, // 11 - { 0, 0 }, // 12 - { 0, 0 }, // 13 - { 0, 0 }, // 14 - { 1, 0 }, // TEXCOORD - { 1, 0 }, // TEXKILL - { 3, 0 }, // TEX - { 1, 0 }, // TEXBEM - { 1, 0 }, // TEXBEM1 - { 1, 0 }, // TEXREG2AR - { 1, 0 }, // TEXREG2GB - { 1, 0 }, // TEXM3X2PAD - { 1, 0 }, // TEXM3X2TEX - { 1, 0 }, // TEXM3X3PAD - { 1, 0 }, // TEXM3X3TEX - { 1, 0 }, // TEXM3X3DIFF - { 1, 0 }, // TEXM3X3SPEC - { 1, 0 }, // TEXM3X3VSPEC - { 2, 0 }, // EXPP - { 2, 0 }, // LOGP - { 4, 0 }, // CND - { 1, 4 }, // DEF - { 1, 0 }, // TEXREG2RGB - { 1, 0 }, // TEXDP3TEX - { 1, 0 }, // TEXM3X2DEPTH - { 1, 0 }, // TEXDP3 - { 1, 0 }, // TEXM3X3 - { 1, 0 }, // TEXDEPTH - { 4, 0 }, // CMP - { 1, 0 }, // BEM - { 4, 0 }, // DP2ADD - { 2, 0 }, // DSX - { 2, 0 }, // DSY - { 5, 0 }, // TEXLDD - { 1, 0 }, // SETP - { 3, 0 }, // TEXLDL - { 0, 0 }, // BREAKP - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_dx9bcOpcodeInfo) == Dx9bcOpcode::Count); - - static const char* s_dx9bcOpcode[] = - { - "nop", - "mov", - "add", - "sub", - "mad", - "mul", - "rcp", - "rsq", - "dp3", - "dp4", - "min", - "max", - "slt", - "sge", - "exp", - "log", - "lit", - "dst", - "lrp", - "frc", - "m4x4", - "m4x3", - "m3x4", - "m3x3", - "m3x2", - "call", - "callnz", - "loop", - "ret", - "endloop", - "label", - "dcl", - "pow", - "crs", - "sgn", - "abs", - "nrm", - "sincos", - "rep", - "endrep", - "if", - "ifc", - "else", - "endif", - "break", - "breakc", - "mova", - "defb", - "defi", - - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - - "texcoord", - "texkill", - "tex", - "texbem", - "texbem1", - "texreg2ar", - "texreg2gb", - "texm3x2pad", - "texm3x2tex", - "texm3x3pad", - "texm3x3tex", - "texm3x3diff", - "texm3x3spec", - "texm3x3vspec", - "expp", - "logp", - "cnd", - "def", - "texreg2rgb", - "texdp3tex", - "texm3x2depth", - "texdp3", - "texm3x3", - "texdepth", - "cmp", - "bem", - "dp2add", - "dsx", - "dsy", - "texldd", - "setp", - "texldl", - "breakp", - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_dx9bcOpcode) == Dx9bcOpcode::Count); - - const char* getName(Dx9bcOpcode::Enum _opcode) - { - BX_ASSERT(_opcode < Dx9bcOpcode::Count, "Unknown opcode id %d (%x).", _opcode, _opcode); - return s_dx9bcOpcode[_opcode]; - } - - static const char* s_dx9bcOperandType[] = - { - "r", // Temporary Register File - "v", // Input Register File - "c", // Constant Register File - "t", // Texture Register File (PS) - "oPos", // Rasterizer Register File - "oD", // Attribute Output Register File - "oT", // Texture Coordinate Output Register File - "output", // Output register file for VS3.0+ - "i", // Constant Integer Vector Register File - "oColor", // Color Output Register File - "oDepth", // Depth Output Register File - "s", // Sampler State Register File - "c", // Constant Register File 2048 - 4095 - "c", // Constant Register File 4096 - 6143 - "c", // Constant Register File 6144 - 8191 - "b", // Constant Boolean register file - "aL", // Loop counter register file - "tempfloat16", // 16-bit float temp register file - "misctype", // Miscellaneous (single) registers. - "label", // Label - "p", // Predicate register - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_dx9bcOperandType) == Dx9bcOperandType::Count); - - static const char* s_dx9bcDeclUsage[] = - { - "position", - "blendweight", - "blendindices", - "normal", - "psize", - "texcoord", - "tangent", - "binormal", - "tessfactor", - "positiont", - "color", - "fog", - "depth", - "sample", - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_dx9bcDeclUsage) == Dx9bcDeclUsage::Count); - - int32_t read(bx::ReaderI* _reader, Dx9bcSubOperand& _subOperand, bx::Error* _err) - { - int32_t size = 0; - - uint32_t token; - size += bx::read(_reader, token, _err); - - _subOperand.type = Dx9bcOperandType::Enum( ( (token & UINT32_C(0x70000000) ) >> 28) - | ( (token & UINT32_C(0x00001800) ) >> 8) ); - _subOperand.regIndex = (token & UINT32_C(0x000007ff) ); - _subOperand.swizzleBits = uint8_t( (token & UINT32_C(0x00ff0000) ) >> 16); - - return size; - } - - int32_t write(bx::WriterI* _writer, const Dx9bcSubOperand& _subOperand, bx::Error* _err) - { - int32_t size = 0; - - uint32_t token = 0; - token |= (_subOperand.type << 28) & UINT32_C(0x70000000); - token |= (_subOperand.type << 8) & UINT32_C(0x00001800); - token |= _subOperand.regIndex & UINT32_C(0x000007ff); - token |= (_subOperand.swizzleBits << 16) & UINT32_C(0x00ff0000); - size += bx::write(_writer, token, _err); - - return size; - } - - int32_t read(bx::ReaderI* _reader, Dx9bcOperand& _operand, bx::Error* _err) - { - int32_t size = 0; - - uint32_t token; - size += bx::read(_reader, token, _err); - - _operand.type = Dx9bcOperandType::Enum( ( (token & UINT32_C(0x70000000) ) >> 28) - | ( (token & UINT32_C(0x00001800) ) >> 8) ); - _operand.regIndex = (token & UINT32_C(0x000007ff) ); - _operand.addrMode = Dx9bcOperandAddrMode::Enum( (token & UINT32_C(0x00002000) ) >> 13); - - if (_operand.destination) - { - // Destination Parameter Token - // https://msdn.microsoft.com/en-us/library/ff552738.aspx - - _operand.writeMask = uint8_t( (token & UINT32_C(0x000f0000) ) >> 16); - _operand.saturate = 0 != (token & UINT32_C(0x00100000) ); - _operand.partialPrecision = 0 != (token & UINT32_C(0x00200000) ); - _operand.centroid = 0 != (token & UINT32_C(0x00400000) ); - } - else - { - // Source Parameter Token - // https://msdn.microsoft.com/en-us/library/ff569716%28v=vs.85%29.aspx - - _operand.writeMask = 0; - _operand.saturate = false; - _operand.partialPrecision = false; - _operand.centroid = false; - _operand.swizzleBits = uint8_t( (token & UINT32_C(0x00ff0000) ) >> 16); - } - - if (Dx9bcOperandAddrMode::Relative == _operand.addrMode) - { - size += read(_reader, _operand.subOperand, _err); - } - - return size; - } - - int32_t write(bx::WriterI* _writer, const Dx9bcOperand& _operand, bx::Error* _err) - { - int32_t size = 0; - - uint32_t token = 0; - token |= (_operand.type << 28) & UINT32_C(0x70000000); - token |= (_operand.type << 8) & UINT32_C(0x00001800); - token |= _operand.regIndex & UINT32_C(0x000007ff); - token |= (_operand.addrMode << 13) & UINT32_C(0x00002000); - size += bx::write(_writer, token, _err); - - if (Dx9bcOperandAddrMode::Relative == _operand.addrMode) - { - size += write(_writer, _operand.subOperand, _err); - } - - return size; - } - - int32_t read(bx::ReaderI* _reader, Dx9bcInstruction& _instruction, bx::Error* _err) - { - int32_t size = 0; - - uint32_t token; - size += bx::read(_reader, token, _err); - - _instruction.opcode = Dx9bcOpcode::Enum( (token & UINT32_C(0x0000ffff) ) ); - - if (Dx9bcOpcode::Comment == _instruction.opcode) - { - _instruction.specific = 0; - _instruction.length = uint16_t( (token & UINT32_C(0x7fff0000) ) >> 16) + 1; - _instruction.predicated = false; - _instruction.coissue = false; - } - else - { - _instruction.specific = uint8_t( (token & UINT32_C(0x00ff0000) ) >> 16); - _instruction.length = uint8_t( (token & UINT32_C(0x0f000000) ) >> 24) + 1; - _instruction.predicated = 0 != (token & UINT32_C(0x10000000) ); - _instruction.coissue = 0 != (token & UINT32_C(0x40000000) ); - } - - if (Dx9bcOpcode::Count <= _instruction.opcode) - { - if (Dx9bcOpcode::Comment == _instruction.opcode) - { - for (int32_t ii = 0, num = _instruction.length-1; ii < num; ++ii) - { - uint32_t tmp; - size += bx::read(_reader, tmp, _err); - } - } - - return size; - } - - uint32_t currOp = 0; - - const Dx9bcOpcodeInfo& info = s_dx9bcOpcodeInfo[bx::uint32_min(_instruction.opcode, Dx9bcOpcode::Count)]; - _instruction.numOperands = info.numOperands; - _instruction.numValues = info.numValues; - - switch (_instruction.opcode) - { - case Dx9bcOpcode::SINCOS: - if (5 > _instruction.length) - { - _instruction.numOperands = 2; - } - break; - - default: - break; - }; - -//BX_TRACE("%d (%d), %d, %d, 0x%08x" -// , _instruction.opcode -// , bx::uint32_min(_instruction.opcode, Dx9bcOpcode::Count) -// , _instruction.length -// , _instruction.numOperands -// , token -// ); - - const bool valuesBeforeOpcode = false - || Dx9bcOpcode::DCL == _instruction.opcode - ; - - if (valuesBeforeOpcode - && 0 < info.numValues) - { - size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t), _err); - } - - _instruction.operand[0].destination = true; - - switch (_instruction.numOperands) - { - case 6: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 5: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 4: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 3: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 2: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 1: size += read(_reader, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 0: - if (!valuesBeforeOpcode - && 0 < info.numValues) - { - size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t), _err); - } - break; - - default: - BX_ASSERT(false, "Instruction %s with invalid number of operands %d (numValues %d)." - , getName(_instruction.opcode) - , _instruction.numOperands - , info.numValues - ); - break; - } - - return size; - } - - int32_t write(bx::WriterI* _writer, const Dx9bcInstruction& _instruction, bx::Error* _err) - { - int32_t size = 0; - - uint32_t token = 0; - token |= _instruction.opcode & UINT32_C(0x0000ffff); - token |= (_instruction.specific << 16) & UINT32_C(0x00ff0000); - token |= ( (_instruction.length - 1) << 24) & UINT32_C(0x0f000000); - size += bx::write(_writer, token, _err); - - uint32_t currOp = 0; - switch (_instruction.numOperands) - { - case 6: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 5: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 4: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 3: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 2: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 1: size += write(_writer, _instruction.operand[currOp++], _err); BX_FALLTHROUGH; - case 0: - break; - } - - return size; - } - - int32_t toString(char* _out, int32_t _size, const Dx9bcInstruction& _instruction) - { - int32_t size = 0; - - if (Dx9bcOpcode::Comment == _instruction.opcode - || Dx9bcOpcode::Phase == _instruction.opcode) - { - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "// %x" - , _instruction.opcode - ); - return size; - } - - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%2d %s" - , _instruction.opcode - , getName(_instruction.opcode) - ); - - switch (_instruction.opcode) - { - case Dx9bcOpcode::DCL: - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "_%s%d (%d, %d, %d, %d)" - , s_dx9bcDeclUsage[_instruction.value[0] & UINT32_C(0x0000000f)] - , (_instruction.value[0] & UINT32_C(0x000f0000) )>>16 - , (_instruction.value[0] & UINT32_C(0x08000000) )>>27 // ? - , (_instruction.value[0] & UINT32_C(0x10000000) )>>28 // texture2d - , (_instruction.value[0] & UINT32_C(0x20000000) )>>29 // textureCube - , (_instruction.value[0] & UINT32_C(0x40000000) )>>30 // texture3d - ); - break; - - default: - break; - } - - for (uint32_t ii = 0; ii < _instruction.numOperands; ++ii) - { - const Dx9bcOperand& operand = _instruction.operand[ii]; - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%s%d" - , 0 == ii ? " " : ", " - , s_dx9bcOperandType[operand.type] - , operand.regIndex - ); - - if (operand.destination) - { - if (0xf > operand.writeMask - && 0 < operand.writeMask) - { - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , ".%s%s%s%s" - , 0 == (operand.writeMask & 1) ? "" : "x" - , 0 == (operand.writeMask & 2) ? "" : "y" - , 0 == (operand.writeMask & 4) ? "" : "z" - , 0 == (operand.writeMask & 8) ? "" : "w" - ); - } - } - else - { - if (Dx9bcOperandAddrMode::Relative == operand.addrMode) - { - const bool array = true; - - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "[" - ); - - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%d" - , s_dx9bcOperandType[operand.subOperand.type] - , operand.subOperand.regIndex - ); - - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s" - , array ? "]" : "" - ); - } - - if (0xe4 != operand.swizzleBits) - { - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , ".%c%c%c%c" - , "xyzw"[(operand.swizzleBits )&0x3] - , "xyzw"[(operand.swizzleBits>>2)&0x3] - , "xyzw"[(operand.swizzleBits>>4)&0x3] - , "xyzw"[(operand.swizzleBits>>6)&0x3] - ); - } - } - } - - switch (_instruction.opcode) - { - case Dx9bcOpcode::DEF: - for (uint32_t jj = 0; jj < _instruction.numValues; ++jj) - { - union { int32_t i; float f; } cast = { _instruction.value[jj] }; - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%f%s" - , 0 == jj ? " (" : ", " - , cast.f - , uint32_t(_instruction.numValues-1) == jj ? ")" : "" - ); - } - break; - - case Dx9bcOpcode::DEFI: - for (uint32_t jj = 0; jj < _instruction.numValues; ++jj) - { - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%d%s" - , 0 == jj ? " (" : ", " - , _instruction.value[jj] - , uint32_t(_instruction.numValues-1) == jj ? ")" : "" - ); - } - break; - - default: - break; - } - - return size; - } - - int32_t read(bx::ReaderSeekerI* _reader, Dx9bcShader& _shader, bx::Error* _err) - { - int32_t size = 0; - int64_t offset = bx::seek(_reader); - - for (;;) - { - Dx9bcInstruction instruction; - int32_t length = read(_reader, instruction, _err); - size += length; - - if (Dx9bcOpcode::Count > instruction.opcode) - { - char temp[512]; - toString(temp, 512, instruction); - - BX_ASSERT(length/4 == instruction.length - , "%s\nread %d, expected %d" - , temp - , length/4 - , instruction.length - ); - } - else - { - if (Dx9bcOpcode::End == instruction.opcode) - { - size -= length; - break; - } - } - } - - bx::seek(_reader, offset, bx::Whence::Begin); - - _shader.byteCode.resize(size); - bx::read(_reader, _shader.byteCode.data(), size, _err); - - return size; - } - - int32_t write(bx::WriterI* _writer, const Dx9bcShader& _shader, bx::Error* _err) - { - BX_UNUSED(_writer, _shader, _err); - return 0; - } - - int32_t read(bx::ReaderSeekerI* _reader, Dx9bc& _bc, bx::Error* _err) - { - int32_t size = 0; - - size += bx::read(_reader, _bc.version, _err); - - bool pixelShader = (0xffff0000 == (_bc.version & 0xffff0000) ); - uint32_t versionMajor = (_bc.version>>8)&0xff; - uint32_t versionMinor = _bc.version&0xff; - BX_UNUSED(pixelShader, versionMajor, versionMinor); - BX_TRACE("%s shader %d.%d" - , pixelShader ? "pixel" : "vertex" - , versionMajor - , versionMinor - ); - - size += read(_reader, _bc.shader, _err); - - return size; - } - - int32_t write(bx::WriterSeekerI* _writer, const Dx9bc& _dxbc, bx::Error* _err) - { - BX_UNUSED(_writer, _dxbc, _err); - return 0; - } - - void parse(const Dx9bcShader& _src, Dx9bcParseFn _fn, void* _userData, bx::Error* _err) - { - BX_ERROR_SCOPE(_err); - - bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); - - bx::Error err; - - for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) - { - Dx9bcInstruction instruction; - uint32_t size = read(&reader, instruction, _err); - BX_ASSERT(size/4 == instruction.length, "read %d, expected %d", size/4, instruction.length); BX_UNUSED(size); - - bool cont = _fn(token * sizeof(uint32_t), instruction, _userData); - if (!cont) - { - return; - } - - token += instruction.length; - } - } - - void filter(Dx9bcShader& _dst, const Dx9bcShader& _src, Dx9bcFilterFn _fn, void* _userData, bx::Error* _err) - { - BX_ERROR_SCOPE(_err); - - bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); - - bx::MemoryBlock mb(g_allocator); - bx::MemoryWriter writer(&mb); - - for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) - { - Dx9bcInstruction instruction; - uint32_t size = read(&reader, instruction, _err); - BX_ASSERT(size/4 == instruction.length, "read %d, expected %d", size/4, instruction.length); BX_UNUSED(size); - - _fn(instruction, _userData); - - write(&writer, instruction, _err); - - token += instruction.length; - } - - uint8_t* data = (uint8_t*)mb.more(); - uint32_t size = uint32_t(bx::getSize(&writer) ); - _dst.byteCode.reserve(size); - bx::memCopy(_dst.byteCode.data(), data, size); - } - -} // namespace bgfx diff --git a/src/shader_dx9bc.h b/src/shader_dx9bc.h deleted file mode 100644 index ca239a7c5cf..00000000000 --- a/src/shader_dx9bc.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright 2011-2023 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE - */ - -#ifndef BGFX_SHADER_DX9BC_H -#define BGFX_SHADER_DX9BC_H - -#include - -namespace bgfx -{ - struct Dx9bcOpcode - { - enum Enum - { - NOP, - MOV, - ADD, - SUB, - MAD, - MUL, - RCP, - RSQ, - DP3, - DP4, - MIN, - MAX, - SLT, - SGE, - EXP, - LOG, - LIT, - DST, - LRP, - FRC, - M4X4, - M4X3, - M3X4, - M3X3, - M3X2, - CALL, - CALLNZ, - LOOP, - RET, - ENDLOOP, - LABEL, - DCL, - POW, - CRS, - SGN, - ABS, - NRM, - SINCOS, - REP, - ENDREP, - IF, - IFC, - ELSE, - ENDIF, - BREAK, - BREAKC, - MOVA, - DEFB, - DEFI, - - Unknown = 63, - TEXCOORD, - TEXKILL, - TEX, - TEXBEM, - TEXBEM1, - TEXREG2AR, - TEXREG2GB, - TEXM3X2PAD, - TEXM3X2TEX, - TEXM3X3PAD, - TEXM3X3TEX, - TEXM3X3DIFF, - TEXM3X3SPEC, - TEXM3X3VSPEC, - EXPP, - LOGP, - CND, - DEF, - TEXREG2RGB, - TEXDP3TEX, - TEXM3X2DEPTH, - TEXDP3, - TEXM3X3, - TEXDEPTH, - CMP, - BEM, - DP2ADD, - DSX, - DSY, - TEXLDD, - SETP, - TEXLDL, - BREAKP, - - Count, - - Phase = 0xfffd, - Comment = 0xfffe, - End = 0xffff - }; - }; - - const char* getName(Dx9bcOpcode::Enum _opcode); - - struct Dx9bcResourceDim - { - enum Enum - { - Unknown, - Texture1D, - Texture2D, - TextureCube, - Texture3D, - }; - }; - - struct Dx9bcOperandType - { - enum Enum - { - Temp, - Input, - Const, - Texture, - RastOut, - AttrOut, - TexCrdOut, - Output, - ConstInt, - ColorOut, - DepthOut, - Sampler, - Const2, - Const3, - Const4, - ConstBool, - Loop, - TempFloat16, - MiscType, - Label, - Predicate, - - Count - }; - }; - - struct Dx9bcDeclUsage - { - enum Enum - { - Position, - BlendWeight, - BlendIndices, - Normal, - Psize, - Texcoord, - Tangent, - Binormal, - TessFactor, - PositionT, - Color, - Fog, - Depth, - Sample, - - Count - }; - }; - - struct Dx9bcOperandAddrMode - { - enum Enum - { - Absolute, - Relative, - - Count - }; - }; - - struct Dx9bcSubOperand - { - Dx9bcSubOperand() { /* not pod */ } - - Dx9bcOperandType::Enum type; - uint32_t regIndex; - uint8_t swizzleBits; - }; - - struct Dx9bcOperand - { - Dx9bcOperand() { /* not pod */ } - - Dx9bcOperandType::Enum type; - uint32_t regIndex; - - bool destination; - - // Destination - uint8_t writeMask; - bool saturate; - bool partialPrecision; - bool centroid; - - // Source - uint8_t swizzleBits; - - Dx9bcOperandAddrMode::Enum addrMode; - Dx9bcSubOperand subOperand; - }; - - struct Dx9bcInstruction - { - Dx9bcInstruction() { /* not pod */ } - - Dx9bcOpcode::Enum opcode; - uint16_t length; - uint8_t numOperands; - uint8_t numValues; - uint8_t specific; - bool predicated; - bool coissue; - - Dx9bcOperand operand[6]; - int32_t value[4]; - }; - - int32_t read(bx::ReaderI* _reader, Dx9bcInstruction& _instruction, bx::Error* _err); - int32_t write(bx::WriterI* _writer, const Dx9bcInstruction& _instruction, bx::Error* _err); - int32_t toString(char* _out, int32_t _size, const Dx9bcInstruction& _instruction); - - struct Dx9bcShader - { - Dx9bcShader() { /* not pod */ } - - stl::vector byteCode; - }; - - int32_t read(bx::ReaderSeekerI* _reader, Dx9bcShader& _shader, bx::Error* _err); - int32_t write(bx::WriterI* _writer, const Dx9bcShader& _shader, bx::Error* _err); - - struct Dx9bc - { - Dx9bc() { /* not pod */ } - - uint32_t version; - Dx9bcShader shader; - }; - - int32_t read(bx::ReaderSeekerI* _reader, Dx9bc& _dx9bc, bx::Error* _err); - int32_t write(bx::WriterSeekerI* _writer, const Dx9bc& _dx9bc, bx::Error* _err); - - typedef bool (*Dx9bcParseFn)(uint32_t _offset, const Dx9bcInstruction& _instruction, void* _userData); - void parse(const Dx9bcShader& _src, Dx9bcParseFn _fn, void* _userData, bx::Error* _err = NULL); - - typedef void (*Dx9bcFilterFn)(Dx9bcInstruction& _instruction, void* _userData); - void filter(Dx9bcShader& _dst, const Dx9bcShader& _src, Dx9bcFilterFn _fn, void* _userData, bx::Error* _err = NULL); - -} // namespace bgfx - -#endif // BGFX_SHADER_DX9BC_H diff --git a/src/shader_spirv.cpp b/src/shader_spirv.cpp index 87a22b2811d..e796ac0c3ac 100644 --- a/src/shader_spirv.cpp +++ b/src/shader_spirv.cpp @@ -940,7 +940,7 @@ namespace bgfx if (_instruction.opcode >= SpvOpcode::Count) { - BX_ERROR_SET(_err, BGFX_SHADER_SPIRV_INVALID_INSTRUCTION, "SPIR-V: Invalid instruction."); + BX_ERROR_SET(_err, kShaderInvalidInstruction, "SPIR-V: Invalid instruction."); return size; } @@ -1158,7 +1158,7 @@ namespace bgfx || _spirv.header.magic != SPIRV_MAGIC ) { - BX_ERROR_SET(_err, BGFX_SHADER_SPIRV_INVALID_HEADER, "SPIR-V: Invalid header."); + BX_ERROR_SET(_err, kShaderInvalidHeader, "SPIR-V: Invalid header."); return size; } @@ -1198,7 +1198,7 @@ namespace bgfx , instruction.length , getName(instruction.opcode) ); - BX_ERROR_SET(_err, BGFX_SHADER_SPIRV_INVALID_INSTRUCTION, "SPIR-V: Invalid instruction."); + BX_ERROR_SET(_err, kShaderInvalidInstruction, "SPIR-V: Invalid instruction."); return; } diff --git a/src/shader_spirv.h b/src/shader_spirv.h index f94422a7f9f..736fdc225ad 100644 --- a/src/shader_spirv.h +++ b/src/shader_spirv.h @@ -8,9 +8,6 @@ #include -BX_ERROR_RESULT(BGFX_SHADER_SPIRV_INVALID_HEADER, BX_MAKEFOURCC('S', 'H', 0, 1) ); -BX_ERROR_RESULT(BGFX_SHADER_SPIRV_INVALID_INSTRUCTION, BX_MAKEFOURCC('S', 'H', 0, 2) ); - #define SPV_CHUNK_HEADER BX_MAKEFOURCC(0x03, 0x02, 0x23, 0x07) namespace bgfx diff --git a/src/version.h b/src/version.h index c0d7b9746ba..ce413a03ef8 100644 --- a/src/version.h +++ b/src/version.h @@ -9,5 +9,5 @@ * */ -#define BGFX_REV_NUMBER 8546 -#define BGFX_REV_SHA1 "878767e751e332309369beecb83e86494f90f8fa" +#define BGFX_REV_NUMBER 8603 +#define BGFX_REV_SHA1 "6a914f5b13bb8b343a0a85b29e57613c2aac718d" diff --git a/src/vertexlayout.cpp b/src/vertexlayout.cpp index e43221fa8ca..85010d8ebc1 100644 --- a/src/vertexlayout.cpp +++ b/src/vertexlayout.cpp @@ -14,15 +14,6 @@ namespace bgfx { - static const uint8_t s_attribTypeSizeD3D9[AttribType::Count][4] = - { - { 4, 4, 4, 4 }, // Uint8 - { 4, 4, 4, 4 }, // Uint10 - { 4, 4, 8, 8 }, // Int16 - { 4, 4, 8, 8 }, // Half - { 4, 8, 12, 16 }, // Float - }; - static const uint8_t s_attribTypeSizeD3D1x[AttribType::Count][4] = { { 1, 2, 4, 4 }, // Uint8 @@ -43,9 +34,8 @@ namespace bgfx static const uint8_t (*s_attribTypeSize[])[AttribType::Count][4] = { - &s_attribTypeSizeD3D9, // Noop + &s_attribTypeSizeD3D1x, // Noop &s_attribTypeSizeD3D1x, // Agc - &s_attribTypeSizeD3D9, // Direct3D9 &s_attribTypeSizeD3D1x, // Direct3D11 &s_attribTypeSizeD3D1x, // Direct3D12 &s_attribTypeSizeD3D1x, // Gnm @@ -55,7 +45,7 @@ namespace bgfx &s_attribTypeSizeGl, // OpenGL &s_attribTypeSizeD3D1x, // Vulkan &s_attribTypeSizeD3D1x, // WebGPU - &s_attribTypeSizeD3D9, // Count + &s_attribTypeSizeD3D1x, // Count }; BX_STATIC_ASSERT(BX_COUNTOF(s_attribTypeSize) == RendererType::Count+1); diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 1d05d968323..694d9d883f5 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -100,7 +100,6 @@ namespace bgfx { ShadingLang::ESSL, 300, "300_es" }, { ShadingLang::ESSL, 310, "310_es" }, { ShadingLang::ESSL, 320, "320_es" }, - { ShadingLang::HLSL, 300, "s_3_0" }, { ShadingLang::HLSL, 400, "s_4_0" }, { ShadingLang::HLSL, 500, "s_5_0" }, { ShadingLang::Metal, 1000, "metal" },