msvcrt: Added _wcsncoll and _wcsncoll_l implementation.
[wine] / dlls / d3d10core / d3d10core_private.h
CommitLineData
078fc191 1/*
ec0370a2 2 * Copyright 2008-2009 Henri Verbeet for CodeWeavers
078fc191
HV
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_D3D10CORE_PRIVATE_H
20#define __WINE_D3D10CORE_PRIVATE_H
21
22#include "wine/debug.h"
23
0a9ac7e9
HV
24#include <assert.h>
25
ccf48fff 26#define COBJMACROS
078fc191 27#include "winbase.h"
a966293f 28#include "wingdi.h"
ccf48fff
HV
29#include "winuser.h"
30#include "objbase.h"
31
32#include "d3d10.h"
a966293f
HV
33#ifdef D3D10CORE_INIT_GUID
34#include "initguid.h"
35#endif
36#include "wine/wined3d.h"
43f469ec 37#include "wine/winedxgi.h"
a9e241e4 38#include "wine/rbtree.h"
ccf48fff 39
7c3fa5d7
HV
40#define MAKE_TAG(ch0, ch1, ch2, ch3) \
41 ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
42 ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
43#define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
ec0370a2 44#define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
bb3b5a73 45#define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N')
f1023815 46#define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R')
7c3fa5d7 47
fbcce678
HV
48struct d3d10_device;
49
bb3b5a73
HV
50struct d3d10_shader_info
51{
52 const DWORD *shader_code;
53 struct wined3d_shader_signature *output_signature;
54};
55
ccf48fff 56/* TRACE helper functions */
802674e0
HV
57const char *debug_d3d10_primitive_topology(D3D10_PRIMITIVE_TOPOLOGY topology) DECLSPEC_HIDDEN;
58const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
ccf48fff 59
cc5271d1
HV
60DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
61enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
d28e5a05 62
7c3fa5d7
HV
63static inline void read_dword(const char **ptr, DWORD *d)
64{
65 memcpy(d, *ptr, sizeof(*d));
66 *ptr += sizeof(*d);
67}
68
802674e0 69void skip_dword_unknown(const char **ptr, unsigned int count) DECLSPEC_HIDDEN;
7c3fa5d7 70
7c3fa5d7 71HRESULT parse_dxbc(const char *data, SIZE_T data_size,
802674e0 72 HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) DECLSPEC_HIDDEN;
7c3fa5d7 73
e398a779 74/* ID3D10Texture2D */
e398a779
HV
75struct d3d10_texture2d
76{
7d295ddf 77 ID3D10Texture2D ID3D10Texture2D_iface;
e398a779 78 LONG refcount;
43f469ec 79
c9f116a5 80 IUnknown *dxgi_surface;
2b4c72b1 81 struct wined3d_texture *wined3d_texture;
1fa7fea8 82 D3D10_TEXTURE2D_DESC desc;
e398a779
HV
83};
84
57b196b2 85HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_device *device,
802674e0 86 const D3D10_TEXTURE2D_DESC *desc) DECLSPEC_HIDDEN;
57b196b2 87
0d4e0bc9
HV
88/* ID3D10Texture3D */
89struct d3d10_texture3d
90{
a8712d55 91 ID3D10Texture3D ID3D10Texture3D_iface;
0d4e0bc9
HV
92 LONG refcount;
93
fd8e18bd 94 struct wined3d_texture *wined3d_texture;
0d4e0bc9
HV
95 D3D10_TEXTURE3D_DESC desc;
96};
97
98HRESULT d3d10_texture3d_init(struct d3d10_texture3d *texture, struct d3d10_device *device,
99 const D3D10_TEXTURE3D_DESC *desc) DECLSPEC_HIDDEN;
100
6d2d5318 101/* ID3D10Buffer */
6d2d5318
HV
102struct d3d10_buffer
103{
0a9ac7e9 104 ID3D10Buffer ID3D10Buffer_iface;
6d2d5318 105 LONG refcount;
399d992a 106
a27ee75e 107 struct wined3d_buffer *wined3d_buffer;
6d2d5318
HV
108};
109
c2a240e8 110HRESULT d3d10_buffer_init(struct d3d10_buffer *buffer, struct d3d10_device *device,
802674e0 111 const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data) DECLSPEC_HIDDEN;
0a9ac7e9 112struct d3d10_buffer *unsafe_impl_from_ID3D10Buffer(ID3D10Buffer *iface) DECLSPEC_HIDDEN;
c2a240e8 113
4bb4bad1
HV
114/* ID3D10DepthStencilView */
115struct d3d10_depthstencil_view
116{
7aff686e 117 ID3D10DepthStencilView ID3D10DepthStencilView_iface;
4bb4bad1 118 LONG refcount;
d2fdeaa4 119
05d1fbb3 120 D3D10_DEPTH_STENCIL_VIEW_DESC desc;
d2fdeaa4 121 ID3D10Resource *resource;
4bb4bad1
HV
122};
123
d2fdeaa4 124HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view,
05d1fbb3 125 ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc) DECLSPEC_HIDDEN;
4bb4bad1 126
b279d657 127/* ID3D10RenderTargetView */
b279d657
HV
128struct d3d10_rendertarget_view
129{
dc3ee8b9 130 ID3D10RenderTargetView ID3D10RenderTargetView_iface;
b279d657
HV
131 LONG refcount;
132
2ab5b833 133 struct wined3d_rendertarget_view *wined3d_view;
2953d814 134 D3D10_RENDER_TARGET_VIEW_DESC desc;
739e302e 135 ID3D10Resource *resource;
b279d657
HV
136};
137
00a5f385 138HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
3333b124 139 ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc) DECLSPEC_HIDDEN;
0b78866a 140struct d3d10_rendertarget_view *unsafe_impl_from_ID3D10RenderTargetView(ID3D10RenderTargetView *iface) DECLSPEC_HIDDEN;
3333b124 141
6075f571
HV
142/* ID3D10ShaderResourceView */
143struct d3d10_shader_resource_view
144{
36de21b3 145 ID3D10ShaderResourceView ID3D10ShaderResourceView_iface;
6075f571 146 LONG refcount;
b6b9c156 147
83e21f87 148 D3D10_SHADER_RESOURCE_VIEW_DESC desc;
b6b9c156 149 ID3D10Resource *resource;
6075f571
HV
150};
151
b6b9c156 152HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view,
83e21f87 153 ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc) DECLSPEC_HIDDEN;
6075f571 154
03fae217 155/* ID3D10InputLayout */
03fae217
HV
156struct d3d10_input_layout
157{
3808a6f3 158 ID3D10InputLayout ID3D10InputLayout_iface;
03fae217 159 LONG refcount;
ec0370a2 160
5765632d 161 struct wined3d_vertex_declaration *wined3d_decl;
03fae217
HV
162};
163
cc68900d
HV
164HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_device *device,
165 const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
166 const void *shader_byte_code, SIZE_T shader_byte_code_length) DECLSPEC_HIDDEN;
6c866e06 167struct d3d10_input_layout *unsafe_impl_from_ID3D10InputLayout(ID3D10InputLayout *iface) DECLSPEC_HIDDEN;
ec0370a2 168
7eb63497 169/* ID3D10VertexShader */
7eb63497
HV
170struct d3d10_vertex_shader
171{
cc0cc6a8 172 ID3D10VertexShader ID3D10VertexShader_iface;
7eb63497 173 LONG refcount;
fcee1b70 174
f8f83ff2 175 struct wined3d_shader *wined3d_shader;
fcee1b70 176 struct wined3d_shader_signature output_signature;
7eb63497
HV
177};
178
0a72acc7
HV
179HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d10_device *device,
180 const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
ec415eaf 181struct d3d10_vertex_shader *unsafe_impl_from_ID3D10VertexShader(ID3D10VertexShader *iface) DECLSPEC_HIDDEN;
0a72acc7 182
972221f5 183/* ID3D10GeometryShader */
972221f5
HV
184struct d3d10_geometry_shader
185{
2b100190 186 ID3D10GeometryShader ID3D10GeometryShader_iface;
972221f5 187 LONG refcount;
73c6355d 188
f8f83ff2 189 struct wined3d_shader *wined3d_shader;
73c6355d 190 struct wined3d_shader_signature output_signature;
972221f5
HV
191};
192
73c6355d
HV
193HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct d3d10_device *device,
194 const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
9081f8af 195struct d3d10_geometry_shader *unsafe_impl_from_ID3D10GeometryShader(ID3D10GeometryShader *iface) DECLSPEC_HIDDEN;
39d6f648 196
53239a9a 197/* ID3D10PixelShader */
53239a9a
HV
198struct d3d10_pixel_shader
199{
f196050f 200 ID3D10PixelShader ID3D10PixelShader_iface;
53239a9a 201 LONG refcount;
f1023815 202
f8f83ff2 203 struct wined3d_shader *wined3d_shader;
bb3b5a73 204 struct wined3d_shader_signature output_signature;
53239a9a
HV
205};
206
dde50a47
HV
207HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_device *device,
208 const void *byte_code, SIZE_T byte_code_length) DECLSPEC_HIDDEN;
887a4ff3 209struct d3d10_pixel_shader *unsafe_impl_from_ID3D10PixelShader(ID3D10PixelShader *iface) DECLSPEC_HIDDEN;
dde50a47 210
802674e0
HV
211HRESULT shader_parse_signature(const char *data, DWORD data_size, struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;
212void shader_free_signature(struct wined3d_shader_signature *s) DECLSPEC_HIDDEN;
f1023815 213
e3ac26d5
HV
214/* ID3D10BlendState */
215struct d3d10_blend_state
216{
a4a4a420 217 ID3D10BlendState ID3D10BlendState_iface;
e3ac26d5 218 LONG refcount;
9d86c8b0 219
525e3da0 220 struct d3d10_device *device;
9d86c8b0 221 D3D10_BLEND_DESC desc;
525e3da0 222 struct wine_rb_entry entry;
e3ac26d5
HV
223};
224
525e3da0
HV
225HRESULT d3d10_blend_state_init(struct d3d10_blend_state *state, struct d3d10_device *device,
226 const D3D10_BLEND_DESC *desc) DECLSPEC_HIDDEN;
e69c28a0 227struct d3d10_blend_state *unsafe_impl_from_ID3D10BlendState(ID3D10BlendState *iface) DECLSPEC_HIDDEN;
e3ac26d5 228
d7589589
HV
229/* ID3D10DepthStencilState */
230struct d3d10_depthstencil_state
231{
815470e6 232 ID3D10DepthStencilState ID3D10DepthStencilState_iface;
d7589589 233 LONG refcount;
d1582890 234
0ffda86f 235 struct d3d10_device *device;
d1582890 236 D3D10_DEPTH_STENCIL_DESC desc;
0ffda86f 237 struct wine_rb_entry entry;
d7589589
HV
238};
239
0ffda86f 240HRESULT d3d10_depthstencil_state_init(struct d3d10_depthstencil_state *state, struct d3d10_device *device,
d1582890 241 const D3D10_DEPTH_STENCIL_DESC *desc) DECLSPEC_HIDDEN;
a78fa408
HV
242struct d3d10_depthstencil_state *unsafe_impl_from_ID3D10DepthStencilState(
243 ID3D10DepthStencilState *iface) DECLSPEC_HIDDEN;
d7589589 244
4b341c25
HV
245/* ID3D10RasterizerState */
246struct d3d10_rasterizer_state
247{
54ac05a8 248 ID3D10RasterizerState ID3D10RasterizerState_iface;
4b341c25 249 LONG refcount;
4f9814c5 250
5d386622 251 struct d3d10_device *device;
4f9814c5 252 D3D10_RASTERIZER_DESC desc;
5d386622 253 struct wine_rb_entry entry;
4b341c25
HV
254};
255
5d386622 256HRESULT d3d10_rasterizer_state_init(struct d3d10_rasterizer_state *state, struct d3d10_device *device,
4f9814c5 257 const D3D10_RASTERIZER_DESC *desc) DECLSPEC_HIDDEN;
fbcce678 258struct d3d10_rasterizer_state *unsafe_impl_from_ID3D10RasterizerState(ID3D10RasterizerState *iface) DECLSPEC_HIDDEN;
4b341c25 259
6d6d8eb1
HV
260/* ID3D10SamplerState */
261struct d3d10_sampler_state
262{
db9823e0 263 ID3D10SamplerState ID3D10SamplerState_iface;
6d6d8eb1 264 LONG refcount;
e5805c31 265
a9e241e4 266 struct d3d10_device *device;
e5805c31 267 struct wined3d_sampler *wined3d_sampler;
14eadb71 268 D3D10_SAMPLER_DESC desc;
a9e241e4 269 struct wine_rb_entry entry;
6d6d8eb1
HV
270};
271
a9e241e4
HV
272HRESULT d3d10_sampler_state_init(struct d3d10_sampler_state *state, struct d3d10_device *device,
273 const D3D10_SAMPLER_DESC *desc) DECLSPEC_HIDDEN;
e5805c31 274struct d3d10_sampler_state *unsafe_impl_from_ID3D10SamplerState(ID3D10SamplerState *iface) DECLSPEC_HIDDEN;
6d6d8eb1 275
e4e1c279
HV
276/* ID3D10Query */
277struct d3d10_query
278{
2f76274d 279 ID3D10Query ID3D10Query_iface;
e4e1c279
HV
280 LONG refcount;
281};
282
283HRESULT d3d10_query_init(struct d3d10_query *query) DECLSPEC_HIDDEN;
284
fbcce678
HV
285/* IDirect3D10Device */
286struct d3d10_device
287{
288 IUnknown IUnknown_inner;
289 ID3D10Device ID3D10Device_iface;
290 IWineDXGIDeviceParent IWineDXGIDeviceParent_iface;
291 IUnknown *outer_unk;
292 LONG refcount;
293
294 struct wined3d_device_parent device_parent;
295 struct wined3d_device *wined3d_device;
296
525e3da0 297 struct wine_rb_tree blend_states;
0ffda86f 298 struct wine_rb_tree depthstencil_states;
5d386622 299 struct wine_rb_tree rasterizer_states;
a9e241e4
HV
300 struct wine_rb_tree sampler_states;
301
e69c28a0
HV
302 struct d3d10_blend_state *blend_state;
303 float blend_factor[4];
304 UINT sample_mask;
a78fa408
HV
305 struct d3d10_depthstencil_state *depth_stencil_state;
306 UINT stencil_ref;
fbcce678
HV
307 struct d3d10_rasterizer_state *rasterizer_state;
308};
309
a9e241e4 310HRESULT d3d10_device_init(struct d3d10_device *device, void *outer_unknown) DECLSPEC_HIDDEN;
fbcce678 311
4ba8261a
HV
312/* Layered device */
313enum dxgi_device_layer_id
314{
315 DXGI_DEVICE_LAYER_DEBUG1 = 0x8,
316 DXGI_DEVICE_LAYER_THREAD_SAFE = 0x10,
317 DXGI_DEVICE_LAYER_DEBUG2 = 0x20,
318 DXGI_DEVICE_LAYER_SWITCH_TO_REF = 0x30,
319 DXGI_DEVICE_LAYER_D3D10_DEVICE = 0xffffffff,
320};
321
322struct layer_get_size_args
323{
324 DWORD unknown0;
325 DWORD unknown1;
326 DWORD *unknown2;
327 DWORD *unknown3;
328 IDXGIAdapter *adapter;
329 WORD interface_major;
330 WORD interface_minor;
331 WORD version_build;
332 WORD version_revision;
333};
334
335struct dxgi_device_layer
336{
337 enum dxgi_device_layer_id id;
338 HRESULT (WINAPI *init)(enum dxgi_device_layer_id id, DWORD *count, DWORD *values);
339 UINT (WINAPI *get_size)(enum dxgi_device_layer_id id, struct layer_get_size_args *args, DWORD unknown0);
340 HRESULT (WINAPI *create)(enum dxgi_device_layer_id id, void **layer_base, DWORD unknown0,
341 void *device_object, REFIID riid, void **device_layer);
342};
343
3505b5cf 344HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, IDXGIAdapter *adapter,
efbd38ae 345 UINT flags, void *unknown0, void **device);
4ba8261a
HV
346HRESULT WINAPI DXGID3D10RegisterLayers(const struct dxgi_device_layer *layers, UINT layer_count);
347
078fc191 348#endif /* __WINE_D3D10CORE_PRIVATE_H */