2 * Direct3D wine internal private include file
4 * Copyright 2002-2003 The wine-d3d team
5 * Copyright 2002-2003 Raphael Junqueira
6 * Copyright 2002-2003, 2004 Jason Edmeades
7 * Copyright 2005 Oliver Stieber
8 * Copyright 2006-2011, 2013 Stefan Dösinger for CodeWeavers
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #ifndef __WINE_WINED3D_PRIVATE_H
26 #define __WINE_WINED3D_PRIVATE_H
28 #ifdef USE_WIN32_OPENGL
29 #define WINE_GLAPI __stdcall
39 #define WIN32_NO_STATUS
40 #define NONAMELESSUNION
41 #define NONAMELESSSTRUCT
49 #include "ddk/d3dkmthk.h"
50 #include "wine/debug.h"
51 #include "wine/heap.h"
52 #include "wine/unicode.h"
55 #include "wine/wined3d.h"
56 #include "wined3d_gl.h"
57 #include "wined3d_vk.h"
58 #include "wine/list.h"
59 #include "wine/rbtree.h"
60 #include "wine/wgl_driver.h"
62 #define MAKEDWORD_VERSION(maj, min) (((maj & 0xffffu) << 16) | (min & 0xffffu))
65 #define WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT 0x00000001
66 #define WINED3D_QUIRK_SET_TEXCOORD_W 0x00000002
67 #define WINED3D_QUIRK_GLSL_CLIP_VARYING 0x00000004
68 #define WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA 0x00000008
69 #define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010
70 #define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020
71 #define WINED3D_QUIRK_BROKEN_RGBA16 0x00000040
72 #define WINED3D_QUIRK_INFO_LOG_SPAM 0x00000080
73 #define WINED3D_QUIRK_LIMITED_TEX_FILTERING 0x00000100
74 #define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200
75 #define WINED3D_QUIRK_NO_INDEPENDENT_BIT_DEPTHS 0x00000400
77 struct wined3d_fragment_pipe_ops
;
78 struct wined3d_adapter
;
79 struct wined3d_context
;
81 struct wined3d_swapchain_gl
;
82 struct wined3d_texture_gl
;
83 struct wined3d_vertex_pipe_ops
;
87 WINED3D_FFP_POSITION
= 0,
88 WINED3D_FFP_BLENDWEIGHT
= 1,
89 WINED3D_FFP_BLENDINDICES
= 2,
90 WINED3D_FFP_NORMAL
= 3,
91 WINED3D_FFP_PSIZE
= 4,
92 WINED3D_FFP_DIFFUSE
= 5,
93 WINED3D_FFP_SPECULAR
= 6,
94 WINED3D_FFP_TEXCOORD0
= 7,
95 WINED3D_FFP_TEXCOORD1
= 8,
96 WINED3D_FFP_TEXCOORD2
= 9,
97 WINED3D_FFP_TEXCOORD3
= 10,
98 WINED3D_FFP_TEXCOORD4
= 11,
99 WINED3D_FFP_TEXCOORD5
= 12,
100 WINED3D_FFP_TEXCOORD6
= 13,
101 WINED3D_FFP_TEXCOORD7
= 14,
102 WINED3D_FFP_ATTRIBS_COUNT
= 15,
105 enum wined3d_ffp_emit_idx
107 WINED3D_FFP_EMIT_FLOAT1
,
108 WINED3D_FFP_EMIT_FLOAT2
,
109 WINED3D_FFP_EMIT_FLOAT3
,
110 WINED3D_FFP_EMIT_FLOAT4
,
111 WINED3D_FFP_EMIT_D3DCOLOR
,
112 WINED3D_FFP_EMIT_UBYTE4
,
113 WINED3D_FFP_EMIT_SHORT2
,
114 WINED3D_FFP_EMIT_SHORT4
,
115 WINED3D_FFP_EMIT_UBYTE4N
,
116 WINED3D_FFP_EMIT_SHORT2N
,
117 WINED3D_FFP_EMIT_SHORT4N
,
118 WINED3D_FFP_EMIT_USHORT2N
,
119 WINED3D_FFP_EMIT_USHORT4N
,
120 WINED3D_FFP_EMIT_UDEC3
,
121 WINED3D_FFP_EMIT_DEC3N
,
122 WINED3D_FFP_EMIT_FLOAT16_2
,
123 WINED3D_FFP_EMIT_FLOAT16_4
,
124 WINED3D_FFP_EMIT_INVALID
,
125 WINED3D_FFP_EMIT_COUNT
,
128 /* Texture format fixups */
130 enum fixup_channel_source
132 CHANNEL_SOURCE_ZERO
= 0,
133 CHANNEL_SOURCE_ONE
= 1,
134 CHANNEL_SOURCE_X
= 2,
135 CHANNEL_SOURCE_Y
= 3,
136 CHANNEL_SOURCE_Z
= 4,
137 CHANNEL_SOURCE_W
= 5,
138 CHANNEL_SOURCE_COMPLEX0
= 6,
139 CHANNEL_SOURCE_COMPLEX1
= 7,
144 COMPLEX_FIXUP_NONE
= 0,
145 COMPLEX_FIXUP_YUY2
= 1,
146 COMPLEX_FIXUP_UYVY
= 2,
147 COMPLEX_FIXUP_YV12
= 3,
148 COMPLEX_FIXUP_P8
= 4,
149 COMPLEX_FIXUP_NV12
= 5,
152 #include <pshpack2.h>
153 struct color_fixup_desc
155 unsigned short x_sign_fixup
: 1;
156 unsigned short x_source
: 3;
157 unsigned short y_sign_fixup
: 1;
158 unsigned short y_source
: 3;
159 unsigned short z_sign_fixup
: 1;
160 unsigned short z_source
: 3;
161 unsigned short w_sign_fixup
: 1;
162 unsigned short w_source
: 3;
166 struct wined3d_d3d_limits
168 unsigned int vs_version
, hs_version
, ds_version
, gs_version
, ps_version
, cs_version
;
169 DWORD vs_uniform_count
;
170 DWORD ps_uniform_count
;
171 unsigned int varying_count
;
172 unsigned int ffp_textures
;
173 unsigned int ffp_blend_stages
;
174 unsigned int ffp_vertex_blend_matrices
;
175 unsigned int active_light_count
;
177 unsigned int max_rt_count
;
178 unsigned int max_clip_distances
;
179 unsigned int texture_size
;
183 typedef void (WINE_GLAPI
*wined3d_ffp_attrib_func
)(const void *data
);
184 typedef void (WINE_GLAPI
*wined3d_ffp_texcoord_func
)(GLenum unit
, const void *data
);
185 typedef void (WINE_GLAPI
*wined3d_generic_attrib_func
)(GLuint idx
, const void *data
);
186 extern wined3d_ffp_attrib_func specular_func_3ubv DECLSPEC_HIDDEN
;
188 struct wined3d_ffp_attrib_ops
190 wined3d_ffp_attrib_func position
[WINED3D_FFP_EMIT_COUNT
];
191 wined3d_ffp_attrib_func diffuse
[WINED3D_FFP_EMIT_COUNT
];
192 wined3d_ffp_attrib_func specular
[WINED3D_FFP_EMIT_COUNT
];
193 wined3d_ffp_attrib_func normal
[WINED3D_FFP_EMIT_COUNT
];
194 wined3d_ffp_texcoord_func texcoord
[WINED3D_FFP_EMIT_COUNT
];
195 wined3d_generic_attrib_func generic
[WINED3D_FFP_EMIT_COUNT
];
198 struct wined3d_d3d_info
200 struct wined3d_d3d_limits limits
;
201 struct wined3d_ffp_attrib_ops ffp_attrib_ops
;
202 uint32_t wined3d_creation_flags
;
204 uint32_t emulated_flatshading
: 1;
205 uint32_t ffp_generic_attributes
: 1;
206 uint32_t ffp_alpha_test
: 1;
207 uint32_t vs_clipping
: 1;
208 uint32_t shader_color_key
: 1;
209 uint32_t shader_double_precision
: 1;
210 uint32_t shader_output_interpolation
: 1;
211 uint32_t viewport_array_index_any_shader
: 1;
212 uint32_t texture_npot
: 1;
213 uint32_t texture_npot_conditional
: 1;
214 uint32_t draw_base_vertex_offset
: 1;
215 uint32_t vertex_bgra
: 1;
216 uint32_t texture_swizzle
: 1;
217 uint32_t srgb_read_control
: 1;
218 uint32_t srgb_write_control
: 1;
219 uint32_t clip_control
: 1;
220 uint32_t full_ffp_varyings
: 1;
221 enum wined3d_feature_level feature_level
;
223 DWORD multisample_draw_location
;
226 static const struct color_fixup_desc COLOR_FIXUP_IDENTITY
=
227 {0, CHANNEL_SOURCE_X
, 0, CHANNEL_SOURCE_Y
, 0, CHANNEL_SOURCE_Z
, 0, CHANNEL_SOURCE_W
};
229 static inline struct color_fixup_desc
create_complex_fixup_desc(enum complex_fixup complex_fixup
)
231 struct color_fixup_desc fixup
=
233 0u, complex_fixup
& (1u << 0) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
234 0u, complex_fixup
& (1u << 1) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
235 0u, complex_fixup
& (1u << 2) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
236 0u, complex_fixup
& (1u << 3) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
241 static inline BOOL
is_identity_fixup(struct color_fixup_desc fixup
)
243 return !memcmp(&fixup
, &COLOR_FIXUP_IDENTITY
, sizeof(fixup
));
246 static inline BOOL
is_complex_fixup(struct color_fixup_desc fixup
)
248 return fixup
.x_source
== CHANNEL_SOURCE_COMPLEX0
|| fixup
.x_source
== CHANNEL_SOURCE_COMPLEX1
;
251 static inline BOOL
is_scaling_fixup(struct color_fixup_desc fixup
)
253 return fixup
.x_sign_fixup
|| fixup
.y_sign_fixup
|| fixup
.z_sign_fixup
|| fixup
.w_sign_fixup
;
256 static inline BOOL
is_same_fixup(struct color_fixup_desc f1
, struct color_fixup_desc f2
)
258 return f1
.x_sign_fixup
== f2
.x_sign_fixup
&& f1
.x_source
== f2
.x_source
259 && f1
.y_sign_fixup
== f2
.y_sign_fixup
&& f1
.y_source
== f2
.y_source
260 && f1
.z_sign_fixup
== f2
.z_sign_fixup
&& f1
.z_source
== f2
.z_source
261 && f1
.w_sign_fixup
== f2
.w_sign_fixup
&& f1
.w_source
== f2
.w_source
;
264 static inline enum complex_fixup
get_complex_fixup(struct color_fixup_desc fixup
)
266 enum complex_fixup complex_fixup
= 0;
267 if (fixup
.x_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 0);
268 if (fixup
.y_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 1);
269 if (fixup
.z_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 2);
270 if (fixup
.w_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 3);
271 return complex_fixup
;
275 #define WINED3D_MAX_STREAMS 16
276 #define WINED3D_MAX_TEXTURES 8
277 #define WINED3D_MAX_FRAGMENT_SAMPLERS 16
278 #define WINED3D_MAX_VERTEX_SAMPLERS 4
279 #define WINED3D_MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + WINED3D_MAX_VERTEX_SAMPLERS)
280 #define WINED3D_MAX_ACTIVE_LIGHTS 8
281 #define WINED3D_MAX_SOFTWARE_ACTIVE_LIGHTS 32
282 #define WINED3D_MAX_CLIP_DISTANCES 8
283 #define MAX_CONSTANT_BUFFERS 15
284 #define MAX_SAMPLER_OBJECTS 16
285 #define MAX_SHADER_RESOURCE_VIEWS 128
286 #define MAX_RENDER_TARGET_VIEWS 8
287 #define MAX_UNORDERED_ACCESS_VIEWS 8
288 #define MAX_TGSM_REGISTERS 8192
289 #define MAX_VERTEX_BLENDS 4
293 GLenum mip
[WINED3D_TEXF_LINEAR
+ 1];
296 extern const struct min_lookup minMipLookup
[WINED3D_TEXF_LINEAR
+ 1] DECLSPEC_HIDDEN
;
297 extern const GLenum magLookup
[WINED3D_TEXF_LINEAR
+ 1] DECLSPEC_HIDDEN
;
299 GLenum
wined3d_gl_compare_func(enum wined3d_cmp_func f
) DECLSPEC_HIDDEN
;
301 static inline enum wined3d_cmp_func
wined3d_sanitize_cmp_func(enum wined3d_cmp_func func
)
303 if (func
< WINED3D_CMP_NEVER
|| func
> WINED3D_CMP_ALWAYS
)
304 return WINED3D_CMP_ALWAYS
;
308 static inline GLenum
wined3d_gl_mag_filter(enum wined3d_texture_filter_type mag_filter
)
310 return magLookup
[mag_filter
];
313 static inline GLenum
wined3d_gl_min_mip_filter(enum wined3d_texture_filter_type min_filter
,
314 enum wined3d_texture_filter_type mip_filter
)
316 return minMipLookup
[min_filter
].mip
[mip_filter
];
319 /* float_16_to_32() and float_32_to_16() (see implementation in
320 * surface_base.c) convert 16 bit floats in the FLOAT16 data type
321 * to standard C floats and vice versa. They do not depend on the encoding
322 * of the C float, so they are platform independent, but slow. On x86 and
323 * other IEEE 754 compliant platforms the conversion can be accelerated by
324 * bit shifting the exponent and mantissa. There are also some SSE-based
325 * assembly routines out there.
327 * See GL_NV_half_float for a reference of the FLOAT16 / GL_HALF format
329 static inline float float_16_to_32(const unsigned short *in
)
331 const unsigned short s
= ((*in
) & 0x8000u
);
332 const unsigned short e
= ((*in
) & 0x7c00u
) >> 10;
333 const unsigned short m
= (*in
) & 0x3ffu
;
334 const float sgn
= (s
? -1.0f
: 1.0f
);
337 if(m
== 0) return sgn
* 0.0f
; /* +0.0 or -0.0 */
338 else return sgn
* powf(2, -14.0f
) * ((float)m
/ 1024.0f
);
340 return sgn
* powf(2, (float)e
- 15.0f
) * (1.0f
+ ((float)m
/ 1024.0f
));
342 if(m
== 0) return sgn
* INFINITY
;
347 static inline float float_24_to_32(DWORD in
)
349 const float sgn
= in
& 0x800000u
? -1.0f
: 1.0f
;
350 const unsigned short e
= (in
& 0x780000u
) >> 19;
351 const unsigned int m
= in
& 0x7ffffu
;
355 if (m
== 0) return sgn
* 0.0f
; /* +0.0 or -0.0 */
356 else return sgn
* powf(2, -6.0f
) * ((float)m
/ 524288.0f
);
360 return sgn
* powf(2, (float)e
- 7.0f
) * (1.0f
+ ((float)m
/ 524288.0f
));
364 if (m
== 0) return sgn
* INFINITY
;
369 static inline unsigned int wined3d_popcount(unsigned int x
)
371 #ifdef HAVE___BUILTIN_POPCOUNT
372 return __builtin_popcount(x
);
374 x
-= x
>> 1 & 0x55555555;
375 x
= (x
& 0x33333333) + (x
>> 2 & 0x33333333);
376 return ((x
+ (x
>> 4)) & 0x0f0f0f0f) * 0x01010101 >> 24;
380 static inline void wined3d_pause(void)
382 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
383 __asm__
__volatile__( "rep;nop" : : : "memory" );
387 #define ORM_BACKBUFFER 0
390 #define PCI_VENDOR_NONE 0xffff /* e.g. 0x8086 for Intel and 0x10de for Nvidia */
391 #define PCI_DEVICE_NONE 0xffff /* e.g. 0x14f for a Geforce6200 */
393 enum wined3d_renderer
395 WINED3D_RENDERER_AUTO
,
396 WINED3D_RENDERER_VULKAN
,
397 WINED3D_RENDERER_OPENGL
,
398 WINED3D_RENDERER_NO3D
,
401 enum wined3d_shader_backend
403 WINED3D_SHADER_BACKEND_AUTO
,
404 WINED3D_SHADER_BACKEND_GLSL
,
405 WINED3D_SHADER_BACKEND_ARB
,
406 WINED3D_SHADER_BACKEND_NONE
,
409 /* NOTE: When adding fields to this structure, make sure to update the default
410 * values in wined3d_main.c as well. */
411 struct wined3d_settings
413 unsigned int cs_multithreaded
;
414 DWORD max_gl_version
;
415 int offscreen_rendering_mode
;
416 unsigned short pci_vendor_id
;
417 unsigned short pci_device_id
;
418 /* Memory tracking and object counting. */
419 UINT64 emulated_textureram
;
421 unsigned int multisample_textures
;
422 unsigned int sample_count
;
423 BOOL check_float_constants
;
424 unsigned int strict_shader_math
;
425 unsigned int max_sm_vs
;
426 unsigned int max_sm_hs
;
427 unsigned int max_sm_ds
;
428 unsigned int max_sm_gs
;
429 unsigned int max_sm_ps
;
430 unsigned int max_sm_cs
;
431 enum wined3d_renderer renderer
;
432 enum wined3d_shader_backend shader_backend
;
435 extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN
;
437 enum wined3d_shader_byte_code_format
439 WINED3D_SHADER_BYTE_CODE_FORMAT_SM1
,
440 WINED3D_SHADER_BYTE_CODE_FORMAT_SM4
,
443 enum wined3d_shader_resource_type
445 WINED3D_SHADER_RESOURCE_NONE
,
446 WINED3D_SHADER_RESOURCE_BUFFER
,
447 WINED3D_SHADER_RESOURCE_TEXTURE_1D
,
448 WINED3D_SHADER_RESOURCE_TEXTURE_2D
,
449 WINED3D_SHADER_RESOURCE_TEXTURE_2DMS
,
450 WINED3D_SHADER_RESOURCE_TEXTURE_3D
,
451 WINED3D_SHADER_RESOURCE_TEXTURE_CUBE
,
452 WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY
,
453 WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY
,
454 WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY
,
455 WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY
,
458 #define WINED3D_SHADER_CONST_VS_F 0x00000001
459 #define WINED3D_SHADER_CONST_VS_I 0x00000002
460 #define WINED3D_SHADER_CONST_VS_B 0x00000004
461 #define WINED3D_SHADER_CONST_VS_CLIP_PLANES 0x00000008
462 #define WINED3D_SHADER_CONST_VS_POINTSIZE 0x00000010
463 #define WINED3D_SHADER_CONST_POS_FIXUP 0x00000020
464 #define WINED3D_SHADER_CONST_PS_F 0x00000040
465 #define WINED3D_SHADER_CONST_PS_I 0x00000080
466 #define WINED3D_SHADER_CONST_PS_B 0x00000100
467 #define WINED3D_SHADER_CONST_PS_BUMP_ENV 0x00000200
468 #define WINED3D_SHADER_CONST_PS_FOG 0x00000400
469 #define WINED3D_SHADER_CONST_PS_ALPHA_TEST 0x00000800
470 #define WINED3D_SHADER_CONST_PS_Y_CORR 0x00001000
471 #define WINED3D_SHADER_CONST_PS_NP2_FIXUP 0x00002000
472 #define WINED3D_SHADER_CONST_FFP_MODELVIEW 0x00004000
473 #define WINED3D_SHADER_CONST_FFP_VERTEXBLEND 0x00008000
474 #define WINED3D_SHADER_CONST_FFP_PROJ 0x00010000
475 #define WINED3D_SHADER_CONST_FFP_TEXMATRIX 0x00020000
476 #define WINED3D_SHADER_CONST_FFP_MATERIAL 0x00040000
477 #define WINED3D_SHADER_CONST_FFP_LIGHTS 0x00080000
478 #define WINED3D_SHADER_CONST_FFP_PS 0x00100000
479 #define WINED3D_SHADER_CONST_FFP_COLOR_KEY 0x00200000
480 #define WINED3D_SHADER_CONST_BASE_VERTEX_ID 0x00400000
482 enum wined3d_shader_register_type
485 WINED3DSPR_INPUT
= 1,
486 WINED3DSPR_CONST
= 2,
488 WINED3DSPR_TEXTURE
= 3,
489 WINED3DSPR_RASTOUT
= 4,
490 WINED3DSPR_ATTROUT
= 5,
491 WINED3DSPR_TEXCRDOUT
= 6,
492 WINED3DSPR_OUTPUT
= 6,
493 WINED3DSPR_CONSTINT
= 7,
494 WINED3DSPR_COLOROUT
= 8,
495 WINED3DSPR_DEPTHOUT
= 9,
496 WINED3DSPR_SAMPLER
= 10,
497 WINED3DSPR_CONST2
= 11,
498 WINED3DSPR_CONST3
= 12,
499 WINED3DSPR_CONST4
= 13,
500 WINED3DSPR_CONSTBOOL
= 14,
501 WINED3DSPR_LOOP
= 15,
502 WINED3DSPR_TEMPFLOAT16
= 16,
503 WINED3DSPR_MISCTYPE
= 17,
504 WINED3DSPR_LABEL
= 18,
505 WINED3DSPR_PREDICATE
= 19,
507 WINED3DSPR_CONSTBUFFER
,
508 WINED3DSPR_IMMCONSTBUFFER
,
513 WINED3DSPR_OUTPOINTID
,
514 WINED3DSPR_FORKINSTID
,
515 WINED3DSPR_JOININSTID
,
516 WINED3DSPR_INCONTROLPOINT
,
517 WINED3DSPR_OUTCONTROLPOINT
,
518 WINED3DSPR_PATCHCONST
,
519 WINED3DSPR_TESSCOORD
,
520 WINED3DSPR_GROUPSHAREDMEM
,
522 WINED3DSPR_THREADGROUPID
,
523 WINED3DSPR_LOCALTHREADID
,
524 WINED3DSPR_LOCALTHREADINDEX
,
527 WINED3DSPR_FUNCTIONBODY
,
528 WINED3DSPR_FUNCTIONPOINTER
,
530 WINED3DSPR_SAMPLEMASK
,
532 WINED3DSPR_DEPTHOUTGE
,
533 WINED3DSPR_DEPTHOUTLE
,
534 WINED3DSPR_RASTERIZER
,
537 enum wined3d_data_type
541 WINED3D_DATA_RESOURCE
,
542 WINED3D_DATA_SAMPLER
,
550 enum wined3d_immconst_type
552 WINED3D_IMMCONST_SCALAR
,
553 WINED3D_IMMCONST_VEC4
,
556 #define WINED3DSP_NOSWIZZLE (0u | (1u << 2) | (2u << 4) | (3u << 6))
558 enum wined3d_shader_src_modifier
560 WINED3DSPSM_NONE
= 0,
562 WINED3DSPSM_BIAS
= 2,
563 WINED3DSPSM_BIASNEG
= 3,
564 WINED3DSPSM_SIGN
= 4,
565 WINED3DSPSM_SIGNNEG
= 5,
566 WINED3DSPSM_COMP
= 6,
568 WINED3DSPSM_X2NEG
= 8,
571 WINED3DSPSM_ABS
= 11,
572 WINED3DSPSM_ABSNEG
= 12,
573 WINED3DSPSM_NOT
= 13,
576 #define WINED3DSP_WRITEMASK_0 0x1u /* .x r */
577 #define WINED3DSP_WRITEMASK_1 0x2u /* .y g */
578 #define WINED3DSP_WRITEMASK_2 0x4u /* .z b */
579 #define WINED3DSP_WRITEMASK_3 0x8u /* .w a */
580 #define WINED3DSP_WRITEMASK_ALL 0xfu /* all */
582 enum wined3d_shader_dst_modifier
584 WINED3DSPDM_NONE
= 0,
585 WINED3DSPDM_SATURATE
= 1,
586 WINED3DSPDM_PARTIALPRECISION
= 2,
587 WINED3DSPDM_MSAMPCENTROID
= 4,
590 enum wined3d_shader_interpolation_mode
593 WINED3DSIM_CONSTANT
= 1,
594 WINED3DSIM_LINEAR
= 2,
595 WINED3DSIM_LINEAR_CENTROID
= 3,
596 WINED3DSIM_LINEAR_NOPERSPECTIVE
= 4,
597 WINED3DSIM_LINEAR_NOPERSPECTIVE_CENTROID
= 5,
598 WINED3DSIM_LINEAR_SAMPLE
= 6,
599 WINED3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE
= 7,
602 #define WINED3D_PACKED_INTERPOLATION_SIZE 3
603 #define WINED3D_PACKED_INTERPOLATION_BIT_COUNT 3
605 enum wined3d_shader_global_flags
607 WINED3DSGF_REFACTORING_ALLOWED
= 0x1,
608 WINED3DSGF_FORCE_EARLY_DEPTH_STENCIL
= 0x4,
609 WINED3DSGF_ENABLE_RAW_AND_STRUCTURED_BUFFERS
= 0x8,
612 enum wined3d_shader_sync_flags
614 WINED3DSSF_THREAD_GROUP
= 0x1,
615 WINED3DSSF_GROUP_SHARED_MEMORY
= 0x2,
618 enum wined3d_shader_uav_flags
620 WINED3DSUF_GLOBALLY_COHERENT
= 0x2,
621 WINED3DSUF_ORDER_PRESERVING_COUNTER
= 0x100,
624 enum wined3d_tessellator_domain
626 WINED3D_TESSELLATOR_DOMAIN_LINE
= 1,
627 WINED3D_TESSELLATOR_DOMAIN_TRIANGLE
= 2,
628 WINED3D_TESSELLATOR_DOMAIN_QUAD
= 3,
631 enum wined3d_tessellator_output_primitive
633 WINED3D_TESSELLATOR_OUTPUT_POINT
= 1,
634 WINED3D_TESSELLATOR_OUTPUT_LINE
= 2,
635 WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CW
= 3,
636 WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW
= 4,
639 enum wined3d_tessellator_partitioning
641 WINED3D_TESSELLATOR_PARTITIONING_INTEGER
= 1,
642 WINED3D_TESSELLATOR_PARTITIONING_POW2
= 2,
643 WINED3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD
= 3,
644 WINED3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
= 4,
647 /* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */
648 #define WINED3DSI_TEXLD_PROJECT 0x1
649 #define WINED3DSI_TEXLD_BIAS 0x2
650 #define WINED3DSI_INDEXED_DYNAMIC 0x4
651 #define WINED3DSI_RESINFO_RCP_FLOAT 0x1
652 #define WINED3DSI_RESINFO_UINT 0x2
653 #define WINED3DSI_SAMPLE_INFO_UINT 0x1
654 #define WINED3DSI_SAMPLER_COMPARISON_MODE 0x1
656 #define WINED3DSI_PRECISE_X 0x100
657 #define WINED3DSI_PRECISE_Y 0x200
658 #define WINED3DSI_PRECISE_Z 0x400
659 #define WINED3DSI_PRECISE_W 0x800
660 #define WINED3DSI_PRECISE_XYZW (WINED3DSI_PRECISE_X | WINED3DSI_PRECISE_Y \
661 | WINED3DSI_PRECISE_Z | WINED3DSI_PRECISE_W)
662 #define WINED3DSI_PRECISE_SHIFT 8
664 enum wined3d_shader_rel_op
666 WINED3D_SHADER_REL_OP_GT
= 1,
667 WINED3D_SHADER_REL_OP_EQ
= 2,
668 WINED3D_SHADER_REL_OP_GE
= 3,
669 WINED3D_SHADER_REL_OP_LT
= 4,
670 WINED3D_SHADER_REL_OP_NE
= 5,
671 WINED3D_SHADER_REL_OP_LE
= 6,
674 enum wined3d_shader_conditional_op
676 WINED3D_SHADER_CONDITIONAL_OP_NZ
= 0,
677 WINED3D_SHADER_CONDITIONAL_OP_Z
= 1
680 #define WINED3D_SM1_VS 0xfffeu
681 #define WINED3D_SM1_PS 0xffffu
682 #define WINED3D_SM4_PS 0x0000u
683 #define WINED3D_SM4_VS 0x0001u
684 #define WINED3D_SM4_GS 0x0002u
685 #define WINED3D_SM5_HS 0x0003u
686 #define WINED3D_SM5_DS 0x0004u
687 #define WINED3D_SM5_CS 0x0005u
689 /* Shader version tokens, and shader end tokens */
690 #define WINED3DPS_VERSION(major, minor) ((WINED3D_SM1_PS << 16) | ((major) << 8) | (minor))
691 #define WINED3DVS_VERSION(major, minor) ((WINED3D_SM1_VS << 16) | ((major) << 8) | (minor))
693 /* Shader backends */
695 /* TODO: Make this dynamic, based on shader limits ? */
696 #define MAX_ATTRIBS 16
697 #define MAX_REG_ADDR 1
698 #define MAX_REG_TEXCRD 8
699 #define MAX_REG_INPUT 32
700 #define MAX_REG_OUTPUT 32
701 #define WINED3D_MAX_CBS 15
702 #define WINED3D_MAX_CONSTS_B 16
703 #define WINED3D_MAX_CONSTS_I 16
704 #define WINED3D_MAX_VS_CONSTS_F 256
705 #define WINED3D_MAX_PS_CONSTS_F 224
707 /* FIXME: This needs to go up to 2048 for
708 * Shader model 3 according to msdn (and for software shaders) */
709 #define MAX_LABELS 16
711 #define MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE 4096
713 struct wined3d_string_buffer
717 unsigned int buffer_size
;
718 unsigned int content_size
;
721 enum WINED3D_SHADER_INSTRUCTION_HANDLER
726 WINED3DSIH_ATOMIC_AND
,
727 WINED3DSIH_ATOMIC_CMP_STORE
,
728 WINED3DSIH_ATOMIC_IADD
,
729 WINED3DSIH_ATOMIC_IMAX
,
730 WINED3DSIH_ATOMIC_IMIN
,
731 WINED3DSIH_ATOMIC_OR
,
732 WINED3DSIH_ATOMIC_UMAX
,
733 WINED3DSIH_ATOMIC_UMIN
,
734 WINED3DSIH_ATOMIC_XOR
,
748 WINED3DSIH_CONTINUEP
,
749 WINED3DSIH_COUNTBITS
,
752 WINED3DSIH_CUT_STREAM
,
754 WINED3DSIH_DCL_CONSTANT_BUFFER
,
755 WINED3DSIH_DCL_FUNCTION_BODY
,
756 WINED3DSIH_DCL_FUNCTION_TABLE
,
757 WINED3DSIH_DCL_GLOBAL_FLAGS
,
758 WINED3DSIH_DCL_GS_INSTANCES
,
759 WINED3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT
,
760 WINED3DSIH_DCL_HS_JOIN_PHASE_INSTANCE_COUNT
,
761 WINED3DSIH_DCL_HS_MAX_TESSFACTOR
,
762 WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER
,
763 WINED3DSIH_DCL_INDEX_RANGE
,
764 WINED3DSIH_DCL_INDEXABLE_TEMP
,
765 WINED3DSIH_DCL_INPUT
,
766 WINED3DSIH_DCL_INPUT_CONTROL_POINT_COUNT
,
767 WINED3DSIH_DCL_INPUT_PRIMITIVE
,
768 WINED3DSIH_DCL_INPUT_PS
,
769 WINED3DSIH_DCL_INPUT_PS_SGV
,
770 WINED3DSIH_DCL_INPUT_PS_SIV
,
771 WINED3DSIH_DCL_INPUT_SGV
,
772 WINED3DSIH_DCL_INPUT_SIV
,
773 WINED3DSIH_DCL_INTERFACE
,
774 WINED3DSIH_DCL_OUTPUT
,
775 WINED3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT
,
776 WINED3DSIH_DCL_OUTPUT_SIV
,
777 WINED3DSIH_DCL_OUTPUT_TOPOLOGY
,
778 WINED3DSIH_DCL_RESOURCE_RAW
,
779 WINED3DSIH_DCL_RESOURCE_STRUCTURED
,
780 WINED3DSIH_DCL_SAMPLER
,
781 WINED3DSIH_DCL_STREAM
,
782 WINED3DSIH_DCL_TEMPS
,
783 WINED3DSIH_DCL_TESSELLATOR_DOMAIN
,
784 WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE
,
785 WINED3DSIH_DCL_TESSELLATOR_PARTITIONING
,
786 WINED3DSIH_DCL_TGSM_RAW
,
787 WINED3DSIH_DCL_TGSM_STRUCTURED
,
788 WINED3DSIH_DCL_THREAD_GROUP
,
789 WINED3DSIH_DCL_UAV_RAW
,
790 WINED3DSIH_DCL_UAV_STRUCTURED
,
791 WINED3DSIH_DCL_UAV_TYPED
,
792 WINED3DSIH_DCL_VERTICES_OUT
,
804 WINED3DSIH_DSX_COARSE
,
807 WINED3DSIH_DSY_COARSE
,
811 WINED3DSIH_EMIT_STREAM
,
815 WINED3DSIH_ENDSWITCH
,
817 WINED3DSIH_EVAL_SAMPLE_INDEX
,
823 WINED3DSIH_FIRSTBIT_HI
,
824 WINED3DSIH_FIRSTBIT_LO
,
825 WINED3DSIH_FIRSTBIT_SHI
,
830 WINED3DSIH_GATHER4_C
,
831 WINED3DSIH_GATHER4_PO
,
832 WINED3DSIH_GATHER4_PO_C
,
834 WINED3DSIH_HS_CONTROL_POINT_PHASE
,
836 WINED3DSIH_HS_FORK_PHASE
,
837 WINED3DSIH_HS_JOIN_PHASE
,
848 WINED3DSIH_IMM_ATOMIC_ALLOC
,
849 WINED3DSIH_IMM_ATOMIC_AND
,
850 WINED3DSIH_IMM_ATOMIC_CMP_EXCH
,
851 WINED3DSIH_IMM_ATOMIC_CONSUME
,
852 WINED3DSIH_IMM_ATOMIC_EXCH
,
853 WINED3DSIH_IMM_ATOMIC_IADD
,
854 WINED3DSIH_IMM_ATOMIC_IMAX
,
855 WINED3DSIH_IMM_ATOMIC_IMIN
,
856 WINED3DSIH_IMM_ATOMIC_OR
,
857 WINED3DSIH_IMM_ATOMIC_UMAX
,
858 WINED3DSIH_IMM_ATOMIC_UMIN
,
859 WINED3DSIH_IMM_ATOMIC_XOR
,
870 WINED3DSIH_LD_STRUCTURED
,
871 WINED3DSIH_LD_UAV_TYPED
,
911 WINED3DSIH_SAMPLE_C_LZ
,
912 WINED3DSIH_SAMPLE_GRAD
,
913 WINED3DSIH_SAMPLE_INFO
,
914 WINED3DSIH_SAMPLE_LOD
,
915 WINED3DSIH_SAMPLE_POS
,
922 WINED3DSIH_STORE_RAW
,
923 WINED3DSIH_STORE_STRUCTURED
,
924 WINED3DSIH_STORE_UAV_TYPED
,
935 WINED3DSIH_TEXDP3TEX
,
939 WINED3DSIH_TEXM3x2DEPTH
,
940 WINED3DSIH_TEXM3x2PAD
,
941 WINED3DSIH_TEXM3x2TEX
,
943 WINED3DSIH_TEXM3x3DIFF
,
944 WINED3DSIH_TEXM3x3PAD
,
945 WINED3DSIH_TEXM3x3SPEC
,
946 WINED3DSIH_TEXM3x3TEX
,
947 WINED3DSIH_TEXM3x3VSPEC
,
948 WINED3DSIH_TEXREG2AR
,
949 WINED3DSIH_TEXREG2GB
,
950 WINED3DSIH_TEXREG2RGB
,
961 WINED3DSIH_TABLE_SIZE
964 struct wined3d_shader_version
966 enum wined3d_shader_type type
;
971 struct wined3d_shader_resource_info
973 enum wined3d_shader_resource_type type
;
974 enum wined3d_data_type data_type
;
979 #define WINED3D_SAMPLER_DEFAULT ~0x0u
981 struct wined3d_shader_sampler_map_entry
983 unsigned int resource_idx
;
984 unsigned int sampler_idx
;
985 unsigned int bind_idx
;
988 struct wined3d_shader_sampler_map
990 struct wined3d_shader_sampler_map_entry
*entries
;
995 struct wined3d_shader_immediate_constant_buffer
997 unsigned int vec4_count
;
998 DWORD data
[MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE
];
1001 struct wined3d_shader_indexable_temp
1004 unsigned int register_idx
;
1005 unsigned int register_size
;
1006 unsigned int component_count
;
1009 #define WINED3D_SHADER_VERSION(major, minor) (((major) << 8) | (minor))
1011 struct wined3d_shader_reg_maps
1013 struct wined3d_shader_version shader_version
;
1014 BYTE texcoord
; /* MAX_REG_TEXCRD, 8 */
1015 BYTE address
; /* MAX_REG_ADDR, 1 */
1016 WORD labels
; /* MAX_LABELS, 16 */
1017 DWORD temporary
; /* 32 */
1018 unsigned int temporary_count
;
1019 DWORD
*constf
; /* pixel, vertex */
1020 struct list indexable_temps
;
1021 const struct wined3d_shader_immediate_constant_buffer
*icb
;
1024 DWORD texcoord_mask
[MAX_REG_TEXCRD
]; /* vertex < 3.0 */
1025 BYTE output_registers_mask
[MAX_REG_OUTPUT
]; /* vertex >= 3.0 */
1027 DWORD input_registers
; /* max(MAX_REG_INPUT, MAX_ATTRIBS), 32 */
1028 DWORD output_registers
; /* MAX_REG_OUTPUT, 32 */
1029 WORD integer_constants
; /* WINED3D_MAX_CONSTS_I, 16 */
1030 WORD boolean_constants
; /* WINED3D_MAX_CONSTS_B, 16 */
1031 WORD local_int_consts
; /* WINED3D_MAX_CONSTS_I, 16 */
1032 WORD local_bool_consts
; /* WINED3D_MAX_CONSTS_B, 16 */
1033 UINT cb_sizes
[WINED3D_MAX_CBS
];
1035 struct wined3d_shader_resource_info resource_info
[MAX_SHADER_RESOURCE_VIEWS
];
1036 struct wined3d_shader_sampler_map sampler_map
;
1037 DWORD sampler_comparison_mode
;
1038 BYTE bumpmat
; /* WINED3D_MAX_TEXTURES, 8 */
1039 BYTE luminanceparams
; /* WINED3D_MAX_TEXTURES, 8 */
1040 struct wined3d_shader_resource_info uav_resource_info
[MAX_UNORDERED_ACCESS_VIEWS
];
1041 DWORD uav_read_mask
: 8; /* MAX_UNORDERED_ACCESS_VIEWS, 8 */
1042 DWORD uav_counter_mask
: 8; /* MAX_UNORDERED_ACCESS_VIEWS, 8 */
1044 DWORD clip_distance_mask
: 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
1045 DWORD cull_distance_mask
: 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
1050 DWORD usestexldd
: 1;
1052 DWORD usesfacing
: 1;
1053 DWORD usesrelconstF
: 1;
1055 DWORD usestexldl
: 1;
1059 DWORD point_size
: 1;
1061 DWORD input_rel_addressing
: 1;
1062 DWORD viewport_array
: 1;
1063 DWORD sample_mask
: 1;
1066 DWORD rt_mask
; /* Used render targets, 32 max. */
1068 /* Whether or not loops are used in this shader, and nesting depth */
1069 unsigned int loop_depth
;
1070 unsigned int min_rel_offset
, max_rel_offset
;
1072 struct wined3d_shader_tgsm
*tgsm
;
1073 SIZE_T tgsm_capacity
;
1074 unsigned int tgsm_count
;
1077 /* Keeps track of details for TEX_M#x# instructions which need to maintain
1078 * state information between multiple instructions. */
1079 struct wined3d_shader_tex_mx
1081 unsigned int current_row
;
1082 DWORD texcoord_w
[2];
1085 struct wined3d_shader_parser_state
1087 unsigned int current_loop_depth
;
1088 unsigned int current_loop_reg
;
1092 struct wined3d_shader_context
1094 const struct wined3d_shader
*shader
;
1095 const struct wined3d_gl_info
*gl_info
;
1096 const struct wined3d_shader_reg_maps
*reg_maps
;
1097 struct wined3d_string_buffer
*buffer
;
1098 struct wined3d_shader_tex_mx
*tex_mx
;
1099 struct wined3d_shader_parser_state
*state
;
1103 struct wined3d_shader_register_index
1105 const struct wined3d_shader_src_param
*rel_addr
;
1106 unsigned int offset
;
1109 struct wined3d_shader_register
1111 enum wined3d_shader_register_type type
;
1112 enum wined3d_data_type data_type
;
1113 struct wined3d_shader_register_index idx
[2];
1114 enum wined3d_immconst_type immconst_type
;
1117 DWORD immconst_data
[4];
1118 unsigned fp_body_idx
;
1122 struct wined3d_shader_dst_param
1124 struct wined3d_shader_register reg
;
1130 struct wined3d_shader_src_param
1132 struct wined3d_shader_register reg
;
1134 enum wined3d_shader_src_modifier modifiers
;
1137 struct wined3d_shader_index_range
1139 struct wined3d_shader_dst_param first_register
;
1140 unsigned int last_register
;
1143 struct wined3d_shader_semantic
1145 enum wined3d_decl_usage usage
;
1147 enum wined3d_shader_resource_type resource_type
;
1148 enum wined3d_data_type resource_data_type
;
1149 struct wined3d_shader_dst_param reg
;
1152 enum wined3d_shader_input_sysval_semantic
1154 WINED3D_SIV_POSITION
= 1,
1155 WINED3D_SIV_CLIP_DISTANCE
= 2,
1156 WINED3D_SIV_CULL_DISTANCE
= 3,
1157 WINED3D_SIV_RENDER_TARGET_ARRAY_INDEX
= 4,
1158 WINED3D_SIV_VIEWPORT_ARRAY_INDEX
= 5,
1159 WINED3D_SIV_VERTEX_ID
= 6,
1160 WINED3D_SIV_PRIMITIVE_ID
= 7,
1161 WINED3D_SIV_INSTANCE_ID
= 8,
1162 WINED3D_SIV_IS_FRONT_FACE
= 9,
1163 WINED3D_SIV_SAMPLE_INDEX
= 10,
1164 WINED3D_SIV_QUAD_U0_TESS_FACTOR
= 11,
1165 WINED3D_SIV_QUAD_V0_TESS_FACTOR
= 12,
1166 WINED3D_SIV_QUAD_U1_TESS_FACTOR
= 13,
1167 WINED3D_SIV_QUAD_V1_TESS_FACTOR
= 14,
1168 WINED3D_SIV_QUAD_U_INNER_TESS_FACTOR
= 15,
1169 WINED3D_SIV_QUAD_V_INNER_TESS_FACTOR
= 16,
1170 WINED3D_SIV_TRIANGLE_U_TESS_FACTOR
= 17,
1171 WINED3D_SIV_TRIANGLE_V_TESS_FACTOR
= 18,
1172 WINED3D_SIV_TRIANGLE_W_TESS_FACTOR
= 19,
1173 WINED3D_SIV_TRIANGLE_INNER_TESS_FACTOR
= 20,
1174 WINED3D_SIV_LINE_DETAIL_TESS_FACTOR
= 21,
1175 WINED3D_SIV_LINE_DENSITY_TESS_FACTOR
= 22,
1178 struct wined3d_shader_register_semantic
1180 struct wined3d_shader_dst_param reg
;
1181 enum wined3d_shader_input_sysval_semantic sysval_semantic
;
1184 struct wined3d_shader_structured_resource
1186 struct wined3d_shader_dst_param reg
;
1187 unsigned int byte_stride
;
1190 struct wined3d_shader_tgsm
1193 unsigned int stride
;
1196 struct wined3d_shader_tgsm_raw
1198 struct wined3d_shader_dst_param reg
;
1199 unsigned int byte_count
;
1202 struct wined3d_shader_tgsm_structured
1204 struct wined3d_shader_dst_param reg
;
1205 unsigned int byte_stride
;
1206 unsigned int structure_count
;
1209 struct wined3d_shader_thread_group_size
1211 unsigned int x
, y
, z
;
1214 struct wined3d_shader_function_table_pointer
1217 unsigned int array_size
;
1218 unsigned int body_count
;
1219 unsigned int table_count
;
1222 struct wined3d_shader_texel_offset
1224 signed char u
, v
, w
;
1227 struct wined3d_shader_primitive_type
1229 enum wined3d_primitive_type type
;
1230 unsigned int patch_vertex_count
;
1233 struct wined3d_shader_instruction
1235 const struct wined3d_shader_context
*ctx
;
1236 enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx
;
1238 unsigned int dst_count
;
1239 unsigned int src_count
;
1240 const struct wined3d_shader_dst_param
*dst
;
1241 const struct wined3d_shader_src_param
*src
;
1242 struct wined3d_shader_texel_offset texel_offset
;
1244 const struct wined3d_shader_src_param
*predicate
;
1247 struct wined3d_shader_semantic semantic
;
1248 struct wined3d_shader_register_semantic register_semantic
;
1249 struct wined3d_shader_primitive_type primitive_type
;
1250 struct wined3d_shader_dst_param dst
;
1251 struct wined3d_shader_src_param src
;
1254 const struct wined3d_shader_immediate_constant_buffer
*icb
;
1255 struct wined3d_shader_structured_resource structured_resource
;
1256 struct wined3d_shader_tgsm_raw tgsm_raw
;
1257 struct wined3d_shader_tgsm_structured tgsm_structured
;
1258 struct wined3d_shader_thread_group_size thread_group_size
;
1259 enum wined3d_tessellator_domain tessellator_domain
;
1260 enum wined3d_tessellator_output_primitive tessellator_output_primitive
;
1261 enum wined3d_tessellator_partitioning tessellator_partitioning
;
1262 float max_tessellation_factor
;
1263 struct wined3d_shader_index_range index_range
;
1264 struct wined3d_shader_indexable_temp indexable_temp
;
1265 struct wined3d_shader_function_table_pointer fp
;
1269 static inline BOOL
wined3d_shader_instruction_has_texel_offset(const struct wined3d_shader_instruction
*ins
)
1271 return ins
->texel_offset
.u
|| ins
->texel_offset
.v
|| ins
->texel_offset
.w
;
1274 struct wined3d_shader_attribute
1276 enum wined3d_decl_usage usage
;
1280 struct wined3d_shader_loop_control
1287 struct wined3d_shader_frontend
1289 void *(*shader_init
)(const DWORD
*byte_code
, size_t byte_code_size
,
1290 const struct wined3d_shader_signature
*output_signature
);
1291 void (*shader_free
)(void *data
);
1292 void (*shader_read_header
)(void *data
, const DWORD
**ptr
, struct wined3d_shader_version
*shader_version
);
1293 void (*shader_read_instruction
)(void *data
, const DWORD
**ptr
, struct wined3d_shader_instruction
*ins
);
1294 BOOL (*shader_is_end
)(void *data
, const DWORD
**ptr
);
1297 extern const struct wined3d_shader_frontend sm1_shader_frontend DECLSPEC_HIDDEN
;
1298 extern const struct wined3d_shader_frontend sm4_shader_frontend DECLSPEC_HIDDEN
;
1300 HRESULT
shader_extract_from_dxbc(struct wined3d_shader
*shader
,
1301 unsigned int max_shader_version
, enum wined3d_shader_byte_code_format
*format
) DECLSPEC_HIDDEN
;
1302 BOOL
shader_get_stream_output_register_info(const struct wined3d_shader
*shader
,
1303 const struct wined3d_stream_output_element
*so_element
, unsigned int *register_idx
,
1304 unsigned int *component_idx
) DECLSPEC_HIDDEN
;
1306 typedef void (*SHADER_HANDLER
)(const struct wined3d_shader_instruction
*);
1308 #define WINED3D_SHADER_CAP_VS_CLIPPING 0x00000001u
1309 #define WINED3D_SHADER_CAP_SRGB_WRITE 0x00000002u
1310 #define WINED3D_SHADER_CAP_DOUBLE_PRECISION 0x00000004u
1311 #define WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION 0x00000008u
1312 #define WINED3D_SHADER_CAP_FULL_FFP_VARYINGS 0x00000010u
1316 unsigned int vs_version
;
1317 unsigned int hs_version
;
1318 unsigned int ds_version
;
1319 unsigned int gs_version
;
1320 unsigned int ps_version
;
1321 unsigned int cs_version
;
1323 unsigned int vs_uniform_count
;
1324 unsigned int ps_uniform_count
;
1325 float ps_1x_max_value
;
1326 unsigned int varying_count
;
1331 enum wined3d_gl_resource_type
1333 WINED3D_GL_RES_TYPE_TEX_1D
= 0,
1334 WINED3D_GL_RES_TYPE_TEX_2D
= 1,
1335 WINED3D_GL_RES_TYPE_TEX_3D
= 2,
1336 WINED3D_GL_RES_TYPE_TEX_CUBE
= 3,
1337 WINED3D_GL_RES_TYPE_TEX_RECT
= 4,
1338 WINED3D_GL_RES_TYPE_BUFFER
= 5,
1339 WINED3D_GL_RES_TYPE_RB
= 6,
1340 WINED3D_GL_RES_TYPE_COUNT
= 7,
1343 enum wined3d_vertex_processing_mode
1346 WINED3D_VP_MODE_SHADER
,
1347 WINED3D_VP_MODE_NONE
,
1350 #define WINED3D_CONST_NUM_UNUSED ~0U
1352 enum wined3d_ffp_ps_fog_mode
1354 WINED3D_FFP_PS_FOG_OFF
,
1355 WINED3D_FFP_PS_FOG_LINEAR
,
1356 WINED3D_FFP_PS_FOG_EXP
,
1357 WINED3D_FFP_PS_FOG_EXP2
,
1360 /* Stateblock dependent parameters which have to be hardcoded
1361 * into the shader code
1364 #define WINED3D_PSARGS_PROJECTED (1u << 3)
1365 #define WINED3D_PSARGS_TEXTRANSFORM_SHIFT 4
1366 #define WINED3D_PSARGS_TEXTRANSFORM_MASK 0xfu
1367 #define WINED3D_PSARGS_TEXTYPE_SHIFT 2
1368 #define WINED3D_PSARGS_TEXTYPE_MASK 0x3u
1370 /* Used for Shader Model 1 pixel shaders to track the bound texture
1371 * type. 2D and RECT textures are separated through NP2 fixup. */
1372 enum wined3d_shader_tex_types
1374 WINED3D_SHADER_TEX_2D
= 0,
1375 WINED3D_SHADER_TEX_3D
= 1,
1376 WINED3D_SHADER_TEX_CUBE
= 2,
1377 WINED3D_SHADER_TEX_ERR
= 3,
1380 struct ps_compile_args
1382 struct color_fixup_desc color_fixup
[WINED3D_MAX_FRAGMENT_SAMPLERS
];
1383 enum wined3d_vertex_processing_mode vp_mode
;
1384 enum wined3d_ffp_ps_fog_mode fog
;
1385 DWORD tex_types
; /* ps 1 - 3, 16 textures */
1386 WORD tex_transform
; /* ps 1.0-1.3, 4 textures */
1387 WORD srgb_correction
;
1388 /* Bitmap for NP2 texcoord fixups (16 samplers max currently).
1389 D3D9 has a limit of 16 samplers and the fixup is superfluous
1390 in D3D10 (unconditional NP2 support mandatory). */
1392 WORD shadow
; /* WINED3D_MAX_FRAGMENT_SAMPLERS, 16 */
1393 WORD texcoords_initialized
; /* WINED3D_MAX_TEXTURES, 8 */
1394 WORD padding_to_dword
;
1395 DWORD pointsprite
: 1;
1396 DWORD flatshading
: 1;
1397 DWORD alpha_test_func
: 3;
1398 DWORD render_offscreen
: 1;
1399 DWORD rt_alpha_swizzle
: 8; /* MAX_RENDER_TARGET_VIEWS, 8 */
1409 struct vs_compile_args
1412 BYTE clip_enabled
: 1;
1413 BYTE point_size
: 1;
1414 BYTE per_vertex_point_size
: 1;
1415 BYTE flatshading
: 1;
1416 BYTE next_shader_type
: 3;
1418 WORD swizzle_map
; /* MAX_ATTRIBS, 16 */
1419 unsigned int next_shader_input_count
;
1420 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
1423 struct ds_compile_args
1425 enum wined3d_tessellator_output_primitive tessellator_output_primitive
;
1426 enum wined3d_tessellator_partitioning tessellator_partitioning
;
1427 unsigned int output_count
: 16;
1428 unsigned int next_shader_type
: 3;
1429 unsigned int render_offscreen
: 1;
1430 unsigned int padding
: 12;
1431 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
1434 struct gs_compile_args
1436 unsigned int output_count
;
1437 enum wined3d_primitive_type primitive_type
;
1438 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
1441 struct wined3d_shader_backend_ops
1443 void (*shader_handle_instruction
)(const struct wined3d_shader_instruction
*);
1444 void (*shader_precompile
)(void *shader_priv
, struct wined3d_shader
*shader
);
1445 void (*shader_select
)(void *shader_priv
, struct wined3d_context
*context
,
1446 const struct wined3d_state
*state
);
1447 void (*shader_select_compute
)(void *shader_priv
, struct wined3d_context
*context
,
1448 const struct wined3d_state
*state
);
1449 void (*shader_disable
)(void *shader_priv
, struct wined3d_context
*context
);
1450 void (*shader_update_float_vertex_constants
)(struct wined3d_device
*device
, UINT start
, UINT count
);
1451 void (*shader_update_float_pixel_constants
)(struct wined3d_device
*device
, UINT start
, UINT count
);
1452 void (*shader_load_constants
)(void *shader_priv
, struct wined3d_context
*context
,
1453 const struct wined3d_state
*state
);
1454 void (*shader_destroy
)(struct wined3d_shader
*shader
);
1455 HRESULT (*shader_alloc_private
)(struct wined3d_device
*device
, const struct wined3d_vertex_pipe_ops
*vertex_pipe
,
1456 const struct wined3d_fragment_pipe_ops
*fragment_pipe
);
1457 void (*shader_free_private
)(struct wined3d_device
*device
, struct wined3d_context
*context
);
1458 BOOL (*shader_allocate_context_data
)(struct wined3d_context
*context
);
1459 void (*shader_free_context_data
)(struct wined3d_context
*context
);
1460 void (*shader_init_context_state
)(struct wined3d_context
*context
);
1461 void (*shader_get_caps
)(const struct wined3d_adapter
*adapter
, struct shader_caps
*caps
);
1462 BOOL (*shader_color_fixup_supported
)(struct color_fixup_desc fixup
);
1463 BOOL (*shader_has_ffp_proj_control
)(void *shader_priv
);
1466 extern const struct wined3d_shader_backend_ops glsl_shader_backend DECLSPEC_HIDDEN
;
1467 extern const struct wined3d_shader_backend_ops arb_program_shader_backend DECLSPEC_HIDDEN
;
1468 extern const struct wined3d_shader_backend_ops none_shader_backend DECLSPEC_HIDDEN
;
1470 #define GL_EXTCALL(f) (gl_info->gl_ops.ext.p_##f)
1472 #define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xff)
1473 #define D3DCOLOR_B_G(dw) (((dw) >> 8) & 0xff)
1474 #define D3DCOLOR_B_B(dw) (((dw) >> 0) & 0xff)
1475 #define D3DCOLOR_B_A(dw) (((dw) >> 24) & 0xff)
1477 static inline void wined3d_color_from_d3dcolor(struct wined3d_color
*wined3d_color
, DWORD d3d_color
)
1479 wined3d_color
->r
= D3DCOLOR_B_R(d3d_color
) / 255.0f
;
1480 wined3d_color
->g
= D3DCOLOR_B_G(d3d_color
) / 255.0f
;
1481 wined3d_color
->b
= D3DCOLOR_B_B(d3d_color
) / 255.0f
;
1482 wined3d_color
->a
= D3DCOLOR_B_A(d3d_color
) / 255.0f
;
1485 #define WINED3D_HIGHEST_TRANSFORM_STATE WINED3D_TS_WORLD_MATRIX(255) /* Highest value in wined3d_transform_state. */
1487 void wined3d_check_gl_call(const struct wined3d_gl_info
*gl_info
,
1488 const char *file
, unsigned int line
, const char *name
) DECLSPEC_HIDDEN
;
1490 /* Checking of API calls */
1491 /* --------------------- */
1492 #ifndef WINE_NO_DEBUG_MSGS
1493 #define checkGLcall(A) \
1495 if (__WINE_IS_DEBUG_ON(_ERR, &__wine_dbch_d3d) \
1496 && !gl_info->supported[ARB_DEBUG_OUTPUT]) \
1497 wined3d_check_gl_call(gl_info, __FILE__, __LINE__, A); \
1500 #define checkGLcall(A) do {} while(0)
1503 struct wined3d_bo_address
1505 UINT_PTR buffer_object
;
1509 struct wined3d_const_bo_address
1511 UINT_PTR buffer_object
;
1515 static inline struct wined3d_const_bo_address
*wined3d_const_bo_address(struct wined3d_bo_address
*data
)
1517 return (struct wined3d_const_bo_address
*)data
;
1520 struct wined3d_stream_info_element
1522 const struct wined3d_format
*format
;
1523 struct wined3d_bo_address data
;
1525 unsigned int stream_idx
;
1526 unsigned int divisor
;
1529 struct wined3d_stream_info
1531 struct wined3d_stream_info_element elements
[MAX_ATTRIBS
];
1532 DWORD position_transformed
: 1;
1534 WORD swizzle_map
; /* MAX_ATTRIBS, 16 */
1535 WORD use_map
; /* MAX_ATTRIBS, 16 */
1538 void wined3d_stream_info_from_declaration(struct wined3d_stream_info
*stream_info
,
1539 const struct wined3d_state
*state
, const struct wined3d_d3d_info
*d3d_info
) DECLSPEC_HIDDEN
;
1541 struct wined3d_direct_dispatch_parameters
1543 unsigned int group_count_x
;
1544 unsigned int group_count_y
;
1545 unsigned int group_count_z
;
1548 struct wined3d_indirect_dispatch_parameters
1550 struct wined3d_buffer
*buffer
;
1551 unsigned int offset
;
1554 struct wined3d_dispatch_parameters
1559 struct wined3d_direct_dispatch_parameters direct
;
1560 struct wined3d_indirect_dispatch_parameters indirect
;
1564 struct wined3d_direct_draw_parameters
1566 int base_vertex_idx
;
1567 unsigned int start_idx
;
1568 unsigned int index_count
;
1569 unsigned int start_instance
;
1570 unsigned int instance_count
;
1573 struct wined3d_indirect_draw_parameters
1575 struct wined3d_buffer
*buffer
;
1576 unsigned int offset
;
1579 struct wined3d_draw_parameters
1584 struct wined3d_direct_draw_parameters direct
;
1585 struct wined3d_indirect_draw_parameters indirect
;
1590 void draw_primitive(struct wined3d_device
*device
, const struct wined3d_state
*state
,
1591 const struct wined3d_draw_parameters
*draw_parameters
) DECLSPEC_HIDDEN
;
1592 void dispatch_compute(struct wined3d_device
*device
, const struct wined3d_state
*state
,
1593 const struct wined3d_dispatch_parameters
*dispatch_parameters
) DECLSPEC_HIDDEN
;
1597 #define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
1598 (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
1600 enum wined3d_pipeline
1602 WINED3D_PIPELINE_GRAPHICS
,
1603 WINED3D_PIPELINE_COMPUTE
,
1604 WINED3D_PIPELINE_COUNT
,
1607 /* Routines and structures related to state management */
1609 #define STATE_RENDER(a) (a)
1610 #define STATE_IS_RENDER(a) ((a) >= STATE_RENDER(1) && (a) <= STATE_RENDER(WINEHIGHEST_RENDER_STATE))
1612 #define STATE_TEXTURESTAGE(stage, num) \
1613 (STATE_RENDER(WINEHIGHEST_RENDER_STATE) + 1 + (stage) * (WINED3D_HIGHEST_TEXTURE_STATE + 1) + (num))
1614 #define STATE_IS_TEXTURESTAGE(a) \
1615 ((a) >= STATE_TEXTURESTAGE(0, 1) && (a) <= STATE_TEXTURESTAGE(WINED3D_MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE))
1617 /* + 1 because samplers start with 0 */
1618 #define STATE_SAMPLER(num) (STATE_TEXTURESTAGE(WINED3D_MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE) + 1 + (num))
1619 #define STATE_IS_SAMPLER(num) ((num) >= STATE_SAMPLER(0) && (num) <= STATE_SAMPLER(WINED3D_MAX_COMBINED_SAMPLERS - 1))
1621 #define STATE_GRAPHICS_SHADER(a) (STATE_SAMPLER(WINED3D_MAX_COMBINED_SAMPLERS) + (a))
1622 #define STATE_IS_GRAPHICS_SHADER(a) \
1623 ((a) >= STATE_GRAPHICS_SHADER(0) && (a) < STATE_GRAPHICS_SHADER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
1625 #define STATE_GRAPHICS_CONSTANT_BUFFER(a) (STATE_GRAPHICS_SHADER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT) + (a))
1626 #define STATE_IS_GRAPHICS_CONSTANT_BUFFER(a) \
1627 ((a) >= STATE_GRAPHICS_CONSTANT_BUFFER(0) \
1628 && (a) < STATE_GRAPHICS_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
1630 #define STATE_GRAPHICS_SHADER_RESOURCE_BINDING (STATE_GRAPHICS_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
1631 #define STATE_IS_GRAPHICS_SHADER_RESOURCE_BINDING(a) ((a) == STATE_GRAPHICS_SHADER_RESOURCE_BINDING)
1633 #define STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING (STATE_GRAPHICS_SHADER_RESOURCE_BINDING + 1)
1634 #define STATE_IS_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING)
1636 #define STATE_TRANSFORM(a) (STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING + (a))
1637 #define STATE_IS_TRANSFORM(a) ((a) >= STATE_TRANSFORM(1) && (a) <= STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(255)))
1639 #define STATE_STREAMSRC (STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(255)) + 1)
1640 #define STATE_IS_STREAMSRC(a) ((a) == STATE_STREAMSRC)
1641 #define STATE_INDEXBUFFER (STATE_STREAMSRC + 1)
1642 #define STATE_IS_INDEXBUFFER(a) ((a) == STATE_INDEXBUFFER)
1644 #define STATE_VDECL (STATE_INDEXBUFFER + 1)
1645 #define STATE_IS_VDECL(a) ((a) == STATE_VDECL)
1647 #define STATE_VIEWPORT (STATE_VDECL + 1)
1648 #define STATE_IS_VIEWPORT(a) ((a) == STATE_VIEWPORT)
1650 #define STATE_LIGHT_TYPE (STATE_VIEWPORT + 1)
1651 #define STATE_IS_LIGHT_TYPE(a) ((a) == STATE_LIGHT_TYPE)
1652 #define STATE_ACTIVELIGHT(a) (STATE_LIGHT_TYPE + 1 + (a))
1653 #define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(WINED3D_MAX_ACTIVE_LIGHTS))
1655 #define STATE_SCISSORRECT (STATE_ACTIVELIGHT(WINED3D_MAX_ACTIVE_LIGHTS - 1) + 1)
1656 #define STATE_IS_SCISSORRECT(a) ((a) == STATE_SCISSORRECT)
1658 #define STATE_CLIPPLANE(a) (STATE_SCISSORRECT + 1 + (a))
1659 #define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES - 1))
1661 #define STATE_MATERIAL (STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES))
1662 #define STATE_IS_MATERIAL(a) ((a) == STATE_MATERIAL)
1664 #define STATE_RASTERIZER (STATE_MATERIAL + 1)
1665 #define STATE_IS_RASTERIZER(a) ((a) == STATE_RASTERIZER)
1667 #define STATE_POINTSPRITECOORDORIGIN (STATE_RASTERIZER + 1)
1668 #define STATE_IS_POINTSPRITECOORDORIGIN(a) ((a) == STATE_POINTSPRITECOORDORIGIN)
1670 #define STATE_BASEVERTEXINDEX (STATE_POINTSPRITECOORDORIGIN + 1)
1671 #define STATE_IS_BASEVERTEXINDEX(a) ((a) == STATE_BASEVERTEXINDEX)
1673 #define STATE_FRAMEBUFFER (STATE_BASEVERTEXINDEX + 1)
1674 #define STATE_IS_FRAMEBUFFER(a) ((a) == STATE_FRAMEBUFFER)
1676 #define STATE_POINT_ENABLE (STATE_FRAMEBUFFER + 1)
1677 #define STATE_IS_POINT_ENABLE(a) ((a) == STATE_POINT_ENABLE)
1679 #define STATE_COLOR_KEY (STATE_POINT_ENABLE + 1)
1680 #define STATE_IS_COLOR_KEY(a) ((a) == STATE_COLOR_KEY)
1682 #define STATE_STREAM_OUTPUT (STATE_COLOR_KEY + 1)
1683 #define STATE_IS_STREAM_OUTPUT(a) ((a) == STATE_STREAM_OUTPUT)
1685 #define STATE_BLEND (STATE_STREAM_OUTPUT + 1)
1686 #define STATE_IS_BLEND(a) ((a) == STATE_BLEND)
1688 #define STATE_BLEND_FACTOR (STATE_BLEND + 1)
1689 #define STATE_IS_BLEND_FACTOR(a) ((a) == STATE_BLEND_FACTOR)
1691 #define STATE_COMPUTE_OFFSET (STATE_BLEND_FACTOR + 1)
1693 #define STATE_COMPUTE_SHADER (STATE_COMPUTE_OFFSET)
1694 #define STATE_IS_COMPUTE_SHADER(a) ((a) == STATE_COMPUTE_SHADER)
1696 #define STATE_COMPUTE_CONSTANT_BUFFER (STATE_COMPUTE_SHADER + 1)
1697 #define STATE_IS_COMPUTE_CONSTANT_BUFFER(a) ((a) == STATE_COMPUTE_CONSTANT_BUFFER)
1699 #define STATE_COMPUTE_SHADER_RESOURCE_BINDING (STATE_COMPUTE_CONSTANT_BUFFER + 1)
1700 #define STATE_IS_COMPUTE_SHADER_RESOURCE_BINDING(a) ((a) == STATE_COMPUTE_SHADER_RESOURCE_BINDING)
1702 #define STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING (STATE_COMPUTE_SHADER_RESOURCE_BINDING + 1)
1703 #define STATE_IS_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1705 #define STATE_COMPUTE_HIGHEST (STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1706 #define STATE_HIGHEST (STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1708 #define STATE_IS_COMPUTE(a) ((a) >= STATE_COMPUTE_OFFSET && (a) <= STATE_COMPUTE_HIGHEST)
1709 #define STATE_COMPUTE_COUNT (STATE_COMPUTE_HIGHEST - STATE_COMPUTE_OFFSET + 1)
1711 #define STATE_SHADER(a) ((a) != WINED3D_SHADER_TYPE_COMPUTE ? STATE_GRAPHICS_SHADER(a) : STATE_COMPUTE_SHADER)
1712 #define STATE_CONSTANT_BUFFER(a) \
1713 ((a) != WINED3D_SHADER_TYPE_COMPUTE ? STATE_GRAPHICS_CONSTANT_BUFFER(a) : STATE_COMPUTE_CONSTANT_BUFFER)
1714 #define STATE_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == WINED3D_PIPELINE_GRAPHICS ? \
1715 STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING : STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1723 union wined3d_gl_fence_object
1729 enum wined3d_fence_result
1732 WINED3D_FENCE_WAITING
,
1733 WINED3D_FENCE_NOT_STARTED
,
1734 WINED3D_FENCE_WRONG_THREAD
,
1735 WINED3D_FENCE_ERROR
,
1738 struct wined3d_fence
1741 union wined3d_gl_fence_object object
;
1742 struct wined3d_context_gl
*context_gl
;
1745 HRESULT
wined3d_fence_create(struct wined3d_device
*device
, struct wined3d_fence
**fence
) DECLSPEC_HIDDEN
;
1746 void wined3d_fence_destroy(struct wined3d_fence
*fence
) DECLSPEC_HIDDEN
;
1747 void wined3d_fence_issue(struct wined3d_fence
*fence
, struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
1748 enum wined3d_fence_result
wined3d_fence_wait(const struct wined3d_fence
*fence
,
1749 struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
1751 /* Direct3D terminology with little modifications. We do not have an issued
1752 * state because only the driver knows about it, but we have a created state
1753 * because D3D allows GetData() on a created query, but OpenGL doesn't. */
1754 enum wined3d_query_state
1761 struct wined3d_query_ops
1763 BOOL (*query_poll
)(struct wined3d_query
*query
, DWORD flags
);
1764 BOOL (*query_issue
)(struct wined3d_query
*query
, DWORD flags
);
1765 void (*query_destroy
)(struct wined3d_query
*query
);
1768 struct wined3d_query
1773 const struct wined3d_parent_ops
*parent_ops
;
1774 struct wined3d_device
*device
;
1775 enum wined3d_query_state state
;
1776 enum wined3d_query_type type
;
1779 const struct wined3d_query_ops
*query_ops
;
1781 LONG counter_main
, counter_retrieved
;
1782 struct list poll_list_entry
;
1784 GLuint buffer_object
;
1788 HRESULT
wined3d_query_gl_create(struct wined3d_device
*device
, enum wined3d_query_type type
, void *parent
,
1789 const struct wined3d_parent_ops
*parent_ops
, struct wined3d_query
**query
) DECLSPEC_HIDDEN
;
1790 void wined3d_query_gl_destroy_buffer_object(struct wined3d_context_gl
*context_gl
,
1791 struct wined3d_query
*query
) DECLSPEC_HIDDEN
;
1793 struct wined3d_event_query
1795 struct wined3d_query query
;
1797 struct wined3d_fence fence
;
1801 struct wined3d_occlusion_query
1803 struct wined3d_query query
;
1807 struct wined3d_context_gl
*context_gl
;
1812 struct wined3d_timestamp_query
1814 struct wined3d_query query
;
1818 struct wined3d_context_gl
*context_gl
;
1822 union wined3d_gl_so_statistics_query
1832 struct wined3d_so_statistics_query
1834 struct wined3d_query query
;
1837 union wined3d_gl_so_statistics_query u
;
1838 struct wined3d_context_gl
*context_gl
;
1839 unsigned int stream_idx
;
1840 struct wined3d_query_data_so_statistics statistics
;
1844 union wined3d_gl_pipeline_statistics_query
1851 GLuint vertex_shader
;
1852 GLuint tess_control_shader
;
1853 GLuint tess_eval_shader
;
1854 GLuint geometry_shader
;
1855 GLuint geometry_primitives
;
1856 GLuint fragment_shader
;
1857 GLuint compute_shader
;
1858 GLuint clipping_input
;
1859 GLuint clipping_output
;
1863 struct wined3d_pipeline_statistics_query
1865 struct wined3d_query query
;
1868 union wined3d_gl_pipeline_statistics_query u
;
1869 struct wined3d_context_gl
*context_gl
;
1870 struct wined3d_query_data_pipeline_statistics statistics
;
1874 struct wined3d_gl_view
1880 struct wined3d_rendertarget_info
1882 struct wined3d_gl_view gl_view
;
1883 struct wined3d_resource
*resource
;
1884 unsigned int sub_resource_idx
;
1885 unsigned int layer_count
;
1888 struct wined3d_fb_state
1890 struct wined3d_rendertarget_view
*render_targets
[MAX_RENDER_TARGET_VIEWS
];
1891 struct wined3d_rendertarget_view
*depth_stencil
;
1894 #define MAX_GL_FRAGMENT_SAMPLERS 32
1896 struct wined3d_context
1898 const struct wined3d_d3d_info
*d3d_info
;
1899 const struct wined3d_state_entry
*state_table
;
1900 uint32_t dirty_graphics_states
[STATE_HIGHEST
/ (sizeof(uint32_t) * CHAR_BIT
) + 1];
1901 uint32_t dirty_compute_states
[STATE_COMPUTE_COUNT
/ (sizeof(uint32_t) * CHAR_BIT
) + 1];
1903 struct wined3d_device
*device
;
1904 struct wined3d_swapchain
*swapchain
;
1907 struct wined3d_texture
*texture
;
1908 unsigned int sub_resource_idx
;
1911 /* Stores some information about the context state for optimization */
1912 DWORD shader_update_mask
: 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */
1913 DWORD update_shader_resource_bindings
: 1;
1914 DWORD update_compute_shader_resource_bindings
: 1;
1915 DWORD update_unordered_access_view_bindings
: 1;
1916 DWORD update_compute_unordered_access_view_bindings
: 1;
1917 DWORD last_swizzle_map
: 16; /* MAX_ATTRIBS, 16 */
1918 DWORD last_was_rhw
: 1; /* True iff last draw_primitive was in xyzrhw mode. */
1919 DWORD last_was_pshader
: 1;
1920 DWORD last_was_vshader
: 1;
1921 DWORD last_was_diffuse
: 1;
1922 DWORD last_was_specular
: 1;
1923 DWORD last_was_normal
: 1;
1925 DWORD last_was_ffp_blit
: 1;
1926 DWORD last_was_blit
: 1;
1927 DWORD last_was_ckey
: 1;
1928 DWORD namedArraysLoaded
: 1;
1929 DWORD texShaderBumpMap
: 8; /* WINED3D_MAX_TEXTURES, 8 */
1930 DWORD lastWasPow2Texture
: 8; /* WINED3D_MAX_TEXTURES, 8 */
1931 DWORD fixed_function_usage_map
: 8; /* WINED3D_MAX_TEXTURES, 8 */
1932 DWORD lowest_disabled_stage
: 4; /* Max WINED3D_MAX_TEXTURES, 8 */
1934 DWORD use_immediate_mode_draw
: 1;
1935 DWORD uses_uavs
: 1;
1936 DWORD transform_feedback_active
: 1;
1937 DWORD transform_feedback_paused
: 1;
1938 DWORD fog_coord
: 1;
1939 DWORD render_offscreen
: 1;
1941 DWORD destroyed
: 1;
1942 DWORD destroy_delayed
: 1;
1943 DWORD clip_distance_mask
: 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
1946 DWORD constant_update_mask
;
1947 DWORD numbered_array_mask
;
1948 enum fogsource fog_source
;
1950 UINT instance_count
;
1952 void *shader_backend_data
;
1953 void *fragment_pipe_data
;
1955 struct wined3d_stream_info stream_info
;
1957 /* Fences for GL_APPLE_flush_buffer_range */
1958 struct wined3d_fence
*buffer_fences
[MAX_ATTRIBS
];
1959 unsigned int buffer_fence_count
;
1961 unsigned int viewport_count
;
1962 unsigned int scissor_rect_count
;
1965 void wined3d_context_cleanup(struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
1967 HRESULT
wined3d_context_no3d_init(struct wined3d_context
*context_no3d
,
1968 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
1970 struct wined3d_context_gl
1972 struct wined3d_context c
;
1974 const struct wined3d_gl_info
*gl_info
;
1976 DWORD tid
; /* Thread ID which owns this context at the moment. */
1978 uint32_t dc_is_private
: 1;
1979 uint32_t dc_has_format
: 1; /* Only meaningful for private DCs. */
1980 uint32_t fog_enabled
: 1;
1981 uint32_t diffuse_attrib_to_1
: 1;
1982 uint32_t rebind_fbo
: 1;
1983 uint32_t untracked_material_count
: 2; /* Max value 2 */
1984 uint32_t needs_set
: 1;
1986 uint32_t padding
: 23;
1988 uint32_t default_attrib_value_set
;
1990 GLenum tracking_parm
; /* Which source is tracking current colour. */
1991 GLenum untracked_materials
[2];
1993 unsigned int active_texture
;
1995 GLenum
*texture_type
;
1997 /* The WGL context. */
2002 HWND restore_pf_win
;
2010 unsigned int fbo_entry_count
;
2011 struct list fbo_list
;
2012 struct list fbo_destroy_list
;
2013 struct fbo_entry
*current_fbo
;
2014 GLuint fbo_read_binding
;
2015 GLuint fbo_draw_binding
;
2016 struct wined3d_rendertarget_info blit_targets
[MAX_RENDER_TARGET_VIEWS
];
2017 uint32_t draw_buffers_mask
; /* Enabled draw buffers, 31 max. */
2020 struct list occlusion_queries
;
2022 struct list timestamp_queries
;
2023 struct list so_statistics_queries
;
2024 struct list pipeline_statistics_queries
;
2026 GLuint
*free_occlusion_queries
;
2027 SIZE_T free_occlusion_query_size
;
2028 unsigned int free_occlusion_query_count
;
2030 union wined3d_gl_fence_object
*free_fences
;
2031 SIZE_T free_fence_size
;
2032 unsigned int free_fence_count
;
2034 GLuint
*free_timestamp_queries
;
2035 SIZE_T free_timestamp_query_size
;
2036 unsigned int free_timestamp_query_count
;
2038 union wined3d_gl_so_statistics_query
*free_so_statistics_queries
;
2039 SIZE_T free_so_statistics_query_size
;
2040 unsigned int free_so_statistics_query_count
;
2042 union wined3d_gl_pipeline_statistics_query
*free_pipeline_statistics_queries
;
2043 SIZE_T free_pipeline_statistics_query_size
;
2044 unsigned int free_pipeline_statistics_query_count
;
2048 unsigned int tex_unit_map
[WINED3D_MAX_COMBINED_SAMPLERS
];
2049 unsigned int rev_tex_unit_map
[MAX_GL_FRAGMENT_SAMPLERS
+ WINED3D_MAX_VERTEX_SAMPLERS
];
2051 /* Extension emulation. */
2052 GLint gl_fog_source
;
2053 GLfloat fog_coord_value
;
2054 GLfloat colour
[4], fog_start
, fog_end
, fog_colour
[4];
2056 GLuint dummy_arbfp_prog
;
2059 static inline struct wined3d_context_gl
*wined3d_context_gl(struct wined3d_context
*context
)
2061 return CONTAINING_RECORD(context
, struct wined3d_context_gl
, c
);
2064 static inline const struct wined3d_context_gl
*wined3d_context_gl_const(const struct wined3d_context
*context
)
2066 return CONTAINING_RECORD(context
, struct wined3d_context_gl
, c
);
2069 struct wined3d_context
*wined3d_context_gl_acquire(const struct wined3d_device
*device
,
2070 struct wined3d_texture
*texture
, unsigned int sub_resource_idx
) DECLSPEC_HIDDEN
;
2071 void wined3d_context_gl_active_texture(struct wined3d_context_gl
*context_gl
,
2072 const struct wined3d_gl_info
*gl_info
, unsigned int unit
) DECLSPEC_HIDDEN
;
2073 void wined3d_context_gl_alloc_fence(struct wined3d_context_gl
*context_gl
,
2074 struct wined3d_fence
*fence
) DECLSPEC_HIDDEN
;
2075 void wined3d_context_gl_alloc_occlusion_query(struct wined3d_context_gl
*context_gl
,
2076 struct wined3d_occlusion_query
*query
) DECLSPEC_HIDDEN
;
2077 void wined3d_context_gl_alloc_pipeline_statistics_query(struct wined3d_context_gl
*context_gl
,
2078 struct wined3d_pipeline_statistics_query
*query
) DECLSPEC_HIDDEN
;
2079 void wined3d_context_gl_alloc_so_statistics_query(struct wined3d_context_gl
*context_gl
,
2080 struct wined3d_so_statistics_query
*query
) DECLSPEC_HIDDEN
;
2081 void wined3d_context_gl_alloc_timestamp_query(struct wined3d_context_gl
*context_gl
,
2082 struct wined3d_timestamp_query
*query
) DECLSPEC_HIDDEN
;
2083 void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl
*context_gl
,
2084 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2085 BOOL
wined3d_context_gl_apply_clear_state(struct wined3d_context_gl
*context_gl
, const struct wined3d_state
*state
,
2086 unsigned int rt_count
, const struct wined3d_fb_state
*fb
) DECLSPEC_HIDDEN
;
2087 void wined3d_context_gl_apply_fbo_state_blit(struct wined3d_context_gl
*context_gl
, GLenum target
,
2088 struct wined3d_resource
*rt
, unsigned int rt_sub_resource_idx
,
2089 struct wined3d_resource
*ds
, unsigned int ds_sub_resource_idx
, DWORD location
) DECLSPEC_HIDDEN
;
2090 void wined3d_context_gl_apply_ffp_blit_state(struct wined3d_context_gl
*context_gl
,
2091 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2092 void wined3d_context_gl_bind_bo(struct wined3d_context_gl
*context_gl
, GLenum binding
, GLuint name
) DECLSPEC_HIDDEN
;
2093 void wined3d_context_gl_bind_dummy_textures(const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2094 void wined3d_context_gl_bind_texture(struct wined3d_context_gl
*context_gl
,
2095 GLenum target
, GLuint name
) DECLSPEC_HIDDEN
;
2096 void wined3d_context_gl_check_fbo_status(const struct wined3d_context_gl
*context_gl
, GLenum target
) DECLSPEC_HIDDEN
;
2097 void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl
*context_gl
,
2098 const struct wined3d_bo_address
*dst
, GLenum dst_binding
,
2099 const struct wined3d_bo_address
*src
, GLenum src_binding
, size_t size
) DECLSPEC_HIDDEN
;
2100 void wined3d_context_gl_destroy(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2101 void wined3d_context_gl_draw_shaded_quad(struct wined3d_context_gl
*context_gl
, struct wined3d_texture_gl
*texture_gl
,
2102 unsigned int sub_resource_idx
, const RECT
*src_rect
, const RECT
*dst_rect
,
2103 enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
2104 void wined3d_context_gl_draw_textured_quad(struct wined3d_context_gl
*context_gl
,
2105 struct wined3d_texture_gl
*texture_gl
, unsigned int sub_resource_idx
,
2106 const RECT
*src_rect
, const RECT
*dst_rect
, enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
2107 void wined3d_context_gl_enable_clip_distances(struct wined3d_context_gl
*context_gl
, uint32_t mask
) DECLSPEC_HIDDEN
;
2108 void wined3d_context_gl_end_transform_feedback(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2109 void wined3d_context_gl_free_fence(struct wined3d_fence
*fence
) DECLSPEC_HIDDEN
;
2110 void wined3d_context_gl_free_occlusion_query(struct wined3d_occlusion_query
*query
) DECLSPEC_HIDDEN
;
2111 void wined3d_context_gl_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query
*query
) DECLSPEC_HIDDEN
;
2112 void wined3d_context_gl_free_so_statistics_query(struct wined3d_so_statistics_query
*query
) DECLSPEC_HIDDEN
;
2113 void wined3d_context_gl_free_timestamp_query(struct wined3d_timestamp_query
*query
) DECLSPEC_HIDDEN
;
2114 struct wined3d_context_gl
*wined3d_context_gl_get_current(void) DECLSPEC_HIDDEN
;
2115 GLenum
wined3d_context_gl_get_offscreen_gl_buffer(const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2116 const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl
*context_gl
,
2117 const struct wined3d_shader_version
*shader_version
, unsigned int *base
, unsigned int *count
) DECLSPEC_HIDDEN
;
2118 HRESULT
wined3d_context_gl_init(struct wined3d_context_gl
*context_gl
,
2119 struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
2120 void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl
*context_gl
,
2121 const struct wined3d_stream_info
*si
, GLuint
*current_bo
, const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
2122 void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl
*context_gl
,
2123 const struct wined3d_bo_address
*data
, size_t size
, GLenum binding
, DWORD flags
) DECLSPEC_HIDDEN
;
2124 struct wined3d_context_gl
*wined3d_context_gl_reacquire(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2125 void wined3d_context_gl_release(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2126 BOOL
wined3d_context_gl_set_current(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2127 void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl
*context_gl
, GLenum buffer
) DECLSPEC_HIDDEN
;
2128 void wined3d_context_gl_texture_update(struct wined3d_context_gl
*context_gl
,
2129 const struct wined3d_texture_gl
*texture_gl
) DECLSPEC_HIDDEN
;
2130 void wined3d_context_gl_unload_tex_coords(const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2131 void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl
*context_gl
,
2132 const struct wined3d_bo_address
*data
, GLenum binding
) DECLSPEC_HIDDEN
;
2133 void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl
*context_gl
,
2134 const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
2136 struct wined3d_context_vk
2138 struct wined3d_context c
;
2141 void wined3d_context_vk_cleanup(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2142 HRESULT
wined3d_context_vk_init(struct wined3d_context_vk
*context_vk
,
2143 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
2145 typedef void (*APPLYSTATEFUNC
)(struct wined3d_context
*ctx
, const struct wined3d_state
*state
, DWORD state_id
);
2147 struct wined3d_state_entry
2149 unsigned int representative
;
2150 APPLYSTATEFUNC apply
;
2153 struct wined3d_state_entry_template
2156 struct wined3d_state_entry content
;
2157 unsigned int extension
;
2160 #define WINED3D_FRAGMENT_CAP_PROJ_CONTROL 0x00000001
2161 #define WINED3D_FRAGMENT_CAP_SRGB_WRITE 0x00000002
2162 #define WINED3D_FRAGMENT_CAP_COLOR_KEY 0x00000004
2164 struct fragment_caps
2167 DWORD PrimitiveMiscCaps
;
2168 DWORD TextureOpCaps
;
2169 DWORD MaxTextureBlendStages
;
2170 DWORD MaxSimultaneousTextures
;
2173 #define GL_EXT_EMUL_ARB_MULTITEXTURE 0x00000001
2174 #define GL_EXT_EMUL_EXT_FOG_COORD 0x00000002
2176 struct wined3d_fragment_pipe_ops
2178 void (*fp_enable
)(const struct wined3d_context
*context
, BOOL enable
);
2179 void (*get_caps
)(const struct wined3d_adapter
*adapter
, struct fragment_caps
*caps
);
2180 DWORD (*get_emul_mask
)(const struct wined3d_gl_info
*gl_info
);
2181 void *(*alloc_private
)(const struct wined3d_shader_backend_ops
*shader_backend
, void *shader_priv
);
2182 void (*free_private
)(struct wined3d_device
*device
, struct wined3d_context
*context
);
2183 BOOL (*allocate_context_data
)(struct wined3d_context
*context
);
2184 void (*free_context_data
)(struct wined3d_context
*context
);
2185 BOOL (*color_fixup_supported
)(struct color_fixup_desc fixup
);
2186 const struct wined3d_state_entry_template
*states
;
2189 struct wined3d_vertex_caps
2192 BOOL emulated_flatshading
;
2193 BOOL ffp_generic_attributes
;
2194 DWORD max_active_lights
;
2195 DWORD max_vertex_blend_matrices
;
2196 DWORD max_vertex_blend_matrix_index
;
2197 DWORD vertex_processing_caps
;
2199 DWORD max_user_clip_planes
;
2203 struct wined3d_vertex_pipe_ops
2205 void (*vp_enable
)(const struct wined3d_context
*context
, BOOL enable
);
2206 void (*vp_get_caps
)(const struct wined3d_adapter
*adapter
, struct wined3d_vertex_caps
*caps
);
2207 DWORD (*vp_get_emul_mask
)(const struct wined3d_gl_info
*gl_info
);
2208 void *(*vp_alloc
)(const struct wined3d_shader_backend_ops
*shader_backend
, void *shader_priv
);
2209 void (*vp_free
)(struct wined3d_device
*device
, struct wined3d_context
*context
);
2210 const struct wined3d_state_entry_template
*vp_states
;
2213 extern const struct wined3d_state_entry_template misc_state_template
[] DECLSPEC_HIDDEN
;
2214 extern const struct wined3d_fragment_pipe_ops none_fragment_pipe DECLSPEC_HIDDEN
;
2215 extern const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline DECLSPEC_HIDDEN
;
2216 extern const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline DECLSPEC_HIDDEN
;
2217 extern const struct wined3d_fragment_pipe_ops arbfp_fragment_pipeline DECLSPEC_HIDDEN
;
2218 extern const struct wined3d_fragment_pipe_ops nvts_fragment_pipeline DECLSPEC_HIDDEN
;
2219 extern const struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline DECLSPEC_HIDDEN
;
2220 extern const struct wined3d_fragment_pipe_ops glsl_fragment_pipe DECLSPEC_HIDDEN
;
2222 extern const struct wined3d_vertex_pipe_ops none_vertex_pipe DECLSPEC_HIDDEN
;
2223 extern const struct wined3d_vertex_pipe_ops ffp_vertex_pipe DECLSPEC_HIDDEN
;
2224 extern const struct wined3d_vertex_pipe_ops glsl_vertex_pipe DECLSPEC_HIDDEN
;
2226 /* "Base" state table */
2227 HRESULT
compile_state_table(struct wined3d_state_entry
*state_table
, APPLYSTATEFUNC
**dev_multistate_funcs
,
2228 const struct wined3d_d3d_info
*d3d_info
, const BOOL
*supported_extensions
,
2229 const struct wined3d_vertex_pipe_ops
*vertex
, const struct wined3d_fragment_pipe_ops
*fragment
,
2230 const struct wined3d_state_entry_template
*misc
) DECLSPEC_HIDDEN
;
2232 enum wined3d_blit_op
2234 WINED3D_BLIT_OP_COLOR_BLIT
,
2235 WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST
,
2236 WINED3D_BLIT_OP_COLOR_BLIT_CKEY
,
2237 WINED3D_BLIT_OP_DEPTH_BLIT
,
2238 WINED3D_BLIT_OP_RAW_BLIT
,
2241 struct wined3d_blitter
2243 const struct wined3d_blitter_ops
*ops
;
2244 struct wined3d_blitter
*next
;
2247 struct wined3d_blitter_ops
2249 void (*blitter_destroy
)(struct wined3d_blitter
*blitter
, struct wined3d_context
*context
);
2250 void (*blitter_clear
)(struct wined3d_blitter
*blitter
, struct wined3d_device
*device
,
2251 unsigned int rt_count
, const struct wined3d_fb_state
*fb
, unsigned int rect_count
, const RECT
*clear_rects
,
2252 const RECT
*draw_rect
, DWORD flags
, const struct wined3d_color
*colour
, float depth
, DWORD stencil
);
2253 DWORD (*blitter_blit
)(struct wined3d_blitter
*blitter
, enum wined3d_blit_op op
, struct wined3d_context
*context
,
2254 struct wined3d_texture
*src_texture
, unsigned int src_sub_resource_idx
, DWORD src_location
,
2255 const RECT
*src_rect
, struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
2256 DWORD dst_location
, const RECT
*dst_rect
, const struct wined3d_color_key
*colour_key
,
2257 enum wined3d_texture_filter_type filter
);
2260 void wined3d_arbfp_blitter_create(struct wined3d_blitter
**next
,
2261 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2262 struct wined3d_blitter
*wined3d_cpu_blitter_create(void) DECLSPEC_HIDDEN
;
2263 void wined3d_fbo_blitter_create(struct wined3d_blitter
**next
,
2264 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
2265 void wined3d_ffp_blitter_create(struct wined3d_blitter
**next
,
2266 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
2267 struct wined3d_blitter
*wined3d_glsl_blitter_create(struct wined3d_blitter
**next
,
2268 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2269 void wined3d_raw_blitter_create(struct wined3d_blitter
**next
,
2270 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
2272 BOOL
fbo_blitter_supported(enum wined3d_blit_op blit_op
, const struct wined3d_gl_info
*gl_info
,
2273 const struct wined3d_resource
*src_resource
, DWORD src_location
,
2274 const struct wined3d_resource
*dst_resource
, DWORD dst_location
) DECLSPEC_HIDDEN
;
2276 BOOL
wined3d_clip_blit(const RECT
*clip_rect
, RECT
*clipped
, RECT
*other
) DECLSPEC_HIDDEN
;
2278 HGLRC
context_create_wgl_attribs(const struct wined3d_gl_info
*gl_info
, HDC hdc
, HGLRC share_ctx
) DECLSPEC_HIDDEN
;
2279 DWORD
context_get_tls_idx(void) DECLSPEC_HIDDEN
;
2280 void context_gl_resource_released(struct wined3d_device
*device
,
2281 GLuint name
, BOOL rb_namespace
) DECLSPEC_HIDDEN
;
2282 void context_invalidate_compute_state(struct wined3d_context
*context
, DWORD state_id
) DECLSPEC_HIDDEN
;
2283 void context_invalidate_state(struct wined3d_context
*context
, DWORD state_id
) DECLSPEC_HIDDEN
;
2284 void context_resource_released(const struct wined3d_device
*device
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
2285 void context_restore(struct wined3d_context
*context
, struct wined3d_texture
*texture
,
2286 unsigned int sub_resource_idx
) DECLSPEC_HIDDEN
;
2287 void context_set_tls_idx(DWORD idx
) DECLSPEC_HIDDEN
;
2288 void context_state_drawbuf(struct wined3d_context
*context
,
2289 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
2290 void context_state_fb(struct wined3d_context
*context
,
2291 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
2293 /*****************************************************************************
2294 * Internal representation of a light
2296 struct wined3d_light_info
2298 struct wined3d_light OriginalParms
; /* Note D3D8LIGHT == D3D9LIGHT */
2299 DWORD OriginalIndex
;
2303 /* Converted parms to speed up swapping lights */
2304 struct wined3d_vec4 position
;
2305 struct wined3d_vec4 direction
;
2312 /* The default light parameters */
2313 extern const struct wined3d_light WINED3D_default_light DECLSPEC_HIDDEN
;
2315 struct wined3d_pixel_format
2317 int iPixelFormat
; /* WGL pixel format */
2318 int iPixelType
; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */
2319 int redSize
, greenSize
, blueSize
, alphaSize
, colorSize
;
2320 int depthSize
, stencilSize
;
2321 BOOL windowDrawable
;
2327 enum wined3d_pci_vendor
2329 HW_VENDOR_SOFTWARE
= 0x0000,
2330 HW_VENDOR_AMD
= 0x1002,
2331 HW_VENDOR_NVIDIA
= 0x10de,
2332 HW_VENDOR_VMWARE
= 0x15ad,
2333 HW_VENDOR_REDHAT
= 0x1af4,
2334 HW_VENDOR_INTEL
= 0x8086,
2337 enum wined3d_pci_device
2341 CARD_AMD_RAGE_128PRO
= 0x5246,
2342 CARD_AMD_RADEON_7200
= 0x5144,
2343 CARD_AMD_RADEON_8500
= 0x514c,
2344 CARD_AMD_RADEON_9500
= 0x4144,
2345 CARD_AMD_RADEON_XPRESS_200M
= 0x5955,
2346 CARD_AMD_RADEON_X700
= 0x5e4c,
2347 CARD_AMD_RADEON_X1600
= 0x71c2,
2348 CARD_AMD_RADEON_HD2350
= 0x94c7,
2349 CARD_AMD_RADEON_HD2600
= 0x9581,
2350 CARD_AMD_RADEON_HD2900
= 0x9400,
2351 CARD_AMD_RADEON_HD3200
= 0x9620,
2352 CARD_AMD_RADEON_HD3850
= 0x9515,
2353 CARD_AMD_RADEON_HD4200M
= 0x9712,
2354 CARD_AMD_RADEON_HD4350
= 0x954f,
2355 CARD_AMD_RADEON_HD4600
= 0x9495,
2356 CARD_AMD_RADEON_HD4700
= 0x944e,
2357 CARD_AMD_RADEON_HD4800
= 0x944c,
2358 CARD_AMD_RADEON_HD5400
= 0x68f9,
2359 CARD_AMD_RADEON_HD5600
= 0x68d8,
2360 CARD_AMD_RADEON_HD5700
= 0x68be,
2361 CARD_AMD_RADEON_HD5800
= 0x6898,
2362 CARD_AMD_RADEON_HD5900
= 0x689c,
2363 CARD_AMD_RADEON_HD6300
= 0x9803,
2364 CARD_AMD_RADEON_HD6400
= 0x6770,
2365 CARD_AMD_RADEON_HD6490M
= 0x6760,
2366 CARD_AMD_RADEON_HD6410D
= 0x9644,
2367 CARD_AMD_RADEON_HD6480G
= 0x9648,
2368 CARD_AMD_RADEON_HD6550D
= 0x9640,
2369 CARD_AMD_RADEON_HD6600
= 0x6758,
2370 CARD_AMD_RADEON_HD6600M
= 0x6741,
2371 CARD_AMD_RADEON_HD6700
= 0x68ba,
2372 CARD_AMD_RADEON_HD6800
= 0x6739,
2373 CARD_AMD_RADEON_HD6900
= 0x6719,
2374 CARD_AMD_RADEON_HD7660D
= 0x9901,
2375 CARD_AMD_RADEON_HD7700
= 0x683d,
2376 CARD_AMD_RADEON_HD7800
= 0x6819,
2377 CARD_AMD_RADEON_HD7870
= 0x6818,
2378 CARD_AMD_RADEON_HD7900
= 0x679a,
2379 CARD_AMD_RADEON_HD8600M
= 0x6660,
2380 CARD_AMD_RADEON_HD8670
= 0x6610,
2381 CARD_AMD_RADEON_HD8770
= 0x665c,
2382 CARD_AMD_RADEON_R3
= 0x9830,
2383 CARD_AMD_RADEON_R7
= 0x130f,
2384 CARD_AMD_RADEON_R9_285
= 0x6939,
2385 CARD_AMD_RADEON_R9_290
= 0x67b1,
2386 CARD_AMD_RADEON_R9_290X
= 0x67b0,
2387 CARD_AMD_RADEON_R9_FURY
= 0x7300,
2388 CARD_AMD_RADEON_R9_M370X
= 0x6821,
2389 CARD_AMD_RADEON_R9_M380
= 0x6647,
2390 CARD_AMD_RADEON_R9_M395X
= 0x6920,
2391 CARD_AMD_RADEON_RX_460
= 0x67ef,
2392 CARD_AMD_RADEON_RX_480
= 0x67df,
2393 CARD_AMD_RADEON_RX_VEGA_10
= 0x687f,
2394 CARD_AMD_RADEON_RX_VEGA_20
= 0x66af,
2396 CARD_NVIDIA_RIVA_128
= 0x0018,
2397 CARD_NVIDIA_RIVA_TNT
= 0x0020,
2398 CARD_NVIDIA_RIVA_TNT2
= 0x0028,
2399 CARD_NVIDIA_GEFORCE
= 0x0100,
2400 CARD_NVIDIA_GEFORCE2_MX
= 0x0110,
2401 CARD_NVIDIA_GEFORCE2
= 0x0150,
2402 CARD_NVIDIA_GEFORCE3
= 0x0200,
2403 CARD_NVIDIA_GEFORCE4_MX
= 0x0170,
2404 CARD_NVIDIA_GEFORCE4_TI4200
= 0x0253,
2405 CARD_NVIDIA_GEFORCEFX_5200
= 0x0320,
2406 CARD_NVIDIA_GEFORCEFX_5600
= 0x0312,
2407 CARD_NVIDIA_GEFORCEFX_5800
= 0x0302,
2408 CARD_NVIDIA_GEFORCE_6200
= 0x014f,
2409 CARD_NVIDIA_GEFORCE_6600GT
= 0x0140,
2410 CARD_NVIDIA_GEFORCE_6800
= 0x0041,
2411 CARD_NVIDIA_GEFORCE_7300
= 0x01d7, /* GeForce Go 7300 */
2412 CARD_NVIDIA_GEFORCE_7400
= 0x01d8,
2413 CARD_NVIDIA_GEFORCE_7600
= 0x0391,
2414 CARD_NVIDIA_GEFORCE_7800GT
= 0x0092,
2415 CARD_NVIDIA_GEFORCE_8200
= 0x0849, /* Other PCI ID 0x084b */
2416 CARD_NVIDIA_GEFORCE_8300GS
= 0x0423,
2417 CARD_NVIDIA_GEFORCE_8400GS
= 0x0404,
2418 CARD_NVIDIA_GEFORCE_8500GT
= 0x0421,
2419 CARD_NVIDIA_GEFORCE_8600GT
= 0x0402,
2420 CARD_NVIDIA_GEFORCE_8600MGT
= 0x0407,
2421 CARD_NVIDIA_GEFORCE_8800GTS
= 0x0193,
2422 CARD_NVIDIA_GEFORCE_8800GTX
= 0x0191,
2423 CARD_NVIDIA_GEFORCE_9200
= 0x086d,
2424 CARD_NVIDIA_GEFORCE_9300
= 0x086c,
2425 CARD_NVIDIA_GEFORCE_9400M
= 0x0863,
2426 CARD_NVIDIA_GEFORCE_9400GT
= 0x042c,
2427 CARD_NVIDIA_GEFORCE_9500GT
= 0x0640,
2428 CARD_NVIDIA_GEFORCE_9600GT
= 0x0622,
2429 CARD_NVIDIA_GEFORCE_9700MGT
= 0x064a,
2430 CARD_NVIDIA_GEFORCE_9800GT
= 0x0614,
2431 CARD_NVIDIA_GEFORCE_210
= 0x0a23,
2432 CARD_NVIDIA_GEFORCE_GT220
= 0x0a20,
2433 CARD_NVIDIA_GEFORCE_GT240
= 0x0ca3,
2434 CARD_NVIDIA_GEFORCE_GTS250
= 0x0615,
2435 CARD_NVIDIA_GEFORCE_GTX260
= 0x05e2,
2436 CARD_NVIDIA_GEFORCE_GTX275
= 0x05e6,
2437 CARD_NVIDIA_GEFORCE_GTX280
= 0x05e1,
2438 CARD_NVIDIA_GEFORCE_315M
= 0x0a7a,
2439 CARD_NVIDIA_GEFORCE_320M
= 0x08a3,
2440 CARD_NVIDIA_GEFORCE_GT320M
= 0x0a2d,
2441 CARD_NVIDIA_GEFORCE_GT325M
= 0x0a35,
2442 CARD_NVIDIA_GEFORCE_GT330
= 0x0ca0,
2443 CARD_NVIDIA_GEFORCE_GTS350M
= 0x0cb0,
2444 CARD_NVIDIA_GEFORCE_410M
= 0x1055,
2445 CARD_NVIDIA_GEFORCE_GT420
= 0x0de2,
2446 CARD_NVIDIA_GEFORCE_GT425M
= 0x0df0,
2447 CARD_NVIDIA_GEFORCE_GT430
= 0x0de1,
2448 CARD_NVIDIA_GEFORCE_GT440
= 0x0de0,
2449 CARD_NVIDIA_GEFORCE_GTS450
= 0x0dc4,
2450 CARD_NVIDIA_GEFORCE_GTX460
= 0x0e22,
2451 CARD_NVIDIA_GEFORCE_GTX460M
= 0x0dd1,
2452 CARD_NVIDIA_GEFORCE_GTX465
= 0x06c4,
2453 CARD_NVIDIA_GEFORCE_GTX470
= 0x06cd,
2454 CARD_NVIDIA_GEFORCE_GTX480
= 0x06c0,
2455 CARD_NVIDIA_GEFORCE_GT520
= 0x1040,
2456 CARD_NVIDIA_GEFORCE_GT525M
= 0x0dec,
2457 CARD_NVIDIA_GEFORCE_GT540M
= 0x0df4,
2458 CARD_NVIDIA_GEFORCE_GTX550
= 0x1244,
2459 CARD_NVIDIA_GEFORCE_GT555M
= 0x04b8,
2460 CARD_NVIDIA_GEFORCE_GTX560TI
= 0x1200,
2461 CARD_NVIDIA_GEFORCE_GTX560M
= 0x1251,
2462 CARD_NVIDIA_GEFORCE_GTX560
= 0x1201,
2463 CARD_NVIDIA_GEFORCE_GTX570
= 0x1081,
2464 CARD_NVIDIA_GEFORCE_GTX580
= 0x1080,
2465 CARD_NVIDIA_GEFORCE_GT610
= 0x104a,
2466 CARD_NVIDIA_GEFORCE_GT630
= 0x0f00,
2467 CARD_NVIDIA_GEFORCE_GT630M
= 0x0de9,
2468 CARD_NVIDIA_GEFORCE_GT640
= 0x0fc1,
2469 CARD_NVIDIA_GEFORCE_GT640M
= 0x0fd2,
2470 CARD_NVIDIA_GEFORCE_GT650M
= 0x0fd1,
2471 CARD_NVIDIA_GEFORCE_GTX650
= 0x0fc6,
2472 CARD_NVIDIA_GEFORCE_GTX650TI
= 0x11c6,
2473 CARD_NVIDIA_GEFORCE_GTX660
= 0x11c0,
2474 CARD_NVIDIA_GEFORCE_GTX660M
= 0x0fd4,
2475 CARD_NVIDIA_GEFORCE_GTX660TI
= 0x1183,
2476 CARD_NVIDIA_GEFORCE_GTX670
= 0x1189,
2477 CARD_NVIDIA_GEFORCE_GTX670MX
= 0x11a1,
2478 CARD_NVIDIA_GEFORCE_GTX675MX_1
= 0x11a7,
2479 CARD_NVIDIA_GEFORCE_GTX675MX_2
= 0x11a2,
2480 CARD_NVIDIA_GEFORCE_GTX680
= 0x1180,
2481 CARD_NVIDIA_GEFORCE_GTX690
= 0x1188,
2482 CARD_NVIDIA_GEFORCE_GT720
= 0x128b,
2483 CARD_NVIDIA_GEFORCE_GT730
= 0x1287,
2484 CARD_NVIDIA_GEFORCE_GT730M
= 0x0fe1,
2485 CARD_NVIDIA_GEFORCE_GT740M
= 0x1292,
2486 CARD_NVIDIA_GEFORCE_GT750M
= 0x0fe9,
2487 CARD_NVIDIA_GEFORCE_GT755M
= 0x0fcd,
2488 CARD_NVIDIA_GEFORCE_GTX750
= 0x1381,
2489 CARD_NVIDIA_GEFORCE_GTX750TI
= 0x1380,
2490 CARD_NVIDIA_GEFORCE_GTX760
= 0x1187,
2491 CARD_NVIDIA_GEFORCE_GTX760TI
= 0x1193,
2492 CARD_NVIDIA_GEFORCE_GTX765M
= 0x11e2,
2493 CARD_NVIDIA_GEFORCE_GTX770M
= 0x11e0,
2494 CARD_NVIDIA_GEFORCE_GTX770
= 0x1184,
2495 CARD_NVIDIA_GEFORCE_GTX775M
= 0x119d,
2496 CARD_NVIDIA_GEFORCE_GTX780
= 0x1004,
2497 CARD_NVIDIA_GEFORCE_GTX780M
= 0x119e,
2498 CARD_NVIDIA_GEFORCE_GTX780TI
= 0x100a,
2499 CARD_NVIDIA_GEFORCE_GTXTITAN
= 0x1005,
2500 CARD_NVIDIA_GEFORCE_GTXTITANB
= 0x100c,
2501 CARD_NVIDIA_GEFORCE_GTXTITANX
= 0x17c2,
2502 CARD_NVIDIA_GEFORCE_GTXTITANZ
= 0x1001,
2503 CARD_NVIDIA_GEFORCE_820M
= 0x0fed,
2504 CARD_NVIDIA_GEFORCE_830M
= 0x1340,
2505 CARD_NVIDIA_GEFORCE_840M
= 0x1341,
2506 CARD_NVIDIA_GEFORCE_845M
= 0x1344,
2507 CARD_NVIDIA_GEFORCE_GTX850M
= 0x1391,
2508 CARD_NVIDIA_GEFORCE_GTX860M
= 0x1392, /* Other PCI ID 0x119a */
2509 CARD_NVIDIA_GEFORCE_GTX870M
= 0x1199,
2510 CARD_NVIDIA_GEFORCE_GTX880M
= 0x1198,
2511 CARD_NVIDIA_GEFORCE_940M
= 0x1347,
2512 CARD_NVIDIA_GEFORCE_GTX950
= 0x1402,
2513 CARD_NVIDIA_GEFORCE_GTX950M
= 0x139a,
2514 CARD_NVIDIA_GEFORCE_GTX960
= 0x1401,
2515 CARD_NVIDIA_GEFORCE_GTX960M
= 0x139b,
2516 CARD_NVIDIA_GEFORCE_GTX970
= 0x13c2,
2517 CARD_NVIDIA_GEFORCE_GTX970M
= 0x13d8,
2518 CARD_NVIDIA_GEFORCE_GTX980
= 0x13c0,
2519 CARD_NVIDIA_GEFORCE_GTX980TI
= 0x17c8,
2520 CARD_NVIDIA_GEFORCE_GTX1050
= 0x1c81,
2521 CARD_NVIDIA_GEFORCE_GTX1050TI
= 0x1c82,
2522 CARD_NVIDIA_GEFORCE_GTX1060
= 0x1c03,
2523 CARD_NVIDIA_GEFORCE_GTX1070
= 0x1b81,
2524 CARD_NVIDIA_GEFORCE_GTX1080
= 0x1b80,
2525 CARD_NVIDIA_GEFORCE_GTX1080TI
= 0x1b06,
2526 CARD_NVIDIA_TITANX_PASCAL
= 0x1b00,
2527 CARD_NVIDIA_TITANV
= 0x1d81,
2528 CARD_NVIDIA_GEFORCE_GTX1660TI
= 0x2182,
2529 CARD_NVIDIA_GEFORCE_RTX2060
= 0x1f08,
2530 CARD_NVIDIA_GEFORCE_RTX2070
= 0x1f07,
2531 CARD_NVIDIA_GEFORCE_RTX2080
= 0x1e87,
2532 CARD_NVIDIA_GEFORCE_RTX2080TI
= 0x1e07,
2534 CARD_REDHAT_VIRGL
= 0x1010,
2536 CARD_VMWARE_SVGA3D
= 0x0405,
2538 CARD_INTEL_830M
= 0x3577,
2539 CARD_INTEL_855GM
= 0x3582,
2540 CARD_INTEL_845G
= 0x2562,
2541 CARD_INTEL_865G
= 0x2572,
2542 CARD_INTEL_915G
= 0x2582,
2543 CARD_INTEL_E7221G
= 0x258a,
2544 CARD_INTEL_915GM
= 0x2592,
2545 CARD_INTEL_945G
= 0x2772,
2546 CARD_INTEL_945GM
= 0x27a2,
2547 CARD_INTEL_945GME
= 0x27ae,
2548 CARD_INTEL_Q35
= 0x29b2,
2549 CARD_INTEL_G33
= 0x29c2,
2550 CARD_INTEL_Q33
= 0x29d2,
2551 CARD_INTEL_PNVG
= 0xa001,
2552 CARD_INTEL_PNVM
= 0xa011,
2553 CARD_INTEL_965Q
= 0x2992,
2554 CARD_INTEL_965G
= 0x2982,
2555 CARD_INTEL_946GZ
= 0x2972,
2556 CARD_INTEL_965GM
= 0x2a02,
2557 CARD_INTEL_965GME
= 0x2a12,
2558 CARD_INTEL_GM45
= 0x2a42,
2559 CARD_INTEL_IGD
= 0x2e02,
2560 CARD_INTEL_Q45
= 0x2e12,
2561 CARD_INTEL_G45
= 0x2e22,
2562 CARD_INTEL_G41
= 0x2e32,
2563 CARD_INTEL_B43
= 0x2e92,
2564 CARD_INTEL_ILKD
= 0x0042,
2565 CARD_INTEL_ILKM
= 0x0046,
2566 CARD_INTEL_SNBD
= 0x0122,
2567 CARD_INTEL_SNBM
= 0x0126,
2568 CARD_INTEL_SNBS
= 0x010a,
2569 CARD_INTEL_IVBD
= 0x0162,
2570 CARD_INTEL_IVBM
= 0x0166,
2571 CARD_INTEL_IVBS
= 0x015a,
2572 CARD_INTEL_HWD
= 0x0412,
2573 CARD_INTEL_HWM
= 0x0416,
2574 CARD_INTEL_HD5000_1
= 0x0a26,
2575 CARD_INTEL_HD5000_2
= 0x0422,
2576 CARD_INTEL_I5100_1
= 0x0a22,
2577 CARD_INTEL_I5100_2
= 0x0a2a,
2578 CARD_INTEL_I5100_3
= 0x0a2b,
2579 CARD_INTEL_I5100_4
= 0x0a2e,
2580 CARD_INTEL_IP5200_1
= 0x0d22,
2581 CARD_INTEL_IP5200_2
= 0x0d26,
2582 CARD_INTEL_IP5200_3
= 0x0d2a,
2583 CARD_INTEL_IP5200_4
= 0x0d2b,
2584 CARD_INTEL_IP5200_5
= 0x0d2e,
2585 CARD_INTEL_IP5200_6
= 0x0c22,
2586 CARD_INTEL_HD5300
= 0x161e,
2587 CARD_INTEL_HD5500
= 0x1616,
2588 CARD_INTEL_HD5600
= 0x1612,
2589 CARD_INTEL_HD6000
= 0x1626,
2590 CARD_INTEL_I6100
= 0x162b,
2591 CARD_INTEL_IP6200
= 0x1622,
2592 CARD_INTEL_IPP6300
= 0x162a,
2593 CARD_INTEL_HD510_1
= 0x1902,
2594 CARD_INTEL_HD510_2
= 0x1906,
2595 CARD_INTEL_HD510_3
= 0x190b,
2596 CARD_INTEL_HD515
= 0x191e,
2597 CARD_INTEL_HD520_1
= 0x1916,
2598 CARD_INTEL_HD520_2
= 0x1921,
2599 CARD_INTEL_HD530_1
= 0x1912,
2600 CARD_INTEL_HD530_2
= 0x191b,
2601 CARD_INTEL_HDP530
= 0x191d,
2602 CARD_INTEL_I540
= 0x1926,
2603 CARD_INTEL_I550
= 0x1927,
2604 CARD_INTEL_I555
= 0x192b,
2605 CARD_INTEL_IP555
= 0x192d,
2606 CARD_INTEL_IP580_1
= 0x1932,
2607 CARD_INTEL_IP580_2
= 0x193b,
2608 CARD_INTEL_IPP580_1
= 0x193a,
2609 CARD_INTEL_IPP580_2
= 0x193d,
2610 CARD_INTEL_UHD617
= 0x87c0,
2611 CARD_INTEL_HD620
= 0x5916,
2612 CARD_INTEL_HD630_1
= 0x5912,
2613 CARD_INTEL_HD630_2
= 0x591b,
2616 struct wined3d_fbo_ops
2618 GLboolean (WINE_GLAPI
*glIsRenderbuffer
)(GLuint renderbuffer
);
2619 void (WINE_GLAPI
*glBindRenderbuffer
)(GLenum target
, GLuint renderbuffer
);
2620 void (WINE_GLAPI
*glDeleteRenderbuffers
)(GLsizei n
, const GLuint
*renderbuffers
);
2621 void (WINE_GLAPI
*glGenRenderbuffers
)(GLsizei n
, GLuint
*renderbuffers
);
2622 void (WINE_GLAPI
*glRenderbufferStorage
)(GLenum target
, GLenum internalformat
,
2623 GLsizei width
, GLsizei height
);
2624 void (WINE_GLAPI
*glRenderbufferStorageMultisample
)(GLenum target
, GLsizei samples
,
2625 GLenum internalformat
, GLsizei width
, GLsizei height
);
2626 void (WINE_GLAPI
*glGetRenderbufferParameteriv
)(GLenum target
, GLenum pname
, GLint
*params
);
2627 GLboolean (WINE_GLAPI
*glIsFramebuffer
)(GLuint framebuffer
);
2628 void (WINE_GLAPI
*glBindFramebuffer
)(GLenum target
, GLuint framebuffer
);
2629 void (WINE_GLAPI
*glDeleteFramebuffers
)(GLsizei n
, const GLuint
*framebuffers
);
2630 void (WINE_GLAPI
*glGenFramebuffers
)(GLsizei n
, GLuint
*framebuffers
);
2631 GLenum (WINE_GLAPI
*glCheckFramebufferStatus
)(GLenum target
);
2632 void (WINE_GLAPI
*glFramebufferTexture
)(GLenum target
, GLenum attachment
,
2633 GLuint texture
, GLint level
);
2634 void (WINE_GLAPI
*glFramebufferTexture1D
)(GLenum target
, GLenum attachment
,
2635 GLenum textarget
, GLuint texture
, GLint level
);
2636 void (WINE_GLAPI
*glFramebufferTexture2D
)(GLenum target
, GLenum attachment
,
2637 GLenum textarget
, GLuint texture
, GLint level
);
2638 void (WINE_GLAPI
*glFramebufferTexture3D
)(GLenum target
, GLenum attachment
,
2639 GLenum textarget
, GLuint texture
, GLint level
, GLint layer
);
2640 void (WINE_GLAPI
*glFramebufferTextureLayer
)(GLenum target
, GLenum attachment
,
2641 GLuint texture
, GLint level
, GLint layer
);
2642 void (WINE_GLAPI
*glFramebufferRenderbuffer
)(GLenum target
, GLenum attachment
,
2643 GLenum renderbuffertarget
, GLuint renderbuffer
);
2644 void (WINE_GLAPI
*glGetFramebufferAttachmentParameteriv
)(GLenum target
, GLenum attachment
,
2645 GLenum pname
, GLint
*params
);
2646 void (WINE_GLAPI
*glBlitFramebuffer
)(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
2647 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
, GLbitfield mask
, GLenum filter
);
2648 void (WINE_GLAPI
*glGenerateMipmap
)(GLenum target
);
2651 struct wined3d_gl_limits
2656 UINT texture_coords
;
2657 unsigned int uniform_blocks
[WINED3D_SHADER_TYPE_COUNT
];
2658 unsigned int samplers
[WINED3D_SHADER_TYPE_COUNT
];
2659 unsigned int graphics_samplers
;
2660 unsigned int combined_samplers
;
2661 UINT general_combiners
;
2662 UINT user_clip_distances
;
2663 UINT texture3d_size
;
2667 UINT vertex_attribs
;
2669 unsigned int texture_buffer_offset_alignment
;
2671 unsigned int framebuffer_width
;
2672 unsigned int framebuffer_height
;
2675 UINT glsl_vs_float_constants
;
2676 UINT glsl_ps_float_constants
;
2678 UINT arb_vs_float_constants
;
2679 UINT arb_vs_native_constants
;
2680 UINT arb_vs_instructions
;
2682 UINT arb_ps_float_constants
;
2683 UINT arb_ps_local_constants
;
2684 UINT arb_ps_native_constants
;
2685 UINT arb_ps_instructions
;
2689 void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits
*gl_limits
,
2690 enum wined3d_shader_type shader_type
, unsigned int *base
, unsigned int *count
) DECLSPEC_HIDDEN
;
2691 void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits
*gl_limits
,
2692 enum wined3d_shader_type shader_type
, unsigned int *base
, unsigned int *count
) DECLSPEC_HIDDEN
;
2694 struct wined3d_gl_info
2696 DWORD selected_gl_version
;
2698 struct wined3d_gl_limits limits
;
2699 DWORD reserved_glsl_constants
, reserved_arb_constants
;
2701 BOOL supported
[WINED3D_GL_EXT_COUNT
];
2702 GLint wrap_lookup
[WINED3D_TADDRESS_MIRROR_ONCE
- WINED3D_TADDRESS_WRAP
+ 1];
2704 HGLRC (WINAPI
*p_wglCreateContextAttribsARB
)(HDC dc
, HGLRC share
, const GLint
*attribs
);
2705 struct opengl_funcs gl_ops
;
2706 struct wined3d_fbo_ops fbo_ops
;
2708 void (WINE_GLAPI
*p_glDisableWINE
)(GLenum cap
);
2709 void (WINE_GLAPI
*p_glEnableWINE
)(GLenum cap
);
2712 /* The driver names reflect the lowest GPU supported
2713 * by a certain driver, so DRIVER_AMD_R300 supports
2714 * R3xx, R4xx and R5xx GPUs. */
2715 enum wined3d_display_driver
2717 DRIVER_AMD_RAGE_128PRO
,
2722 DRIVER_INTEL_GMA800
,
2723 DRIVER_INTEL_GMA900
,
2724 DRIVER_INTEL_GMA950
,
2725 DRIVER_INTEL_GMA3000
,
2726 DRIVER_INTEL_HD4000
,
2728 DRIVER_NVIDIA_GEFORCE2MX
,
2729 DRIVER_NVIDIA_GEFORCEFX
,
2730 DRIVER_NVIDIA_GEFORCE6
,
2731 DRIVER_NVIDIA_GEFORCE8
,
2732 DRIVER_REDHAT_VIRGL
,
2738 struct wined3d_gpu_description
2740 enum wined3d_pci_vendor vendor
;
2741 enum wined3d_pci_device device
;
2742 const char *description
;
2743 enum wined3d_display_driver driver
;
2744 unsigned int vidmem
;
2747 const struct wined3d_gpu_description
*wined3d_get_gpu_description(enum wined3d_pci_vendor vendor
,
2748 enum wined3d_pci_device device
) DECLSPEC_HIDDEN
;
2749 const struct wined3d_gpu_description
*wined3d_get_user_override_gpu_description(enum wined3d_pci_vendor vendor
,
2750 enum wined3d_pci_device device
) DECLSPEC_HIDDEN
;
2751 enum wined3d_pci_device
wined3d_gpu_from_feature_level(enum wined3d_pci_vendor
*vendor
,
2752 enum wined3d_feature_level feature_level
) DECLSPEC_HIDDEN
;
2754 /* 512 in Direct3D 8/9, 128 in DXGI. */
2755 #define WINED3D_MAX_DEVICE_IDENTIFIER_LENGTH 512
2757 struct wined3d_driver_info
2759 enum wined3d_pci_vendor vendor
;
2760 enum wined3d_pci_device device
;
2762 char description
[WINED3D_MAX_DEVICE_IDENTIFIER_LENGTH
];
2764 UINT64 sysmem_bytes
;
2769 void wined3d_driver_info_init(struct wined3d_driver_info
*driver_info
,
2770 const struct wined3d_gpu_description
*gpu_description
,
2771 UINT64 vram_bytes
, UINT64 sysmem_bytes
) DECLSPEC_HIDDEN
;
2773 struct wined3d_adapter_ops
2775 void (*adapter_destroy
)(struct wined3d_adapter
*adapter
);
2776 HRESULT (*adapter_create_device
)(struct wined3d
*wined3d
, const struct wined3d_adapter
*adapter
,
2777 enum wined3d_device_type device_type
, HWND focus_window
, unsigned int flags
,
2778 BYTE surface_alignment
, const enum wined3d_feature_level
*levels
, unsigned int level_count
,
2779 struct wined3d_device_parent
*device_parent
, struct wined3d_device
**device
);
2780 void (*adapter_destroy_device
)(struct wined3d_device
*device
);
2781 struct wined3d_context
*(*adapter_acquire_context
)(struct wined3d_device
*device
,
2782 struct wined3d_texture
*texture
, unsigned int sub_resource_idx
);
2783 void (*adapter_release_context
)(struct wined3d_context
*context
);
2784 void (*adapter_get_wined3d_caps
)(const struct wined3d_adapter
*adapter
, struct wined3d_caps
*caps
);
2785 BOOL (*adapter_check_format
)(const struct wined3d_adapter
*adapter
,
2786 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*rt_format
,
2787 const struct wined3d_format
*ds_format
);
2788 HRESULT (*adapter_init_3d
)(struct wined3d_device
*device
);
2789 void (*adapter_uninit_3d
)(struct wined3d_device
*device
);
2790 void *(*adapter_map_bo_address
)(struct wined3d_context
*context
,
2791 const struct wined3d_bo_address
*data
, size_t size
, GLenum binding
, uint32_t flags
);
2792 void (*adapter_unmap_bo_address
)(struct wined3d_context
*context
,
2793 const struct wined3d_bo_address
*data
, GLenum binding
);
2794 HRESULT (*adapter_create_swapchain
)(struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
2795 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_swapchain
**swapchain
);
2796 void (*adapter_destroy_swapchain
)(struct wined3d_swapchain
*swapchain
);
2797 HRESULT (*adapter_create_buffer
)(struct wined3d_device
*device
, const struct wined3d_buffer_desc
*desc
,
2798 const struct wined3d_sub_resource_data
*data
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
2799 struct wined3d_buffer
**buffer
);
2800 void (*adapter_destroy_buffer
)(struct wined3d_buffer
*buffer
);
2801 HRESULT (*adapter_create_texture
)(struct wined3d_device
*device
, const struct wined3d_resource_desc
*desc
,
2802 unsigned int layer_count
, unsigned int level_count
, uint32_t flags
, void *parent
,
2803 const struct wined3d_parent_ops
*parent_ops
, struct wined3d_texture
**texture
);
2804 void (*adapter_destroy_texture
)(struct wined3d_texture
*texture
);
2805 HRESULT (*adapter_create_rendertarget_view
)(const struct wined3d_view_desc
*desc
,
2806 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
2807 struct wined3d_rendertarget_view
**view
);
2808 void (*adapter_destroy_rendertarget_view
)(struct wined3d_rendertarget_view
*view
);
2809 HRESULT (*adapter_create_shader_resource_view
)(const struct wined3d_view_desc
*desc
,
2810 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
2811 struct wined3d_shader_resource_view
**view
);
2812 void (*adapter_destroy_shader_resource_view
)(struct wined3d_shader_resource_view
*view
);
2813 HRESULT (*adapter_create_unordered_access_view
)(const struct wined3d_view_desc
*desc
,
2814 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
2815 struct wined3d_unordered_access_view
**view
);
2816 void (*adapter_destroy_unordered_access_view
)(struct wined3d_unordered_access_view
*view
);
2817 HRESULT (*adapter_create_sampler
)(struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
2818 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_sampler
**sampler
);
2819 void (*adapter_destroy_sampler
)(struct wined3d_sampler
*sampler
);
2820 HRESULT (*adapter_create_query
)(struct wined3d_device
*device
, enum wined3d_query_type type
,
2821 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_query
**query
);
2822 void (*adapter_destroy_query
)(struct wined3d_query
*query
);
2823 void (*adapter_flush_context
)(struct wined3d_context
*context
);
2826 /* The adapter structure */
2827 struct wined3d_adapter
2829 unsigned int ordinal
;
2830 POINT monitor_position
;
2831 enum wined3d_format_id screen_format
;
2833 struct wined3d_gl_info gl_info
;
2834 struct wined3d_d3d_info d3d_info
;
2835 struct wined3d_driver_info driver_info
;
2836 UINT64 vram_bytes_used
;
2841 WCHAR device_name
[CCHDEVICENAME
]; /* for use with e.g. ChangeDisplaySettings() */
2846 const struct wined3d_vertex_pipe_ops
*vertex_pipe
;
2847 const struct wined3d_fragment_pipe_ops
*fragment_pipe
;
2848 const struct wined3d_shader_backend_ops
*shader_backend
;
2849 const struct wined3d_adapter_ops
*adapter_ops
;
2852 BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, unsigned int ordinal
,
2853 const struct wined3d_adapter_ops
*adapter_ops
) DECLSPEC_HIDDEN
;
2854 void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
) DECLSPEC_HIDDEN
;
2856 struct wined3d_adapter_gl
2858 struct wined3d_adapter a
;
2860 struct wined3d_pixel_format
*pixel_formats
;
2861 unsigned int pixel_format_count
;
2864 static inline struct wined3d_adapter_gl
*wined3d_adapter_gl(struct wined3d_adapter
*adapter
)
2866 return CONTAINING_RECORD(adapter
, struct wined3d_adapter_gl
, a
);
2869 static inline const struct wined3d_adapter_gl
*wined3d_adapter_gl_const(const struct wined3d_adapter
*adapter
)
2871 return CONTAINING_RECORD(adapter
, struct wined3d_adapter_gl
, a
);
2874 struct wined3d_adapter
*wined3d_adapter_gl_create(unsigned int ordinal
,
2875 unsigned int wined3d_creation_flags
) DECLSPEC_HIDDEN
;
2877 struct wined3d_adapter_vk
2879 struct wined3d_adapter a
;
2881 struct wined3d_vk_info vk_info
;
2882 VkPhysicalDevice physical_device
;
2884 VkPhysicalDeviceLimits device_limits
;
2887 static inline struct wined3d_adapter_vk
*wined3d_adapter_vk(struct wined3d_adapter
*adapter
)
2889 return CONTAINING_RECORD(adapter
, struct wined3d_adapter_vk
, a
);
2892 struct wined3d_adapter
*wined3d_adapter_vk_create(unsigned int ordinal
,
2893 unsigned int wined3d_creation_flags
) DECLSPEC_HIDDEN
;
2895 struct wined3d_caps_gl_ctx
2901 HGLRC restore_gl_ctx
;
2903 const struct wined3d_gl_info
*gl_info
;
2905 GLuint test_program_id
;
2908 BOOL
wined3d_adapter_gl_init_format_info(struct wined3d_adapter
*adapter
,
2909 struct wined3d_caps_gl_ctx
*ctx
) DECLSPEC_HIDDEN
;
2910 BOOL
wined3d_adapter_no3d_init_format_info(struct wined3d_adapter
*adapter
) DECLSPEC_HIDDEN
;
2911 BOOL
wined3d_adapter_vk_init_format_info(struct wined3d_adapter_vk
*adapter_vk
,
2912 const struct wined3d_vk_info
*vk_info
) DECLSPEC_HIDDEN
;
2913 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
) DECLSPEC_HIDDEN
;
2915 BOOL
wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx
*ctx
) DECLSPEC_HIDDEN
;
2917 void install_gl_compat_wrapper(struct wined3d_gl_info
*gl_info
, enum wined3d_gl_extension ext
) DECLSPEC_HIDDEN
;
2919 enum wined3d_projection_type
2921 WINED3D_PROJECTION_NONE
= 0,
2922 WINED3D_PROJECTION_COUNT3
= 1,
2923 WINED3D_PROJECTION_COUNT4
= 2
2926 /*****************************************************************************
2927 * Fixed function pipeline replacements
2929 #define ARG_UNUSED 0xff
2930 struct texture_stage_op
2942 struct color_fixup_desc color_fixup
;
2943 unsigned tex_type
: 3;
2944 unsigned tmp_dst
: 1;
2945 unsigned projected
: 2;
2946 unsigned padding
: 10;
2949 struct ffp_frag_settings
2951 struct texture_stage_op op
[WINED3D_MAX_TEXTURES
];
2952 enum wined3d_ffp_ps_fog_mode fog
;
2953 unsigned char sRGB_write
;
2954 unsigned char emul_clipplanes
;
2955 unsigned char texcoords_initialized
;
2956 unsigned char color_key_enabled
: 1;
2957 unsigned char pointsprite
: 1;
2958 unsigned char flatshading
: 1;
2959 unsigned char alpha_test_func
: 3;
2960 unsigned char padding
: 2;
2963 struct ffp_frag_desc
2965 struct wine_rb_entry entry
;
2966 struct ffp_frag_settings settings
;
2969 int wined3d_ffp_frag_program_key_compare(const void *key
, const struct wine_rb_entry
*entry
) DECLSPEC_HIDDEN
;
2970 int wined3d_ffp_vertex_program_key_compare(const void *key
, const struct wine_rb_entry
*entry
) DECLSPEC_HIDDEN
;
2972 extern const struct wined3d_parent_ops wined3d_null_parent_ops DECLSPEC_HIDDEN
;
2974 void gen_ffp_frag_op(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
2975 struct ffp_frag_settings
*settings
, BOOL ignore_textype
) DECLSPEC_HIDDEN
;
2976 const struct ffp_frag_desc
*find_ffp_frag_shader(const struct wine_rb_tree
*fragment_shaders
,
2977 const struct ffp_frag_settings
*settings
) DECLSPEC_HIDDEN
;
2978 void add_ffp_frag_shader(struct wine_rb_tree
*shaders
, struct ffp_frag_desc
*desc
) DECLSPEC_HIDDEN
;
2979 void wined3d_ftoa(float value
, char *s
) DECLSPEC_HIDDEN
;
2981 extern const float wined3d_srgb_const0
[] DECLSPEC_HIDDEN
;
2982 extern const float wined3d_srgb_const1
[] DECLSPEC_HIDDEN
;
2984 enum wined3d_ffp_vs_fog_mode
2986 WINED3D_FFP_VS_FOG_OFF
= 0,
2987 WINED3D_FFP_VS_FOG_FOGCOORD
= 1,
2988 WINED3D_FFP_VS_FOG_DEPTH
= 2,
2989 WINED3D_FFP_VS_FOG_RANGE
= 3,
2992 #define WINED3D_FFP_TCI_SHIFT 16
2993 #define WINED3D_FFP_TCI_MASK 0xffu
2995 #define WINED3D_FFP_LIGHT_TYPE_SHIFT(idx) (3 * (idx))
2996 #define WINED3D_FFP_LIGHT_TYPE_MASK 0x7u
2998 struct wined3d_ffp_vs_settings
3000 DWORD point_light_count
: 4;
3001 DWORD spot_light_count
: 4;
3002 DWORD directional_light_count
: 4;
3003 DWORD parallel_point_light_count
: 4;
3004 DWORD diffuse_source
: 2;
3005 DWORD emissive_source
: 2;
3006 DWORD ambient_source
: 2;
3007 DWORD specular_source
: 2;
3008 DWORD transformed
: 1;
3009 DWORD vertexblends
: 2;
3012 DWORD normalize
: 1;
3014 DWORD localviewer
: 1;
3016 DWORD point_size
: 1;
3017 DWORD per_vertex_point_size
: 1;
3019 DWORD texcoords
: 8; /* WINED3D_MAX_TEXTURES */
3020 DWORD ortho_fog
: 1;
3021 DWORD flatshading
: 1;
3022 DWORD swizzle_map
: 16; /* MAX_ATTRIBS, 16 */
3025 DWORD texgen
[WINED3D_MAX_TEXTURES
];
3028 struct wined3d_ffp_vs_desc
3030 struct wine_rb_entry entry
;
3031 struct wined3d_ffp_vs_settings settings
;
3034 void wined3d_ffp_get_vs_settings(const struct wined3d_context
*context
,
3035 const struct wined3d_state
*state
, struct wined3d_ffp_vs_settings
*settings
) DECLSPEC_HIDDEN
;
3041 unsigned int adapter_count
;
3042 struct wined3d_adapter
*adapters
[1];
3045 BOOL
wined3d_filter_messages(HWND window
, BOOL filter
) DECLSPEC_HIDDEN
;
3046 void wined3d_hook_swapchain(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
3047 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
) DECLSPEC_HIDDEN
;
3048 void wined3d_unhook_swapchain(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
3049 void wined3d_unregister_window(HWND window
) DECLSPEC_HIDDEN
;
3051 BOOL
wined3d_get_app_name(char *app_name
, unsigned int app_name_size
) DECLSPEC_HIDDEN
;
3053 struct wined3d_blend_state
3056 struct wined3d_blend_state_desc desc
;
3059 const struct wined3d_parent_ops
*parent_ops
;
3061 struct wined3d_device
*device
;
3064 struct wined3d_rasterizer_state
3067 struct wined3d_rasterizer_state_desc desc
;
3070 const struct wined3d_parent_ops
*parent_ops
;
3072 struct wined3d_device
*device
;
3075 struct wined3d_stream_output
3077 struct wined3d_buffer
*buffer
;
3081 struct wined3d_stream_state
3083 struct wined3d_buffer
*buffer
;
3090 #define LIGHTMAP_SIZE 43
3091 #define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE)
3093 struct wined3d_light_state
3095 /* Light hashmap. Collisions are handled using linked lists. */
3096 struct list light_map
[LIGHTMAP_SIZE
];
3097 const struct wined3d_light_info
*lights
[WINED3D_MAX_ACTIVE_LIGHTS
];
3100 #define WINED3D_STATE_NO_REF 0x00000001
3101 #define WINED3D_STATE_INIT_DEFAULT 0x00000002
3103 struct wined3d_state
3106 const struct wined3d_fb_state
*fb
;
3108 struct wined3d_vertex_declaration
*vertex_declaration
;
3109 struct wined3d_stream_output stream_output
[WINED3D_MAX_STREAM_OUTPUT_BUFFERS
];
3110 struct wined3d_stream_state streams
[WINED3D_MAX_STREAMS
+ 1 /* tesselated pseudo-stream */];
3111 struct wined3d_buffer
*index_buffer
;
3112 enum wined3d_format_id index_format
;
3113 unsigned int index_offset
;
3114 int base_vertex_index
;
3115 int load_base_vertex_index
; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */
3116 GLenum gl_primitive_type
;
3117 GLint gl_patch_vertices
;
3118 struct wined3d_query
*predicate
;
3119 BOOL predicate_value
;
3121 struct wined3d_shader
*shader
[WINED3D_SHADER_TYPE_COUNT
];
3122 struct wined3d_buffer
*cb
[WINED3D_SHADER_TYPE_COUNT
][MAX_CONSTANT_BUFFERS
];
3123 struct wined3d_sampler
*sampler
[WINED3D_SHADER_TYPE_COUNT
][MAX_SAMPLER_OBJECTS
];
3124 struct wined3d_shader_resource_view
*shader_resource_view
[WINED3D_SHADER_TYPE_COUNT
][MAX_SHADER_RESOURCE_VIEWS
];
3125 struct wined3d_unordered_access_view
*unordered_access_view
[WINED3D_PIPELINE_COUNT
][MAX_UNORDERED_ACCESS_VIEWS
];
3127 BOOL vs_consts_b
[WINED3D_MAX_CONSTS_B
];
3128 struct wined3d_ivec4 vs_consts_i
[WINED3D_MAX_CONSTS_I
];
3129 struct wined3d_vec4 vs_consts_f
[WINED3D_MAX_VS_CONSTS_F
];
3131 BOOL ps_consts_b
[WINED3D_MAX_CONSTS_B
];
3132 struct wined3d_ivec4 ps_consts_i
[WINED3D_MAX_CONSTS_I
];
3133 struct wined3d_vec4 ps_consts_f
[WINED3D_MAX_PS_CONSTS_F
];
3135 struct wined3d_texture
*textures
[WINED3D_MAX_COMBINED_SAMPLERS
];
3136 DWORD sampler_states
[WINED3D_MAX_COMBINED_SAMPLERS
][WINED3D_HIGHEST_SAMPLER_STATE
+ 1];
3137 DWORD texture_states
[WINED3D_MAX_TEXTURES
][WINED3D_HIGHEST_TEXTURE_STATE
+ 1];
3139 struct wined3d_matrix transforms
[WINED3D_HIGHEST_TRANSFORM_STATE
+ 1];
3140 struct wined3d_vec4 clip_planes
[WINED3D_MAX_CLIP_DISTANCES
];
3141 struct wined3d_material material
;
3142 struct wined3d_viewport viewports
[WINED3D_MAX_VIEWPORTS
];
3143 unsigned int viewport_count
;
3144 RECT scissor_rects
[WINED3D_MAX_VIEWPORTS
];
3145 unsigned int scissor_rect_count
;
3147 struct wined3d_light_state light_state
;
3149 DWORD render_states
[WINEHIGHEST_RENDER_STATE
+ 1];
3150 struct wined3d_blend_state
*blend_state
;
3151 struct wined3d_color blend_factor
;
3152 struct wined3d_rasterizer_state
*rasterizer_state
;
3155 struct wined3d_dummy_textures
3162 GLuint tex_cube_array
;
3163 GLuint tex_1d_array
;
3164 GLuint tex_2d_array
;
3167 GLuint tex_2d_ms_array
;
3170 #define WINED3D_UNMAPPED_STAGE ~0u
3172 /* Multithreaded flag. Removed from the public header to signal that
3173 * wined3d_device_create() ignores it. */
3174 #define WINED3DCREATE_MULTITHREADED 0x00000004
3176 struct wined3d_stateblock_state
3178 struct wined3d_vertex_declaration
*vertex_declaration
;
3179 struct wined3d_stream_state streams
[WINED3D_MAX_STREAMS
+ 1];
3180 struct wined3d_buffer
*index_buffer
;
3181 enum wined3d_format_id index_format
;
3182 int base_vertex_index
;
3184 struct wined3d_shader
*vs
;
3185 struct wined3d_vec4 vs_consts_f
[WINED3D_MAX_VS_CONSTS_F
];
3186 struct wined3d_ivec4 vs_consts_i
[WINED3D_MAX_CONSTS_I
];
3187 BOOL vs_consts_b
[WINED3D_MAX_CONSTS_B
];
3189 struct wined3d_shader
*ps
;
3190 struct wined3d_vec4 ps_consts_f
[WINED3D_MAX_PS_CONSTS_F
];
3191 struct wined3d_ivec4 ps_consts_i
[WINED3D_MAX_CONSTS_I
];
3192 BOOL ps_consts_b
[WINED3D_MAX_CONSTS_B
];
3194 DWORD rs
[WINEHIGHEST_RENDER_STATE
+ 1];
3195 struct wined3d_color blend_factor
;
3197 struct wined3d_texture
*textures
[WINED3D_MAX_COMBINED_SAMPLERS
];
3198 DWORD sampler_states
[WINED3D_MAX_COMBINED_SAMPLERS
][WINED3D_HIGHEST_SAMPLER_STATE
+ 1];
3199 DWORD texture_states
[WINED3D_MAX_TEXTURES
][WINED3D_HIGHEST_TEXTURE_STATE
+ 1];
3201 struct wined3d_matrix transforms
[WINED3D_HIGHEST_TRANSFORM_STATE
+ 1];
3202 struct wined3d_vec4 clip_planes
[WINED3D_MAX_CLIP_DISTANCES
];
3203 struct wined3d_material material
;
3204 struct wined3d_viewport viewport
;
3207 struct wined3d_light_state light_state
;
3210 struct wined3d_device
3214 /* WineD3D Information */
3215 struct wined3d_device_parent
*device_parent
;
3216 struct wined3d
*wined3d
;
3217 struct wined3d_adapter
*adapter
;
3219 const struct wined3d_shader_backend_ops
*shader_backend
;
3221 void *fragment_priv
;
3223 struct wined3d_state_entry state_table
[STATE_HIGHEST
+ 1];
3224 /* Array of functions for states which are handled by more than one pipeline part */
3225 APPLYSTATEFUNC
*multistate_funcs
[STATE_HIGHEST
+ 1];
3226 struct wined3d_blitter
*blitter
;
3228 BYTE bCursorVisible
: 1;
3229 BYTE d3d_initialized
: 1;
3230 BYTE inScene
: 1; /* A flag to check for proper BeginScene / EndScene call pairs */
3231 BYTE softwareVertexProcessing
: 1; /* process vertex shaders using software or hardware */
3232 BYTE restore_screensaver
: 1;
3235 unsigned char surface_alignment
; /* Line Alignment of surfaces */
3239 enum wined3d_feature_level feature_level
;
3241 struct wined3d_state state
;
3242 struct wined3d_stateblock
*recording
;
3243 struct wined3d_stateblock_state stateblock_state
;
3244 struct wined3d_stateblock_state
*update_stateblock_state
;
3246 /* Internal use fields */
3247 struct wined3d_device_creation_parameters create_parms
;
3250 struct wined3d_rendertarget_view
*back_buffer_view
;
3251 struct wined3d_swapchain
**swapchains
;
3252 UINT swapchain_count
;
3253 unsigned int max_frame_latency
;
3255 struct list resources
; /* a linked list to track resources created by the device */
3256 struct list shaders
; /* a linked list to track shaders (pixel and vertex) */
3257 struct wine_rb_tree samplers
;
3259 /* Render Target Support */
3260 struct wined3d_fb_state fb
;
3261 struct wined3d_rendertarget_view
*auto_depth_stencil_view
;
3263 /* Cursor management */
3268 UINT cursorWidth
, cursorHeight
;
3269 struct wined3d_texture
*cursor_texture
;
3270 HCURSOR hardwareCursor
;
3272 /* The Wine logo texture */
3273 struct wined3d_texture
*logo_texture
;
3275 /* Default sampler used to emulate the direct resource access without using wined3d_sampler */
3276 struct wined3d_sampler
*default_sampler
;
3277 struct wined3d_sampler
*null_sampler
;
3279 /* Command stream */
3280 struct wined3d_cs
*cs
;
3282 /* Context management */
3283 struct wined3d_context
**contexts
;
3287 void wined3d_device_cleanup(struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
3288 void device_clear_render_targets(struct wined3d_device
*device
, UINT rt_count
, const struct wined3d_fb_state
*fb
,
3289 UINT rect_count
, const RECT
*rects
, const RECT
*draw_rect
, DWORD flags
,
3290 const struct wined3d_color
*color
, float depth
, DWORD stencil
) DECLSPEC_HIDDEN
;
3291 BOOL
device_context_add(struct wined3d_device
*device
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
3292 void device_context_remove(struct wined3d_device
*device
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
3293 void wined3d_device_create_primary_opengl_context_cs(void *object
) DECLSPEC_HIDDEN
;
3294 void wined3d_device_delete_opengl_contexts_cs(void *object
) DECLSPEC_HIDDEN
;
3295 HRESULT
wined3d_device_init(struct wined3d_device
*device
, struct wined3d
*wined3d
,
3296 unsigned int adapter_idx
, enum wined3d_device_type device_type
, HWND focus_window
, unsigned int flags
,
3297 BYTE surface_alignment
, const enum wined3d_feature_level
*levels
, unsigned int level_count
,
3298 struct wined3d_device_parent
*device_parent
) DECLSPEC_HIDDEN
;
3299 LRESULT
device_process_message(struct wined3d_device
*device
, HWND window
, BOOL unicode
,
3300 UINT message
, WPARAM wparam
, LPARAM lparam
, WNDPROC proc
) DECLSPEC_HIDDEN
;
3301 void device_resource_add(struct wined3d_device
*device
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3302 void device_resource_released(struct wined3d_device
*device
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3303 void device_invalidate_state(const struct wined3d_device
*device
, DWORD state
) DECLSPEC_HIDDEN
;
3304 HRESULT
wined3d_device_set_implicit_swapchain(struct wined3d_device
*device
,
3305 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
3306 void wined3d_device_uninit_3d(struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
3308 struct wined3d_device_no3d
3310 struct wined3d_device d
;
3312 struct wined3d_context context_no3d
;
3315 static inline struct wined3d_device_no3d
*wined3d_device_no3d(struct wined3d_device
*device
)
3317 return CONTAINING_RECORD(device
, struct wined3d_device_no3d
, d
);
3320 struct wined3d_device_gl
3322 struct wined3d_device d
;
3324 /* Textures for when no other textures are bound. */
3325 struct wined3d_dummy_textures dummy_textures
;
3328 static inline struct wined3d_device_gl
*wined3d_device_gl(struct wined3d_device
*device
)
3330 return CONTAINING_RECORD(device
, struct wined3d_device_gl
, d
);
3333 struct wined3d_device_vk
3335 struct wined3d_device d
;
3337 struct wined3d_context_vk context_vk
;
3342 struct wined3d_vk_info vk_info
;
3345 static inline struct wined3d_device_vk
*wined3d_device_vk(struct wined3d_device
*device
)
3347 return CONTAINING_RECORD(device
, struct wined3d_device_vk
, d
);
3350 static inline BOOL
isStateDirty(const struct wined3d_context
*context
, unsigned int state_id
)
3352 unsigned int idx
= state_id
/ (sizeof(*context
->dirty_graphics_states
) * CHAR_BIT
);
3353 unsigned int shift
= state_id
& ((sizeof(*context
->dirty_graphics_states
) * CHAR_BIT
) - 1);
3354 return context
->dirty_graphics_states
[idx
] & (1u << shift
);
3357 static inline float wined3d_alpha_ref(const struct wined3d_state
*state
)
3359 return (state
->render_states
[WINED3D_RS_ALPHAREF
] & 0xff) / 255.0f
;
3362 const char *wined3d_debug_resource_access(DWORD access
) DECLSPEC_HIDDEN
;
3363 const char *wined3d_debug_bind_flags(DWORD bind_flags
) DECLSPEC_HIDDEN
;
3364 const char *wined3d_debug_view_desc(const struct wined3d_view_desc
*d
,
3365 const struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3366 const char *wined3d_debug_vkresult(VkResult vr
) DECLSPEC_HIDDEN
;
3368 static inline BOOL
wined3d_resource_access_is_managed(unsigned int access
)
3370 return !(~access
& (WINED3D_RESOURCE_ACCESS_GPU
| WINED3D_RESOURCE_ACCESS_CPU
));
3373 struct wined3d_resource_ops
3375 ULONG (*resource_incref
)(struct wined3d_resource
*resource
);
3376 ULONG (*resource_decref
)(struct wined3d_resource
*resource
);
3377 void (*resource_preload
)(struct wined3d_resource
*resource
);
3378 void (*resource_unload
)(struct wined3d_resource
*resource
);
3379 HRESULT (*resource_sub_resource_map
)(struct wined3d_resource
*resource
, unsigned int sub_resource_idx
,
3380 struct wined3d_map_desc
*map_desc
, const struct wined3d_box
*box
, DWORD flags
);
3381 HRESULT (*resource_sub_resource_unmap
)(struct wined3d_resource
*resource
, unsigned int sub_resource_idx
);
3384 struct wined3d_resource
3390 struct wined3d_device
*device
;
3391 enum wined3d_resource_type type
;
3392 enum wined3d_gl_resource_type gl_type
;
3393 const struct wined3d_format
*format
;
3394 unsigned int format_flags
;
3395 enum wined3d_multisample_type multisample_type
;
3396 UINT multisample_quality
;
3398 unsigned int bind_flags
;
3399 unsigned int access
;
3410 const struct wined3d_parent_ops
*parent_ops
;
3411 const struct wined3d_resource_ops
*resource_ops
;
3413 struct list resource_list_entry
;
3416 static inline ULONG
wined3d_resource_incref(struct wined3d_resource
*resource
)
3418 return resource
->resource_ops
->resource_incref(resource
);
3421 static inline ULONG
wined3d_resource_decref(struct wined3d_resource
*resource
)
3423 return resource
->resource_ops
->resource_decref(resource
);
3426 static inline void wined3d_resource_acquire(struct wined3d_resource
*resource
)
3428 InterlockedIncrement(&resource
->access_count
);
3431 static inline void wined3d_resource_release(struct wined3d_resource
*resource
)
3433 InterlockedDecrement(&resource
->access_count
);
3436 void resource_cleanup(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3437 HRESULT
resource_init(struct wined3d_resource
*resource
, struct wined3d_device
*device
,
3438 enum wined3d_resource_type type
, const struct wined3d_format
*format
,
3439 enum wined3d_multisample_type multisample_type
, unsigned int multisample_quality
, unsigned int usage
,
3440 unsigned int bind_flags
, unsigned int access
, unsigned int width
, unsigned int height
, unsigned int depth
,
3441 unsigned int size
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3442 const struct wined3d_resource_ops
*resource_ops
) DECLSPEC_HIDDEN
;
3443 void resource_unload(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3444 void wined3d_resource_free_sysmem(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3445 const struct wined3d_format
*wined3d_resource_get_decompress_format(
3446 const struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3447 unsigned int wined3d_resource_get_sample_count(const struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3448 GLbitfield
wined3d_resource_gl_map_flags(DWORD d3d_flags
) DECLSPEC_HIDDEN
;
3449 GLenum
wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags
) DECLSPEC_HIDDEN
;
3450 BOOL
wined3d_resource_is_offscreen(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3451 BOOL
wined3d_resource_prepare_sysmem(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3452 void wined3d_resource_update_draw_binding(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3454 /* Tests show that the start address of resources is 32 byte aligned */
3455 #define RESOURCE_ALIGNMENT 16
3456 #define WINED3D_CONSTANT_BUFFER_ALIGNMENT 16
3458 #define WINED3D_LOCATION_DISCARDED 0x00000001
3459 #define WINED3D_LOCATION_SYSMEM 0x00000002
3460 #define WINED3D_LOCATION_USER_MEMORY 0x00000004
3461 #define WINED3D_LOCATION_BUFFER 0x00000008
3462 #define WINED3D_LOCATION_TEXTURE_RGB 0x00000010
3463 #define WINED3D_LOCATION_TEXTURE_SRGB 0x00000020
3464 #define WINED3D_LOCATION_DRAWABLE 0x00000040
3465 #define WINED3D_LOCATION_RB_MULTISAMPLE 0x00000080
3466 #define WINED3D_LOCATION_RB_RESOLVED 0x00000100
3468 const char *wined3d_debug_location(DWORD location
) DECLSPEC_HIDDEN
;
3470 struct wined3d_blt_info
3473 struct wined3d_vec3 texcoords
[4];
3476 struct wined3d_texture_ops
3478 BOOL (*texture_prepare_location
)(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
3479 struct wined3d_context
*context
, unsigned int location
);
3480 BOOL (*texture_load_location
)(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
3481 struct wined3d_context
*context
, unsigned int location
);
3482 void (*texture_upload_data
)(struct wined3d_context
*context
, const struct wined3d_const_bo_address
*src_bo_addr
,
3483 const struct wined3d_format
*src_format
, const struct wined3d_box
*src_box
, unsigned int src_row_pitch
,
3484 unsigned int src_slice_pitch
, struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
3485 unsigned int dst_location
, unsigned int dst_x
, unsigned int dst_y
, unsigned int dst_z
);
3486 void (*texture_download_data
)(struct wined3d_context
*context
, struct wined3d_texture
*src_texture
,
3487 unsigned int src_sub_resource_idx
, unsigned int src_location
, const struct wined3d_box
*src_box
,
3488 const struct wined3d_bo_address
*dst_bo_addr
, const struct wined3d_format
*dst_format
,
3489 unsigned int dst_x
, unsigned int dst_y
, unsigned int dst_z
,
3490 unsigned int dst_row_pitch
, unsigned int dst_slice_pitch
);
3493 #define WINED3D_TEXTURE_COND_NP2 0x00000001
3494 #define WINED3D_TEXTURE_COND_NP2_EMULATED 0x00000002
3495 #define WINED3D_TEXTURE_POW2_MAT_IDENT 0x00000004
3496 #define WINED3D_TEXTURE_IS_SRGB 0x00000008
3497 #define WINED3D_TEXTURE_RGB_ALLOCATED 0x00000010
3498 #define WINED3D_TEXTURE_RGB_VALID 0x00000020
3499 #define WINED3D_TEXTURE_SRGB_ALLOCATED 0x00000040
3500 #define WINED3D_TEXTURE_SRGB_VALID 0x00000080
3501 #define WINED3D_TEXTURE_CONVERTED 0x00000100
3502 #define WINED3D_TEXTURE_PIN_SYSMEM 0x00000200
3503 #define WINED3D_TEXTURE_NORMALIZED_COORDS 0x00000400
3504 #define WINED3D_TEXTURE_GET_DC_LENIENT 0x00000800
3505 #define WINED3D_TEXTURE_DC_IN_USE 0x00001000
3506 #define WINED3D_TEXTURE_DISCARD 0x00002000
3507 #define WINED3D_TEXTURE_GET_DC 0x00004000
3508 #define WINED3D_TEXTURE_GENERATE_MIPMAPS 0x00008000
3510 #define WINED3D_TEXTURE_ASYNC_COLOR_KEY 0x00000001
3512 struct wined3d_texture
3514 struct wined3d_resource resource
;
3515 const struct wined3d_texture_ops
*texture_ops
;
3516 struct wined3d_swapchain
*swapchain
;
3517 unsigned int pow2_width
;
3518 unsigned int pow2_height
;
3521 unsigned int download_count
;
3522 unsigned int sysmem_count
;
3523 float pow2_matrix
[16];
3527 DWORD update_map_binding
;
3530 unsigned int row_pitch
;
3531 unsigned int slice_pitch
;
3533 /* May only be accessed from the command stream worker thread. */
3534 struct wined3d_texture_async
3538 /* Color keys for DDraw */
3539 struct wined3d_color_key dst_blt_color_key
;
3540 struct wined3d_color_key src_blt_color_key
;
3541 struct wined3d_color_key dst_overlay_color_key
;
3542 struct wined3d_color_key src_overlay_color_key
;
3543 struct wined3d_color_key gl_color_key
;
3544 DWORD color_key_flags
;
3547 struct wined3d_overlay_info
3550 struct list overlays
;
3551 struct wined3d_texture
*dst_texture
;
3552 unsigned int dst_sub_resource_idx
;
3557 struct wined3d_dc_info
3563 struct wined3d_texture_sub_resource
3566 const struct wined3d_parent_ops
*parent_ops
;
3568 unsigned int offset
;
3571 unsigned int map_count
;
3573 GLuint buffer_object
;
3577 static inline void *wined3d_texture_allocate_object_memory(SIZE_T s
, SIZE_T level_count
, SIZE_T layer_count
)
3579 struct wined3d_texture
*t
;
3581 if (level_count
> ((~(SIZE_T
)0 - s
) / sizeof(*t
->sub_resources
)) / layer_count
)
3584 return heap_alloc_zero(s
+ level_count
* layer_count
* sizeof(*t
->sub_resources
));
3587 static inline struct wined3d_texture
*texture_from_resource(struct wined3d_resource
*resource
)
3589 return CONTAINING_RECORD(resource
, struct wined3d_texture
, resource
);
3592 static inline unsigned int wined3d_texture_get_level_width(const struct wined3d_texture
*texture
,
3595 return max(1, texture
->resource
.width
>> level
);
3598 static inline unsigned int wined3d_texture_get_level_height(const struct wined3d_texture
*texture
,
3601 return max(1, texture
->resource
.height
>> level
);
3604 static inline unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture
*texture
,
3607 return max(1, texture
->resource
.depth
>> level
);
3610 static inline unsigned int wined3d_texture_get_level_pow2_width(const struct wined3d_texture
*texture
,
3613 return max(1, texture
->pow2_width
>> level
);
3616 static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wined3d_texture
*texture
,
3619 return max(1, texture
->pow2_height
>> level
);
3622 static inline void wined3d_texture_get_level_box(const struct wined3d_texture
*texture
,
3623 unsigned int level
, struct wined3d_box
*box
)
3625 wined3d_box_set(box
, 0, 0,
3626 wined3d_texture_get_level_width(texture
, level
),
3627 wined3d_texture_get_level_height(texture
, level
),
3628 0, wined3d_texture_get_level_depth(texture
, level
));
3631 HRESULT
texture2d_blt(struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
3632 const struct wined3d_box
*dst_box
, struct wined3d_texture
*src_texture
,
3633 unsigned int src_sub_resource_idx
, const struct wined3d_box
*src_box
, DWORD flags
,
3634 const struct wined3d_blt_fx
*blt_fx
, enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
3635 void texture2d_blt_fbo(struct wined3d_device
*device
, struct wined3d_context
*context
,
3636 enum wined3d_texture_filter_type filter
, struct wined3d_texture
*src_texture
,
3637 unsigned int src_sub_resource_idx
, DWORD src_location
, const RECT
*src_rect
,
3638 struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
, DWORD dst_location
,
3639 const RECT
*dst_rect
) DECLSPEC_HIDDEN
;
3640 void texture2d_get_blt_info(const struct wined3d_texture_gl
*texture_gl
, unsigned int sub_resource_idx
,
3641 const RECT
*rect
, struct wined3d_blt_info
*info
) DECLSPEC_HIDDEN
;
3642 void texture2d_load_fb_texture(struct wined3d_texture_gl
*texture_gl
, unsigned int sub_resource_idx
,
3643 BOOL srgb
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
3644 void texture2d_read_from_framebuffer(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
3645 struct wined3d_context
*context
, DWORD src_location
, DWORD dst_location
) DECLSPEC_HIDDEN
;
3647 HRESULT
wined3d_texture_check_box_dimensions(const struct wined3d_texture
*texture
,
3648 unsigned int level
, const struct wined3d_box
*box
) DECLSPEC_HIDDEN
;
3649 void wined3d_texture_cleanup(struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
3650 void wined3d_texture_download_from_texture(struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
3651 struct wined3d_texture
*src_texture
, unsigned int src_sub_resource_idx
) DECLSPEC_HIDDEN
;
3652 GLenum
wined3d_texture_get_gl_buffer(const struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
3653 void wined3d_texture_get_memory(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
3654 struct wined3d_bo_address
*data
, DWORD locations
) DECLSPEC_HIDDEN
;
3655 void wined3d_texture_invalidate_location(struct wined3d_texture
*texture
,
3656 unsigned int sub_resource_idx
, DWORD location
) DECLSPEC_HIDDEN
;
3657 void wined3d_texture_load(struct wined3d_texture
*texture
,
3658 struct wined3d_context
*context
, BOOL srgb
) DECLSPEC_HIDDEN
;
3659 BOOL
wined3d_texture_load_location(struct wined3d_texture
*texture
,
3660 unsigned int sub_resource_idx
, struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
3661 BOOL
wined3d_texture_prepare_location(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
3662 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
3663 void wined3d_texture_set_map_binding(struct wined3d_texture
*texture
, DWORD map_binding
) DECLSPEC_HIDDEN
;
3664 void wined3d_texture_set_swapchain(struct wined3d_texture
*texture
,
3665 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
3666 void wined3d_texture_sub_resources_destroyed(struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
3667 void wined3d_texture_translate_drawable_coords(const struct wined3d_texture
*texture
,
3668 HWND window
, RECT
*rect
) DECLSPEC_HIDDEN
;
3669 void wined3d_texture_upload_from_texture(struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
3670 unsigned int dst_x
, unsigned int dst_y
, unsigned int dst_z
, struct wined3d_texture
*src_texture
,
3671 unsigned int src_sub_resource_idx
, const struct wined3d_box
*src_box
) DECLSPEC_HIDDEN
;
3672 void wined3d_texture_validate_location(struct wined3d_texture
*texture
,
3673 unsigned int sub_resource_idx
, DWORD location
) DECLSPEC_HIDDEN
;
3675 HRESULT
wined3d_texture_no3d_init(struct wined3d_texture
*texture_no3d
, struct wined3d_device
*device
,
3676 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
3677 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
3679 void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle
[4], struct color_fixup_desc fixup
) DECLSPEC_HIDDEN
;
3683 struct wined3d_sampler_desc sampler_desc
;
3684 unsigned int base_level
;
3688 struct wined3d_texture_gl
3690 struct wined3d_texture t
;
3692 struct gl_texture texture_rgb
, texture_srgb
;
3696 GLuint rb_multisample
;
3699 struct list renderbuffers
;
3700 const struct wined3d_renderbuffer_entry
*current_renderbuffer
;
3703 static inline struct wined3d_texture_gl
*wined3d_texture_gl(struct wined3d_texture
*texture
)
3705 return CONTAINING_RECORD(texture
, struct wined3d_texture_gl
, t
);
3708 static inline struct gl_texture
*wined3d_texture_gl_get_gl_texture(struct wined3d_texture_gl
*texture_gl
,
3711 return srgb
? &texture_gl
->texture_srgb
: &texture_gl
->texture_rgb
;
3714 static inline GLenum
wined3d_texture_gl_get_sub_resource_target(const struct wined3d_texture_gl
*texture_gl
,
3715 unsigned int sub_resource_idx
)
3717 static const GLenum cube_targets
[] =
3719 GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
,
3720 GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
,
3721 GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
,
3722 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
,
3723 GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
,
3724 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
,
3727 return texture_gl
->t
.resource
.usage
& WINED3DUSAGE_LEGACY_CUBEMAP
3728 ? cube_targets
[sub_resource_idx
/ texture_gl
->t
.level_count
] : texture_gl
->target
;
3731 static inline BOOL
wined3d_texture_gl_is_multisample_location(const struct wined3d_texture_gl
*texture_gl
,
3734 if (location
== WINED3D_LOCATION_RB_MULTISAMPLE
)
3736 if (location
!= WINED3D_LOCATION_TEXTURE_RGB
&& location
!= WINED3D_LOCATION_TEXTURE_SRGB
)
3738 return texture_gl
->target
== GL_TEXTURE_2D_MULTISAMPLE
|| texture_gl
->target
== GL_TEXTURE_2D_MULTISAMPLE_ARRAY
;
3741 void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl
*texture_gl
,
3742 const struct wined3d_sampler_desc
*sampler_desc
, const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
3743 void wined3d_texture_gl_bind(struct wined3d_texture_gl
*texture_gl
,
3744 struct wined3d_context_gl
*context_gl
, BOOL srgb
) DECLSPEC_HIDDEN
;
3745 void wined3d_texture_gl_bind_and_dirtify(struct wined3d_texture_gl
*texture_gl
,
3746 struct wined3d_context_gl
*context_gl
, BOOL srgb
) DECLSPEC_HIDDEN
;
3747 HRESULT
wined3d_texture_gl_init(struct wined3d_texture_gl
*texture_gl
, struct wined3d_device
*device
,
3748 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
3749 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
3750 void wined3d_texture_gl_prepare_texture(struct wined3d_texture_gl
*texture_gl
,
3751 struct wined3d_context_gl
*context_gl
, BOOL srgb
) DECLSPEC_HIDDEN
;
3752 void wined3d_texture_gl_set_compatible_renderbuffer(struct wined3d_texture_gl
*texture_gl
,
3753 struct wined3d_context_gl
*context_gl
, unsigned int level
,
3754 const struct wined3d_rendertarget_info
*rt
) DECLSPEC_HIDDEN
;
3755 void wined3d_texture_gl_unload_texture(struct wined3d_texture_gl
*texture_gl
) DECLSPEC_HIDDEN
;
3757 struct wined3d_texture_vk
3759 struct wined3d_texture t
;
3762 static inline struct wined3d_texture_vk
*wined3d_texture_vk(struct wined3d_texture
*texture
)
3764 return CONTAINING_RECORD(texture
, struct wined3d_texture_vk
, t
);
3767 HRESULT
wined3d_texture_vk_init(struct wined3d_texture_vk
*texture_vk
, struct wined3d_device
*device
,
3768 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
3769 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
3771 struct wined3d_renderbuffer_entry
3779 struct wined3d_fbo_resource
3783 GLuint level
, layer
;
3786 #define WINED3D_FBO_ENTRY_FLAG_ATTACHED 0x1
3787 #define WINED3D_FBO_ENTRY_FLAG_DEPTH 0x2
3788 #define WINED3D_FBO_ENTRY_FLAG_STENCIL 0x4
3796 struct wined3d_fbo_entry_key
3799 struct wined3d_fbo_resource objects
[MAX_RENDER_TARGET_VIEWS
+ 1];
3803 struct wined3d_sampler
3805 struct wine_rb_entry entry
;
3807 struct wined3d_device
*device
;
3809 const struct wined3d_parent_ops
*parent_ops
;
3810 struct wined3d_sampler_desc desc
;
3813 struct wined3d_sampler_gl
3815 struct wined3d_sampler s
;
3820 static inline struct wined3d_sampler_gl
*wined3d_sampler_gl(struct wined3d_sampler
*sampler
)
3822 return CONTAINING_RECORD(sampler
, struct wined3d_sampler_gl
, s
);
3825 void wined3d_sampler_gl_bind(struct wined3d_sampler_gl
*sampler_gl
, unsigned int unit
,
3826 struct wined3d_texture_gl
*texture_gl
, const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
3827 void wined3d_sampler_gl_init(struct wined3d_sampler_gl
*sampler_gl
,
3828 struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
3829 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
3831 void wined3d_sampler_vk_init(struct wined3d_sampler
*sampler_vk
,
3832 struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
3833 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
3835 struct wined3d_vertex_declaration_element
3837 const struct wined3d_format
*format
;
3839 unsigned int input_slot
;
3840 unsigned int offset
;
3841 unsigned int output_slot
;
3842 enum wined3d_input_classification input_slot_class
;
3843 unsigned int instance_data_step_rate
;
3849 struct wined3d_vertex_declaration
3853 const struct wined3d_parent_ops
*parent_ops
;
3854 struct wined3d_device
*device
;
3856 struct wined3d_vertex_declaration_element
*elements
;
3857 unsigned int element_count
;
3859 BOOL position_transformed
;
3862 struct wined3d_saved_states
3864 DWORD transform
[(WINED3D_HIGHEST_TRANSFORM_STATE
>> 5) + 1];
3865 WORD streamSource
; /* WINED3D_MAX_STREAMS, 16 */
3866 WORD streamFreq
; /* WINED3D_MAX_STREAMS, 16 */
3867 DWORD renderState
[(WINEHIGHEST_RENDER_STATE
>> 5) + 1];
3868 DWORD textureState
[WINED3D_MAX_TEXTURES
]; /* WINED3D_HIGHEST_TEXTURE_STATE + 1, 18 */
3869 WORD samplerState
[WINED3D_MAX_COMBINED_SAMPLERS
]; /* WINED3D_HIGHEST_SAMPLER_STATE + 1, 14 */
3870 DWORD clipplane
; /* WINED3D_MAX_USER_CLIP_PLANES, 32 */
3871 WORD pixelShaderConstantsB
; /* WINED3D_MAX_CONSTS_B, 16 */
3872 WORD pixelShaderConstantsI
; /* WINED3D_MAX_CONSTS_I, 16 */
3873 BOOL ps_consts_f
[WINED3D_MAX_PS_CONSTS_F
];
3874 WORD vertexShaderConstantsB
; /* WINED3D_MAX_CONSTS_B, 16 */
3875 WORD vertexShaderConstantsI
; /* WINED3D_MAX_CONSTS_I, 16 */
3876 BOOL vs_consts_f
[WINED3D_MAX_VS_CONSTS_F
];
3877 DWORD textures
: 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */
3881 DWORD vertexDecl
: 1;
3882 DWORD pixelShader
: 1;
3883 DWORD vertexShader
: 1;
3884 DWORD scissorRect
: 1;
3885 DWORD blend_state
: 1;
3886 DWORD store_stream_offset
: 1;
3895 struct wined3d_stateblock
3897 LONG ref
; /* Note: Ref counting not required */
3898 struct wined3d_device
*device
;
3900 /* Array indicating whether things have been set or changed */
3901 struct wined3d_saved_states changed
;
3902 struct wined3d_stateblock_state stateblock_state
;
3904 /* Contained state management */
3905 DWORD contained_render_states
[WINEHIGHEST_RENDER_STATE
+ 1];
3906 unsigned int num_contained_render_states
;
3907 DWORD contained_transform_states
[WINED3D_HIGHEST_TRANSFORM_STATE
+ 1];
3908 unsigned int num_contained_transform_states
;
3909 DWORD contained_vs_consts_i
[WINED3D_MAX_CONSTS_I
];
3910 unsigned int num_contained_vs_consts_i
;
3911 DWORD contained_vs_consts_b
[WINED3D_MAX_CONSTS_B
];
3912 unsigned int num_contained_vs_consts_b
;
3913 DWORD contained_vs_consts_f
[WINED3D_MAX_VS_CONSTS_F
];
3914 unsigned int num_contained_vs_consts_f
;
3915 DWORD contained_ps_consts_i
[WINED3D_MAX_CONSTS_I
];
3916 unsigned int num_contained_ps_consts_i
;
3917 DWORD contained_ps_consts_b
[WINED3D_MAX_CONSTS_B
];
3918 unsigned int num_contained_ps_consts_b
;
3919 DWORD contained_ps_consts_f
[WINED3D_MAX_PS_CONSTS_F
];
3920 unsigned int num_contained_ps_consts_f
;
3921 struct StageState contained_tss_states
[WINED3D_MAX_TEXTURES
* (WINED3D_HIGHEST_TEXTURE_STATE
+ 1)];
3922 unsigned int num_contained_tss_states
;
3923 struct StageState contained_sampler_states
[WINED3D_MAX_COMBINED_SAMPLERS
* WINED3D_HIGHEST_SAMPLER_STATE
];
3924 unsigned int num_contained_sampler_states
;
3927 void stateblock_init_contained_states(struct wined3d_stateblock
*stateblock
) DECLSPEC_HIDDEN
;
3929 void wined3d_stateblock_state_init(struct wined3d_stateblock_state
*state
,
3930 const struct wined3d_device
*device
, DWORD flags
) DECLSPEC_HIDDEN
;
3931 void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state
*state
) DECLSPEC_HIDDEN
;
3933 void wined3d_light_state_enable_light(struct wined3d_light_state
*state
, const struct wined3d_d3d_info
*d3d_info
,
3934 struct wined3d_light_info
*light_info
, BOOL enable
) DECLSPEC_HIDDEN
;
3935 struct wined3d_light_info
*wined3d_light_state_get_light(const struct wined3d_light_state
*state
,
3936 unsigned int idx
) DECLSPEC_HIDDEN
;
3937 HRESULT
wined3d_light_state_set_light(struct wined3d_light_state
*state
, DWORD light_idx
,
3938 const struct wined3d_light
*params
, struct wined3d_light_info
**light_info
) DECLSPEC_HIDDEN
;
3940 void state_cleanup(struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
3941 void state_init(struct wined3d_state
*state
, struct wined3d_fb_state
*fb
,
3942 const struct wined3d_d3d_info
*d3d_info
, DWORD flags
) DECLSPEC_HIDDEN
;
3943 void state_unbind_resources(struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
3945 enum wined3d_cs_queue_id
3947 WINED3D_CS_QUEUE_DEFAULT
= 0,
3948 WINED3D_CS_QUEUE_MAP
,
3949 WINED3D_CS_QUEUE_COUNT
,
3952 enum wined3d_push_constants
3954 WINED3D_PUSH_CONSTANTS_VS_F
,
3955 WINED3D_PUSH_CONSTANTS_PS_F
,
3956 WINED3D_PUSH_CONSTANTS_VS_I
,
3957 WINED3D_PUSH_CONSTANTS_PS_I
,
3958 WINED3D_PUSH_CONSTANTS_VS_B
,
3959 WINED3D_PUSH_CONSTANTS_PS_B
,
3962 #define WINED3D_CS_QUERY_POLL_INTERVAL 10u
3963 #define WINED3D_CS_QUEUE_SIZE 0x100000u
3964 #define WINED3D_CS_SPIN_COUNT 10000000u
3966 struct wined3d_cs_queue
3969 BYTE data
[WINED3D_CS_QUEUE_SIZE
];
3972 struct wined3d_cs_ops
3974 void *(*require_space
)(struct wined3d_cs
*cs
, size_t size
, enum wined3d_cs_queue_id queue_id
);
3975 void (*submit
)(struct wined3d_cs
*cs
, enum wined3d_cs_queue_id queue_id
);
3976 void (*finish
)(struct wined3d_cs
*cs
, enum wined3d_cs_queue_id queue_id
);
3977 void (*push_constants
)(struct wined3d_cs
*cs
, enum wined3d_push_constants p
,
3978 unsigned int start_idx
, unsigned int count
, const void *constants
);
3983 const struct wined3d_cs_ops
*ops
;
3984 struct wined3d_device
*device
;
3985 struct wined3d_fb_state fb
;
3986 struct wined3d_state state
;
3987 HMODULE wined3d_module
;
3991 struct wined3d_cs_queue queue
[WINED3D_CS_QUEUE_COUNT
];
3992 size_t data_size
, start
, end
;
3994 struct list query_poll_list
;
3995 BOOL queries_flushed
;
3998 BOOL waiting_for_event
;
3999 LONG pending_presents
;
4002 struct wined3d_cs
*wined3d_cs_create(struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
4003 void wined3d_cs_destroy(struct wined3d_cs
*cs
) DECLSPEC_HIDDEN
;
4004 void wined3d_cs_destroy_object(struct wined3d_cs
*cs
,
4005 void (*callback
)(void *object
), void *object
) DECLSPEC_HIDDEN
;
4006 void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs
*cs
,
4007 struct wined3d_texture
*texture
, unsigned int layer
) DECLSPEC_HIDDEN
;
4008 void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*dst_resource
,
4009 unsigned int dst_sub_resource_idx
, const struct wined3d_box
*dst_box
, struct wined3d_resource
*src_resource
,
4010 unsigned int src_sub_resource_idx
, const struct wined3d_box
*src_box
, DWORD flags
,
4011 const struct wined3d_blt_fx
*fx
, enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
4012 void wined3d_cs_emit_clear(struct wined3d_cs
*cs
, DWORD rect_count
, const RECT
*rects
,
4013 DWORD flags
, const struct wined3d_color
*color
, float depth
, DWORD stencil
) DECLSPEC_HIDDEN
;
4014 void wined3d_cs_emit_clear_rendertarget_view(struct wined3d_cs
*cs
, struct wined3d_rendertarget_view
*view
,
4015 const RECT
*rect
, DWORD flags
, const struct wined3d_color
*color
, float depth
, DWORD stencil
) DECLSPEC_HIDDEN
;
4016 void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs
*cs
,
4017 struct wined3d_unordered_access_view
*view
, const struct wined3d_uvec4
*clear_value
) DECLSPEC_HIDDEN
;
4018 void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs
*cs
, struct wined3d_buffer
*dst_buffer
,
4019 unsigned int offset
, struct wined3d_unordered_access_view
*uav
) DECLSPEC_HIDDEN
;
4020 void wined3d_cs_emit_dispatch(struct wined3d_cs
*cs
,
4021 unsigned int group_count_x
, unsigned int group_count_y
, unsigned int group_count_z
) DECLSPEC_HIDDEN
;
4022 void wined3d_cs_emit_dispatch_indirect(struct wined3d_cs
*cs
,
4023 struct wined3d_buffer
*buffer
, unsigned int offset
) DECLSPEC_HIDDEN
;
4024 void wined3d_cs_emit_draw(struct wined3d_cs
*cs
, GLenum primitive_type
, unsigned int patch_vertex_count
,
4025 int base_vertex_idx
, unsigned int start_idx
, unsigned int index_count
,
4026 unsigned int start_instance
, unsigned int instance_count
, BOOL indexed
) DECLSPEC_HIDDEN
;
4027 void wined3d_cs_emit_draw_indirect(struct wined3d_cs
*cs
, GLenum primitive_type
, unsigned int patch_vertex_count
,
4028 struct wined3d_buffer
*buffer
, unsigned int offset
, BOOL indexed
) DECLSPEC_HIDDEN
;
4029 void wined3d_cs_emit_flush(struct wined3d_cs
*cs
) DECLSPEC_HIDDEN
;
4030 void wined3d_cs_emit_generate_mipmaps(struct wined3d_cs
*cs
, struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4031 void wined3d_cs_emit_preload_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
4032 void wined3d_cs_emit_present(struct wined3d_cs
*cs
, struct wined3d_swapchain
*swapchain
, const RECT
*src_rect
,
4033 const RECT
*dst_rect
, HWND dst_window_override
, unsigned int swap_interval
, DWORD flags
) DECLSPEC_HIDDEN
;
4034 void wined3d_cs_emit_query_issue(struct wined3d_cs
*cs
, struct wined3d_query
*query
, DWORD flags
) DECLSPEC_HIDDEN
;
4035 void wined3d_cs_emit_reset_state(struct wined3d_cs
*cs
) DECLSPEC_HIDDEN
;
4036 void wined3d_cs_emit_set_blend_state(struct wined3d_cs
*cs
, struct wined3d_blend_state
*state
,
4037 const struct wined3d_color
*blend_factor
) DECLSPEC_HIDDEN
;
4038 void wined3d_cs_emit_set_clip_plane(struct wined3d_cs
*cs
, UINT plane_idx
,
4039 const struct wined3d_vec4
*plane
) DECLSPEC_HIDDEN
;
4040 void wined3d_cs_emit_set_color_key(struct wined3d_cs
*cs
, struct wined3d_texture
*texture
,
4041 WORD flags
, const struct wined3d_color_key
*color_key
) DECLSPEC_HIDDEN
;
4042 void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4043 UINT cb_idx
, struct wined3d_buffer
*buffer
) DECLSPEC_HIDDEN
;
4044 void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs
*cs
,
4045 struct wined3d_rendertarget_view
*view
) DECLSPEC_HIDDEN
;
4046 void wined3d_cs_emit_set_index_buffer(struct wined3d_cs
*cs
, struct wined3d_buffer
*buffer
,
4047 enum wined3d_format_id format_id
, unsigned int offset
) DECLSPEC_HIDDEN
;
4048 void wined3d_cs_emit_set_light(struct wined3d_cs
*cs
, const struct wined3d_light_info
*light
) DECLSPEC_HIDDEN
;
4049 void wined3d_cs_emit_set_light_enable(struct wined3d_cs
*cs
, unsigned int idx
, BOOL enable
) DECLSPEC_HIDDEN
;
4050 void wined3d_cs_emit_set_material(struct wined3d_cs
*cs
, const struct wined3d_material
*material
) DECLSPEC_HIDDEN
;
4051 void wined3d_cs_emit_set_predication(struct wined3d_cs
*cs
,
4052 struct wined3d_query
*predicate
, BOOL value
) DECLSPEC_HIDDEN
;
4053 void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs
*cs
,
4054 struct wined3d_rasterizer_state
*rasterizer_state
) DECLSPEC_HIDDEN
;
4055 void wined3d_cs_emit_set_render_state(struct wined3d_cs
*cs
,
4056 enum wined3d_render_state state
, DWORD value
) DECLSPEC_HIDDEN
;
4057 void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs
*cs
, unsigned int view_idx
,
4058 struct wined3d_rendertarget_view
*view
) DECLSPEC_HIDDEN
;
4059 void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4060 UINT view_idx
, struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4061 void wined3d_cs_emit_set_sampler(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4062 UINT sampler_idx
, struct wined3d_sampler
*sampler
) DECLSPEC_HIDDEN
;
4063 void wined3d_cs_emit_set_sampler_state(struct wined3d_cs
*cs
, UINT sampler_idx
,
4064 enum wined3d_sampler_state state
, DWORD value
) DECLSPEC_HIDDEN
;
4065 void wined3d_cs_emit_set_scissor_rects(struct wined3d_cs
*cs
, unsigned int rect_count
, const RECT
*rects
) DECLSPEC_HIDDEN
;
4066 void wined3d_cs_emit_set_shader(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4067 struct wined3d_shader
*shader
) DECLSPEC_HIDDEN
;
4068 void wined3d_cs_emit_set_stream_output(struct wined3d_cs
*cs
, UINT stream_idx
,
4069 struct wined3d_buffer
*buffer
, UINT offset
) DECLSPEC_HIDDEN
;
4070 void wined3d_cs_emit_set_stream_source(struct wined3d_cs
*cs
, UINT stream_idx
,
4071 struct wined3d_buffer
*buffer
, UINT offset
, UINT stride
) DECLSPEC_HIDDEN
;
4072 void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs
*cs
, UINT stream_idx
,
4073 UINT frequency
, UINT flags
) DECLSPEC_HIDDEN
;
4074 void wined3d_cs_emit_set_texture(struct wined3d_cs
*cs
, UINT stage
, struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
4075 void wined3d_cs_emit_set_texture_state(struct wined3d_cs
*cs
, UINT stage
,
4076 enum wined3d_texture_stage_state state
, DWORD value
) DECLSPEC_HIDDEN
;
4077 void wined3d_cs_emit_set_transform(struct wined3d_cs
*cs
, enum wined3d_transform_state state
,
4078 const struct wined3d_matrix
*matrix
) DECLSPEC_HIDDEN
;
4079 void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs
*cs
, enum wined3d_pipeline pipeline
,
4080 unsigned int view_idx
, struct wined3d_unordered_access_view
*view
,
4081 unsigned int initial_count
) DECLSPEC_HIDDEN
;
4082 void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs
*cs
,
4083 struct wined3d_vertex_declaration
*declaration
) DECLSPEC_HIDDEN
;
4084 void wined3d_cs_emit_set_viewports(struct wined3d_cs
*cs
, unsigned int viewport_count
, const struct wined3d_viewport
*viewports
) DECLSPEC_HIDDEN
;
4085 void wined3d_cs_emit_unload_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
4086 void wined3d_cs_emit_update_sub_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
,
4087 unsigned int sub_resource_idx
, const struct wined3d_box
*box
, const void *data
, unsigned int row_pitch
,
4088 unsigned int slice_pitch
) DECLSPEC_HIDDEN
;
4089 void wined3d_cs_init_object(struct wined3d_cs
*cs
,
4090 void (*callback
)(void *object
), void *object
) DECLSPEC_HIDDEN
;
4091 HRESULT
wined3d_cs_map(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
, unsigned int sub_resource_idx
,
4092 struct wined3d_map_desc
*map_desc
, const struct wined3d_box
*box
, unsigned int flags
) DECLSPEC_HIDDEN
;
4093 HRESULT
wined3d_cs_unmap(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
,
4094 unsigned int sub_resource_idx
) DECLSPEC_HIDDEN
;
4096 static inline void wined3d_cs_finish(struct wined3d_cs
*cs
, enum wined3d_cs_queue_id queue_id
)
4098 cs
->ops
->finish(cs
, queue_id
);
4101 static inline void wined3d_cs_push_constants(struct wined3d_cs
*cs
, enum wined3d_push_constants p
,
4102 unsigned int start_idx
, unsigned int count
, const void *constants
)
4104 cs
->ops
->push_constants(cs
, p
, start_idx
, count
, constants
);
4107 static inline void wined3d_resource_wait_idle(struct wined3d_resource
*resource
)
4109 const struct wined3d_cs
*cs
= resource
->device
->cs
;
4111 if (!cs
->thread
|| cs
->thread_id
== GetCurrentThreadId())
4114 while (InterlockedCompareExchange(&resource
->access_count
, 0, 0))
4118 /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other
4119 * fixed function semantics as D3DCOLOR or FLOAT16 */
4120 enum wined3d_buffer_conversion_type
4127 struct wined3d_map_range
4133 struct wined3d_buffer_ops
4135 BOOL (*buffer_prepare_location
)(struct wined3d_buffer
*buffer
,
4136 struct wined3d_context
*context
, unsigned int location
);
4137 void (*buffer_upload_ranges
)(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
, const void *data
,
4138 unsigned int data_offset
, unsigned int range_count
, const struct wined3d_map_range
*ranges
);
4139 void (*buffer_download_ranges
)(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
, void *data
,
4140 unsigned int data_offset
, unsigned int range_count
, const struct wined3d_map_range
*ranges
);
4143 struct wined3d_buffer
4145 struct wined3d_resource resource
;
4146 const struct wined3d_buffer_ops
*buffer_ops
;
4148 unsigned int structure_byte_stride
;
4153 struct wined3d_map_range
*maps
;
4154 SIZE_T maps_size
, modified_areas
;
4155 struct wined3d_fence
*fence
;
4157 /* conversion stuff */
4158 UINT decl_change_count
, full_conversion_count
;
4160 UINT stride
; /* 0 if no conversion */
4161 enum wined3d_buffer_conversion_type
*conversion_map
; /* NULL if no conversion */
4162 UINT conversion_stride
; /* 0 if no shifted conversion */
4165 static inline struct wined3d_buffer
*buffer_from_resource(struct wined3d_resource
*resource
)
4167 return CONTAINING_RECORD(resource
, struct wined3d_buffer
, resource
);
4170 void wined3d_buffer_cleanup(struct wined3d_buffer
*buffer
) DECLSPEC_HIDDEN
;
4171 DWORD
wined3d_buffer_get_memory(struct wined3d_buffer
*buffer
,
4172 struct wined3d_bo_address
*data
, DWORD locations
) DECLSPEC_HIDDEN
;
4173 void wined3d_buffer_invalidate_location(struct wined3d_buffer
*buffer
, DWORD location
) DECLSPEC_HIDDEN
;
4174 void wined3d_buffer_load(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
,
4175 const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
4176 BOOL
wined3d_buffer_load_location(struct wined3d_buffer
*buffer
,
4177 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4178 BYTE
*wined3d_buffer_load_sysmem(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4179 void wined3d_buffer_copy(struct wined3d_buffer
*dst_buffer
, unsigned int dst_offset
,
4180 struct wined3d_buffer
*src_buffer
, unsigned int src_offset
, unsigned int size
) DECLSPEC_HIDDEN
;
4181 void wined3d_buffer_upload_data(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
,
4182 const struct wined3d_box
*box
, const void *data
) DECLSPEC_HIDDEN
;
4184 HRESULT
wined3d_buffer_no3d_init(struct wined3d_buffer
*buffer_no3d
, struct wined3d_device
*device
,
4185 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
4186 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4188 struct wined3d_buffer_gl
4190 struct wined3d_buffer b
;
4192 GLuint buffer_object
;
4193 GLenum buffer_object_usage
;
4194 GLenum buffer_type_hint
;
4197 static inline struct wined3d_buffer_gl
*wined3d_buffer_gl(struct wined3d_buffer
*buffer
)
4199 return CONTAINING_RECORD(buffer
, struct wined3d_buffer_gl
, b
);
4202 void wined3d_buffer_gl_destroy_buffer_object(struct wined3d_buffer_gl
*buffer_gl
,
4203 struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
4204 HRESULT
wined3d_buffer_gl_init(struct wined3d_buffer_gl
*buffer_gl
, struct wined3d_device
*device
,
4205 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
4206 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4208 struct wined3d_buffer_vk
4210 struct wined3d_buffer b
;
4213 static inline struct wined3d_buffer_vk
*wined3d_buffer_vk(struct wined3d_buffer
*buffer
)
4215 return CONTAINING_RECORD(buffer
, struct wined3d_buffer_vk
, b
);
4218 HRESULT
wined3d_buffer_vk_init(struct wined3d_buffer_vk
*buffer_vk
, struct wined3d_device
*device
,
4219 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
4220 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4222 struct wined3d_rendertarget_view
4226 struct wined3d_resource
*resource
;
4228 const struct wined3d_parent_ops
*parent_ops
;
4230 const struct wined3d_format
*format
;
4231 unsigned int format_flags
;
4232 unsigned int sub_resource_idx
;
4233 unsigned int layer_count
;
4236 unsigned int height
;
4238 struct wined3d_view_desc desc
;
4241 void wined3d_rendertarget_view_cleanup(struct wined3d_rendertarget_view
*view
) DECLSPEC_HIDDEN
;
4242 void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view
*view
,
4243 const struct wined3d_context
*context
, unsigned int *width
, unsigned int *height
) DECLSPEC_HIDDEN
;
4244 void wined3d_rendertarget_view_invalidate_location(struct wined3d_rendertarget_view
*view
,
4245 DWORD location
) DECLSPEC_HIDDEN
;
4246 void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view
*view
,
4247 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4248 void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view
*view
,
4249 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4250 void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view
*view
,
4251 DWORD location
) DECLSPEC_HIDDEN
;
4253 HRESULT
wined3d_rendertarget_view_no3d_init(struct wined3d_rendertarget_view
*view_no3d
,
4254 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4255 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4257 struct wined3d_rendertarget_view_gl
4259 struct wined3d_rendertarget_view v
;
4260 struct wined3d_gl_view gl_view
;
4263 static inline struct wined3d_rendertarget_view_gl
*wined3d_rendertarget_view_gl(
4264 struct wined3d_rendertarget_view
*view
)
4266 return CONTAINING_RECORD(view
, struct wined3d_rendertarget_view_gl
, v
);
4269 HRESULT
wined3d_rendertarget_view_gl_init(struct wined3d_rendertarget_view_gl
*view_gl
,
4270 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4271 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4273 struct wined3d_rendertarget_view_vk
4275 struct wined3d_rendertarget_view v
;
4278 static inline struct wined3d_rendertarget_view_vk
*wined3d_rendertarget_view_vk(
4279 struct wined3d_rendertarget_view
*view
)
4281 return CONTAINING_RECORD(view
, struct wined3d_rendertarget_view_vk
, v
);
4284 HRESULT
wined3d_rendertarget_view_vk_init(struct wined3d_rendertarget_view_vk
*view_vk
,
4285 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4286 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4288 struct wined3d_shader_resource_view
4292 struct wined3d_resource
*resource
;
4294 const struct wined3d_parent_ops
*parent_ops
;
4296 const struct wined3d_format
*format
;
4298 struct wined3d_view_desc desc
;
4301 void wined3d_shader_resource_view_cleanup(struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4302 void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4304 struct wined3d_shader_resource_view_gl
4306 struct wined3d_shader_resource_view v
;
4307 struct wined3d_gl_view gl_view
;
4310 static inline struct wined3d_shader_resource_view_gl
*wined3d_shader_resource_view_gl(
4311 struct wined3d_shader_resource_view
*view
)
4313 return CONTAINING_RECORD(view
, struct wined3d_shader_resource_view_gl
, v
);
4316 void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
*view_gl
, unsigned int unit
,
4317 struct wined3d_sampler_gl
*sampler_gl
, struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
4318 HRESULT
wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view_gl
*view_gl
,
4319 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4320 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4322 struct wined3d_shader_resource_view_vk
4324 struct wined3d_shader_resource_view v
;
4327 static inline struct wined3d_shader_resource_view_vk
*wined3d_shader_resource_view_vk(
4328 struct wined3d_shader_resource_view
*view
)
4330 return CONTAINING_RECORD(view
, struct wined3d_shader_resource_view_vk
, v
);
4333 HRESULT
wined3d_shader_resource_view_vk_init(struct wined3d_shader_resource_view_vk
*view_vk
,
4334 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4335 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4337 struct wined3d_unordered_access_view
4341 struct wined3d_resource
*resource
;
4343 const struct wined3d_parent_ops
*parent_ops
;
4345 const struct wined3d_format
*format
;
4347 struct wined3d_view_desc desc
;
4350 void wined3d_unordered_access_view_cleanup(struct wined3d_unordered_access_view
*view
) DECLSPEC_HIDDEN
;
4351 void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_view
*view
,
4352 const struct wined3d_uvec4
*clear_value
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4353 void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_view
*view
,
4354 struct wined3d_buffer
*buffer
, unsigned int offset
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4355 void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_access_view
*view
,
4356 DWORD location
) DECLSPEC_HIDDEN
;
4357 void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_view
*view
,
4358 unsigned int value
) DECLSPEC_HIDDEN
;
4360 struct wined3d_unordered_access_view_gl
4362 struct wined3d_unordered_access_view v
;
4363 struct wined3d_gl_view gl_view
;
4367 static inline struct wined3d_unordered_access_view_gl
*wined3d_unordered_access_view_gl(
4368 struct wined3d_unordered_access_view
*view
)
4370 return CONTAINING_RECORD(view
, struct wined3d_unordered_access_view_gl
, v
);
4373 HRESULT
wined3d_unordered_access_view_gl_init(struct wined3d_unordered_access_view_gl
*view_gl
,
4374 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4375 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4377 struct wined3d_unordered_access_view_vk
4379 struct wined3d_unordered_access_view v
;
4382 static inline struct wined3d_unordered_access_view_vk
*wined3d_unordered_access_view_vk(
4383 struct wined3d_unordered_access_view
*view
)
4385 return CONTAINING_RECORD(view
, struct wined3d_unordered_access_view_vk
, v
);
4388 HRESULT
wined3d_unordered_access_view_vk_init(struct wined3d_unordered_access_view_vk
*view_vk
,
4389 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4390 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4392 struct wined3d_swapchain_state
4394 struct wined3d_swapchain_desc desc
;
4396 struct wined3d_display_mode original_mode
, d3d_mode
;
4397 RECT original_window_rect
;
4399 /* Window styles to restore when switching fullscreen mode. */
4405 void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state
*state
,
4406 HWND window
, const RECT
*window_rect
) DECLSPEC_HIDDEN
;
4407 HRESULT
wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
*state
,
4408 HWND window
, unsigned int w
, unsigned int h
) DECLSPEC_HIDDEN
;
4410 struct wined3d_swapchain_ops
4412 void (*swapchain_present
)(struct wined3d_swapchain
*swapchain
,
4413 const RECT
*src_rect
, const RECT
*dst_rect
, unsigned int swap_interval
, DWORD flags
);
4414 void (*swapchain_frontbuffer_updated
)(struct wined3d_swapchain
*swapchain
);
4417 struct wined3d_swapchain
4421 const struct wined3d_parent_ops
*parent_ops
;
4422 const struct wined3d_swapchain_ops
*swapchain_ops
;
4423 struct wined3d_device
*device
;
4425 struct wined3d_texture
**back_buffers
;
4426 struct wined3d_texture
*front_buffer
;
4427 struct wined3d_gamma_ramp orig_gamma
;
4428 BOOL render_to_fbo
, reapply_mode
;
4429 const struct wined3d_format
*ds_format
;
4430 struct wined3d_palette
*palette
;
4431 RECT front_buffer_update
;
4432 unsigned int swap_interval
;
4433 unsigned int max_frame_latency
;
4435 LONG prev_time
, frames
; /* Performance tracking */
4437 struct wined3d_swapchain_state state
;
4441 void wined3d_swapchain_activate(struct wined3d_swapchain
*swapchain
, BOOL activate
) DECLSPEC_HIDDEN
;
4442 void wined3d_swapchain_cleanup(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
4443 void swapchain_update_draw_bindings(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
4444 void swapchain_set_max_frame_latency(struct wined3d_swapchain
*swapchain
,
4445 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
4447 HRESULT
wined3d_swapchain_no3d_init(struct wined3d_swapchain
*swapchain_no3d
,
4448 struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
4449 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4451 struct wined3d_swapchain_gl
4453 struct wined3d_swapchain s
;
4455 struct wined3d_context_gl
**contexts
;
4456 SIZE_T contexts_size
;
4457 SIZE_T context_count
;
4463 static inline struct wined3d_swapchain_gl
*wined3d_swapchain_gl(struct wined3d_swapchain
*swapchain
)
4465 return CONTAINING_RECORD(swapchain
, struct wined3d_swapchain_gl
, s
);
4468 void wined3d_swapchain_gl_cleanup(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
4469 void wined3d_swapchain_gl_destroy_contexts(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
4470 HDC
wined3d_swapchain_gl_get_backup_dc(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
4471 struct wined3d_context_gl
*wined3d_swapchain_gl_get_context(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
4472 HRESULT
wined3d_swapchain_gl_init(struct wined3d_swapchain_gl
*swapchain_gl
,
4473 struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
4474 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4476 HRESULT
wined3d_swapchain_vk_init(struct wined3d_swapchain
*swapchain_vk
,
4477 struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
4478 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4480 /*****************************************************************************
4481 * Utility function prototypes
4484 /* Trace routines */
4485 const char *debug_bo_address(const struct wined3d_bo_address
*address
) DECLSPEC_HIDDEN
;
4486 const char *debug_box(const struct wined3d_box
*box
) DECLSPEC_HIDDEN
;
4487 const char *debug_color(const struct wined3d_color
*color
) DECLSPEC_HIDDEN
;
4488 const char *debug_const_bo_address(const struct wined3d_const_bo_address
*address
) DECLSPEC_HIDDEN
;
4489 const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx
) DECLSPEC_HIDDEN
;
4490 const char *debug_d3dformat(enum wined3d_format_id format_id
) DECLSPEC_HIDDEN
;
4491 const char *debug_d3ddevicetype(enum wined3d_device_type device_type
) DECLSPEC_HIDDEN
;
4492 const char *debug_d3dresourcetype(enum wined3d_resource_type resource_type
) DECLSPEC_HIDDEN
;
4493 const char *debug_d3dusage(DWORD usage
) DECLSPEC_HIDDEN
;
4494 const char *debug_d3dusagequery(DWORD usagequery
) DECLSPEC_HIDDEN
;
4495 const char *debug_d3ddeclmethod(enum wined3d_decl_method method
) DECLSPEC_HIDDEN
;
4496 const char *debug_d3ddeclusage(enum wined3d_decl_usage usage
) DECLSPEC_HIDDEN
;
4497 const char *debug_d3dinput_classification(enum wined3d_input_classification classification
) DECLSPEC_HIDDEN
;
4498 const char *debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type
) DECLSPEC_HIDDEN
;
4499 const char *debug_d3drenderstate(enum wined3d_render_state state
) DECLSPEC_HIDDEN
;
4500 const char *debug_d3dsamplerstate(enum wined3d_sampler_state state
) DECLSPEC_HIDDEN
;
4501 const char *debug_d3dstate(DWORD state
) DECLSPEC_HIDDEN
;
4502 const char *debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_type
) DECLSPEC_HIDDEN
;
4503 const char *debug_d3dtexturestate(enum wined3d_texture_stage_state state
) DECLSPEC_HIDDEN
;
4504 const char *debug_d3dtop(enum wined3d_texture_op d3dtop
) DECLSPEC_HIDDEN
;
4505 const char *debug_d3dtstype(enum wined3d_transform_state tstype
) DECLSPEC_HIDDEN
;
4506 const char *debug_fboattachment(GLenum attachment
) DECLSPEC_HIDDEN
;
4507 const char *debug_fbostatus(GLenum status
) DECLSPEC_HIDDEN
;
4508 const char *debug_glerror(GLenum error
) DECLSPEC_HIDDEN
;
4509 const char *debug_ivec4(const struct wined3d_ivec4
*v
) DECLSPEC_HIDDEN
;
4510 const char *debug_uvec4(const struct wined3d_uvec4
*v
) DECLSPEC_HIDDEN
;
4511 const char *debug_shader_type(enum wined3d_shader_type shader_type
) DECLSPEC_HIDDEN
;
4512 const char *debug_vec4(const struct wined3d_vec4
*v
) DECLSPEC_HIDDEN
;
4513 const char *wined3d_debug_feature_level(enum wined3d_feature_level level
) DECLSPEC_HIDDEN
;
4514 void dump_color_fixup_desc(struct color_fixup_desc fixup
) DECLSPEC_HIDDEN
;
4516 BOOL
is_invalid_op(const struct wined3d_state
*state
, int stage
,
4517 enum wined3d_texture_op op
, DWORD arg1
, DWORD arg2
, DWORD arg3
) DECLSPEC_HIDDEN
;
4518 void set_tex_op_nvrc(const struct wined3d_gl_info
*gl_info
, const struct wined3d_state
*state
,
4519 BOOL is_alpha
, int stage
, enum wined3d_texture_op op
, DWORD arg1
, DWORD arg2
, DWORD arg3
,
4520 INT texture_idx
, DWORD dst
) DECLSPEC_HIDDEN
;
4521 void texture_activate_dimensions(struct wined3d_texture
*texture
,
4522 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
4523 void sampler_texdim(struct wined3d_context
*context
,
4524 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4525 void tex_alphaop(struct wined3d_context
*context
,
4526 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4527 void apply_pixelshader(struct wined3d_context
*context
,
4528 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4529 void state_alpha_test(struct wined3d_context
*context
,
4530 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4531 void state_fogcolor(struct wined3d_context
*context
,
4532 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4533 void state_fogdensity(struct wined3d_context
*context
,
4534 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4535 void state_fogstartend(struct wined3d_context
*context
,
4536 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4537 void state_fog_fragpart(struct wined3d_context
*context
,
4538 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4539 void state_nop(struct wined3d_context
*context
,
4540 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4541 void state_srgbwrite(struct wined3d_context
*context
,
4542 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4544 void state_clipping(struct wined3d_context
*context
,
4545 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4546 void clipplane(struct wined3d_context
*context
,
4547 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4548 void state_pointsprite_w(struct wined3d_context
*context
,
4549 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4550 void state_pointsprite(struct wined3d_context
*context
,
4551 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4552 void state_shademode(struct wined3d_context
*context
,
4553 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
4555 GLenum
gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type
) DECLSPEC_HIDDEN
;
4556 enum wined3d_primitive_type
d3d_primitive_type_from_gl(GLenum primitive_type
) DECLSPEC_HIDDEN
;
4559 void multiply_matrix(struct wined3d_matrix
*dest
, const struct wined3d_matrix
*src1
,
4560 const struct wined3d_matrix
*src2
) DECLSPEC_HIDDEN
;
4562 void wined3d_release_dc(HWND window
, HDC dc
) DECLSPEC_HIDDEN
;
4564 struct wined3d_shader_lconst
4571 struct wined3d_shader_limits
4573 unsigned int sampler
;
4574 unsigned int constant_int
;
4575 unsigned int constant_float
;
4576 unsigned int constant_bool
;
4577 unsigned int packed_output
;
4578 unsigned int packed_input
;
4582 #define PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
4584 #define PRINTF_ATTR(fmt,args)
4587 struct wined3d_string_buffer_list
4592 struct wined3d_string_buffer
*string_buffer_get(struct wined3d_string_buffer_list
*list
) DECLSPEC_HIDDEN
;
4593 void string_buffer_sprintf(struct wined3d_string_buffer
*buffer
, const char *format
, ...) PRINTF_ATTR(2, 3) DECLSPEC_HIDDEN
;
4594 void string_buffer_release(struct wined3d_string_buffer_list
*list
, struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
4595 void string_buffer_list_init(struct wined3d_string_buffer_list
*list
) DECLSPEC_HIDDEN
;
4596 void string_buffer_list_cleanup(struct wined3d_string_buffer_list
*list
) DECLSPEC_HIDDEN
;
4598 int shader_addline(struct wined3d_string_buffer
*buffer
, const char *fmt
, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN
;
4599 BOOL
string_buffer_resize(struct wined3d_string_buffer
*buffer
, int rc
) DECLSPEC_HIDDEN
;
4600 int shader_vaddline(struct wined3d_string_buffer
*buffer
, const char *fmt
, va_list args
) DECLSPEC_HIDDEN
;
4602 struct wined3d_shader_phase
4606 unsigned int instance_count
;
4607 unsigned int temporary_count
;
4610 struct wined3d_vertex_shader
4612 struct wined3d_shader_attribute attributes
[MAX_ATTRIBS
];
4615 struct wined3d_hull_shader
4619 struct wined3d_shader_phase
*control_point
;
4620 unsigned int fork_count
;
4621 unsigned int join_count
;
4622 struct wined3d_shader_phase
*fork
;
4624 struct wined3d_shader_phase
*join
;
4627 unsigned int output_vertex_count
;
4628 enum wined3d_tessellator_output_primitive tessellator_output_primitive
;
4629 enum wined3d_tessellator_partitioning tessellator_partitioning
;
4632 struct wined3d_domain_shader
4634 enum wined3d_tessellator_domain tessellator_domain
;
4637 struct wined3d_geometry_shader
4639 enum wined3d_primitive_type input_type
;
4640 enum wined3d_primitive_type output_type
;
4641 unsigned int vertices_out
;
4642 unsigned int instance_count
;
4644 struct wined3d_stream_output_desc so_desc
;
4647 struct wined3d_pixel_shader
4649 /* Pixel shader input semantics */
4650 DWORD input_reg_map
[MAX_REG_INPUT
];
4651 DWORD input_reg_used
; /* MAX_REG_INPUT, 32 */
4652 unsigned int declared_in_count
;
4654 /* Some information about the shader behavior */
4658 BOOL force_early_depth_stencil
;
4659 enum wined3d_shader_register_type depth_output
;
4660 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
4663 struct wined3d_compute_shader
4665 struct wined3d_shader_thread_group_size thread_group_size
;
4668 struct wined3d_shader
4671 const struct wined3d_shader_limits
*limits
;
4672 const DWORD
*function
;
4673 unsigned int functionLength
;
4675 unsigned int byte_code_size
;
4676 BOOL load_local_constsF
;
4677 const struct wined3d_shader_frontend
*frontend
;
4678 void *frontend_data
;
4682 const struct wined3d_parent_ops
*parent_ops
;
4684 /* Programs this shader is linked with */
4685 struct list linked_programs
;
4687 /* Immediate constants (override global ones) */
4688 struct list constantsB
;
4689 struct list constantsF
;
4690 struct list constantsI
;
4691 struct wined3d_shader_reg_maps reg_maps
;
4692 BOOL lconst_inf_or_nan
;
4694 struct wined3d_shader_signature input_signature
;
4695 struct wined3d_shader_signature output_signature
;
4696 struct wined3d_shader_signature patch_constant_signature
;
4698 /* Pointer to the parent device */
4699 struct wined3d_device
*device
;
4700 struct list shader_list_entry
;
4704 struct wined3d_vertex_shader vs
;
4705 struct wined3d_hull_shader hs
;
4706 struct wined3d_domain_shader ds
;
4707 struct wined3d_geometry_shader gs
;
4708 struct wined3d_pixel_shader ps
;
4709 struct wined3d_compute_shader cs
;
4713 enum wined3d_shader_resource_type
pixelshader_get_resource_type(const struct wined3d_shader_reg_maps
*reg_maps
,
4714 unsigned int resource_idx
, DWORD tex_types
) DECLSPEC_HIDDEN
;
4715 void find_ps_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
4716 BOOL position_transformed
, struct ps_compile_args
*args
,
4717 const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4719 BOOL
vshader_get_input(const struct wined3d_shader
*shader
,
4720 BYTE usage_req
, BYTE usage_idx_req
, unsigned int *regnum
) DECLSPEC_HIDDEN
;
4721 void find_vs_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
4722 WORD swizzle_map
, struct vs_compile_args
*args
,
4723 const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4725 void find_ds_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
4726 struct ds_compile_args
*args
, const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4728 void find_gs_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
4729 struct gs_compile_args
*args
, const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4731 void string_buffer_clear(struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
4732 BOOL
string_buffer_init(struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
4733 void string_buffer_free(struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
4734 unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_maps
*reg_maps
,
4735 unsigned int max
) DECLSPEC_HIDDEN
;
4736 HRESULT
shader_generate_code(const struct wined3d_shader
*shader
, struct wined3d_string_buffer
*buffer
,
4737 const struct wined3d_shader_reg_maps
*reg_maps
, void *backend_ctx
,
4738 const DWORD
*start
, const DWORD
*end
) DECLSPEC_HIDDEN
;
4739 BOOL
shader_match_semantic(const char *semantic_name
, enum wined3d_decl_usage usage
) DECLSPEC_HIDDEN
;
4741 static inline BOOL
shader_is_scalar(const struct wined3d_shader_register
*reg
)
4745 case WINED3DSPR_RASTOUT
:
4747 if (reg
->idx
[0].offset
)
4752 case WINED3DSPR_CONSTBOOL
: /* b# */
4753 case WINED3DSPR_DEPTHOUT
: /* oDepth */
4754 case WINED3DSPR_DEPTHOUTGE
:
4755 case WINED3DSPR_DEPTHOUTLE
:
4756 case WINED3DSPR_LOOP
: /* aL */
4757 case WINED3DSPR_OUTPOINTID
:
4758 case WINED3DSPR_PREDICATE
: /* p0 */
4759 case WINED3DSPR_PRIMID
: /* primID */
4760 case WINED3DSPR_COVERAGE
: /* vCoverage */
4761 case WINED3DSPR_SAMPLEMASK
: /* oMask */
4764 case WINED3DSPR_MISCTYPE
:
4765 switch (reg
->idx
[0].offset
)
4775 case WINED3DSPR_IMMCONST
:
4776 return reg
->immconst_type
== WINED3D_IMMCONST_SCALAR
;
4783 static inline void shader_get_position_fixup(const struct wined3d_context
*context
,
4784 const struct wined3d_state
*state
, unsigned int fixup_count
, float *position_fixup
)
4786 float center_offset
;
4789 if (context
->d3d_info
->wined3d_creation_flags
& WINED3D_PIXEL_CENTER_INTEGER
)
4790 center_offset
= 63.0f
/ 64.0f
;
4792 center_offset
= -1.0f
/ 64.0f
;
4794 for (i
= 0; i
< fixup_count
; ++i
)
4796 position_fixup
[4 * i
] = 1.0f
;
4797 position_fixup
[4 * i
+ 1] = 1.0f
;
4798 position_fixup
[4 * i
+ 2] = center_offset
/ state
->viewports
[i
].width
;
4799 position_fixup
[4 * i
+ 3] = -center_offset
/ state
->viewports
[i
].height
;
4801 if (context
->render_offscreen
)
4803 position_fixup
[4 * i
+ 1] *= -1.0f
;
4804 position_fixup
[4 * i
+ 3] *= -1.0f
;
4809 static inline BOOL
shader_constant_is_local(const struct wined3d_shader
*shader
, DWORD reg
)
4811 struct wined3d_shader_lconst
*lconst
;
4813 if (shader
->load_local_constsF
)
4816 LIST_FOR_EACH_ENTRY(lconst
, &shader
->constantsF
, struct wined3d_shader_lconst
, entry
)
4818 if (lconst
->idx
== reg
)
4825 void get_identity_matrix(struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
4826 void get_modelview_matrix(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
4827 unsigned int index
, struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
4828 void get_projection_matrix(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
4829 struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
4830 void get_texture_matrix(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
4831 unsigned int tex
, struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
4832 void get_pointsize_minmax(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
4833 float *out_min
, float *out_max
) DECLSPEC_HIDDEN
;
4834 void get_pointsize(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
4835 float *out_pointsize
, float *out_att
) DECLSPEC_HIDDEN
;
4836 void get_fog_start_end(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
4837 float *start
, float *end
) DECLSPEC_HIDDEN
;
4839 /* Using additional shader constants (uniforms in GLSL / program environment
4840 * or local parameters in ARB) is costly:
4841 * ARB only knows float4 parameters and GLSL compiler are not really smart
4842 * when it comes to efficiently pack float2 uniforms, so no space is wasted
4843 * (in fact most compilers map a float2 to a full float4 uniform).
4845 * For NP2 texcoord fixup we only need 2 floats (width and height) for each
4846 * 2D texture used in the shader. We therefore pack fixup info for 2 textures
4847 * into a single shader constant (uniform / program parameter).
4849 * This structure is shared between the GLSL and the ARB backend.*/
4850 struct ps_np2fixup_info
{
4851 unsigned char idx
[WINED3D_MAX_FRAGMENT_SAMPLERS
]; /* indices to the real constant */
4852 WORD active
; /* bitfield indicating if we can apply the fixup */
4856 void print_glsl_info_log(const struct wined3d_gl_info
*gl_info
, GLuint id
, BOOL program
) DECLSPEC_HIDDEN
;
4857 void shader_glsl_validate_link(const struct wined3d_gl_info
*gl_info
, GLuint program
) DECLSPEC_HIDDEN
;
4859 struct wined3d_palette
4862 struct wined3d_device
*device
;
4865 RGBQUAD colors
[256];
4869 /* DirectDraw utility functions */
4870 extern enum wined3d_format_id
pixelformat_for_depth(DWORD depth
) DECLSPEC_HIDDEN
;
4872 /*****************************************************************************
4873 * Pixel format management
4876 /* WineD3D pixel format flags */
4877 #define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001
4878 #define WINED3DFMT_FLAG_FILTERING 0x00000002
4879 #define WINED3DFMT_FLAG_DEPTH 0x00000004
4880 #define WINED3DFMT_FLAG_STENCIL 0x00000008
4881 #define WINED3DFMT_FLAG_RENDERTARGET 0x00000010
4882 #define WINED3DFMT_FLAG_EXTENSION 0x00000020
4883 #define WINED3DFMT_FLAG_FBO_ATTACHABLE 0x00000040
4884 #define WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB 0x00000080
4885 #define WINED3DFMT_FLAG_DECOMPRESS 0x00000100
4886 #define WINED3DFMT_FLAG_FLOAT 0x00000200
4887 #define WINED3DFMT_FLAG_BUMPMAP 0x00000400
4888 #define WINED3DFMT_FLAG_SRGB_READ 0x00000800
4889 #define WINED3DFMT_FLAG_SRGB_WRITE 0x00001000
4890 #define WINED3DFMT_FLAG_VTF 0x00002000
4891 #define WINED3DFMT_FLAG_SHADOW 0x00004000
4892 #define WINED3DFMT_FLAG_COMPRESSED 0x00008000
4893 #define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
4894 #define WINED3DFMT_FLAG_BLOCKS 0x00020000
4895 #define WINED3DFMT_FLAG_HEIGHT_SCALE 0x00040000
4896 #define WINED3DFMT_FLAG_TEXTURE 0x00080000
4897 #define WINED3DFMT_FLAG_BLOCKS_NO_VERIFY 0x00100000
4898 #define WINED3DFMT_FLAG_INTEGER 0x00200000
4899 #define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000
4900 #define WINED3DFMT_FLAG_NORMALISED 0x00800000
4901 #define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
4902 #define WINED3DFMT_FLAG_BLIT 0x02000000
4903 #define WINED3DFMT_FLAG_MAPPABLE 0x04000000
4905 struct wined3d_rational
4911 struct wined3d_color_key_conversion
4913 enum wined3d_format_id dst_format
;
4914 void (*convert
)(const BYTE
*src
, unsigned int src_pitch
, BYTE
*dst
, unsigned int dst_pitch
,
4915 unsigned int width
, unsigned int height
, const struct wined3d_color_key
*colour_key
);
4918 struct wined3d_format
4920 enum wined3d_format_id id
;
4922 D3DDDIFORMAT ddi_format
;
4923 unsigned int component_count
;
4938 UINT block_byte_count
;
4940 enum wined3d_ffp_emit_idx emit_idx
;
4942 UINT conv_byte_count
;
4943 DWORD multisample_types
;
4944 unsigned int flags
[WINED3D_GL_RES_TYPE_COUNT
];
4945 float depth_bias_scale
;
4946 struct wined3d_rational height_scale
;
4947 struct color_fixup_desc color_fixup
;
4948 void (*upload
)(const BYTE
*src
, BYTE
*dst
, unsigned int src_row_pitch
, unsigned int src_slice_pitch
,
4949 unsigned int dst_row_pitch
, unsigned dst_slice_pitch
,
4950 unsigned int width
, unsigned int height
, unsigned int depth
);
4951 void (*download
)(const BYTE
*src
, BYTE
*dst
, unsigned int src_row_pitch
, unsigned int src_slice_pitch
,
4952 unsigned int dst_row_pitch
, unsigned dst_slice_pitch
,
4953 unsigned int width
, unsigned int height
, unsigned int depth
);
4954 void (*decompress
)(const BYTE
*src
, BYTE
*dst
, unsigned int src_row_pitch
, unsigned int src_slice_pitch
,
4955 unsigned int dst_row_pitch
, unsigned dst_slice_pitch
,
4956 unsigned int width
, unsigned int height
, unsigned int depth
);
4958 enum wined3d_format_id typeless_id
;
4961 const struct wined3d_format
*wined3d_get_format(const struct wined3d_adapter
*adapter
,
4962 enum wined3d_format_id format_id
, unsigned int bind_flags
) DECLSPEC_HIDDEN
;
4963 void wined3d_format_calculate_pitch(const struct wined3d_format
*format
, unsigned int alignment
,
4964 unsigned int width
, unsigned int height
, unsigned int *row_pitch
, unsigned int *slice_pitch
) DECLSPEC_HIDDEN
;
4965 UINT
wined3d_format_calculate_size(const struct wined3d_format
*format
,
4966 UINT alignment
, UINT width
, UINT height
, UINT depth
) DECLSPEC_HIDDEN
;
4967 DWORD
wined3d_format_convert_from_float(const struct wined3d_format
*format
,
4968 const struct wined3d_color
*color
) DECLSPEC_HIDDEN
;
4969 void wined3d_format_get_float_color_key(const struct wined3d_format
*format
,
4970 const struct wined3d_color_key
*key
, struct wined3d_color
*float_colors
) DECLSPEC_HIDDEN
;
4971 BOOL
wined3d_format_is_depth_view(enum wined3d_format_id resource_format_id
,
4972 enum wined3d_format_id view_format_id
) DECLSPEC_HIDDEN
;
4973 const struct wined3d_color_key_conversion
* wined3d_format_get_color_key_conversion(
4974 const struct wined3d_texture
*texture
, BOOL need_alpha_ck
) DECLSPEC_HIDDEN
;
4975 BOOL
wined3d_formats_are_srgb_variants(enum wined3d_format_id format1
,
4976 enum wined3d_format_id format2
) DECLSPEC_HIDDEN
;
4978 struct wined3d_format_gl
4980 struct wined3d_format f
;
4986 GLint srgb_internal
;
4994 static inline const struct wined3d_format_gl
*wined3d_format_gl(const struct wined3d_format
*format
)
4996 return CONTAINING_RECORD(format
, struct wined3d_format_gl
, f
);
4999 struct wined3d_format_vk
5001 struct wined3d_format f
;
5006 static inline const struct wined3d_format_vk
*wined3d_format_vk(const struct wined3d_format
*format
)
5008 return CONTAINING_RECORD(format
, struct wined3d_format_vk
, f
);
5011 BOOL
wined3d_array_reserve(void **elements
, SIZE_T
*capacity
, SIZE_T count
, SIZE_T size
) DECLSPEC_HIDDEN
;
5013 static inline BOOL
wined3d_format_is_typeless(const struct wined3d_format
*format
)
5015 return format
->id
== format
->typeless_id
&& format
->id
!= WINED3DFMT_UNKNOWN
;
5018 static inline BOOL
use_vs(const struct wined3d_state
*state
)
5020 /* Check state->vertex_declaration to allow this to be used before the
5021 * stream info is validated, for example in device_update_tex_unit_map(). */
5022 return state
->shader
[WINED3D_SHADER_TYPE_VERTEX
]
5023 && (!state
->vertex_declaration
|| !state
->vertex_declaration
->position_transformed
);
5026 static inline BOOL
use_ps(const struct wined3d_state
*state
)
5028 return !!state
->shader
[WINED3D_SHADER_TYPE_PIXEL
];
5031 static inline void context_apply_state(struct wined3d_context
*context
,
5032 const struct wined3d_state
*state
, DWORD state_id
)
5034 const struct wined3d_state_entry
*state_table
= context
->state_table
;
5035 unsigned int rep
= state_table
[state_id
].representative
;
5036 state_table
[rep
].apply(context
, state
, rep
);
5039 static inline BOOL
is_srgb_enabled(const DWORD
*sampler_states
)
5041 /* Only use the LSB of the WINED3D_SAMP_SRGB_TEXTURE value. This matches
5042 * the behaviour of the AMD Windows driver.
5044 * Might & Magic: Heroes VI - Shades of Darkness sets
5045 * WINED3D_SAMP_SRGB_TEXTURE to a large value that looks like a
5046 * pointer—presumably by accident—and expects sRGB decoding to be
5048 return sampler_states
[WINED3D_SAMP_SRGB_TEXTURE
] & 0x1;
5051 static inline BOOL
needs_separate_srgb_gl_texture(const struct wined3d_context
*context
,
5052 const struct wined3d_texture
*texture
)
5054 unsigned int flags
= texture
->resource
.format_flags
5055 & (WINED3DFMT_FLAG_SRGB_READ
| WINED3DFMT_FLAG_SRGB_WRITE
);
5057 return (!context
->d3d_info
->srgb_read_control
5058 || (flags
&& flags
!= (WINED3DFMT_FLAG_SRGB_READ
| WINED3DFMT_FLAG_SRGB_WRITE
)))
5059 && context
->d3d_info
->wined3d_creation_flags
& WINED3D_SRGB_READ_WRITE_CONTROL
;
5062 static inline BOOL
needs_srgb_write(const struct wined3d_context
*context
,
5063 const struct wined3d_state
*state
, const struct wined3d_fb_state
*fb
)
5065 return (!(context
->d3d_info
->wined3d_creation_flags
& WINED3D_SRGB_READ_WRITE_CONTROL
)
5066 || state
->render_states
[WINED3D_RS_SRGBWRITEENABLE
])
5067 && fb
->render_targets
[0] && fb
->render_targets
[0]->format_flags
& WINED3DFMT_FLAG_SRGB_WRITE
;
5070 static inline GLuint
wined3d_texture_gl_get_texture_name(const struct wined3d_texture_gl
*texture_gl
,
5071 const struct wined3d_context
*context
, BOOL srgb
)
5073 return srgb
&& needs_separate_srgb_gl_texture(context
, &texture_gl
->t
)
5074 ? texture_gl
->texture_srgb
.name
: texture_gl
->texture_rgb
.name
;
5077 static inline BOOL
can_use_texture_swizzle(const struct wined3d_d3d_info
*d3d_info
, const struct wined3d_format
*format
)
5079 return d3d_info
->texture_swizzle
&& !is_complex_fixup(format
->color_fixup
) && !is_scaling_fixup(format
->color_fixup
);
5082 static inline BOOL
is_rasterization_disabled(const struct wined3d_shader
*geometry_shader
)
5084 return geometry_shader
5085 && geometry_shader
->u
.gs
.so_desc
.rasterizer_stream_idx
== WINED3D_NO_RASTERIZER_STREAM
;
5088 static inline DWORD
wined3d_extract_bits(const DWORD
*bitstream
,
5089 unsigned int offset
, unsigned int count
)
5091 const unsigned int word_bit_count
= sizeof(*bitstream
) * CHAR_BIT
;
5092 const unsigned int idx
= offset
/ word_bit_count
;
5093 const unsigned int shift
= offset
% word_bit_count
;
5094 DWORD mask
= (1u << count
) - 1;
5097 ret
= (bitstream
[idx
] >> shift
) & mask
;
5098 if (shift
+ count
> word_bit_count
)
5100 const unsigned int extracted_bit_count
= word_bit_count
- shift
;
5101 const unsigned int remaining_bit_count
= count
- extracted_bit_count
;
5102 mask
= (1u << remaining_bit_count
) - 1;
5103 ret
|= (bitstream
[idx
+ 1] & mask
) << extracted_bit_count
;
5108 static inline void wined3d_insert_bits(DWORD
*bitstream
,
5109 unsigned int offset
, unsigned int count
, DWORD bits
)
5111 const unsigned int word_bit_count
= sizeof(*bitstream
) * CHAR_BIT
;
5112 const unsigned int idx
= offset
/ word_bit_count
;
5113 const unsigned int shift
= offset
% word_bit_count
;
5114 DWORD mask
= (1u << count
) - 1;
5116 bitstream
[idx
] |= (bits
& mask
) << shift
;
5117 if (shift
+ count
> word_bit_count
)
5119 const unsigned int inserted_bit_count
= word_bit_count
- shift
;
5120 const unsigned int remaining_bit_count
= count
- inserted_bit_count
;
5121 mask
= (1u << remaining_bit_count
) - 1;
5122 bitstream
[idx
+ 1] |= (bits
>> inserted_bit_count
) & mask
;
5126 static inline void wined3d_from_cs(const struct wined3d_cs
*cs
)
5129 assert(cs
->thread_id
== GetCurrentThreadId());
5132 static inline void wined3d_not_from_cs(struct wined3d_cs
*cs
)
5134 assert(cs
->thread_id
!= GetCurrentThreadId());
5137 static inline enum wined3d_material_color_source
validate_material_colour_source(WORD use_map
,
5138 enum wined3d_material_color_source source
)
5140 if (source
== WINED3D_MCS_COLOR1
&& use_map
& (1u << WINED3D_FFP_DIFFUSE
))
5142 if (source
== WINED3D_MCS_COLOR2
&& use_map
& (1u << WINED3D_FFP_SPECULAR
))
5144 return WINED3D_MCS_MATERIAL
;
5147 static inline void wined3d_get_material_colour_source(enum wined3d_material_color_source
*diffuse
,
5148 enum wined3d_material_color_source
*emissive
, enum wined3d_material_color_source
*ambient
,
5149 enum wined3d_material_color_source
*specular
, const struct wined3d_state
*state
,
5150 const struct wined3d_stream_info
*si
)
5152 if (!state
->render_states
[WINED3D_RS_LIGHTING
])
5154 *diffuse
= WINED3D_MCS_COLOR1
;
5155 *specular
= WINED3D_MCS_COLOR2
;
5156 *emissive
= *ambient
= WINED3D_MCS_MATERIAL
;
5161 if (!state
->render_states
[WINED3D_RS_COLORVERTEX
])
5163 *diffuse
= *emissive
= *ambient
= *specular
= WINED3D_MCS_MATERIAL
;
5168 *diffuse
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_DIFFUSEMATERIALSOURCE
]);
5169 *emissive
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_EMISSIVEMATERIALSOURCE
]);
5170 *ambient
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_AMBIENTMATERIALSOURCE
]);
5171 *specular
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_SPECULARMATERIALSOURCE
]);
5174 static inline void wined3d_vec4_transform(struct wined3d_vec4
*dst
,
5175 const struct wined3d_vec4
*v
, const struct wined3d_matrix
*m
)
5177 struct wined3d_vec4 tmp
;
5179 tmp
.x
= v
->x
* m
->_11
+ v
->y
* m
->_21
+ v
->z
* m
->_31
+ v
->w
* m
->_41
;
5180 tmp
.y
= v
->x
* m
->_12
+ v
->y
* m
->_22
+ v
->z
* m
->_32
+ v
->w
* m
->_42
;
5181 tmp
.z
= v
->x
* m
->_13
+ v
->y
* m
->_23
+ v
->z
* m
->_33
+ v
->w
* m
->_43
;
5182 tmp
.w
= v
->x
* m
->_14
+ v
->y
* m
->_24
+ v
->z
* m
->_34
+ v
->w
* m
->_44
;
5187 BOOL
invert_matrix(struct wined3d_matrix
*out
, const struct wined3d_matrix
*m
) DECLSPEC_HIDDEN
;
5189 void compute_normal_matrix(float *normal_matrix
, BOOL legacy_lighting
,
5190 const struct wined3d_matrix
*modelview
) DECLSPEC_HIDDEN
;
5192 static inline struct wined3d_context
*context_acquire(struct wined3d_device
*device
,
5193 struct wined3d_texture
*texture
, unsigned int sub_resource_idx
)
5195 wined3d_from_cs(device
->cs
);
5197 return device
->adapter
->adapter_ops
->adapter_acquire_context(device
, texture
, sub_resource_idx
);
5200 static inline void context_release(struct wined3d_context
*context
)
5202 context
->device
->adapter
->adapter_ops
->adapter_release_context(context
);
5205 static inline float wined3d_get_float_state(const struct wined3d_state
*state
, enum wined3d_render_state rs
)
5214 tmpvalue
.d
= state
->render_states
[rs
];
5218 static inline void *wined3d_context_map_bo_address(struct wined3d_context
*context
,
5219 const struct wined3d_bo_address
*data
, size_t size
, GLenum binding
, uint32_t flags
)
5221 return context
->device
->adapter
->adapter_ops
->adapter_map_bo_address(context
, data
, size
, binding
, flags
);
5224 static inline void wined3d_context_unmap_bo_address(struct wined3d_context
*context
,
5225 const struct wined3d_bo_address
*data
, GLenum binding
)
5227 return context
->device
->adapter
->adapter_ops
->adapter_unmap_bo_address(context
, data
, binding
);
5230 /* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
5231 #define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"