joy.cpl: Remove uneeded FIXME message.
[wine] / dlls / d3d10 / d3d10_private.h
1 /*
2  * Copyright 2008-2009 Henri Verbeet for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #ifndef __WINE_D3D10_PRIVATE_H
20 #define __WINE_D3D10_PRIVATE_H
21
22 #include "wine/debug.h"
23 #include "wine/rbtree.h"
24
25 #define COBJMACROS
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "objbase.h"
29
30 #include "d3d10.h"
31 #include "d3dcompiler.h"
32
33 /*
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.
37  */
38 #define D3DERR_INVALIDCALL 0x8876086c
39
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;
45
46 void *d3d10_rb_alloc(size_t size) DECLSPEC_HIDDEN;
47 void *d3d10_rb_realloc(void *ptr, size_t size) DECLSPEC_HIDDEN;
48 void d3d10_rb_free(void *ptr) DECLSPEC_HIDDEN;
49
50 enum d3d10_effect_object_type
51 {
52     D3D10_EOT_VERTEXSHADER = 0x6,
53     D3D10_EOT_PIXELSHADER = 0x7,
54     D3D10_EOT_GEOMETRYSHADER = 0x8,
55     D3D10_EOT_STENCIL_REF = 0x9,
56     D3D10_EOT_BLEND_FACTOR = 0xa,
57     D3D10_EOT_SAMPLE_MASK = 0xb,
58 };
59
60 enum d3d10_effect_object_operation
61 {
62     D3D10_EOO_VALUE = 1,
63     D3D10_EOO_PARSED_OBJECT = 2,
64     D3D10_EOO_PARSED_OBJECT_INDEX = 3,
65     D3D10_EOO_ANONYMOUS_SHADER = 7,
66 };
67
68 struct d3d10_effect_object
69 {
70     struct d3d10_effect_pass *pass;
71     enum d3d10_effect_object_type type;
72     DWORD idx_offset;
73     DWORD index;
74     void *data;
75 };
76
77 struct d3d10_effect_shader_signature
78 {
79     char *signature;
80     UINT signature_size;
81     UINT element_count;
82     D3D10_SIGNATURE_PARAMETER_DESC *elements;
83 };
84
85 struct d3d10_effect_shader_variable
86 {
87     struct d3d10_effect_shader_signature input_signature;
88     struct d3d10_effect_shader_signature output_signature;
89     union
90     {
91         ID3D10VertexShader *vs;
92         ID3D10PixelShader *ps;
93         ID3D10GeometryShader *gs;
94     } shader;
95 };
96
97 /* ID3D10EffectType */
98 struct d3d10_effect_type
99 {
100     ID3D10EffectType ID3D10EffectType_iface;
101
102     char *name;
103     D3D10_SHADER_VARIABLE_TYPE basetype;
104     D3D10_SHADER_VARIABLE_CLASS type_class;
105
106     DWORD id;
107     struct wine_rb_entry entry;
108     struct d3d10_effect *effect;
109
110     DWORD element_count;
111     DWORD size_unpacked;
112     DWORD stride;
113     DWORD size_packed;
114     DWORD member_count;
115     DWORD column_count;
116     DWORD row_count;
117     struct d3d10_effect_type *elementtype;
118     struct d3d10_effect_type_member *members;
119 };
120
121 struct d3d10_effect_type_member
122 {
123     char *name;
124     char *semantic;
125     DWORD buffer_offset;
126     struct d3d10_effect_type *type;
127 };
128
129 /* ID3D10EffectVariable */
130 struct d3d10_effect_variable
131 {
132     ID3D10EffectVariable ID3D10EffectVariable_iface;
133
134     struct d3d10_effect_variable *buffer;
135     struct d3d10_effect_type *type;
136
137     void *data;
138     char *name;
139     char *semantic;
140     DWORD buffer_offset;
141     DWORD annotation_count;
142     DWORD flag;
143     DWORD data_size;
144     struct d3d10_effect *effect;
145     struct d3d10_effect_variable *elements;
146     struct d3d10_effect_variable *members;
147     struct d3d10_effect_variable *annotations;
148 };
149
150 /* ID3D10EffectPass */
151 struct d3d10_effect_pass
152 {
153     ID3D10EffectPass ID3D10EffectPass_iface;
154
155     struct d3d10_effect_technique *technique;
156     char *name;
157     DWORD start;
158     DWORD object_count;
159     DWORD annotation_count;
160     struct d3d10_effect_object *objects;
161     struct d3d10_effect_variable *annotations;
162
163     UINT stencil_ref;
164     UINT sample_mask;
165     float blend_factor[4];
166 };
167
168 /* ID3D10EffectTechnique */
169 struct d3d10_effect_technique
170 {
171     ID3D10EffectTechnique ID3D10EffectTechnique_iface;
172
173     struct d3d10_effect *effect;
174     char *name;
175     DWORD pass_count;
176     DWORD annotation_count;
177     struct d3d10_effect_pass *passes;
178     struct d3d10_effect_variable *annotations;
179 };
180
181 struct d3d10_effect_anonymous_shader
182 {
183     struct d3d10_effect_variable shader;
184     struct d3d10_effect_type type;
185 };
186
187 /* ID3D10Effect */
188 extern const struct ID3D10EffectVtbl d3d10_effect_vtbl DECLSPEC_HIDDEN;
189 struct d3d10_effect
190 {
191     ID3D10Effect ID3D10Effect_iface;
192     LONG refcount;
193
194     ID3D10Device *device;
195     DWORD version;
196     DWORD local_buffer_count;
197     DWORD variable_count;
198     DWORD local_variable_count;
199     DWORD sharedbuffers_count;
200     DWORD sharedobjects_count;
201     DWORD technique_count;
202     DWORD index_offset;
203     DWORD texture_count;
204     DWORD dephstencilstate_count;
205     DWORD blendstate_count;
206     DWORD rasterizerstate_count;
207     DWORD samplerstate_count;
208     DWORD rendertargetview_count;
209     DWORD depthstencilview_count;
210     DWORD used_shader_count;
211     DWORD anonymous_shader_count;
212
213     DWORD used_shader_current;
214     DWORD anonymous_shader_current;
215
216     struct wine_rb_tree types;
217     struct d3d10_effect_variable *local_buffers;
218     struct d3d10_effect_variable *local_variables;
219     struct d3d10_effect_anonymous_shader *anonymous_shaders;
220     struct d3d10_effect_variable **used_shaders;
221     struct d3d10_effect_technique *techniques;
222 };
223
224 /* ID3D10ShaderReflection */
225 extern const struct ID3D10ShaderReflectionVtbl d3d10_shader_reflection_vtbl DECLSPEC_HIDDEN;
226 struct d3d10_shader_reflection
227 {
228     ID3D10ShaderReflection ID3D10ShaderReflection_iface;
229     LONG refcount;
230 };
231
232 HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T data_size) DECLSPEC_HIDDEN;
233
234 /* D3D10Core */
235 HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter,
236         UINT flags, void *unknown0, ID3D10Device **device);
237
238 #define MAKE_TAG(ch0, ch1, ch2, ch3) \
239     ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
240     ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
241 #define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
242 #define TAG_FX10 MAKE_TAG('F', 'X', '1', '0')
243 #define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
244 #define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N')
245 #define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R')
246
247 HRESULT parse_dxbc(const char *data, SIZE_T data_size,
248         HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) DECLSPEC_HIDDEN;
249
250 static inline void read_dword(const char **ptr, DWORD *d)
251 {
252     memcpy(d, *ptr, sizeof(*d));
253     *ptr += sizeof(*d);
254 }
255
256 static inline void write_dword(char **ptr, DWORD d)
257 {
258     memcpy(*ptr, &d, sizeof(d));
259     *ptr += sizeof(d);
260 }
261
262 void skip_dword_unknown(const char *location, const char **ptr, unsigned int count) DECLSPEC_HIDDEN;
263 void write_dword_unknown(char **ptr, DWORD d) DECLSPEC_HIDDEN;
264
265 #endif /* __WINE_D3D10_PRIVATE_H */