2 * Copyright 2008-2009 Henri Verbeet for CodeWeavers
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
19 #ifndef __WINE_D3D10_PRIVATE_H
20 #define __WINE_D3D10_PRIVATE_H
22 #include "wine/debug.h"
23 #include "wine/rbtree.h"
31 #include "d3dcompiler.h"
34 * This doesn't belong here, but for some functions it is possible to return that value,
35 * see http://msdn.microsoft.com/en-us/library/bb205278%28v=VS.85%29.aspx
36 * The original definition is in D3DX10core.h.
38 #define D3DERR_INVALIDCALL 0x8876086c
40 /* TRACE helper functions */
41 const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type
) DECLSPEC_HIDDEN
;
42 const char *debug_d3d10_shader_variable_class(D3D10_SHADER_VARIABLE_CLASS c
) DECLSPEC_HIDDEN
;
43 const char *debug_d3d10_shader_variable_type(D3D10_SHADER_VARIABLE_TYPE t
) DECLSPEC_HIDDEN
;
44 const char *debug_d3d10_device_state_types(D3D10_DEVICE_STATE_TYPES t
) DECLSPEC_HIDDEN
;
46 enum d3d10_effect_object_type
48 D3D10_EOT_RASTERIZER_STATE
= 0x0,
49 D3D10_EOT_DEPTH_STENCIL_STATE
= 0x1,
50 D3D10_EOT_BLEND_STATE
= 0x2,
51 D3D10_EOT_VERTEXSHADER
= 0x6,
52 D3D10_EOT_PIXELSHADER
= 0x7,
53 D3D10_EOT_GEOMETRYSHADER
= 0x8,
54 D3D10_EOT_STENCIL_REF
= 0x9,
55 D3D10_EOT_BLEND_FACTOR
= 0xa,
56 D3D10_EOT_SAMPLE_MASK
= 0xb,
59 enum d3d10_effect_object_operation
62 D3D10_EOO_PARSED_OBJECT
= 2,
63 D3D10_EOO_PARSED_OBJECT_INDEX
= 3,
64 D3D10_EOO_ANONYMOUS_SHADER
= 7,
67 struct d3d10_effect_object
69 struct d3d10_effect_pass
*pass
;
70 enum d3d10_effect_object_type type
;
73 ID3D10RasterizerState
*rs
;
74 ID3D10DepthStencilState
*ds
;
76 ID3D10VertexShader
*vs
;
77 ID3D10PixelShader
*ps
;
78 ID3D10GeometryShader
*gs
;
82 struct d3d10_effect_shader_signature
87 D3D10_SIGNATURE_PARAMETER_DESC
*elements
;
90 struct d3d10_effect_shader_variable
92 struct d3d10_effect_shader_signature input_signature
;
93 struct d3d10_effect_shader_signature output_signature
;
96 ID3D10VertexShader
*vs
;
97 ID3D10PixelShader
*ps
;
98 ID3D10GeometryShader
*gs
;
102 struct d3d10_effect_state_object_variable
106 D3D10_RASTERIZER_DESC rasterizer
;
107 D3D10_DEPTH_STENCIL_DESC depth_stencil
;
108 D3D10_BLEND_DESC blend
;
109 D3D10_SAMPLER_DESC sampler
;
113 ID3D10RasterizerState
*rasterizer
;
114 ID3D10DepthStencilState
*depth_stencil
;
115 ID3D10BlendState
*blend
;
116 ID3D10SamplerState
*sampler
;
120 /* ID3D10EffectType */
121 struct d3d10_effect_type
123 ID3D10EffectType ID3D10EffectType_iface
;
126 D3D10_SHADER_VARIABLE_TYPE basetype
;
127 D3D10_SHADER_VARIABLE_CLASS type_class
;
130 struct wine_rb_entry entry
;
131 struct d3d10_effect
*effect
;
140 struct d3d10_effect_type
*elementtype
;
141 struct d3d10_effect_type_member
*members
;
144 struct d3d10_effect_type_member
149 struct d3d10_effect_type
*type
;
152 /* ID3D10EffectVariable */
153 struct d3d10_effect_variable
155 ID3D10EffectVariable ID3D10EffectVariable_iface
;
157 struct d3d10_effect_variable
*buffer
;
158 struct d3d10_effect_type
*type
;
163 DWORD annotation_count
;
166 struct d3d10_effect
*effect
;
167 struct d3d10_effect_variable
*elements
;
168 struct d3d10_effect_variable
*members
;
169 struct d3d10_effect_variable
*annotations
;
173 struct d3d10_effect_state_object_variable state
;
174 struct d3d10_effect_shader_variable shader
;
178 /* ID3D10EffectPass */
179 struct d3d10_effect_pass
181 ID3D10EffectPass ID3D10EffectPass_iface
;
183 struct d3d10_effect_technique
*technique
;
187 DWORD annotation_count
;
188 struct d3d10_effect_object
*objects
;
189 struct d3d10_effect_variable
*annotations
;
191 D3D10_PASS_SHADER_DESC vs
;
192 D3D10_PASS_SHADER_DESC ps
;
193 D3D10_PASS_SHADER_DESC gs
;
196 float blend_factor
[4];
199 /* ID3D10EffectTechnique */
200 struct d3d10_effect_technique
202 ID3D10EffectTechnique ID3D10EffectTechnique_iface
;
204 struct d3d10_effect
*effect
;
207 DWORD annotation_count
;
208 struct d3d10_effect_pass
*passes
;
209 struct d3d10_effect_variable
*annotations
;
212 struct d3d10_effect_anonymous_shader
214 struct d3d10_effect_variable shader
;
215 struct d3d10_effect_type type
;
219 extern const struct ID3D10EffectVtbl d3d10_effect_vtbl DECLSPEC_HIDDEN
;
222 ID3D10Effect ID3D10Effect_iface
;
225 ID3D10Device
*device
;
227 DWORD local_buffer_count
;
228 DWORD variable_count
;
229 DWORD local_variable_count
;
230 DWORD sharedbuffers_count
;
231 DWORD sharedobjects_count
;
232 DWORD technique_count
;
235 DWORD depthstencilstate_count
;
236 DWORD blendstate_count
;
237 DWORD rasterizerstate_count
;
238 DWORD samplerstate_count
;
239 DWORD rendertargetview_count
;
240 DWORD depthstencilview_count
;
241 DWORD used_shader_count
;
242 DWORD anonymous_shader_count
;
244 DWORD used_shader_current
;
245 DWORD anonymous_shader_current
;
247 struct wine_rb_tree types
;
248 struct d3d10_effect_variable
*local_buffers
;
249 struct d3d10_effect_variable
*local_variables
;
250 struct d3d10_effect_anonymous_shader
*anonymous_shaders
;
251 struct d3d10_effect_variable
**used_shaders
;
252 struct d3d10_effect_technique
*techniques
;
255 /* ID3D10ShaderReflection */
256 extern const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl DECLSPEC_HIDDEN
;
257 struct d3d10_shader_reflection
259 ID3D10ShaderReflection ID3D10ShaderReflection_iface
;
263 HRESULT
d3d10_effect_parse(struct d3d10_effect
*This
, const void *data
, SIZE_T data_size
) DECLSPEC_HIDDEN
;
266 HRESULT WINAPI
D3D10CoreCreateDevice(IDXGIFactory
*factory
, IDXGIAdapter
*adapter
,
267 unsigned int flags
, D3D_FEATURE_LEVEL feature_level
, ID3D10Device
**device
);
269 #define MAKE_TAG(ch0, ch1, ch2, ch3) \
270 ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
271 ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
272 #define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
273 #define TAG_FX10 MAKE_TAG('F', 'X', '1', '0')
274 #define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
275 #define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N')
276 #define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R')
278 HRESULT
parse_dxbc(const char *data
, SIZE_T data_size
,
279 HRESULT (*chunk_handler
)(const char *data
, DWORD data_size
, DWORD tag
, void *ctx
), void *ctx
) DECLSPEC_HIDDEN
;
281 static inline void *d3d10_calloc(SIZE_T count
, SIZE_T size
)
283 if (count
> ~(SIZE_T
)0 / size
)
285 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, count
* size
);
288 static inline void read_dword(const char **ptr
, DWORD
*d
)
290 memcpy(d
, *ptr
, sizeof(*d
));
294 static inline void write_dword(char **ptr
, DWORD d
)
296 memcpy(*ptr
, &d
, sizeof(d
));
300 static inline BOOL
require_space(size_t offset
, size_t count
, size_t size
, size_t data_size
)
302 return !count
|| (data_size
- offset
) / count
>= size
;
305 void skip_dword_unknown(const char *location
, const char **ptr
, unsigned int count
) DECLSPEC_HIDDEN
;
306 void write_dword_unknown(char **ptr
, DWORD d
) DECLSPEC_HIDDEN
;
308 #endif /* __WINE_D3D10_PRIVATE_H */