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
40 #define WIN32_NO_STATUS
41 #define NONAMELESSUNION
42 #define NONAMELESSSTRUCT
50 #include "ddk/d3dkmthk.h"
51 #include "wine/debug.h"
52 #include "wine/heap.h"
53 #include "wine/unicode.h"
56 #include "wine/wined3d.h"
57 #include "wined3d_gl.h"
58 #include "wined3d_vk.h"
59 #include "wine/list.h"
60 #include "wine/rbtree.h"
61 #include "wine/wgl_driver.h"
63 #define MAKEDWORD_VERSION(maj, min) (((maj & 0xffffu) << 16) | (min & 0xffffu))
66 #define WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT 0x00000001
67 #define WINED3D_QUIRK_SET_TEXCOORD_W 0x00000002
68 #define WINED3D_QUIRK_GLSL_CLIP_VARYING 0x00000004
69 #define WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA 0x00000008
70 #define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010
71 #define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020
72 #define WINED3D_QUIRK_BROKEN_RGBA16 0x00000040
73 #define WINED3D_QUIRK_INFO_LOG_SPAM 0x00000080
74 #define WINED3D_QUIRK_LIMITED_TEX_FILTERING 0x00000100
75 #define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200
76 #define WINED3D_QUIRK_NO_INDEPENDENT_BIT_DEPTHS 0x00000400
78 #define WINED3D_MAX_DIRTY_REGION_COUNT 7
80 #define WINED3D_ALPHA_TO_COVERAGE_ENABLE MAKEFOURCC('A','2','M','1')
81 #define WINED3D_ALPHA_TO_COVERAGE_DISABLE MAKEFOURCC('A','2','M','0')
83 #define WINED3D_BITMAP_SIZE(x) (((x) + 31) >> 5)
85 struct wined3d_fragment_pipe_ops
;
86 struct wined3d_adapter
;
87 struct wined3d_buffer_vk
;
88 struct wined3d_context
;
89 struct wined3d_context_vk
;
90 struct wined3d_gl_info
;
92 struct wined3d_swapchain_gl
;
93 struct wined3d_texture_gl
;
94 struct wined3d_vertex_pipe_ops
;
98 WINED3D_FFP_POSITION
= 0,
99 WINED3D_FFP_BLENDWEIGHT
= 1,
100 WINED3D_FFP_BLENDINDICES
= 2,
101 WINED3D_FFP_NORMAL
= 3,
102 WINED3D_FFP_PSIZE
= 4,
103 WINED3D_FFP_DIFFUSE
= 5,
104 WINED3D_FFP_SPECULAR
= 6,
105 WINED3D_FFP_TEXCOORD0
= 7,
106 WINED3D_FFP_TEXCOORD1
= 8,
107 WINED3D_FFP_TEXCOORD2
= 9,
108 WINED3D_FFP_TEXCOORD3
= 10,
109 WINED3D_FFP_TEXCOORD4
= 11,
110 WINED3D_FFP_TEXCOORD5
= 12,
111 WINED3D_FFP_TEXCOORD6
= 13,
112 WINED3D_FFP_TEXCOORD7
= 14,
113 WINED3D_FFP_ATTRIBS_COUNT
= 15,
116 enum wined3d_ffp_emit_idx
118 WINED3D_FFP_EMIT_FLOAT1
,
119 WINED3D_FFP_EMIT_FLOAT2
,
120 WINED3D_FFP_EMIT_FLOAT3
,
121 WINED3D_FFP_EMIT_FLOAT4
,
122 WINED3D_FFP_EMIT_D3DCOLOR
,
123 WINED3D_FFP_EMIT_UBYTE4
,
124 WINED3D_FFP_EMIT_SHORT2
,
125 WINED3D_FFP_EMIT_SHORT4
,
126 WINED3D_FFP_EMIT_UBYTE4N
,
127 WINED3D_FFP_EMIT_SHORT2N
,
128 WINED3D_FFP_EMIT_SHORT4N
,
129 WINED3D_FFP_EMIT_USHORT2N
,
130 WINED3D_FFP_EMIT_USHORT4N
,
131 WINED3D_FFP_EMIT_UDEC3
,
132 WINED3D_FFP_EMIT_DEC3N
,
133 WINED3D_FFP_EMIT_FLOAT16_2
,
134 WINED3D_FFP_EMIT_FLOAT16_4
,
135 WINED3D_FFP_EMIT_INVALID
,
136 WINED3D_FFP_EMIT_COUNT
,
139 /* Texture format fixups */
141 enum fixup_channel_source
143 CHANNEL_SOURCE_ZERO
= 0,
144 CHANNEL_SOURCE_ONE
= 1,
145 CHANNEL_SOURCE_X
= 2,
146 CHANNEL_SOURCE_Y
= 3,
147 CHANNEL_SOURCE_Z
= 4,
148 CHANNEL_SOURCE_W
= 5,
149 CHANNEL_SOURCE_COMPLEX0
= 6,
150 CHANNEL_SOURCE_COMPLEX1
= 7,
155 COMPLEX_FIXUP_NONE
= 0,
156 COMPLEX_FIXUP_YUY2
= 1,
157 COMPLEX_FIXUP_UYVY
= 2,
158 COMPLEX_FIXUP_YV12
= 3,
159 COMPLEX_FIXUP_P8
= 4,
160 COMPLEX_FIXUP_NV12
= 5,
161 COMPLEX_FIXUP_YUV
= 6,
164 #include <pshpack2.h>
165 struct color_fixup_desc
167 unsigned short x_sign_fixup
: 1;
168 unsigned short x_source
: 3;
169 unsigned short y_sign_fixup
: 1;
170 unsigned short y_source
: 3;
171 unsigned short z_sign_fixup
: 1;
172 unsigned short z_source
: 3;
173 unsigned short w_sign_fixup
: 1;
174 unsigned short w_source
: 3;
178 struct wined3d_d3d_limits
180 unsigned int vs_version
, hs_version
, ds_version
, gs_version
, ps_version
, cs_version
;
181 DWORD vs_uniform_count
;
182 DWORD ps_uniform_count
;
183 unsigned int varying_count
;
184 unsigned int ffp_textures
;
185 unsigned int ffp_blend_stages
;
186 unsigned int ffp_vertex_blend_matrices
;
187 unsigned int active_light_count
;
189 unsigned int max_rt_count
;
190 unsigned int max_clip_distances
;
191 unsigned int texture_size
;
195 typedef void (WINE_GLAPI
*wined3d_ffp_attrib_func
)(const void *data
);
196 typedef void (WINE_GLAPI
*wined3d_ffp_texcoord_func
)(GLenum unit
, const void *data
);
197 typedef void (WINE_GLAPI
*wined3d_generic_attrib_func
)(GLuint idx
, const void *data
);
198 extern wined3d_ffp_attrib_func specular_func_3ubv DECLSPEC_HIDDEN
;
200 struct wined3d_ffp_attrib_ops
202 wined3d_ffp_attrib_func position
[WINED3D_FFP_EMIT_COUNT
];
203 wined3d_ffp_attrib_func diffuse
[WINED3D_FFP_EMIT_COUNT
];
204 wined3d_ffp_attrib_func specular
[WINED3D_FFP_EMIT_COUNT
];
205 wined3d_ffp_attrib_func normal
[WINED3D_FFP_EMIT_COUNT
];
206 wined3d_ffp_texcoord_func texcoord
[WINED3D_FFP_EMIT_COUNT
];
207 wined3d_generic_attrib_func generic
[WINED3D_FFP_EMIT_COUNT
];
210 struct wined3d_d3d_info
212 struct wined3d_d3d_limits limits
;
213 struct wined3d_ffp_attrib_ops ffp_attrib_ops
;
214 uint32_t wined3d_creation_flags
;
216 uint32_t emulated_flatshading
: 1;
217 uint32_t ffp_generic_attributes
: 1;
218 uint32_t ffp_alpha_test
: 1;
219 uint32_t vs_clipping
: 1;
220 uint32_t shader_color_key
: 1;
221 uint32_t shader_double_precision
: 1;
222 uint32_t shader_output_interpolation
: 1;
223 uint32_t viewport_array_index_any_shader
: 1;
224 uint32_t texture_npot
: 1;
225 uint32_t texture_npot_conditional
: 1;
226 uint32_t draw_base_vertex_offset
: 1;
227 uint32_t vertex_bgra
: 1;
228 uint32_t texture_swizzle
: 1;
229 uint32_t srgb_read_control
: 1;
230 uint32_t srgb_write_control
: 1;
231 uint32_t clip_control
: 1;
232 uint32_t full_ffp_varyings
: 1;
233 uint32_t scaled_resolve
: 1;
234 enum wined3d_feature_level feature_level
;
236 DWORD multisample_draw_location
;
239 static const struct color_fixup_desc COLOR_FIXUP_IDENTITY
=
240 {0, CHANNEL_SOURCE_X
, 0, CHANNEL_SOURCE_Y
, 0, CHANNEL_SOURCE_Z
, 0, CHANNEL_SOURCE_W
};
242 static inline struct color_fixup_desc
create_complex_fixup_desc(enum complex_fixup complex_fixup
)
244 struct color_fixup_desc fixup
=
246 0u, complex_fixup
& (1u << 0) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
247 0u, complex_fixup
& (1u << 1) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
248 0u, complex_fixup
& (1u << 2) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
249 0u, complex_fixup
& (1u << 3) ? CHANNEL_SOURCE_COMPLEX1
: CHANNEL_SOURCE_COMPLEX0
,
254 static inline BOOL
is_identity_fixup(struct color_fixup_desc fixup
)
256 return !memcmp(&fixup
, &COLOR_FIXUP_IDENTITY
, sizeof(fixup
));
259 static inline BOOL
is_complex_fixup(struct color_fixup_desc fixup
)
261 return fixup
.x_source
== CHANNEL_SOURCE_COMPLEX0
|| fixup
.x_source
== CHANNEL_SOURCE_COMPLEX1
;
264 static inline BOOL
is_scaling_fixup(struct color_fixup_desc fixup
)
266 return fixup
.x_sign_fixup
|| fixup
.y_sign_fixup
|| fixup
.z_sign_fixup
|| fixup
.w_sign_fixup
;
269 static inline BOOL
is_same_fixup(struct color_fixup_desc f1
, struct color_fixup_desc f2
)
271 return f1
.x_sign_fixup
== f2
.x_sign_fixup
&& f1
.x_source
== f2
.x_source
272 && f1
.y_sign_fixup
== f2
.y_sign_fixup
&& f1
.y_source
== f2
.y_source
273 && f1
.z_sign_fixup
== f2
.z_sign_fixup
&& f1
.z_source
== f2
.z_source
274 && f1
.w_sign_fixup
== f2
.w_sign_fixup
&& f1
.w_source
== f2
.w_source
;
277 static inline enum complex_fixup
get_complex_fixup(struct color_fixup_desc fixup
)
279 enum complex_fixup complex_fixup
= 0;
280 if (fixup
.x_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 0);
281 if (fixup
.y_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 1);
282 if (fixup
.z_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 2);
283 if (fixup
.w_source
== CHANNEL_SOURCE_COMPLEX1
) complex_fixup
|= (1u << 3);
284 return complex_fixup
;
288 #define WINED3D_MAX_ACTIVE_LIGHTS 8
289 #define WINED3D_MAX_SOFTWARE_ACTIVE_LIGHTS 32
290 #define MAX_CONSTANT_BUFFERS 15
291 #define MAX_SAMPLER_OBJECTS 16
292 #define MAX_SHADER_RESOURCE_VIEWS 128
293 #define MAX_UNORDERED_ACCESS_VIEWS 8
294 #define MAX_TGSM_REGISTERS 8192
295 #define MAX_VERTEX_BLENDS 4
299 GLenum mip
[WINED3D_TEXF_LINEAR
+ 1];
302 extern const struct min_lookup minMipLookup
[WINED3D_TEXF_LINEAR
+ 1] DECLSPEC_HIDDEN
;
303 extern const GLenum magLookup
[WINED3D_TEXF_LINEAR
+ 1] DECLSPEC_HIDDEN
;
305 GLenum
wined3d_gl_compare_func(enum wined3d_cmp_func f
) DECLSPEC_HIDDEN
;
306 VkAccessFlags
vk_access_mask_from_bind_flags(uint32_t bind_flags
) DECLSPEC_HIDDEN
;
307 VkCompareOp
vk_compare_op_from_wined3d(enum wined3d_cmp_func op
) DECLSPEC_HIDDEN
;
308 VkImageViewType
vk_image_view_type_from_wined3d(enum wined3d_resource_type type
, uint32_t flags
) DECLSPEC_HIDDEN
;
309 VkShaderStageFlagBits
vk_shader_stage_from_wined3d(enum wined3d_shader_type shader_type
) DECLSPEC_HIDDEN
;
311 static inline enum wined3d_cmp_func
wined3d_sanitize_cmp_func(enum wined3d_cmp_func func
)
313 if (func
< WINED3D_CMP_NEVER
|| func
> WINED3D_CMP_ALWAYS
)
314 return WINED3D_CMP_ALWAYS
;
318 static inline GLenum
wined3d_gl_mag_filter(enum wined3d_texture_filter_type mag_filter
)
320 return magLookup
[mag_filter
];
323 static inline GLenum
wined3d_gl_min_mip_filter(enum wined3d_texture_filter_type min_filter
,
324 enum wined3d_texture_filter_type mip_filter
)
326 return minMipLookup
[min_filter
].mip
[mip_filter
];
329 /* float_16_to_32() and float_32_to_16() (see implementation in
330 * surface_base.c) convert 16 bit floats in the FLOAT16 data type
331 * to standard C floats and vice versa. They do not depend on the encoding
332 * of the C float, so they are platform independent, but slow. On x86 and
333 * other IEEE 754 compliant platforms the conversion can be accelerated by
334 * bit shifting the exponent and mantissa. There are also some SSE-based
335 * assembly routines out there.
337 * See GL_NV_half_float for a reference of the FLOAT16 / GL_HALF format
339 static inline float float_16_to_32(const unsigned short *in
)
341 const unsigned short s
= ((*in
) & 0x8000u
);
342 const unsigned short e
= ((*in
) & 0x7c00u
) >> 10;
343 const unsigned short m
= (*in
) & 0x3ffu
;
344 const float sgn
= (s
? -1.0f
: 1.0f
);
347 if(m
== 0) return sgn
* 0.0f
; /* +0.0 or -0.0 */
348 else return sgn
* powf(2, -14.0f
) * ((float)m
/ 1024.0f
);
350 return sgn
* powf(2, (float)e
- 15.0f
) * (1.0f
+ ((float)m
/ 1024.0f
));
352 if(m
== 0) return sgn
* INFINITY
;
357 static inline float float_24_to_32(DWORD in
)
359 const float sgn
= in
& 0x800000u
? -1.0f
: 1.0f
;
360 const unsigned short e
= (in
& 0x780000u
) >> 19;
361 const unsigned int m
= in
& 0x7ffffu
;
365 if (m
== 0) return sgn
* 0.0f
; /* +0.0 or -0.0 */
366 else return sgn
* powf(2, -6.0f
) * ((float)m
/ 524288.0f
);
370 return sgn
* powf(2, (float)e
- 7.0f
) * (1.0f
+ ((float)m
/ 524288.0f
));
374 if (m
== 0) return sgn
* INFINITY
;
379 static inline unsigned int wined3d_popcount(unsigned int x
)
381 #ifdef HAVE___BUILTIN_POPCOUNT
382 return __builtin_popcount(x
);
384 x
-= x
>> 1 & 0x55555555;
385 x
= (x
& 0x33333333) + (x
>> 2 & 0x33333333);
386 return ((x
+ (x
>> 4)) & 0x0f0f0f0f) * 0x01010101 >> 24;
390 static inline void wined3d_pause(void)
392 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
393 __asm__
__volatile__( "rep;nop" : : : "memory" );
397 #define ORM_BACKBUFFER 0
400 #define PCI_VENDOR_NONE 0xffff /* e.g. 0x8086 for Intel and 0x10de for Nvidia */
401 #define PCI_DEVICE_NONE 0xffff /* e.g. 0x14f for a Geforce6200 */
403 enum wined3d_renderer
405 WINED3D_RENDERER_AUTO
,
406 WINED3D_RENDERER_VULKAN
,
407 WINED3D_RENDERER_OPENGL
,
408 WINED3D_RENDERER_NO3D
,
411 enum wined3d_shader_backend
413 WINED3D_SHADER_BACKEND_AUTO
,
414 WINED3D_SHADER_BACKEND_GLSL
,
415 WINED3D_SHADER_BACKEND_ARB
,
416 WINED3D_SHADER_BACKEND_NONE
,
419 /* NOTE: When adding fields to this structure, make sure to update the default
420 * values in wined3d_main.c as well. */
421 struct wined3d_settings
423 unsigned int cs_multithreaded
;
424 DWORD max_gl_version
;
425 int offscreen_rendering_mode
;
426 unsigned short pci_vendor_id
;
427 unsigned short pci_device_id
;
428 /* Memory tracking and object counting. */
429 UINT64 emulated_textureram
;
431 unsigned int multisample_textures
;
432 unsigned int sample_count
;
433 BOOL check_float_constants
;
434 unsigned int strict_shader_math
;
435 unsigned int max_sm_vs
;
436 unsigned int max_sm_hs
;
437 unsigned int max_sm_ds
;
438 unsigned int max_sm_gs
;
439 unsigned int max_sm_ps
;
440 unsigned int max_sm_cs
;
441 enum wined3d_renderer renderer
;
442 enum wined3d_shader_backend shader_backend
;
445 extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN
;
447 enum wined3d_shader_byte_code_format
449 WINED3D_SHADER_BYTE_CODE_FORMAT_SM1
,
450 WINED3D_SHADER_BYTE_CODE_FORMAT_SM4
,
453 enum wined3d_shader_resource_type
455 WINED3D_SHADER_RESOURCE_NONE
,
456 WINED3D_SHADER_RESOURCE_BUFFER
,
457 WINED3D_SHADER_RESOURCE_TEXTURE_1D
,
458 WINED3D_SHADER_RESOURCE_TEXTURE_2D
,
459 WINED3D_SHADER_RESOURCE_TEXTURE_2DMS
,
460 WINED3D_SHADER_RESOURCE_TEXTURE_3D
,
461 WINED3D_SHADER_RESOURCE_TEXTURE_CUBE
,
462 WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY
,
463 WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY
,
464 WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY
,
465 WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY
,
468 #define WINED3D_SHADER_CONST_VS_F 0x00000001
469 #define WINED3D_SHADER_CONST_VS_I 0x00000002
470 #define WINED3D_SHADER_CONST_VS_B 0x00000004
471 #define WINED3D_SHADER_CONST_VS_CLIP_PLANES 0x00000008
472 #define WINED3D_SHADER_CONST_VS_POINTSIZE 0x00000010
473 #define WINED3D_SHADER_CONST_POS_FIXUP 0x00000020
474 #define WINED3D_SHADER_CONST_PS_F 0x00000040
475 #define WINED3D_SHADER_CONST_PS_I 0x00000080
476 #define WINED3D_SHADER_CONST_PS_B 0x00000100
477 #define WINED3D_SHADER_CONST_PS_BUMP_ENV 0x00000200
478 #define WINED3D_SHADER_CONST_PS_FOG 0x00000400
479 #define WINED3D_SHADER_CONST_PS_ALPHA_TEST 0x00000800
480 #define WINED3D_SHADER_CONST_PS_Y_CORR 0x00001000
481 #define WINED3D_SHADER_CONST_PS_NP2_FIXUP 0x00002000
482 #define WINED3D_SHADER_CONST_FFP_MODELVIEW 0x00004000
483 #define WINED3D_SHADER_CONST_FFP_VERTEXBLEND 0x00008000
484 #define WINED3D_SHADER_CONST_FFP_PROJ 0x00010000
485 #define WINED3D_SHADER_CONST_FFP_TEXMATRIX 0x00020000
486 #define WINED3D_SHADER_CONST_FFP_MATERIAL 0x00040000
487 #define WINED3D_SHADER_CONST_FFP_LIGHTS 0x00080000
488 #define WINED3D_SHADER_CONST_FFP_PS 0x00100000
489 #define WINED3D_SHADER_CONST_FFP_COLOR_KEY 0x00200000
490 #define WINED3D_SHADER_CONST_BASE_VERTEX_ID 0x00400000
492 enum wined3d_shader_register_type
495 WINED3DSPR_INPUT
= 1,
496 WINED3DSPR_CONST
= 2,
498 WINED3DSPR_TEXTURE
= 3,
499 WINED3DSPR_RASTOUT
= 4,
500 WINED3DSPR_ATTROUT
= 5,
501 WINED3DSPR_TEXCRDOUT
= 6,
502 WINED3DSPR_OUTPUT
= 6,
503 WINED3DSPR_CONSTINT
= 7,
504 WINED3DSPR_COLOROUT
= 8,
505 WINED3DSPR_DEPTHOUT
= 9,
506 WINED3DSPR_SAMPLER
= 10,
507 WINED3DSPR_CONST2
= 11,
508 WINED3DSPR_CONST3
= 12,
509 WINED3DSPR_CONST4
= 13,
510 WINED3DSPR_CONSTBOOL
= 14,
511 WINED3DSPR_LOOP
= 15,
512 WINED3DSPR_TEMPFLOAT16
= 16,
513 WINED3DSPR_MISCTYPE
= 17,
514 WINED3DSPR_LABEL
= 18,
515 WINED3DSPR_PREDICATE
= 19,
517 WINED3DSPR_CONSTBUFFER
,
518 WINED3DSPR_IMMCONSTBUFFER
,
523 WINED3DSPR_OUTPOINTID
,
524 WINED3DSPR_FORKINSTID
,
525 WINED3DSPR_JOININSTID
,
526 WINED3DSPR_INCONTROLPOINT
,
527 WINED3DSPR_OUTCONTROLPOINT
,
528 WINED3DSPR_PATCHCONST
,
529 WINED3DSPR_TESSCOORD
,
530 WINED3DSPR_GROUPSHAREDMEM
,
532 WINED3DSPR_THREADGROUPID
,
533 WINED3DSPR_LOCALTHREADID
,
534 WINED3DSPR_LOCALTHREADINDEX
,
537 WINED3DSPR_FUNCTIONBODY
,
538 WINED3DSPR_FUNCTIONPOINTER
,
540 WINED3DSPR_SAMPLEMASK
,
542 WINED3DSPR_DEPTHOUTGE
,
543 WINED3DSPR_DEPTHOUTLE
,
544 WINED3DSPR_RASTERIZER
,
547 enum wined3d_data_type
551 WINED3D_DATA_RESOURCE
,
552 WINED3D_DATA_SAMPLER
,
560 enum wined3d_immconst_type
562 WINED3D_IMMCONST_SCALAR
,
563 WINED3D_IMMCONST_VEC4
,
566 #define WINED3DSP_NOSWIZZLE (0u | (1u << 2) | (2u << 4) | (3u << 6))
568 enum wined3d_shader_src_modifier
570 WINED3DSPSM_NONE
= 0,
572 WINED3DSPSM_BIAS
= 2,
573 WINED3DSPSM_BIASNEG
= 3,
574 WINED3DSPSM_SIGN
= 4,
575 WINED3DSPSM_SIGNNEG
= 5,
576 WINED3DSPSM_COMP
= 6,
578 WINED3DSPSM_X2NEG
= 8,
581 WINED3DSPSM_ABS
= 11,
582 WINED3DSPSM_ABSNEG
= 12,
583 WINED3DSPSM_NOT
= 13,
586 #define WINED3DSP_WRITEMASK_0 0x1u /* .x r */
587 #define WINED3DSP_WRITEMASK_1 0x2u /* .y g */
588 #define WINED3DSP_WRITEMASK_2 0x4u /* .z b */
589 #define WINED3DSP_WRITEMASK_3 0x8u /* .w a */
590 #define WINED3DSP_WRITEMASK_ALL 0xfu /* all */
592 enum wined3d_shader_dst_modifier
594 WINED3DSPDM_NONE
= 0,
595 WINED3DSPDM_SATURATE
= 1,
596 WINED3DSPDM_PARTIALPRECISION
= 2,
597 WINED3DSPDM_MSAMPCENTROID
= 4,
600 enum wined3d_shader_interpolation_mode
603 WINED3DSIM_CONSTANT
= 1,
604 WINED3DSIM_LINEAR
= 2,
605 WINED3DSIM_LINEAR_CENTROID
= 3,
606 WINED3DSIM_LINEAR_NOPERSPECTIVE
= 4,
607 WINED3DSIM_LINEAR_NOPERSPECTIVE_CENTROID
= 5,
608 WINED3DSIM_LINEAR_SAMPLE
= 6,
609 WINED3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE
= 7,
612 #define WINED3D_PACKED_INTERPOLATION_SIZE 3
613 #define WINED3D_PACKED_INTERPOLATION_BIT_COUNT 3
615 enum wined3d_shader_global_flags
617 WINED3DSGF_REFACTORING_ALLOWED
= 0x1,
618 WINED3DSGF_FORCE_EARLY_DEPTH_STENCIL
= 0x4,
619 WINED3DSGF_ENABLE_RAW_AND_STRUCTURED_BUFFERS
= 0x8,
622 enum wined3d_shader_sync_flags
624 WINED3DSSF_THREAD_GROUP
= 0x1,
625 WINED3DSSF_GROUP_SHARED_MEMORY
= 0x2,
628 enum wined3d_shader_uav_flags
630 WINED3DSUF_GLOBALLY_COHERENT
= 0x2,
631 WINED3DSUF_ORDER_PRESERVING_COUNTER
= 0x100,
634 enum wined3d_tessellator_domain
636 WINED3D_TESSELLATOR_DOMAIN_LINE
= 1,
637 WINED3D_TESSELLATOR_DOMAIN_TRIANGLE
= 2,
638 WINED3D_TESSELLATOR_DOMAIN_QUAD
= 3,
641 enum wined3d_tessellator_output_primitive
643 WINED3D_TESSELLATOR_OUTPUT_POINT
= 1,
644 WINED3D_TESSELLATOR_OUTPUT_LINE
= 2,
645 WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CW
= 3,
646 WINED3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW
= 4,
649 enum wined3d_tessellator_partitioning
651 WINED3D_TESSELLATOR_PARTITIONING_INTEGER
= 1,
652 WINED3D_TESSELLATOR_PARTITIONING_POW2
= 2,
653 WINED3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD
= 3,
654 WINED3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
= 4,
657 /* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */
658 #define WINED3DSI_TEXLD_PROJECT 0x1
659 #define WINED3DSI_TEXLD_BIAS 0x2
660 #define WINED3DSI_INDEXED_DYNAMIC 0x4
661 #define WINED3DSI_RESINFO_RCP_FLOAT 0x1
662 #define WINED3DSI_RESINFO_UINT 0x2
663 #define WINED3DSI_SAMPLE_INFO_UINT 0x1
664 #define WINED3DSI_SAMPLER_COMPARISON_MODE 0x1
666 #define WINED3DSI_PRECISE_X 0x100
667 #define WINED3DSI_PRECISE_Y 0x200
668 #define WINED3DSI_PRECISE_Z 0x400
669 #define WINED3DSI_PRECISE_W 0x800
670 #define WINED3DSI_PRECISE_XYZW (WINED3DSI_PRECISE_X | WINED3DSI_PRECISE_Y \
671 | WINED3DSI_PRECISE_Z | WINED3DSI_PRECISE_W)
672 #define WINED3DSI_PRECISE_SHIFT 8
674 enum wined3d_shader_rel_op
676 WINED3D_SHADER_REL_OP_GT
= 1,
677 WINED3D_SHADER_REL_OP_EQ
= 2,
678 WINED3D_SHADER_REL_OP_GE
= 3,
679 WINED3D_SHADER_REL_OP_LT
= 4,
680 WINED3D_SHADER_REL_OP_NE
= 5,
681 WINED3D_SHADER_REL_OP_LE
= 6,
684 enum wined3d_shader_conditional_op
686 WINED3D_SHADER_CONDITIONAL_OP_NZ
= 0,
687 WINED3D_SHADER_CONDITIONAL_OP_Z
= 1
690 #define WINED3D_SM1_VS 0xfffeu
691 #define WINED3D_SM1_PS 0xffffu
692 #define WINED3D_SM4_PS 0x0000u
693 #define WINED3D_SM4_VS 0x0001u
694 #define WINED3D_SM4_GS 0x0002u
695 #define WINED3D_SM5_HS 0x0003u
696 #define WINED3D_SM5_DS 0x0004u
697 #define WINED3D_SM5_CS 0x0005u
699 /* Shader version tokens, and shader end tokens */
700 #define WINED3DPS_VERSION(major, minor) ((WINED3D_SM1_PS << 16) | ((major) << 8) | (minor))
701 #define WINED3DVS_VERSION(major, minor) ((WINED3D_SM1_VS << 16) | ((major) << 8) | (minor))
703 /* Shader backends */
705 /* TODO: Make this dynamic, based on shader limits ? */
706 #define MAX_ATTRIBS 16
707 #define MAX_REG_ADDR 1
708 #define MAX_REG_TEXCRD 8
709 #define MAX_REG_INPUT 32
710 #define MAX_REG_OUTPUT 32
711 #define WINED3D_MAX_CBS 15
713 /* FIXME: This needs to go up to 2048 for
714 * Shader model 3 according to msdn (and for software shaders) */
715 #define MAX_LABELS 16
717 #define MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE 4096
719 struct wined3d_string_buffer
723 unsigned int buffer_size
;
724 unsigned int content_size
;
727 enum WINED3D_SHADER_INSTRUCTION_HANDLER
732 WINED3DSIH_ATOMIC_AND
,
733 WINED3DSIH_ATOMIC_CMP_STORE
,
734 WINED3DSIH_ATOMIC_IADD
,
735 WINED3DSIH_ATOMIC_IMAX
,
736 WINED3DSIH_ATOMIC_IMIN
,
737 WINED3DSIH_ATOMIC_OR
,
738 WINED3DSIH_ATOMIC_UMAX
,
739 WINED3DSIH_ATOMIC_UMIN
,
740 WINED3DSIH_ATOMIC_XOR
,
754 WINED3DSIH_CONTINUEP
,
755 WINED3DSIH_COUNTBITS
,
758 WINED3DSIH_CUT_STREAM
,
760 WINED3DSIH_DCL_CONSTANT_BUFFER
,
761 WINED3DSIH_DCL_FUNCTION_BODY
,
762 WINED3DSIH_DCL_FUNCTION_TABLE
,
763 WINED3DSIH_DCL_GLOBAL_FLAGS
,
764 WINED3DSIH_DCL_GS_INSTANCES
,
765 WINED3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT
,
766 WINED3DSIH_DCL_HS_JOIN_PHASE_INSTANCE_COUNT
,
767 WINED3DSIH_DCL_HS_MAX_TESSFACTOR
,
768 WINED3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER
,
769 WINED3DSIH_DCL_INDEX_RANGE
,
770 WINED3DSIH_DCL_INDEXABLE_TEMP
,
771 WINED3DSIH_DCL_INPUT
,
772 WINED3DSIH_DCL_INPUT_CONTROL_POINT_COUNT
,
773 WINED3DSIH_DCL_INPUT_PRIMITIVE
,
774 WINED3DSIH_DCL_INPUT_PS
,
775 WINED3DSIH_DCL_INPUT_PS_SGV
,
776 WINED3DSIH_DCL_INPUT_PS_SIV
,
777 WINED3DSIH_DCL_INPUT_SGV
,
778 WINED3DSIH_DCL_INPUT_SIV
,
779 WINED3DSIH_DCL_INTERFACE
,
780 WINED3DSIH_DCL_OUTPUT
,
781 WINED3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT
,
782 WINED3DSIH_DCL_OUTPUT_SIV
,
783 WINED3DSIH_DCL_OUTPUT_TOPOLOGY
,
784 WINED3DSIH_DCL_RESOURCE_RAW
,
785 WINED3DSIH_DCL_RESOURCE_STRUCTURED
,
786 WINED3DSIH_DCL_SAMPLER
,
787 WINED3DSIH_DCL_STREAM
,
788 WINED3DSIH_DCL_TEMPS
,
789 WINED3DSIH_DCL_TESSELLATOR_DOMAIN
,
790 WINED3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE
,
791 WINED3DSIH_DCL_TESSELLATOR_PARTITIONING
,
792 WINED3DSIH_DCL_TGSM_RAW
,
793 WINED3DSIH_DCL_TGSM_STRUCTURED
,
794 WINED3DSIH_DCL_THREAD_GROUP
,
795 WINED3DSIH_DCL_UAV_RAW
,
796 WINED3DSIH_DCL_UAV_STRUCTURED
,
797 WINED3DSIH_DCL_UAV_TYPED
,
798 WINED3DSIH_DCL_VERTICES_OUT
,
810 WINED3DSIH_DSX_COARSE
,
813 WINED3DSIH_DSY_COARSE
,
817 WINED3DSIH_EMIT_STREAM
,
821 WINED3DSIH_ENDSWITCH
,
823 WINED3DSIH_EVAL_SAMPLE_INDEX
,
829 WINED3DSIH_FIRSTBIT_HI
,
830 WINED3DSIH_FIRSTBIT_LO
,
831 WINED3DSIH_FIRSTBIT_SHI
,
836 WINED3DSIH_GATHER4_C
,
837 WINED3DSIH_GATHER4_PO
,
838 WINED3DSIH_GATHER4_PO_C
,
840 WINED3DSIH_HS_CONTROL_POINT_PHASE
,
842 WINED3DSIH_HS_FORK_PHASE
,
843 WINED3DSIH_HS_JOIN_PHASE
,
854 WINED3DSIH_IMM_ATOMIC_ALLOC
,
855 WINED3DSIH_IMM_ATOMIC_AND
,
856 WINED3DSIH_IMM_ATOMIC_CMP_EXCH
,
857 WINED3DSIH_IMM_ATOMIC_CONSUME
,
858 WINED3DSIH_IMM_ATOMIC_EXCH
,
859 WINED3DSIH_IMM_ATOMIC_IADD
,
860 WINED3DSIH_IMM_ATOMIC_IMAX
,
861 WINED3DSIH_IMM_ATOMIC_IMIN
,
862 WINED3DSIH_IMM_ATOMIC_OR
,
863 WINED3DSIH_IMM_ATOMIC_UMAX
,
864 WINED3DSIH_IMM_ATOMIC_UMIN
,
865 WINED3DSIH_IMM_ATOMIC_XOR
,
876 WINED3DSIH_LD_STRUCTURED
,
877 WINED3DSIH_LD_UAV_TYPED
,
917 WINED3DSIH_SAMPLE_C_LZ
,
918 WINED3DSIH_SAMPLE_GRAD
,
919 WINED3DSIH_SAMPLE_INFO
,
920 WINED3DSIH_SAMPLE_LOD
,
921 WINED3DSIH_SAMPLE_POS
,
928 WINED3DSIH_STORE_RAW
,
929 WINED3DSIH_STORE_STRUCTURED
,
930 WINED3DSIH_STORE_UAV_TYPED
,
941 WINED3DSIH_TEXDP3TEX
,
945 WINED3DSIH_TEXM3x2DEPTH
,
946 WINED3DSIH_TEXM3x2PAD
,
947 WINED3DSIH_TEXM3x2TEX
,
949 WINED3DSIH_TEXM3x3DIFF
,
950 WINED3DSIH_TEXM3x3PAD
,
951 WINED3DSIH_TEXM3x3SPEC
,
952 WINED3DSIH_TEXM3x3TEX
,
953 WINED3DSIH_TEXM3x3VSPEC
,
954 WINED3DSIH_TEXREG2AR
,
955 WINED3DSIH_TEXREG2GB
,
956 WINED3DSIH_TEXREG2RGB
,
967 WINED3DSIH_TABLE_SIZE
970 struct wined3d_shader_version
972 enum wined3d_shader_type type
;
977 struct wined3d_shader_resource_info
979 enum wined3d_shader_resource_type type
;
980 enum wined3d_data_type data_type
;
985 #define WINED3D_SAMPLER_DEFAULT ~0x0u
987 struct wined3d_shader_sampler_map_entry
989 unsigned int resource_idx
;
990 unsigned int sampler_idx
;
991 unsigned int bind_idx
;
994 struct wined3d_shader_sampler_map
996 struct wined3d_shader_sampler_map_entry
*entries
;
1001 struct wined3d_shader_immediate_constant_buffer
1003 unsigned int vec4_count
;
1004 DWORD data
[MAX_IMMEDIATE_CONSTANT_BUFFER_SIZE
];
1007 struct wined3d_shader_indexable_temp
1010 unsigned int register_idx
;
1011 unsigned int register_size
;
1012 unsigned int component_count
;
1015 #define WINED3D_SHADER_VERSION(major, minor) (((major) << 8) | (minor))
1017 struct wined3d_shader_reg_maps
1019 struct wined3d_shader_version shader_version
;
1020 BYTE texcoord
; /* MAX_REG_TEXCRD, 8 */
1021 BYTE address
; /* MAX_REG_ADDR, 1 */
1022 WORD labels
; /* MAX_LABELS, 16 */
1023 DWORD temporary
; /* 32 */
1024 unsigned int temporary_count
;
1025 DWORD
*constf
; /* pixel, vertex */
1026 struct list indexable_temps
;
1027 const struct wined3d_shader_immediate_constant_buffer
*icb
;
1030 DWORD texcoord_mask
[MAX_REG_TEXCRD
]; /* vertex < 3.0 */
1031 BYTE output_registers_mask
[MAX_REG_OUTPUT
]; /* vertex >= 3.0 */
1033 DWORD input_registers
; /* max(MAX_REG_INPUT, MAX_ATTRIBS), 32 */
1034 DWORD output_registers
; /* MAX_REG_OUTPUT, 32 */
1035 WORD integer_constants
; /* WINED3D_MAX_CONSTS_I, 16 */
1036 WORD boolean_constants
; /* WINED3D_MAX_CONSTS_B, 16 */
1037 WORD local_int_consts
; /* WINED3D_MAX_CONSTS_I, 16 */
1038 WORD local_bool_consts
; /* WINED3D_MAX_CONSTS_B, 16 */
1039 UINT cb_sizes
[WINED3D_MAX_CBS
];
1040 uint32_t cb_map
; /* WINED3D_MAX_CBS, 15 */
1042 struct wined3d_shader_resource_info resource_info
[MAX_SHADER_RESOURCE_VIEWS
];
1043 uint32_t resource_map
[WINED3D_BITMAP_SIZE(MAX_SHADER_RESOURCE_VIEWS
)];
1044 struct wined3d_shader_sampler_map sampler_map
;
1045 DWORD sampler_comparison_mode
;
1046 BYTE bumpmat
; /* WINED3D_MAX_TEXTURES, 8 */
1047 BYTE luminanceparams
; /* WINED3D_MAX_TEXTURES, 8 */
1048 struct wined3d_shader_resource_info uav_resource_info
[MAX_UNORDERED_ACCESS_VIEWS
];
1049 DWORD uav_read_mask
: 8; /* MAX_UNORDERED_ACCESS_VIEWS, 8 */
1050 DWORD uav_counter_mask
: 8; /* MAX_UNORDERED_ACCESS_VIEWS, 8 */
1052 DWORD clip_distance_mask
: 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
1053 DWORD cull_distance_mask
: 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
1058 DWORD usestexldd
: 1;
1060 DWORD usesfacing
: 1;
1061 DWORD usesrelconstF
: 1;
1063 DWORD usestexldl
: 1;
1067 DWORD point_size
: 1;
1069 DWORD input_rel_addressing
: 1;
1070 DWORD viewport_array
: 1;
1071 DWORD sample_mask
: 1;
1074 DWORD rt_mask
; /* Used render targets, 32 max. */
1076 /* Whether or not loops are used in this shader, and nesting depth */
1077 unsigned int loop_depth
;
1078 unsigned int min_rel_offset
, max_rel_offset
;
1080 struct wined3d_shader_tgsm
*tgsm
;
1081 SIZE_T tgsm_capacity
;
1082 unsigned int tgsm_count
;
1085 /* Keeps track of details for TEX_M#x# instructions which need to maintain
1086 * state information between multiple instructions. */
1087 struct wined3d_shader_tex_mx
1089 unsigned int current_row
;
1090 DWORD texcoord_w
[2];
1093 struct wined3d_shader_parser_state
1095 unsigned int current_loop_depth
;
1096 unsigned int current_loop_reg
;
1100 struct wined3d_shader_context
1102 const struct wined3d_shader
*shader
;
1103 const struct wined3d_shader_reg_maps
*reg_maps
;
1104 struct wined3d_string_buffer
*buffer
;
1105 struct wined3d_shader_tex_mx
*tex_mx
;
1106 struct wined3d_shader_parser_state
*state
;
1110 struct wined3d_shader_register_index
1112 const struct wined3d_shader_src_param
*rel_addr
;
1113 unsigned int offset
;
1116 struct wined3d_shader_register
1118 enum wined3d_shader_register_type type
;
1119 enum wined3d_data_type data_type
;
1120 struct wined3d_shader_register_index idx
[2];
1121 enum wined3d_immconst_type immconst_type
;
1124 DWORD immconst_data
[4];
1125 unsigned fp_body_idx
;
1129 struct wined3d_shader_dst_param
1131 struct wined3d_shader_register reg
;
1137 struct wined3d_shader_src_param
1139 struct wined3d_shader_register reg
;
1141 enum wined3d_shader_src_modifier modifiers
;
1144 struct wined3d_shader_index_range
1146 struct wined3d_shader_dst_param first_register
;
1147 unsigned int last_register
;
1150 struct wined3d_shader_semantic
1152 enum wined3d_decl_usage usage
;
1154 enum wined3d_shader_resource_type resource_type
;
1155 enum wined3d_data_type resource_data_type
;
1156 struct wined3d_shader_dst_param reg
;
1159 enum wined3d_shader_input_sysval_semantic
1161 WINED3D_SIV_POSITION
= 1,
1162 WINED3D_SIV_CLIP_DISTANCE
= 2,
1163 WINED3D_SIV_CULL_DISTANCE
= 3,
1164 WINED3D_SIV_RENDER_TARGET_ARRAY_INDEX
= 4,
1165 WINED3D_SIV_VIEWPORT_ARRAY_INDEX
= 5,
1166 WINED3D_SIV_VERTEX_ID
= 6,
1167 WINED3D_SIV_PRIMITIVE_ID
= 7,
1168 WINED3D_SIV_INSTANCE_ID
= 8,
1169 WINED3D_SIV_IS_FRONT_FACE
= 9,
1170 WINED3D_SIV_SAMPLE_INDEX
= 10,
1171 WINED3D_SIV_QUAD_U0_TESS_FACTOR
= 11,
1172 WINED3D_SIV_QUAD_V0_TESS_FACTOR
= 12,
1173 WINED3D_SIV_QUAD_U1_TESS_FACTOR
= 13,
1174 WINED3D_SIV_QUAD_V1_TESS_FACTOR
= 14,
1175 WINED3D_SIV_QUAD_U_INNER_TESS_FACTOR
= 15,
1176 WINED3D_SIV_QUAD_V_INNER_TESS_FACTOR
= 16,
1177 WINED3D_SIV_TRIANGLE_U_TESS_FACTOR
= 17,
1178 WINED3D_SIV_TRIANGLE_V_TESS_FACTOR
= 18,
1179 WINED3D_SIV_TRIANGLE_W_TESS_FACTOR
= 19,
1180 WINED3D_SIV_TRIANGLE_INNER_TESS_FACTOR
= 20,
1181 WINED3D_SIV_LINE_DETAIL_TESS_FACTOR
= 21,
1182 WINED3D_SIV_LINE_DENSITY_TESS_FACTOR
= 22,
1185 struct wined3d_shader_register_semantic
1187 struct wined3d_shader_dst_param reg
;
1188 enum wined3d_shader_input_sysval_semantic sysval_semantic
;
1191 struct wined3d_shader_structured_resource
1193 struct wined3d_shader_dst_param reg
;
1194 unsigned int byte_stride
;
1197 struct wined3d_shader_tgsm
1200 unsigned int stride
;
1203 struct wined3d_shader_tgsm_raw
1205 struct wined3d_shader_dst_param reg
;
1206 unsigned int byte_count
;
1209 struct wined3d_shader_tgsm_structured
1211 struct wined3d_shader_dst_param reg
;
1212 unsigned int byte_stride
;
1213 unsigned int structure_count
;
1216 struct wined3d_shader_thread_group_size
1218 unsigned int x
, y
, z
;
1221 struct wined3d_shader_function_table_pointer
1224 unsigned int array_size
;
1225 unsigned int body_count
;
1226 unsigned int table_count
;
1229 struct wined3d_shader_texel_offset
1231 signed char u
, v
, w
;
1234 struct wined3d_shader_primitive_type
1236 enum wined3d_primitive_type type
;
1237 unsigned int patch_vertex_count
;
1240 struct wined3d_shader_instruction
1242 const struct wined3d_shader_context
*ctx
;
1243 enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx
;
1245 unsigned int dst_count
;
1246 unsigned int src_count
;
1247 const struct wined3d_shader_dst_param
*dst
;
1248 const struct wined3d_shader_src_param
*src
;
1249 struct wined3d_shader_texel_offset texel_offset
;
1251 const struct wined3d_shader_src_param
*predicate
;
1254 struct wined3d_shader_semantic semantic
;
1255 struct wined3d_shader_register_semantic register_semantic
;
1256 struct wined3d_shader_primitive_type primitive_type
;
1257 struct wined3d_shader_dst_param dst
;
1258 struct wined3d_shader_src_param src
;
1261 const struct wined3d_shader_immediate_constant_buffer
*icb
;
1262 struct wined3d_shader_structured_resource structured_resource
;
1263 struct wined3d_shader_tgsm_raw tgsm_raw
;
1264 struct wined3d_shader_tgsm_structured tgsm_structured
;
1265 struct wined3d_shader_thread_group_size thread_group_size
;
1266 enum wined3d_tessellator_domain tessellator_domain
;
1267 enum wined3d_tessellator_output_primitive tessellator_output_primitive
;
1268 enum wined3d_tessellator_partitioning tessellator_partitioning
;
1269 float max_tessellation_factor
;
1270 struct wined3d_shader_index_range index_range
;
1271 struct wined3d_shader_indexable_temp indexable_temp
;
1272 struct wined3d_shader_function_table_pointer fp
;
1276 static inline BOOL
wined3d_shader_instruction_has_texel_offset(const struct wined3d_shader_instruction
*ins
)
1278 return ins
->texel_offset
.u
|| ins
->texel_offset
.v
|| ins
->texel_offset
.w
;
1281 struct wined3d_shader_attribute
1283 enum wined3d_decl_usage usage
;
1287 struct wined3d_shader_loop_control
1294 struct wined3d_shader_frontend
1296 void *(*shader_init
)(const DWORD
*byte_code
, size_t byte_code_size
,
1297 const struct wined3d_shader_signature
*output_signature
);
1298 void (*shader_free
)(void *data
);
1299 void (*shader_read_header
)(void *data
, const DWORD
**ptr
, struct wined3d_shader_version
*shader_version
);
1300 void (*shader_read_instruction
)(void *data
, const DWORD
**ptr
, struct wined3d_shader_instruction
*ins
);
1301 BOOL (*shader_is_end
)(void *data
, const DWORD
**ptr
);
1304 extern const struct wined3d_shader_frontend sm1_shader_frontend DECLSPEC_HIDDEN
;
1305 extern const struct wined3d_shader_frontend sm4_shader_frontend DECLSPEC_HIDDEN
;
1307 HRESULT
shader_extract_from_dxbc(struct wined3d_shader
*shader
,
1308 unsigned int max_shader_version
, enum wined3d_shader_byte_code_format
*format
) DECLSPEC_HIDDEN
;
1309 BOOL
shader_get_stream_output_register_info(const struct wined3d_shader
*shader
,
1310 const struct wined3d_stream_output_element
*so_element
, unsigned int *register_idx
,
1311 unsigned int *component_idx
) DECLSPEC_HIDDEN
;
1313 typedef void (*SHADER_HANDLER
)(const struct wined3d_shader_instruction
*);
1315 #define WINED3D_SHADER_CAP_VS_CLIPPING 0x00000001u
1316 #define WINED3D_SHADER_CAP_SRGB_WRITE 0x00000002u
1317 #define WINED3D_SHADER_CAP_DOUBLE_PRECISION 0x00000004u
1318 #define WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION 0x00000008u
1319 #define WINED3D_SHADER_CAP_FULL_FFP_VARYINGS 0x00000010u
1323 unsigned int vs_version
;
1324 unsigned int hs_version
;
1325 unsigned int ds_version
;
1326 unsigned int gs_version
;
1327 unsigned int ps_version
;
1328 unsigned int cs_version
;
1330 unsigned int vs_uniform_count
;
1331 unsigned int ps_uniform_count
;
1332 float ps_1x_max_value
;
1333 unsigned int varying_count
;
1338 enum wined3d_gl_resource_type
1340 WINED3D_GL_RES_TYPE_TEX_1D
= 0,
1341 WINED3D_GL_RES_TYPE_TEX_2D
= 1,
1342 WINED3D_GL_RES_TYPE_TEX_3D
= 2,
1343 WINED3D_GL_RES_TYPE_TEX_CUBE
= 3,
1344 WINED3D_GL_RES_TYPE_TEX_RECT
= 4,
1345 WINED3D_GL_RES_TYPE_BUFFER
= 5,
1346 WINED3D_GL_RES_TYPE_RB
= 6,
1347 WINED3D_GL_RES_TYPE_COUNT
= 7,
1350 enum wined3d_vertex_processing_mode
1353 WINED3D_VP_MODE_SHADER
,
1354 WINED3D_VP_MODE_NONE
,
1357 #define WINED3D_CONST_NUM_UNUSED ~0U
1359 enum wined3d_ffp_ps_fog_mode
1361 WINED3D_FFP_PS_FOG_OFF
,
1362 WINED3D_FFP_PS_FOG_LINEAR
,
1363 WINED3D_FFP_PS_FOG_EXP
,
1364 WINED3D_FFP_PS_FOG_EXP2
,
1367 /* Stateblock dependent parameters which have to be hardcoded
1368 * into the shader code
1371 #define WINED3D_PSARGS_PROJECTED (1u << 3)
1372 #define WINED3D_PSARGS_TEXTRANSFORM_SHIFT 4
1373 #define WINED3D_PSARGS_TEXTRANSFORM_MASK 0xfu
1374 #define WINED3D_PSARGS_TEXTYPE_SHIFT 2
1375 #define WINED3D_PSARGS_TEXTYPE_MASK 0x3u
1377 /* Used for Shader Model 1 pixel shaders to track the bound texture
1378 * type. 2D and RECT textures are separated through NP2 fixup. */
1379 enum wined3d_shader_tex_types
1381 WINED3D_SHADER_TEX_2D
= 0,
1382 WINED3D_SHADER_TEX_3D
= 1,
1383 WINED3D_SHADER_TEX_CUBE
= 2,
1384 WINED3D_SHADER_TEX_ERR
= 3,
1387 struct ps_compile_args
1389 struct color_fixup_desc color_fixup
[WINED3D_MAX_FRAGMENT_SAMPLERS
];
1390 enum wined3d_vertex_processing_mode vp_mode
;
1391 enum wined3d_ffp_ps_fog_mode fog
;
1392 DWORD tex_types
; /* ps 1 - 3, 16 textures */
1393 WORD tex_transform
; /* ps 1.0-1.3, 4 textures */
1394 WORD srgb_correction
;
1395 /* Bitmap for NP2 texcoord fixups (16 samplers max currently).
1396 D3D9 has a limit of 16 samplers and the fixup is superfluous
1397 in D3D10 (unconditional NP2 support mandatory). */
1399 WORD shadow
; /* WINED3D_MAX_FRAGMENT_SAMPLERS, 16 */
1400 WORD texcoords_initialized
; /* WINED3D_MAX_TEXTURES, 8 */
1401 WORD padding_to_dword
;
1402 DWORD pointsprite
: 1;
1403 DWORD flatshading
: 1;
1404 DWORD alpha_test_func
: 3;
1405 DWORD render_offscreen
: 1;
1406 DWORD rt_alpha_swizzle
: 8; /* WINED3D_MAX_RENDER_TARGETS, 8 */
1407 DWORD dual_source_blend
: 1;
1417 struct vs_compile_args
1420 BYTE clip_enabled
: 1;
1421 BYTE point_size
: 1;
1422 BYTE per_vertex_point_size
: 1;
1423 BYTE flatshading
: 1;
1424 BYTE next_shader_type
: 3;
1426 WORD swizzle_map
; /* MAX_ATTRIBS, 16 */
1427 unsigned int next_shader_input_count
;
1428 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
1431 struct ds_compile_args
1433 enum wined3d_tessellator_output_primitive tessellator_output_primitive
;
1434 enum wined3d_tessellator_partitioning tessellator_partitioning
;
1435 unsigned int output_count
: 16;
1436 unsigned int next_shader_type
: 3;
1437 unsigned int render_offscreen
: 1;
1438 unsigned int padding
: 12;
1439 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
1442 struct gs_compile_args
1444 unsigned int output_count
;
1445 enum wined3d_primitive_type primitive_type
;
1446 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
1449 struct wined3d_shader_backend_ops
1451 void (*shader_handle_instruction
)(const struct wined3d_shader_instruction
*);
1452 void (*shader_precompile
)(void *shader_priv
, struct wined3d_shader
*shader
);
1453 void (*shader_select
)(void *shader_priv
, struct wined3d_context
*context
,
1454 const struct wined3d_state
*state
);
1455 void (*shader_select_compute
)(void *shader_priv
, struct wined3d_context
*context
,
1456 const struct wined3d_state
*state
);
1457 void (*shader_disable
)(void *shader_priv
, struct wined3d_context
*context
);
1458 void (*shader_update_float_vertex_constants
)(struct wined3d_device
*device
, UINT start
, UINT count
);
1459 void (*shader_update_float_pixel_constants
)(struct wined3d_device
*device
, UINT start
, UINT count
);
1460 void (*shader_load_constants
)(void *shader_priv
, struct wined3d_context
*context
,
1461 const struct wined3d_state
*state
);
1462 void (*shader_destroy
)(struct wined3d_shader
*shader
);
1463 HRESULT (*shader_alloc_private
)(struct wined3d_device
*device
, const struct wined3d_vertex_pipe_ops
*vertex_pipe
,
1464 const struct wined3d_fragment_pipe_ops
*fragment_pipe
);
1465 void (*shader_free_private
)(struct wined3d_device
*device
, struct wined3d_context
*context
);
1466 BOOL (*shader_allocate_context_data
)(struct wined3d_context
*context
);
1467 void (*shader_free_context_data
)(struct wined3d_context
*context
);
1468 void (*shader_init_context_state
)(struct wined3d_context
*context
);
1469 void (*shader_get_caps
)(const struct wined3d_adapter
*adapter
, struct shader_caps
*caps
);
1470 BOOL (*shader_color_fixup_supported
)(struct color_fixup_desc fixup
);
1471 BOOL (*shader_has_ffp_proj_control
)(void *shader_priv
);
1474 extern const struct wined3d_shader_backend_ops glsl_shader_backend DECLSPEC_HIDDEN
;
1475 extern const struct wined3d_shader_backend_ops arb_program_shader_backend DECLSPEC_HIDDEN
;
1476 extern const struct wined3d_shader_backend_ops none_shader_backend DECLSPEC_HIDDEN
;
1478 const struct wined3d_shader_backend_ops
*wined3d_spirv_shader_backend_init_vk(void) DECLSPEC_HIDDEN
;
1480 #define GL_EXTCALL(f) (gl_info->gl_ops.ext.p_##f)
1482 #define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xff)
1483 #define D3DCOLOR_B_G(dw) (((dw) >> 8) & 0xff)
1484 #define D3DCOLOR_B_B(dw) (((dw) >> 0) & 0xff)
1485 #define D3DCOLOR_B_A(dw) (((dw) >> 24) & 0xff)
1487 static inline void wined3d_color_from_d3dcolor(struct wined3d_color
*wined3d_color
, DWORD d3d_color
)
1489 wined3d_color
->r
= D3DCOLOR_B_R(d3d_color
) / 255.0f
;
1490 wined3d_color
->g
= D3DCOLOR_B_G(d3d_color
) / 255.0f
;
1491 wined3d_color
->b
= D3DCOLOR_B_B(d3d_color
) / 255.0f
;
1492 wined3d_color
->a
= D3DCOLOR_B_A(d3d_color
) / 255.0f
;
1495 extern const struct wined3d_vec4 wined3d_srgb_const
[] DECLSPEC_HIDDEN
;
1497 static inline float wined3d_srgb_from_linear(float colour
)
1501 if (colour
< wined3d_srgb_const
[1].x
)
1502 return colour
* wined3d_srgb_const
[0].w
;
1504 return wined3d_srgb_const
[0].y
* powf(colour
, wined3d_srgb_const
[0].x
) - wined3d_srgb_const
[0].z
;
1508 static inline void wined3d_colour_srgb_from_linear(struct wined3d_color
*colour_srgb
,
1509 const struct wined3d_color
*colour
)
1511 colour_srgb
->r
= wined3d_srgb_from_linear(colour
->r
);
1512 colour_srgb
->g
= wined3d_srgb_from_linear(colour
->g
);
1513 colour_srgb
->b
= wined3d_srgb_from_linear(colour
->b
);
1514 colour_srgb
->a
= colour
->a
;
1517 void wined3d_check_gl_call(const struct wined3d_gl_info
*gl_info
,
1518 const char *file
, unsigned int line
, const char *name
) DECLSPEC_HIDDEN
;
1520 /* Checking of API calls */
1521 /* --------------------- */
1522 #ifndef WINE_NO_DEBUG_MSGS
1523 #define checkGLcall(A) \
1525 if (__WINE_IS_DEBUG_ON(_ERR, &__wine_dbch_d3d) \
1526 && !gl_info->supported[ARB_DEBUG_OUTPUT]) \
1527 wined3d_check_gl_call(gl_info, __FILE__, __LINE__, A); \
1530 #define checkGLcall(A) do {} while(0)
1533 struct wined3d_bo_gl
1539 static inline GLuint
wined3d_bo_gl_id(uintptr_t bo
)
1541 return bo
? ((struct wined3d_bo_gl
*)bo
)->id
: 0;
1544 struct wined3d_bo_user_vk
1550 struct wined3d_bo_vk
1553 struct wined3d_allocator_block
*memory
;
1554 struct wined3d_bo_slab_vk
*slab
;
1556 VkDeviceMemory vk_memory
;
1559 VkDeviceSize buffer_offset
;
1560 VkDeviceSize memory_offset
;
1562 VkBufferUsageFlags usage
;
1563 VkMemoryPropertyFlags memory_type
;
1566 uint64_t command_buffer_id
;
1569 struct wined3d_bo_slab_vk_key
1571 VkMemoryPropertyFlags memory_type
;
1572 VkBufferUsageFlags usage
;
1576 struct wined3d_bo_slab_vk
1578 struct wine_rb_entry entry
;
1579 struct wined3d_bo_slab_vk
*next
;
1580 struct wined3d_bo_vk bo
;
1581 unsigned int map_count
;
1586 struct wined3d_bo_address
1588 UINT_PTR buffer_object
;
1592 struct wined3d_const_bo_address
1594 UINT_PTR buffer_object
;
1598 static inline struct wined3d_const_bo_address
*wined3d_const_bo_address(struct wined3d_bo_address
*data
)
1600 return (struct wined3d_const_bo_address
*)data
;
1603 struct wined3d_stream_info_element
1605 const struct wined3d_format
*format
;
1606 struct wined3d_bo_address data
;
1608 unsigned int stream_idx
;
1609 unsigned int divisor
;
1612 struct wined3d_stream_info
1614 struct wined3d_stream_info_element elements
[MAX_ATTRIBS
];
1615 DWORD position_transformed
: 1;
1617 WORD swizzle_map
; /* MAX_ATTRIBS, 16 */
1618 WORD use_map
; /* MAX_ATTRIBS, 16 */
1621 void wined3d_stream_info_from_declaration(struct wined3d_stream_info
*stream_info
,
1622 const struct wined3d_state
*state
, const struct wined3d_d3d_info
*d3d_info
) DECLSPEC_HIDDEN
;
1624 struct wined3d_direct_dispatch_parameters
1626 unsigned int group_count_x
;
1627 unsigned int group_count_y
;
1628 unsigned int group_count_z
;
1631 struct wined3d_indirect_dispatch_parameters
1633 struct wined3d_buffer
*buffer
;
1634 unsigned int offset
;
1637 struct wined3d_dispatch_parameters
1642 struct wined3d_direct_dispatch_parameters direct
;
1643 struct wined3d_indirect_dispatch_parameters indirect
;
1647 struct wined3d_direct_draw_parameters
1649 int base_vertex_idx
;
1650 unsigned int start_idx
;
1651 unsigned int index_count
;
1652 unsigned int start_instance
;
1653 unsigned int instance_count
;
1656 struct wined3d_indirect_draw_parameters
1658 struct wined3d_buffer
*buffer
;
1659 unsigned int offset
;
1662 struct wined3d_draw_parameters
1667 struct wined3d_direct_draw_parameters direct
;
1668 struct wined3d_indirect_draw_parameters indirect
;
1673 void draw_primitive(struct wined3d_device
*device
, const struct wined3d_state
*state
,
1674 const struct wined3d_draw_parameters
*draw_parameters
) DECLSPEC_HIDDEN
;
1675 void dispatch_compute(struct wined3d_device
*device
, const struct wined3d_state
*state
,
1676 const struct wined3d_dispatch_parameters
*dispatch_parameters
) DECLSPEC_HIDDEN
;
1680 #define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
1681 (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
1683 enum wined3d_pipeline
1685 WINED3D_PIPELINE_GRAPHICS
,
1686 WINED3D_PIPELINE_COMPUTE
,
1687 WINED3D_PIPELINE_COUNT
,
1690 /* Routines and structures related to state management */
1692 #define STATE_RENDER(a) (a)
1693 #define STATE_IS_RENDER(a) ((a) >= STATE_RENDER(1) && (a) <= STATE_RENDER(WINEHIGHEST_RENDER_STATE))
1695 #define STATE_TEXTURESTAGE(stage, num) \
1696 (STATE_RENDER(WINEHIGHEST_RENDER_STATE) + 1 + (stage) * (WINED3D_HIGHEST_TEXTURE_STATE + 1) + (num))
1697 #define STATE_IS_TEXTURESTAGE(a) \
1698 ((a) >= STATE_TEXTURESTAGE(0, 1) && (a) <= STATE_TEXTURESTAGE(WINED3D_MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE))
1700 /* + 1 because samplers start with 0 */
1701 #define STATE_SAMPLER(num) (STATE_TEXTURESTAGE(WINED3D_MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE) + 1 + (num))
1702 #define STATE_IS_SAMPLER(num) ((num) >= STATE_SAMPLER(0) && (num) <= STATE_SAMPLER(WINED3D_MAX_COMBINED_SAMPLERS - 1))
1704 #define STATE_GRAPHICS_SHADER(a) (STATE_SAMPLER(WINED3D_MAX_COMBINED_SAMPLERS) + (a))
1705 #define STATE_IS_GRAPHICS_SHADER(a) \
1706 ((a) >= STATE_GRAPHICS_SHADER(0) && (a) < STATE_GRAPHICS_SHADER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
1708 #define STATE_GRAPHICS_CONSTANT_BUFFER(a) (STATE_GRAPHICS_SHADER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT) + (a))
1709 #define STATE_IS_GRAPHICS_CONSTANT_BUFFER(a) \
1710 ((a) >= STATE_GRAPHICS_CONSTANT_BUFFER(0) \
1711 && (a) < STATE_GRAPHICS_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
1713 #define STATE_GRAPHICS_SHADER_RESOURCE_BINDING (STATE_GRAPHICS_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GRAPHICS_COUNT))
1714 #define STATE_IS_GRAPHICS_SHADER_RESOURCE_BINDING(a) ((a) == STATE_GRAPHICS_SHADER_RESOURCE_BINDING)
1716 #define STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING (STATE_GRAPHICS_SHADER_RESOURCE_BINDING + 1)
1717 #define STATE_IS_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING)
1719 #define STATE_TRANSFORM(a) (STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING + (a))
1720 #define STATE_IS_TRANSFORM(a) ((a) >= STATE_TRANSFORM(1) && (a) <= STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(255)))
1722 #define STATE_STREAMSRC (STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(255)) + 1)
1723 #define STATE_IS_STREAMSRC(a) ((a) == STATE_STREAMSRC)
1724 #define STATE_INDEXBUFFER (STATE_STREAMSRC + 1)
1725 #define STATE_IS_INDEXBUFFER(a) ((a) == STATE_INDEXBUFFER)
1727 #define STATE_VDECL (STATE_INDEXBUFFER + 1)
1728 #define STATE_IS_VDECL(a) ((a) == STATE_VDECL)
1730 #define STATE_VIEWPORT (STATE_VDECL + 1)
1731 #define STATE_IS_VIEWPORT(a) ((a) == STATE_VIEWPORT)
1733 #define STATE_LIGHT_TYPE (STATE_VIEWPORT + 1)
1734 #define STATE_IS_LIGHT_TYPE(a) ((a) == STATE_LIGHT_TYPE)
1735 #define STATE_ACTIVELIGHT(a) (STATE_LIGHT_TYPE + 1 + (a))
1736 #define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(WINED3D_MAX_ACTIVE_LIGHTS))
1738 #define STATE_SCISSORRECT (STATE_ACTIVELIGHT(WINED3D_MAX_ACTIVE_LIGHTS - 1) + 1)
1739 #define STATE_IS_SCISSORRECT(a) ((a) == STATE_SCISSORRECT)
1741 #define STATE_CLIPPLANE(a) (STATE_SCISSORRECT + 1 + (a))
1742 #define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES - 1))
1744 #define STATE_MATERIAL (STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES))
1745 #define STATE_IS_MATERIAL(a) ((a) == STATE_MATERIAL)
1747 #define STATE_RASTERIZER (STATE_MATERIAL + 1)
1748 #define STATE_IS_RASTERIZER(a) ((a) == STATE_RASTERIZER)
1750 #define STATE_POINTSPRITECOORDORIGIN (STATE_RASTERIZER + 1)
1751 #define STATE_IS_POINTSPRITECOORDORIGIN(a) ((a) == STATE_POINTSPRITECOORDORIGIN)
1753 #define STATE_BASEVERTEXINDEX (STATE_POINTSPRITECOORDORIGIN + 1)
1754 #define STATE_IS_BASEVERTEXINDEX(a) ((a) == STATE_BASEVERTEXINDEX)
1756 #define STATE_FRAMEBUFFER (STATE_BASEVERTEXINDEX + 1)
1757 #define STATE_IS_FRAMEBUFFER(a) ((a) == STATE_FRAMEBUFFER)
1759 #define STATE_POINT_ENABLE (STATE_FRAMEBUFFER + 1)
1760 #define STATE_IS_POINT_ENABLE(a) ((a) == STATE_POINT_ENABLE)
1762 #define STATE_COLOR_KEY (STATE_POINT_ENABLE + 1)
1763 #define STATE_IS_COLOR_KEY(a) ((a) == STATE_COLOR_KEY)
1765 #define STATE_STREAM_OUTPUT (STATE_COLOR_KEY + 1)
1766 #define STATE_IS_STREAM_OUTPUT(a) ((a) == STATE_STREAM_OUTPUT)
1768 #define STATE_BLEND (STATE_STREAM_OUTPUT + 1)
1769 #define STATE_IS_BLEND(a) ((a) == STATE_BLEND)
1771 #define STATE_BLEND_FACTOR (STATE_BLEND + 1)
1772 #define STATE_IS_BLEND_FACTOR(a) ((a) == STATE_BLEND_FACTOR)
1774 #define STATE_COMPUTE_OFFSET (STATE_BLEND_FACTOR + 1)
1776 #define STATE_COMPUTE_SHADER (STATE_COMPUTE_OFFSET)
1777 #define STATE_IS_COMPUTE_SHADER(a) ((a) == STATE_COMPUTE_SHADER)
1779 #define STATE_COMPUTE_CONSTANT_BUFFER (STATE_COMPUTE_SHADER + 1)
1780 #define STATE_IS_COMPUTE_CONSTANT_BUFFER(a) ((a) == STATE_COMPUTE_CONSTANT_BUFFER)
1782 #define STATE_COMPUTE_SHADER_RESOURCE_BINDING (STATE_COMPUTE_CONSTANT_BUFFER + 1)
1783 #define STATE_IS_COMPUTE_SHADER_RESOURCE_BINDING(a) ((a) == STATE_COMPUTE_SHADER_RESOURCE_BINDING)
1785 #define STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING (STATE_COMPUTE_SHADER_RESOURCE_BINDING + 1)
1786 #define STATE_IS_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1788 #define STATE_COMPUTE_HIGHEST (STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1789 #define STATE_HIGHEST (STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1791 #define STATE_IS_COMPUTE(a) ((a) >= STATE_COMPUTE_OFFSET && (a) <= STATE_COMPUTE_HIGHEST)
1792 #define STATE_COMPUTE_COUNT (STATE_COMPUTE_HIGHEST - STATE_COMPUTE_OFFSET + 1)
1794 #define STATE_SHADER(a) ((a) != WINED3D_SHADER_TYPE_COMPUTE ? STATE_GRAPHICS_SHADER(a) : STATE_COMPUTE_SHADER)
1795 #define STATE_CONSTANT_BUFFER(a) \
1796 ((a) != WINED3D_SHADER_TYPE_COMPUTE ? STATE_GRAPHICS_CONSTANT_BUFFER(a) : STATE_COMPUTE_CONSTANT_BUFFER)
1797 #define STATE_UNORDERED_ACCESS_VIEW_BINDING(a) ((a) == WINED3D_PIPELINE_GRAPHICS ? \
1798 STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING : STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING)
1806 union wined3d_gl_fence_object
1812 enum wined3d_fence_result
1815 WINED3D_FENCE_WAITING
,
1816 WINED3D_FENCE_NOT_STARTED
,
1817 WINED3D_FENCE_WRONG_THREAD
,
1818 WINED3D_FENCE_ERROR
,
1821 struct wined3d_fence
1824 union wined3d_gl_fence_object object
;
1825 struct wined3d_context_gl
*context_gl
;
1828 HRESULT
wined3d_fence_create(struct wined3d_device
*device
, struct wined3d_fence
**fence
) DECLSPEC_HIDDEN
;
1829 void wined3d_fence_destroy(struct wined3d_fence
*fence
) DECLSPEC_HIDDEN
;
1830 void wined3d_fence_issue(struct wined3d_fence
*fence
, struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
1831 enum wined3d_fence_result
wined3d_fence_wait(const struct wined3d_fence
*fence
,
1832 struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
1834 /* Direct3D terminology with little modifications. We do not have an issued
1835 * state because only the driver knows about it, but we have a created state
1836 * because D3D allows GetData() on a created query, but OpenGL doesn't. */
1837 enum wined3d_query_state
1844 struct wined3d_query_ops
1846 BOOL (*query_poll
)(struct wined3d_query
*query
, DWORD flags
);
1847 BOOL (*query_issue
)(struct wined3d_query
*query
, DWORD flags
);
1848 void (*query_destroy
)(struct wined3d_query
*query
);
1851 struct wined3d_query
1856 const struct wined3d_parent_ops
*parent_ops
;
1857 struct wined3d_device
*device
;
1858 enum wined3d_query_state state
;
1859 enum wined3d_query_type type
;
1862 const struct wined3d_query_ops
*query_ops
;
1864 LONG counter_main
, counter_retrieved
;
1865 struct list poll_list_entry
;
1867 GLuint buffer_object
;
1871 HRESULT
wined3d_query_gl_create(struct wined3d_device
*device
, enum wined3d_query_type type
, void *parent
,
1872 const struct wined3d_parent_ops
*parent_ops
, struct wined3d_query
**query
) DECLSPEC_HIDDEN
;
1873 void wined3d_query_gl_destroy_buffer_object(struct wined3d_context_gl
*context_gl
,
1874 struct wined3d_query
*query
) DECLSPEC_HIDDEN
;
1876 struct wined3d_event_query
1878 struct wined3d_query query
;
1880 struct wined3d_fence fence
;
1884 struct wined3d_occlusion_query
1886 struct wined3d_query query
;
1890 struct wined3d_context_gl
*context_gl
;
1895 struct wined3d_timestamp_query
1897 struct wined3d_query query
;
1901 struct wined3d_context_gl
*context_gl
;
1905 union wined3d_gl_so_statistics_query
1915 struct wined3d_so_statistics_query
1917 struct wined3d_query query
;
1920 union wined3d_gl_so_statistics_query u
;
1921 struct wined3d_context_gl
*context_gl
;
1922 unsigned int stream_idx
;
1923 struct wined3d_query_data_so_statistics statistics
;
1927 union wined3d_gl_pipeline_statistics_query
1934 GLuint vertex_shader
;
1935 GLuint tess_control_shader
;
1936 GLuint tess_eval_shader
;
1937 GLuint geometry_shader
;
1938 GLuint geometry_primitives
;
1939 GLuint fragment_shader
;
1940 GLuint compute_shader
;
1941 GLuint clipping_input
;
1942 GLuint clipping_output
;
1946 struct wined3d_pipeline_statistics_query
1948 struct wined3d_query query
;
1951 union wined3d_gl_pipeline_statistics_query u
;
1952 struct wined3d_context_gl
*context_gl
;
1953 struct wined3d_query_data_pipeline_statistics statistics
;
1957 #define WINED3D_QUERY_POOL_SIZE 256
1959 struct wined3d_query_pool_vk
1963 struct list
*free_list
;
1964 VkQueryPool vk_query_pool
;
1965 uint32_t allocated
[WINED3D_BITMAP_SIZE(WINED3D_QUERY_POOL_SIZE
)];
1968 bool wined3d_query_pool_vk_allocate_query(struct wined3d_query_pool_vk
*pool_vk
, size_t *idx
) DECLSPEC_HIDDEN
;
1969 void wined3d_query_pool_vk_cleanup(struct wined3d_query_pool_vk
*pool_vk
,
1970 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
1971 void wined3d_query_pool_vk_free_query(struct wined3d_query_pool_vk
*pool_vk
, size_t idx
) DECLSPEC_HIDDEN
;
1972 bool wined3d_query_pool_vk_init(struct wined3d_query_pool_vk
*pool_vk
, struct wined3d_context_vk
*context_vk
,
1973 enum wined3d_query_type type
, struct list
*free_pools
) DECLSPEC_HIDDEN
;
1975 struct wined3d_query_pool_idx_vk
1977 struct wined3d_query_pool_vk
*pool_vk
;
1981 struct wined3d_query_vk
1983 struct wined3d_query q
;
1986 struct wined3d_query_pool_idx_vk pool_idx
;
1988 uint64_t command_buffer_id
;
1989 uint32_t control_flags
;
1990 size_t pending_count
;
1993 static inline struct wined3d_query_vk
*wined3d_query_vk(struct wined3d_query
*query
)
1995 return CONTAINING_RECORD(query
, struct wined3d_query_vk
, q
);
1998 bool wined3d_query_vk_accumulate_data(struct wined3d_query_vk
*query_vk
, struct wined3d_context_vk
*context_vk
,
1999 const struct wined3d_query_pool_idx_vk
*pool_idx
) DECLSPEC_HIDDEN
;
2000 HRESULT
wined3d_query_vk_create(struct wined3d_device
*device
, enum wined3d_query_type type
, void *parent
,
2001 const struct wined3d_parent_ops
*parent_ops
, struct wined3d_query
**query
) DECLSPEC_HIDDEN
;
2002 void wined3d_query_vk_resume(struct wined3d_query_vk
*query_vk
, struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2003 void wined3d_query_vk_suspend(struct wined3d_query_vk
*query_vk
, struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2005 struct wined3d_gl_view
2011 struct wined3d_range
2013 unsigned int offset
;
2017 struct wined3d_rendertarget_info
2019 struct wined3d_gl_view gl_view
;
2020 struct wined3d_resource
*resource
;
2021 unsigned int sub_resource_idx
;
2022 unsigned int layer_count
;
2025 struct wined3d_fb_state
2027 struct wined3d_rendertarget_view
*render_targets
[WINED3D_MAX_RENDER_TARGETS
];
2028 struct wined3d_rendertarget_view
*depth_stencil
;
2031 #define MAX_GL_FRAGMENT_SAMPLERS 32
2033 struct wined3d_context
2035 const struct wined3d_d3d_info
*d3d_info
;
2036 const struct wined3d_state_entry
*state_table
;
2037 uint32_t dirty_graphics_states
[WINED3D_BITMAP_SIZE(STATE_HIGHEST
)];
2038 uint32_t dirty_compute_states
[WINED3D_BITMAP_SIZE(STATE_COMPUTE_COUNT
)];
2040 struct wined3d_device
*device
;
2041 struct wined3d_swapchain
*swapchain
;
2044 struct wined3d_texture
*texture
;
2045 unsigned int sub_resource_idx
;
2048 /* Stores some information about the context state for optimization */
2049 DWORD shader_update_mask
: 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */
2050 DWORD update_shader_resource_bindings
: 1;
2051 DWORD update_compute_shader_resource_bindings
: 1;
2052 DWORD update_unordered_access_view_bindings
: 1;
2053 DWORD update_compute_unordered_access_view_bindings
: 1;
2054 DWORD last_swizzle_map
: 16; /* MAX_ATTRIBS, 16 */
2055 DWORD last_was_rhw
: 1; /* True iff last draw_primitive was in xyzrhw mode. */
2056 DWORD last_was_pshader
: 1;
2057 DWORD last_was_vshader
: 1;
2058 DWORD last_was_diffuse
: 1;
2059 DWORD last_was_specular
: 1;
2060 DWORD last_was_normal
: 1;
2062 DWORD last_was_ffp_blit
: 1;
2063 DWORD last_was_blit
: 1;
2064 DWORD last_was_ckey
: 1;
2065 DWORD last_was_dual_source_blend
: 1;
2066 DWORD texShaderBumpMap
: 8; /* WINED3D_MAX_TEXTURES, 8 */
2067 DWORD lastWasPow2Texture
: 8; /* WINED3D_MAX_TEXTURES, 8 */
2068 DWORD fixed_function_usage_map
: 8; /* WINED3D_MAX_TEXTURES, 8 */
2069 DWORD lowest_disabled_stage
: 4; /* Max WINED3D_MAX_TEXTURES, 8 */
2071 DWORD use_immediate_mode_draw
: 1;
2072 DWORD uses_uavs
: 1;
2073 DWORD uses_fbo_attached_resources
: 1;
2074 DWORD transform_feedback_active
: 1;
2075 DWORD transform_feedback_paused
: 1;
2076 DWORD fog_coord
: 1;
2077 DWORD render_offscreen
: 1;
2079 DWORD destroyed
: 1;
2080 DWORD destroy_delayed
: 1;
2081 DWORD clip_distance_mask
: 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
2082 DWORD namedArraysLoaded
: 1;
2085 DWORD constant_update_mask
;
2086 DWORD numbered_array_mask
;
2087 enum fogsource fog_source
;
2089 UINT instance_count
;
2091 void *shader_backend_data
;
2092 void *fragment_pipe_data
;
2094 struct wined3d_stream_info stream_info
;
2096 /* Fences for GL_APPLE_flush_buffer_range */
2097 struct wined3d_fence
*buffer_fences
[MAX_ATTRIBS
];
2098 unsigned int buffer_fence_count
;
2100 unsigned int viewport_count
;
2101 unsigned int scissor_rect_count
;
2104 void wined3d_context_cleanup(struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
2105 void wined3d_context_init(struct wined3d_context
*context
, struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
2106 void context_load_shader_resources(struct wined3d_context
*context
,
2107 const struct wined3d_state
*state
, unsigned int shader_mask
) DECLSPEC_HIDDEN
;
2108 void context_load_stream_output_buffers(struct wined3d_context
*context
,
2109 const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
2110 void context_load_unordered_access_resources(struct wined3d_context
*context
,
2111 const struct wined3d_shader
*shader
, struct wined3d_unordered_access_view
* const *views
) DECLSPEC_HIDDEN
;
2112 void context_preload_textures(struct wined3d_context
*context
, const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
2113 void context_update_stream_info(struct wined3d_context
*context
, const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
2115 HRESULT
wined3d_context_no3d_init(struct wined3d_context
*context_no3d
,
2116 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
2118 struct wined3d_context_gl
2120 struct wined3d_context c
;
2122 const struct wined3d_gl_info
*gl_info
;
2124 DWORD tid
; /* Thread ID which owns this context at the moment. */
2126 uint32_t dc_is_private
: 1;
2127 uint32_t dc_has_format
: 1; /* Only meaningful for private DCs. */
2128 uint32_t fog_enabled
: 1;
2129 uint32_t diffuse_attrib_to_1
: 1;
2130 uint32_t rebind_fbo
: 1;
2131 uint32_t untracked_material_count
: 2; /* Max value 2 */
2132 uint32_t needs_set
: 1;
2134 uint32_t padding
: 23;
2136 uint32_t default_attrib_value_set
;
2138 GLenum tracking_parm
; /* Which source is tracking current colour. */
2139 GLenum untracked_materials
[2];
2141 unsigned int active_texture
;
2143 GLenum
*texture_type
;
2145 /* The WGL context. */
2150 HWND restore_pf_win
;
2158 unsigned int fbo_entry_count
;
2159 struct list fbo_list
;
2160 struct list fbo_destroy_list
;
2161 struct fbo_entry
*current_fbo
;
2162 GLuint fbo_read_binding
;
2163 GLuint fbo_draw_binding
;
2164 struct wined3d_rendertarget_info blit_targets
[WINED3D_MAX_RENDER_TARGETS
];
2165 uint32_t draw_buffers_mask
; /* Enabled draw buffers, 31 max. */
2168 struct list occlusion_queries
;
2170 struct list timestamp_queries
;
2171 struct list so_statistics_queries
;
2172 struct list pipeline_statistics_queries
;
2174 GLuint
*free_occlusion_queries
;
2175 SIZE_T free_occlusion_query_size
;
2176 unsigned int free_occlusion_query_count
;
2178 union wined3d_gl_fence_object
*free_fences
;
2179 SIZE_T free_fence_size
;
2180 unsigned int free_fence_count
;
2182 GLuint
*free_timestamp_queries
;
2183 SIZE_T free_timestamp_query_size
;
2184 unsigned int free_timestamp_query_count
;
2186 union wined3d_gl_so_statistics_query
*free_so_statistics_queries
;
2187 SIZE_T free_so_statistics_query_size
;
2188 unsigned int free_so_statistics_query_count
;
2190 union wined3d_gl_pipeline_statistics_query
*free_pipeline_statistics_queries
;
2191 SIZE_T free_pipeline_statistics_query_size
;
2192 unsigned int free_pipeline_statistics_query_count
;
2196 unsigned int tex_unit_map
[WINED3D_MAX_COMBINED_SAMPLERS
];
2197 unsigned int rev_tex_unit_map
[MAX_GL_FRAGMENT_SAMPLERS
+ WINED3D_MAX_VERTEX_SAMPLERS
];
2199 /* Extension emulation. */
2200 GLint gl_fog_source
;
2201 GLfloat fog_coord_value
;
2202 GLfloat colour
[4], fog_start
, fog_end
, fog_colour
[4];
2204 GLuint dummy_arbfp_prog
;
2207 static inline struct wined3d_context_gl
*wined3d_context_gl(struct wined3d_context
*context
)
2209 return CONTAINING_RECORD(context
, struct wined3d_context_gl
, c
);
2212 static inline const struct wined3d_context_gl
*wined3d_context_gl_const(const struct wined3d_context
*context
)
2214 return CONTAINING_RECORD(context
, struct wined3d_context_gl
, c
);
2217 struct wined3d_context
*wined3d_context_gl_acquire(const struct wined3d_device
*device
,
2218 struct wined3d_texture
*texture
, unsigned int sub_resource_idx
) DECLSPEC_HIDDEN
;
2219 void wined3d_context_gl_active_texture(struct wined3d_context_gl
*context_gl
,
2220 const struct wined3d_gl_info
*gl_info
, unsigned int unit
) DECLSPEC_HIDDEN
;
2221 void wined3d_context_gl_alloc_fence(struct wined3d_context_gl
*context_gl
,
2222 struct wined3d_fence
*fence
) DECLSPEC_HIDDEN
;
2223 void wined3d_context_gl_alloc_occlusion_query(struct wined3d_context_gl
*context_gl
,
2224 struct wined3d_occlusion_query
*query
) DECLSPEC_HIDDEN
;
2225 void wined3d_context_gl_alloc_pipeline_statistics_query(struct wined3d_context_gl
*context_gl
,
2226 struct wined3d_pipeline_statistics_query
*query
) DECLSPEC_HIDDEN
;
2227 void wined3d_context_gl_alloc_so_statistics_query(struct wined3d_context_gl
*context_gl
,
2228 struct wined3d_so_statistics_query
*query
) DECLSPEC_HIDDEN
;
2229 void wined3d_context_gl_alloc_timestamp_query(struct wined3d_context_gl
*context_gl
,
2230 struct wined3d_timestamp_query
*query
) DECLSPEC_HIDDEN
;
2231 void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl
*context_gl
,
2232 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2233 BOOL
wined3d_context_gl_apply_clear_state(struct wined3d_context_gl
*context_gl
, const struct wined3d_state
*state
,
2234 unsigned int rt_count
, const struct wined3d_fb_state
*fb
) DECLSPEC_HIDDEN
;
2235 void wined3d_context_gl_apply_fbo_state_blit(struct wined3d_context_gl
*context_gl
, GLenum target
,
2236 struct wined3d_resource
*rt
, unsigned int rt_sub_resource_idx
,
2237 struct wined3d_resource
*ds
, unsigned int ds_sub_resource_idx
, DWORD location
) DECLSPEC_HIDDEN
;
2238 void wined3d_context_gl_apply_ffp_blit_state(struct wined3d_context_gl
*context_gl
,
2239 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2240 void wined3d_context_gl_bind_bo(struct wined3d_context_gl
*context_gl
, GLenum binding
, GLuint name
) DECLSPEC_HIDDEN
;
2241 void wined3d_context_gl_bind_dummy_textures(const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2242 void wined3d_context_gl_bind_texture(struct wined3d_context_gl
*context_gl
,
2243 GLenum target
, GLuint name
) DECLSPEC_HIDDEN
;
2244 void wined3d_context_gl_check_fbo_status(const struct wined3d_context_gl
*context_gl
, GLenum target
) DECLSPEC_HIDDEN
;
2245 void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl
*context_gl
,
2246 const struct wined3d_bo_address
*dst
, const struct wined3d_bo_address
*src
, size_t size
) DECLSPEC_HIDDEN
;
2247 void wined3d_context_gl_destroy(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2248 void wined3d_context_gl_draw_shaded_quad(struct wined3d_context_gl
*context_gl
, struct wined3d_texture_gl
*texture_gl
,
2249 unsigned int sub_resource_idx
, const RECT
*src_rect
, const RECT
*dst_rect
,
2250 enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
2251 void wined3d_context_gl_draw_textured_quad(struct wined3d_context_gl
*context_gl
,
2252 struct wined3d_texture_gl
*texture_gl
, unsigned int sub_resource_idx
,
2253 const RECT
*src_rect
, const RECT
*dst_rect
, enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
2254 void wined3d_context_gl_enable_clip_distances(struct wined3d_context_gl
*context_gl
, uint32_t mask
) DECLSPEC_HIDDEN
;
2255 void wined3d_context_gl_end_transform_feedback(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2256 void wined3d_context_gl_free_fence(struct wined3d_fence
*fence
) DECLSPEC_HIDDEN
;
2257 void wined3d_context_gl_free_occlusion_query(struct wined3d_occlusion_query
*query
) DECLSPEC_HIDDEN
;
2258 void wined3d_context_gl_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query
*query
) DECLSPEC_HIDDEN
;
2259 void wined3d_context_gl_free_so_statistics_query(struct wined3d_so_statistics_query
*query
) DECLSPEC_HIDDEN
;
2260 void wined3d_context_gl_free_timestamp_query(struct wined3d_timestamp_query
*query
) DECLSPEC_HIDDEN
;
2261 struct wined3d_context_gl
*wined3d_context_gl_get_current(void) DECLSPEC_HIDDEN
;
2262 GLenum
wined3d_context_gl_get_offscreen_gl_buffer(const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2263 const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl
*context_gl
,
2264 const struct wined3d_shader_version
*shader_version
, unsigned int *base
, unsigned int *count
) DECLSPEC_HIDDEN
;
2265 HRESULT
wined3d_context_gl_init(struct wined3d_context_gl
*context_gl
,
2266 struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
2267 void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl
*context_gl
,
2268 const struct wined3d_stream_info
*si
, GLuint
*current_bo
, const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
2269 void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl
*context_gl
,
2270 const struct wined3d_bo_address
*data
, size_t size
, uint32_t flags
) DECLSPEC_HIDDEN
;
2271 struct wined3d_context_gl
*wined3d_context_gl_reacquire(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2272 void wined3d_context_gl_release(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2273 BOOL
wined3d_context_gl_set_current(struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2274 void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl
*context_gl
, GLenum buffer
) DECLSPEC_HIDDEN
;
2275 void wined3d_context_gl_texture_update(struct wined3d_context_gl
*context_gl
,
2276 const struct wined3d_texture_gl
*texture_gl
) DECLSPEC_HIDDEN
;
2277 void wined3d_context_gl_unload_tex_coords(const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
2278 void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl
*context_gl
, const struct wined3d_bo_address
*data
,
2279 unsigned int range_count
, const struct wined3d_range
*ranges
) DECLSPEC_HIDDEN
;
2280 void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl
*context_gl
,
2281 const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
2283 struct wined3d_command_buffer_vk
2286 VkCommandBuffer vk_command_buffer
;
2290 enum wined3d_retired_object_type_vk
2292 WINED3D_RETIRED_FREE_VK
,
2293 WINED3D_RETIRED_FRAMEBUFFER_VK
,
2294 WINED3D_RETIRED_DESCRIPTOR_POOL_VK
,
2295 WINED3D_RETIRED_MEMORY_VK
,
2296 WINED3D_RETIRED_ALLOCATOR_BLOCK_VK
,
2297 WINED3D_RETIRED_BO_SLAB_SLICE_VK
,
2298 WINED3D_RETIRED_BUFFER_VK
,
2299 WINED3D_RETIRED_IMAGE_VK
,
2300 WINED3D_RETIRED_BUFFER_VIEW_VK
,
2301 WINED3D_RETIRED_IMAGE_VIEW_VK
,
2302 WINED3D_RETIRED_SAMPLER_VK
,
2305 struct wined3d_retired_object_vk
2307 enum wined3d_retired_object_type_vk type
;
2310 struct wined3d_retired_object_vk
*next
;
2311 VkFramebuffer vk_framebuffer
;
2312 VkDescriptorPool vk_descriptor_pool
;
2313 VkDeviceMemory vk_memory
;
2314 struct wined3d_allocator_block
*block
;
2317 struct wined3d_bo_slab_vk
*slab
;
2322 VkBufferView vk_buffer_view
;
2323 VkImageView vk_image_view
;
2324 VkSampler vk_sampler
;
2326 uint64_t command_buffer_id
;
2329 struct wined3d_retired_objects_vk
2331 struct wined3d_retired_object_vk
*objects
;
2332 struct wined3d_retired_object_vk
*free
;
2337 struct wined3d_render_pass_attachment_vk
2340 VkSampleCountFlagBits vk_samples
;
2341 VkImageLayout vk_layout
;
2344 struct wined3d_render_pass_key_vk
2346 struct wined3d_render_pass_attachment_vk rt
[WINED3D_MAX_RENDER_TARGETS
];
2347 struct wined3d_render_pass_attachment_vk ds
;
2349 uint32_t clear_flags
;
2352 struct wined3d_render_pass_vk
2354 struct wine_rb_entry entry
;
2355 struct wined3d_render_pass_key_vk key
;
2356 VkRenderPass vk_render_pass
;
2359 struct wined3d_pipeline_layout_key_vk
2361 VkDescriptorSetLayoutBinding
*bindings
;
2362 SIZE_T binding_count
;
2365 struct wined3d_pipeline_layout_vk
2367 struct wine_rb_entry entry
;
2368 struct wined3d_pipeline_layout_key_vk key
;
2369 VkPipelineLayout vk_pipeline_layout
;
2370 VkDescriptorSetLayout vk_set_layout
;
2373 struct wined3d_graphics_pipeline_key_vk
2375 VkPipelineShaderStageCreateInfo stages
[WINED3D_SHADER_TYPE_GRAPHICS_COUNT
];
2376 VkVertexInputBindingDivisorDescriptionEXT divisors
[MAX_ATTRIBS
];
2377 VkVertexInputAttributeDescription attributes
[MAX_ATTRIBS
];
2378 VkVertexInputBindingDescription bindings
[MAX_ATTRIBS
];
2379 VkViewport viewport
;
2381 VkPipelineColorBlendAttachmentState blend_attachments
[WINED3D_MAX_RENDER_TARGETS
];
2383 VkPipelineVertexInputDivisorStateCreateInfoEXT divisor_desc
;
2384 VkPipelineVertexInputStateCreateInfo input_desc
;
2385 VkPipelineInputAssemblyStateCreateInfo ia_desc
;
2386 VkPipelineTessellationStateCreateInfo ts_desc
;
2387 VkPipelineViewportStateCreateInfo vp_desc
;
2388 VkPipelineRasterizationStateCreateInfo rs_desc
;
2389 VkPipelineMultisampleStateCreateInfo ms_desc
;
2390 VkPipelineDepthStencilStateCreateInfo ds_desc
;
2391 VkPipelineColorBlendStateCreateInfo blend_desc
;
2392 VkPipelineDynamicStateCreateInfo dynamic_desc
;
2394 VkGraphicsPipelineCreateInfo pipeline_desc
;
2397 struct wined3d_graphics_pipeline_vk
2399 struct wine_rb_entry entry
;
2400 struct wined3d_graphics_pipeline_key_vk key
;
2401 VkPipeline vk_pipeline
;
2404 enum wined3d_shader_descriptor_type
2406 WINED3D_SHADER_DESCRIPTOR_TYPE_CBV
,
2407 WINED3D_SHADER_DESCRIPTOR_TYPE_SRV
,
2408 WINED3D_SHADER_DESCRIPTOR_TYPE_UAV
,
2409 WINED3D_SHADER_DESCRIPTOR_TYPE_UAV_COUNTER
,
2410 WINED3D_SHADER_DESCRIPTOR_TYPE_SAMPLER
,
2413 struct wined3d_shader_resource_binding
2415 enum wined3d_shader_type shader_type
;
2416 enum wined3d_shader_descriptor_type shader_descriptor_type
;
2417 size_t resource_idx
;
2418 enum wined3d_shader_resource_type resource_type
;
2419 enum wined3d_data_type resource_data_type
;
2423 struct wined3d_shader_resource_bindings
2425 struct wined3d_shader_resource_binding
*bindings
;
2429 struct wined3d_shader_descriptor_writes_vk
2431 VkWriteDescriptorSet
*writes
;
2435 struct wined3d_pending_query_vk
2437 struct wined3d_query_vk
*query_vk
;
2438 struct wined3d_query_pool_idx_vk pool_idx
;
2441 struct wined3d_pending_queries_vk
2443 struct wined3d_pending_query_vk
*queries
;
2449 struct wined3d_context_vk
2451 struct wined3d_context c
;
2453 const struct wined3d_vk_info
*vk_info
;
2455 uint32_t update_compute_pipeline
: 1;
2456 uint32_t padding
: 31;
2460 VkShaderModule vk_modules
[WINED3D_SHADER_TYPE_GRAPHICS_COUNT
];
2461 struct wined3d_graphics_pipeline_key_vk pipeline_key_vk
;
2462 VkPipeline vk_pipeline
;
2463 VkPipelineLayout vk_pipeline_layout
;
2464 VkDescriptorSetLayout vk_set_layout
;
2465 struct wined3d_shader_resource_bindings bindings
;
2470 VkPipeline vk_pipeline
;
2471 VkPipelineLayout vk_pipeline_layout
;
2472 VkDescriptorSetLayout vk_set_layout
;
2473 struct wined3d_shader_resource_bindings bindings
;
2476 VkCommandPool vk_command_pool
;
2477 struct wined3d_command_buffer_vk current_command_buffer
;
2478 uint64_t completed_command_buffer_id
;
2482 struct wined3d_command_buffer_vk
*buffers
;
2483 SIZE_T buffers_size
;
2484 SIZE_T buffer_count
;
2487 struct wined3d_shader_descriptor_writes_vk descriptor_writes
;
2489 VkFramebuffer vk_framebuffer
;
2490 VkRenderPass vk_render_pass
;
2491 VkDescriptorPool vk_descriptor_pool
;
2493 VkSampleCountFlagBits sample_count
;
2494 unsigned int rt_count
;
2496 struct list active_queries
;
2497 struct wined3d_pending_queries_vk pending_queries
;
2498 struct list free_occlusion_query_pools
;
2499 struct list free_timestamp_query_pools
;
2500 struct list free_pipeline_statistics_query_pools
;
2502 struct wined3d_retired_objects_vk retired
;
2503 struct wine_rb_tree render_passes
;
2504 struct wine_rb_tree pipeline_layouts
;
2505 struct wine_rb_tree graphics_pipelines
;
2506 struct wine_rb_tree bo_slab_available
;
2509 static inline struct wined3d_context_vk
*wined3d_context_vk(struct wined3d_context
*context
)
2511 return CONTAINING_RECORD(context
, struct wined3d_context_vk
, c
);
2514 void wined3d_context_vk_accumulate_pending_queries(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2515 void wined3d_context_vk_add_pending_query(struct wined3d_context_vk
*context_vk
,
2516 struct wined3d_query_vk
*query_vk
) DECLSPEC_HIDDEN
;
2517 struct wined3d_allocator_block
*wined3d_context_vk_allocate_memory(struct wined3d_context_vk
*context_vk
,
2518 unsigned int memory_type
, VkDeviceSize size
, VkDeviceMemory
*vk_memory
) DECLSPEC_HIDDEN
;
2519 bool wined3d_context_vk_allocate_query(struct wined3d_context_vk
*context_vk
,
2520 enum wined3d_query_type type
, struct wined3d_query_pool_idx_vk
*pool_idx
) DECLSPEC_HIDDEN
;
2521 VkDeviceMemory
wined3d_context_vk_allocate_vram_chunk_memory(struct wined3d_context_vk
*context_vk
,
2522 unsigned int pool
, size_t size
) DECLSPEC_HIDDEN
;
2523 VkCommandBuffer
wined3d_context_vk_apply_compute_state(struct wined3d_context_vk
*context_vk
,
2524 const struct wined3d_state
*state
, struct wined3d_buffer_vk
*indirect_vk
) DECLSPEC_HIDDEN
;
2525 VkCommandBuffer
wined3d_context_vk_apply_draw_state(struct wined3d_context_vk
*context_vk
,
2526 const struct wined3d_state
*state
, struct wined3d_buffer_vk
*indirect_vk
, bool indexed
) DECLSPEC_HIDDEN
;
2527 void wined3d_context_vk_cleanup(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2528 BOOL
wined3d_context_vk_create_bo(struct wined3d_context_vk
*context_vk
, VkDeviceSize size
,
2529 VkBufferUsageFlags usage
, VkMemoryPropertyFlags memory_type
, struct wined3d_bo_vk
*bo
) DECLSPEC_HIDDEN
;
2530 void wined3d_context_vk_destroy_allocator_block(struct wined3d_context_vk
*context_vk
,
2531 struct wined3d_allocator_block
*block
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
2532 void wined3d_context_vk_destroy_bo(struct wined3d_context_vk
*context_vk
,
2533 const struct wined3d_bo_vk
*bo
) DECLSPEC_HIDDEN
;
2534 void wined3d_context_vk_destroy_buffer_view(struct wined3d_context_vk
*context_vk
,
2535 VkBufferView vk_view
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
2536 void wined3d_context_vk_destroy_framebuffer(struct wined3d_context_vk
*context_vk
,
2537 VkFramebuffer vk_framebuffer
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
2538 void wined3d_context_vk_destroy_image(struct wined3d_context_vk
*context_vk
,
2539 VkImage vk_image
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
2540 void wined3d_context_vk_destroy_image_view(struct wined3d_context_vk
*context_vk
,
2541 VkImageView vk_view
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
2542 void wined3d_context_vk_destroy_memory(struct wined3d_context_vk
*context_vk
,
2543 VkDeviceMemory vk_memory
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
2544 void wined3d_context_vk_destroy_sampler(struct wined3d_context_vk
*context_vk
,
2545 VkSampler vk_sampler
, uint64_t command_buffer_id
) DECLSPEC_HIDDEN
;
2546 void wined3d_context_vk_end_current_render_pass(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2547 VkCommandBuffer
wined3d_context_vk_get_command_buffer(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2548 struct wined3d_pipeline_layout_vk
*wined3d_context_vk_get_pipeline_layout(struct wined3d_context_vk
*context_vk
,
2549 VkDescriptorSetLayoutBinding
*bindings
, SIZE_T binding_count
) DECLSPEC_HIDDEN
;
2550 VkRenderPass
wined3d_context_vk_get_render_pass(struct wined3d_context_vk
*context_vk
,
2551 const struct wined3d_fb_state
*fb
, unsigned int rt_count
,
2552 bool depth_stencil
, uint32_t clear_flags
) DECLSPEC_HIDDEN
;
2553 void wined3d_context_vk_image_barrier(struct wined3d_context_vk
*context_vk
,
2554 VkCommandBuffer vk_command_buffer
, VkPipelineStageFlags src_stage_mask
, VkPipelineStageFlags dst_stage_mask
,
2555 VkAccessFlags src_access_mask
, VkAccessFlags dst_access_mask
, VkImageLayout old_layout
,
2556 VkImageLayout new_layout
, VkImage image
, VkImageAspectFlags aspect_mask
) DECLSPEC_HIDDEN
;
2557 HRESULT
wined3d_context_vk_init(struct wined3d_context_vk
*context_vk
,
2558 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
2559 void wined3d_context_vk_poll_command_buffers(struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
2560 void wined3d_context_vk_remove_pending_queries(struct wined3d_context_vk
*context_vk
,
2561 struct wined3d_query_vk
*query_vk
) DECLSPEC_HIDDEN
;
2562 void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk
*context_vk
,
2563 unsigned int wait_semaphore_count
, const VkSemaphore
*wait_semaphores
, const VkPipelineStageFlags
*wait_stages
,
2564 unsigned int signal_semaphore_count
, const VkSemaphore
*signal_semaphores
) DECLSPEC_HIDDEN
;
2565 void wined3d_context_vk_wait_command_buffer(struct wined3d_context_vk
*context_vk
, uint64_t id
) DECLSPEC_HIDDEN
;
2567 typedef void (*APPLYSTATEFUNC
)(struct wined3d_context
*ctx
, const struct wined3d_state
*state
, DWORD state_id
);
2569 struct wined3d_state_entry
2571 unsigned int representative
;
2572 APPLYSTATEFUNC apply
;
2575 struct wined3d_state_entry_template
2578 struct wined3d_state_entry content
;
2579 unsigned int extension
;
2582 #define WINED3D_FRAGMENT_CAP_PROJ_CONTROL 0x00000001
2583 #define WINED3D_FRAGMENT_CAP_SRGB_WRITE 0x00000002
2584 #define WINED3D_FRAGMENT_CAP_COLOR_KEY 0x00000004
2586 struct fragment_caps
2589 DWORD PrimitiveMiscCaps
;
2590 DWORD TextureOpCaps
;
2591 DWORD MaxTextureBlendStages
;
2592 DWORD MaxSimultaneousTextures
;
2595 #define GL_EXT_EMUL_ARB_MULTITEXTURE 0x00000001
2596 #define GL_EXT_EMUL_EXT_FOG_COORD 0x00000002
2598 struct wined3d_fragment_pipe_ops
2600 void (*fp_enable
)(const struct wined3d_context
*context
, BOOL enable
);
2601 void (*get_caps
)(const struct wined3d_adapter
*adapter
, struct fragment_caps
*caps
);
2602 DWORD (*get_emul_mask
)(const struct wined3d_gl_info
*gl_info
);
2603 void *(*alloc_private
)(const struct wined3d_shader_backend_ops
*shader_backend
, void *shader_priv
);
2604 void (*free_private
)(struct wined3d_device
*device
, struct wined3d_context
*context
);
2605 BOOL (*allocate_context_data
)(struct wined3d_context
*context
);
2606 void (*free_context_data
)(struct wined3d_context
*context
);
2607 BOOL (*color_fixup_supported
)(struct color_fixup_desc fixup
);
2608 const struct wined3d_state_entry_template
*states
;
2611 struct wined3d_vertex_caps
2614 BOOL emulated_flatshading
;
2615 BOOL ffp_generic_attributes
;
2616 DWORD max_active_lights
;
2617 DWORD max_vertex_blend_matrices
;
2618 DWORD max_vertex_blend_matrix_index
;
2619 DWORD vertex_processing_caps
;
2621 DWORD max_user_clip_planes
;
2625 struct wined3d_vertex_pipe_ops
2627 void (*vp_enable
)(const struct wined3d_context
*context
, BOOL enable
);
2628 void (*vp_get_caps
)(const struct wined3d_adapter
*adapter
, struct wined3d_vertex_caps
*caps
);
2629 DWORD (*vp_get_emul_mask
)(const struct wined3d_gl_info
*gl_info
);
2630 void *(*vp_alloc
)(const struct wined3d_shader_backend_ops
*shader_backend
, void *shader_priv
);
2631 void (*vp_free
)(struct wined3d_device
*device
, struct wined3d_context
*context
);
2632 const struct wined3d_state_entry_template
*vp_states
;
2635 extern const struct wined3d_state_entry_template misc_state_template_gl
[] DECLSPEC_HIDDEN
;
2636 extern const struct wined3d_fragment_pipe_ops none_fragment_pipe DECLSPEC_HIDDEN
;
2637 extern const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline DECLSPEC_HIDDEN
;
2638 extern const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline DECLSPEC_HIDDEN
;
2639 extern const struct wined3d_fragment_pipe_ops arbfp_fragment_pipeline DECLSPEC_HIDDEN
;
2640 extern const struct wined3d_fragment_pipe_ops nvts_fragment_pipeline DECLSPEC_HIDDEN
;
2641 extern const struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline DECLSPEC_HIDDEN
;
2642 extern const struct wined3d_fragment_pipe_ops glsl_fragment_pipe DECLSPEC_HIDDEN
;
2644 const struct wined3d_fragment_pipe_ops
*wined3d_spirv_fragment_pipe_init_vk(void) DECLSPEC_HIDDEN
;
2646 extern const struct wined3d_vertex_pipe_ops none_vertex_pipe DECLSPEC_HIDDEN
;
2647 extern const struct wined3d_vertex_pipe_ops ffp_vertex_pipe DECLSPEC_HIDDEN
;
2648 extern const struct wined3d_vertex_pipe_ops glsl_vertex_pipe DECLSPEC_HIDDEN
;
2650 const struct wined3d_vertex_pipe_ops
*wined3d_spirv_vertex_pipe_init_vk(void) DECLSPEC_HIDDEN
;
2652 /* "Base" state table */
2653 HRESULT
compile_state_table(struct wined3d_state_entry
*state_table
, APPLYSTATEFUNC
**dev_multistate_funcs
,
2654 const struct wined3d_d3d_info
*d3d_info
, const BOOL
*supported_extensions
,
2655 const struct wined3d_vertex_pipe_ops
*vertex
, const struct wined3d_fragment_pipe_ops
*fragment
,
2656 const struct wined3d_state_entry_template
*misc
) DECLSPEC_HIDDEN
;
2658 enum wined3d_blit_op
2660 WINED3D_BLIT_OP_COLOR_BLIT
,
2661 WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST
,
2662 WINED3D_BLIT_OP_COLOR_BLIT_CKEY
,
2663 WINED3D_BLIT_OP_DEPTH_BLIT
,
2664 WINED3D_BLIT_OP_RAW_BLIT
,
2667 struct wined3d_blitter
2669 const struct wined3d_blitter_ops
*ops
;
2670 struct wined3d_blitter
*next
;
2673 struct wined3d_blitter_ops
2675 void (*blitter_destroy
)(struct wined3d_blitter
*blitter
, struct wined3d_context
*context
);
2676 void (*blitter_clear
)(struct wined3d_blitter
*blitter
, struct wined3d_device
*device
,
2677 unsigned int rt_count
, const struct wined3d_fb_state
*fb
, unsigned int rect_count
, const RECT
*clear_rects
,
2678 const RECT
*draw_rect
, DWORD flags
, const struct wined3d_color
*colour
, float depth
, DWORD stencil
);
2679 DWORD (*blitter_blit
)(struct wined3d_blitter
*blitter
, enum wined3d_blit_op op
, struct wined3d_context
*context
,
2680 struct wined3d_texture
*src_texture
, unsigned int src_sub_resource_idx
, DWORD src_location
,
2681 const RECT
*src_rect
, struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
2682 DWORD dst_location
, const RECT
*dst_rect
, const struct wined3d_color_key
*colour_key
,
2683 enum wined3d_texture_filter_type filter
);
2686 void wined3d_arbfp_blitter_create(struct wined3d_blitter
**next
,
2687 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2688 struct wined3d_blitter
*wined3d_cpu_blitter_create(void) DECLSPEC_HIDDEN
;
2689 void wined3d_fbo_blitter_create(struct wined3d_blitter
**next
,
2690 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
2691 void wined3d_ffp_blitter_create(struct wined3d_blitter
**next
,
2692 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
2693 struct wined3d_blitter
*wined3d_glsl_blitter_create(struct wined3d_blitter
**next
,
2694 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
2695 void wined3d_raw_blitter_create(struct wined3d_blitter
**next
,
2696 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
2697 void wined3d_vk_blitter_create(struct wined3d_blitter
**next
) DECLSPEC_HIDDEN
;
2699 BOOL
wined3d_clip_blit(const RECT
*clip_rect
, RECT
*clipped
, RECT
*other
) DECLSPEC_HIDDEN
;
2701 HGLRC
context_create_wgl_attribs(const struct wined3d_gl_info
*gl_info
, HDC hdc
, HGLRC share_ctx
) DECLSPEC_HIDDEN
;
2702 DWORD
context_get_tls_idx(void) DECLSPEC_HIDDEN
;
2703 void context_gl_resource_released(struct wined3d_device
*device
,
2704 GLuint name
, BOOL rb_namespace
) DECLSPEC_HIDDEN
;
2705 void context_invalidate_compute_state(struct wined3d_context
*context
, DWORD state_id
) DECLSPEC_HIDDEN
;
2706 void context_invalidate_state(struct wined3d_context
*context
, DWORD state_id
) DECLSPEC_HIDDEN
;
2707 void context_resource_released(const struct wined3d_device
*device
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
2708 void context_restore(struct wined3d_context
*context
, struct wined3d_texture
*texture
,
2709 unsigned int sub_resource_idx
) DECLSPEC_HIDDEN
;
2710 void context_set_tls_idx(DWORD idx
) DECLSPEC_HIDDEN
;
2711 void context_state_drawbuf(struct wined3d_context
*context
,
2712 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
2713 void context_state_fb(struct wined3d_context
*context
,
2714 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
2716 /*****************************************************************************
2717 * Internal representation of a light
2719 struct wined3d_light_info
2721 struct wined3d_light OriginalParms
; /* Note D3D8LIGHT == D3D9LIGHT */
2722 DWORD OriginalIndex
;
2726 /* Converted parms to speed up swapping lights */
2727 struct wined3d_vec4 position
;
2728 struct wined3d_vec4 direction
;
2735 /* The default light parameters */
2736 extern const struct wined3d_light WINED3D_default_light DECLSPEC_HIDDEN
;
2738 struct wined3d_pixel_format
2740 int iPixelFormat
; /* WGL pixel format */
2741 int iPixelType
; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */
2742 int redSize
, greenSize
, blueSize
, alphaSize
, colorSize
;
2743 int depthSize
, stencilSize
;
2744 BOOL windowDrawable
;
2750 enum wined3d_pci_vendor
2752 HW_VENDOR_SOFTWARE
= 0x0000,
2753 HW_VENDOR_AMD
= 0x1002,
2754 HW_VENDOR_NVIDIA
= 0x10de,
2755 HW_VENDOR_VMWARE
= 0x15ad,
2756 HW_VENDOR_REDHAT
= 0x1af4,
2757 HW_VENDOR_INTEL
= 0x8086,
2760 enum wined3d_pci_device
2764 CARD_AMD_RAGE_128PRO
= 0x5246,
2765 CARD_AMD_RADEON_7200
= 0x5144,
2766 CARD_AMD_RADEON_8500
= 0x514c,
2767 CARD_AMD_RADEON_9500
= 0x4144,
2768 CARD_AMD_RADEON_XPRESS_200M
= 0x5955,
2769 CARD_AMD_RADEON_X700
= 0x5e4c,
2770 CARD_AMD_RADEON_X1600
= 0x71c2,
2771 CARD_AMD_RADEON_HD2350
= 0x94c7,
2772 CARD_AMD_RADEON_HD2600
= 0x9581,
2773 CARD_AMD_RADEON_HD2900
= 0x9400,
2774 CARD_AMD_RADEON_HD3200
= 0x9620,
2775 CARD_AMD_RADEON_HD3850
= 0x9515,
2776 CARD_AMD_RADEON_HD4200M
= 0x9712,
2777 CARD_AMD_RADEON_HD4350
= 0x954f,
2778 CARD_AMD_RADEON_HD4600
= 0x9495,
2779 CARD_AMD_RADEON_HD4700
= 0x944e,
2780 CARD_AMD_RADEON_HD4800
= 0x944c,
2781 CARD_AMD_RADEON_HD5400
= 0x68f9,
2782 CARD_AMD_RADEON_HD5600
= 0x68d8,
2783 CARD_AMD_RADEON_HD5700
= 0x68be,
2784 CARD_AMD_RADEON_HD5800
= 0x6898,
2785 CARD_AMD_RADEON_HD5900
= 0x689c,
2786 CARD_AMD_RADEON_HD6300
= 0x9803,
2787 CARD_AMD_RADEON_HD6400
= 0x6770,
2788 CARD_AMD_RADEON_HD6490M
= 0x6760,
2789 CARD_AMD_RADEON_HD6410D
= 0x9644,
2790 CARD_AMD_RADEON_HD6480G
= 0x9648,
2791 CARD_AMD_RADEON_HD6550D
= 0x9640,
2792 CARD_AMD_RADEON_HD6600
= 0x6758,
2793 CARD_AMD_RADEON_HD6600M
= 0x6741,
2794 CARD_AMD_RADEON_HD6700
= 0x68ba,
2795 CARD_AMD_RADEON_HD6800
= 0x6739,
2796 CARD_AMD_RADEON_HD6900
= 0x6719,
2797 CARD_AMD_RADEON_HD7660D
= 0x9901,
2798 CARD_AMD_RADEON_HD7700
= 0x683d,
2799 CARD_AMD_RADEON_HD7800
= 0x6819,
2800 CARD_AMD_RADEON_HD7870
= 0x6818,
2801 CARD_AMD_RADEON_HD7900
= 0x679a,
2802 CARD_AMD_RADEON_HD8600M
= 0x6660,
2803 CARD_AMD_RADEON_HD8670
= 0x6610,
2804 CARD_AMD_RADEON_HD8770
= 0x665c,
2805 CARD_AMD_RADEON_R3
= 0x9830,
2806 CARD_AMD_RADEON_R7
= 0x130f,
2807 CARD_AMD_RADEON_R9_285
= 0x6939,
2808 CARD_AMD_RADEON_R9_290
= 0x67b1,
2809 CARD_AMD_RADEON_R9_290X
= 0x67b0,
2810 CARD_AMD_RADEON_R9_FURY
= 0x7300,
2811 CARD_AMD_RADEON_R9_M370X
= 0x6821,
2812 CARD_AMD_RADEON_R9_M380
= 0x6647,
2813 CARD_AMD_RADEON_R9_M395X
= 0x6920,
2814 CARD_AMD_RADEON_RX_460
= 0x67ef,
2815 CARD_AMD_RADEON_RX_480
= 0x67df,
2816 CARD_AMD_RADEON_RX_VEGA_10
= 0x687f,
2817 CARD_AMD_RADEON_RX_VEGA_12
= 0x69af,
2818 CARD_AMD_RADEON_RX_VEGA_20
= 0x66af,
2819 CARD_AMD_RADEON_RX_NAVI_10
= 0x731f,
2821 CARD_NVIDIA_RIVA_128
= 0x0018,
2822 CARD_NVIDIA_RIVA_TNT
= 0x0020,
2823 CARD_NVIDIA_RIVA_TNT2
= 0x0028,
2824 CARD_NVIDIA_GEFORCE
= 0x0100,
2825 CARD_NVIDIA_GEFORCE2_MX
= 0x0110,
2826 CARD_NVIDIA_GEFORCE2
= 0x0150,
2827 CARD_NVIDIA_GEFORCE3
= 0x0200,
2828 CARD_NVIDIA_GEFORCE4_MX
= 0x0170,
2829 CARD_NVIDIA_GEFORCE4_TI4200
= 0x0253,
2830 CARD_NVIDIA_GEFORCEFX_5200
= 0x0320,
2831 CARD_NVIDIA_GEFORCEFX_5600
= 0x0312,
2832 CARD_NVIDIA_GEFORCEFX_5800
= 0x0302,
2833 CARD_NVIDIA_GEFORCE_6200
= 0x014f,
2834 CARD_NVIDIA_GEFORCE_6600GT
= 0x0140,
2835 CARD_NVIDIA_GEFORCE_6800
= 0x0041,
2836 CARD_NVIDIA_GEFORCE_7300
= 0x01d7, /* GeForce Go 7300 */
2837 CARD_NVIDIA_GEFORCE_7400
= 0x01d8,
2838 CARD_NVIDIA_GEFORCE_7600
= 0x0391,
2839 CARD_NVIDIA_GEFORCE_7800GT
= 0x0092,
2840 CARD_NVIDIA_GEFORCE_8200
= 0x0849, /* Other PCI ID 0x084b */
2841 CARD_NVIDIA_GEFORCE_8300GS
= 0x0423,
2842 CARD_NVIDIA_GEFORCE_8400GS
= 0x0404,
2843 CARD_NVIDIA_GEFORCE_8500GT
= 0x0421,
2844 CARD_NVIDIA_GEFORCE_8600GT
= 0x0402,
2845 CARD_NVIDIA_GEFORCE_8600MGT
= 0x0407,
2846 CARD_NVIDIA_GEFORCE_8800GTS
= 0x0193,
2847 CARD_NVIDIA_GEFORCE_8800GTX
= 0x0191,
2848 CARD_NVIDIA_GEFORCE_9200
= 0x086d,
2849 CARD_NVIDIA_GEFORCE_9300
= 0x086c,
2850 CARD_NVIDIA_GEFORCE_9400M
= 0x0863,
2851 CARD_NVIDIA_GEFORCE_9400GT
= 0x042c,
2852 CARD_NVIDIA_GEFORCE_9500GT
= 0x0640,
2853 CARD_NVIDIA_GEFORCE_9600GT
= 0x0622,
2854 CARD_NVIDIA_GEFORCE_9700MGT
= 0x064a,
2855 CARD_NVIDIA_GEFORCE_9800GT
= 0x0614,
2856 CARD_NVIDIA_GEFORCE_210
= 0x0a23,
2857 CARD_NVIDIA_GEFORCE_GT220
= 0x0a20,
2858 CARD_NVIDIA_GEFORCE_GT240
= 0x0ca3,
2859 CARD_NVIDIA_GEFORCE_GTS250
= 0x0615,
2860 CARD_NVIDIA_GEFORCE_GTX260
= 0x05e2,
2861 CARD_NVIDIA_GEFORCE_GTX275
= 0x05e6,
2862 CARD_NVIDIA_GEFORCE_GTX280
= 0x05e1,
2863 CARD_NVIDIA_GEFORCE_315M
= 0x0a7a,
2864 CARD_NVIDIA_GEFORCE_320M
= 0x08a3,
2865 CARD_NVIDIA_GEFORCE_GT320M
= 0x0a2d,
2866 CARD_NVIDIA_GEFORCE_GT325M
= 0x0a35,
2867 CARD_NVIDIA_GEFORCE_GT330
= 0x0ca0,
2868 CARD_NVIDIA_GEFORCE_GTS350M
= 0x0cb0,
2869 CARD_NVIDIA_GEFORCE_410M
= 0x1055,
2870 CARD_NVIDIA_GEFORCE_GT420
= 0x0de2,
2871 CARD_NVIDIA_GEFORCE_GT425M
= 0x0df0,
2872 CARD_NVIDIA_GEFORCE_GT430
= 0x0de1,
2873 CARD_NVIDIA_GEFORCE_GT440
= 0x0de0,
2874 CARD_NVIDIA_GEFORCE_GTS450
= 0x0dc4,
2875 CARD_NVIDIA_GEFORCE_GTX460
= 0x0e22,
2876 CARD_NVIDIA_GEFORCE_GTX460M
= 0x0dd1,
2877 CARD_NVIDIA_GEFORCE_GTX465
= 0x06c4,
2878 CARD_NVIDIA_GEFORCE_GTX470
= 0x06cd,
2879 CARD_NVIDIA_GEFORCE_GTX480
= 0x06c0,
2880 CARD_NVIDIA_GEFORCE_GT520
= 0x1040,
2881 CARD_NVIDIA_GEFORCE_GT525M
= 0x0dec,
2882 CARD_NVIDIA_GEFORCE_GT540M
= 0x0df4,
2883 CARD_NVIDIA_GEFORCE_GTX550
= 0x1244,
2884 CARD_NVIDIA_GEFORCE_GT555M
= 0x04b8,
2885 CARD_NVIDIA_GEFORCE_GTX560TI
= 0x1200,
2886 CARD_NVIDIA_GEFORCE_GTX560M
= 0x1251,
2887 CARD_NVIDIA_GEFORCE_GTX560
= 0x1201,
2888 CARD_NVIDIA_GEFORCE_GTX570
= 0x1081,
2889 CARD_NVIDIA_GEFORCE_GTX580
= 0x1080,
2890 CARD_NVIDIA_GEFORCE_GT610
= 0x104a,
2891 CARD_NVIDIA_GEFORCE_GT630
= 0x0f00,
2892 CARD_NVIDIA_GEFORCE_GT630M
= 0x0de9,
2893 CARD_NVIDIA_GEFORCE_GT640
= 0x0fc1,
2894 CARD_NVIDIA_GEFORCE_GT640M
= 0x0fd2,
2895 CARD_NVIDIA_GEFORCE_GT650M
= 0x0fd1,
2896 CARD_NVIDIA_GEFORCE_GTX650
= 0x0fc6,
2897 CARD_NVIDIA_GEFORCE_GTX650TI
= 0x11c6,
2898 CARD_NVIDIA_GEFORCE_GTX660
= 0x11c0,
2899 CARD_NVIDIA_GEFORCE_GTX660M
= 0x0fd4,
2900 CARD_NVIDIA_GEFORCE_GTX660TI
= 0x1183,
2901 CARD_NVIDIA_GEFORCE_GTX670
= 0x1189,
2902 CARD_NVIDIA_GEFORCE_GTX670MX
= 0x11a1,
2903 CARD_NVIDIA_GEFORCE_GTX675MX_1
= 0x11a7,
2904 CARD_NVIDIA_GEFORCE_GTX675MX_2
= 0x11a2,
2905 CARD_NVIDIA_GEFORCE_GTX680
= 0x1180,
2906 CARD_NVIDIA_GEFORCE_GTX690
= 0x1188,
2907 CARD_NVIDIA_GEFORCE_GT720
= 0x128b,
2908 CARD_NVIDIA_GEFORCE_GT730
= 0x1287,
2909 CARD_NVIDIA_GEFORCE_GT730M
= 0x0fe1,
2910 CARD_NVIDIA_GEFORCE_GT740M
= 0x1292,
2911 CARD_NVIDIA_GEFORCE_GT750M
= 0x0fe9,
2912 CARD_NVIDIA_GEFORCE_GT755M
= 0x0fcd,
2913 CARD_NVIDIA_GEFORCE_GTX750
= 0x1381,
2914 CARD_NVIDIA_GEFORCE_GTX750TI
= 0x1380,
2915 CARD_NVIDIA_GEFORCE_GTX760
= 0x1187,
2916 CARD_NVIDIA_GEFORCE_GTX760TI
= 0x1193,
2917 CARD_NVIDIA_GEFORCE_GTX765M
= 0x11e2,
2918 CARD_NVIDIA_GEFORCE_GTX770M
= 0x11e0,
2919 CARD_NVIDIA_GEFORCE_GTX770
= 0x1184,
2920 CARD_NVIDIA_GEFORCE_GTX775M
= 0x119d,
2921 CARD_NVIDIA_GEFORCE_GTX780
= 0x1004,
2922 CARD_NVIDIA_GEFORCE_GTX780M
= 0x119e,
2923 CARD_NVIDIA_GEFORCE_GTX780TI
= 0x100a,
2924 CARD_NVIDIA_GEFORCE_GTXTITAN
= 0x1005,
2925 CARD_NVIDIA_GEFORCE_GTXTITANB
= 0x100c,
2926 CARD_NVIDIA_GEFORCE_GTXTITANX
= 0x17c2,
2927 CARD_NVIDIA_GEFORCE_GTXTITANZ
= 0x1001,
2928 CARD_NVIDIA_GEFORCE_820M
= 0x0fed,
2929 CARD_NVIDIA_GEFORCE_830M
= 0x1340,
2930 CARD_NVIDIA_GEFORCE_840M
= 0x1341,
2931 CARD_NVIDIA_GEFORCE_845M
= 0x1344,
2932 CARD_NVIDIA_GEFORCE_GTX850M
= 0x1391,
2933 CARD_NVIDIA_GEFORCE_GTX860M
= 0x1392, /* Other PCI ID 0x119a */
2934 CARD_NVIDIA_GEFORCE_GTX870M
= 0x1199,
2935 CARD_NVIDIA_GEFORCE_GTX880M
= 0x1198,
2936 CARD_NVIDIA_GEFORCE_940M
= 0x1347,
2937 CARD_NVIDIA_GEFORCE_GTX950
= 0x1402,
2938 CARD_NVIDIA_GEFORCE_GTX950M
= 0x139a,
2939 CARD_NVIDIA_GEFORCE_GTX960
= 0x1401,
2940 CARD_NVIDIA_GEFORCE_GTX960M
= 0x139b,
2941 CARD_NVIDIA_GEFORCE_GTX970
= 0x13c2,
2942 CARD_NVIDIA_GEFORCE_GTX970M
= 0x13d8,
2943 CARD_NVIDIA_GEFORCE_GTX980
= 0x13c0,
2944 CARD_NVIDIA_GEFORCE_GTX980TI
= 0x17c8,
2945 CARD_NVIDIA_GEFORCE_GTX1050
= 0x1c81,
2946 CARD_NVIDIA_GEFORCE_GTX1050TI
= 0x1c82,
2947 CARD_NVIDIA_GEFORCE_GTX1060_3GB
= 0x1c02,
2948 CARD_NVIDIA_GEFORCE_GTX1060
= 0x1c03,
2949 CARD_NVIDIA_GEFORCE_GTX1070
= 0x1b81,
2950 CARD_NVIDIA_GEFORCE_GTX1080
= 0x1b80,
2951 CARD_NVIDIA_GEFORCE_GTX1080TI
= 0x1b06,
2952 CARD_NVIDIA_TITANX_PASCAL
= 0x1b00,
2953 CARD_NVIDIA_TITANV
= 0x1d81,
2954 CARD_NVIDIA_GEFORCE_GTX1650SUPER
= 0x2187,
2955 CARD_NVIDIA_GEFORCE_GTX1660SUPER
= 0x21c4,
2956 CARD_NVIDIA_GEFORCE_GTX1660TI
= 0x2182,
2957 CARD_NVIDIA_GEFORCE_RTX2060
= 0x1f08,
2958 CARD_NVIDIA_GEFORCE_RTX2070
= 0x1f07,
2959 CARD_NVIDIA_GEFORCE_RTX2080
= 0x1e87,
2960 CARD_NVIDIA_GEFORCE_RTX2080TI
= 0x1e07,
2962 CARD_REDHAT_VIRGL
= 0x1010,
2964 CARD_VMWARE_SVGA3D
= 0x0405,
2966 CARD_INTEL_830M
= 0x3577,
2967 CARD_INTEL_855GM
= 0x3582,
2968 CARD_INTEL_845G
= 0x2562,
2969 CARD_INTEL_865G
= 0x2572,
2970 CARD_INTEL_915G
= 0x2582,
2971 CARD_INTEL_E7221G
= 0x258a,
2972 CARD_INTEL_915GM
= 0x2592,
2973 CARD_INTEL_945G
= 0x2772,
2974 CARD_INTEL_945GM
= 0x27a2,
2975 CARD_INTEL_945GME
= 0x27ae,
2976 CARD_INTEL_Q35
= 0x29b2,
2977 CARD_INTEL_G33
= 0x29c2,
2978 CARD_INTEL_Q33
= 0x29d2,
2979 CARD_INTEL_PNVG
= 0xa001,
2980 CARD_INTEL_PNVM
= 0xa011,
2981 CARD_INTEL_965Q
= 0x2992,
2982 CARD_INTEL_965G
= 0x2982,
2983 CARD_INTEL_946GZ
= 0x2972,
2984 CARD_INTEL_965GM
= 0x2a02,
2985 CARD_INTEL_965GME
= 0x2a12,
2986 CARD_INTEL_GM45
= 0x2a42,
2987 CARD_INTEL_IGD
= 0x2e02,
2988 CARD_INTEL_Q45
= 0x2e12,
2989 CARD_INTEL_G45
= 0x2e22,
2990 CARD_INTEL_G41
= 0x2e32,
2991 CARD_INTEL_B43
= 0x2e92,
2992 CARD_INTEL_ILKD
= 0x0042,
2993 CARD_INTEL_ILKM
= 0x0046,
2994 CARD_INTEL_SNBD
= 0x0122,
2995 CARD_INTEL_SNBM
= 0x0126,
2996 CARD_INTEL_SNBS
= 0x010a,
2997 CARD_INTEL_IVBD
= 0x0162,
2998 CARD_INTEL_IVBM
= 0x0166,
2999 CARD_INTEL_IVBS
= 0x015a,
3000 CARD_INTEL_HWD
= 0x0412,
3001 CARD_INTEL_HWM
= 0x0416,
3002 CARD_INTEL_HD5000_1
= 0x0a26,
3003 CARD_INTEL_HD5000_2
= 0x0422,
3004 CARD_INTEL_I5100_1
= 0x0a22,
3005 CARD_INTEL_I5100_2
= 0x0a2a,
3006 CARD_INTEL_I5100_3
= 0x0a2b,
3007 CARD_INTEL_I5100_4
= 0x0a2e,
3008 CARD_INTEL_IP5200_1
= 0x0d22,
3009 CARD_INTEL_IP5200_2
= 0x0d26,
3010 CARD_INTEL_IP5200_3
= 0x0d2a,
3011 CARD_INTEL_IP5200_4
= 0x0d2b,
3012 CARD_INTEL_IP5200_5
= 0x0d2e,
3013 CARD_INTEL_IP5200_6
= 0x0c22,
3014 CARD_INTEL_HD5300
= 0x161e,
3015 CARD_INTEL_HD5500
= 0x1616,
3016 CARD_INTEL_HD5600
= 0x1612,
3017 CARD_INTEL_HD6000
= 0x1626,
3018 CARD_INTEL_I6100
= 0x162b,
3019 CARD_INTEL_IP6200
= 0x1622,
3020 CARD_INTEL_IPP6300
= 0x162a,
3021 CARD_INTEL_HD510_1
= 0x1902,
3022 CARD_INTEL_HD510_2
= 0x1906,
3023 CARD_INTEL_HD510_3
= 0x190b,
3024 CARD_INTEL_HD515
= 0x191e,
3025 CARD_INTEL_HD520_1
= 0x1916,
3026 CARD_INTEL_HD520_2
= 0x1921,
3027 CARD_INTEL_HD530_1
= 0x1912,
3028 CARD_INTEL_HD530_2
= 0x191b,
3029 CARD_INTEL_HDP530
= 0x191d,
3030 CARD_INTEL_I540
= 0x1926,
3031 CARD_INTEL_I550
= 0x1927,
3032 CARD_INTEL_I555
= 0x192b,
3033 CARD_INTEL_IP555
= 0x192d,
3034 CARD_INTEL_IP580_1
= 0x1932,
3035 CARD_INTEL_IP580_2
= 0x193b,
3036 CARD_INTEL_IPP580_1
= 0x193a,
3037 CARD_INTEL_IPP580_2
= 0x193d,
3038 CARD_INTEL_UHD617
= 0x87c0,
3039 CARD_INTEL_UHD620
= 0x3ea0,
3040 CARD_INTEL_HD615
= 0x591e,
3041 CARD_INTEL_HD620
= 0x5916,
3042 CARD_INTEL_HD630_1
= 0x5912,
3043 CARD_INTEL_HD630_2
= 0x591b,
3046 struct wined3d_fbo_ops
3048 GLboolean (WINE_GLAPI
*glIsRenderbuffer
)(GLuint renderbuffer
);
3049 void (WINE_GLAPI
*glBindRenderbuffer
)(GLenum target
, GLuint renderbuffer
);
3050 void (WINE_GLAPI
*glDeleteRenderbuffers
)(GLsizei n
, const GLuint
*renderbuffers
);
3051 void (WINE_GLAPI
*glGenRenderbuffers
)(GLsizei n
, GLuint
*renderbuffers
);
3052 void (WINE_GLAPI
*glRenderbufferStorage
)(GLenum target
, GLenum internalformat
,
3053 GLsizei width
, GLsizei height
);
3054 void (WINE_GLAPI
*glRenderbufferStorageMultisample
)(GLenum target
, GLsizei samples
,
3055 GLenum internalformat
, GLsizei width
, GLsizei height
);
3056 void (WINE_GLAPI
*glGetRenderbufferParameteriv
)(GLenum target
, GLenum pname
, GLint
*params
);
3057 GLboolean (WINE_GLAPI
*glIsFramebuffer
)(GLuint framebuffer
);
3058 void (WINE_GLAPI
*glBindFramebuffer
)(GLenum target
, GLuint framebuffer
);
3059 void (WINE_GLAPI
*glDeleteFramebuffers
)(GLsizei n
, const GLuint
*framebuffers
);
3060 void (WINE_GLAPI
*glGenFramebuffers
)(GLsizei n
, GLuint
*framebuffers
);
3061 GLenum (WINE_GLAPI
*glCheckFramebufferStatus
)(GLenum target
);
3062 void (WINE_GLAPI
*glFramebufferTexture
)(GLenum target
, GLenum attachment
,
3063 GLuint texture
, GLint level
);
3064 void (WINE_GLAPI
*glFramebufferTexture1D
)(GLenum target
, GLenum attachment
,
3065 GLenum textarget
, GLuint texture
, GLint level
);
3066 void (WINE_GLAPI
*glFramebufferTexture2D
)(GLenum target
, GLenum attachment
,
3067 GLenum textarget
, GLuint texture
, GLint level
);
3068 void (WINE_GLAPI
*glFramebufferTexture3D
)(GLenum target
, GLenum attachment
,
3069 GLenum textarget
, GLuint texture
, GLint level
, GLint layer
);
3070 void (WINE_GLAPI
*glFramebufferTextureLayer
)(GLenum target
, GLenum attachment
,
3071 GLuint texture
, GLint level
, GLint layer
);
3072 void (WINE_GLAPI
*glFramebufferRenderbuffer
)(GLenum target
, GLenum attachment
,
3073 GLenum renderbuffertarget
, GLuint renderbuffer
);
3074 void (WINE_GLAPI
*glGetFramebufferAttachmentParameteriv
)(GLenum target
, GLenum attachment
,
3075 GLenum pname
, GLint
*params
);
3076 void (WINE_GLAPI
*glBlitFramebuffer
)(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
3077 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
, GLbitfield mask
, GLenum filter
);
3078 void (WINE_GLAPI
*glGenerateMipmap
)(GLenum target
);
3081 struct wined3d_gl_limits
3086 UINT texture_coords
;
3087 unsigned int uniform_blocks
[WINED3D_SHADER_TYPE_COUNT
];
3088 unsigned int samplers
[WINED3D_SHADER_TYPE_COUNT
];
3089 unsigned int graphics_samplers
;
3090 unsigned int combined_samplers
;
3091 UINT general_combiners
;
3092 UINT user_clip_distances
;
3093 unsigned int texture_size
;
3094 UINT texture3d_size
;
3098 UINT vertex_attribs
;
3100 unsigned int texture_buffer_offset_alignment
;
3102 unsigned int framebuffer_width
;
3103 unsigned int framebuffer_height
;
3106 UINT glsl_vs_float_constants
;
3107 UINT glsl_ps_float_constants
;
3109 UINT arb_vs_float_constants
;
3110 UINT arb_vs_native_constants
;
3111 UINT arb_vs_instructions
;
3113 UINT arb_ps_float_constants
;
3114 UINT arb_ps_local_constants
;
3115 UINT arb_ps_native_constants
;
3116 UINT arb_ps_instructions
;
3120 void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits
*gl_limits
,
3121 enum wined3d_shader_type shader_type
, unsigned int *base
, unsigned int *count
) DECLSPEC_HIDDEN
;
3122 void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits
*gl_limits
,
3123 enum wined3d_shader_type shader_type
, unsigned int *base
, unsigned int *count
) DECLSPEC_HIDDEN
;
3125 struct wined3d_gl_info
3127 DWORD selected_gl_version
;
3129 struct wined3d_gl_limits limits
;
3130 DWORD reserved_glsl_constants
, reserved_arb_constants
;
3132 BOOL supported
[WINED3D_GL_EXT_COUNT
];
3133 GLint wrap_lookup
[WINED3D_TADDRESS_MIRROR_ONCE
- WINED3D_TADDRESS_WRAP
+ 1];
3135 HGLRC (WINAPI
*p_wglCreateContextAttribsARB
)(HDC dc
, HGLRC share
, const GLint
*attribs
);
3136 struct opengl_funcs gl_ops
;
3137 struct wined3d_fbo_ops fbo_ops
;
3139 void (WINE_GLAPI
*p_glDisableWINE
)(GLenum cap
);
3140 void (WINE_GLAPI
*p_glEnableWINE
)(GLenum cap
);
3143 /* The driver names reflect the lowest GPU supported
3144 * by a certain driver, so DRIVER_AMD_R300 supports
3145 * R3xx, R4xx and R5xx GPUs. */
3146 enum wined3d_display_driver
3148 DRIVER_AMD_RAGE_128PRO
,
3153 DRIVER_INTEL_GMA800
,
3154 DRIVER_INTEL_GMA900
,
3155 DRIVER_INTEL_GMA950
,
3156 DRIVER_INTEL_GMA3000
,
3157 DRIVER_INTEL_HD4000
,
3159 DRIVER_NVIDIA_GEFORCE2MX
,
3160 DRIVER_NVIDIA_GEFORCEFX
,
3161 DRIVER_NVIDIA_GEFORCE6
,
3162 DRIVER_NVIDIA_GEFORCE8
,
3163 DRIVER_REDHAT_VIRGL
,
3169 struct wined3d_gpu_description
3171 enum wined3d_pci_vendor vendor
;
3172 enum wined3d_pci_device device
;
3173 const char *description
;
3174 enum wined3d_display_driver driver
;
3175 unsigned int vidmem
;
3178 const struct wined3d_gpu_description
*wined3d_get_gpu_description(enum wined3d_pci_vendor vendor
,
3179 enum wined3d_pci_device device
) DECLSPEC_HIDDEN
;
3180 const struct wined3d_gpu_description
*wined3d_get_user_override_gpu_description(enum wined3d_pci_vendor vendor
,
3181 enum wined3d_pci_device device
) DECLSPEC_HIDDEN
;
3182 enum wined3d_pci_device
wined3d_gpu_from_feature_level(enum wined3d_pci_vendor
*vendor
,
3183 enum wined3d_feature_level feature_level
) DECLSPEC_HIDDEN
;
3185 /* 512 in Direct3D 8/9, 128 in DXGI. */
3186 #define WINED3D_MAX_DEVICE_IDENTIFIER_LENGTH 512
3188 struct wined3d_driver_info
3190 enum wined3d_pci_vendor vendor
;
3191 enum wined3d_pci_device device
;
3193 char description
[WINED3D_MAX_DEVICE_IDENTIFIER_LENGTH
];
3195 UINT64 sysmem_bytes
;
3200 void wined3d_driver_info_init(struct wined3d_driver_info
*driver_info
,
3201 const struct wined3d_gpu_description
*gpu_description
,
3202 UINT64 vram_bytes
, UINT64 sysmem_bytes
) DECLSPEC_HIDDEN
;
3204 struct wined3d_adapter_ops
3206 void (*adapter_destroy
)(struct wined3d_adapter
*adapter
);
3207 HRESULT (*adapter_create_device
)(struct wined3d
*wined3d
, const struct wined3d_adapter
*adapter
,
3208 enum wined3d_device_type device_type
, HWND focus_window
, unsigned int flags
,
3209 BYTE surface_alignment
, const enum wined3d_feature_level
*levels
, unsigned int level_count
,
3210 struct wined3d_device_parent
*device_parent
, struct wined3d_device
**device
);
3211 void (*adapter_destroy_device
)(struct wined3d_device
*device
);
3212 struct wined3d_context
*(*adapter_acquire_context
)(struct wined3d_device
*device
,
3213 struct wined3d_texture
*texture
, unsigned int sub_resource_idx
);
3214 void (*adapter_release_context
)(struct wined3d_context
*context
);
3215 void (*adapter_get_wined3d_caps
)(const struct wined3d_adapter
*adapter
, struct wined3d_caps
*caps
);
3216 BOOL (*adapter_check_format
)(const struct wined3d_adapter
*adapter
,
3217 const struct wined3d_format
*adapter_format
, const struct wined3d_format
*rt_format
,
3218 const struct wined3d_format
*ds_format
);
3219 HRESULT (*adapter_init_3d
)(struct wined3d_device
*device
);
3220 void (*adapter_uninit_3d
)(struct wined3d_device
*device
);
3221 void *(*adapter_map_bo_address
)(struct wined3d_context
*context
,
3222 const struct wined3d_bo_address
*data
, size_t size
, uint32_t map_flags
);
3223 void (*adapter_unmap_bo_address
)(struct wined3d_context
*context
, const struct wined3d_bo_address
*data
,
3224 unsigned int range_count
, const struct wined3d_range
*ranges
);
3225 void (*adapter_copy_bo_address
)(struct wined3d_context
*context
,
3226 const struct wined3d_bo_address
*dst
, const struct wined3d_bo_address
*src
, size_t size
);
3227 HRESULT (*adapter_create_swapchain
)(struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
3228 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_swapchain
**swapchain
);
3229 void (*adapter_destroy_swapchain
)(struct wined3d_swapchain
*swapchain
);
3230 HRESULT (*adapter_create_buffer
)(struct wined3d_device
*device
, const struct wined3d_buffer_desc
*desc
,
3231 const struct wined3d_sub_resource_data
*data
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3232 struct wined3d_buffer
**buffer
);
3233 void (*adapter_destroy_buffer
)(struct wined3d_buffer
*buffer
);
3234 HRESULT (*adapter_create_texture
)(struct wined3d_device
*device
, const struct wined3d_resource_desc
*desc
,
3235 unsigned int layer_count
, unsigned int level_count
, uint32_t flags
, void *parent
,
3236 const struct wined3d_parent_ops
*parent_ops
, struct wined3d_texture
**texture
);
3237 void (*adapter_destroy_texture
)(struct wined3d_texture
*texture
);
3238 HRESULT (*adapter_create_rendertarget_view
)(const struct wined3d_view_desc
*desc
,
3239 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3240 struct wined3d_rendertarget_view
**view
);
3241 void (*adapter_destroy_rendertarget_view
)(struct wined3d_rendertarget_view
*view
);
3242 HRESULT (*adapter_create_shader_resource_view
)(const struct wined3d_view_desc
*desc
,
3243 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3244 struct wined3d_shader_resource_view
**view
);
3245 void (*adapter_destroy_shader_resource_view
)(struct wined3d_shader_resource_view
*view
);
3246 HRESULT (*adapter_create_unordered_access_view
)(const struct wined3d_view_desc
*desc
,
3247 struct wined3d_resource
*resource
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3248 struct wined3d_unordered_access_view
**view
);
3249 void (*adapter_destroy_unordered_access_view
)(struct wined3d_unordered_access_view
*view
);
3250 HRESULT (*adapter_create_sampler
)(struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
3251 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_sampler
**sampler
);
3252 void (*adapter_destroy_sampler
)(struct wined3d_sampler
*sampler
);
3253 HRESULT (*adapter_create_query
)(struct wined3d_device
*device
, enum wined3d_query_type type
,
3254 void *parent
, const struct wined3d_parent_ops
*parent_ops
, struct wined3d_query
**query
);
3255 void (*adapter_destroy_query
)(struct wined3d_query
*query
);
3256 void (*adapter_flush_context
)(struct wined3d_context
*context
);
3257 void (*adapter_draw_primitive
)(struct wined3d_device
*device
, const struct wined3d_state
*state
,
3258 const struct wined3d_draw_parameters
*parameters
);
3259 void (*adapter_dispatch_compute
)(struct wined3d_device
*device
, const struct wined3d_state
*state
,
3260 const struct wined3d_dispatch_parameters
*parameters
);
3261 void (*adapter_clear_uav
)(struct wined3d_context
*context
,
3262 struct wined3d_unordered_access_view
*view
, const struct wined3d_uvec4
*clear_value
);
3265 struct wined3d_output
3267 unsigned int ordinal
;
3268 WCHAR device_name
[CCHDEVICENAME
];
3269 struct wined3d_adapter
*adapter
;
3270 enum wined3d_format_id screen_format
;
3272 D3DKMT_HANDLE kmt_adapter
;
3273 D3DKMT_HANDLE kmt_device
;
3274 D3DDDI_VIDEO_PRESENT_SOURCE_ID vidpn_source_id
;
3277 /* The adapter structure */
3278 struct wined3d_adapter
3280 unsigned int ordinal
;
3282 struct wined3d_gl_info gl_info
;
3283 struct wined3d_d3d_info d3d_info
;
3284 struct wined3d_driver_info driver_info
;
3285 struct wined3d_output
*outputs
;
3286 unsigned int output_count
;
3287 UINT64 vram_bytes_used
;
3292 WCHAR device_name
[CCHDEVICENAME
]; /* for use with e.g. ChangeDisplaySettings() */
3297 const struct wined3d_vertex_pipe_ops
*vertex_pipe
;
3298 const struct wined3d_fragment_pipe_ops
*fragment_pipe
;
3299 const struct wined3d_state_entry_template
*misc_state_template
;
3300 const struct wined3d_shader_backend_ops
*shader_backend
;
3301 const struct wined3d_adapter_ops
*adapter_ops
;
3304 BOOL
wined3d_adapter_init(struct wined3d_adapter
*adapter
, unsigned int ordinal
,
3305 const struct wined3d_adapter_ops
*adapter_ops
) DECLSPEC_HIDDEN
;
3306 void wined3d_adapter_cleanup(struct wined3d_adapter
*adapter
) DECLSPEC_HIDDEN
;
3308 struct wined3d_adapter_gl
3310 struct wined3d_adapter a
;
3312 struct wined3d_pixel_format
*pixel_formats
;
3313 unsigned int pixel_format_count
;
3316 static inline struct wined3d_adapter_gl
*wined3d_adapter_gl(struct wined3d_adapter
*adapter
)
3318 return CONTAINING_RECORD(adapter
, struct wined3d_adapter_gl
, a
);
3321 static inline const struct wined3d_adapter_gl
*wined3d_adapter_gl_const(const struct wined3d_adapter
*adapter
)
3323 return CONTAINING_RECORD(adapter
, struct wined3d_adapter_gl
, a
);
3326 struct wined3d_adapter
*wined3d_adapter_gl_create(unsigned int ordinal
,
3327 unsigned int wined3d_creation_flags
) DECLSPEC_HIDDEN
;
3329 struct wined3d_adapter_vk
3331 struct wined3d_adapter a
;
3333 struct wined3d_vk_info vk_info
;
3334 VkPhysicalDevice physical_device
;
3336 VkPhysicalDeviceLimits device_limits
;
3337 VkPhysicalDeviceMemoryProperties memory_properties
;
3340 static inline struct wined3d_adapter_vk
*wined3d_adapter_vk(struct wined3d_adapter
*adapter
)
3342 return CONTAINING_RECORD(adapter
, struct wined3d_adapter_vk
, a
);
3345 struct wined3d_adapter
*wined3d_adapter_vk_create(unsigned int ordinal
,
3346 unsigned int wined3d_creation_flags
) DECLSPEC_HIDDEN
;
3347 unsigned int wined3d_adapter_vk_get_memory_type_index(const struct wined3d_adapter_vk
*adapter_vk
,
3348 uint32_t memory_type_mask
, VkMemoryPropertyFlags flags
) DECLSPEC_HIDDEN
;
3350 struct wined3d_caps_gl_ctx
3356 HGLRC restore_gl_ctx
;
3358 const struct wined3d_gl_info
*gl_info
;
3360 GLuint test_program_id
;
3363 BOOL
wined3d_adapter_gl_init_format_info(struct wined3d_adapter
*adapter
,
3364 struct wined3d_caps_gl_ctx
*ctx
) DECLSPEC_HIDDEN
;
3365 BOOL
wined3d_adapter_no3d_init_format_info(struct wined3d_adapter
*adapter
) DECLSPEC_HIDDEN
;
3366 BOOL
wined3d_adapter_vk_init_format_info(struct wined3d_adapter_vk
*adapter_vk
,
3367 const struct wined3d_vk_info
*vk_info
) DECLSPEC_HIDDEN
;
3368 UINT64
adapter_adjust_memory(struct wined3d_adapter
*adapter
, INT64 amount
) DECLSPEC_HIDDEN
;
3370 BOOL
wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx
*ctx
) DECLSPEC_HIDDEN
;
3372 void install_gl_compat_wrapper(struct wined3d_gl_info
*gl_info
, enum wined3d_gl_extension ext
) DECLSPEC_HIDDEN
;
3374 enum wined3d_projection_type
3376 WINED3D_PROJECTION_NONE
= 0,
3377 WINED3D_PROJECTION_COUNT3
= 1,
3378 WINED3D_PROJECTION_COUNT4
= 2
3381 /*****************************************************************************
3382 * Fixed function pipeline replacements
3384 #define ARG_UNUSED 0xff
3385 struct texture_stage_op
3397 struct color_fixup_desc color_fixup
;
3398 unsigned tex_type
: 3;
3399 unsigned tmp_dst
: 1;
3400 unsigned projected
: 2;
3401 unsigned padding
: 10;
3404 struct ffp_frag_settings
3406 struct texture_stage_op op
[WINED3D_MAX_TEXTURES
];
3407 enum wined3d_ffp_ps_fog_mode fog
;
3408 unsigned char sRGB_write
;
3409 unsigned char emul_clipplanes
;
3410 unsigned char texcoords_initialized
;
3411 unsigned char color_key_enabled
: 1;
3412 unsigned char pointsprite
: 1;
3413 unsigned char flatshading
: 1;
3414 unsigned char alpha_test_func
: 3;
3415 unsigned char padding
: 2;
3418 struct ffp_frag_desc
3420 struct wine_rb_entry entry
;
3421 struct ffp_frag_settings settings
;
3424 int wined3d_ffp_frag_program_key_compare(const void *key
, const struct wine_rb_entry
*entry
) DECLSPEC_HIDDEN
;
3425 int wined3d_ffp_vertex_program_key_compare(const void *key
, const struct wine_rb_entry
*entry
) DECLSPEC_HIDDEN
;
3427 extern const struct wined3d_parent_ops wined3d_null_parent_ops DECLSPEC_HIDDEN
;
3429 void gen_ffp_frag_op(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
3430 struct ffp_frag_settings
*settings
, BOOL ignore_textype
) DECLSPEC_HIDDEN
;
3431 const struct ffp_frag_desc
*find_ffp_frag_shader(const struct wine_rb_tree
*fragment_shaders
,
3432 const struct ffp_frag_settings
*settings
) DECLSPEC_HIDDEN
;
3433 void add_ffp_frag_shader(struct wine_rb_tree
*shaders
, struct ffp_frag_desc
*desc
) DECLSPEC_HIDDEN
;
3434 void wined3d_ftoa(float value
, char *s
) DECLSPEC_HIDDEN
;
3436 enum wined3d_ffp_vs_fog_mode
3438 WINED3D_FFP_VS_FOG_OFF
= 0,
3439 WINED3D_FFP_VS_FOG_FOGCOORD
= 1,
3440 WINED3D_FFP_VS_FOG_DEPTH
= 2,
3441 WINED3D_FFP_VS_FOG_RANGE
= 3,
3444 #define WINED3D_FFP_TCI_SHIFT 16
3445 #define WINED3D_FFP_TCI_MASK 0xffu
3447 #define WINED3D_FFP_LIGHT_TYPE_SHIFT(idx) (3 * (idx))
3448 #define WINED3D_FFP_LIGHT_TYPE_MASK 0x7u
3450 struct wined3d_ffp_vs_settings
3452 DWORD point_light_count
: 4;
3453 DWORD spot_light_count
: 4;
3454 DWORD directional_light_count
: 4;
3455 DWORD parallel_point_light_count
: 4;
3456 DWORD diffuse_source
: 2;
3457 DWORD emissive_source
: 2;
3458 DWORD ambient_source
: 2;
3459 DWORD specular_source
: 2;
3460 DWORD transformed
: 1;
3461 DWORD vertexblends
: 2;
3464 DWORD normalize
: 1;
3466 DWORD localviewer
: 1;
3468 DWORD point_size
: 1;
3469 DWORD per_vertex_point_size
: 1;
3471 DWORD texcoords
: 8; /* WINED3D_MAX_TEXTURES */
3472 DWORD ortho_fog
: 1;
3473 DWORD flatshading
: 1;
3474 DWORD swizzle_map
: 16; /* MAX_ATTRIBS, 16 */
3477 DWORD texgen
[WINED3D_MAX_TEXTURES
];
3480 struct wined3d_ffp_vs_desc
3482 struct wine_rb_entry entry
;
3483 struct wined3d_ffp_vs_settings settings
;
3486 void wined3d_ffp_get_vs_settings(const struct wined3d_context
*context
,
3487 const struct wined3d_state
*state
, struct wined3d_ffp_vs_settings
*settings
) DECLSPEC_HIDDEN
;
3493 unsigned int adapter_count
;
3494 struct wined3d_adapter
*adapters
[1];
3497 BOOL
wined3d_filter_messages(HWND window
, BOOL filter
) DECLSPEC_HIDDEN
;
3498 void wined3d_hook_swapchain(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
3499 HRESULT
wined3d_init(struct wined3d
*wined3d
, DWORD flags
) DECLSPEC_HIDDEN
;
3500 void wined3d_unhook_swapchain(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
3501 void wined3d_unregister_window(HWND window
) DECLSPEC_HIDDEN
;
3503 BOOL
wined3d_get_app_name(char *app_name
, unsigned int app_name_size
) DECLSPEC_HIDDEN
;
3505 struct wined3d_blend_state
3508 struct wined3d_blend_state_desc desc
;
3512 const struct wined3d_parent_ops
*parent_ops
;
3514 struct wined3d_device
*device
;
3515 struct wine_rb_entry entry
;
3518 static inline unsigned int wined3d_blend_state_get_writemask(const struct wined3d_blend_state
*state
,
3523 if (!state
->desc
.independent
)
3525 return state
->desc
.rt
[index
].writemask
;
3528 struct wined3d_rasterizer_state
3531 struct wined3d_rasterizer_state_desc desc
;
3534 const struct wined3d_parent_ops
*parent_ops
;
3536 struct wined3d_device
*device
;
3537 struct wine_rb_entry entry
;
3540 struct wined3d_stream_output
3542 struct wined3d_buffer
*buffer
;
3546 #define LIGHTMAP_SIZE 43
3547 #define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE)
3549 struct wined3d_light_state
3551 /* Light hashmap. Collisions are handled using linked lists. */
3552 struct list light_map
[LIGHTMAP_SIZE
];
3553 const struct wined3d_light_info
*lights
[WINED3D_MAX_ACTIVE_LIGHTS
];
3556 #define WINED3D_STATE_NO_REF 0x00000001
3557 #define WINED3D_STATE_INIT_DEFAULT 0x00000002
3559 struct wined3d_state
3562 struct wined3d_fb_state fb
;
3564 struct wined3d_vertex_declaration
*vertex_declaration
;
3565 struct wined3d_stream_output stream_output
[WINED3D_MAX_STREAM_OUTPUT_BUFFERS
];
3566 struct wined3d_stream_state streams
[WINED3D_MAX_STREAMS
];
3567 struct wined3d_buffer
*index_buffer
;
3568 enum wined3d_format_id index_format
;
3569 unsigned int index_offset
;
3570 int base_vertex_index
;
3571 int load_base_vertex_index
; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */
3572 enum wined3d_primitive_type primitive_type
;
3573 unsigned int patch_vertex_count
;
3574 struct wined3d_query
*predicate
;
3575 BOOL predicate_value
;
3577 struct wined3d_shader
*shader
[WINED3D_SHADER_TYPE_COUNT
];
3578 struct wined3d_buffer
*cb
[WINED3D_SHADER_TYPE_COUNT
][MAX_CONSTANT_BUFFERS
];
3579 struct wined3d_sampler
*sampler
[WINED3D_SHADER_TYPE_COUNT
][MAX_SAMPLER_OBJECTS
];
3580 struct wined3d_shader_resource_view
*shader_resource_view
[WINED3D_SHADER_TYPE_COUNT
][MAX_SHADER_RESOURCE_VIEWS
];
3581 struct wined3d_unordered_access_view
*unordered_access_view
[WINED3D_PIPELINE_COUNT
][MAX_UNORDERED_ACCESS_VIEWS
];
3583 struct wined3d_vec4 vs_consts_f
[WINED3D_MAX_VS_CONSTS_F
];
3584 struct wined3d_ivec4 vs_consts_i
[WINED3D_MAX_CONSTS_I
];
3585 BOOL vs_consts_b
[WINED3D_MAX_CONSTS_B
];
3587 struct wined3d_vec4 ps_consts_f
[WINED3D_MAX_PS_CONSTS_F
];
3588 struct wined3d_ivec4 ps_consts_i
[WINED3D_MAX_CONSTS_I
];
3589 BOOL ps_consts_b
[WINED3D_MAX_CONSTS_B
];
3591 struct wined3d_texture
*textures
[WINED3D_MAX_COMBINED_SAMPLERS
];
3592 DWORD sampler_states
[WINED3D_MAX_COMBINED_SAMPLERS
][WINED3D_HIGHEST_SAMPLER_STATE
+ 1];
3593 DWORD texture_states
[WINED3D_MAX_TEXTURES
][WINED3D_HIGHEST_TEXTURE_STATE
+ 1];
3595 struct wined3d_matrix transforms
[WINED3D_HIGHEST_TRANSFORM_STATE
+ 1];
3596 struct wined3d_vec4 clip_planes
[WINED3D_MAX_CLIP_DISTANCES
];
3597 struct wined3d_material material
;
3598 struct wined3d_viewport viewports
[WINED3D_MAX_VIEWPORTS
];
3599 unsigned int viewport_count
;
3600 RECT scissor_rects
[WINED3D_MAX_VIEWPORTS
];
3601 unsigned int scissor_rect_count
;
3603 struct wined3d_light_state light_state
;
3605 DWORD render_states
[WINEHIGHEST_RENDER_STATE
+ 1];
3606 struct wined3d_blend_state
*blend_state
;
3607 struct wined3d_color blend_factor
;
3608 struct wined3d_rasterizer_state
*rasterizer_state
;
3611 struct wined3d_dummy_textures
3618 GLuint tex_cube_array
;
3619 GLuint tex_1d_array
;
3620 GLuint tex_2d_array
;
3623 GLuint tex_2d_ms_array
;
3626 #define WINED3D_UNMAPPED_STAGE ~0u
3628 /* Multithreaded flag. Removed from the public header to signal that
3629 * wined3d_device_create() ignores it. */
3630 #define WINED3DCREATE_MULTITHREADED 0x00000004
3632 struct wined3d_device
3636 /* WineD3D Information */
3637 struct wined3d_device_parent
*device_parent
;
3638 struct wined3d
*wined3d
;
3639 struct wined3d_adapter
*adapter
;
3641 const struct wined3d_shader_backend_ops
*shader_backend
;
3643 void *fragment_priv
;
3645 struct wined3d_state_entry state_table
[STATE_HIGHEST
+ 1];
3646 /* Array of functions for states which are handled by more than one pipeline part */
3647 APPLYSTATEFUNC
*multistate_funcs
[STATE_HIGHEST
+ 1];
3648 struct wined3d_blitter
*blitter
;
3650 BYTE bCursorVisible
: 1;
3651 BYTE d3d_initialized
: 1;
3652 BYTE inScene
: 1; /* A flag to check for proper BeginScene / EndScene call pairs */
3653 BYTE softwareVertexProcessing
: 1; /* process vertex shaders using software or hardware */
3654 BYTE restore_screensaver
: 1;
3657 unsigned char surface_alignment
; /* Line Alignment of surfaces */
3661 enum wined3d_feature_level feature_level
;
3663 struct wined3d_state state
;
3665 /* Internal use fields */
3666 struct wined3d_device_creation_parameters create_parms
;
3669 struct wined3d_rendertarget_view
*back_buffer_view
;
3670 struct wined3d_swapchain
**swapchains
;
3671 UINT swapchain_count
;
3672 unsigned int max_frame_latency
;
3674 struct list resources
; /* a linked list to track resources created by the device */
3675 struct list shaders
; /* a linked list to track shaders (pixel and vertex) */
3676 struct wine_rb_tree samplers
, rasterizer_states
, blend_states
;
3678 /* Render Target Support */
3679 struct wined3d_rendertarget_view
*auto_depth_stencil_view
;
3681 /* Cursor management */
3686 UINT cursorWidth
, cursorHeight
;
3687 struct wined3d_texture
*cursor_texture
;
3688 HCURSOR hardwareCursor
;
3690 /* The Wine logo texture */
3691 struct wined3d_texture
*logo_texture
;
3693 /* Default sampler used to emulate the direct resource access without using wined3d_sampler */
3694 struct wined3d_sampler
*default_sampler
;
3695 struct wined3d_sampler
*null_sampler
;
3697 /* Command stream */
3698 struct wined3d_cs
*cs
;
3700 /* Context management */
3701 struct wined3d_context
**contexts
;
3705 void wined3d_device_cleanup(struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
3706 BOOL
device_context_add(struct wined3d_device
*device
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
3707 void device_context_remove(struct wined3d_device
*device
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
3708 void wined3d_device_create_default_samplers(struct wined3d_device
*device
,
3709 struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
3710 void wined3d_device_create_primary_opengl_context_cs(void *object
) DECLSPEC_HIDDEN
;
3711 void wined3d_device_delete_opengl_contexts_cs(void *object
) DECLSPEC_HIDDEN
;
3712 void wined3d_device_destroy_default_samplers(struct wined3d_device
*device
,
3713 struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
3714 HRESULT
wined3d_device_init(struct wined3d_device
*device
, struct wined3d
*wined3d
,
3715 unsigned int adapter_idx
, enum wined3d_device_type device_type
, HWND focus_window
, unsigned int flags
,
3716 BYTE surface_alignment
, const enum wined3d_feature_level
*levels
, unsigned int level_count
,
3717 const BOOL
*supported_extensions
, struct wined3d_device_parent
*device_parent
) DECLSPEC_HIDDEN
;
3718 LRESULT
device_process_message(struct wined3d_device
*device
, HWND window
, BOOL unicode
,
3719 UINT message
, WPARAM wparam
, LPARAM lparam
, WNDPROC proc
) DECLSPEC_HIDDEN
;
3720 void device_resource_add(struct wined3d_device
*device
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3721 void device_resource_released(struct wined3d_device
*device
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3722 void device_invalidate_state(const struct wined3d_device
*device
, DWORD state
) DECLSPEC_HIDDEN
;
3723 HRESULT
wined3d_device_set_implicit_swapchain(struct wined3d_device
*device
,
3724 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
3725 void wined3d_device_uninit_3d(struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
3727 struct wined3d_device_no3d
3729 struct wined3d_device d
;
3731 struct wined3d_context context_no3d
;
3734 static inline struct wined3d_device_no3d
*wined3d_device_no3d(struct wined3d_device
*device
)
3736 return CONTAINING_RECORD(device
, struct wined3d_device_no3d
, d
);
3739 struct wined3d_device_gl
3741 struct wined3d_device d
;
3743 /* Textures for when no other textures are bound. */
3744 struct wined3d_dummy_textures dummy_textures
;
3747 static inline struct wined3d_device_gl
*wined3d_device_gl(struct wined3d_device
*device
)
3749 return CONTAINING_RECORD(device
, struct wined3d_device_gl
, d
);
3752 struct wined3d_null_image_vk
3755 struct wined3d_allocator_block
*memory
;
3756 VkDeviceMemory vk_memory
;
3759 struct wined3d_null_resources_vk
3761 struct wined3d_bo_vk bo
;
3762 struct wined3d_null_image_vk image_1d
;
3763 struct wined3d_null_image_vk image_2d
;
3764 struct wined3d_null_image_vk image_2dms
;
3765 struct wined3d_null_image_vk image_3d
;
3768 struct wined3d_null_views_vk
3770 VkBufferView vk_view_buffer_uint
;
3771 VkBufferView vk_view_buffer_float
;
3773 VkDescriptorImageInfo vk_info_1d
;
3774 VkDescriptorImageInfo vk_info_2d
;
3775 VkDescriptorImageInfo vk_info_2dms
;
3776 VkDescriptorImageInfo vk_info_3d
;
3777 VkDescriptorImageInfo vk_info_cube
;
3778 VkDescriptorImageInfo vk_info_2d_array
;
3779 VkDescriptorImageInfo vk_info_2dms_array
;
3782 #define WINED3D_ALLOCATOR_CHUNK_SIZE (64 * 1024 * 1024)
3783 #define WINED3D_ALLOCATOR_CHUNK_ORDER_COUNT 15
3784 #define WINED3D_ALLOCATOR_MIN_BLOCK_SIZE (WINED3D_ALLOCATOR_CHUNK_SIZE >> (WINED3D_ALLOCATOR_CHUNK_ORDER_COUNT - 1))
3785 #define WINED3D_SLAB_BO_MIN_OBJECT_ALIGN 16
3787 struct wined3d_allocator_chunk
3790 struct list available
[WINED3D_ALLOCATOR_CHUNK_ORDER_COUNT
];
3791 struct wined3d_allocator
*allocator
;
3792 unsigned int map_count
;
3796 void wined3d_allocator_chunk_cleanup(struct wined3d_allocator_chunk
*chunk
) DECLSPEC_HIDDEN
;
3797 bool wined3d_allocator_chunk_init(struct wined3d_allocator_chunk
*chunk
,
3798 struct wined3d_allocator
*allocator
) DECLSPEC_HIDDEN
;
3800 struct wined3d_allocator_chunk_vk
3802 struct wined3d_allocator_chunk c
;
3803 VkDeviceMemory vk_memory
;
3806 static inline struct wined3d_allocator_chunk_vk
*wined3d_allocator_chunk_vk(struct wined3d_allocator_chunk
*chunk
)
3808 return CONTAINING_RECORD(chunk
, struct wined3d_allocator_chunk_vk
, c
);
3811 void *wined3d_allocator_chunk_vk_map(struct wined3d_allocator_chunk_vk
*chunk_vk
,
3812 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
3813 void wined3d_allocator_chunk_vk_unmap(struct wined3d_allocator_chunk_vk
*chunk_vk
,
3814 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
3816 struct wined3d_allocator_block
3819 struct wined3d_allocator_chunk
*chunk
;
3820 struct wined3d_allocator_block
*parent
, *sibling
;
3826 void wined3d_allocator_block_free(struct wined3d_allocator_block
*block
) DECLSPEC_HIDDEN
;
3828 struct wined3d_allocator_pool
3833 struct wined3d_allocator_ops
3835 struct wined3d_allocator_chunk
*(*allocator_create_chunk
)(struct wined3d_allocator
*allocator
,
3836 struct wined3d_context
*context
, unsigned int memory_type
, size_t chunk_size
);
3837 void (*allocator_destroy_chunk
)(struct wined3d_allocator_chunk
*chunk
);
3840 struct wined3d_allocator
3842 const struct wined3d_allocator_ops
*ops
;
3843 struct wined3d_allocator_pool
*pools
;
3845 struct wined3d_allocator_block
*free
;
3848 struct wined3d_allocator_block
*wined3d_allocator_allocate(struct wined3d_allocator
*allocator
,
3849 struct wined3d_context
*context
, unsigned int memory_type
, size_t size
) DECLSPEC_HIDDEN
;
3850 void wined3d_allocator_cleanup(struct wined3d_allocator
*allocator
) DECLSPEC_HIDDEN
;
3851 bool wined3d_allocator_init(struct wined3d_allocator
*allocator
,
3852 size_t pool_count
, const struct wined3d_allocator_ops
*allocator_ops
) DECLSPEC_HIDDEN
;
3854 struct wined3d_device_vk
3856 struct wined3d_device d
;
3858 struct wined3d_context_vk context_vk
;
3862 uint32_t vk_queue_family_index
;
3863 uint32_t timestamp_bits
;
3865 struct wined3d_vk_info vk_info
;
3867 struct wined3d_null_resources_vk null_resources_vk
;
3868 struct wined3d_null_views_vk null_views_vk
;
3870 struct wined3d_allocator allocator
;
3873 static inline struct wined3d_device_vk
*wined3d_device_vk(struct wined3d_device
*device
)
3875 return CONTAINING_RECORD(device
, struct wined3d_device_vk
, d
);
3878 bool wined3d_device_vk_create_null_resources(struct wined3d_device_vk
*device_vk
,
3879 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
3880 bool wined3d_device_vk_create_null_views(struct wined3d_device_vk
*device_vk
,
3881 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
3882 void wined3d_device_vk_destroy_null_resources(struct wined3d_device_vk
*device_vk
,
3883 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
3884 void wined3d_device_vk_destroy_null_views(struct wined3d_device_vk
*device_vk
,
3885 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
3887 static inline float wined3d_alpha_ref(const struct wined3d_state
*state
)
3889 return (state
->render_states
[WINED3D_RS_ALPHAREF
] & 0xff) / 255.0f
;
3892 const char *wined3d_debug_resource_access(DWORD access
) DECLSPEC_HIDDEN
;
3893 const char *wined3d_debug_bind_flags(DWORD bind_flags
) DECLSPEC_HIDDEN
;
3894 const char *wined3d_debug_view_desc(const struct wined3d_view_desc
*d
,
3895 const struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3896 const char *wined3d_debug_vkresult(VkResult vr
) DECLSPEC_HIDDEN
;
3898 static inline BOOL
wined3d_resource_access_is_managed(unsigned int access
)
3900 return !(~access
& (WINED3D_RESOURCE_ACCESS_GPU
| WINED3D_RESOURCE_ACCESS_CPU
));
3903 struct wined3d_resource_ops
3905 ULONG (*resource_incref
)(struct wined3d_resource
*resource
);
3906 ULONG (*resource_decref
)(struct wined3d_resource
*resource
);
3907 void (*resource_preload
)(struct wined3d_resource
*resource
);
3908 void (*resource_unload
)(struct wined3d_resource
*resource
);
3909 HRESULT (*resource_sub_resource_map
)(struct wined3d_resource
*resource
, unsigned int sub_resource_idx
,
3910 struct wined3d_map_desc
*map_desc
, const struct wined3d_box
*box
, DWORD flags
);
3911 HRESULT (*resource_sub_resource_unmap
)(struct wined3d_resource
*resource
, unsigned int sub_resource_idx
);
3914 struct wined3d_resource
3918 LONG srv_bind_count_device
;
3921 struct wined3d_device
*device
;
3922 enum wined3d_resource_type type
;
3923 enum wined3d_gl_resource_type gl_type
;
3924 const struct wined3d_format
*format
;
3925 unsigned int format_flags
;
3926 enum wined3d_multisample_type multisample_type
;
3927 UINT multisample_quality
;
3929 unsigned int bind_flags
;
3930 unsigned int access
;
3941 const struct wined3d_parent_ops
*parent_ops
;
3942 const struct wined3d_resource_ops
*resource_ops
;
3944 struct list resource_list_entry
;
3947 static inline ULONG
wined3d_resource_incref(struct wined3d_resource
*resource
)
3949 return resource
->resource_ops
->resource_incref(resource
);
3952 static inline ULONG
wined3d_resource_decref(struct wined3d_resource
*resource
)
3954 return resource
->resource_ops
->resource_decref(resource
);
3957 static inline void wined3d_resource_acquire(struct wined3d_resource
*resource
)
3959 InterlockedIncrement(&resource
->access_count
);
3962 static inline void wined3d_resource_release(struct wined3d_resource
*resource
)
3964 InterlockedDecrement(&resource
->access_count
);
3967 void resource_cleanup(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3968 HRESULT
resource_init(struct wined3d_resource
*resource
, struct wined3d_device
*device
,
3969 enum wined3d_resource_type type
, const struct wined3d_format
*format
,
3970 enum wined3d_multisample_type multisample_type
, unsigned int multisample_quality
, unsigned int usage
,
3971 unsigned int bind_flags
, unsigned int access
, unsigned int width
, unsigned int height
, unsigned int depth
,
3972 unsigned int size
, void *parent
, const struct wined3d_parent_ops
*parent_ops
,
3973 const struct wined3d_resource_ops
*resource_ops
) DECLSPEC_HIDDEN
;
3974 void resource_unload(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3975 void wined3d_resource_free_sysmem(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3976 const struct wined3d_format
*wined3d_resource_get_decompress_format(
3977 const struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3978 unsigned int wined3d_resource_get_sample_count(const struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3979 GLbitfield
wined3d_resource_gl_map_flags(DWORD d3d_flags
) DECLSPEC_HIDDEN
;
3980 GLenum
wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags
) DECLSPEC_HIDDEN
;
3981 BOOL
wined3d_resource_is_offscreen(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3982 BOOL
wined3d_resource_prepare_sysmem(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3983 void wined3d_resource_update_draw_binding(struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
3985 /* Tests show that the start address of resources is 32 byte aligned */
3986 #define RESOURCE_ALIGNMENT 16
3987 #define WINED3D_CONSTANT_BUFFER_ALIGNMENT 16
3989 #define WINED3D_LOCATION_DISCARDED 0x00000001
3990 #define WINED3D_LOCATION_SYSMEM 0x00000002
3991 #define WINED3D_LOCATION_USER_MEMORY 0x00000004
3992 #define WINED3D_LOCATION_BUFFER 0x00000008
3993 #define WINED3D_LOCATION_TEXTURE_RGB 0x00000010
3994 #define WINED3D_LOCATION_TEXTURE_SRGB 0x00000020
3995 #define WINED3D_LOCATION_DRAWABLE 0x00000040
3996 #define WINED3D_LOCATION_RB_MULTISAMPLE 0x00000080
3997 #define WINED3D_LOCATION_RB_RESOLVED 0x00000100
3999 const char *wined3d_debug_location(DWORD location
) DECLSPEC_HIDDEN
;
4001 struct wined3d_blt_info
4004 struct wined3d_vec3 texcoords
[4];
4007 struct wined3d_texture_ops
4009 BOOL (*texture_prepare_location
)(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
4010 struct wined3d_context
*context
, unsigned int location
);
4011 BOOL (*texture_load_location
)(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
4012 struct wined3d_context
*context
, unsigned int location
);
4013 void (*texture_unload_location
)(struct wined3d_texture
*texture
,
4014 struct wined3d_context
*context
, unsigned int location
);
4015 void (*texture_upload_data
)(struct wined3d_context
*context
, const struct wined3d_const_bo_address
*src_bo_addr
,
4016 const struct wined3d_format
*src_format
, const struct wined3d_box
*src_box
, unsigned int src_row_pitch
,
4017 unsigned int src_slice_pitch
, struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
4018 unsigned int dst_location
, unsigned int dst_x
, unsigned int dst_y
, unsigned int dst_z
);
4019 void (*texture_download_data
)(struct wined3d_context
*context
, struct wined3d_texture
*src_texture
,
4020 unsigned int src_sub_resource_idx
, unsigned int src_location
, const struct wined3d_box
*src_box
,
4021 const struct wined3d_bo_address
*dst_bo_addr
, const struct wined3d_format
*dst_format
,
4022 unsigned int dst_x
, unsigned int dst_y
, unsigned int dst_z
,
4023 unsigned int dst_row_pitch
, unsigned int dst_slice_pitch
);
4026 #define WINED3D_TEXTURE_COND_NP2 0x00000001
4027 #define WINED3D_TEXTURE_COND_NP2_EMULATED 0x00000002
4028 #define WINED3D_TEXTURE_POW2_MAT_IDENT 0x00000004
4029 #define WINED3D_TEXTURE_IS_SRGB 0x00000008
4030 #define WINED3D_TEXTURE_RGB_ALLOCATED 0x00000010
4031 #define WINED3D_TEXTURE_RGB_VALID 0x00000020
4032 #define WINED3D_TEXTURE_SRGB_ALLOCATED 0x00000040
4033 #define WINED3D_TEXTURE_SRGB_VALID 0x00000080
4034 #define WINED3D_TEXTURE_CONVERTED 0x00000100
4035 #define WINED3D_TEXTURE_PIN_SYSMEM 0x00000200
4036 #define WINED3D_TEXTURE_NORMALIZED_COORDS 0x00000400
4037 #define WINED3D_TEXTURE_GET_DC_LENIENT 0x00000800
4038 #define WINED3D_TEXTURE_DC_IN_USE 0x00001000
4039 #define WINED3D_TEXTURE_DISCARD 0x00002000
4040 #define WINED3D_TEXTURE_GET_DC 0x00004000
4041 #define WINED3D_TEXTURE_GENERATE_MIPMAPS 0x00008000
4042 #define WINED3D_TEXTURE_DOWNLOADABLE 0x00010000
4044 #define WINED3D_TEXTURE_ASYNC_COLOR_KEY 0x00000001
4046 struct wined3d_texture
4048 struct wined3d_resource resource
;
4049 const struct wined3d_texture_ops
*texture_ops
;
4050 struct wined3d_swapchain
*swapchain
;
4051 unsigned int pow2_width
;
4052 unsigned int pow2_height
;
4055 unsigned int download_count
;
4056 unsigned int sysmem_count
;
4057 float pow2_matrix
[16];
4061 DWORD update_map_binding
;
4064 unsigned int row_pitch
;
4065 unsigned int slice_pitch
;
4067 /* May only be accessed from the command stream worker thread. */
4068 struct wined3d_texture_async
4072 /* Color keys for DDraw */
4073 struct wined3d_color_key dst_blt_color_key
;
4074 struct wined3d_color_key src_blt_color_key
;
4075 struct wined3d_color_key dst_overlay_color_key
;
4076 struct wined3d_color_key src_overlay_color_key
;
4077 struct wined3d_color_key gl_color_key
;
4078 DWORD color_key_flags
;
4081 struct wined3d_dirty_regions
4083 struct wined3d_box
*boxes
;
4085 unsigned int box_count
;
4088 struct wined3d_overlay_info
4091 struct list overlays
;
4092 struct wined3d_texture
*dst_texture
;
4093 unsigned int dst_sub_resource_idx
;
4098 struct wined3d_dc_info
4104 struct wined3d_texture_sub_resource
4107 const struct wined3d_parent_ops
*parent_ops
;
4109 unsigned int offset
;
4112 unsigned int map_count
;
4115 struct wined3d_bo_gl bo
;
4119 static inline void *wined3d_texture_allocate_object_memory(SIZE_T s
, SIZE_T level_count
, SIZE_T layer_count
)
4121 struct wined3d_texture
*t
;
4123 if (level_count
> ((~(SIZE_T
)0 - s
) / sizeof(*t
->sub_resources
)) / layer_count
)
4126 return heap_alloc_zero(s
+ level_count
* layer_count
* sizeof(*t
->sub_resources
));
4129 static inline struct wined3d_texture
*texture_from_resource(struct wined3d_resource
*resource
)
4131 return CONTAINING_RECORD(resource
, struct wined3d_texture
, resource
);
4134 static inline unsigned int wined3d_texture_get_level_width(const struct wined3d_texture
*texture
,
4137 return max(1, texture
->resource
.width
>> level
);
4140 static inline unsigned int wined3d_texture_get_level_height(const struct wined3d_texture
*texture
,
4143 return max(1, texture
->resource
.height
>> level
);
4146 static inline unsigned int wined3d_texture_get_level_depth(const struct wined3d_texture
*texture
,
4149 return max(1, texture
->resource
.depth
>> level
);
4152 static inline unsigned int wined3d_texture_get_level_pow2_width(const struct wined3d_texture
*texture
,
4155 return max(1, texture
->pow2_width
>> level
);
4158 static inline unsigned int wined3d_texture_get_level_pow2_height(const struct wined3d_texture
*texture
,
4161 return max(1, texture
->pow2_height
>> level
);
4164 static inline void wined3d_texture_get_level_box(const struct wined3d_texture
*texture
,
4165 unsigned int level
, struct wined3d_box
*box
)
4167 wined3d_box_set(box
, 0, 0,
4168 wined3d_texture_get_level_width(texture
, level
),
4169 wined3d_texture_get_level_height(texture
, level
),
4170 0, wined3d_texture_get_level_depth(texture
, level
));
4173 static inline bool wined3d_texture_is_full_rect(const struct wined3d_texture
*texture
,
4174 unsigned int level
, const RECT
*r
)
4178 t
= wined3d_texture_get_level_width(texture
, level
);
4179 if ((r
->left
&& r
->right
) || abs(r
->right
- r
->left
) != t
)
4181 t
= wined3d_texture_get_level_height(texture
, level
);
4182 if ((r
->top
&& r
->bottom
) || abs(r
->bottom
- r
->top
) != t
)
4187 HRESULT
texture2d_blt(struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
4188 const struct wined3d_box
*dst_box
, struct wined3d_texture
*src_texture
,
4189 unsigned int src_sub_resource_idx
, const struct wined3d_box
*src_box
, DWORD flags
,
4190 const struct wined3d_blt_fx
*blt_fx
, enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
4191 void texture2d_get_blt_info(const struct wined3d_texture_gl
*texture_gl
, unsigned int sub_resource_idx
,
4192 const RECT
*rect
, struct wined3d_blt_info
*info
) DECLSPEC_HIDDEN
;
4193 void texture2d_load_fb_texture(struct wined3d_texture_gl
*texture_gl
, unsigned int sub_resource_idx
,
4194 BOOL srgb
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4195 void texture2d_read_from_framebuffer(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
4196 struct wined3d_context
*context
, DWORD src_location
, DWORD dst_location
) DECLSPEC_HIDDEN
;
4198 HRESULT
wined3d_texture_check_box_dimensions(const struct wined3d_texture
*texture
,
4199 unsigned int level
, const struct wined3d_box
*box
) DECLSPEC_HIDDEN
;
4200 void wined3d_texture_cleanup(struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
4201 void wined3d_texture_download_from_texture(struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
4202 struct wined3d_texture
*src_texture
, unsigned int src_sub_resource_idx
) DECLSPEC_HIDDEN
;
4203 GLenum
wined3d_texture_get_gl_buffer(const struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
4204 void wined3d_texture_get_memory(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
4205 struct wined3d_bo_address
*data
, DWORD locations
) DECLSPEC_HIDDEN
;
4206 void wined3d_texture_invalidate_location(struct wined3d_texture
*texture
,
4207 unsigned int sub_resource_idx
, DWORD location
) DECLSPEC_HIDDEN
;
4208 void wined3d_texture_load(struct wined3d_texture
*texture
,
4209 struct wined3d_context
*context
, BOOL srgb
) DECLSPEC_HIDDEN
;
4210 BOOL
wined3d_texture_load_location(struct wined3d_texture
*texture
,
4211 unsigned int sub_resource_idx
, struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4212 BOOL
wined3d_texture_prepare_location(struct wined3d_texture
*texture
, unsigned int sub_resource_idx
,
4213 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4214 void wined3d_texture_set_map_binding(struct wined3d_texture
*texture
, DWORD map_binding
) DECLSPEC_HIDDEN
;
4215 void wined3d_texture_set_swapchain(struct wined3d_texture
*texture
,
4216 struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
4217 void wined3d_texture_sub_resources_destroyed(struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
4218 void wined3d_texture_translate_drawable_coords(const struct wined3d_texture
*texture
,
4219 HWND window
, RECT
*rect
) DECLSPEC_HIDDEN
;
4220 void wined3d_texture_upload_from_texture(struct wined3d_texture
*dst_texture
, unsigned int dst_sub_resource_idx
,
4221 unsigned int dst_x
, unsigned int dst_y
, unsigned int dst_z
, struct wined3d_texture
*src_texture
,
4222 unsigned int src_sub_resource_idx
, const struct wined3d_box
*src_box
) DECLSPEC_HIDDEN
;
4223 void wined3d_texture_validate_location(struct wined3d_texture
*texture
,
4224 unsigned int sub_resource_idx
, DWORD location
) DECLSPEC_HIDDEN
;
4225 void wined3d_texture_clear_dirty_regions(struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
4227 HRESULT
wined3d_texture_no3d_init(struct wined3d_texture
*texture_no3d
, struct wined3d_device
*device
,
4228 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
4229 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4231 void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle
[4], struct color_fixup_desc fixup
) DECLSPEC_HIDDEN
;
4232 void wined3d_vk_swizzle_from_color_fixup(VkComponentMapping
*mapping
, struct color_fixup_desc fixup
) DECLSPEC_HIDDEN
;
4236 struct wined3d_sampler_desc sampler_desc
;
4237 unsigned int base_level
;
4241 struct wined3d_texture_gl
4243 struct wined3d_texture t
;
4245 struct gl_texture texture_rgb
, texture_srgb
;
4249 GLuint rb_multisample
;
4252 struct list renderbuffers
;
4253 const struct wined3d_renderbuffer_entry
*current_renderbuffer
;
4256 static inline struct wined3d_texture_gl
*wined3d_texture_gl(struct wined3d_texture
*texture
)
4258 return CONTAINING_RECORD(texture
, struct wined3d_texture_gl
, t
);
4261 static inline struct gl_texture
*wined3d_texture_gl_get_gl_texture(struct wined3d_texture_gl
*texture_gl
,
4264 return srgb
? &texture_gl
->texture_srgb
: &texture_gl
->texture_rgb
;
4267 static inline GLenum
wined3d_texture_gl_get_sub_resource_target(const struct wined3d_texture_gl
*texture_gl
,
4268 unsigned int sub_resource_idx
)
4270 static const GLenum cube_targets
[] =
4272 GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
,
4273 GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
,
4274 GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
,
4275 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
,
4276 GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
,
4277 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
,
4280 return texture_gl
->t
.resource
.usage
& WINED3DUSAGE_LEGACY_CUBEMAP
4281 ? cube_targets
[sub_resource_idx
/ texture_gl
->t
.level_count
] : texture_gl
->target
;
4284 static inline BOOL
wined3d_texture_gl_is_multisample_location(const struct wined3d_texture_gl
*texture_gl
,
4287 if (location
== WINED3D_LOCATION_RB_MULTISAMPLE
)
4289 if (location
!= WINED3D_LOCATION_TEXTURE_RGB
&& location
!= WINED3D_LOCATION_TEXTURE_SRGB
)
4291 return texture_gl
->target
== GL_TEXTURE_2D_MULTISAMPLE
|| texture_gl
->target
== GL_TEXTURE_2D_MULTISAMPLE_ARRAY
;
4294 void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl
*texture_gl
,
4295 const struct wined3d_sampler_desc
*sampler_desc
, const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
4296 void wined3d_texture_gl_bind(struct wined3d_texture_gl
*texture_gl
,
4297 struct wined3d_context_gl
*context_gl
, BOOL srgb
) DECLSPEC_HIDDEN
;
4298 void wined3d_texture_gl_bind_and_dirtify(struct wined3d_texture_gl
*texture_gl
,
4299 struct wined3d_context_gl
*context_gl
, BOOL srgb
) DECLSPEC_HIDDEN
;
4300 HRESULT
wined3d_texture_gl_init(struct wined3d_texture_gl
*texture_gl
, struct wined3d_device
*device
,
4301 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
4302 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4303 void wined3d_texture_gl_prepare_texture(struct wined3d_texture_gl
*texture_gl
,
4304 struct wined3d_context_gl
*context_gl
, BOOL srgb
) DECLSPEC_HIDDEN
;
4305 void wined3d_texture_gl_set_compatible_renderbuffer(struct wined3d_texture_gl
*texture_gl
,
4306 struct wined3d_context_gl
*context_gl
, unsigned int level
,
4307 const struct wined3d_rendertarget_info
*rt
) DECLSPEC_HIDDEN
;
4309 struct wined3d_texture_vk
4311 struct wined3d_texture t
;
4314 struct wined3d_allocator_block
*memory
;
4315 VkDeviceMemory vk_memory
;
4316 enum VkImageLayout layout
;
4317 uint64_t command_buffer_id
;
4319 VkDescriptorImageInfo default_image_info
;
4322 static inline struct wined3d_texture_vk
*wined3d_texture_vk(struct wined3d_texture
*texture
)
4324 return CONTAINING_RECORD(texture
, struct wined3d_texture_vk
, t
);
4327 const VkDescriptorImageInfo
*wined3d_texture_vk_get_default_image_info(struct wined3d_texture_vk
*texture_vk
,
4328 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
4329 HRESULT
wined3d_texture_vk_init(struct wined3d_texture_vk
*texture_vk
, struct wined3d_device
*device
,
4330 const struct wined3d_resource_desc
*desc
, unsigned int layer_count
, unsigned int level_count
,
4331 uint32_t flags
, void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4332 BOOL
wined3d_texture_vk_prepare_texture(struct wined3d_texture_vk
*texture_vk
,
4333 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
4335 struct wined3d_renderbuffer_entry
4343 struct wined3d_fbo_resource
4347 GLuint level
, layer
;
4350 #define WINED3D_FBO_ENTRY_FLAG_ATTACHED 0x1
4351 #define WINED3D_FBO_ENTRY_FLAG_DEPTH 0x2
4352 #define WINED3D_FBO_ENTRY_FLAG_STENCIL 0x4
4360 struct wined3d_fbo_entry_key
4363 struct wined3d_fbo_resource objects
[WINED3D_MAX_RENDER_TARGETS
+ 1];
4367 struct wined3d_sampler
4369 struct wine_rb_entry entry
;
4371 struct wined3d_device
*device
;
4373 const struct wined3d_parent_ops
*parent_ops
;
4374 struct wined3d_sampler_desc desc
;
4377 struct wined3d_sampler_gl
4379 struct wined3d_sampler s
;
4384 static inline struct wined3d_sampler_gl
*wined3d_sampler_gl(struct wined3d_sampler
*sampler
)
4386 return CONTAINING_RECORD(sampler
, struct wined3d_sampler_gl
, s
);
4389 void wined3d_sampler_gl_bind(struct wined3d_sampler_gl
*sampler_gl
, unsigned int unit
,
4390 struct wined3d_texture_gl
*texture_gl
, const struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
4391 void wined3d_sampler_gl_init(struct wined3d_sampler_gl
*sampler_gl
,
4392 struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
4393 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4395 struct wined3d_sampler_vk
4397 struct wined3d_sampler s
;
4399 VkDescriptorImageInfo vk_image_info
;
4400 uint64_t command_buffer_id
;
4403 static inline struct wined3d_sampler_vk
*wined3d_sampler_vk(struct wined3d_sampler
*sampler
)
4405 return CONTAINING_RECORD(sampler
, struct wined3d_sampler_vk
, s
);
4408 void wined3d_sampler_vk_init(struct wined3d_sampler_vk
*sampler_vk
,
4409 struct wined3d_device
*device
, const struct wined3d_sampler_desc
*desc
,
4410 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4412 struct wined3d_vertex_declaration_element
4414 const struct wined3d_format
*format
;
4416 unsigned int input_slot
;
4417 unsigned int offset
;
4418 unsigned int output_slot
;
4419 enum wined3d_input_classification input_slot_class
;
4420 unsigned int instance_data_step_rate
;
4426 struct wined3d_vertex_declaration
4430 const struct wined3d_parent_ops
*parent_ops
;
4431 struct wined3d_device
*device
;
4433 struct wined3d_vertex_declaration_element
*elements
;
4434 unsigned int element_count
;
4436 BOOL position_transformed
;
4439 struct wined3d_saved_states
4441 uint32_t vs_consts_f
[WINED3D_BITMAP_SIZE(WINED3D_MAX_VS_CONSTS_F
)];
4442 WORD vertexShaderConstantsI
; /* WINED3D_MAX_CONSTS_I, 16 */
4443 WORD vertexShaderConstantsB
; /* WINED3D_MAX_CONSTS_B, 16 */
4444 uint32_t ps_consts_f
[WINED3D_BITMAP_SIZE(WINED3D_MAX_PS_CONSTS_F
)];
4445 WORD pixelShaderConstantsI
; /* WINED3D_MAX_CONSTS_I, 16 */
4446 WORD pixelShaderConstantsB
; /* WINED3D_MAX_CONSTS_B, 16 */
4447 uint32_t transform
[WINED3D_BITMAP_SIZE(WINED3D_HIGHEST_TRANSFORM_STATE
+ 1)];
4448 WORD streamSource
; /* WINED3D_MAX_STREAMS, 16 */
4449 WORD streamFreq
; /* WINED3D_MAX_STREAMS, 16 */
4450 uint32_t renderState
[WINED3D_BITMAP_SIZE(WINEHIGHEST_RENDER_STATE
+ 1)];
4451 DWORD textureState
[WINED3D_MAX_TEXTURES
]; /* WINED3D_HIGHEST_TEXTURE_STATE + 1, 18 */
4452 WORD samplerState
[WINED3D_MAX_COMBINED_SAMPLERS
]; /* WINED3D_HIGHEST_SAMPLER_STATE + 1, 14 */
4453 DWORD clipplane
; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
4454 DWORD textures
: 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */
4458 DWORD vertexDecl
: 1;
4459 DWORD pixelShader
: 1;
4460 DWORD vertexShader
: 1;
4461 DWORD scissorRect
: 1;
4462 DWORD store_stream_offset
: 1;
4463 DWORD alpha_to_coverage
: 1;
4465 DWORD transforms
: 1;
4474 struct wined3d_stateblock
4476 LONG ref
; /* Note: Ref counting not required */
4477 struct wined3d_device
*device
;
4479 /* Array indicating whether things have been set or changed */
4480 struct wined3d_saved_states changed
;
4482 struct wined3d_stateblock_state stateblock_state
;
4483 struct wined3d_light_state light_state
;
4485 /* Contained state management */
4486 DWORD contained_render_states
[WINEHIGHEST_RENDER_STATE
+ 1];
4487 unsigned int num_contained_render_states
;
4488 DWORD contained_transform_states
[WINED3D_HIGHEST_TRANSFORM_STATE
+ 1];
4489 unsigned int num_contained_transform_states
;
4490 struct StageState contained_tss_states
[WINED3D_MAX_TEXTURES
* (WINED3D_HIGHEST_TEXTURE_STATE
+ 1)];
4491 unsigned int num_contained_tss_states
;
4492 struct StageState contained_sampler_states
[WINED3D_MAX_COMBINED_SAMPLERS
* WINED3D_HIGHEST_SAMPLER_STATE
];
4493 unsigned int num_contained_sampler_states
;
4496 void wined3d_stateblock_state_init(struct wined3d_stateblock_state
*state
,
4497 const struct wined3d_device
*device
, DWORD flags
) DECLSPEC_HIDDEN
;
4498 void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state
*state
) DECLSPEC_HIDDEN
;
4500 void wined3d_light_state_enable_light(struct wined3d_light_state
*state
, const struct wined3d_d3d_info
*d3d_info
,
4501 struct wined3d_light_info
*light_info
, BOOL enable
) DECLSPEC_HIDDEN
;
4502 struct wined3d_light_info
*wined3d_light_state_get_light(const struct wined3d_light_state
*state
,
4503 unsigned int idx
) DECLSPEC_HIDDEN
;
4504 HRESULT
wined3d_light_state_set_light(struct wined3d_light_state
*state
, DWORD light_idx
,
4505 const struct wined3d_light
*params
, struct wined3d_light_info
**light_info
) DECLSPEC_HIDDEN
;
4507 void state_cleanup(struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
4508 void state_init(struct wined3d_state
*state
, const struct wined3d_d3d_info
*d3d_info
, DWORD flags
) DECLSPEC_HIDDEN
;
4509 void state_unbind_resources(struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
4511 enum wined3d_cs_queue_id
4513 WINED3D_CS_QUEUE_DEFAULT
= 0,
4514 WINED3D_CS_QUEUE_MAP
,
4515 WINED3D_CS_QUEUE_COUNT
,
4518 enum wined3d_push_constants
4520 WINED3D_PUSH_CONSTANTS_VS_F
,
4521 WINED3D_PUSH_CONSTANTS_PS_F
,
4522 WINED3D_PUSH_CONSTANTS_VS_I
,
4523 WINED3D_PUSH_CONSTANTS_PS_I
,
4524 WINED3D_PUSH_CONSTANTS_VS_B
,
4525 WINED3D_PUSH_CONSTANTS_PS_B
,
4528 #define WINED3D_CS_QUERY_POLL_INTERVAL 10u
4529 #define WINED3D_CS_QUEUE_SIZE 0x100000u
4530 #define WINED3D_CS_SPIN_COUNT 10000000u
4532 struct wined3d_cs_queue
4535 BYTE data
[WINED3D_CS_QUEUE_SIZE
];
4538 struct wined3d_cs_ops
4540 void *(*require_space
)(struct wined3d_cs
*cs
, size_t size
, enum wined3d_cs_queue_id queue_id
);
4541 void (*submit
)(struct wined3d_cs
*cs
, enum wined3d_cs_queue_id queue_id
);
4542 void (*finish
)(struct wined3d_cs
*cs
, enum wined3d_cs_queue_id queue_id
);
4543 void (*push_constants
)(struct wined3d_cs
*cs
, enum wined3d_push_constants p
,
4544 unsigned int start_idx
, unsigned int count
, const void *constants
);
4549 const struct wined3d_cs_ops
*ops
;
4550 struct wined3d_device
*device
;
4551 struct wined3d_state state
;
4552 HMODULE wined3d_module
;
4556 struct wined3d_cs_queue queue
[WINED3D_CS_QUEUE_COUNT
];
4557 size_t data_size
, start
, end
;
4559 struct list query_poll_list
;
4560 BOOL queries_flushed
;
4563 BOOL waiting_for_event
;
4564 LONG pending_presents
;
4567 struct wined3d_cs
*wined3d_cs_create(struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
4568 void wined3d_cs_destroy(struct wined3d_cs
*cs
) DECLSPEC_HIDDEN
;
4569 void wined3d_cs_destroy_object(struct wined3d_cs
*cs
,
4570 void (*callback
)(void *object
), void *object
) DECLSPEC_HIDDEN
;
4571 void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs
*cs
,
4572 struct wined3d_texture
*texture
, unsigned int layer
) DECLSPEC_HIDDEN
;
4573 void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*dst_resource
,
4574 unsigned int dst_sub_resource_idx
, const struct wined3d_box
*dst_box
, struct wined3d_resource
*src_resource
,
4575 unsigned int src_sub_resource_idx
, const struct wined3d_box
*src_box
, DWORD flags
,
4576 const struct wined3d_blt_fx
*fx
, enum wined3d_texture_filter_type filter
) DECLSPEC_HIDDEN
;
4577 void wined3d_cs_emit_clear(struct wined3d_cs
*cs
, DWORD rect_count
, const RECT
*rects
,
4578 DWORD flags
, const struct wined3d_color
*color
, float depth
, DWORD stencil
) DECLSPEC_HIDDEN
;
4579 void wined3d_cs_emit_clear_rendertarget_view(struct wined3d_cs
*cs
, struct wined3d_rendertarget_view
*view
,
4580 const RECT
*rect
, DWORD flags
, const struct wined3d_color
*color
, float depth
, DWORD stencil
) DECLSPEC_HIDDEN
;
4581 void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs
*cs
,
4582 struct wined3d_unordered_access_view
*view
, const struct wined3d_uvec4
*clear_value
) DECLSPEC_HIDDEN
;
4583 void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs
*cs
, struct wined3d_buffer
*dst_buffer
,
4584 unsigned int offset
, struct wined3d_unordered_access_view
*uav
) DECLSPEC_HIDDEN
;
4585 void wined3d_cs_emit_dispatch(struct wined3d_cs
*cs
,
4586 unsigned int group_count_x
, unsigned int group_count_y
, unsigned int group_count_z
) DECLSPEC_HIDDEN
;
4587 void wined3d_cs_emit_dispatch_indirect(struct wined3d_cs
*cs
,
4588 struct wined3d_buffer
*buffer
, unsigned int offset
) DECLSPEC_HIDDEN
;
4589 void wined3d_cs_emit_draw(struct wined3d_cs
*cs
, enum wined3d_primitive_type primitive_type
,
4590 unsigned int patch_vertex_count
, int base_vertex_idx
, unsigned int start_idx
, unsigned int index_count
,
4591 unsigned int start_instance
, unsigned int instance_count
, bool indexed
) DECLSPEC_HIDDEN
;
4592 void wined3d_cs_emit_draw_indirect(struct wined3d_cs
*cs
, enum wined3d_primitive_type primitive_type
,
4593 unsigned int patch_vertex_count
, struct wined3d_buffer
*buffer
,
4594 unsigned int offset
, bool indexed
) DECLSPEC_HIDDEN
;
4595 void wined3d_cs_emit_flush(struct wined3d_cs
*cs
) DECLSPEC_HIDDEN
;
4596 void wined3d_cs_emit_generate_mipmaps(struct wined3d_cs
*cs
, struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4597 void wined3d_cs_emit_preload_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
4598 void wined3d_cs_emit_present(struct wined3d_cs
*cs
, struct wined3d_swapchain
*swapchain
, const RECT
*src_rect
,
4599 const RECT
*dst_rect
, HWND dst_window_override
, unsigned int swap_interval
, DWORD flags
) DECLSPEC_HIDDEN
;
4600 void wined3d_cs_emit_query_issue(struct wined3d_cs
*cs
, struct wined3d_query
*query
, DWORD flags
) DECLSPEC_HIDDEN
;
4601 void wined3d_cs_emit_reset_state(struct wined3d_cs
*cs
) DECLSPEC_HIDDEN
;
4602 void wined3d_cs_emit_set_blend_state(struct wined3d_cs
*cs
, struct wined3d_blend_state
*state
,
4603 const struct wined3d_color
*blend_factor
) DECLSPEC_HIDDEN
;
4604 void wined3d_cs_emit_set_clip_plane(struct wined3d_cs
*cs
, UINT plane_idx
,
4605 const struct wined3d_vec4
*plane
) DECLSPEC_HIDDEN
;
4606 void wined3d_cs_emit_set_color_key(struct wined3d_cs
*cs
, struct wined3d_texture
*texture
,
4607 WORD flags
, const struct wined3d_color_key
*color_key
) DECLSPEC_HIDDEN
;
4608 void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4609 UINT cb_idx
, struct wined3d_buffer
*buffer
) DECLSPEC_HIDDEN
;
4610 void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs
*cs
,
4611 struct wined3d_rendertarget_view
*view
) DECLSPEC_HIDDEN
;
4612 void wined3d_cs_emit_set_index_buffer(struct wined3d_cs
*cs
, struct wined3d_buffer
*buffer
,
4613 enum wined3d_format_id format_id
, unsigned int offset
) DECLSPEC_HIDDEN
;
4614 void wined3d_cs_emit_set_light(struct wined3d_cs
*cs
, const struct wined3d_light_info
*light
) DECLSPEC_HIDDEN
;
4615 void wined3d_cs_emit_set_light_enable(struct wined3d_cs
*cs
, unsigned int idx
, BOOL enable
) DECLSPEC_HIDDEN
;
4616 void wined3d_cs_emit_set_material(struct wined3d_cs
*cs
, const struct wined3d_material
*material
) DECLSPEC_HIDDEN
;
4617 void wined3d_cs_emit_set_predication(struct wined3d_cs
*cs
,
4618 struct wined3d_query
*predicate
, BOOL value
) DECLSPEC_HIDDEN
;
4619 void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs
*cs
,
4620 struct wined3d_rasterizer_state
*rasterizer_state
) DECLSPEC_HIDDEN
;
4621 void wined3d_cs_emit_set_render_state(struct wined3d_cs
*cs
,
4622 enum wined3d_render_state state
, DWORD value
) DECLSPEC_HIDDEN
;
4623 void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs
*cs
, unsigned int view_idx
,
4624 struct wined3d_rendertarget_view
*view
) DECLSPEC_HIDDEN
;
4625 void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4626 UINT view_idx
, struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4627 void wined3d_cs_emit_set_sampler(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4628 UINT sampler_idx
, struct wined3d_sampler
*sampler
) DECLSPEC_HIDDEN
;
4629 void wined3d_cs_emit_set_sampler_state(struct wined3d_cs
*cs
, UINT sampler_idx
,
4630 enum wined3d_sampler_state state
, DWORD value
) DECLSPEC_HIDDEN
;
4631 void wined3d_cs_emit_set_scissor_rects(struct wined3d_cs
*cs
, unsigned int rect_count
, const RECT
*rects
) DECLSPEC_HIDDEN
;
4632 void wined3d_cs_emit_set_shader(struct wined3d_cs
*cs
, enum wined3d_shader_type type
,
4633 struct wined3d_shader
*shader
) DECLSPEC_HIDDEN
;
4634 void wined3d_cs_emit_set_stream_output(struct wined3d_cs
*cs
, UINT stream_idx
,
4635 struct wined3d_buffer
*buffer
, UINT offset
) DECLSPEC_HIDDEN
;
4636 void wined3d_cs_emit_set_stream_source(struct wined3d_cs
*cs
, UINT stream_idx
,
4637 struct wined3d_buffer
*buffer
, UINT offset
, UINT stride
) DECLSPEC_HIDDEN
;
4638 void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs
*cs
, UINT stream_idx
,
4639 UINT frequency
, UINT flags
) DECLSPEC_HIDDEN
;
4640 void wined3d_cs_emit_set_texture(struct wined3d_cs
*cs
, UINT stage
, struct wined3d_texture
*texture
) DECLSPEC_HIDDEN
;
4641 void wined3d_cs_emit_set_texture_state(struct wined3d_cs
*cs
, UINT stage
,
4642 enum wined3d_texture_stage_state state
, DWORD value
) DECLSPEC_HIDDEN
;
4643 void wined3d_cs_emit_set_transform(struct wined3d_cs
*cs
, enum wined3d_transform_state state
,
4644 const struct wined3d_matrix
*matrix
) DECLSPEC_HIDDEN
;
4645 void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs
*cs
, enum wined3d_pipeline pipeline
,
4646 unsigned int view_idx
, struct wined3d_unordered_access_view
*view
,
4647 unsigned int initial_count
) DECLSPEC_HIDDEN
;
4648 void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs
*cs
,
4649 struct wined3d_vertex_declaration
*declaration
) DECLSPEC_HIDDEN
;
4650 void wined3d_cs_emit_set_viewports(struct wined3d_cs
*cs
, unsigned int viewport_count
, const struct wined3d_viewport
*viewports
) DECLSPEC_HIDDEN
;
4651 void wined3d_cs_emit_unload_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
) DECLSPEC_HIDDEN
;
4652 void wined3d_cs_emit_update_sub_resource(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
,
4653 unsigned int sub_resource_idx
, const struct wined3d_box
*box
, const void *data
, unsigned int row_pitch
,
4654 unsigned int slice_pitch
) DECLSPEC_HIDDEN
;
4655 void wined3d_cs_init_object(struct wined3d_cs
*cs
,
4656 void (*callback
)(void *object
), void *object
) DECLSPEC_HIDDEN
;
4657 HRESULT
wined3d_cs_map(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
, unsigned int sub_resource_idx
,
4658 struct wined3d_map_desc
*map_desc
, const struct wined3d_box
*box
, unsigned int flags
) DECLSPEC_HIDDEN
;
4659 HRESULT
wined3d_cs_unmap(struct wined3d_cs
*cs
, struct wined3d_resource
*resource
,
4660 unsigned int sub_resource_idx
) DECLSPEC_HIDDEN
;
4662 static inline void wined3d_cs_finish(struct wined3d_cs
*cs
, enum wined3d_cs_queue_id queue_id
)
4664 cs
->ops
->finish(cs
, queue_id
);
4667 static inline void wined3d_cs_push_constants(struct wined3d_cs
*cs
, enum wined3d_push_constants p
,
4668 unsigned int start_idx
, unsigned int count
, const void *constants
)
4670 cs
->ops
->push_constants(cs
, p
, start_idx
, count
, constants
);
4673 static inline void wined3d_resource_wait_idle(struct wined3d_resource
*resource
)
4675 const struct wined3d_cs
*cs
= resource
->device
->cs
;
4677 if (!cs
->thread
|| cs
->thread_id
== GetCurrentThreadId())
4680 while (InterlockedCompareExchange(&resource
->access_count
, 0, 0))
4684 /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other
4685 * fixed function semantics as D3DCOLOR or FLOAT16 */
4686 enum wined3d_buffer_conversion_type
4693 struct wined3d_buffer_ops
4695 BOOL (*buffer_prepare_location
)(struct wined3d_buffer
*buffer
,
4696 struct wined3d_context
*context
, unsigned int location
);
4697 void (*buffer_unload_location
)(struct wined3d_buffer
*buffer
,
4698 struct wined3d_context
*context
, unsigned int location
);
4699 void (*buffer_upload_ranges
)(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
, const void *data
,
4700 unsigned int data_offset
, unsigned int range_count
, const struct wined3d_range
*ranges
);
4701 void (*buffer_download_ranges
)(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
, void *data
,
4702 unsigned int data_offset
, unsigned int range_count
, const struct wined3d_range
*ranges
);
4705 struct wined3d_buffer
4707 struct wined3d_resource resource
;
4708 const struct wined3d_buffer_ops
*buffer_ops
;
4710 unsigned int structure_byte_stride
;
4714 uintptr_t buffer_object
;
4716 struct wined3d_range
*maps
;
4717 SIZE_T maps_size
, modified_areas
;
4718 struct wined3d_fence
*fence
;
4720 /* conversion stuff */
4721 UINT decl_change_count
, full_conversion_count
;
4723 UINT stride
; /* 0 if no conversion */
4724 enum wined3d_buffer_conversion_type
*conversion_map
; /* NULL if no conversion */
4725 UINT conversion_stride
; /* 0 if no shifted conversion */
4728 static inline struct wined3d_buffer
*buffer_from_resource(struct wined3d_resource
*resource
)
4730 return CONTAINING_RECORD(resource
, struct wined3d_buffer
, resource
);
4733 void wined3d_buffer_cleanup(struct wined3d_buffer
*buffer
) DECLSPEC_HIDDEN
;
4734 void wined3d_buffer_copy(struct wined3d_buffer
*dst_buffer
, unsigned int dst_offset
,
4735 struct wined3d_buffer
*src_buffer
, unsigned int src_offset
, unsigned int size
) DECLSPEC_HIDDEN
;
4736 DWORD
wined3d_buffer_get_memory(struct wined3d_buffer
*buffer
,
4737 struct wined3d_bo_address
*data
, DWORD locations
) DECLSPEC_HIDDEN
;
4738 void wined3d_buffer_invalidate_location(struct wined3d_buffer
*buffer
, DWORD location
) DECLSPEC_HIDDEN
;
4739 void wined3d_buffer_load(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
,
4740 const struct wined3d_state
*state
) DECLSPEC_HIDDEN
;
4741 BOOL
wined3d_buffer_load_location(struct wined3d_buffer
*buffer
,
4742 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4743 BYTE
*wined3d_buffer_load_sysmem(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4744 BOOL
wined3d_buffer_prepare_location(struct wined3d_buffer
*buffer
,
4745 struct wined3d_context
*context
, unsigned int location
) DECLSPEC_HIDDEN
;
4746 void wined3d_buffer_upload_data(struct wined3d_buffer
*buffer
, struct wined3d_context
*context
,
4747 const struct wined3d_box
*box
, const void *data
) DECLSPEC_HIDDEN
;
4749 HRESULT
wined3d_buffer_no3d_init(struct wined3d_buffer
*buffer_no3d
, struct wined3d_device
*device
,
4750 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
4751 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4753 struct wined3d_buffer_gl
4755 struct wined3d_buffer b
;
4757 struct wined3d_bo_gl bo
;
4758 GLenum buffer_object_usage
;
4761 static inline struct wined3d_buffer_gl
*wined3d_buffer_gl(struct wined3d_buffer
*buffer
)
4763 return CONTAINING_RECORD(buffer
, struct wined3d_buffer_gl
, b
);
4766 static inline const struct wined3d_buffer_gl
*wined3d_buffer_gl_const(const struct wined3d_buffer
*buffer
)
4768 return CONTAINING_RECORD(buffer
, struct wined3d_buffer_gl
, b
);
4771 GLenum
wined3d_buffer_gl_binding_from_bind_flags(const struct wined3d_gl_info
*gl_info
,
4772 uint32_t bind_flags
) DECLSPEC_HIDDEN
;
4773 HRESULT
wined3d_buffer_gl_init(struct wined3d_buffer_gl
*buffer_gl
, struct wined3d_device
*device
,
4774 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
4775 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4777 struct wined3d_buffer_vk
4779 struct wined3d_buffer b
;
4781 struct wined3d_bo_vk bo
;
4782 struct wined3d_bo_user_vk bo_user
;
4783 VkDescriptorBufferInfo buffer_info
;
4786 static inline struct wined3d_buffer_vk
*wined3d_buffer_vk(struct wined3d_buffer
*buffer
)
4788 return CONTAINING_RECORD(buffer
, struct wined3d_buffer_vk
, b
);
4791 const VkDescriptorBufferInfo
*wined3d_buffer_vk_get_buffer_info(struct wined3d_buffer_vk
*buffer_vk
) DECLSPEC_HIDDEN
;
4792 HRESULT
wined3d_buffer_vk_init(struct wined3d_buffer_vk
*buffer_vk
, struct wined3d_device
*device
,
4793 const struct wined3d_buffer_desc
*desc
, const struct wined3d_sub_resource_data
*data
,
4794 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4796 struct wined3d_rendertarget_view
4800 struct wined3d_resource
*resource
;
4802 const struct wined3d_parent_ops
*parent_ops
;
4804 const struct wined3d_format
*format
;
4805 unsigned int format_flags
;
4806 unsigned int sub_resource_idx
;
4807 unsigned int layer_count
;
4810 unsigned int height
;
4812 struct wined3d_view_desc desc
;
4815 void wined3d_rendertarget_view_cleanup(struct wined3d_rendertarget_view
*view
) DECLSPEC_HIDDEN
;
4816 void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view
*view
,
4817 const struct wined3d_context
*context
, unsigned int *width
, unsigned int *height
) DECLSPEC_HIDDEN
;
4818 void wined3d_rendertarget_view_invalidate_location(struct wined3d_rendertarget_view
*view
,
4819 DWORD location
) DECLSPEC_HIDDEN
;
4820 void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view
*view
,
4821 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4822 void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view
*view
,
4823 struct wined3d_context
*context
, DWORD location
) DECLSPEC_HIDDEN
;
4824 void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view
*view
,
4825 DWORD location
) DECLSPEC_HIDDEN
;
4827 HRESULT
wined3d_rendertarget_view_no3d_init(struct wined3d_rendertarget_view
*view_no3d
,
4828 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4829 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4831 struct wined3d_rendertarget_view_gl
4833 struct wined3d_rendertarget_view v
;
4834 struct wined3d_gl_view gl_view
;
4837 static inline struct wined3d_rendertarget_view_gl
*wined3d_rendertarget_view_gl(
4838 struct wined3d_rendertarget_view
*view
)
4840 return CONTAINING_RECORD(view
, struct wined3d_rendertarget_view_gl
, v
);
4843 HRESULT
wined3d_rendertarget_view_gl_init(struct wined3d_rendertarget_view_gl
*view_gl
,
4844 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4845 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4847 struct wined3d_rendertarget_view_vk
4849 struct wined3d_rendertarget_view v
;
4851 VkImageView vk_image_view
;
4852 uint64_t command_buffer_id
;
4855 static inline struct wined3d_rendertarget_view_vk
*wined3d_rendertarget_view_vk(
4856 struct wined3d_rendertarget_view
*view
)
4858 return CONTAINING_RECORD(view
, struct wined3d_rendertarget_view_vk
, v
);
4861 static inline VkImageView
wined3d_rendertarget_view_vk_get_image_view(struct wined3d_rendertarget_view_vk
*rtv_vk
,
4862 struct wined3d_context_vk
*context_vk
)
4864 struct wined3d_texture_vk
*texture_vk
;
4866 if (rtv_vk
->vk_image_view
)
4867 return rtv_vk
->vk_image_view
;
4869 texture_vk
= wined3d_texture_vk(wined3d_texture_from_resource(rtv_vk
->v
.resource
));
4870 return wined3d_texture_vk_get_default_image_info(texture_vk
, context_vk
)->imageView
;
4873 HRESULT
wined3d_rendertarget_view_vk_init(struct wined3d_rendertarget_view_vk
*view_vk
,
4874 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4875 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4877 struct wined3d_shader_resource_view
4881 struct wined3d_resource
*resource
;
4883 const struct wined3d_parent_ops
*parent_ops
;
4885 const struct wined3d_format
*format
;
4887 struct wined3d_view_desc desc
;
4890 void wined3d_shader_resource_view_cleanup(struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4891 void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view
*view
) DECLSPEC_HIDDEN
;
4893 struct wined3d_shader_resource_view_gl
4895 struct wined3d_shader_resource_view v
;
4896 struct wined3d_gl_view gl_view
;
4899 static inline struct wined3d_shader_resource_view_gl
*wined3d_shader_resource_view_gl(
4900 struct wined3d_shader_resource_view
*view
)
4902 return CONTAINING_RECORD(view
, struct wined3d_shader_resource_view_gl
, v
);
4905 void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
*view_gl
, unsigned int unit
,
4906 struct wined3d_sampler_gl
*sampler_gl
, struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
4907 HRESULT
wined3d_shader_resource_view_gl_init(struct wined3d_shader_resource_view_gl
*view_gl
,
4908 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4909 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4911 struct wined3d_view_vk
4913 struct wined3d_bo_user_vk bo_user
;
4916 VkBufferView vk_buffer_view
;
4917 VkDescriptorImageInfo vk_image_info
;
4919 uint64_t command_buffer_id
;
4922 struct wined3d_shader_resource_view_vk
4924 struct wined3d_shader_resource_view v
;
4925 struct wined3d_view_vk view_vk
;
4928 static inline struct wined3d_shader_resource_view_vk
*wined3d_shader_resource_view_vk(
4929 struct wined3d_shader_resource_view
*view
)
4931 return CONTAINING_RECORD(view
, struct wined3d_shader_resource_view_vk
, v
);
4934 HRESULT
wined3d_shader_resource_view_vk_init(struct wined3d_shader_resource_view_vk
*view_vk
,
4935 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4936 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4937 void wined3d_shader_resource_view_vk_update(struct wined3d_shader_resource_view_vk
*view_vk
,
4938 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
4940 struct wined3d_unordered_access_view
4944 struct wined3d_resource
*resource
;
4946 const struct wined3d_parent_ops
*parent_ops
;
4948 const struct wined3d_format
*format
;
4950 struct wined3d_view_desc desc
;
4951 uintptr_t counter_bo
;
4954 void wined3d_unordered_access_view_cleanup(struct wined3d_unordered_access_view
*view
) DECLSPEC_HIDDEN
;
4955 void wined3d_unordered_access_view_copy_counter(struct wined3d_unordered_access_view
*view
,
4956 struct wined3d_buffer
*buffer
, unsigned int offset
, struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
4957 void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_access_view
*view
,
4958 DWORD location
) DECLSPEC_HIDDEN
;
4959 void wined3d_unordered_access_view_set_counter(struct wined3d_unordered_access_view
*view
,
4960 unsigned int value
) DECLSPEC_HIDDEN
;
4962 struct wined3d_unordered_access_view_gl
4964 struct wined3d_unordered_access_view v
;
4965 struct wined3d_gl_view gl_view
;
4966 struct wined3d_bo_gl counter_bo
;
4969 static inline struct wined3d_unordered_access_view_gl
*wined3d_unordered_access_view_gl(
4970 struct wined3d_unordered_access_view
*view
)
4972 return CONTAINING_RECORD(view
, struct wined3d_unordered_access_view_gl
, v
);
4975 void wined3d_unordered_access_view_gl_clear_uint(struct wined3d_unordered_access_view_gl
*view_gl
,
4976 const struct wined3d_uvec4
*clear_value
, struct wined3d_context_gl
*context_gl
) DECLSPEC_HIDDEN
;
4977 HRESULT
wined3d_unordered_access_view_gl_init(struct wined3d_unordered_access_view_gl
*view_gl
,
4978 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
4979 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
4981 struct wined3d_unordered_access_view_vk
4983 struct wined3d_unordered_access_view v
;
4984 struct wined3d_view_vk view_vk
;
4986 VkBufferView vk_counter_view
;
4987 struct wined3d_bo_vk counter_bo
;
4990 static inline struct wined3d_unordered_access_view_vk
*wined3d_unordered_access_view_vk(
4991 struct wined3d_unordered_access_view
*view
)
4993 return CONTAINING_RECORD(view
, struct wined3d_unordered_access_view_vk
, v
);
4996 void wined3d_unordered_access_view_vk_clear_uint(struct wined3d_unordered_access_view_vk
*view_vk
,
4997 const struct wined3d_uvec4
*clear_value
, struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
4998 HRESULT
wined3d_unordered_access_view_vk_init(struct wined3d_unordered_access_view_vk
*view_vk
,
4999 const struct wined3d_view_desc
*desc
, struct wined3d_resource
*resource
,
5000 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
5001 void wined3d_unordered_access_view_vk_update(struct wined3d_unordered_access_view_vk
*view_vk
,
5002 struct wined3d_context_vk
*context_vk
) DECLSPEC_HIDDEN
;
5004 struct wined3d_swapchain_state
5006 struct wined3d_swapchain_desc desc
;
5008 struct wined3d_display_mode original_mode
, d3d_mode
;
5009 RECT original_window_rect
;
5011 /* Window styles to restore when switching fullscreen mode. */
5017 void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state
*state
,
5018 HWND window
, const RECT
*window_rect
) DECLSPEC_HIDDEN
;
5019 HRESULT
wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
*state
,
5020 HWND window
, int x
, int y
, int width
, int height
) DECLSPEC_HIDDEN
;
5022 struct wined3d_swapchain_ops
5024 void (*swapchain_present
)(struct wined3d_swapchain
*swapchain
,
5025 const RECT
*src_rect
, const RECT
*dst_rect
, unsigned int swap_interval
, DWORD flags
);
5026 void (*swapchain_frontbuffer_updated
)(struct wined3d_swapchain
*swapchain
);
5029 struct wined3d_swapchain
5033 const struct wined3d_parent_ops
*parent_ops
;
5034 const struct wined3d_swapchain_ops
*swapchain_ops
;
5035 struct wined3d_device
*device
;
5037 struct wined3d_texture
**back_buffers
;
5038 struct wined3d_texture
*front_buffer
;
5039 struct wined3d_gamma_ramp orig_gamma
;
5040 BOOL render_to_fbo
, reapply_mode
;
5041 const struct wined3d_format
*ds_format
;
5042 struct wined3d_palette
*palette
;
5043 RECT front_buffer_update
;
5044 unsigned int swap_interval
;
5045 unsigned int max_frame_latency
;
5047 LONG prev_time
, frames
; /* Performance tracking */
5049 struct wined3d_swapchain_state state
;
5053 void wined3d_swapchain_activate(struct wined3d_swapchain
*swapchain
, BOOL activate
) DECLSPEC_HIDDEN
;
5054 void wined3d_swapchain_cleanup(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
5055 struct wined3d_output
* wined3d_swapchain_get_output(const struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
5056 void swapchain_update_draw_bindings(struct wined3d_swapchain
*swapchain
) DECLSPEC_HIDDEN
;
5057 void swapchain_set_max_frame_latency(struct wined3d_swapchain
*swapchain
,
5058 const struct wined3d_device
*device
) DECLSPEC_HIDDEN
;
5060 HRESULT
wined3d_swapchain_no3d_init(struct wined3d_swapchain
*swapchain_no3d
,
5061 struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
5062 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
5064 struct wined3d_swapchain_gl
5066 struct wined3d_swapchain s
;
5068 struct wined3d_context_gl
**contexts
;
5069 SIZE_T contexts_size
;
5070 SIZE_T context_count
;
5076 static inline struct wined3d_swapchain_gl
*wined3d_swapchain_gl(struct wined3d_swapchain
*swapchain
)
5078 return CONTAINING_RECORD(swapchain
, struct wined3d_swapchain_gl
, s
);
5081 void wined3d_swapchain_gl_cleanup(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
5082 void wined3d_swapchain_gl_destroy_contexts(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
5083 HDC
wined3d_swapchain_gl_get_backup_dc(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
5084 struct wined3d_context_gl
*wined3d_swapchain_gl_get_context(struct wined3d_swapchain_gl
*swapchain_gl
) DECLSPEC_HIDDEN
;
5085 HRESULT
wined3d_swapchain_gl_init(struct wined3d_swapchain_gl
*swapchain_gl
,
5086 struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
5087 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
5089 struct wined3d_swapchain_vk
5091 struct wined3d_swapchain s
;
5093 VkSwapchainKHR vk_swapchain
;
5094 VkSurfaceKHR vk_surface
;
5098 VkSemaphore available
;
5099 VkSemaphore presentable
;
5100 uint64_t command_buffer_id
;
5102 unsigned int current
, image_count
;
5105 static inline struct wined3d_swapchain_vk
*wined3d_swapchain_vk(struct wined3d_swapchain
*swapchain
)
5107 return CONTAINING_RECORD(swapchain
, struct wined3d_swapchain_vk
, s
);
5110 void wined3d_swapchain_vk_cleanup(struct wined3d_swapchain_vk
*swapchain_vk
) DECLSPEC_HIDDEN
;
5111 HRESULT
wined3d_swapchain_vk_init(struct wined3d_swapchain_vk
*swapchain_vk
,
5112 struct wined3d_device
*device
, struct wined3d_swapchain_desc
*desc
,
5113 void *parent
, const struct wined3d_parent_ops
*parent_ops
) DECLSPEC_HIDDEN
;
5115 /*****************************************************************************
5116 * Utility function prototypes
5119 /* Trace routines */
5120 const char *debug_bo_address(const struct wined3d_bo_address
*address
) DECLSPEC_HIDDEN
;
5121 const char *debug_box(const struct wined3d_box
*box
) DECLSPEC_HIDDEN
;
5122 const char *debug_color(const struct wined3d_color
*color
) DECLSPEC_HIDDEN
;
5123 const char *debug_const_bo_address(const struct wined3d_const_bo_address
*address
) DECLSPEC_HIDDEN
;
5124 const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx
) DECLSPEC_HIDDEN
;
5125 const char *debug_d3dformat(enum wined3d_format_id format_id
) DECLSPEC_HIDDEN
;
5126 const char *debug_d3ddevicetype(enum wined3d_device_type device_type
) DECLSPEC_HIDDEN
;
5127 const char *debug_d3dresourcetype(enum wined3d_resource_type resource_type
) DECLSPEC_HIDDEN
;
5128 const char *debug_d3dusage(DWORD usage
) DECLSPEC_HIDDEN
;
5129 const char *debug_d3dusagequery(DWORD usagequery
) DECLSPEC_HIDDEN
;
5130 const char *debug_d3ddeclmethod(enum wined3d_decl_method method
) DECLSPEC_HIDDEN
;
5131 const char *debug_d3ddeclusage(enum wined3d_decl_usage usage
) DECLSPEC_HIDDEN
;
5132 const char *debug_d3dinput_classification(enum wined3d_input_classification classification
) DECLSPEC_HIDDEN
;
5133 const char *debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type
) DECLSPEC_HIDDEN
;
5134 const char *debug_d3drenderstate(enum wined3d_render_state state
) DECLSPEC_HIDDEN
;
5135 const char *debug_d3dsamplerstate(enum wined3d_sampler_state state
) DECLSPEC_HIDDEN
;
5136 const char *debug_d3dstate(DWORD state
) DECLSPEC_HIDDEN
;
5137 const char *debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_type
) DECLSPEC_HIDDEN
;
5138 const char *debug_d3dtexturestate(enum wined3d_texture_stage_state state
) DECLSPEC_HIDDEN
;
5139 const char *debug_d3dtop(enum wined3d_texture_op d3dtop
) DECLSPEC_HIDDEN
;
5140 const char *debug_d3dtstype(enum wined3d_transform_state tstype
) DECLSPEC_HIDDEN
;
5141 const char *debug_fboattachment(GLenum attachment
) DECLSPEC_HIDDEN
;
5142 const char *debug_fbostatus(GLenum status
) DECLSPEC_HIDDEN
;
5143 const char *debug_glerror(GLenum error
) DECLSPEC_HIDDEN
;
5144 const char *debug_ivec4(const struct wined3d_ivec4
*v
) DECLSPEC_HIDDEN
;
5145 const char *debug_uvec4(const struct wined3d_uvec4
*v
) DECLSPEC_HIDDEN
;
5146 const char *debug_shader_type(enum wined3d_shader_type shader_type
) DECLSPEC_HIDDEN
;
5147 const char *debug_vec4(const struct wined3d_vec4
*v
) DECLSPEC_HIDDEN
;
5148 const char *wined3d_debug_feature_level(enum wined3d_feature_level level
) DECLSPEC_HIDDEN
;
5149 void dump_color_fixup_desc(struct color_fixup_desc fixup
) DECLSPEC_HIDDEN
;
5151 BOOL
is_invalid_op(const struct wined3d_state
*state
, int stage
,
5152 enum wined3d_texture_op op
, DWORD arg1
, DWORD arg2
, DWORD arg3
) DECLSPEC_HIDDEN
;
5153 void set_tex_op_nvrc(const struct wined3d_gl_info
*gl_info
, const struct wined3d_state
*state
,
5154 BOOL is_alpha
, int stage
, enum wined3d_texture_op op
, DWORD arg1
, DWORD arg2
, DWORD arg3
,
5155 INT texture_idx
, DWORD dst
) DECLSPEC_HIDDEN
;
5156 void texture_activate_dimensions(struct wined3d_texture
*texture
,
5157 const struct wined3d_gl_info
*gl_info
) DECLSPEC_HIDDEN
;
5158 void sampler_texdim(struct wined3d_context
*context
,
5159 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5160 void tex_alphaop(struct wined3d_context
*context
,
5161 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5162 void apply_pixelshader(struct wined3d_context
*context
,
5163 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5164 void state_alpha_test(struct wined3d_context
*context
,
5165 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5166 void state_fogcolor(struct wined3d_context
*context
,
5167 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5168 void state_fogdensity(struct wined3d_context
*context
,
5169 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5170 void state_fogstartend(struct wined3d_context
*context
,
5171 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5172 void state_fog_fragpart(struct wined3d_context
*context
,
5173 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5174 void state_nop(struct wined3d_context
*context
,
5175 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5176 void state_srgbwrite(struct wined3d_context
*context
,
5177 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5179 void state_clipping(struct wined3d_context
*context
,
5180 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5181 void clipplane(struct wined3d_context
*context
,
5182 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5183 void state_pointsprite_w(struct wined3d_context
*context
,
5184 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5185 void state_pointsprite(struct wined3d_context
*context
,
5186 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5187 void state_shademode(struct wined3d_context
*context
,
5188 const struct wined3d_state
*state
, DWORD state_id
) DECLSPEC_HIDDEN
;
5191 void multiply_matrix(struct wined3d_matrix
*dest
, const struct wined3d_matrix
*src1
,
5192 const struct wined3d_matrix
*src2
) DECLSPEC_HIDDEN
;
5194 void wined3d_release_dc(HWND window
, HDC dc
) DECLSPEC_HIDDEN
;
5196 struct wined3d_shader_lconst
5203 struct wined3d_shader_limits
5205 unsigned int sampler
;
5206 unsigned int constant_int
;
5207 unsigned int constant_float
;
5208 unsigned int constant_bool
;
5209 unsigned int packed_output
;
5210 unsigned int packed_input
;
5214 #define PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
5216 #define PRINTF_ATTR(fmt,args)
5219 struct wined3d_string_buffer_list
5224 struct wined3d_string_buffer
*string_buffer_get(struct wined3d_string_buffer_list
*list
) DECLSPEC_HIDDEN
;
5225 void string_buffer_sprintf(struct wined3d_string_buffer
*buffer
, const char *format
, ...) PRINTF_ATTR(2, 3) DECLSPEC_HIDDEN
;
5226 void string_buffer_release(struct wined3d_string_buffer_list
*list
, struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
5227 void string_buffer_list_init(struct wined3d_string_buffer_list
*list
) DECLSPEC_HIDDEN
;
5228 void string_buffer_list_cleanup(struct wined3d_string_buffer_list
*list
) DECLSPEC_HIDDEN
;
5230 int shader_addline(struct wined3d_string_buffer
*buffer
, const char *fmt
, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN
;
5231 BOOL
string_buffer_resize(struct wined3d_string_buffer
*buffer
, int rc
) DECLSPEC_HIDDEN
;
5232 int shader_vaddline(struct wined3d_string_buffer
*buffer
, const char *fmt
, va_list args
) DECLSPEC_HIDDEN
;
5234 struct wined3d_shader_phase
5238 unsigned int instance_count
;
5239 unsigned int temporary_count
;
5242 struct wined3d_vertex_shader
5244 struct wined3d_shader_attribute attributes
[MAX_ATTRIBS
];
5247 struct wined3d_hull_shader
5251 struct wined3d_shader_phase
*control_point
;
5252 unsigned int fork_count
;
5253 unsigned int join_count
;
5254 struct wined3d_shader_phase
*fork
;
5256 struct wined3d_shader_phase
*join
;
5259 unsigned int output_vertex_count
;
5260 enum wined3d_tessellator_output_primitive tessellator_output_primitive
;
5261 enum wined3d_tessellator_partitioning tessellator_partitioning
;
5264 struct wined3d_domain_shader
5266 enum wined3d_tessellator_domain tessellator_domain
;
5269 struct wined3d_geometry_shader
5271 enum wined3d_primitive_type input_type
;
5272 enum wined3d_primitive_type output_type
;
5273 unsigned int vertices_out
;
5274 unsigned int instance_count
;
5276 struct wined3d_stream_output_desc so_desc
;
5279 struct wined3d_pixel_shader
5281 /* Pixel shader input semantics */
5282 DWORD input_reg_map
[MAX_REG_INPUT
];
5283 DWORD input_reg_used
; /* MAX_REG_INPUT, 32 */
5284 unsigned int declared_in_count
;
5286 /* Some information about the shader behavior */
5290 BOOL force_early_depth_stencil
;
5291 enum wined3d_shader_register_type depth_output
;
5292 DWORD interpolation_mode
[WINED3D_PACKED_INTERPOLATION_SIZE
];
5295 struct wined3d_compute_shader
5297 struct wined3d_shader_thread_group_size thread_group_size
;
5300 struct wined3d_shader
5303 const struct wined3d_shader_limits
*limits
;
5304 const DWORD
*function
;
5305 unsigned int functionLength
;
5307 unsigned int byte_code_size
;
5308 BOOL load_local_constsF
;
5309 const struct wined3d_shader_frontend
*frontend
;
5310 void *frontend_data
;
5314 const struct wined3d_parent_ops
*parent_ops
;
5316 /* Programs this shader is linked with */
5317 struct list linked_programs
;
5319 /* Immediate constants (override global ones) */
5320 struct list constantsB
;
5321 struct list constantsF
;
5322 struct list constantsI
;
5323 struct wined3d_shader_reg_maps reg_maps
;
5324 BOOL lconst_inf_or_nan
;
5326 struct wined3d_shader_signature input_signature
;
5327 struct wined3d_shader_signature output_signature
;
5328 struct wined3d_shader_signature patch_constant_signature
;
5330 /* Pointer to the parent device */
5331 struct wined3d_device
*device
;
5332 struct list shader_list_entry
;
5336 struct wined3d_vertex_shader vs
;
5337 struct wined3d_hull_shader hs
;
5338 struct wined3d_domain_shader ds
;
5339 struct wined3d_geometry_shader gs
;
5340 struct wined3d_pixel_shader ps
;
5341 struct wined3d_compute_shader cs
;
5345 enum wined3d_shader_resource_type
pixelshader_get_resource_type(const struct wined3d_shader_reg_maps
*reg_maps
,
5346 unsigned int resource_idx
, DWORD tex_types
) DECLSPEC_HIDDEN
;
5347 void find_ps_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
5348 BOOL position_transformed
, struct ps_compile_args
*args
,
5349 const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
5351 BOOL
vshader_get_input(const struct wined3d_shader
*shader
,
5352 BYTE usage_req
, BYTE usage_idx_req
, unsigned int *regnum
) DECLSPEC_HIDDEN
;
5353 void find_vs_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
5354 WORD swizzle_map
, struct vs_compile_args
*args
,
5355 const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
5357 void find_ds_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
5358 struct ds_compile_args
*args
, const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
5360 void find_gs_compile_args(const struct wined3d_state
*state
, const struct wined3d_shader
*shader
,
5361 struct gs_compile_args
*args
, const struct wined3d_context
*context
) DECLSPEC_HIDDEN
;
5363 void string_buffer_clear(struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
5364 BOOL
string_buffer_init(struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
5365 void string_buffer_free(struct wined3d_string_buffer
*buffer
) DECLSPEC_HIDDEN
;
5366 unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_maps
*reg_maps
,
5367 unsigned int max
) DECLSPEC_HIDDEN
;
5368 HRESULT
shader_generate_code(const struct wined3d_shader
*shader
, struct wined3d_string_buffer
*buffer
,
5369 const struct wined3d_shader_reg_maps
*reg_maps
, void *backend_ctx
,
5370 const DWORD
*start
, const DWORD
*end
) DECLSPEC_HIDDEN
;
5371 BOOL
shader_match_semantic(const char *semantic_name
, enum wined3d_decl_usage usage
) DECLSPEC_HIDDEN
;
5373 static inline BOOL
shader_is_scalar(const struct wined3d_shader_register
*reg
)
5377 case WINED3DSPR_RASTOUT
:
5379 if (reg
->idx
[0].offset
)
5384 case WINED3DSPR_CONSTBOOL
: /* b# */
5385 case WINED3DSPR_DEPTHOUT
: /* oDepth */
5386 case WINED3DSPR_DEPTHOUTGE
:
5387 case WINED3DSPR_DEPTHOUTLE
:
5388 case WINED3DSPR_LOOP
: /* aL */
5389 case WINED3DSPR_OUTPOINTID
:
5390 case WINED3DSPR_PREDICATE
: /* p0 */
5391 case WINED3DSPR_PRIMID
: /* primID */
5392 case WINED3DSPR_COVERAGE
: /* vCoverage */
5393 case WINED3DSPR_SAMPLEMASK
: /* oMask */
5396 case WINED3DSPR_MISCTYPE
:
5397 switch (reg
->idx
[0].offset
)
5407 case WINED3DSPR_IMMCONST
:
5408 return reg
->immconst_type
== WINED3D_IMMCONST_SCALAR
;
5415 static inline void shader_get_position_fixup(const struct wined3d_context
*context
,
5416 const struct wined3d_state
*state
, unsigned int fixup_count
, float *position_fixup
)
5418 float center_offset
;
5421 if (context
->d3d_info
->wined3d_creation_flags
& WINED3D_PIXEL_CENTER_INTEGER
)
5422 center_offset
= 63.0f
/ 64.0f
;
5424 center_offset
= -1.0f
/ 64.0f
;
5426 for (i
= 0; i
< fixup_count
; ++i
)
5428 position_fixup
[4 * i
] = 1.0f
;
5429 position_fixup
[4 * i
+ 1] = 1.0f
;
5430 position_fixup
[4 * i
+ 2] = center_offset
/ state
->viewports
[i
].width
;
5431 position_fixup
[4 * i
+ 3] = -center_offset
/ state
->viewports
[i
].height
;
5433 if (context
->render_offscreen
)
5435 position_fixup
[4 * i
+ 1] *= -1.0f
;
5436 position_fixup
[4 * i
+ 3] *= -1.0f
;
5441 static inline BOOL
shader_constant_is_local(const struct wined3d_shader
*shader
, DWORD reg
)
5443 struct wined3d_shader_lconst
*lconst
;
5445 if (shader
->load_local_constsF
)
5448 LIST_FOR_EACH_ENTRY(lconst
, &shader
->constantsF
, struct wined3d_shader_lconst
, entry
)
5450 if (lconst
->idx
== reg
)
5457 void get_identity_matrix(struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
5458 void get_modelview_matrix(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
5459 unsigned int index
, struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
5460 void get_projection_matrix(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
5461 struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
5462 void get_texture_matrix(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
5463 unsigned int tex
, struct wined3d_matrix
*mat
) DECLSPEC_HIDDEN
;
5464 void get_pointsize_minmax(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
5465 float *out_min
, float *out_max
) DECLSPEC_HIDDEN
;
5466 void get_pointsize(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
5467 float *out_pointsize
, float *out_att
) DECLSPEC_HIDDEN
;
5468 void get_fog_start_end(const struct wined3d_context
*context
, const struct wined3d_state
*state
,
5469 float *start
, float *end
) DECLSPEC_HIDDEN
;
5471 /* Using additional shader constants (uniforms in GLSL / program environment
5472 * or local parameters in ARB) is costly:
5473 * ARB only knows float4 parameters and GLSL compiler are not really smart
5474 * when it comes to efficiently pack float2 uniforms, so no space is wasted
5475 * (in fact most compilers map a float2 to a full float4 uniform).
5477 * For NP2 texcoord fixup we only need 2 floats (width and height) for each
5478 * 2D texture used in the shader. We therefore pack fixup info for 2 textures
5479 * into a single shader constant (uniform / program parameter).
5481 * This structure is shared between the GLSL and the ARB backend.*/
5482 struct ps_np2fixup_info
{
5483 unsigned char idx
[WINED3D_MAX_FRAGMENT_SAMPLERS
]; /* indices to the real constant */
5484 WORD active
; /* bitfield indicating if we can apply the fixup */
5488 void print_glsl_info_log(const struct wined3d_gl_info
*gl_info
, GLuint id
, BOOL program
) DECLSPEC_HIDDEN
;
5489 void shader_glsl_validate_link(const struct wined3d_gl_info
*gl_info
, GLuint program
) DECLSPEC_HIDDEN
;
5491 struct wined3d_palette
5494 struct wined3d_device
*device
;
5497 RGBQUAD colors
[256];
5501 /* DirectDraw utility functions */
5502 extern enum wined3d_format_id
pixelformat_for_depth(DWORD depth
) DECLSPEC_HIDDEN
;
5504 /*****************************************************************************
5505 * Pixel format management
5508 /* WineD3D pixel format flags */
5509 #define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001
5510 #define WINED3DFMT_FLAG_FILTERING 0x00000002
5511 #define WINED3DFMT_FLAG_DEPTH_STENCIL 0x00000008
5512 #define WINED3DFMT_FLAG_RENDERTARGET 0x00000010
5513 #define WINED3DFMT_FLAG_EXTENSION 0x00000020
5514 #define WINED3DFMT_FLAG_FBO_ATTACHABLE 0x00000040
5515 #define WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB 0x00000080
5516 #define WINED3DFMT_FLAG_DECOMPRESS 0x00000100
5517 #define WINED3DFMT_FLAG_FLOAT 0x00000200
5518 #define WINED3DFMT_FLAG_BUMPMAP 0x00000400
5519 #define WINED3DFMT_FLAG_SRGB_READ 0x00000800
5520 #define WINED3DFMT_FLAG_SRGB_WRITE 0x00001000
5521 #define WINED3DFMT_FLAG_VTF 0x00002000
5522 #define WINED3DFMT_FLAG_SHADOW 0x00004000
5523 #define WINED3DFMT_FLAG_COMPRESSED 0x00008000
5524 #define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
5525 #define WINED3DFMT_FLAG_BLOCKS 0x00020000
5526 #define WINED3DFMT_FLAG_HEIGHT_SCALE 0x00040000
5527 #define WINED3DFMT_FLAG_TEXTURE 0x00080000
5528 #define WINED3DFMT_FLAG_BLOCKS_NO_VERIFY 0x00100000
5529 #define WINED3DFMT_FLAG_INTEGER 0x00200000
5530 #define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000
5531 #define WINED3DFMT_FLAG_NORMALISED 0x00800000
5532 #define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
5533 #define WINED3DFMT_FLAG_BLIT 0x02000000
5534 #define WINED3DFMT_FLAG_MAPPABLE 0x04000000
5536 struct wined3d_rational
5542 struct wined3d_color_key_conversion
5544 enum wined3d_format_id dst_format
;
5545 void (*convert
)(const BYTE
*src
, unsigned int src_pitch
, BYTE
*dst
, unsigned int dst_pitch
,
5546 unsigned int width
, unsigned int height
, const struct wined3d_color_key
*colour_key
);
5549 struct wined3d_format
5551 enum wined3d_format_id id
;
5553 D3DDDIFORMAT ddi_format
;
5554 unsigned int component_count
;
5569 UINT block_byte_count
;
5571 enum wined3d_ffp_emit_idx emit_idx
;
5573 UINT conv_byte_count
;
5574 DWORD multisample_types
;
5575 unsigned int flags
[WINED3D_GL_RES_TYPE_COUNT
];
5576 float depth_bias_scale
;
5577 struct wined3d_rational height_scale
;
5578 struct color_fixup_desc color_fixup
;
5579 void (*upload
)(const BYTE
*src
, BYTE
*dst
, unsigned int src_row_pitch
, unsigned int src_slice_pitch
,
5580 unsigned int dst_row_pitch
, unsigned dst_slice_pitch
,
5581 unsigned int width
, unsigned int height
, unsigned int depth
);
5582 void (*download
)(const BYTE
*src
, BYTE
*dst
, unsigned int src_row_pitch
, unsigned int src_slice_pitch
,
5583 unsigned int dst_row_pitch
, unsigned dst_slice_pitch
,
5584 unsigned int width
, unsigned int height
, unsigned int depth
);
5585 void (*decompress
)(const BYTE
*src
, BYTE
*dst
, unsigned int src_row_pitch
, unsigned int src_slice_pitch
,
5586 unsigned int dst_row_pitch
, unsigned dst_slice_pitch
,
5587 unsigned int width
, unsigned int height
, unsigned int depth
);
5589 enum wined3d_format_id typeless_id
;
5592 const struct wined3d_format
*wined3d_get_format(const struct wined3d_adapter
*adapter
,
5593 enum wined3d_format_id format_id
, unsigned int bind_flags
) DECLSPEC_HIDDEN
;
5594 void wined3d_format_calculate_pitch(const struct wined3d_format
*format
, unsigned int alignment
,
5595 unsigned int width
, unsigned int height
, unsigned int *row_pitch
, unsigned int *slice_pitch
) DECLSPEC_HIDDEN
;
5596 UINT
wined3d_format_calculate_size(const struct wined3d_format
*format
,
5597 UINT alignment
, UINT width
, UINT height
, UINT depth
) DECLSPEC_HIDDEN
;
5598 DWORD
wined3d_format_convert_from_float(const struct wined3d_format
*format
,
5599 const struct wined3d_color
*color
) DECLSPEC_HIDDEN
;
5600 void wined3d_format_copy_data(const struct wined3d_format
*format
, const uint8_t *src
,
5601 unsigned int src_row_pitch
, unsigned int src_slice_pitch
, uint8_t *dst
, unsigned int dst_row_pitch
,
5602 unsigned int dst_slice_pitch
, unsigned int w
, unsigned int h
, unsigned int d
) DECLSPEC_HIDDEN
;
5603 void wined3d_format_get_float_color_key(const struct wined3d_format
*format
,
5604 const struct wined3d_color_key
*key
, struct wined3d_color
*float_colors
) DECLSPEC_HIDDEN
;
5605 BOOL
wined3d_format_is_depth_view(enum wined3d_format_id resource_format_id
,
5606 enum wined3d_format_id view_format_id
) DECLSPEC_HIDDEN
;
5607 const struct wined3d_color_key_conversion
* wined3d_format_get_color_key_conversion(
5608 const struct wined3d_texture
*texture
, BOOL need_alpha_ck
) DECLSPEC_HIDDEN
;
5609 BOOL
wined3d_formats_are_srgb_variants(enum wined3d_format_id format1
,
5610 enum wined3d_format_id format2
) DECLSPEC_HIDDEN
;
5612 struct wined3d_format_gl
5614 struct wined3d_format f
;
5620 GLint srgb_internal
;
5628 static inline const struct wined3d_format_gl
*wined3d_format_gl(const struct wined3d_format
*format
)
5630 return CONTAINING_RECORD(format
, struct wined3d_format_gl
, f
);
5633 struct wined3d_format_vk
5635 struct wined3d_format f
;
5640 static inline const struct wined3d_format_vk
*wined3d_format_vk(const struct wined3d_format
*format
)
5642 return CONTAINING_RECORD(format
, struct wined3d_format_vk
, f
);
5645 BOOL
wined3d_array_reserve(void **elements
, SIZE_T
*capacity
, SIZE_T count
, SIZE_T size
) DECLSPEC_HIDDEN
;
5647 static inline BOOL
wined3d_format_is_typeless(const struct wined3d_format
*format
)
5649 return format
->id
== format
->typeless_id
&& format
->id
!= WINED3DFMT_UNKNOWN
;
5652 static inline BOOL
use_vs(const struct wined3d_state
*state
)
5654 /* Check state->vertex_declaration to allow this to be used before the
5655 * stream info is validated, for example in device_update_tex_unit_map(). */
5656 return state
->shader
[WINED3D_SHADER_TYPE_VERTEX
]
5657 && (!state
->vertex_declaration
|| !state
->vertex_declaration
->position_transformed
);
5660 static inline BOOL
use_ps(const struct wined3d_state
*state
)
5662 return !!state
->shader
[WINED3D_SHADER_TYPE_PIXEL
];
5665 static inline BOOL
use_transform_feedback(const struct wined3d_state
*state
)
5667 const struct wined3d_shader
*shader
;
5669 if (!(shader
= state
->shader
[WINED3D_SHADER_TYPE_GEOMETRY
]))
5671 return shader
->u
.gs
.so_desc
.element_count
;
5674 static inline void context_apply_state(struct wined3d_context
*context
,
5675 const struct wined3d_state
*state
, DWORD state_id
)
5677 const struct wined3d_state_entry
*state_table
= context
->state_table
;
5678 unsigned int rep
= state_table
[state_id
].representative
;
5679 state_table
[rep
].apply(context
, state
, rep
);
5682 static inline BOOL
is_srgb_enabled(const DWORD
*sampler_states
)
5684 /* Only use the LSB of the WINED3D_SAMP_SRGB_TEXTURE value. This matches
5685 * the behaviour of the AMD Windows driver.
5687 * Might & Magic: Heroes VI - Shades of Darkness sets
5688 * WINED3D_SAMP_SRGB_TEXTURE to a large value that looks like a
5689 * pointer—presumably by accident—and expects sRGB decoding to be
5691 return sampler_states
[WINED3D_SAMP_SRGB_TEXTURE
] & 0x1;
5694 static inline BOOL
needs_separate_srgb_gl_texture(const struct wined3d_context
*context
,
5695 const struct wined3d_texture
*texture
)
5697 if (!(context
->d3d_info
->wined3d_creation_flags
& WINED3D_SRGB_READ_WRITE_CONTROL
))
5700 if (!context
->d3d_info
->srgb_read_control
5701 && (texture
->resource
.bind_flags
& WINED3D_BIND_SHADER_RESOURCE
)
5702 && (texture
->resource
.format_flags
& WINED3DFMT_FLAG_SRGB_READ
))
5705 if (!context
->d3d_info
->srgb_write_control
5706 && (texture
->resource
.bind_flags
& WINED3D_BIND_RENDER_TARGET
)
5707 && (texture
->resource
.format_flags
& WINED3DFMT_FLAG_SRGB_WRITE
))
5713 static inline BOOL
needs_srgb_write(const struct wined3d_d3d_info
*d3d_info
,
5714 const struct wined3d_state
*state
, const struct wined3d_fb_state
*fb
)
5716 return (!(d3d_info
->wined3d_creation_flags
& WINED3D_SRGB_READ_WRITE_CONTROL
)
5717 || state
->render_states
[WINED3D_RS_SRGBWRITEENABLE
])
5718 && fb
->render_targets
[0] && fb
->render_targets
[0]->format_flags
& WINED3DFMT_FLAG_SRGB_WRITE
;
5721 static inline GLuint
wined3d_texture_gl_get_texture_name(const struct wined3d_texture_gl
*texture_gl
,
5722 const struct wined3d_context
*context
, BOOL srgb
)
5724 return srgb
&& needs_separate_srgb_gl_texture(context
, &texture_gl
->t
)
5725 ? texture_gl
->texture_srgb
.name
: texture_gl
->texture_rgb
.name
;
5728 static inline BOOL
can_use_texture_swizzle(const struct wined3d_d3d_info
*d3d_info
, const struct wined3d_format
*format
)
5730 return d3d_info
->texture_swizzle
&& !is_complex_fixup(format
->color_fixup
) && !is_scaling_fixup(format
->color_fixup
);
5733 static inline BOOL
is_rasterization_disabled(const struct wined3d_shader
*geometry_shader
)
5735 return geometry_shader
5736 && geometry_shader
->u
.gs
.so_desc
.rasterizer_stream_idx
== WINED3D_NO_RASTERIZER_STREAM
;
5739 static inline DWORD
wined3d_extract_bits(const DWORD
*bitstream
,
5740 unsigned int offset
, unsigned int count
)
5742 const unsigned int word_bit_count
= sizeof(*bitstream
) * CHAR_BIT
;
5743 const unsigned int idx
= offset
/ word_bit_count
;
5744 const unsigned int shift
= offset
% word_bit_count
;
5745 DWORD mask
= (1u << count
) - 1;
5748 ret
= (bitstream
[idx
] >> shift
) & mask
;
5749 if (shift
+ count
> word_bit_count
)
5751 const unsigned int extracted_bit_count
= word_bit_count
- shift
;
5752 const unsigned int remaining_bit_count
= count
- extracted_bit_count
;
5753 mask
= (1u << remaining_bit_count
) - 1;
5754 ret
|= (bitstream
[idx
+ 1] & mask
) << extracted_bit_count
;
5759 static inline void wined3d_insert_bits(DWORD
*bitstream
,
5760 unsigned int offset
, unsigned int count
, DWORD bits
)
5762 const unsigned int word_bit_count
= sizeof(*bitstream
) * CHAR_BIT
;
5763 const unsigned int idx
= offset
/ word_bit_count
;
5764 const unsigned int shift
= offset
% word_bit_count
;
5765 DWORD mask
= (1u << count
) - 1;
5767 bitstream
[idx
] |= (bits
& mask
) << shift
;
5768 if (shift
+ count
> word_bit_count
)
5770 const unsigned int inserted_bit_count
= word_bit_count
- shift
;
5771 const unsigned int remaining_bit_count
= count
- inserted_bit_count
;
5772 mask
= (1u << remaining_bit_count
) - 1;
5773 bitstream
[idx
+ 1] |= (bits
>> inserted_bit_count
) & mask
;
5777 static inline void wined3d_from_cs(const struct wined3d_cs
*cs
)
5780 assert(cs
->thread_id
== GetCurrentThreadId());
5783 static inline void wined3d_not_from_cs(struct wined3d_cs
*cs
)
5785 assert(cs
->thread_id
!= GetCurrentThreadId());
5788 static inline enum wined3d_material_color_source
validate_material_colour_source(WORD use_map
,
5789 enum wined3d_material_color_source source
)
5791 if (source
== WINED3D_MCS_COLOR1
&& use_map
& (1u << WINED3D_FFP_DIFFUSE
))
5793 if (source
== WINED3D_MCS_COLOR2
&& use_map
& (1u << WINED3D_FFP_SPECULAR
))
5795 return WINED3D_MCS_MATERIAL
;
5798 static inline void wined3d_get_material_colour_source(enum wined3d_material_color_source
*diffuse
,
5799 enum wined3d_material_color_source
*emissive
, enum wined3d_material_color_source
*ambient
,
5800 enum wined3d_material_color_source
*specular
, const struct wined3d_state
*state
,
5801 const struct wined3d_stream_info
*si
)
5803 if (!state
->render_states
[WINED3D_RS_LIGHTING
])
5805 *diffuse
= WINED3D_MCS_COLOR1
;
5806 *specular
= WINED3D_MCS_COLOR2
;
5807 *emissive
= *ambient
= WINED3D_MCS_MATERIAL
;
5812 if (!state
->render_states
[WINED3D_RS_COLORVERTEX
])
5814 *diffuse
= *emissive
= *ambient
= *specular
= WINED3D_MCS_MATERIAL
;
5819 *diffuse
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_DIFFUSEMATERIALSOURCE
]);
5820 *emissive
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_EMISSIVEMATERIALSOURCE
]);
5821 *ambient
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_AMBIENTMATERIALSOURCE
]);
5822 *specular
= validate_material_colour_source(si
->use_map
, state
->render_states
[WINED3D_RS_SPECULARMATERIALSOURCE
]);
5825 static inline void wined3d_vec4_transform(struct wined3d_vec4
*dst
,
5826 const struct wined3d_vec4
*v
, const struct wined3d_matrix
*m
)
5828 struct wined3d_vec4 tmp
;
5830 tmp
.x
= v
->x
* m
->_11
+ v
->y
* m
->_21
+ v
->z
* m
->_31
+ v
->w
* m
->_41
;
5831 tmp
.y
= v
->x
* m
->_12
+ v
->y
* m
->_22
+ v
->z
* m
->_32
+ v
->w
* m
->_42
;
5832 tmp
.z
= v
->x
* m
->_13
+ v
->y
* m
->_23
+ v
->z
* m
->_33
+ v
->w
* m
->_43
;
5833 tmp
.w
= v
->x
* m
->_14
+ v
->y
* m
->_24
+ v
->z
* m
->_34
+ v
->w
* m
->_44
;
5838 BOOL
invert_matrix(struct wined3d_matrix
*out
, const struct wined3d_matrix
*m
) DECLSPEC_HIDDEN
;
5840 void compute_normal_matrix(float *normal_matrix
, BOOL legacy_lighting
,
5841 const struct wined3d_matrix
*modelview
) DECLSPEC_HIDDEN
;
5843 static inline struct wined3d_context
*context_acquire(struct wined3d_device
*device
,
5844 struct wined3d_texture
*texture
, unsigned int sub_resource_idx
)
5846 wined3d_from_cs(device
->cs
);
5848 return device
->adapter
->adapter_ops
->adapter_acquire_context(device
, texture
, sub_resource_idx
);
5851 static inline void context_release(struct wined3d_context
*context
)
5853 context
->device
->adapter
->adapter_ops
->adapter_release_context(context
);
5856 static inline float wined3d_get_float_state(const struct wined3d_state
*state
, enum wined3d_render_state rs
)
5865 tmpvalue
.d
= state
->render_states
[rs
];
5869 static inline void *wined3d_context_map_bo_address(struct wined3d_context
*context
,
5870 const struct wined3d_bo_address
*data
, size_t size
, uint32_t map_flags
)
5872 return context
->device
->adapter
->adapter_ops
->adapter_map_bo_address(context
, data
, size
, map_flags
);
5875 static inline void wined3d_context_unmap_bo_address(struct wined3d_context
*context
,
5876 const struct wined3d_bo_address
*data
, unsigned int range_count
, const struct wined3d_range
*ranges
)
5878 context
->device
->adapter
->adapter_ops
->adapter_unmap_bo_address(context
, data
, range_count
, ranges
);
5881 static inline void wined3d_context_copy_bo_address(struct wined3d_context
*context
,
5882 const struct wined3d_bo_address
*dst
, const struct wined3d_bo_address
*src
, size_t size
)
5884 context
->device
->adapter
->adapter_ops
->adapter_copy_bo_address(context
, dst
, src
, size
);
5887 static inline void wined3d_context_vk_reference_bo(const struct wined3d_context_vk
*context_vk
,
5888 struct wined3d_bo_vk
*bo
)
5890 bo
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
5893 static inline void wined3d_context_vk_reference_texture(const struct wined3d_context_vk
*context_vk
,
5894 struct wined3d_texture_vk
*texture_vk
)
5896 texture_vk
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
5899 static inline void wined3d_context_vk_reference_query(const struct wined3d_context_vk
*context_vk
,
5900 struct wined3d_query_vk
*query_vk
)
5902 query_vk
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
5905 static inline void wined3d_context_vk_reference_sampler(const struct wined3d_context_vk
*context_vk
,
5906 struct wined3d_sampler_vk
*sampler_vk
)
5908 sampler_vk
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
5911 static inline void wined3d_context_vk_reference_rendertarget_view(const struct wined3d_context_vk
*context_vk
,
5912 struct wined3d_rendertarget_view_vk
*rtv_vk
)
5914 struct wined3d_resource
*resource
= rtv_vk
->v
.resource
;
5916 if (resource
->type
== WINED3D_RTYPE_BUFFER
)
5917 wined3d_context_vk_reference_bo(context_vk
, &wined3d_buffer_vk(buffer_from_resource(resource
))->bo
);
5919 wined3d_context_vk_reference_texture(context_vk
, wined3d_texture_vk(texture_from_resource(resource
)));
5920 rtv_vk
->command_buffer_id
= context_vk
->current_command_buffer
.id
;
5923 static inline void wined3d_context_vk_reference_shader_resource_view(const struct wined3d_context_vk
*context_vk
,
5924 struct wined3d_shader_resource_view_vk
*srv_vk
)
5926 struct wined3d_resource
*resource
= srv_vk
->v
.resource
;
5928 if (resource
->type
== WINED3D_RTYPE_BUFFER
)
5929 wined3d_context_vk_reference_bo(context_vk
, &wined3d_buffer_vk(buffer_from_resource(resource
))->bo
);
5931 wined3d_context_vk_reference_texture(context_vk
, wined3d_texture_vk(texture_from_resource(resource
)));
5932 srv_vk
->view_vk
.command_buffer_id
= context_vk
->current_command_buffer
.id
;
5935 static inline void wined3d_context_vk_reference_unordered_access_view(const struct wined3d_context_vk
*context_vk
,
5936 struct wined3d_unordered_access_view_vk
*uav_vk
)
5938 struct wined3d_resource
*resource
= uav_vk
->v
.resource
;
5940 if (resource
->type
== WINED3D_RTYPE_BUFFER
)
5941 wined3d_context_vk_reference_bo(context_vk
, &wined3d_buffer_vk(buffer_from_resource(resource
))->bo
);
5943 wined3d_context_vk_reference_texture(context_vk
, wined3d_texture_vk(texture_from_resource(resource
)));
5944 uav_vk
->view_vk
.command_buffer_id
= context_vk
->current_command_buffer
.id
;
5947 static inline BOOL
wined3d_dsv_srv_conflict(const struct wined3d_rendertarget_view
*dsv
,
5948 const struct wined3d_format
*srv_format
)
5950 return !srv_format
|| (srv_format
->red_size
&& !(dsv
->desc
.flags
& WINED3D_VIEW_READ_ONLY_DEPTH
))
5951 || (srv_format
->green_size
&& !(dsv
->desc
.flags
& WINED3D_VIEW_READ_ONLY_STENCIL
));
5954 static inline BOOL
wined3d_resource_check_fbo_attached(const struct wined3d_state
*state
,
5955 const struct wined3d_resource
*resource
, const struct wined3d_format
*srv_format
)
5957 struct wined3d_rendertarget_view
* const *rts
= &state
->fb
.render_targets
[0];
5958 const struct wined3d_rendertarget_view
*dsv
;
5961 if ((resource
->bind_flags
& WINED3D_BIND_DEPTH_STENCIL
)
5962 && (dsv
= state
->fb
.depth_stencil
) && dsv
->resource
== resource
5963 && wined3d_dsv_srv_conflict(dsv
, srv_format
))
5966 if (!(resource
->bind_flags
& WINED3D_BIND_RENDER_TARGET
))
5969 for (i
= 0; i
< WINED3D_MAX_RENDER_TARGETS
; ++i
)
5970 if (rts
[i
] && rts
[i
]->resource
== resource
)
5976 static inline void wined3d_viewport_get_z_range(const struct wined3d_viewport
*vp
, float *min_z
, float *max_z
)
5980 /* The magic constant is derived from tests. */
5981 *max_z
= max(vp
->max_z
, vp
->min_z
+ 0.001f
);
5984 static inline BOOL
wined3d_bitmap_clear(uint32_t *map
, unsigned int idx
)
5986 return map
[idx
>> 5] &= ~(1u << (idx
& 0x1f));
5989 static inline BOOL
wined3d_bitmap_set(uint32_t *map
, unsigned int idx
)
5991 return map
[idx
>> 5] |= (1u << (idx
& 0x1f));
5994 static inline BOOL
wined3d_bitmap_is_set(const uint32_t *map
, unsigned int idx
)
5996 return map
[idx
>> 5] & (1u << (idx
& 0x1f));
5999 static inline unsigned int wined3d_bitmap_ffs_xor(const uint32_t *bitmap
, unsigned int bit_count
,
6000 unsigned int start
, uint32_t xor_mask
)
6002 const unsigned int word_bit_count
= sizeof(*bitmap
) * CHAR_BIT
;
6003 const uint32_t *ptr
, *end_ptr
;
6006 assert(bit_count
< word_bit_count
|| !(bit_count
% word_bit_count
));
6008 ptr
= bitmap
+ start
/ word_bit_count
;
6009 end_ptr
= bitmap
+ (bit_count
+ word_bit_count
- 1) / word_bit_count
;
6014 mask
= ~0u << start
% word_bit_count
;
6015 map
= (*ptr
^ xor_mask
) & mask
;
6018 if (++ptr
== end_ptr
)
6020 map
= *ptr
^ xor_mask
;
6022 return (ptr
- bitmap
) * word_bit_count
+ wined3d_bit_scan(&map
);
6025 static inline unsigned int wined3d_bitmap_ffs(const uint32_t *bitmap
, unsigned int bit_count
, unsigned int start
)
6027 return wined3d_bitmap_ffs_xor(bitmap
, bit_count
, start
, 0);
6030 static inline unsigned int wined3d_bitmap_ffz(const uint32_t *bitmap
, unsigned int bit_count
, unsigned int start
)
6032 return wined3d_bitmap_ffs_xor(bitmap
, bit_count
, start
, ~0u);
6035 static inline BOOL
wined3d_bitmap_get_range(const DWORD
*bitmap
, unsigned int bit_count
,
6036 unsigned int start
, struct wined3d_range
*range
)
6038 unsigned int range_start
, range_end
;
6040 range_start
= wined3d_bitmap_ffs(bitmap
, bit_count
, start
);
6041 if (range_start
== ~0u)
6044 range_end
= wined3d_bitmap_ffz(bitmap
, bit_count
, range_start
+ 1);
6045 if (range_end
== ~0u)
6046 range_end
= bit_count
;
6048 range
->offset
= range_start
;
6049 range
->size
= range_end
- range_start
;
6053 static inline bool wined3d_context_is_graphics_state_dirty(const struct wined3d_context
*context
, unsigned int state_id
)
6055 return wined3d_bitmap_is_set(context
->dirty_graphics_states
, state_id
);
6058 static inline bool wined3d_context_is_compute_state_dirty(const struct wined3d_context
*context
, unsigned int state_id
)
6060 return wined3d_bitmap_is_set(context
->dirty_compute_states
, state_id
- STATE_COMPUTE_OFFSET
);
6063 static inline bool isStateDirty(const struct wined3d_context
*context
, unsigned int state_id
)
6065 return wined3d_context_is_graphics_state_dirty(context
, state_id
);
6068 static inline VkImageAspectFlags
vk_aspect_mask_from_format(const struct wined3d_format
*format
)
6070 VkImageAspectFlags mask
= 0;
6072 if (format
->depth_size
)
6073 mask
|= VK_IMAGE_ASPECT_DEPTH_BIT
;
6074 if (format
->stencil_size
)
6075 mask
|= VK_IMAGE_ASPECT_STENCIL_BIT
;
6076 if (!mask
|| format
->red_size
|| format
->green_size
|| format
->blue_size
|| format
->alpha_size
)
6077 mask
|= VK_IMAGE_ASPECT_COLOR_BIT
;
6082 static inline bool wined3d_primitive_type_is_list(enum wined3d_primitive_type t
)
6084 return t
== WINED3D_PT_POINTLIST
6085 || t
== WINED3D_PT_LINELIST
6086 || t
== WINED3D_PT_TRIANGLELIST
6087 || t
== WINED3D_PT_LINELIST_ADJ
6088 || t
== WINED3D_PT_TRIANGLELIST_ADJ
6089 || t
== WINED3D_PT_PATCH
;
6092 /* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
6093 #define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"