2 * Copyright 2008 Luis Busquets
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __D3DX9SHADER_H__
22 #define __D3DX9SHADER_H__
24 #define D3DXSHADER_DEBUG 0x1
25 #define D3DXSHADER_SKIPVALIDATION 0x2
26 #define D3DXSHADER_SKIPOPTIMIZATION 0x4
27 #define D3DXSHADER_PACKMATRIX_ROWMAJOR 0x8
28 #define D3DXSHADER_PACKMATRIX_COLUMNMAJOR 0x10
29 #define D3DXSHADER_PARTIALPRECISION 0x20
30 #define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT 0x40
31 #define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT 0x80
32 #define D3DXSHADER_NO_PRESHADER 0x100
33 #define D3DXSHADER_AVOID_FLOW_CONTROL 0x200
34 #define D3DXSHADER_PREFER_FLOW_CONTROL 0x400
35 #define D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY 0x1000
36 #define D3DXSHADER_IEEE_STRICTNESS 0x2000
38 #define D3DXSHADER_OPTIMIZATION_LEVEL0 0x4000
39 #define D3DXSHADER_OPTIMIZATION_LEVEL1 0x0
40 #define D3DXSHADER_OPTIMIZATION_LEVEL2 0xC000
41 #define D3DXSHADER_OPTIMIZATION_LEVEL3 0x8000
43 #define D3DXSHADER_USE_LEGACY_D3DX9_31_DLL 0x10000
45 typedef LPCSTR D3DXHANDLE
;
47 typedef enum D3DXPARAMETER_CLASS
52 D3DXPC_MATRIX_COLUMNS
,
55 D3DXPC_FORCE_DWORD
= 0x7fffffff,
56 } D3DXPARAMETER_CLASS
, *LPD3DXPARAMETER_CLASS
;
58 typedef enum D3DXPARAMETER_TYPE
78 D3DXPT_VERTEXFRAGMENT
,
80 D3DXPT_FORCE_DWORD
= 0x7fffffff,
81 } D3DXPARAMETER_TYPE
, *LPD3DXPARAMETER_TYPE
;
83 typedef struct _D3DXMACRO
{
86 } D3DXMACRO
, *LPD3DXMACRO
;
88 typedef enum _D3DXINCLUDE_TYPE
92 D3DXINC_FORCE_DWORD
= 0x7fffffff,
93 } D3DXINCLUDE_TYPE
, *LPD3DXINCLUDE_TYPE
;
96 #define INTERFACE ID3DXInclude
98 DECLARE_INTERFACE(ID3DXInclude
)
100 STDMETHOD(Open
)(THIS_ D3DXINCLUDE_TYPE include_type
, LPCSTR filename
, LPCVOID parent_data
, LPCVOID
*data
, UINT
*bytes
) PURE
;
101 STDMETHOD(Close
)(THIS_ LPCVOID data
) PURE
;
104 #define ID3DXInclude_Open(p,a,b,c,d,e) (p)->lpVtbl->Open(p,a,b,c,d,e)
105 #define ID3DXInclude_Close(p,a) (p)->lpVtbl->Close(p,a)
107 typedef struct ID3DXInclude
*LPD3DXINCLUDE
;
113 LPCSTR WINAPI
D3DXGetPixelShaderProfile(LPDIRECT3DDEVICE9 device
);
114 UINT WINAPI
D3DXGetShaderSize(const DWORD
*byte_code
);
115 DWORD WINAPI
D3DXGetShaderVersion(const DWORD
*byte_code
);
116 LPCSTR WINAPI
D3DXGetVertexShaderProfile(LPDIRECT3DDEVICE9 device
);
118 HRESULT WINAPI
D3DXAssembleShaderFromFileA(LPCSTR filename
,
119 CONST D3DXMACRO
* defines
,
120 LPD3DXINCLUDE include
,
122 LPD3DXBUFFER
* shader
,
123 LPD3DXBUFFER
* error_messages
);
125 HRESULT WINAPI
D3DXAssembleShaderFromFileW(LPCWSTR filename
,
126 CONST D3DXMACRO
* defines
,
127 LPD3DXINCLUDE include
,
129 LPD3DXBUFFER
* shader
,
130 LPD3DXBUFFER
* error_messages
);
132 HRESULT WINAPI
D3DXAssembleShaderFromResourceA(HMODULE module
,
134 CONST D3DXMACRO
* defines
,
135 LPD3DXINCLUDE include
,
137 LPD3DXBUFFER
* shader
,
138 LPD3DXBUFFER
* error_messages
);
140 HRESULT WINAPI
D3DXAssembleShaderFromResourceW(HMODULE module
,
142 CONST D3DXMACRO
* defines
,
143 LPD3DXINCLUDE include
,
145 LPD3DXBUFFER
* shader
,
146 LPD3DXBUFFER
* error_messages
);
148 HRESULT WINAPI
D3DXAssembleShader(LPCSTR data
,
150 CONST D3DXMACRO
* defines
,
151 LPD3DXINCLUDE include
,
153 LPD3DXBUFFER
* shader
,
154 LPD3DXBUFFER
* error_messages
);
160 #endif /* __D3DX9SHADER_H__ */