ReactOS 0.4.17-dev-970-gcf0f1a6
utils.c
Go to the documentation of this file.
1/*
2 * Utility functions for the WineD3D Library
3 *
4 * Copyright 2002-2004 Jason Edmeades
5 * Copyright 2003-2004 Raphael Junqueira
6 * Copyright 2004 Christian Costa
7 * Copyright 2005 Oliver Stieber
8 * Copyright 2006-2008 Henri Verbeet
9 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
10 * Copyright 2009-2010 Henri Verbeet for CodeWeavers
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include <stdio.h>
28
29#include "wined3d_private.h"
30#include "wined3d_gl.h"
31#include "wined3d_vk.h"
32
34
35#define WINED3D_FORMAT_FOURCC_BASE (WINED3DFMT_BC7_UNORM_SRGB + 1)
36
37static const struct
38{
40 unsigned int idx;
41}
43{
68};
69
70#define WINED3D_FORMAT_COUNT (WINED3D_FORMAT_FOURCC_BASE + ARRAY_SIZE(format_index_remap))
71
73{
79 const char *channels;
80};
81
82static const struct wined3d_format_channels formats[] =
83{
84 /* size offset
85 * format id r g b a r g b a bpp z s channels */
86 {WINED3DFMT_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
87 /* FourCC formats */
88 {WINED3DFMT_UYVY, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
89 {WINED3DFMT_YUY2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
90 {WINED3DFMT_YV12, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
91 {WINED3DFMT_NV12, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
92 {WINED3DFMT_DXT1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
93 {WINED3DFMT_DXT2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
94 {WINED3DFMT_DXT3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
95 {WINED3DFMT_DXT4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
96 {WINED3DFMT_DXT5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
97 {WINED3DFMT_MULTI2_ARGB8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
98 {WINED3DFMT_G8R8_G8B8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
99 {WINED3DFMT_R8G8_B8G8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
100 /* Hmm? */
101 {WINED3DFMT_R8G8_SNORM_Cx, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
102 {WINED3DFMT_R11G11B10_FLOAT, 11, 11, 10, 0, 0, 11, 22, 0, 4, 0, 0, "FFF"},
103 /* Palettized formats */
104 {WINED3DFMT_P8_UINT_A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 8, 2, 0, 0},
105 {WINED3DFMT_P8_UINT, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
106 /* Standard ARGB formats. */
107 {WINED3DFMT_B8G8R8_UNORM, 8, 8, 8, 0, 16, 8, 0, 0, 3, 0, 0, "uuu"},
108 {WINED3DFMT_B5G6R5_UNORM, 5, 6, 5, 0, 11, 5, 0, 0, 2, 0, 0, "uuu"},
109 {WINED3DFMT_B5G5R5X1_UNORM, 5, 5, 5, 0, 10, 5, 0, 0, 2, 0, 0, "uuuX"},
110 {WINED3DFMT_B5G5R5A1_UNORM, 5, 5, 5, 1, 10, 5, 0, 15, 2, 0, 0, "uuuu"},
111 {WINED3DFMT_B4G4R4A4_UNORM, 4, 4, 4, 4, 8, 4, 0, 12, 2, 0, 0, "uuuu"},
112 {WINED3DFMT_B2G3R3_UNORM, 3, 3, 2, 0, 5, 2, 0, 0, 1, 0, 0, "uuu"},
113 {WINED3DFMT_A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 0, 1, 0, 0, "u"},
114 {WINED3DFMT_B2G3R3A8_UNORM, 3, 3, 2, 8, 5, 2, 0, 8, 2, 0, 0, "uuuu"},
115 {WINED3DFMT_B4G4R4X4_UNORM, 4, 4, 4, 0, 8, 4, 0, 0, 2, 0, 0, "uuuX"},
116 {WINED3DFMT_R8G8B8X8_UNORM, 8, 8, 8, 0, 0, 8, 16, 0, 4, 0, 0, "uuuX"},
117 {WINED3DFMT_B10G10R10A2_UNORM, 10, 10, 10, 2, 20, 10, 0, 30, 4, 0, 0, "uuuu"},
118 /* Luminance */
119 {WINED3DFMT_L8_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
120 {WINED3DFMT_L8A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 8, 2, 0, 0},
121 {WINED3DFMT_L4A4_UNORM, 0, 0, 0, 4, 0, 0, 0, 4, 1, 0, 0},
122 {WINED3DFMT_L16_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
123 /* Bump mapping stuff */
124 {WINED3DFMT_R5G5_SNORM_L6_UNORM, 5, 5, 0, 0, 0, 5, 0, 0, 2, 0, 0},
125 {WINED3DFMT_R8G8_SNORM_L8X8_UNORM, 8, 8, 0, 0, 0, 8, 0, 0, 4, 0, 0},
126 {WINED3DFMT_R10G11B11_SNORM, 10, 11, 11, 0, 0, 10, 21, 0, 4, 0, 0, "iii"},
127 {WINED3DFMT_R10G10B10_SNORM_A2_UNORM, 10, 10, 10, 2, 0, 10, 20, 30, 4, 0, 0, "iiiu"},
128 /* Depth stencil formats */
129 {WINED3DFMT_D16_LOCKABLE, 0, 0, 0, 0, 0, 0, 0, 0, 2, 16, 0, "D"},
130 {WINED3DFMT_D32_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 32, 0, "D"},
131 {WINED3DFMT_S1_UINT_D15_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 2, 15, 1, "SD"},
132 {WINED3DFMT_X8D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 0, "XD"},
133 {WINED3DFMT_S4X4_UINT_D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 4, "SXD"},
134 {WINED3DFMT_S8_UINT_D24_FLOAT, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8, "SD"},
135 /* Vendor-specific formats */
136 {WINED3DFMT_ATI1N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
137 {WINED3DFMT_ATI2N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
138 {WINED3DFMT_NVDB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
139 {WINED3DFMT_ATOC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
140 {WINED3DFMT_INST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
141 {WINED3DFMT_INTZ, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8},
142 {WINED3DFMT_RESZ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
143 {WINED3DFMT_NVHU, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
144 {WINED3DFMT_NVHS, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
145 {WINED3DFMT_NULL, 8, 8, 8, 8, 0, 8, 16, 24, 4, 0, 0},
146 /* Unsure about them, could not find a Windows driver that supports them */
147 {WINED3DFMT_R16, 16, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
148 {WINED3DFMT_AL16, 0, 0, 0, 16, 0, 0, 0, 16, 4, 0, 0},
149 /* DirectX 10 HDR formats */
150 {WINED3DFMT_R9G9B9E5_SHAREDEXP, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0},
151 /* Typeless */
152 {WINED3DFMT_R32G32B32A32_TYPELESS, 32, 32, 32, 32, 0, 32, 64, 96, 16, 0, 0},
153 {WINED3DFMT_R32G32B32_TYPELESS, 32, 32, 32, 0, 0, 32, 64, 0, 12, 0, 0},
154 {WINED3DFMT_R16G16B16A16_TYPELESS, 16, 16, 16, 16, 0, 16, 32, 48, 8, 0, 0},
155 {WINED3DFMT_R32G32_TYPELESS, 32, 32, 0, 0, 0, 32, 0, 0, 8, 0, 0},
156 {WINED3DFMT_R32G8X24_TYPELESS, 32, 8, 0, 0, 0, 0, 0, 0, 8, 0, 0},
157 {WINED3DFMT_R10G10B10A2_TYPELESS, 10, 10, 10, 2, 0, 10, 20, 30, 4, 0, 0},
158 {WINED3DFMT_R10G10B10X2_TYPELESS, 10, 10, 10, 0, 0, 10, 20, 0, 4, 0, 0},
159 {WINED3DFMT_R8G8B8A8_TYPELESS, 8, 8, 8, 8, 0, 8, 16, 24, 4, 0, 0},
160 {WINED3DFMT_R16G16_TYPELESS, 16, 16, 0, 0, 0, 16, 0, 0, 4, 0, 0},
161 {WINED3DFMT_R32_TYPELESS, 32, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0},
162 {WINED3DFMT_R24G8_TYPELESS, 24, 8, 0, 0, 0, 0, 0, 0, 4, 0, 0},
163 {WINED3DFMT_R8G8_TYPELESS, 8, 8, 0, 0, 0, 8, 0, 0, 2, 0, 0},
164 {WINED3DFMT_R16_TYPELESS, 16, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
165 {WINED3DFMT_R8_TYPELESS, 8, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
166 {WINED3DFMT_BC1_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
167 {WINED3DFMT_BC2_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
168 {WINED3DFMT_BC3_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
169 {WINED3DFMT_BC4_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
170 {WINED3DFMT_BC5_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
171 {WINED3DFMT_BC6H_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
172 {WINED3DFMT_BC7_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
173 {WINED3DFMT_B8G8R8A8_TYPELESS, 8, 8, 8, 8, 16, 8, 0, 24, 4, 0, 0},
174 {WINED3DFMT_B8G8R8X8_TYPELESS, 8, 8, 8, 0, 16, 8, 0, 0, 4, 0, 0},
175};
176
178{
181 const char *channels;
182};
183
197{
269};
270
272{
278};
279
281{
288};
289
291{
294};
295
297{
307};
308
310{
312 unsigned int attrs;
313 unsigned int caps;
314};
315
316/* The ATI2N format behaves like an uncompressed format in LockRect(), but
317 * still needs to use the correct block based calculation for e.g. the
318 * resource size. */
320{
359};
360
361static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
362{
363 BYTE c;
364
365 /* (2⁸ - 1) / (2⁵ - 1) ≈ 2⁸ / 2⁵ + 2⁸ / 2¹⁰
366 * (2⁸ - 1) / (2⁶ - 1) ≈ 2⁸ / 2⁶ + 2⁸ / 2¹² */
367 c = rgb565 >> 11;
368 *r = (c << 3) + (c >> 2);
369 c = (rgb565 >> 5) & 0x3f;
370 *g = (c << 2) + (c >> 4);
371 c = rgb565 & 0x1f;
372 *b = (c << 3) + (c >> 2);
373}
374
375static void build_dxtn_colour_table(WORD colour0, WORD colour1,
376 DWORD colour_table[4], enum wined3d_format_id format_id)
377{
378 unsigned int i;
379 struct
380 {
381 BYTE r, g, b;
382 } c[4];
383
384 rgb888_from_rgb565(colour0, &c[0].r, &c[0].g, &c[0].b);
385 rgb888_from_rgb565(colour1, &c[1].r, &c[1].g, &c[1].b);
386
387 if (format_id == WINED3DFMT_BC1_UNORM && colour0 <= colour1)
388 {
389 c[2].r = (c[0].r + c[1].r) / 2;
390 c[2].g = (c[0].g + c[1].g) / 2;
391 c[2].b = (c[0].b + c[1].b) / 2;
392
393 c[3].r = 0;
394 c[3].g = 0;
395 c[3].b = 0;
396 }
397 else
398 {
399 for (i = 0; i < 2; ++i)
400 {
401 c[i + 2].r = (2 * c[i].r + c[1 - i].r) / 3;
402 c[i + 2].g = (2 * c[i].g + c[1 - i].g) / 3;
403 c[i + 2].b = (2 * c[i].b + c[1 - i].b) / 3;
404 }
405 }
406
407 for (i = 0; i < 4; ++i)
408 {
409 colour_table[i] = (c[i].r << 16) | (c[i].g << 8) | c[i].b;
410 }
411}
412
413static void build_bc3_alpha_table(BYTE alpha0, BYTE alpha1, BYTE alpha_table[8])
414{
415 unsigned int i;
416
417 alpha_table[0] = alpha0;
418 alpha_table[1] = alpha1;
419
420 if (alpha0 > alpha1)
421 {
422 for (i = 0; i < 6; ++i)
423 {
424 alpha_table[2 + i] = ((6 - i) * alpha0 + (i + 1) * alpha1) / 7;
425 }
426 return;
427 }
428 else
429 {
430 for (i = 0; i < 4; ++i)
431 {
432 alpha_table[2 + i] = ((4 - i) * alpha0 + (i + 1) * alpha1) / 5;
433 }
434 alpha_table[6] = 0x00;
435 alpha_table[7] = 0xff;
436 }
437}
438
439static void decompress_dxtn_block(const BYTE *src, BYTE *dst, unsigned int width,
440 unsigned int height, unsigned int dst_row_pitch, enum wined3d_format_id format_id)
441{
442 const UINT64 *s = (const UINT64 *)src;
443 BOOL bc1_alpha = FALSE;
444 DWORD colour_table[4];
445 BYTE alpha_table[8];
446 UINT64 alpha_bits;
447 DWORD colour_bits;
448 unsigned int x, y;
449 BYTE colour_idx;
450 DWORD *dst_row;
451 BYTE alpha;
452
454 {
455 WORD colour0, colour1;
456
457 alpha_bits = 0;
458
459 colour0 = s[0] & 0xffff;
460 colour1 = (s[0] >> 16) & 0xffff;
461 colour_bits = (s[0] >> 32) & 0xffffffff;
462 build_dxtn_colour_table(colour0, colour1, colour_table, format_id);
463 if (colour0 <= colour1)
464 bc1_alpha = TRUE;
465 }
466 else
467 {
468 alpha_bits = s[0];
470 {
471 build_bc3_alpha_table(alpha_bits & 0xff, (alpha_bits >> 8) & 0xff, alpha_table);
472 alpha_bits >>= 16;
473 }
474
475 colour_bits = (s[1] >> 32) & 0xffffffff;
476 build_dxtn_colour_table(s[1] & 0xffff, (s[1] >> 16) & 0xffff, colour_table, format_id);
477 }
478
479 for (y = 0; y < height; ++y)
480 {
481 dst_row = (DWORD *)&dst[y * dst_row_pitch];
482 for (x = 0; x < width; ++x)
483 {
484 colour_idx = (colour_bits >> (y * 8 + x * 2)) & 0x3;
485 switch (format_id)
486 {
488 alpha = bc1_alpha && colour_idx == 3 ? 0x00 : 0xff;
489 break;
490
492 alpha = (alpha_bits >> (y * 16 + x * 4)) & 0xf;
493 /* (2⁸ - 1) / (2⁴ - 1) ≈ 2⁸ / 2⁴ + 2⁸ / 2⁸ */
494 alpha |= alpha << 4;
495 break;
496
498 alpha = alpha_table[(alpha_bits >> (y * 12 + x * 3)) & 0x7];
499 break;
500
501 default:
502 alpha = 0xff;
503 break;
504 }
505 dst_row[x] = (alpha << 24) | colour_table[colour_idx];
506 }
507 }
508}
509
510static void decompress_dxtn(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
511 unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
512 unsigned int width, unsigned int height, unsigned int depth, enum wined3d_format_id format_id)
513{
514 unsigned int block_byte_count, block_w, block_h;
515 const BYTE *src_row, *src_slice = src;
516 BYTE *dst_row, *dst_slice = dst;
517 unsigned int x, y, z;
518
519 block_byte_count = format_id == WINED3DFMT_BC1_UNORM ? 8 : 16;
520
521 for (z = 0; z < depth; ++z)
522 {
523 src_row = src_slice;
524 dst_row = dst_slice;
525 for (y = 0; y < height; y += 4)
526 {
527 for (x = 0; x < width; x += 4)
528 {
529 block_w = min(width - x, 4);
530 block_h = min(height - y, 4);
531 decompress_dxtn_block(&src_row[x * (block_byte_count / 4)],
532 &dst_row[x * 4], block_w, block_h, dst_row_pitch, format_id);
533 }
534 src_row += src_row_pitch;
535 dst_row += dst_row_pitch * 4;
536 }
537 src_slice += src_slice_pitch;
538 dst_slice += dst_slice_pitch;
539 }
540}
541
542static void decompress_bc3(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
543 unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
544 unsigned int width, unsigned int height, unsigned int depth)
545{
546 decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
547 dst_slice_pitch, width, height, depth, WINED3DFMT_BC3_UNORM);
548}
549
550static void decompress_bc2(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
551 unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
552 unsigned int width, unsigned int height, unsigned int depth)
553{
554 decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
555 dst_slice_pitch, width, height, depth, WINED3DFMT_BC2_UNORM);
556}
557
558static void decompress_bc1(const BYTE *src, BYTE *dst, unsigned int src_row_pitch,
559 unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
560 unsigned int width, unsigned int height, unsigned int depth)
561{
562 decompress_dxtn(src, dst, src_row_pitch, src_slice_pitch, dst_row_pitch,
563 dst_slice_pitch, width, height, depth, WINED3DFMT_BC1_UNORM);
564}
565
566static void build_rgtc_colour_table(uint8_t red0, uint8_t red1, uint8_t colour_table[8])
567{
568 unsigned int i;
569
570 colour_table[0] = red0;
571 colour_table[1] = red1;
572 if (red0 <= red1)
573 {
574 for (i = 0; i < 4; ++i)
575 {
576 colour_table[i + 2] = ((8 - 2 * i) * red0 + (2 + 2 * i) * red1 + 5) / 10;
577 }
578 colour_table[6] = 0x00;
579 colour_table[7] = 0xff;
580 }
581 else
582 {
583 for (i = 0; i < 6; ++i)
584 {
585 colour_table[i + 2] = ((12 - 2 * i) * red0 + (2 + 2 * i) * red1 + 7) / 14;
586 }
587 }
588}
589
591 unsigned int width, unsigned int height, unsigned int dst_row_pitch)
592{
593 const uint64_t *s = (const uint64_t *)src;
594 uint8_t red0, red1, red_idx;
595 uint8_t colour_table[8];
596 unsigned int x, y;
597 uint32_t *dst_row;
599
600 red0 = s[0] & 0xff;
601 red1 = (s[0] >> 8) & 0xff;
602 bits = s[0] >> 16;
603 build_rgtc_colour_table(red0, red1, colour_table);
604
605 for (y = 0; y < height; ++y)
606 {
607 dst_row = (uint32_t *)&dst[y * dst_row_pitch];
608 for (x = 0; x < width; ++x)
609 {
610 red_idx = (bits >> (y * 12 + x * 3)) & 0x7;
611 /* Decompressing to bgra32 is perhaps not ideal for RGTC formats.
612 * It's convenient though. */
613 dst_row[x] = 0xff000000 | (colour_table[red_idx] << 16);
614 }
615 }
616}
617
618static void decompress_bc4(const uint8_t *src, uint8_t *dst, unsigned int src_row_pitch,
619 unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
620 unsigned int width, unsigned int height, unsigned int depth)
621{
622 unsigned int block_w, block_h, x, y, z;
623 const uint8_t *src_row, *src_slice;
624 uint8_t *dst_row, *dst_slice;
625
626 for (z = 0; z < depth; ++z)
627 {
628 src_slice = &src[z * src_slice_pitch];
629 dst_slice = &dst[z * dst_slice_pitch];
630 for (y = 0; y < height; y += 4)
631 {
632 src_row = &src_slice[(y / 4) * src_row_pitch];
633 dst_row = &dst_slice[y * dst_row_pitch];
634 for (x = 0; x < width; x += 4)
635 {
636 block_w = min(width - x, 4);
637 block_h = min(height - y, 4);
638 decompress_rgtc_block(&src_row[(x / 4) * 8], &dst_row[x * 4], block_w, block_h, dst_row_pitch);
639 }
640 }
641 }
642}
643
645{
647 void (*decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
648 unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
649 unsigned int width, unsigned int height, unsigned int depth);
650}
652{
663
665{
670 unsigned int attrs;
671};
672
674{
695};
696
698{
703};
704
706{
727 /* Without ARB_half_float_vertex we convert these on upload. */
750};
751
753{
760 unsigned int conv_byte_count;
761 unsigned int caps;
763 void (*upload)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
764 unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
765 unsigned int width, unsigned int height, unsigned int depth);
766 void (*download)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
767 unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
768 unsigned int width, unsigned int height, unsigned int depth);
769 void (*decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch,
770 unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
771 unsigned int width, unsigned int height, unsigned int depth);
772};
773
774static void convert_l4a4_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
775 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
776{
777 /* WINED3DFMT_L4A4_UNORM exists as an internal gl format, but for some reason there is not
778 * format+type combination to load it. Thus convert it to A8L8, then load it
779 * with A4L4 internal, but A8L8 format+type
780 */
781 unsigned int x, y, z;
782 const unsigned char *Source;
783 unsigned char *Dest;
784
785 for (z = 0; z < depth; z++)
786 {
787 for (y = 0; y < height; y++)
788 {
789 Source = src + z * src_slice_pitch + y * src_row_pitch;
790 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
791 for (x = 0; x < width; x++ )
792 {
793 unsigned char color = (*Source++);
794 /* A */ Dest[1] = (color & 0xf0u) << 0;
795 /* L */ Dest[0] = (color & 0x0fu) << 4;
796 Dest += 2;
797 }
798 }
799 }
800}
801
802static void convert_r5g5_snorm_l6_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
803 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
804{
805 unsigned int x, y, z;
806 unsigned char r_in, g_in, l_in;
807 const unsigned short *texel_in;
808 unsigned short *texel_out;
809
810 /* Emulating signed 5 bit values with unsigned 5 bit values has some precision problems by design:
811 * E.g. the signed input value 0 becomes 16. GL normalizes it to 16 / 31 = 0.516. We convert it
812 * back to a signed value by subtracting 0.5 and multiplying by 2.0. The resulting value is
813 * ((16 / 31) - 0.5) * 2.0 = 0.032, which is quite different from the intended result 0.000. */
814 for (z = 0; z < depth; z++)
815 {
816 for (y = 0; y < height; y++)
817 {
818 texel_out = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
819 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
820 for (x = 0; x < width; x++ )
821 {
822 l_in = (*texel_in & 0xfc00u) >> 10;
823 g_in = (*texel_in & 0x03e0u) >> 5;
824 r_in = *texel_in & 0x001fu;
825
826 *texel_out = ((r_in + 16) << 11) | (l_in << 5) | (g_in + 16);
827 texel_out++;
828 texel_in++;
829 }
830 }
831 }
832}
833
834static void convert_r5g5_snorm_l6_unorm_ext(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
835 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
836{
837 unsigned int x, y, z;
838 unsigned char *texel_out, r_out, g_out, r_in, g_in, l_in;
839 const unsigned short *texel_in;
840
841 for (z = 0; z < depth; z++)
842 {
843 for (y = 0; y < height; y++)
844 {
845 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
846 texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
847 for (x = 0; x < width; x++ )
848 {
849 l_in = (*texel_in & 0xfc00u) >> 10;
850 g_in = (*texel_in & 0x03e0u) >> 5;
851 r_in = *texel_in & 0x001fu;
852
853 r_out = r_in << 3;
854 if (!(r_in & 0x10)) /* r > 0 */
855 r_out |= r_in >> 1;
856
857 g_out = g_in << 3;
858 if (!(g_in & 0x10)) /* g > 0 */
859 g_out |= g_in >> 1;
860
861 texel_out[0] = r_out;
862 texel_out[1] = g_out;
863 texel_out[2] = l_in << 1 | l_in >> 5;
864 texel_out[3] = 0;
865
866 texel_out += 4;
867 texel_in++;
868 }
869 }
870 }
871}
872
873static void convert_r5g5_snorm_l6_unorm_nv(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
874 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
875{
876 unsigned int x, y, z;
877 unsigned char *texel_out, ds_out, dt_out, r_in, g_in, l_in;
878 const unsigned short *texel_in;
879
880 /* This makes the gl surface bigger(24 bit instead of 16), but it works with
881 * fixed function and shaders without further conversion once the surface is
882 * loaded.
883 *
884 * The difference between this function and convert_r5g5_snorm_l6_unorm_ext
885 * is that convert_r5g5_snorm_l6_unorm_ext creates a 32 bit XRGB texture and
886 * this function creates a 24 bit DSDT_MAG texture. Trying to load a DSDT_MAG
887 * internal with a 32 bit DSDT_MAG_INTENSITY or DSDT_MAG_VIB format fails. */
888 for (z = 0; z < depth; z++)
889 {
890 for (y = 0; y < height; y++)
891 {
892 texel_in = (const unsigned short *)(src + z * src_slice_pitch + y * src_row_pitch);
893 texel_out = dst + z * dst_slice_pitch + y * dst_row_pitch;
894 for (x = 0; x < width; x++ )
895 {
896 l_in = (*texel_in & 0xfc00u) >> 10;
897 g_in = (*texel_in & 0x03e0u) >> 5;
898 r_in = *texel_in & 0x001fu;
899
900 ds_out = r_in << 3;
901 if (!(r_in & 0x10)) /* r > 0 */
902 ds_out |= r_in >> 1;
903
904 dt_out = g_in << 3;
905 if (!(g_in & 0x10)) /* g > 0 */
906 dt_out |= g_in >> 1;
907
908 texel_out[0] = ds_out;
909 texel_out[1] = dt_out;
910 texel_out[2] = l_in << 1 | l_in >> 5;
911
912 texel_out += 3;
913 texel_in++;
914 }
915 }
916 }
917}
918
919static void convert_r8g8_snorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
920 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
921{
922 unsigned int x, y, z;
923 const short *Source;
924 unsigned char *Dest;
925
926 for (z = 0; z < depth; z++)
927 {
928 for (y = 0; y < height; y++)
929 {
930 Source = (const short *)(src + z * src_slice_pitch + y * src_row_pitch);
931 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
932 for (x = 0; x < width; x++ )
933 {
934 const short color = (*Source++);
935 /* B */ Dest[0] = 0xff;
936 /* G */ Dest[1] = (color >> 8) + 128; /* V */
937 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
938 Dest += 3;
939 }
940 }
941 }
942}
943
944static void convert_r8g8_snorm_l8x8_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
945 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
946{
947 unsigned int x, y, z;
948 const DWORD *Source;
949 unsigned char *Dest;
950
951 /* Doesn't work correctly with the fixed function pipeline, but can work in
952 * shaders if the shader is adjusted. (There's no use for this format in gl's
953 * standard fixed function pipeline anyway).
954 */
955 for (z = 0; z < depth; z++)
956 {
957 for (y = 0; y < height; y++)
958 {
959 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
960 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
961 for (x = 0; x < width; x++ )
962 {
963 LONG color = (*Source++);
964 /* B */ Dest[0] = ((color >> 16) & 0xff); /* L */
965 /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
966 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
967 Dest += 4;
968 }
969 }
970 }
971}
972
973static void convert_r8g8_snorm_l8x8_unorm_nv(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
974 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
975{
976 unsigned int x, y, z;
977 const DWORD *Source;
978 unsigned char *Dest;
979
980 /* This implementation works with the fixed function pipeline and shaders
981 * without further modification after converting the surface.
982 */
983 for (z = 0; z < depth; z++)
984 {
985 for (y = 0; y < height; y++)
986 {
987 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
988 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
989 for (x = 0; x < width; x++ )
990 {
991 LONG color = (*Source++);
992 /* L */ Dest[2] = ((color >> 16) & 0xff); /* L */
993 /* V */ Dest[1] = ((color >> 8 ) & 0xff); /* V */
994 /* U */ Dest[0] = (color & 0xff); /* U */
995 /* I */ Dest[3] = 255; /* X */
996 Dest += 4;
997 }
998 }
999 }
1000}
1001
1002static void convert_r8g8b8a8_snorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
1003 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
1004{
1005 unsigned int x, y, z;
1006 const DWORD *Source;
1007 unsigned char *Dest;
1008
1009 for (z = 0; z < depth; z++)
1010 {
1011 for (y = 0; y < height; y++)
1012 {
1013 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1014 Dest = dst + z * dst_slice_pitch + y * dst_row_pitch;
1015 for (x = 0; x < width; x++ )
1016 {
1017 LONG color = (*Source++);
1018 /* B */ Dest[0] = ((color >> 16) & 0xff) + 128; /* W */
1019 /* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
1020 /* R */ Dest[2] = (color & 0xff) + 128; /* U */
1021 /* A */ Dest[3] = ((color >> 24) & 0xff) + 128; /* Q */
1022 Dest += 4;
1023 }
1024 }
1025 }
1026}
1027
1028static void convert_r16g16_snorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
1029 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
1030{
1031 unsigned int x, y, z;
1032 const DWORD *Source;
1033 unsigned short *Dest;
1034
1035 for (z = 0; z < depth; z++)
1036 {
1037 for (y = 0; y < height; y++)
1038 {
1039 Source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1040 Dest = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
1041 for (x = 0; x < width; x++ )
1042 {
1043 const DWORD color = (*Source++);
1044 /* B */ Dest[0] = 0xffff;
1045 /* G */ Dest[1] = (color >> 16) + 32768; /* V */
1046 /* R */ Dest[2] = (color & 0xffff) + 32768; /* U */
1047 Dest += 3;
1048 }
1049 }
1050 }
1051}
1052
1053static void convert_r16g16(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
1054 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
1055{
1056 unsigned int x, y, z;
1057 const WORD *Source;
1058 WORD *Dest;
1059
1060 for (z = 0; z < depth; z++)
1061 {
1062 for (y = 0; y < height; y++)
1063 {
1064 Source = (const WORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1065 Dest = (WORD *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
1066 for (x = 0; x < width; x++ )
1067 {
1068 WORD green = (*Source++);
1069 WORD red = (*Source++);
1070 Dest[0] = green;
1071 Dest[1] = red;
1072 /* Strictly speaking not correct for R16G16F, but it doesn't matter because the
1073 * shader overwrites it anyway */
1074 Dest[2] = 0xffff;
1075 Dest += 3;
1076 }
1077 }
1078 }
1079}
1080
1081static void convert_r32g32_float(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
1082 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
1083{
1084 unsigned int x, y, z;
1085 const float *Source;
1086 float *Dest;
1087
1088 for (z = 0; z < depth; z++)
1089 {
1090 for (y = 0; y < height; y++)
1091 {
1092 Source = (const float *)(src + z * src_slice_pitch + y * src_row_pitch);
1093 Dest = (float *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
1094 for (x = 0; x < width; x++ )
1095 {
1096 float green = (*Source++);
1097 float red = (*Source++);
1098 Dest[0] = green;
1099 Dest[1] = red;
1100 Dest[2] = 1.0f;
1101 Dest += 3;
1102 }
1103 }
1104 }
1105}
1106
1107static void convert_s8_uint_d24_float(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch,
1108 UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
1109{
1110 unsigned int x, y, z;
1111
1112 for (z = 0; z < depth; z++)
1113 {
1114 for (y = 0; y < height; ++y)
1115 {
1116 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1117 float *dest_f = (float *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
1118 DWORD *dest_s = (DWORD *)dest_f;
1119
1120 for (x = 0; x < width; ++x)
1121 {
1122 dest_f[x * 2] = float_24_to_32((source[x] & 0xffffff00u) >> 8);
1123 dest_s[x * 2 + 1] = source[x] & 0xff;
1124 }
1125 }
1126 }
1127}
1128
1129static void x8_d24_unorm_upload(const BYTE *src, BYTE *dst,
1130 unsigned int src_row_pitch, unsigned int src_slice_pitch,
1131 unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
1132 unsigned int width, unsigned int height, unsigned int depth)
1133{
1134 unsigned int x, y, z;
1135
1136 for (z = 0; z < depth; ++z)
1137 {
1138 for (y = 0; y < height; ++y)
1139 {
1140 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1141 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
1142
1143 for (x = 0; x < width; ++x)
1144 {
1145 dest[x] = source[x] << 8 | ((source[x] >> 16) & 0xff);
1146 }
1147 }
1148 }
1149}
1150
1152 unsigned int src_row_pitch, unsigned int src_slice_pitch,
1153 unsigned int dst_row_pitch, unsigned int dst_slice_pitch,
1154 unsigned int width, unsigned int height, unsigned int depth)
1155{
1156 unsigned int x, y, z;
1157
1158 for (z = 0; z < depth; ++z)
1159 {
1160 for (y = 0; y < height; ++y)
1161 {
1162 const DWORD *source = (const DWORD *)(src + z * src_slice_pitch + y * src_row_pitch);
1163 DWORD *dest = (DWORD *)(dst + z * dst_slice_pitch + y * dst_row_pitch);
1164
1165 for (x = 0; x < width; ++x)
1166 {
1167 dest[x] = source[x] >> 8;
1168 }
1169 }
1170 }
1171}
1172
1174{
1175 /* FIXME: Is this really how color keys are supposed to work? I think it
1176 * makes more sense to compare the individual channels. */
1177 return color >= color_key->color_space_low_value
1178 && color <= color_key->color_space_high_value;
1179}
1180
1181static void convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, unsigned int src_pitch,
1182 BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height,
1183 const struct wined3d_color_key *color_key)
1184{
1185 const WORD *src_row;
1186 unsigned int x, y;
1187 WORD *dst_row;
1188
1189 for (y = 0; y < height; ++y)
1190 {
1191 src_row = (WORD *)&src[src_pitch * y];
1192 dst_row = (WORD *)&dst[dst_pitch * y];
1193 for (x = 0; x < width; ++x)
1194 {
1195 WORD src_color = src_row[x];
1196 if (!color_in_range(color_key, src_color))
1197 dst_row[x] = 0x8000u | ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
1198 else
1199 dst_row[x] = ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
1200 }
1201 }
1202}
1203
1204static void convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, unsigned int src_pitch,
1205 BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height,
1206 const struct wined3d_color_key *color_key)
1207{
1208 const WORD *src_row;
1209 unsigned int x, y;
1210 WORD *dst_row;
1211
1212 for (y = 0; y < height; ++y)
1213 {
1214 src_row = (WORD *)&src[src_pitch * y];
1215 dst_row = (WORD *)&dst[dst_pitch * y];
1216 for (x = 0; x < width; ++x)
1217 {
1218 WORD src_color = src_row[x];
1219 if (color_in_range(color_key, src_color))
1220 dst_row[x] = src_color & ~0x8000;
1221 else
1222 dst_row[x] = src_color | 0x8000;
1223 }
1224 }
1225}
1226
1227static void convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch,
1228 BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height,
1229 const struct wined3d_color_key *color_key)
1230{
1231 const BYTE *src_row;
1232 unsigned int x, y;
1233 DWORD *dst_row;
1234
1235 for (y = 0; y < height; ++y)
1236 {
1237 src_row = &src[src_pitch * y];
1238 dst_row = (DWORD *)&dst[dst_pitch * y];
1239 for (x = 0; x < width; ++x)
1240 {
1241 DWORD src_color = (src_row[x * 3 + 2] << 16) | (src_row[x * 3 + 1] << 8) | src_row[x * 3];
1242 if (!color_in_range(color_key, src_color))
1243 dst_row[x] = src_color | 0xff000000;
1244 }
1245 }
1246}
1247
1248static void convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch,
1249 BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height,
1250 const struct wined3d_color_key *color_key)
1251{
1252 const DWORD *src_row;
1253 unsigned int x, y;
1254 DWORD *dst_row;
1255
1256 for (y = 0; y < height; ++y)
1257 {
1258 src_row = (DWORD *)&src[src_pitch * y];
1259 dst_row = (DWORD *)&dst[dst_pitch * y];
1260 for (x = 0; x < width; ++x)
1261 {
1262 DWORD src_color = src_row[x];
1263 if (color_in_range(color_key, src_color))
1264 dst_row[x] = src_color & ~0xff000000;
1265 else
1266 dst_row[x] = src_color | 0xff000000;
1267 }
1268 }
1269}
1270
1271static void convert_b8g8r8a8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch,
1272 BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height,
1273 const struct wined3d_color_key *color_key)
1274{
1275 const DWORD *src_row;
1276 unsigned int x, y;
1277 DWORD *dst_row;
1278
1279 for (y = 0; y < height; ++y)
1280 {
1281 src_row = (DWORD *)&src[src_pitch * y];
1282 dst_row = (DWORD *)&dst[dst_pitch * y];
1283 for (x = 0; x < width; ++x)
1284 {
1285 DWORD src_color = src_row[x];
1286 if (color_in_range(color_key, src_color))
1287 src_color &= ~0xff000000;
1288 dst_row[x] = src_color;
1289 }
1290 }
1291}
1292
1294 const struct wined3d_texture *texture, BOOL need_alpha_ck)
1295{
1296 const struct wined3d_format *format = texture->resource.format;
1297 unsigned int i;
1298
1299 static const struct
1300 {
1301 enum wined3d_format_id src_format;
1302 struct wined3d_color_key_conversion conversion;
1303 }
1304 color_key_info[] =
1305 {
1311 };
1312
1313 if (need_alpha_ck && (texture->async.flags & WINED3D_TEXTURE_ASYNC_COLOR_KEY))
1314 {
1315 for (i = 0; i < ARRAY_SIZE(color_key_info); ++i)
1316 {
1317 if (color_key_info[i].src_format == format->id)
1318 return &color_key_info[i].conversion;
1319 }
1320
1321 FIXME("Color-keying not supported with format %s.\n", debug_d3dformat(format->id));
1322 }
1323
1324 return NULL;
1325}
1326
1327/* We intentionally don't support WINED3DFMT_D32_UNORM. No hardware driver
1328 * supports it, and applications get confused when we do.
1329 *
1330 * The following formats explicitly don't have WINED3D_FORMAT_CAP_TEXTURE set:
1331 *
1332 * These are never supported on native.
1333 * WINED3DFMT_B8G8R8_UNORM
1334 * WINED3DFMT_B2G3R3_UNORM
1335 * WINED3DFMT_L4A4_UNORM
1336 * WINED3DFMT_S1_UINT_D15_UNORM
1337 * WINED3DFMT_S4X4_UINT_D24_UNORM
1338 *
1339 * Only some Geforce/Voodoo3/G400 cards offer 8-bit textures in case of ddraw.
1340 * Since it is not widely available, don't offer it. Further no Windows driver
1341 * offers WINED3DFMT_P8_UINT_A8_NORM, so don't offer it either.
1342 * WINED3DFMT_P8_UINT
1343 * WINED3DFMT_P8_UINT_A8_UNORM
1344 *
1345 * These formats seem to be similar to the HILO formats in
1346 * GL_NV_texture_shader. NVHU is said to be GL_UNSIGNED_HILO16,
1347 * NVHS GL_SIGNED_HILO16. Rumours say that D3D computes a 3rd channel
1348 * similarly to D3DFMT_CxV8U8 (So NVHS could be called D3DFMT_CxV16U16). ATI
1349 * refused to support formats which can easily be emulated with pixel shaders,
1350 * so applications have to deal with not having NVHS and NVHU.
1351 * WINED3DFMT_NVHU
1352 * WINED3DFMT_NVHS */
1354{
1355 /* format id gl_internal gl_srgb_internal gl_rt_internal
1356 gl_format gl_type conv_byte_count
1357 caps
1358 extension upload download */
1359 /* FourCC formats */
1360 /* GL_APPLE_ycbcr_422 claims that its '2YUV' format, which is supported via the UNSIGNED_SHORT_8_8_REV_APPLE type
1361 * is equivalent to 'UYVY' format on Windows, and the 'YUVS' via UNSIGNED_SHORT_8_8_APPLE equates to 'YUY2'. The
1362 * d3d9 test however shows that the opposite is true. Since the extension is from 2002, it predates the x86 based
1363 * Macs, so probably the endianness differs. This could be tested as soon as we have a Windows and MacOS on a big
1364 * endian machine
1365 */
1479 /* IEEE formats */
1481 GL_RED, GL_FLOAT, 0,
1485 GL_RED, GL_FLOAT, 0,
1489 GL_RGB, GL_FLOAT, 12,
1493 GL_RG, GL_FLOAT, 0,
1497 GL_RGB, GL_FLOAT, 0,
1501 GL_RGBA, GL_FLOAT, 0,
1504 /* Float */
1530 /* Palettized formats */
1533 0,
1537 0,
1539 /* Standard ARGB formats */
1714 /* Luminance */
1750 /* Bump mapping stuff */
1756 GL_DSDT_NV, GL_BYTE, 0,
1760 GL_RG, GL_BYTE, 0,
1773 GL_RGBA, GL_BYTE, 4,
1789 GL_RGBA, GL_BYTE, 0,
1793 GL_RGBA, GL_BYTE, 0,
1802 GL_HILO_NV, GL_SHORT, 0,
1806 GL_RG, GL_SHORT, 0,
1811 GL_RGBA, GL_SHORT, 0,
1816 GL_RED, GL_SHORT, 0,
1821 GL_RED, GL_BYTE, 0,
1825 /* Depth stencil formats */
1882 /* Vendor-specific formats */
1904 {WINED3DFMT_NULL, 0, 0, 0,
1908 /* DirectX 10 HDR formats */
1913};
1914
1916{
1919};
1920
1922{
1930};
1931
1933{
1934 unsigned int i;
1935
1936 if ((unsigned int)format_id < WINED3D_FORMAT_FOURCC_BASE)
1937 return format_id;
1938
1939 for (i = 0; i < ARRAY_SIZE(format_index_remap); ++i)
1940 {
1941 if (format_index_remap[i].id == format_id)
1942 return format_index_remap[i].idx;
1943 }
1944
1945 return -1;
1946}
1947
1949{
1951}
1952
1954{
1956}
1957
1958static struct wined3d_format *get_format_by_idx(const struct wined3d_adapter *adapter, int fmt_idx)
1959{
1960 return (struct wined3d_format *)((BYTE *)adapter->formats + fmt_idx * adapter->format_size);
1961}
1962
1963static struct wined3d_format_gl *get_format_gl_by_idx(const struct wined3d_adapter *adapter, int fmt_idx)
1964{
1966}
1967
1970{
1971 int fmt_idx;
1972
1973 if ((fmt_idx = get_format_idx(format_id)) == -1)
1974 {
1975 ERR("Format %s (%#x) not found.\n", debug_d3dformat(format_id), format_id);
1976 return NULL;
1977 }
1978
1979 return get_format_by_idx(adapter, fmt_idx);
1980}
1981
1984{
1985 struct wined3d_format *format;
1986
1989
1990 return NULL;
1991}
1992
1993static void copy_format(const struct wined3d_adapter *adapter,
1994 struct wined3d_format *dst_format, const struct wined3d_format *src_format)
1995{
1996 enum wined3d_format_id id = dst_format->id;
1997 memcpy(dst_format, src_format, adapter->format_size);
1998 dst_format->id = id;
1999}
2000
2001static void format_set_caps(struct wined3d_format *format, unsigned int caps)
2002{
2003 unsigned int i;
2004
2005 for (i = 0; i < ARRAY_SIZE(format->caps); ++i)
2006 format->caps[i] |= caps;
2007}
2008
2009static void format_clear_caps(struct wined3d_format *format, unsigned int caps)
2010{
2011 unsigned int i;
2012
2013 for (i = 0; i < ARRAY_SIZE(format->caps); ++i)
2014 format->caps[i] &= ~caps;
2015}
2016
2018{
2019 switch (t)
2020 {
2021 case 'u':
2023 case 'i':
2025 case 'U':
2027 case 'I':
2029 case 'F':
2031 case 'D':
2033 case 'S':
2035 case 'X':
2037 default:
2038 ERR("Invalid channel type '%c'.\n", t);
2040 }
2041}
2042
2043static void parse_channel_desc(struct wined3d_format *format, const char *channel_desc)
2044{
2045 unsigned int component_count = 0;
2046 unsigned int attrs = 0;
2047 unsigned int j;
2048
2049 for (j = 0; j < strlen(channel_desc); ++j)
2050 {
2051 enum wined3d_channel_type channel_type = map_channel_type(channel_desc[j]);
2052
2053 if (channel_type == WINED3D_CHANNEL_TYPE_UNORM || channel_type == WINED3D_CHANNEL_TYPE_SNORM)
2055 if (channel_type == WINED3D_CHANNEL_TYPE_UINT || channel_type == WINED3D_CHANNEL_TYPE_SINT)
2057 if (channel_type == WINED3D_CHANNEL_TYPE_FLOAT)
2059 if (channel_type != WINED3D_CHANNEL_TYPE_UNUSED)
2061
2062 if (channel_type == WINED3D_CHANNEL_TYPE_DEPTH && !format->depth_size)
2063 {
2064 format->depth_size = format->red_size;
2065 format->red_size = format->red_offset = 0;
2066 }
2067
2068 if (channel_type == WINED3D_CHANNEL_TYPE_STENCIL && !format->stencil_size)
2069 {
2070 format->stencil_size = format->green_size;
2071 format->green_size = format->green_offset = 0;
2072 }
2073 }
2074
2075 format->attrs |= attrs;
2076 format->component_count = component_count;
2077}
2078
2080{
2081 struct wined3d_format *format;
2082 unsigned int i;
2083
2084 for (i = 0; i < ARRAY_SIZE(formats); ++i)
2085 {
2087 return FALSE;
2088
2089 format->id = formats[i].id;
2090 format->red_size = formats[i].red_size;
2091 format->green_size = formats[i].green_size;
2092 format->blue_size = formats[i].blue_size;
2093 format->alpha_size = formats[i].alpha_size;
2094 format->red_offset = formats[i].red_offset;
2095 format->green_offset = formats[i].green_offset;
2096 format->blue_offset = formats[i].blue_offset;
2097 format->alpha_offset = formats[i].alpha_offset;
2098 format->byte_count = formats[i].bpp;
2099 format->depth_size = formats[i].depth_size;
2100 format->stencil_size = formats[i].stencil_size;
2101 format->block_width = 1;
2102 format->block_height = 1;
2103 format->block_byte_count = formats[i].bpp;
2104
2105 if (formats[i].channels)
2107 }
2108
2109 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
2110 {
2111 struct wined3d_format *typeless_format;
2112
2114 return FALSE;
2115
2116 if (!(typeless_format = get_format_internal(adapter, typed_formats[i].typeless_id)))
2117 return FALSE;
2118
2119 format->id = typed_formats[i].id;
2120 format->red_size = typeless_format->red_size;
2121 format->green_size = typeless_format->green_size;
2122 format->blue_size = typeless_format->blue_size;
2123 format->alpha_size = typeless_format->alpha_size;
2124 format->red_offset = typeless_format->red_offset;
2125 format->green_offset = typeless_format->green_offset;
2126 format->blue_offset = typeless_format->blue_offset;
2127 format->alpha_offset = typeless_format->alpha_offset;
2128 format->byte_count = typeless_format->byte_count;
2129 format->depth_size = typeless_format->depth_size;
2130 format->stencil_size = typeless_format->stencil_size;
2131 format->block_width = typeless_format->block_width;
2132 format->block_height = typeless_format->block_height;
2133 format->block_byte_count = typeless_format->block_byte_count;
2134 format->typeless_id = typeless_format->id;
2135
2136 typeless_format->typeless_id = typeless_format->id;
2137
2139 }
2140
2141 for (i = 0; i < ARRAY_SIZE(ddi_formats); ++i)
2142 {
2144 return FALSE;
2145
2146 format->ddi_format = ddi_formats[i].ddi_format;
2147 }
2148
2149 for (i = 0; i < ARRAY_SIZE(format_base_flags); ++i)
2150 {
2152 return FALSE;
2153
2154 format->attrs |= format_base_flags[i].attrs;
2156 }
2157
2158 return TRUE;
2159}
2160
2162{
2163 struct wined3d_format *format;
2164 unsigned int i;
2165
2166 for (i = 0; i < ARRAY_SIZE(format_block_info); ++i)
2167 {
2169 return FALSE;
2170
2171 format->block_width = format_block_info[i].block_width;
2172 format->block_height = format_block_info[i].block_height;
2173 format->block_byte_count = format_block_info[i].block_byte_count;
2175 }
2176
2177 return TRUE;
2178}
2179
2180/* Most compressed formats are not supported for 3D textures by OpenGL.
2181 *
2182 * In the case of the S3TC/DXTn formats, NV_texture_compression_vtc provides
2183 * these formats for 3D textures, but unfortunately the block layout is
2184 * different from the one used by Direct3D.
2185 *
2186 * Since applications either don't check format availability at all before
2187 * using these, or refuse to run without them, we decompress them on upload.
2188 *
2189 * Affected applications include "Heroes VI", "From Dust", "Halo Online" and
2190 * "Eldorado". */
2192{
2193 struct wined3d_format *format;
2194 unsigned int i;
2195
2196 for (i = 0; i < ARRAY_SIZE(format_decompress_info); ++i)
2197 {
2199 return FALSE;
2200
2202 format->decompress = format_decompress_info[i].decompress;
2203 }
2204
2205 return TRUE;
2206}
2207
2209{
2210 struct wined3d_format *format, *srgb_format;
2211 unsigned int i;
2212
2213 for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i)
2214 {
2215 if (!(srgb_format = get_format_internal(adapter, format_srgb_info[i].srgb_format_id)))
2216 return FALSE;
2217 if (!(format = get_format_internal(adapter, format_srgb_info[i].base_format_id)))
2218 return FALSE;
2219
2220 copy_format(adapter, srgb_format, format);
2221 }
2222
2223 return TRUE;
2224}
2225
2227{
2228 switch (type)
2229 {
2231 return GL_TEXTURE_1D;
2233 return GL_TEXTURE_2D;
2235 return GL_TEXTURE_3D;
2239 return GL_TEXTURE_2D; /* TODO: GL_TEXTURE_BUFFER. */
2241 return GL_RENDERBUFFER;
2243 break;
2244 }
2245 ERR("Unexpected GL resource type %u.\n", type);
2246 return 0;
2247}
2248
2249static void delete_fbo_attachment(const struct wined3d_gl_info *gl_info,
2250 enum wined3d_gl_resource_type d3d_type, GLuint object)
2251{
2252 switch (d3d_type)
2253 {
2258 gl_info->gl_ops.gl.p_glDeleteTextures(1, &object);
2259 break;
2260
2262 gl_info->fbo_ops.glDeleteRenderbuffers(1, &object);
2263 break;
2264
2267 break;
2268 }
2269}
2270
2271static void create_and_bind_fbo_attachment(const struct wined3d_gl_info *gl_info,
2272 const struct wined3d_format_gl *format_gl,
2273 enum wined3d_gl_resource_type d3d_type, GLuint *object, GLenum internal)
2274{
2275 GLenum format = format_gl->format;
2276 GLenum type = format_gl->type;
2278
2279 attach_type = format_gl->f.depth_size ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0;
2280 switch (d3d_type)
2281 {
2283 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2284 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, *object);
2285 gl_info->gl_ops.gl.p_glTexImage1D(GL_TEXTURE_1D, 0, internal, 16, 0, format, type, NULL);
2286 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2287 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2288
2289 gl_info->fbo_ops.glFramebufferTexture1D(GL_FRAMEBUFFER, attach_type, GL_TEXTURE_1D, *object, 0);
2290 if (format_gl->f.stencil_size)
2291 gl_info->fbo_ops.glFramebufferTexture1D(GL_FRAMEBUFFER,
2293 break;
2294
2296 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2297 gl_info->gl_ops.gl.p_glBindTexture(wined3d_gl_type_to_enum(d3d_type), *object);
2298 gl_info->gl_ops.gl.p_glTexImage2D(wined3d_gl_type_to_enum(d3d_type), 0, internal, 16, 16, 0,
2299 format, type, NULL);
2300 gl_info->gl_ops.gl.p_glTexParameteri(wined3d_gl_type_to_enum(d3d_type), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2301 gl_info->gl_ops.gl.p_glTexParameteri(wined3d_gl_type_to_enum(d3d_type), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2302
2303 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, attach_type,
2304 wined3d_gl_type_to_enum(d3d_type), *object, 0);
2305 if (format_gl->f.stencil_size)
2306 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
2307 wined3d_gl_type_to_enum(d3d_type), *object, 0);
2308 break;
2309
2311 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2312 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_3D, *object);
2314 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2315 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2316
2317 gl_info->fbo_ops.glFramebufferTexture3D(GL_FRAMEBUFFER, attach_type, GL_TEXTURE_3D, *object, 0, 0);
2318 if (format_gl->f.stencil_size)
2319 gl_info->fbo_ops.glFramebufferTexture3D(GL_FRAMEBUFFER,
2320 GL_STENCIL_ATTACHMENT, GL_TEXTURE_3D, *object, 0, 0);
2321 break;
2322
2324 gl_info->gl_ops.gl.p_glGenTextures(1, object);
2325 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, *object);
2326 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, internal, 16, 16, 0,
2327 format, type, NULL);
2328 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, internal, 16, 16, 0,
2329 format, type, NULL);
2330 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, internal, 16, 16, 0,
2331 format, type, NULL);
2332 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, internal, 16, 16, 0,
2333 format, type, NULL);
2334 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, internal, 16, 16, 0,
2335 format, type, NULL);
2336 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, internal, 16, 16, 0,
2337 format, type, NULL);
2338 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
2339 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
2340
2341 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, attach_type,
2343 if (format_gl->f.stencil_size)
2344 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
2346 break;
2347
2349 gl_info->fbo_ops.glGenRenderbuffers(1, object);
2350 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, *object);
2351 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, internal, 16, 16);
2352 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, attach_type, GL_RENDERBUFFER, *object);
2353 if (format_gl->f.stencil_size)
2354 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
2356 break;
2357
2360 break;
2361 }
2362
2363 /* Ideally we'd skip all formats already known not to work on textures
2364 * by checking for WINED3D_FORMAT_CAP_TEXTURE here. However, we want to
2365 * know if we can attach WINED3DFMT_P8_UINT textures to FBOs, and this
2366 * format never has WINED3D_FORMAT_CAP_TEXTURE set. Instead, swallow GL
2367 * errors generated by invalid formats. */
2368 while (gl_info->gl_ops.gl.p_glGetError());
2369}
2370
2371static void draw_test_quad(struct wined3d_caps_gl_ctx *ctx, const struct wined3d_vec3 *geometry,
2372 const struct wined3d_color *color)
2373{
2374 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2375 static const struct wined3d_vec3 default_geometry[] =
2376 {
2377 {-1.0f, -1.0f, 0.0f},
2378 { 1.0f, -1.0f, 0.0f},
2379 {-1.0f, 1.0f, 0.0f},
2380 { 1.0f, 1.0f, 0.0f},
2381 };
2382 static const char vs_core_header[] =
2383 "#version 150\n"
2384 "in vec4 pos;\n"
2385 "in vec4 color;\n"
2386 "out vec4 out_color;\n"
2387 "\n";
2388 static const char vs_legacy_header[] =
2389 "#version 120\n"
2390 "attribute vec4 pos;\n"
2391 "attribute vec4 color;\n"
2392 "varying vec4 out_color;\n"
2393 "\n";
2394 static const char vs_body[] =
2395 "void main()\n"
2396 "{\n"
2397 " gl_Position = pos;\n"
2398 " out_color = color;\n"
2399 "}\n";
2400 static const char fs_core[] =
2401 "#version 150\n"
2402 "in vec4 out_color;\n"
2403 "out vec4 fragment_color;\n"
2404 "\n"
2405 "void main()\n"
2406 "{\n"
2407 " fragment_color = out_color;\n"
2408 "}\n";
2409 static const char fs_legacy[] =
2410 "#version 120\n"
2411 "varying vec4 out_color;\n"
2412 "\n"
2413 "void main()\n"
2414 "{\n"
2415 " gl_FragData[0] = out_color;\n"
2416 "}\n";
2417 const char *source[2];
2418 GLuint vs_id, fs_id;
2419 unsigned int i;
2420
2421 if (!geometry)
2422 geometry = default_geometry;
2423
2425 || !gl_info->supported[ARB_FRAGMENT_SHADER])
2426 {
2427 gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
2428 gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
2429 gl_info->gl_ops.gl.p_glLoadIdentity();
2430 gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
2431 gl_info->gl_ops.gl.p_glLoadIdentity();
2432
2433 gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
2434 gl_info->gl_ops.gl.p_glColor4f(color->r, color->g, color->b, color->a);
2435 for (i = 0; i < 4; ++i)
2436 gl_info->gl_ops.gl.p_glVertex3fv(&geometry[i].x);
2437 gl_info->gl_ops.gl.p_glEnd();
2438 checkGLcall("draw quad");
2439 return;
2440 }
2441
2442 if (!ctx->test_vbo)
2443 GL_EXTCALL(glGenBuffers(1, &ctx->test_vbo));
2444 GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, ctx->test_vbo));
2445 GL_EXTCALL(glBufferData(GL_ARRAY_BUFFER, sizeof(struct wined3d_vec3) * 4, geometry, GL_STREAM_DRAW));
2446 GL_EXTCALL(glVertexAttribPointer(0, 3, GL_FLOAT, FALSE, 0, NULL));
2447 GL_EXTCALL(glVertexAttrib4f(1, color->r, color->g, color->b, color->a));
2448 GL_EXTCALL(glEnableVertexAttribArray(0));
2449 GL_EXTCALL(glDisableVertexAttribArray(1));
2450
2451 if (!ctx->test_program_id)
2452 {
2453 BOOL use_glsl_150 = gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50);
2454
2455 ctx->test_program_id = GL_EXTCALL(glCreateProgram());
2456
2457 vs_id = GL_EXTCALL(glCreateShader(GL_VERTEX_SHADER));
2458 source[0] = use_glsl_150 ? vs_core_header : vs_legacy_header;
2459 source[1] = vs_body;
2460 GL_EXTCALL(glShaderSource(vs_id, 2, source, NULL));
2461 GL_EXTCALL(glAttachShader(ctx->test_program_id, vs_id));
2462 GL_EXTCALL(glDeleteShader(vs_id));
2463
2464 fs_id = GL_EXTCALL(glCreateShader(GL_FRAGMENT_SHADER));
2465 source[0] = use_glsl_150 ? fs_core : fs_legacy;
2466 GL_EXTCALL(glShaderSource(fs_id, 1, source, NULL));
2467 GL_EXTCALL(glAttachShader(ctx->test_program_id, fs_id));
2468 GL_EXTCALL(glDeleteShader(fs_id));
2469
2470 GL_EXTCALL(glBindAttribLocation(ctx->test_program_id, 0, "pos"));
2471 GL_EXTCALL(glBindAttribLocation(ctx->test_program_id, 1, "color"));
2472
2473 if (use_glsl_150)
2474 GL_EXTCALL(glBindFragDataLocation(ctx->test_program_id, 0, "fragment_color"));
2475
2476 GL_EXTCALL(glCompileShader(vs_id));
2477 print_glsl_info_log(gl_info, vs_id, FALSE);
2478 GL_EXTCALL(glCompileShader(fs_id));
2479 print_glsl_info_log(gl_info, fs_id, FALSE);
2480 GL_EXTCALL(glLinkProgram(ctx->test_program_id));
2481 shader_glsl_validate_link(gl_info, ctx->test_program_id);
2482 }
2483 GL_EXTCALL(glUseProgram(ctx->test_program_id));
2484
2485 gl_info->gl_ops.gl.p_glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
2486
2487 GL_EXTCALL(glUseProgram(0));
2488 GL_EXTCALL(glDisableVertexAttribArray(0));
2489 GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, 0));
2490 checkGLcall("draw quad");
2491}
2492
2493/* Context activation is done by the caller. */
2495{
2496 /* Check if the default internal format is supported as a frame buffer
2497 * target, otherwise fall back to the render target internal.
2498 *
2499 * Try to stick to the standard format if possible, this limits precision differences. */
2500 static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 1.0f};
2501 static const struct wined3d_color half_transparent_red = {1.0f, 0.0f, 0.0f, 0.5f};
2502 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2503 GLenum status, rt_internal = format->rt_internal;
2504 GLuint object, color_rb;
2506 BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
2507
2508 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2509
2510 for (type = 0; type < ARRAY_SIZE(format->f.caps); ++type)
2511 {
2512 const char *type_string = "color";
2513
2515 continue;
2516
2517 create_and_bind_fbo_attachment(gl_info, format, type, &object, format->internal);
2518
2520 {
2521 gl_info->fbo_ops.glGenRenderbuffers(1, &color_rb);
2522 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, color_rb);
2524 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 16, 1);
2525 else
2526 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 16, 16);
2527
2528 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
2530 checkGLcall("Create and attach color rb attachment");
2531 type_string = "depth / stencil";
2532 }
2533
2534 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2535 checkGLcall("Framebuffer format check");
2536
2538 {
2539 TRACE("Format %s is supported as FBO %s attachment, type %u.\n",
2540 debug_d3dformat(format->f.id), type_string, type);
2542 format->rt_internal = format->internal;
2543 regular_fmt_used = TRUE;
2544 }
2545 else
2546 {
2547 if (!rt_internal)
2548 {
2550 {
2551 WARN("Format %s with rendertarget flag is not supported as FBO color attachment (type %u),"
2552 " and no fallback specified.\n", debug_d3dformat(format->f.id), type);
2554 }
2555 else
2556 {
2557 TRACE("Format %s is not supported as FBO %s attachment, type %u.\n",
2558 debug_d3dformat(format->f.id), type_string, type);
2559 }
2560 format->rt_internal = format->internal;
2561 }
2562 else
2563 {
2564 TRACE("Format %s is not supported as FBO %s attachment (type %u),"
2565 " trying rtInternal format as fallback.\n",
2566 debug_d3dformat(format->f.id), type_string, type);
2567
2568 while (gl_info->gl_ops.gl.p_glGetError());
2569
2570 delete_fbo_attachment(gl_info, type, object);
2571 create_and_bind_fbo_attachment(gl_info, format, type, &object, format->rt_internal);
2572
2573 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2574 checkGLcall("Framebuffer format check");
2575
2577 {
2578 TRACE("Format %s rtInternal format is supported as FBO %s attachment, type %u.\n",
2579 debug_d3dformat(format->f.id), type_string, type);
2580 fallback_fmt_used = TRUE;
2581 }
2582 else
2583 {
2584 WARN("Format %s rtInternal format is not supported as FBO %s attachment, type %u.\n",
2585 debug_d3dformat(format->f.id), type_string, type);
2587 }
2588 }
2589 }
2590
2594 && !(format->f.attrs & WINED3D_FORMAT_ATTR_INTEGER)
2595 && format->f.id != WINED3DFMT_NULL && format->f.id != WINED3DFMT_P8_UINT
2596 && format->format != GL_LUMINANCE && format->format != GL_LUMINANCE_ALPHA
2597 && (format->f.red_size || format->f.alpha_size))
2598 {
2599 uint32_t readback[16 * 16 * 16], color = 0;
2600 unsigned int r_range, a_range;
2601 BYTE r, a;
2602 BOOL match = TRUE;
2603 GLuint rb;
2604
2605 if (gl_info->supported[EXT_PACKED_DEPTH_STENCIL])
2606 {
2607 gl_info->fbo_ops.glGenRenderbuffers(1, &rb);
2608 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, rb);
2610 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 16, 1);
2611 else
2612 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 16, 16);
2613 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rb);
2614 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rb);
2615 checkGLcall("RB attachment");
2616 }
2617
2618 gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
2619 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2620 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
2621 if (gl_info->gl_ops.gl.p_glGetError() == GL_INVALID_FRAMEBUFFER_OPERATION)
2622 {
2623 while (gl_info->gl_ops.gl.p_glGetError());
2624 TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
2625 debug_d3dformat(format->f.id), type);
2626 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING;
2627 }
2628 else
2629 {
2630 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2632 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 1);
2633 else
2634 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 16);
2635 gl_info->gl_ops.gl.p_glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2636
2637 draw_test_quad(ctx, NULL, &black);
2638
2639 gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
2640
2641 draw_test_quad(ctx, NULL, &half_transparent_red);
2642
2643 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
2644
2645 switch (type)
2646 {
2648 /* Rebinding texture to workaround a fglrx bug. */
2649 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, object);
2650 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_1D, 0, GL_BGRA,
2652 color = readback[7];
2653 break;
2654
2657 /* Rebinding texture to workaround a fglrx bug. */
2658 gl_info->gl_ops.gl.p_glBindTexture(wined3d_gl_type_to_enum(type), object);
2659 gl_info->gl_ops.gl.p_glGetTexImage(wined3d_gl_type_to_enum(type), 0, GL_BGRA,
2661 color = readback[7 * 16 + 7];
2662 break;
2663
2665 /* Rebinding texture to workaround a fglrx bug. */
2666 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, object);
2667 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL_BGRA,
2669 color = readback[7 * 16 + 7];
2670 break;
2671
2673 gl_info->gl_ops.gl.p_glReadPixels(0, 0, 16, 16,
2675 color = readback[7 * 16 + 7];
2676 break;
2677
2680 color = 0;
2681 break;
2682 }
2683 checkGLcall("Post-pixelshader blending check");
2684
2685 a = color >> 24;
2686 r = (color & 0x00ff0000u) >> 16;
2687
2688 r_range = format->f.red_size < 8 ? 1u << (8 - format->f.red_size) : 1;
2689 a_range = format->f.alpha_size < 8 ? 1u << (8 - format->f.alpha_size) : 1;
2690 if (format->f.red_size && (r < 0x7f - r_range || r > 0x7f + r_range))
2691 match = FALSE;
2692 else if (format->f.alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range))
2693 match = FALSE;
2694 if (!match)
2695 {
2696 TRACE("Format %s doesn't support post-pixelshader blending, type %u.\n",
2697 debug_d3dformat(format->f.id), type);
2698 TRACE("Color output: %#x\n", color);
2699 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING;
2700 }
2701 else
2702 {
2703 TRACE("Format %s supports post-pixelshader blending, type %u.\n",
2704 debug_d3dformat(format->f.id), type);
2705 TRACE("Color output: %#x\n", color);
2707 }
2708 }
2709
2710 if (gl_info->supported[EXT_PACKED_DEPTH_STENCIL])
2711 {
2712 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
2713 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
2714 gl_info->fbo_ops.glDeleteRenderbuffers(1, &rb);
2715 checkGLcall("RB cleanup");
2716 }
2717 }
2718
2719 if (format->internal != format->srgb_internal)
2720 {
2721 delete_fbo_attachment(gl_info, type, object);
2722 create_and_bind_fbo_attachment(gl_info, format, type, &object, format->srgb_internal);
2723
2724 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER);
2725 checkGLcall("Framebuffer format check");
2726
2728 {
2729 TRACE("Format %s's sRGB format is FBO attachable, type %u.\n",
2730 debug_d3dformat(format->f.id), type);
2732 if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
2733 format->internal = format->srgb_internal;
2734 }
2735 else
2736 {
2737 WARN("Format %s's sRGB format is not FBO attachable, type %u.\n",
2738 debug_d3dformat(format->f.id), type);
2740 }
2741 }
2742 else if (status == GL_FRAMEBUFFER_COMPLETE)
2744
2746 {
2747 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
2748 gl_info->fbo_ops.glDeleteRenderbuffers(1, &color_rb);
2749 }
2750
2751 delete_fbo_attachment(gl_info, type, object);
2752 checkGLcall("Framebuffer format check cleanup");
2753 }
2754
2755 if (fallback_fmt_used && regular_fmt_used)
2756 {
2757 FIXME("Format %s needs different render target formats for different resource types.\n",
2758 debug_d3dformat(format->f.id));
2762 }
2763}
2764
2765static void query_format_cap(struct wined3d_gl_info *gl_info, struct wined3d_format_gl *format,
2766 GLint internal, GLenum pname, unsigned int cap, const char *string)
2767{
2768 GLint value;
2770
2771 for (type = 0; type < ARRAY_SIZE(format->f.caps); ++type)
2772 {
2773 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type), internal, pname, 1, &value);
2774 if (value == GL_FULL_SUPPORT)
2775 {
2776 TRACE("Format %s supports %s, resource type %u.\n", debug_d3dformat(format->f.id), string, type);
2777 format->f.caps[type] |= cap;
2778 }
2779 else
2780 {
2781 TRACE("Format %s doesn't support %s, resource type %u.\n", debug_d3dformat(format->f.id), string, type);
2782 format->f.caps[type] &= ~cap;
2783 }
2784 }
2785}
2786
2787/* Context activation is done by the caller. */
2789 struct wined3d_caps_gl_ctx *ctx)
2790{
2791 const struct wined3d_gl_info *gl_info = ctx->gl_info;
2792 unsigned int i, type;
2793 GLuint fbo;
2794
2796 {
2797 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
2798 {
2800 BOOL fallback_fmt_used = FALSE, regular_fmt_used = FALSE;
2801 GLenum rt_internal = format->rt_internal;
2802 GLint value;
2803
2804 if (!format->internal)
2805 continue;
2806
2807 for (type = 0; type < ARRAY_SIZE(format->f.caps); ++type)
2808 {
2809 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2810 format->internal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
2811 if (value == GL_FULL_SUPPORT)
2812 {
2813 TRACE("Format %s is supported as FBO color attachment, resource type %u.\n",
2814 debug_d3dformat(format->f.id), type);
2816 format->rt_internal = format->internal;
2817 regular_fmt_used = TRUE;
2818
2819 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2820 format->internal, GL_FRAMEBUFFER_BLEND, 1, &value);
2821 if (value == GL_FULL_SUPPORT)
2822 {
2823 TRACE("Format %s supports post-pixelshader blending, resource type %u.\n",
2824 debug_d3dformat(format->f.id), type);
2826 }
2827 else
2828 {
2829 TRACE("Format %s doesn't support post-pixelshader blending, resource typed %u.\n",
2830 debug_d3dformat(format->f.id), type);
2831 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING;
2832 }
2833 }
2834 else
2835 {
2836 if (!rt_internal)
2837 {
2839 {
2840 WARN("Format %s with rendertarget flag is not supported as FBO color attachment"
2841 " and no fallback specified, resource type %u.\n",
2842 debug_d3dformat(format->f.id), type);
2843 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_RENDERTARGET;
2844 }
2845 else
2846 TRACE("Format %s is not supported as FBO color attachment,"
2847 " resource type %u.\n", debug_d3dformat(format->f.id), type);
2848 format->rt_internal = format->internal;
2849 }
2850 else
2851 {
2852 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2854 if (value == GL_FULL_SUPPORT)
2855 {
2856 TRACE("Format %s rtInternal format is supported as FBO color attachment,"
2857 " resource type %u.\n", debug_d3dformat(format->f.id), type);
2858 fallback_fmt_used = TRUE;
2859 }
2860 else
2861 {
2862 WARN("Format %s rtInternal format is not supported as FBO color attachment,"
2863 " resource type %u.\n", debug_d3dformat(format->f.id), type);
2864 format->f.caps[type] &= ~WINED3D_FORMAT_CAP_RENDERTARGET;
2865 }
2866 }
2867 }
2868
2869 if (format->internal != format->srgb_internal)
2870 {
2871 gl_info->gl_ops.ext.p_glGetInternalformativ(wined3d_gl_type_to_enum(type),
2872 format->srgb_internal, GL_FRAMEBUFFER_RENDERABLE, 1, &value);
2873 if (value == GL_FULL_SUPPORT)
2874 {
2875 TRACE("Format %s's sRGB format is FBO attachable, resource type %u.\n",
2876 debug_d3dformat(format->f.id), type);
2878 if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
2879 format->internal = format->srgb_internal;
2880 }
2881 else
2882 {
2883 WARN("Format %s's sRGB format is not FBO attachable, resource type %u.\n",
2884 debug_d3dformat(format->f.id), type);
2886 }
2887 }
2888 else if (format->f.caps[type] & WINED3D_FORMAT_CAP_FBO_ATTACHABLE)
2890 }
2891
2892 if (fallback_fmt_used && regular_fmt_used)
2893 {
2894 FIXME("Format %s needs different render target formats for different resource types.\n",
2895 debug_d3dformat(format->f.id));
2898 }
2899 }
2900 return;
2901 }
2902
2903 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
2904 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
2905 gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0);
2906 gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0);
2907
2908 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
2909 {
2911
2912 if (!format->internal)
2913 continue;
2914
2916 {
2917 TRACE("Skipping format %s because it's a compressed format.\n",
2918 debug_d3dformat(format->f.id));
2919 continue;
2920 }
2921
2922 TRACE("Checking if format %s is supported as FBO color attachment...\n", debug_d3dformat(format->f.id));
2924 }
2925
2926 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
2927}
2928
2929static GLenum lookup_gl_view_class(GLenum internal_format)
2930{
2931 static const struct
2932 {
2933 GLenum internal_format;
2935 }
2936 view_classes[] =
2937 {
2938 /* 128-bit */
2942 /* 96-bit */
2946 /* 64-bit */
2955 /* 48-bit */
2961 /* 32-bit */
2979 /* 24-bit */
2985 /* 16-bit */
2995 /* 8-bit */
3000
3001 /* RGTC1 */
3004 /* RGTC2 */
3007
3008 /* BPTC unorm */
3011 /* BPTC float */
3014
3015 /* DXT1 RGB */
3018 /* DXT1 RGBA */
3021 /* DXT3 */
3024 /* DXT5 */
3027 };
3028
3029 unsigned int i;
3030
3031 for (i = 0; i < ARRAY_SIZE(view_classes); ++i)
3032 {
3033 if (view_classes[i].internal_format == internal_format)
3034 return view_classes[i].view_class;
3035 }
3036
3037 return GL_NONE;
3038}
3039
3041{
3042 GLenum internal_view_class, gamma_view_class, rt_view_class;
3043
3044 internal_view_class = lookup_gl_view_class(format->internal);
3045 gamma_view_class = lookup_gl_view_class(format->srgb_internal);
3046 rt_view_class = lookup_gl_view_class(format->rt_internal);
3047
3048 if (internal_view_class == gamma_view_class || gamma_view_class == rt_view_class)
3049 {
3050 format->view_class = internal_view_class;
3051 TRACE("Format %s is member of GL view class %#x.\n",
3052 debug_d3dformat(format->f.id), format->view_class);
3053 }
3054 else
3055 {
3056 format->view_class = GL_NONE;
3057 }
3058}
3059
3061 struct wined3d_format_gl *format, const struct wined3d_format_texture_info *texture_info,
3062 struct wined3d_gl_info *gl_info, BOOL srgb_format)
3063{
3064 GLint count, multisample_types[8];
3065 unsigned int i, max_log2;
3066 GLenum target;
3067
3069 {
3070 query_format_cap(gl_info, format, format->internal, GL_VERTEX_TEXTURE,
3071 WINED3D_FORMAT_CAP_VTF, "vertex texture usage");
3072 query_format_cap(gl_info, format, format->internal, GL_FILTER,
3073 WINED3D_FORMAT_CAP_FILTERING, "filtering");
3075 WINED3D_FORMAT_CAP_UNORDERED_ACCESS, "unordered access");
3076
3077 if (srgb_format || format->srgb_internal != format->internal)
3078 {
3079 query_format_cap(gl_info, format, format->srgb_internal, GL_SRGB_READ,
3080 WINED3D_FORMAT_CAP_SRGB_READ, "sRGB read");
3081 query_format_cap(gl_info, format, format->srgb_internal, GL_SRGB_WRITE,
3082 WINED3D_FORMAT_CAP_SRGB_WRITE, "sRGB write");
3083
3084 if (!(format->f.caps[WINED3D_GL_RES_TYPE_TEX_2D]
3086 format->srgb_internal = format->internal;
3087 else if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
3088 format->internal = format->srgb_internal;
3089 }
3090 }
3091 else
3092 {
3093 if (!gl_info->limits.samplers[WINED3D_SHADER_TYPE_VERTEX])
3095
3100
3101 if (srgb_format || format->srgb_internal != format->internal)
3102 {
3103 /* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */
3104 if (!gl_info->supported[EXT_TEXTURE_SRGB])
3105 {
3106 format->srgb_internal = format->internal;
3108 }
3109 else if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE])
3110 {
3111 format->internal = format->srgb_internal;
3112 }
3113 }
3114 }
3115
3116 if (!gl_info->supported[ARB_DEPTH_TEXTURE] && (format->f.depth_size || format->f.stencil_size))
3117 {
3118 TRACE("Disabling texturing support for depth / stencil format %s.\n", debug_d3dformat(format->f.id));
3119 format->f.caps[WINED3D_GL_RES_TYPE_TEX_1D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3120 format->f.caps[WINED3D_GL_RES_TYPE_TEX_2D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3121 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3122 format->f.caps[WINED3D_GL_RES_TYPE_TEX_CUBE] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3123 }
3124
3126
3127 if (format->internal && format->f.caps[WINED3D_GL_RES_TYPE_RB]
3130 {
3131 if (gl_info->supported[ARB_INTERNALFORMAT_QUERY])
3132 {
3134 count = 0;
3135 GL_EXTCALL(glGetInternalformativ(target, format->internal,
3137 if (count > ARRAY_SIZE(multisample_types))
3138 FIXME("Unexpectedly high number of multisample types %d.\n", count);
3139 count = min(count, ARRAY_SIZE(multisample_types));
3140 GL_EXTCALL(glGetInternalformativ(target, format->internal,
3141 GL_SAMPLES, count, multisample_types));
3142 checkGLcall("query sample counts");
3143 for (i = 0; i < count; ++i)
3144 {
3145 if (multisample_types[i] > sizeof(format->f.multisample_types) * CHAR_BIT)
3146 continue;
3147 format->f.multisample_types |= 1u << (multisample_types[i] - 1);
3148 }
3149 }
3150 else
3151 {
3152 max_log2 = wined3d_log2i(min(gl_info->limits.samples,
3153 sizeof(format->f.multisample_types) * CHAR_BIT));
3154 for (i = 1; i <= max_log2; ++i)
3155 format->f.multisample_types |= 1u << ((1u << i) - 1);
3156 }
3157 }
3158}
3159
3161{
3162 struct wined3d_format_gl *format, *srgb_format;
3164 struct shader_caps shader_caps;
3165 unsigned int i, j;
3166
3167 adapter->fragment_pipe->get_caps(adapter, &fragment_caps);
3168 adapter->shader_backend->shader_get_caps(adapter, &shader_caps);
3169
3170 for (i = 0; i < ARRAY_SIZE(format_texture_info); ++i)
3171 {
3173 return FALSE;
3174
3175 if (!gl_info->supported[format_texture_info[i].extension])
3176 continue;
3177
3178 /* ARB_texture_rg defines floating point formats, but only if
3179 * ARB_texture_float is also supported. */
3180 if (!gl_info->supported[ARB_TEXTURE_FLOAT]
3181 && (format->f.attrs & WINED3D_FORMAT_ATTR_FLOAT))
3182 continue;
3183
3184 /* ARB_texture_rg defines integer formats if EXT_texture_integer is also supported. */
3185 if (!gl_info->supported[EXT_TEXTURE_INTEGER]
3186 && (format->f.attrs & WINED3D_FORMAT_ATTR_INTEGER))
3187 continue;
3188
3189 format->internal = format_texture_info[i].gl_internal;
3190 format->srgb_internal = format_texture_info[i].gl_srgb_internal;
3191 format->rt_internal = format_texture_info[i].gl_rt_internal;
3192 format->format = format_texture_info[i].gl_format;
3193 format->type = format_texture_info[i].gl_type;
3194 format->f.color_fixup = COLOR_FIXUP_IDENTITY;
3195 format->f.height_scale.numerator = 1;
3196 format->f.height_scale.denominator = 1;
3197
3201
3202 /* GL_ARB_depth_texture does not support 3D textures. It also says "cube textures are
3203 * problematic", but doesn't explicitly mandate that an error is generated. */
3206
3209
3211 format->f.caps[WINED3D_GL_RES_TYPE_RB] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3212
3213 if (format->srgb_internal != format->internal
3214 && !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
3215 {
3216 format->srgb_internal = format->internal;
3218 }
3219
3222
3224
3225 /* Texture conversion stuff */
3226 format->f.conv_byte_count = format_texture_info[i].conv_byte_count;
3227 format->f.upload = format_texture_info[i].upload;
3228 format->f.download = format_texture_info[i].download;
3229
3230 srgb_format = NULL;
3231 for (j = 0; j < ARRAY_SIZE(format_srgb_info); ++j)
3232 {
3233 if (format_srgb_info[j].base_format_id == format->f.id)
3234 {
3235 if (!(srgb_format = get_format_gl_internal(adapter, format_srgb_info[j].srgb_format_id)))
3236 return FALSE;
3237 break;
3238 }
3239 }
3240 if (!srgb_format)
3241 continue;
3242
3243 copy_format(adapter, &srgb_format->f, &format->f);
3244
3245 if (gl_info->supported[EXT_TEXTURE_SRGB]
3246 && !(adapter->d3d_info.wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL))
3247 {
3248 srgb_format->internal = format_texture_info[i].gl_srgb_internal;
3249 srgb_format->srgb_internal = format_texture_info[i].gl_srgb_internal;
3251 query_internal_format(adapter, srgb_format, &format_texture_info[i], gl_info, TRUE);
3252 }
3253 }
3254
3255 return TRUE;
3256}
3257
3258static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
3259{
3260 unsigned int diff = x > y ? x - y : y - x;
3261
3262 return diff <= max_diff;
3263}
3264
3265static BOOL compare_colour(DWORD c1, DWORD c2, BYTE max_diff)
3266{
3267 return compare_uint(c1 & 0xff, c2 & 0xff, max_diff)
3268 && compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff)
3269 && compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff)
3270 && compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff);
3271}
3272
3273/* A context is provided by the caller */
3274static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
3275{
3276 static const DWORD data[] = {0x00000000, 0xffffffff};
3277 GLuint tex, fbo, buffer;
3278 uint32_t readback[16 * 1];
3279 BOOL ret = FALSE;
3280
3281 /* Render a filtered texture and see what happens. This is intended to detect the lack of
3282 * float16 filtering on ATI X1000 class cards. The drivers disable filtering instead of
3283 * falling back to software. If this changes in the future this code will get fooled and
3284 * apps might hit the software path due to incorrectly advertised caps.
3285 *
3286 * Its unlikely that this changes however. GL Games like Mass Effect depend on the filter
3287 * disable fallback, if Apple or ATI ever change the driver behavior they will break more
3288 * than Wine. The Linux binary <= r500 driver is not maintained any more anyway
3289 */
3290
3291 while (gl_info->gl_ops.gl.p_glGetError());
3292
3293 gl_info->gl_ops.gl.p_glGenTextures(1, &buffer);
3294 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, buffer);
3295 memset(readback, 0x7e, sizeof(readback));
3296 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 1, 0,
3298 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
3299 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
3300 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3301 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3302 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
3303
3304 gl_info->gl_ops.gl.p_glGenTextures(1, &tex);
3305 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex);
3306 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, internal, 2, 1, 0,
3308 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
3309 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3310 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
3311 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
3312 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
3313 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D);
3314
3315 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3316 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3317 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, buffer, 0);
3318 gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0);
3319
3320 gl_info->gl_ops.gl.p_glViewport(0, 0, 16, 1);
3321 gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
3322 gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
3323 gl_info->gl_ops.gl.p_glLoadIdentity();
3324 gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
3325 gl_info->gl_ops.gl.p_glLoadIdentity();
3326
3327 gl_info->gl_ops.gl.p_glClearColor(0, 1, 0, 0);
3328 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3329
3330 gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP);
3331 gl_info->gl_ops.gl.p_glTexCoord2f(0.0, 0.0);
3332 gl_info->gl_ops.gl.p_glVertex2f(-1.0f, -1.0f);
3333 gl_info->gl_ops.gl.p_glTexCoord2f(1.0, 0.0);
3334 gl_info->gl_ops.gl.p_glVertex2f(1.0f, -1.0f);
3335 gl_info->gl_ops.gl.p_glTexCoord2f(0.0, 1.0);
3336 gl_info->gl_ops.gl.p_glVertex2f(-1.0f, 1.0f);
3337 gl_info->gl_ops.gl.p_glTexCoord2f(1.0, 1.0);
3338 gl_info->gl_ops.gl.p_glVertex2f(1.0f, 1.0f);
3339 gl_info->gl_ops.gl.p_glEnd();
3340
3341 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, buffer);
3342 memset(readback, 0x7f, sizeof(readback));
3343 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, readback);
3344 if (compare_colour(readback[6], 0xffffffff, 5) || compare_colour(readback[6], 0x00000000, 5)
3345 || compare_colour(readback[9], 0xffffffff, 5) || compare_colour(readback[9], 0x00000000, 5))
3346 {
3347 TRACE("Read back colors 0x%08x and 0x%08x close to unfiltered color, assuming no filtering\n",
3348 readback[6], readback[9]);
3349 ret = FALSE;
3350 }
3351 else
3352 {
3353 TRACE("Read back colors are 0x%08x and 0x%08x, assuming texture is filtered\n",
3354 readback[6], readback[9]);
3355 ret = TRUE;
3356 }
3357
3358 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3359 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3360 gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex);
3361 gl_info->gl_ops.gl.p_glDeleteTextures(1, &buffer);
3362 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
3363
3364 if (gl_info->gl_ops.gl.p_glGetError())
3365 {
3366 FIXME("Error during filtering test for format %x, returning no filtering\n", internal);
3367 ret = FALSE;
3368 }
3369
3370 return ret;
3371}
3372
3374 struct wined3d_gl_info *gl_info)
3375{
3376 enum wined3d_pci_vendor vendor = adapter->driver_info.vendor;
3377 struct wined3d_format_gl *format;
3378 unsigned int i;
3379 static const enum wined3d_format_id fmts16[] =
3380 {
3384 };
3385 BOOL filtered;
3386
3387 /* This was already handled by init_format_texture_info(). */
3389 return;
3390
3391 if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
3392 {
3394 {
3395 TRACE("Nvidia card with texture_float support: Assuming float16 blending\n");
3396 filtered = TRUE;
3397 }
3398 else if (gl_info->limits.glsl_varyings > 44)
3399 {
3400 TRACE("More than 44 GLSL varyings - assuming d3d10 card with float16 blending\n");
3401 filtered = TRUE;
3402 }
3403 else
3404 {
3405 TRACE("Assuming no float16 blending\n");
3406 filtered = FALSE;
3407 }
3408
3409 if (filtered)
3410 {
3411 for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
3412 {
3415 }
3416 }
3417 return;
3418 }
3419
3420 for (i = 0; i < ARRAY_SIZE(fmts16); ++i)
3421 {
3423 if (!format->internal)
3424 continue; /* Not supported by GL */
3425
3426 filtered = check_filter(gl_info, format->internal);
3427 if (filtered)
3428 {
3429 TRACE("Format %s supports filtering.\n", debug_d3dformat(format->f.id));
3431 }
3432 else
3433 {
3434 TRACE("Format %s does not support filtering.\n", debug_d3dformat(format->f.id));
3435 }
3436 }
3437}
3438
3440{
3441 switch (c)
3442 {
3443 default:
3444 case '0':
3445 return CHANNEL_SOURCE_ZERO;
3446 case '1':
3447 return CHANNEL_SOURCE_ONE;
3448 case 'x':
3449 case 'X':
3450 return CHANNEL_SOURCE_X;
3451 case 'y':
3452 case 'Y':
3453 return CHANNEL_SOURCE_Y;
3454 case 'z':
3455 case 'Z':
3456 return CHANNEL_SOURCE_Z;
3457 case 'w':
3458 case 'W':
3459 return CHANNEL_SOURCE_W;
3460 }
3461}
3462
3463static unsigned int fixup_sign_from_char(char c)
3464{
3465 if (c == 'x' || c == 'y' || c == 'z' || c == 'w')
3466 return 1;
3467 return 0;
3468}
3469
3471{
3472 struct color_fixup_desc fixup;
3473
3474 if (strlen(s) != 4)
3475 {
3476 ERR("Invalid fixup string %s.\n", wine_dbgstr_a(s));
3477 return COLOR_FIXUP_IDENTITY;
3478 }
3479
3481 fixup.x_source = fixup_source_from_char(s[0]);
3483 fixup.y_source = fixup_source_from_char(s[1]);
3485 fixup.z_source = fixup_source_from_char(s[2]);
3487 fixup.w_source = fixup_source_from_char(s[3]);
3488
3489 return fixup;
3490}
3491
3492static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
3493{
3494 const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
3495 struct wined3d_format_gl *format;
3496 BOOL use_legacy_fixups;
3497 unsigned int i;
3498
3499 static const struct
3500 {
3501 enum wined3d_format_id id;
3502 const char *fixup;
3503 BOOL legacy;
3504 enum wined3d_gl_extension extension;
3505 }
3506 fixups[] =
3507 {
3513
3517
3521
3525
3529
3532
3535
3539
3542
3545
3548
3551
3554
3556 };
3557
3558 use_legacy_fixups = d3d_info->wined3d_creation_flags & WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR;
3559 for (i = 0; i < ARRAY_SIZE(fixups); ++i)
3560 {
3561 if (fixups[i].legacy && !use_legacy_fixups)
3562 continue;
3563
3564 if (!gl_info->supported[fixups[i].extension])
3565 continue;
3566
3567 format = get_format_gl_internal(adapter, fixups[i].id);
3568 format->f.color_fixup = create_color_fixup_desc_from_string(fixups[i].fixup);
3569 }
3570
3571 if (!gl_info->supported[APPLE_YCBCR_422] && !gl_info->supported[APPLE_RGB_422]
3572 && (gl_info->supported[ARB_FRAGMENT_PROGRAM]
3573 || (gl_info->supported[ARB_FRAGMENT_SHADER] && gl_info->supported[ARB_VERTEX_SHADER])))
3574 {
3577
3580 }
3581 else if (!gl_info->supported[APPLE_YCBCR_422] && gl_info->supported[APPLE_RGB_422])
3582 {
3585
3588 }
3589 else if (!gl_info->supported[APPLE_YCBCR_422] && (!gl_info->supported[ARB_FRAGMENT_PROGRAM]
3590 && (!gl_info->supported[ARB_FRAGMENT_SHADER] || !gl_info->supported[ARB_VERTEX_SHADER])))
3591 {
3594 format->internal = 0;
3595
3598 format->internal = 0;
3599 }
3600
3601 if (gl_info->supported[ARB_FRAGMENT_PROGRAM]
3602 || (gl_info->supported[ARB_FRAGMENT_SHADER] && gl_info->supported[ARB_VERTEX_SHADER]))
3603 {
3606 format->f.height_scale.numerator = 3;
3607 format->f.height_scale.denominator = 2;
3609
3612 format->f.height_scale.numerator = 3;
3613 format->f.height_scale.denominator = 2;
3615 }
3616 else
3617 {
3620 format->internal = 0;
3621
3624 format->internal = 0;
3625 }
3626
3628 {
3631 }
3632
3633 if (!gl_info->supported[ARB_HALF_FLOAT_PIXEL])
3634 {
3637
3640
3643 }
3644
3645 if (gl_info->quirks & WINED3D_QUIRK_BROKEN_RGBA16)
3646 {
3649 }
3650
3651 /* ATI instancing hack: Although ATI cards do not support Shader Model
3652 * 3.0, they support instancing. To query if the card supports instancing
3653 * CheckDeviceFormat() with the special format MAKEFOURCC('I','N','S','T')
3654 * is used. Should an application check for this, provide a proper return
3655 * value. We can do instancing with all shader versions, but we need
3656 * vertex shaders.
3657 *
3658 * Additionally applications have to set the D3DRS_POINTSIZE render state
3659 * to MAKEFOURCC('I','N','S','T') once to enable instancing. Wined3d
3660 * doesn't need that and just ignores it.
3661 *
3662 * With Shader Model 3.0 capable cards Instancing 'just works' in Windows. */
3663 /* FIXME: This should just check the shader backend caps. */
3664 if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_VERTEX_SHADER])
3665 {
3668 }
3669
3670 /* Depth bound test. To query if the card supports it CheckDeviceFormat()
3671 * with the special format MAKEFOURCC('N','V','D','B') is used. It is
3672 * enabled by setting D3DRS_ADAPTIVETESS_X render state to
3673 * MAKEFOURCC('N','V','D','B') and then controlled by setting
3674 * D3DRS_ADAPTIVETESS_Z (zMin) and D3DRS_ADAPTIVETESS_W (zMax) to test
3675 * value. */
3676 if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST])
3677 {
3680 }
3681
3682 if (gl_info->supported[ARB_MULTISAMPLE])
3683 {
3686 }
3687
3688 /* RESZ aka AMD DX9-level hack for multisampled depth buffer resolve. You query for RESZ
3689 * support by checking for availability of MAKEFOURCC('R','E','S','Z') surfaces with
3690 * RENDERTARGET usage. */
3691 if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
3692 {
3695 }
3696
3697 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
3698 {
3700
3702 continue;
3703
3704 if (is_identity_fixup(format->f.color_fixup))
3705 continue;
3706
3707 TRACE("Checking support for fixup:\n");
3708 dump_color_fixup_desc(format->f.color_fixup);
3709 if (!adapter->shader_backend->shader_color_fixup_supported(format->f.color_fixup)
3710 || !adapter->fragment_pipe->color_fixup_supported(format->f.color_fixup))
3711 {
3712 TRACE("[FAILED]\n");
3714 }
3715 else
3716 {
3717 TRACE("[OK]\n");
3718 }
3719 }
3720
3721 /* These formats are not supported for 3D textures. See also
3722 * WINED3D_FORMAT_CAP_DECOMPRESS. */
3724 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3726 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3728 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3730 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3732 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] &= ~WINED3D_FORMAT_CAP_TEXTURE;
3733}
3734
3736 struct wined3d_gl_info *gl_info)
3737{
3738 struct wined3d_format_gl *format;
3739 unsigned int i;
3740
3741 for (i = 0; i < ARRAY_SIZE(format_vertex_info); ++i)
3742 {
3744 return FALSE;
3745
3746 if (!gl_info->supported[format_vertex_info[i].extension])
3747 continue;
3748
3749 format->f.emit_idx = format_vertex_info[i].emit_idx;
3750 format->vtx_type = format_vertex_info[i].gl_vtx_type;
3751 format->vtx_format = format->f.component_count;
3753 }
3754
3755 if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
3756 {
3758 format->vtx_format = GL_BGRA;
3759 }
3760
3761 return TRUE;
3762}
3763
3765{
3766 unsigned int caps[WINED3D_GL_RES_TYPE_COUNT];
3767 unsigned int attrs, i, j;
3768
3769 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
3770 {
3771 struct wined3d_format *format, *typeless_format;
3772
3774 return FALSE;
3775 if (!(typeless_format = get_format_internal(adapter, typed_formats[i].typeless_id)))
3776 return FALSE;
3777
3778 attrs = typeless_format->attrs;
3779 memcpy(caps, typeless_format->caps, sizeof(caps));
3780 copy_format(adapter, typeless_format, format);
3781 typeless_format->attrs |= attrs;
3782 for (j = 0; j < ARRAY_SIZE(typeless_format->caps); ++j)
3783 typeless_format->caps[j] |= caps[j];
3784 }
3785
3787 {
3788 struct wined3d_format *typeless_format, *typeless_ds_format, *ds_format;
3789 struct wined3d_format *depth_view_format, *stencil_view_format;
3791
3793 return FALSE;
3794 if (!(ds_format = get_format_internal(adapter, typeless_depth_stencil_formats[i].depth_stencil_id)))
3795 return FALSE;
3796
3797 typeless_ds_format = get_format_by_idx(adapter, WINED3D_FORMAT_COUNT + i);
3798 typeless_ds_format->id = typeless_depth_stencil_formats[i].typeless_id;
3799 copy_format(adapter, typeless_ds_format, ds_format);
3800 typeless_ds_format->attrs = typeless_format->attrs;
3801 for (j = 0; j < ARRAY_SIZE(typeless_ds_format->caps); ++j)
3802 {
3803 typeless_ds_format->caps[j] = typeless_format->caps[j];
3804 typeless_format->caps[j] &= ~WINED3D_FORMAT_CAP_DEPTH_STENCIL;
3805 }
3806
3807 if ((format_id = typeless_depth_stencil_formats[i].depth_view_id)
3808 && typeless_depth_stencil_formats[i].separate_depth_view_format)
3809 {
3810 if (!(depth_view_format = get_format_internal(adapter, format_id)))
3811 return FALSE;
3812 copy_format(adapter, depth_view_format, ds_format);
3813 depth_view_format->red_size = depth_view_format->depth_size;
3814 depth_view_format->depth_size = 0;
3815 depth_view_format->stencil_size = 0;
3816 }
3817 if ((format_id = typeless_depth_stencil_formats[i].stencil_view_id))
3818 {
3819 if (!(stencil_view_format = get_format_internal(adapter, format_id)))
3820 return FALSE;
3821 copy_format(adapter, stencil_view_format, ds_format);
3822 stencil_view_format->green_size = stencil_view_format->stencil_size;
3823 stencil_view_format->depth_size = 0;
3824 stencil_view_format->stencil_size = 0;
3825 }
3826 }
3827
3828 return TRUE;
3829}
3830
3832 struct wined3d_gl_info *gl_info)
3833{
3834 unsigned int i, j;
3835
3836 if (!gl_info->fbo_ops.glGenerateMipmap)
3837 return;
3838
3839 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
3840 {
3842
3843 for (j = 0; j < ARRAY_SIZE(format->caps); ++j)
3846 }
3847}
3848
3850{
3851 static const struct wined3d_color red = {1.0f, 0.0f, 0.0f, 1.0f};
3852 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3853 static const float offset = -63.0f / 128.0f;
3854 GLuint texture, fbo;
3855 uint32_t readback[4];
3856 unsigned int i;
3857
3858 gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
3859 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3860 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
3861 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ARRAY_SIZE(readback), 1, 0,
3863 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3864 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3865 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3867 checkGLcall("create resources");
3868
3869 gl_info->gl_ops.gl.p_glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
3870 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3871 GL_EXTCALL(glViewportIndexedf(0, offset, offset, 4.0f, 1.0f));
3873 checkGLcall("draw");
3874
3875 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3876 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0,
3878 checkGLcall("readback");
3879
3880 TRACE("Readback colors are 0x%08x, 0x%08x, 0x%08x, 0x%08x.\n",
3881 readback[0], readback[1], readback[2], readback[3]);
3882
3883 gl_info->gl_ops.gl.p_glDeleteTextures(1, &texture);
3884 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3885 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3886 checkGLcall("delete resources");
3887
3888 for (i = 0; i < ARRAY_SIZE(readback); ++i)
3889 {
3890 if (readback[i] != 0xffff0000)
3891 return FALSE;
3892 }
3893 return TRUE;
3894}
3895
3897{
3898 static const struct wined3d_color red = {1.0f, 0.0f, 0.0f, 1.0f};
3899 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3900 unsigned int x, y, clear = 0, draw = 0;
3901 GLuint texture, fbo;
3902 uint32_t readback[8][8];
3903
3904 /* This is a very simple test to find out how GL handles polygon edges:
3905 * Draw a 1x1 quad exactly through 4 adjacent pixel centers in an 8x8
3906 * viewport and see which pixel it ends up in. So far we've seen top left
3907 * and bottom left conventions. This test may produce unexpected results
3908 * if the driver forces multisampling on us.
3909 *
3910 * If we find a bottom-left filling behavior we also move the x-axis
3911 * by the same amount. This is necessary to keep diagonals that go
3912 * through the pixel center intact.
3913 *
3914 * Note that we are ignoring some settings that might influence the
3915 * driver: How we switch GL to an upper-left coordinate system,
3916 * shaders vs fixed function GL. Testing these isn't possible with
3917 * the current draw_test_quad() infrastructure. Also the test is
3918 * skipped if we are not using FBOs. Drawing into the onscreen
3919 * frame buffer may also yield different driver behavior.
3920 *
3921 * The minimum offset also depends on the viewport size, although
3922 * the relation between those two is GPU dependent and not exactly
3923 * sensible. E.g. a 8192x8192 viewport on a GeForce 9 needs at
3924 * least an offset of 1/240.9, whereas a 8x8 one needs 1/255.982;
3925 * 32x32 needs 1/255.935. 4x4 and lower are happy with something
3926 * below 1/256. The 8x8 size below has been arbitrarily chosen to
3927 * get a useful result out of that card and avoid allocating a
3928 * gigantic texture during library init.
3929 *
3930 * Newer cards usually do the right thing anyway. In cases where
3931 * they do not (e.g. Radeon GPUs in a macbookpro14,3 running MacOS)
3932 * an offset of 1/2^20 is enough. */
3933 const struct wined3d_vec3 edge_geometry[] =
3934 {
3935 {(-1.0f + offset) / 8.0f, (-1.0f + offset) / 8.0f, 0.0f},
3936 {( 1.0f + offset) / 8.0f, (-1.0f + offset) / 8.0f, 0.0f},
3937 {(-1.0f + offset) / 8.0f, ( 1.0f + offset) / 8.0f, 0.0f},
3938 {( 1.0f + offset) / 8.0f, ( 1.0f + offset) / 8.0f, 0.0f},
3939 };
3940
3941 gl_info->gl_ops.gl.p_glGenTextures(1, &texture);
3942 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3943 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
3944 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 8, 8, 0,
3946 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
3947 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
3948 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3950 checkGLcall("create resources");
3951
3952 gl_info->gl_ops.gl.p_glViewport(0, 0, 8, 8);
3953 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
3954 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT);
3955
3956 draw_test_quad(ctx, edge_geometry, &red);
3957 checkGLcall("draw");
3958
3959 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture);
3960 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0,
3962 checkGLcall("readback");
3963
3964 gl_info->gl_ops.gl.p_glDeleteTextures(1, &texture);
3965 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
3966 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
3967 checkGLcall("delete resources");
3968
3969 /* We expect that exactly one fragment is generated. */
3970 for (y = 0; y < ARRAY_SIZE(readback); ++y)
3971 {
3972 for (x = 0; x < ARRAY_SIZE(readback[0]); ++x)
3973 {
3974 if (readback[y][x] == 0xff0000ff)
3975 clear++;
3976 else if (readback[y][x] == 0xffff0000)
3977 draw++;
3978 }
3979 }
3980
3981 if (clear != 63 || draw != 1)
3982 {
3983 FIXME("Unexpected filling convention test result.\n");
3984 return FALSE;
3985 }
3986
3987 /* One pixel was drawn, check if it is the expected one */
3988 return readback[3][3] == 0xffff0000;
3989}
3991{
3992 const struct wined3d_gl_info *gl_info = ctx->gl_info;
3993 static const struct wined3d_color blue = {0.0f, 0.0f, 1.0f, 1.0f};
3994 GLuint fbo, color, depth;
3995 unsigned int low = 0, high = 32, cur;
3996 uint32_t readback[256];
3997 static const struct wined3d_vec3 geometry[] =
3998 {
3999 {-1.0f, -1.0f, -1.0f},
4000 { 1.0f, -1.0f, 0.0f},
4001 {-1.0f, 1.0f, -1.0f},
4002 { 1.0f, 1.0f, 0.0f},
4003 };
4004
4005 /* Most drivers want 2^23 for fixed point depth buffers, including r300g, r600g,
4006 * Nvidia. Use this as a fallback if the detection fails. */
4007 unsigned int fallback = 23;
4008
4009 gl_info->gl_ops.gl.p_glGenTextures(1, &color);
4010 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, color);
4011 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
4012 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 256, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);
4013
4014 gl_info->fbo_ops.glGenRenderbuffers(1, &depth);
4015 gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, depth);
4016 gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, format, 256, 1);
4017
4018 gl_info->fbo_ops.glGenFramebuffers(1, &fbo);
4019 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo);
4020 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0);
4021 gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);
4022 checkGLcall("Setup framebuffer");
4023
4024 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 0.5f, 0.0f);
4025 gl_info->gl_ops.gl.p_glClearDepth(0.5f);
4026 gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
4027 gl_info->gl_ops.gl.p_glEnable(GL_POLYGON_OFFSET_FILL);
4028 gl_info->gl_ops.gl.p_glViewport(0, 0, 256, 1);
4029 checkGLcall("Misc parameters");
4030
4031 for (;;)
4032 {
4033 if (high - low <= 1)
4034 {
4035 ERR("PolygonOffset scale factor detection failed, using fallback value 2^%u.\n", fallback);
4036 cur = fallback;
4037 break;
4038 }
4039 cur = (low + high) / 2;
4040
4041 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
4042 /* The post viewport transform Z of the geometry runs from 0.0 to 0.5. We want to push it another
4043 * 0.25 so that the Z buffer content (0.5) cuts the quad off at half the screen. */
4044 gl_info->gl_ops.gl.p_glPolygonOffset(0.0f, (float)(1u << cur) * 0.25f);
4045 draw_test_quad(ctx, geometry, &blue);
4046 checkGLcall("Test draw");
4047
4048 /* Rebinding texture to workaround a fglrx bug. */
4049 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, color);
4050 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, readback);
4051 checkGLcall("readback");
4052
4053 TRACE("low %02u, high %02u, cur %2u, 0=0x%08x, 125=0x%08x, 131=0x%08x, 255=0x%08x\n",
4054 low, high, cur, readback[0], readback[125], readback[131], readback[255]);
4055
4056 if ((readback[125] & 0xff) < 0xa0)
4057 high = cur;
4058 else if ((readback[131] & 0xff) > 0xa0)
4059 low = cur;
4060 else
4061 {
4062 TRACE("Found scale factor 2^%u for format %x.\n", cur, format);
4063 break;
4064 }
4065 }
4066
4067 gl_info->gl_ops.gl.p_glDeleteTextures(1, &color);
4068 gl_info->fbo_ops.glDeleteRenderbuffers(1, &depth);
4069 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo);
4070 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0);
4071 checkGLcall("Delete framebuffer");
4072
4073 gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
4074 gl_info->gl_ops.gl.p_glDisable(GL_POLYGON_OFFSET_FILL);
4075 return (float)(1u << cur);
4076}
4077
4079 struct wined3d_caps_gl_ctx *ctx)
4080{
4081 const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
4082 unsigned int i;
4083
4084 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
4085 {
4087
4088 if (format->f.depth_size && (format->f.caps[WINED3D_GL_RES_TYPE_RB] & WINED3D_FORMAT_CAP_DEPTH_STENCIL))
4089 {
4090 TRACE("Testing depth bias scale for format %s.\n", debug_d3dformat(format->f.id));
4091 format->f.depth_bias_scale = wined3d_adapter_find_polyoffset_scale(ctx, format->internal);
4092
4094 {
4095 /* The single-precision binary floating-point format has
4096 * a significand precision of 24 bits.
4097 */
4098 if (format->f.attrs & WINED3D_FORMAT_ATTR_FLOAT)
4099 format->f.depth_bias_scale /= 1u << 24;
4100 else
4101 format->f.depth_bias_scale /= 1u << format->f.depth_size;
4102 }
4103 }
4104 }
4105}
4106
4108{
4110
4111 if (!(adapter->formats = calloc(count, format_size)))
4112 {
4113 ERR("Failed to allocate memory.\n");
4114 return FALSE;
4115 }
4116 adapter->format_size = format_size;
4117
4119 goto fail;
4121 goto fail;
4123 goto fail;
4125 goto fail;
4126
4127 return TRUE;
4128
4129fail:
4130 free(adapter->formats);
4131 adapter->formats = NULL;
4132 return FALSE;
4133}
4134
4136{
4137 struct wined3d_format *format;
4138 unsigned int i;
4139
4140 static const enum wined3d_format_id blit_formats[] =
4141 {
4159 };
4160
4162 return FALSE;
4163
4164 for (i = 0; i < ARRAY_SIZE(blit_formats); ++i)
4165 {
4166 if (!(format = get_format_internal(adapter, blit_formats[i])))
4167 return FALSE;
4168
4171 }
4172
4173 return TRUE;
4174}
4175
4176/* Context activation is done by the caller. */
4178{
4180
4182 return FALSE;
4183
4184 if (!init_format_texture_info(adapter, gl_info)) goto fail;
4185 if (!init_format_vertex_info(adapter, gl_info)) goto fail;
4186
4187 apply_format_fixups(adapter, gl_info);
4192
4193 if (!init_typeless_formats(adapter)) goto fail;
4194
4195 return TRUE;
4196
4197fail:
4198 free(adapter->formats);
4199 adapter->formats = NULL;
4200 return FALSE;
4201}
4202
4204 const struct wined3d_vk_info *vk_info, VkPhysicalDevice vk_physical_device)
4205{
4206 static const struct
4207 {
4208 enum wined3d_format_id id;
4209 VkFormat vk_format;
4210 const char *fixup;
4211 }
4212 vulkan_formats[] =
4213 {
4285 };
4286 VkFormat vk_format = VK_FORMAT_UNDEFINED;
4287 VkImageFormatProperties image_properties;
4288 VkFormatFeatureFlags texture_flags;
4290 VkImageUsageFlags vk_usage;
4291 unsigned int caps;
4292 const char *fixup;
4293 unsigned int i;
4294 uint32_t mask;
4295 VkResult vr;
4296
4297 for (i = 0; i < ARRAY_SIZE(vulkan_formats); ++i)
4298 {
4299 if (vulkan_formats[i].id == format->f.id)
4300 {
4301 vk_format = vulkan_formats[i].vk_format;
4302 fixup = vulkan_formats[i].fixup;
4303 break;
4304 }
4305 }
4306 if (!vk_format)
4307 {
4308 WARN("Unsupported format %s.\n", debug_d3dformat(format->f.id));
4309 return;
4310 }
4311
4312 format->vk_format = vk_format;
4313 if (fixup)
4314 format->f.color_fixup = create_color_fixup_desc_from_string(fixup);
4315 else
4316 format->f.color_fixup = COLOR_FIXUP_IDENTITY;
4317
4318 VK_CALL(vkGetPhysicalDeviceFormatProperties(vk_physical_device, vk_format, &properties));
4319 if (vk_format == VK_FORMAT_D24_UNORM_S8_UINT)
4320 {
4322 {
4323 /* AMD doesn't support VK_FORMAT_D24_UNORM_S8_UINT. */
4324 WARN("Mapping VK_FORMAT_D24_UNORM_S8_UINT to VK_FORMAT_D32_SFLOAT_S8_UINT.\n");
4325
4326 format->vk_format = vk_format = VK_FORMAT_D32_SFLOAT_S8_UINT;
4327 VK_CALL(vkGetPhysicalDeviceFormatProperties(vk_physical_device, vk_format, &properties));
4328 }
4329 }
4330
4335
4336 caps = 0;
4337 texture_flags = properties.linearTilingFeatures | properties.optimalTilingFeatures;
4338 if (texture_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)
4339 {
4341 }
4342 if (texture_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)
4343 {
4345 }
4347 {
4349 }
4351 {
4353 }
4355 {
4357 }
4358 if (texture_flags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)
4359 {
4361 }
4362 if ((texture_flags & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT)
4363 && (texture_flags & VK_FORMAT_FEATURE_TRANSFER_DST_BIT))
4364 {
4366 }
4367
4370
4371 format->f.caps[WINED3D_GL_RES_TYPE_TEX_1D] |= caps;
4372 format->f.caps[WINED3D_GL_RES_TYPE_TEX_2D] |= caps;
4373 format->f.caps[WINED3D_GL_RES_TYPE_TEX_3D] |= caps;
4374 format->f.caps[WINED3D_GL_RES_TYPE_TEX_CUBE] |= caps;
4375
4376 vk_usage = 0;
4377 if (texture_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)
4379 else if (texture_flags & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
4381 if (vk_usage)
4382 {
4383 if ((vr = VK_CALL(vkGetPhysicalDeviceImageFormatProperties(vk_physical_device, vk_format,
4384 VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, vk_usage, 0, &image_properties))) < 0)
4385 {
4386 ERR("Failed to get image format properties, vr %s.\n", wined3d_debug_vkresult(vr));
4387 return;
4388 }
4389
4390 mask = image_properties.sampleCounts & 0x3f;
4391 while (mask)
4392 {
4393 i = (1u << wined3d_bit_scan(&mask)) - 1;
4394 format->f.multisample_types |= 1u << i;
4395 }
4396 }
4397}
4398
4400 const struct wined3d_vk_info *vk_info)
4401{
4402 VkPhysicalDevice vk_physical_device = adapter_vk->physical_device;
4403 struct wined3d_adapter *adapter = &adapter_vk->a;
4404 struct wined3d_format_vk *format;
4405 unsigned int i;
4406
4408 return FALSE;
4409
4410 for (i = 0; i < WINED3D_FORMAT_COUNT; ++i)
4411 {
4413
4414 if (format->f.id)
4415 init_vulkan_format_info(format, vk_info, vk_physical_device);
4416 }
4417
4418 if (!init_typeless_formats(adapter)) goto fail;
4419
4420 return TRUE;
4421
4422fail:
4423 free(adapter->formats);
4424 adapter->formats = NULL;
4425 return FALSE;
4426}
4427
4429 enum wined3d_format_id format_id, unsigned int bind_flags)
4430{
4431 const struct wined3d_format *format;
4433 unsigned int i;
4434
4435 if (idx == -1)
4436 {
4437 FIXME("Can't find format %s (%#x) in the format lookup table.\n",
4440 }
4441
4443
4445 {
4447 {
4450 }
4451
4452 FIXME("Cannot find depth/stencil typeless format %s (%#x).\n",
4455 }
4456
4457 return format;
4458}
4459
4461 const struct wined3d_format *format, enum wined3d_channel_type channel_type)
4462{
4463 const struct wined3d_typed_format_info *info;
4464 uint32_t i;
4465
4466 for (i = 0; i < ARRAY_SIZE(typed_formats); ++i)
4467 {
4468 info = &typed_formats[i];
4469 if (info->typeless_id == format->typeless_id && map_channel_type(info->channels[0]) == channel_type)
4470 return info->id;
4471 }
4472
4473 return WINED3DFMT_UNKNOWN;
4474}
4475
4477 enum wined3d_format_id view_format_id)
4478{
4479 unsigned int i;
4480
4482 {
4483 if (typeless_depth_stencil_formats[i].typeless_id == resource_format_id)
4484 return typeless_depth_stencil_formats[i].depth_view_id == view_format_id;
4485 }
4486 return FALSE;
4487}
4488
4490 unsigned int width, unsigned int height, unsigned int *row_pitch, unsigned int *slice_pitch)
4491{
4492 /* For block based formats, pitch means the amount of bytes to the next
4493 * row of blocks rather than the next row of pixels. */
4495 {
4496 unsigned int row_block_count = (width + format->block_width - 1) / format->block_width;
4497 unsigned int slice_block_count = (height + format->block_height - 1) / format->block_height;
4498 *row_pitch = row_block_count * format->block_byte_count;
4499 *row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1);
4500 *slice_pitch = *row_pitch * slice_block_count;
4501 }
4502 else
4503 {
4504 *row_pitch = format->byte_count * width; /* Bytes / row */
4505 *row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1);
4506 *slice_pitch = *row_pitch * height;
4507 }
4508
4510 {
4511 /* The D3D format requirements make sure that the resulting format is an integer again */
4512 *slice_pitch *= format->height_scale.numerator;
4513 *slice_pitch /= format->height_scale.denominator;
4514 }
4515
4516 TRACE("Returning row pitch %u, slice pitch %u.\n", *row_pitch, *slice_pitch);
4517}
4518
4521{
4522 unsigned int row_pitch, slice_pitch;
4523
4524 if (format->id == WINED3DFMT_UNKNOWN)
4525 return 0;
4526
4528 return width * height * depth * format->byte_count;
4529
4530 wined3d_format_calculate_pitch(format, alignment, width, height, &row_pitch, &slice_pitch);
4531
4532 return slice_pitch * depth;
4533}
4534
4536{
4537 unsigned int i;
4538
4539 for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i)
4540 {
4541 if (format1 == format_srgb_info[i].srgb_format_id)
4542 return format2 == format_srgb_info[i].base_format_id;
4543 if (format1 == format_srgb_info[i].base_format_id)
4544 return format2 == format_srgb_info[i].srgb_format_id;
4545 }
4546 return FALSE;
4547}
4548
4549/*****************************************************************************
4550 * Trace formatting of useful values
4551 */
4552const char *debug_box(const struct wined3d_box *box)
4553{
4554 if (!box)
4555 return "(null)";
4556 return wine_dbg_sprintf("(%u, %u, %u)-(%u, %u, %u)",
4557 box->left, box->top, box->front,
4558 box->right, box->bottom, box->back);
4559}
4560
4561const char *debug_color(const struct wined3d_color *color)
4562{
4563 if (!color)
4564 return "(null)";
4565 return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}",
4566 color->r, color->g, color->b, color->a);
4567}
4568
4569const char *debug_ivec4(const struct wined3d_ivec4 *v)
4570{
4571 if (!v)
4572 return "(null)";
4573 return wine_dbg_sprintf("{%d, %d, %d, %d}",
4574 v->x, v->y, v->z, v->w);
4575}
4576
4577const char *debug_uvec4(const struct wined3d_uvec4 *v)
4578{
4579 if (!v)
4580 return "(null)";
4581 return wine_dbg_sprintf("{%u, %u, %u, %u}",
4582 v->x, v->y, v->z, v->w);
4583}
4584
4585const char *debug_vec4(const struct wined3d_vec4 *v)
4586{
4587 if (!v)
4588 return "(null)";
4589 return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}",
4590 v->x, v->y, v->z, v->w);
4591}
4592
4594{
4595 if (!address)
4596 return "(null)";
4597 return wine_dbg_sprintf("{%p:%p}", address->buffer_object, address->addr);
4598}
4599
4601{
4603}
4604
4606{
4607 switch (format_id)
4608 {
4609#define FMT_TO_STR(format_id) case format_id: return #format_id
4763#undef FMT_TO_STR
4764 default:
4765 {
4766 char fourcc[5];
4767 fourcc[0] = (char)(format_id);
4768 fourcc[1] = (char)(format_id >> 8);
4769 fourcc[2] = (char)(format_id >> 16);
4770 fourcc[3] = (char)(format_id >> 24);
4771 fourcc[4] = 0;
4772 if (isprint(fourcc[0]) && isprint(fourcc[1]) && isprint(fourcc[2]) && isprint(fourcc[3]))
4773 FIXME("Unrecognized %#x (as fourcc: %s) WINED3DFORMAT!\n", format_id, fourcc);
4774 else
4775 FIXME("Unrecognized %#x WINED3DFORMAT!\n", format_id);
4776 }
4777 return "unrecognized";
4778 }
4779}
4780
4782{
4783 switch (device_type)
4784 {
4785#define DEVTYPE_TO_STR(dev) case dev: return #dev
4789#undef DEVTYPE_TO_STR
4790 default:
4791 FIXME("Unrecognized device type %#x.\n", device_type);
4792 return "unrecognized";
4793 }
4794}
4795
4797{
4798 char str[200]; /* wine_dbg_sprintf() limits string size to 200 */
4799 char *ptr;
4800 int size;
4801};
4802
4803static void init_debug_buffer(struct debug_buffer *buffer, const char *default_string)
4804{
4805 snprintf(buffer->str, sizeof(buffer->str), "%s", default_string);
4806 buffer->ptr = buffer->str;
4807 buffer->size = sizeof(buffer->str);
4808}
4809
4810static void debug_append(struct debug_buffer *buffer, const char *str, const char *separator)
4811{
4812 int size;
4813
4814 if (!separator || buffer->ptr == buffer->str)
4815 separator = "";
4816 size = snprintf(buffer->ptr, buffer->size, "%s%s", separator, str);
4817 if (size == -1 || size >= buffer->size)
4818 {
4819 buffer->size = 0;
4820 strcpy(&buffer->str[sizeof(buffer->str) - 4], "...");
4821 return;
4822 }
4823
4824 buffer->ptr += size;
4825 buffer->size -= size;
4826}
4827
4829{
4830 struct debug_buffer buffer;
4831
4833#define ACCESS_TO_STR(x) if (access & x) { debug_append(&buffer, #x, " | "); access &= ~x; }
4838#undef ACCESS_TO_STR
4839 if (access)
4840 FIXME("Unrecognised access flag(s) %#x.\n", access);
4841
4842 return wine_dbg_sprintf("%s", buffer.str);
4843}
4844
4845const char *wined3d_debug_bind_flags(uint32_t bind_flags)
4846{
4847 struct debug_buffer buffer;
4848
4850#define BIND_FLAG_TO_STR(x) if (bind_flags & x) { debug_append(&buffer, #x, " | "); bind_flags &= ~x; }
4860#undef BIND_FLAG_TO_STR
4861 if (bind_flags)
4862 FIXME("Unrecognised bind flag(s) %#x.\n", bind_flags);
4863
4864 return wine_dbg_sprintf("%s", buffer.str);
4865}
4866
4868{
4869 struct debug_buffer buffer;
4870 unsigned int flags = d->flags;
4871
4873#define VIEW_FLAG_TO_STR(x) if (flags & x) { debug_append(&buffer, #x, " | "); flags &= ~x; }
4882#undef VIEW_FLAG_TO_STR
4883 if (flags)
4884 FIXME("Unrecognised view flag(s) %#x.\n", flags);
4885
4886 if (resource->type == WINED3D_RTYPE_BUFFER)
4887 return wine_dbg_sprintf("format %s, flags %s, start_idx %u, count %u",
4888 debug_d3dformat(d->format_id), buffer.str, d->u.buffer.start_idx, d->u.buffer.count);
4889 else
4890 return wine_dbg_sprintf("format %s, flags %s, level_idx %u, level_count %u, layer_idx %u, layer_count %u",
4891 debug_d3dformat(d->format_id), buffer.str, d->u.texture.level_idx, d->u.texture.level_count,
4892 d->u.texture.layer_idx, d->u.texture.layer_count);
4893}
4894
4896{
4897 struct debug_buffer buffer;
4898
4900#define WINED3DUSAGE_TO_STR(x) if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
4926#undef WINED3DUSAGE_TO_STR
4927 if (usage)
4928 FIXME("Unrecognized usage flag(s) %#x.\n", usage);
4929
4930 return wine_dbg_sprintf("%s", buffer.str);
4931}
4932
4934{
4935 switch (method)
4936 {
4937#define WINED3DDECLMETHOD_TO_STR(u) case u: return #u
4945#undef WINED3DDECLMETHOD_TO_STR
4946 default:
4947 FIXME("Unrecognized declaration method %#x.\n", method);
4948 return "unrecognized";
4949 }
4950}
4951
4953{
4954 switch (usage)
4955 {
4956#define WINED3DDECLUSAGE_TO_STR(u) case u: return #u
4971#undef WINED3DDECLUSAGE_TO_STR
4972 default:
4973 FIXME("Unrecognized %u declaration usage!\n", usage);
4974 return "unrecognized";
4975 }
4976}
4977
4979{
4980 switch (classification)
4981 {
4982#define WINED3D_TO_STR(x) case x: return #x
4985#undef WINED3D_TO_STR
4986 default:
4987 FIXME("Unrecognized input classification %#x.\n", classification);
4988 return "unrecognized";
4989 }
4990}
4991
4992const char *debug_d3dresourcetype(enum wined3d_resource_type resource_type)
4993{
4994 switch (resource_type)
4995 {
4996#define WINED3D_TO_STR(x) case x: return #x
5002#undef WINED3D_TO_STR
5003 default:
5004 FIXME("Unrecognized resource type %#x.\n", resource_type);
5005 return "unrecognized";
5006 }
5007}
5008
5009const char *debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type)
5010{
5011 switch (primitive_type)
5012 {
5013#define PRIM_TO_STR(prim) case prim: return #prim
5026#undef PRIM_TO_STR
5027 default:
5028 FIXME("Unrecognized primitive type %#x.\n", primitive_type);
5029 return "unrecognized";
5030 }
5031}
5032
5034{
5035 switch (state)
5036 {
5037#define D3DSTATE_TO_STR(u) case u: return #u
5162#undef D3DSTATE_TO_STR
5163 default:
5164 FIXME("Unrecognized %u render state!\n", state);
5165 return "unrecognized";
5166 }
5167}
5168
5170{
5171 switch (state)
5172 {
5173#define D3DSTATE_TO_STR(u) case u: return #u
5187#undef D3DSTATE_TO_STR
5188 default:
5189 FIXME("Unrecognized %u sampler state!\n", state);
5190 return "unrecognized";
5191 }
5192}
5193
5195{
5196 switch (filter_type)
5197 {
5198#define D3DTEXTUREFILTERTYPE_TO_STR(u) case u: return #u
5207#undef D3DTEXTUREFILTERTYPE_TO_STR
5208 default:
5209 FIXME("Unrecognized texture filter type 0x%08x.\n", filter_type);
5210 return "unrecognized";
5211 }
5212}
5213
5215{
5216 switch (state)
5217 {
5218#define D3DSTATE_TO_STR(u) case u: return #u
5237#undef D3DSTATE_TO_STR
5238 default:
5239 FIXME("Unrecognized %u texture state!\n", state);
5240 return "unrecognized";
5241 }
5242}
5243
5244const char *debug_d3dtop(enum wined3d_texture_op d3dtop)
5245{
5246 switch (d3dtop)
5247 {
5248#define D3DTOP_TO_STR(u) case u: return #u
5275#undef D3DTOP_TO_STR
5276 default:
5277 FIXME("Unrecognized texture op %#x.\n", d3dtop);
5278 return "unrecognized";
5279 }
5280}
5281
5283{
5284 switch (tstype)
5285 {
5286#define TSTYPE_TO_STR(tstype) case tstype: return #tstype
5301#undef TSTYPE_TO_STR
5302 default:
5303 if (tstype > 256 && tstype < 512)
5304 {
5305 FIXME("WINED3D_TS_WORLD_MATRIX(%u). 1..255 not currently supported.\n", tstype);
5306 return ("WINED3D_TS_WORLD_MATRIX > 0");
5307 }
5308 FIXME("Unrecognized transform state %#x.\n", tstype);
5309 return "unrecognized";
5310 }
5311}
5312
5314{
5315 switch(type)
5316 {
5317#define WINED3D_TO_STR(type) case type: return #type
5324#undef WINED3D_TO_STR
5325 default:
5326 FIXME("Unrecognized shader type %#x.\n", type);
5327 return "unrecognized";
5328 }
5329}
5330
5332{
5334 return wine_dbg_sprintf("STATE_RENDER(%s)", debug_d3drenderstate(state - STATE_RENDER(0)));
5336 {
5337 unsigned int texture_stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
5338 uint32_t texture_state = state - STATE_TEXTURESTAGE(texture_stage, 0);
5339 return wine_dbg_sprintf("STATE_TEXTURESTAGE(%#x, %s)",
5340 texture_stage, debug_d3dtexturestate(texture_state));
5341 }
5345 return wine_dbg_sprintf("STATE_SHADER(%s)", debug_shader_type(state - STATE_SHADER(0)));
5347 return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(WINED3D_SHADER_TYPE_COMPUTE));
5349 return wine_dbg_sprintf("STATE_CONSTANT_BUFFER(%s)", debug_shader_type(state - STATE_CONSTANT_BUFFER(0)));
5351 return "STATE_COMPUTE_SHADER_RESOURCE_BINDING";
5353 return "STATE_GRAPHICS_SHADER_RESOURCE_BINDING";
5355 return "STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING";
5357 return "STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING";
5359 return "STATE_STREAMSRC";
5361 return "STATE_INDEXBUFFER";
5362 if (STATE_IS_VDECL(state))
5363 return "STATE_VDECL";
5365 return "STATE_VIEWPORT";
5367 return "STATE_SCISSORRECT";
5369 return wine_dbg_sprintf("STATE_CLIPPLANE(%#x)", state - STATE_CLIPPLANE(0));
5371 return "STATE_RASTERIZER";
5373 return "STATE_DEPTH_BOUNDS";
5375 return "STATE_BASEVERTEXINDEX";
5377 return "STATE_FRAMEBUFFER";
5379 return "STATE_STREAM_OUTPUT";
5380 if (STATE_IS_BLEND(state))
5381 return "STATE_BLEND";
5383 return "STATE_BLEND_FACTOR";
5385 return "STATE_SAMPLE_MASK";
5387 return "STATE_DEPTH_STENCIL";
5389 return "STATE_STENCIL_REF";
5390
5391 return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state);
5392}
5393
5395{
5396 switch(attachment)
5397 {
5398#define WINED3D_TO_STR(x) case x: return #x
5417#undef WINED3D_TO_STR
5418 default:
5419 return wine_dbg_sprintf("Unknown FBO attachment %#x", attachment);
5420 }
5421}
5422
5424 switch(status) {
5425#define FBOSTATUS_TO_STR(u) case u: return #u
5438#undef FBOSTATUS_TO_STR
5439 default:
5440 FIXME("Unrecognized FBO status 0x%08x.\n", status);
5441 return "unrecognized";
5442 }
5443}
5444
5446 switch(error) {
5447#define GLERROR_TO_STR(u) case u: return #u
5456#undef GLERROR_TO_STR
5457 default:
5458 FIXME("Unrecognized GL error 0x%08x.\n", error);
5459 return "unrecognized";
5460 }
5461}
5462
5464{
5465 switch (vr)
5466 {
5467#define WINED3D_TO_STR(x) case x: return #x
5496#undef WINED3D_TO_STR
5497 default:
5498 return wine_dbg_sprintf("unrecognised(%d)", vr);
5499 }
5500}
5501
5503{
5504 switch(source)
5505 {
5506#define WINED3D_TO_STR(x) case x: return #x
5515#undef WINED3D_TO_STR
5516 default:
5517 FIXME("Unrecognized fixup_channel_source %#x\n", source);
5518 return "unrecognized";
5519 }
5520}
5521
5522static const char *debug_complex_fixup(enum complex_fixup fixup)
5523{
5524 switch(fixup)
5525 {
5526#define WINED3D_TO_STR(x) case x: return #x
5533#undef WINED3D_TO_STR
5534 default:
5535 FIXME("Unrecognized complex fixup %#x\n", fixup);
5536 return "unrecognized";
5537 }
5538}
5539
5541{
5542 if (is_complex_fixup(fixup))
5543 {
5544 TRACE("\tComplex: %s\n", debug_complex_fixup(get_complex_fixup(fixup)));
5545 return;
5546 }
5547
5548 TRACE("\tX: %s%s\n", debug_fixup_channel_source(fixup.x_source), fixup.x_sign_fixup ? ", SIGN_FIXUP" : "");
5549 TRACE("\tY: %s%s\n", debug_fixup_channel_source(fixup.y_source), fixup.y_sign_fixup ? ", SIGN_FIXUP" : "");
5550 TRACE("\tZ: %s%s\n", debug_fixup_channel_source(fixup.z_source), fixup.z_sign_fixup ? ", SIGN_FIXUP" : "");
5551 TRACE("\tW: %s%s\n", debug_fixup_channel_source(fixup.w_source), fixup.w_sign_fixup ? ", SIGN_FIXUP" : "");
5552}
5553
5554BOOL is_invalid_op(const struct wined3d_state *state, int stage,
5556{
5557 if (op == WINED3D_TOP_DISABLE)
5558 return FALSE;
5560 return FALSE;
5561
5564 return TRUE;
5567 return TRUE;
5570 return TRUE;
5571
5572 return FALSE;
5573}
5574
5576{
5577 static const struct wined3d_matrix identity =
5578 {
5579 1.0f, 0.0f, 0.0f, 0.0f,
5580 0.0f, 1.0f, 0.0f, 0.0f,
5581 0.0f, 0.0f, 1.0f, 0.0f,
5582 0.0f, 0.0f, 0.0f, 1.0f,
5583 };
5584
5585 *mat = identity;
5586}
5587
5589{
5591}
5592
5593/* Setup this textures matrix according to the texture flags. */
5594static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords,
5595 enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix)
5596{
5597 struct wined3d_matrix mat;
5598
5600 {
5601 get_identity_matrix(out_matrix);
5602 return;
5603 }
5604
5606 {
5607 ERR("Invalid texture transform flags: WINED3D_TTFF_COUNT1 | WINED3D_TTFF_PROJECTED.\n");
5608 return;
5609 }
5610
5611 mat = *matrix;
5612
5613 /* When less than 4 components are provided for an attribute, the remaining
5614 * components are filled with (..., 0, 0, 1). This is the case when using
5615 * shaders in Direct3D as well as in GL and Vulkan.
5616 *
5617 * However, when using the Direct3D fixed function vertex pipeline, the
5618 * texture coordinates transformed by texture matrices effectively have
5619 * 1 in the first "default" component and 0 in the others (e.g. for
5620 * R32_FLOAT the coordinates are (..., 1, 0, 0).
5621 *
5622 * We could approximate this by modifying the shader, but modifying uniforms
5623 * is generally cheaper, so instead we change the matrix, copying the 2nd or
5624 * 3rd column to the 4th. That is, whichever coefficients expect a value of
5625 * 1 will instead be used as the coefficients for the 4th column, which
5626 * actually has a value of 1. The coefficients for other columns don't need
5627 * to be modified, since the corresponding texcoord components are zero. */
5628
5629 if (!(flags & WINED3D_TTFF_PROJECTED) && !calculated_coords)
5630 {
5631 switch (format_id)
5632 {
5634 mat._41 = mat._21;
5635 mat._42 = mat._22;
5636 mat._43 = mat._23;
5637 mat._44 = mat._24;
5638 break;
5639
5641 mat._41 = mat._31;
5642 mat._42 = mat._32;
5643 mat._43 = mat._33;
5644 mat._44 = mat._34;
5645 break;
5646
5649 case WINED3DFMT_UNKNOWN:
5650 break;
5651 default:
5652 FIXME("Unexpected fixed function texture coord input\n");
5653 }
5654 }
5655
5656 *out_matrix = mat;
5657}
5658
5659static enum wined3d_format_id get_texcoord_format(const struct wined3d_vertex_declaration *decl, unsigned int index)
5660{
5661 for (unsigned int i = 0; i < decl->element_count; ++i)
5662 {
5663 if (decl->elements[i].usage == WINED3D_DECL_USAGE_TEXCOORD
5664 && decl->elements[i].usage_idx == index)
5665 return decl->elements[i].format->id;
5666 }
5667
5668 return WINED3DFMT_UNKNOWN;
5669}
5670
5672 const unsigned int tex, struct wined3d_matrix *mat)
5673{
5674 BOOL generated = (state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000)
5676 unsigned int coord_idx = min(state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0x0000ffff,
5678
5680 state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS],
5681 generated, get_texcoord_format(state->vertex_declaration, coord_idx), mat);
5682}
5683
5685 float *out_min, float *out_max)
5686{
5687 union
5688 {
5689 DWORD d;
5690 float f;
5691 } min, max;
5692
5693 min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
5694 max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
5695
5696 if (min.f > max.f)
5697 min.f = max.f;
5698
5699 *out_min = min.f;
5700 *out_max = max.f;
5701}
5702
5704 float *start, float *end)
5705{
5706 union
5707 {
5708 DWORD d;
5709 float f;
5710 } tmpvalue;
5711
5712 switch (context->fog_source)
5713 {
5714 case FOGSOURCE_VS:
5715 *start = 1.0f;
5716 *end = 0.0f;
5717 break;
5718
5719 case FOGSOURCE_FFP:
5720 tmpvalue.d = state->render_states[WINED3D_RS_FOGSTART];
5721 *start = tmpvalue.f;
5722 tmpvalue.d = state->render_states[WINED3D_RS_FOGEND];
5723 *end = tmpvalue.f;
5724 /* Special handling for fog_start == fog_end. In d3d with vertex
5725 * fog, everything is fogged. With table fog, everything with
5726 * fog_coord < fog_start is unfogged, and fog_coord > fog_start
5727 * is fogged. Windows drivers disagree when fog_coord == fog_start. */
5728 if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE && *start == *end)
5729 {
5730 *start = -INFINITY;
5731 *end = 0.0f;
5732 }
5733 break;
5734
5735 default:
5736 /* This should not happen, context->fog_source is set in wined3d, not the app. */
5737 ERR("Unexpected fog coordinate source.\n");
5738 *start = 0.0f;
5739 *end = 0.0f;
5740 }
5741}
5742
5744{
5745 DISPLAY_DEVICEW display_device;
5746 DWORD device_idx = 0;
5747
5748 display_device.cb = sizeof(display_device);
5749 while (EnumDisplayDevicesW(NULL, device_idx++, &display_device, 0))
5750 {
5751 if (display_device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
5752 {
5753 lstrcpyW(display, display_device.DeviceName);
5754 return TRUE;
5755 }
5756 }
5757
5758 return FALSE;
5759}
5760
5762{
5763 D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME open_adapter_param;
5764 D3DKMT_CLOSEADAPTER close_adapter_param;
5765
5766 if (!wined3d_get_primary_display(open_adapter_param.DeviceName))
5767 return FALSE;
5768
5769 if (D3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_param))
5770 return FALSE;
5771
5772 *luid = open_adapter_param.AdapterLuid;
5773 close_adapter_param.hAdapter = open_adapter_param.hAdapter;
5774 D3DKMTCloseAdapter(&close_adapter_param);
5775 return TRUE;
5776}
5777
5779{
5780 uint32_t p = 0;
5781
5782 p |= (value->x & wined3d_mask_from_size(format->red_size)) << format->red_offset;
5783 p |= (value->y & wined3d_mask_from_size(format->green_size)) << format->green_offset;
5784 p |= (value->z & wined3d_mask_from_size(format->blue_size)) << format->blue_offset;
5785 p |= (value->w & wined3d_mask_from_size(format->alpha_size)) << format->alpha_offset;
5786
5787 return p;
5788}
5789
5792{
5794 {
5795 retval->int32[0] = c->r;
5796 retval->int32[1] = c->g;
5797 retval->int32[2] = c->b;
5798 retval->int32[3] = c->a;
5799 }
5800 else
5801 {
5802 retval->float32[0] = c->r;
5803 retval->float32[1] = c->g;
5804 retval->float32[2] = c->b;
5805 retval->float32[3] = c->a;
5806 }
5807}
5808
5809/* Note: It's the caller's responsibility to ensure values can be expressed
5810 * in the requested format. UNORM formats for example can only express values
5811 * in the range 0.0f -> 1.0f.
5812 *
5813 * The code below assumes that no component crosses the 32 bit boundary (like
5814 * e.g. a hypothetical, and totally braindead, B30G30R4 format would).
5815 * This function writes at least sizeof(uint32_t) bytes, or format->byte_count,
5816 * whichever is larger. */
5818 const struct wined3d_color *color, void *ret)
5819{
5820 static const struct
5821 {
5823 struct wined3d_vec4 mul;
5824 struct wined3d_uvec4 shift;
5825 }
5826 float_conv[] =
5827 {
5828 {WINED3DFMT_P8_UINT, { 0.0f, 0.0f, 0.0f, 255.0f}, { 0, 0, 0, 0}},
5829 {WINED3DFMT_S1_UINT_D15_UNORM, { 32767.0f, 0.0f, 0.0f, 0.0f}, { 0, 0, 0, 0}},
5830 {WINED3DFMT_D16_UNORM, { 65535.0f, 0.0f, 0.0f, 0.0f}, { 0, 0, 0, 0}},
5831 };
5832 static const struct
5833 {
5835 struct wined3d_dvec4 mul;
5836 struct wined3d_uvec4 shift;
5837 }
5838 double_conv[] =
5839 {
5840 {WINED3DFMT_D24_UNORM_S8_UINT, { 16777215.0, 1.0, 0.0, 0.0}, {8, 0, 0, 0}},
5841 {WINED3DFMT_X8D24_UNORM, { 16777215.0, 0.0, 0.0, 0.0}, {0, 0, 0, 0}},
5842 {WINED3DFMT_D32_UNORM, {4294967295.0, 0.0, 0.0, 0.0}, {0, 0, 0, 0}},
5843 };
5845 struct wined3d_color colour_srgb;
5846 struct wined3d_uvec4 idx, shift;
5847 unsigned int i;
5848
5849 TRACE("Converting colour %s to format %s.\n", debug_color(color), debug_d3dformat(format_id));
5850 memset(ret, 0, max(sizeof(uint32_t), format->byte_count));
5851
5852 for (i = 0; i < ARRAY_SIZE(format_srgb_info); ++i)
5853 {
5854 if (format_id != format_srgb_info[i].srgb_format_id)
5855 continue;
5856
5858 format_id = format_srgb_info[i].base_format_id;
5859 color = &colour_srgb;
5860 break;
5861 }
5862
5863 for (i = 0; i < ARRAY_SIZE(float_conv); ++i)
5864 {
5865 uint32_t *ret_i = ret;
5866
5867 if (format_id != float_conv[i].format_id)
5868 continue;
5869
5870 idx.x = float_conv[i].shift.x / 32;
5871 idx.y = float_conv[i].shift.y / 32;
5872 idx.z = float_conv[i].shift.z / 32;
5873 idx.w = float_conv[i].shift.w / 32;
5874 shift.x = float_conv[i].shift.x % 32;
5875 shift.y = float_conv[i].shift.y % 32;
5876 shift.z = float_conv[i].shift.z % 32;
5877 shift.w = float_conv[i].shift.w % 32;
5878
5879 ret_i[idx.x] = ((uint32_t)((color->r * float_conv[i].mul.x) + 0.5f)) << shift.x;
5880 ret_i[idx.y] |= ((uint32_t)((color->g * float_conv[i].mul.y) + 0.5f)) << shift.y;
5881 ret_i[idx.z] |= ((uint32_t)((color->b * float_conv[i].mul.z) + 0.5f)) << shift.z;
5882 ret_i[idx.w] |= ((uint32_t)((color->a * float_conv[i].mul.w) + 0.5f)) << shift.w;
5883
5884 return;
5885 }
5886
5887 for (i = 0; i < ARRAY_SIZE(double_conv); ++i)
5888 {
5889 uint32_t *ret_i;
5890
5891 if (format_id != double_conv[i].format_id)
5892 continue;
5893
5894 idx.x = double_conv[i].shift.x / 32;
5895 idx.y = double_conv[i].shift.y / 32;
5896 idx.z = double_conv[i].shift.z / 32;
5897 idx.w = double_conv[i].shift.w / 32;
5898 shift.x = double_conv[i].shift.x % 32;
5899 shift.y = double_conv[i].shift.y % 32;
5900 shift.z = double_conv[i].shift.z % 32;
5901 shift.w = double_conv[i].shift.w % 32;
5902
5903 ret_i = ret;
5904 ret_i[idx.x] = ((uint32_t)((color->r * double_conv[i].mul.x) + 0.5)) << shift.x;
5905 ret_i[idx.y] |= ((uint32_t)((color->g * double_conv[i].mul.y) + 0.5)) << shift.y;
5906 ret_i[idx.z] |= ((uint32_t)((color->b * double_conv[i].mul.z) + 0.5)) << shift.z;
5907 ret_i[idx.w] |= ((uint32_t)((color->a * double_conv[i].mul.w) + 0.5)) << shift.w;
5908
5909 return;
5910 }
5911
5913 {
5914 uint32_t *ret_i = ret;
5915
5916 idx.x = format->red_offset / 32;
5917 idx.y = format->green_offset / 32;
5918 idx.z = format->blue_offset / 32;
5919 idx.w = format->alpha_offset / 32;
5920 shift.x = format->red_offset % 32;
5921 shift.y = format->green_offset % 32;
5922 shift.z = format->blue_offset % 32;
5923 shift.w = format->alpha_offset % 32;
5924
5925 ret_i[idx.x] = ((uint32_t)((color->r * wined3d_mask_from_size(format->red_size)) + 0.5f)) << shift.x;
5926 ret_i[idx.y] |= ((uint32_t)((color->g * wined3d_mask_from_size(format->green_size)) + 0.5f)) << shift.y;
5927 ret_i[idx.z] |= ((uint32_t)((color->b * wined3d_mask_from_size(format->blue_size)) + 0.5f)) << shift.z;
5928 ret_i[idx.w] |= ((uint32_t)((color->a * wined3d_mask_from_size(format->alpha_size)) + 0.5f)) << shift.w;
5929
5930 return;
5931 }
5932
5933 /* 32 bit float formats. We don't handle D32_FLOAT_S8X24_UINT for now. */
5934 if ((format->attrs & WINED3D_FORMAT_ATTR_FLOAT)
5935 && (format->red_size == 32 || format->depth_size == 32)
5936 && !format->stencil_size)
5937 {
5938 float *ret_f = ret;
5939
5940 switch (format->byte_count)
5941 {
5942 case 16: ret_f[3] = color->a;
5943 case 12: ret_f[2] = color->b;
5944 case 8: ret_f[1] = color->g;
5945 case 4: ret_f[0] = color->r;
5946 break;
5947
5948 default:
5949 ERR("Unexpected byte count %u, format %s.\n", format->byte_count, debug_d3dformat(format_id));
5950 break;
5951 }
5952
5953 return;
5954 }
5955
5956 if ((format->attrs & WINED3D_FORMAT_ATTR_FLOAT) && format->red_size == 16)
5957 {
5958 uint16_t *ret_s = ret;
5959
5960 switch (format->byte_count)
5961 {
5962 case 8:
5963 ret_s[3] = float_32_to_16(&color->a);
5964 ret_s[2] = float_32_to_16(&color->b);
5965 /* fall through */
5966 case 4:
5967 ret_s[1] = float_32_to_16(&color->g);
5968 /* fall through */
5969 case 2:
5970 ret_s[0] = float_32_to_16(&color->r);
5971 break;
5972
5973 default:
5974 ERR("Unexpected byte count %u, format %s.\n", format->byte_count, debug_d3dformat(format_id));
5975 break;
5976 }
5977
5978 return;
5979 }
5980
5981 FIXME("Conversion for format %s not implemented.\n", debug_d3dformat(format_id));
5982}
5983
5985{
5987
5988 if (!size)
5989 return 1.0f;
5990
5991 color >>= offset;
5992 color &= mask;
5993
5994 return (float)color / (float)mask;
5995}
5996
5998 const struct wined3d_color_key *key, struct wined3d_color *float_colors)
5999{
6000 struct wined3d_color slop = {INFINITY, INFINITY, INFINITY, INFINITY};
6001
6002 switch (format->id)
6003 {
6022 if (format->red_size)
6023 slop.r = 0.5f / wined3d_mask_from_size(format->red_size);
6024 if (format->green_size)
6025 slop.g = 0.5f / wined3d_mask_from_size(format->green_size);
6026 if (format->blue_size)
6027 slop.b = 0.5f / wined3d_mask_from_size(format->blue_size);
6028 if (format->alpha_size)
6029 slop.a = 0.5f / wined3d_mask_from_size(format->alpha_size);
6030
6031 float_colors[0].r = color_to_float(key->color_space_low_value, format->red_size, format->red_offset)
6032 - slop.r;
6033 float_colors[0].g = color_to_float(key->color_space_low_value, format->green_size, format->green_offset)
6034 - slop.g;
6035 float_colors[0].b = color_to_float(key->color_space_low_value, format->blue_size, format->blue_offset)
6036 - slop.b;
6037 float_colors[0].a = color_to_float(key->color_space_low_value, format->alpha_size, format->alpha_offset)
6038 - slop.a;
6039
6040 float_colors[1].r = color_to_float(key->color_space_high_value, format->red_size, format->red_offset)
6041 + slop.r;
6042 float_colors[1].g = color_to_float(key->color_space_high_value, format->green_size, format->green_offset)
6043 + slop.g;
6044 float_colors[1].b = color_to_float(key->color_space_high_value, format->blue_size, format->blue_offset)
6045 + slop.b;
6046 float_colors[1].a = color_to_float(key->color_space_high_value, format->alpha_size, format->alpha_offset)
6047 + slop.a;
6048 break;
6049
6050 case WINED3DFMT_P8_UINT:
6051 float_colors[0].r = 0.0f;
6052 float_colors[0].g = 0.0f;
6053 float_colors[0].b = 0.0f;
6054 float_colors[0].a = (key->color_space_low_value - 0.5f) / 255.0f;
6055
6056 float_colors[1].r = 0.0f;
6057 float_colors[1].g = 0.0f;
6058 float_colors[1].b = 0.0f;
6059 float_colors[1].a = (key->color_space_high_value + 0.5f) / 255.0f;
6060 break;
6061
6062 default:
6063 ERR("Unhandled color key to float conversion for format %s.\n", debug_d3dformat(format->id));
6064 }
6065}
6066
6068{
6069 switch (depth)
6070 {
6071 case 8: return WINED3DFMT_P8_UINT;
6072 case 15: return WINED3DFMT_B5G5R5X1_UNORM;
6073 case 16: return WINED3DFMT_B5G6R5_UNORM;
6074 case 24: return WINED3DFMT_B8G8R8X8_UNORM; /* Robots needs 24bit to be WINED3DFMT_B8G8R8X8_UNORM */
6075 case 32: return WINED3DFMT_B8G8R8X8_UNORM; /* EVE online and the Fur demo need 32bit AdapterDisplayMode to return WINED3DFMT_B8G8R8X8_UNORM */
6076 default: return WINED3DFMT_UNKNOWN;
6077 }
6078}
6079
6081 unsigned int src_row_pitch, unsigned int src_slice_pitch, uint8_t *dst, unsigned int dst_row_pitch,
6082 unsigned int dst_slice_pitch, unsigned int w, unsigned int h, unsigned int d)
6083{
6084 unsigned int row_block_count, row_count, row_size, slice, row;
6085 unsigned int slice_count = d, slice_size;
6086 const uint8_t *src_row;
6087 uint8_t *dst_row;
6088
6089 row_block_count = (w + format->block_width - 1) / format->block_width;
6090 row_count = (h + format->block_height - 1) / format->block_height;
6091 row_size = row_block_count * format->block_byte_count;
6092 slice_size = row_size * row_count;
6093
6094 if (src_row_pitch == row_size && dst_row_pitch == row_size
6095 && ((src_slice_pitch == slice_size && dst_slice_pitch == slice_size) || slice_count == 1))
6096 {
6097 memcpy(dst, src, slice_count * slice_size);
6098 return;
6099 }
6100
6101 for (slice = 0; slice < slice_count; ++slice)
6102 {
6103 for (row = 0; row < row_count; ++row)
6104 {
6105 src_row = &src[slice * src_slice_pitch + row * src_row_pitch];
6106 dst_row = &dst[slice * dst_slice_pitch + row * dst_row_pitch];
6107 memcpy(dst_row, src_row, row_size);
6108 }
6109 }
6110}
6111
6112void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
6113{
6114 struct wined3d_matrix tmp;
6115
6116 /* Now do the multiplication 'by hand'.
6117 I know that all this could be optimised, but this will be done later :-) */
6118 tmp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
6119 tmp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
6120 tmp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
6121 tmp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
6122
6123 tmp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
6124 tmp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
6125 tmp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
6126 tmp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
6127
6128 tmp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
6129 tmp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
6130 tmp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
6131 tmp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
6132
6133 tmp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
6134 tmp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
6135 tmp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
6136 tmp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
6137
6138 *dst = tmp;
6139}
6140
6142 const struct wined3d_d3d_info *d3d_info, struct ffp_frag_settings *settings)
6143{
6144#define ARG1 0x01
6145#define ARG2 0x02
6146#define ARG0 0x04
6147 static const unsigned char args[WINED3D_TOP_LERP + 1] =
6148 {
6149 /* undefined */ 0,
6150 /* D3DTOP_DISABLE */ 0,
6151 /* D3DTOP_SELECTARG1 */ ARG1,
6152 /* D3DTOP_SELECTARG2 */ ARG2,
6153 /* D3DTOP_MODULATE */ ARG1 | ARG2,
6154 /* D3DTOP_MODULATE2X */ ARG1 | ARG2,
6155 /* D3DTOP_MODULATE4X */ ARG1 | ARG2,
6156 /* D3DTOP_ADD */ ARG1 | ARG2,
6157 /* D3DTOP_ADDSIGNED */ ARG1 | ARG2,
6158 /* D3DTOP_ADDSIGNED2X */ ARG1 | ARG2,
6159 /* D3DTOP_SUBTRACT */ ARG1 | ARG2,
6160 /* D3DTOP_ADDSMOOTH */ ARG1 | ARG2,
6161 /* D3DTOP_BLENDDIFFUSEALPHA */ ARG1 | ARG2,
6162 /* D3DTOP_BLENDTEXTUREALPHA */ ARG1 | ARG2,
6163 /* D3DTOP_BLENDFACTORALPHA */ ARG1 | ARG2,
6164 /* D3DTOP_BLENDTEXTUREALPHAPM */ ARG1 | ARG2,
6165 /* D3DTOP_BLENDCURRENTALPHA */ ARG1 | ARG2,
6166 /* D3DTOP_PREMODULATE */ ARG1 | ARG2,
6167 /* D3DTOP_MODULATEALPHA_ADDCOLOR */ ARG1 | ARG2,
6168 /* D3DTOP_MODULATECOLOR_ADDALPHA */ ARG1 | ARG2,
6169 /* D3DTOP_MODULATEINVALPHA_ADDCOLOR */ ARG1 | ARG2,
6170 /* D3DTOP_MODULATEINVCOLOR_ADDALPHA */ ARG1 | ARG2,
6171 /* D3DTOP_BUMPENVMAP */ ARG1 | ARG2,
6172 /* D3DTOP_BUMPENVMAPLUMINANCE */ ARG1 | ARG2,
6173 /* D3DTOP_DOTPRODUCT3 */ ARG1 | ARG2,
6174 /* D3DTOP_MULTIPLYADD */ ARG1 | ARG2 | ARG0,
6175 /* D3DTOP_LERP */ ARG1 | ARG2 | ARG0
6176 };
6177 unsigned int i;
6178 DWORD ttff;
6179 DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2;
6180 struct wined3d_texture *texture;
6181
6182 settings->padding = 0;
6183
6184 for (i = 0; i < d3d_info->ffp_fragment_caps.max_blend_stages; ++i)
6185 {
6186 settings->op[i].padding = 0;
6187 if (state->texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
6188 {
6189 settings->op[i].cop = WINED3D_TOP_DISABLE;
6190 settings->op[i].aop = WINED3D_TOP_DISABLE;
6191 settings->op[i].carg0 = settings->op[i].carg1 = settings->op[i].carg2 = ARG_UNUSED;
6192 settings->op[i].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED;
6193 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
6194 settings->op[i].tmp_dst = 0;
6195 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
6196 settings->op[i].projected = WINED3D_PROJECTION_NONE;
6197 i++;
6198 break;
6199 }
6200
6202 {
6203 if (can_use_texture_swizzle(d3d_info, texture->resource.format))
6204 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
6205 else
6206 settings->op[i].color_fixup = texture->resource.format->color_fixup;
6207 settings->op[i].tex_type = texture->resource.gl_type;
6208 } else {
6209 settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
6210 settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
6211 }
6212
6213 cop = state->texture_states[i][WINED3D_TSS_COLOR_OP];
6214 aop = state->texture_states[i][WINED3D_TSS_ALPHA_OP];
6215
6216 carg1 = (args[cop] & ARG1) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG1] : ARG_UNUSED;
6217 carg2 = (args[cop] & ARG2) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG2] : ARG_UNUSED;
6218 carg0 = (args[cop] & ARG0) ? state->texture_states[i][WINED3D_TSS_COLOR_ARG0] : ARG_UNUSED;
6219
6220 if (is_invalid_op(state, i, cop, carg1, carg2, carg0))
6221 {
6222 carg0 = ARG_UNUSED;
6223 carg2 = ARG_UNUSED;
6224 carg1 = WINED3DTA_CURRENT;
6226 }
6227
6228 if (cop == WINED3D_TOP_DOTPRODUCT3)
6229 {
6230 /* A dotproduct3 on the colorop overwrites the alphaop operation and replicates
6231 * the color result to the alpha component of the destination
6232 */
6233 aop = cop;
6234 aarg1 = carg1;
6235 aarg2 = carg2;
6236 aarg0 = carg0;
6237 }
6238 else
6239 {
6240 aarg1 = (args[aop] & ARG1) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG1] : ARG_UNUSED;
6241 aarg2 = (args[aop] & ARG2) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] : ARG_UNUSED;
6242 aarg0 = (args[aop] & ARG0) ? state->texture_states[i][WINED3D_TSS_ALPHA_ARG0] : ARG_UNUSED;
6243 }
6244
6245 if (!i && state->render_states[WINED3D_RS_COLORKEYENABLE]
6246 && texture && !(texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP)
6247 && (texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT) && !texture->resource.format->alpha_size)
6248 {
6249 if (aop == WINED3D_TOP_DISABLE)
6250 {
6251 aarg1 = WINED3DTA_TEXTURE;
6253 }
6254 else if (aop == WINED3D_TOP_SELECT_ARG1 && aarg1 != WINED3DTA_TEXTURE)
6255 {
6256 if (state->blend_state && state->blend_state->desc.rt[0].enable)
6257 {
6258 aarg2 = WINED3DTA_TEXTURE;
6260 }
6261 else
6262 {
6263 aarg1 = WINED3DTA_TEXTURE;
6264 }
6265 }
6266 else if (aop == WINED3D_TOP_SELECT_ARG2 && aarg2 != WINED3DTA_TEXTURE)
6267 {
6268 if (state->blend_state && state->blend_state->desc.rt[0].enable)
6269 {
6270 aarg1 = WINED3DTA_TEXTURE;
6272 }
6273 else
6274 {
6275 aarg2 = WINED3DTA_TEXTURE;
6276 }
6277 }
6278 }
6279
6280 if (is_invalid_op(state, i, aop, aarg1, aarg2, aarg0))
6281 {
6282 aarg0 = ARG_UNUSED;
6283 aarg2 = ARG_UNUSED;
6284 aarg1 = WINED3DTA_CURRENT;
6286 }
6287
6288 if (carg1 == WINED3DTA_TEXTURE || carg2 == WINED3DTA_TEXTURE || carg0 == WINED3DTA_TEXTURE
6289 || aarg1 == WINED3DTA_TEXTURE || aarg2 == WINED3DTA_TEXTURE || aarg0 == WINED3DTA_TEXTURE)
6290 {
6291 ttff = state->texture_states[i][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS];
6293 settings->op[i].projected = WINED3D_PROJECTION_COUNT3;
6294 else if (ttff & WINED3D_TTFF_PROJECTED)
6295 settings->op[i].projected = WINED3D_PROJECTION_COUNT4;
6296 else
6297 settings->op[i].projected = WINED3D_PROJECTION_NONE;
6298 }
6299 else
6300 {
6301 settings->op[i].projected = WINED3D_PROJECTION_NONE;
6302 }
6303
6304 settings->op[i].cop = cop;
6305 settings->op[i].aop = aop;
6306 settings->op[i].carg0 = carg0;
6307 settings->op[i].carg1 = carg1;
6308 settings->op[i].carg2 = carg2;
6309 settings->op[i].aarg0 = aarg0;
6310 settings->op[i].aarg1 = aarg1;
6311 settings->op[i].aarg2 = aarg2;
6312 settings->op[i].tmp_dst = state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP;
6313 }
6314
6315 /* Clear unsupported stages */
6316 for (; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6317 memset(&settings->op[i], 0xff, sizeof(settings->op[i]));
6318
6319 if (!state->render_states[WINED3D_RS_FOGENABLE])
6320 {
6322 }
6323 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE)
6324 {
6325 if (use_vs(state) || state->vertex_declaration->position_transformed)
6326 {
6328 }
6329 else
6330 {
6331 switch (state->render_states[WINED3D_RS_FOGVERTEXMODE])
6332 {
6333 case WINED3D_FOG_NONE:
6334 case WINED3D_FOG_LINEAR:
6336 break;
6337 case WINED3D_FOG_EXP:
6339 break;
6340 case WINED3D_FOG_EXP2:
6342 break;
6343 }
6344 }
6345 }
6346 else
6347 {
6348 switch (state->render_states[WINED3D_RS_FOGTABLEMODE])
6349 {
6350 case WINED3D_FOG_LINEAR:
6352 break;
6353 case WINED3D_FOG_EXP:
6355 break;
6356 case WINED3D_FOG_EXP2:
6358 break;
6359 }
6360 }
6361 settings->sRGB_write = !d3d_info->srgb_write_control && needs_srgb_write(d3d_info, state, &state->fb);
6362
6364 if (state->render_states[WINED3D_RS_COLORKEYENABLE]
6365 && texture && (texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT)
6366 && settings->op[0].cop != WINED3D_TOP_DISABLE)
6367 settings->color_key_enabled = 1;
6368 else
6369 settings->color_key_enabled = 0;
6370
6371 /* texcoords_initialized is set to meaningful values only when GL doesn't
6372 * support enough varyings to always pass around all the possible texture
6373 * coordinates.
6374 * This is used to avoid reading a varying not written by the vertex shader.
6375 * Reading uninitialized varyings on core profile contexts results in an
6376 * error while with builtin varyings on legacy contexts you get undefined
6377 * behavior. */
6378 if (d3d_info->limits.varying_count && !d3d_info->full_ffp_varyings)
6379 {
6380 settings->texcoords_initialized = 0;
6381 for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6382 {
6383 if (use_vs(state))
6384 {
6385 if (state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.output_registers & (1u << i))
6386 settings->texcoords_initialized |= 1u << i;
6387 }
6388 else
6389 {
6390 unsigned int coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6391 if ((state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX] >> WINED3D_FFP_TCI_SHIFT)
6393 || (coord_idx < WINED3D_MAX_FFP_TEXTURES && (state->vertex_declaration->texcoords & (1u << coord_idx))))
6394 settings->texcoords_initialized |= 1u << i;
6395 }
6396 }
6397 }
6398 else
6399 {
6401 }
6402
6403 settings->pointsprite = state->render_states[WINED3D_RS_POINTSPRITEENABLE]
6404 && state->primitive_type == WINED3D_PT_POINTLIST;
6405
6406 if (d3d_info->ffp_alpha_test)
6407 settings->alpha_test_func = WINED3D_CMP_ALWAYS - 1;
6408 else
6409 settings->alpha_test_func = (state->render_states[WINED3D_RS_ALPHATESTENABLE]
6411 : WINED3D_CMP_ALWAYS) - 1;
6412
6413 if (d3d_info->emulated_flatshading)
6414 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6415 else
6416 settings->flatshading = FALSE;
6417}
6418
6419const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders,
6420 const struct ffp_frag_settings *settings)
6421{
6422 struct wine_rb_entry *entry = wine_rb_get(fragment_shaders, settings);
6424}
6425
6427{
6428 /* Note that the key is the implementation independent part of the ffp_frag_desc structure,
6429 * whereas desc points to an extended structure with implementation specific parts. */
6430 if (wine_rb_put(shaders, &desc->settings, &desc->entry) == -1)
6431 {
6432 ERR("Failed to insert ffp frag shader.\n");
6433 }
6434}
6435
6437{
6438 const struct ffp_frag_settings *ka = key;
6439 const struct ffp_frag_settings *kb = &WINE_RB_ENTRY_VALUE(entry, const struct ffp_frag_desc, entry)->settings;
6440
6441 return memcmp(ka, kb, sizeof(*ka));
6442}
6443
6445 const struct wined3d_d3d_info *d3d_info, struct wined3d_ffp_vs_settings *settings)
6446{
6447 enum wined3d_material_color_source diffuse_source, emissive_source, ambient_source, specular_source;
6448 const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration;
6449 unsigned int coord_idx, i;
6450
6451 memset(settings, 0, sizeof(*settings));
6452
6453 if (vdecl->position_transformed)
6454 {
6455 settings->transformed = 1;
6456 settings->point_size = state->primitive_type == WINED3D_PT_POINTLIST;
6457 settings->per_vertex_point_size = vdecl->point_size;
6458 settings->diffuse = vdecl->diffuse;
6459 if (!state->render_states[WINED3D_RS_FOGENABLE])
6460 settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
6461 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
6463 else
6465
6466 for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6467 {
6468 coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6469 if (coord_idx < WINED3D_MAX_FFP_TEXTURES && (vdecl->texcoords & (1u << coord_idx)))
6470 settings->texcoords |= 1u << i;
6471 settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6472 }
6473 if (d3d_info->full_ffp_varyings)
6475
6476 if (d3d_info->emulated_flatshading)
6477 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6478 else
6479 settings->flatshading = FALSE;
6480
6481 settings->swizzle_map = si->swizzle_map;
6482
6483 return;
6484 }
6485
6486 switch (state->render_states[WINED3D_RS_VERTEXBLEND])
6487 {
6492 settings->vertexblends = state->render_states[WINED3D_RS_VERTEXBLEND];
6493 break;
6494 default:
6495 FIXME("Unsupported vertex blending: %d\n", state->render_states[WINED3D_RS_VERTEXBLEND]);
6496 break;
6497 }
6498
6499 settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
6500 && state->render_states[WINED3D_RS_CLIPPLANEENABLE];
6501 settings->diffuse = vdecl->diffuse;
6502 settings->normal = vdecl->normal;
6503 settings->normalize = settings->normal && state->render_states[WINED3D_RS_NORMALIZENORMALS];
6504 settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];
6505 settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER];
6506 settings->specular_enable = !!state->render_states[WINED3D_RS_SPECULARENABLE];
6507 settings->point_size = state->primitive_type == WINED3D_PT_POINTLIST;
6508 settings->per_vertex_point_size = vdecl->point_size;
6509
6510 wined3d_get_material_colour_source(&diffuse_source, &emissive_source,
6511 &ambient_source, &specular_source, state);
6512 settings->diffuse_source = diffuse_source;
6513 settings->emissive_source = emissive_source;
6514 settings->ambient_source = ambient_source;
6515 settings->specular_source = specular_source;
6516
6517 for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i)
6518 {
6519 coord_idx = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6520 if (coord_idx < WINED3D_MAX_FFP_TEXTURES && (vdecl->texcoords & (1u << coord_idx)))
6521 settings->texcoords |= 1u << i;
6522 settings->texgen[i] = state->texture_states[i][WINED3D_TSS_TEXCOORD_INDEX];
6523 }
6524 if (d3d_info->full_ffp_varyings)
6526
6527 for (i = 0; i < WINED3D_MAX_ACTIVE_LIGHTS; ++i)
6528 {
6529 if (!state->light_state.lights[i])
6530 continue;
6531
6532 switch (state->light_state.lights[i]->OriginalParms.type)
6533 {
6535 ++settings->point_light_count;
6536 break;
6537 case WINED3D_LIGHT_SPOT:
6538 ++settings->spot_light_count;
6539 break;
6541 ++settings->directional_light_count;
6542 break;
6544 ++settings->parallel_point_light_count;
6545 break;
6546 default:
6547 FIXME("Unhandled light type %#x.\n", state->light_state.lights[i]->OriginalParms.type);
6548 break;
6549 }
6550 }
6551
6552 if (!state->render_states[WINED3D_RS_FOGENABLE])
6553 settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
6554 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
6555 {
6557
6558 if (state->transforms[WINED3D_TS_PROJECTION]._14 == 0.0f
6559 && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f
6560 && state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f
6561 && state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f)
6562 settings->ortho_fog = 1;
6563 }
6564 else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE)
6566 else if (state->render_states[WINED3D_RS_RANGEFOGENABLE])
6568 else
6570
6571 if (d3d_info->emulated_flatshading)
6572 settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
6573 else
6574 settings->flatshading = FALSE;
6575
6576 settings->swizzle_map = si->swizzle_map;
6577}
6578
6580{
6581 const struct wined3d_ffp_vs_settings *ka = key;
6583 const struct wined3d_ffp_vs_desc, entry)->settings;
6584
6585 return memcmp(ka, kb, sizeof(*ka));
6586}
6587
6589{
6590 struct debug_buffer buffer;
6591 const char *prefix = "";
6592 const char *suffix = "";
6593
6594 if (wined3d_popcount(location) > 16)
6595 {
6596 prefix = "~(";
6598 suffix = ")";
6599 }
6600
6602#define LOCATION_TO_STR(x) if (location & x) { debug_append(&buffer, #x, " | "); location &= ~x; }
6612#undef LOCATION_TO_STR
6613 if (location)
6614 FIXME("Unrecognized location flag(s) %#x.\n", location);
6615
6616 return wine_dbg_sprintf("%s%s%s", prefix, buffer.str, suffix);
6617}
6618
6620{
6621 switch (level)
6622 {
6623#define LEVEL_TO_STR(level) case level: return #level
6635#undef LEVEL_TO_STR
6636 default:
6637 return wine_dbg_sprintf("%#x", level);
6638 }
6639}
6640
6641/* Print a floating point value with the %.8e format specifier, always using
6642 * '.' as decimal separator. */
6643void wined3d_ftoa(float value, char *s)
6644{
6645 int idx = 1;
6646
6647 if (copysignf(1.0f, value) < 0.0f)
6648 ++idx;
6649
6650 /* Be sure to allocate a buffer of at least 17 characters for the result
6651 as sprintf may return a 3 digit exponent when using the MSVC runtime
6652 instead of a 2 digit exponent. */
6653 sprintf(s, "%.8e", value);
6654 if (isfinite(value))
6655 s[idx] = '.';
6656}
6657
6659{
6660 /* You'd figure ReleaseDC() would fail if the DC doesn't match the window.
6661 * However, that's not what actually happens, and there are user32 tests
6662 * that confirm ReleaseDC() with the wrong window is supposed to succeed.
6663 * So explicitly check that the DC belongs to the window, since we want to
6664 * avoid releasing a DC that belongs to some other window if the original
6665 * window was already destroyed. */
6666 if (WindowFromDC(dc) != window)
6667 WARN("DC %p does not belong to window %p.\n", dc, window);
6668 else if (!ReleaseDC(window, dc))
6669 ERR("Failed to release device context %p, last error %#lx.\n", dc, GetLastError());
6670}
6671
6672BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other)
6673{
6674 RECT orig = *clipped;
6675 float scale_x = (float)(orig.right - orig.left) / (float)(other->right - other->left);
6676 float scale_y = (float)(orig.bottom - orig.top) / (float)(other->bottom - other->top);
6677
6678 IntersectRect(clipped, clipped, clip_rect);
6679
6680 if (IsRectEmpty(clipped))
6681 {
6683 return FALSE;
6684 }
6685
6686 other->left += (LONG)((clipped->left - orig.left) / scale_x);
6687 other->top += (LONG)((clipped->top - orig.top) / scale_y);
6688 other->right -= (LONG)((orig.right - clipped->right) / scale_x);
6689 other->bottom -= (LONG)((orig.bottom - clipped->bottom) / scale_y);
6690
6691 return TRUE;
6692}
6693
6695 enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
6696{
6697 unsigned int i;
6698
6699 *base = 0;
6700 for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
6701 {
6702 *count = gl_limits->uniform_blocks[i];
6703 if (i == shader_type)
6704 return;
6705 *base += *count;
6706 }
6707
6708 ERR("Unrecognized shader type %#x.\n", shader_type);
6709 *count = 0;
6710}
6711
6713 enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
6714{
6715 unsigned int i;
6716
6718 {
6719 if (gl_limits->combined_samplers == gl_limits->graphics_samplers)
6720 *base = 0;
6721 else
6722 *base = gl_limits->graphics_samplers;
6724 return;
6725 }
6726
6727 *base = 0;
6728 for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i)
6729 {
6730 *count = gl_limits->samplers[i];
6731 if (i == shader_type)
6732 return;
6733 *base += *count;
6734 }
6735
6736 ERR("Unrecognized shader type %#x.\n", shader_type);
6737 *count = 0;
6738}
6739
6741{
6742 SIZE_T max_capacity, new_capacity;
6743 void *new_elements;
6744
6745 if (count <= *capacity)
6746 return TRUE;
6747
6748 max_capacity = ~(SIZE_T)0 / size;
6749 if (count > max_capacity)
6750 return FALSE;
6751
6752 new_capacity = max(1, *capacity);
6753 while (new_capacity < count && new_capacity <= max_capacity / 2)
6754 new_capacity *= 2;
6755 if (new_capacity < count)
6756 new_capacity = count;
6757
6758 new_elements = _recalloc(*elements, new_capacity, size);
6759 if (!new_elements)
6760 return FALSE;
6761
6762 *elements = new_elements;
6763 *capacity = new_capacity;
6764 return TRUE;
6765}
6766
6767static void swap_rows(float **a, float **b)
6768{
6769 float *tmp = *a;
6770
6771 *a = *b;
6772 *b = tmp;
6773}
6774
6776{
6777 float wtmp[4][8];
6778 float m0, m1, m2, m3, s;
6779 float *r0, *r1, *r2, *r3;
6780
6781 r0 = wtmp[0];
6782 r1 = wtmp[1];
6783 r2 = wtmp[2];
6784 r3 = wtmp[3];
6785
6786 r0[0] = m->_11;
6787 r0[1] = m->_12;
6788 r0[2] = m->_13;
6789 r0[3] = m->_14;
6790 r0[4] = 1.0f;
6791 r0[5] = r0[6] = r0[7] = 0.0f;
6792
6793 r1[0] = m->_21;
6794 r1[1] = m->_22;
6795 r1[2] = m->_23;
6796 r1[3] = m->_24;
6797 r1[5] = 1.0f;
6798 r1[4] = r1[6] = r1[7] = 0.0f;
6799
6800 r2[0] = m->_31;
6801 r2[1] = m->_32;
6802 r2[2] = m->_33;
6803 r2[3] = m->_34;
6804 r2[6] = 1.0f;
6805 r2[4] = r2[5] = r2[7] = 0.0f;
6806
6807 r3[0] = m->_41;
6808 r3[1] = m->_42;
6809 r3[2] = m->_43;
6810 r3[3] = m->_44;
6811 r3[7] = 1.0f;
6812 r3[4] = r3[5] = r3[6] = 0.0f;
6813
6814 /* Choose pivot - or die. */
6815 if (fabsf(r3[0]) > fabsf(r2[0]))
6816 swap_rows(&r3, &r2);
6817 if (fabsf(r2[0]) > fabsf(r1[0]))
6818 swap_rows(&r2, &r1);
6819 if (fabsf(r1[0]) > fabsf(r0[0]))
6820 swap_rows(&r1, &r0);
6821 if (r0[0] == 0.0f)
6822 return FALSE;
6823
6824 /* Eliminate first variable. */
6825 m1 = r1[0] / r0[0]; m2 = r2[0] / r0[0]; m3 = r3[0] / r0[0];
6826 s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s;
6827 s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s;
6828 s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s;
6829 s = r0[4];
6830 if (s != 0.0f)
6831 {
6832 r1[4] -= m1 * s;
6833 r2[4] -= m2 * s;
6834 r3[4] -= m3 * s;
6835 }
6836 s = r0[5];
6837 if (s != 0.0f)
6838 {
6839 r1[5] -= m1 * s;
6840 r2[5] -= m2 * s;
6841 r3[5] -= m3 * s;
6842 }
6843 s = r0[6];
6844 if (s != 0.0f)
6845 {
6846 r1[6] -= m1 * s;
6847 r2[6] -= m2 * s;
6848 r3[6] -= m3 * s;
6849 }
6850 s = r0[7];
6851 if (s != 0.0f)
6852 {
6853 r1[7] -= m1 * s;
6854 r2[7] -= m2 * s;
6855 r3[7] -= m3 * s;
6856 }
6857
6858 /* Choose pivot - or die. */
6859 if (fabsf(r3[1]) > fabsf(r2[1]))
6860 swap_rows(&r3, &r2);
6861 if (fabsf(r2[1]) > fabsf(r1[1]))
6862 swap_rows(&r2, &r1);
6863 if (r1[1] == 0.0f)
6864 return FALSE;
6865
6866 /* Eliminate second variable. */
6867 m2 = r2[1] / r1[1]; m3 = r3[1] / r1[1];
6868 r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2];
6869 r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3];
6870 s = r1[4];
6871 if (s != 0.0f)
6872 {
6873 r2[4] -= m2 * s;
6874 r3[4] -= m3 * s;
6875 }
6876 s = r1[5];
6877 if (s != 0.0f)
6878 {
6879 r2[5] -= m2 * s;
6880 r3[5] -= m3 * s;
6881 }
6882 s = r1[6];
6883 if (s != 0.0f)
6884 {
6885 r2[6] -= m2 * s;
6886 r3[6] -= m3 * s;
6887 }
6888 s = r1[7];
6889 if (s != 0.0f)
6890 {
6891 r2[7] -= m2 * s;
6892 r3[7] -= m3 * s;
6893 }
6894
6895 /* Choose pivot - or die. */
6896 if (fabsf(r3[2]) > fabsf(r2[2]))
6897 swap_rows(&r3, &r2);
6898 if (r2[2] == 0.0f)
6899 return FALSE;
6900
6901 /* Eliminate third variable. */
6902 m3 = r3[2] / r2[2];
6903 r3[3] -= m3 * r2[3];
6904 r3[4] -= m3 * r2[4];
6905 r3[5] -= m3 * r2[5];
6906 r3[6] -= m3 * r2[6];
6907 r3[7] -= m3 * r2[7];
6908
6909 /* Last check. */
6910 if (r3[3] == 0.0f)
6911 return FALSE;
6912
6913 /* Back substitute row 3. */
6914 s = 1.0f / r3[3];
6915 r3[4] *= s;
6916 r3[5] *= s;
6917 r3[6] *= s;
6918 r3[7] *= s;
6919
6920 /* Back substitute row 2. */
6921 m2 = r2[3];
6922 s = 1.0f / r2[2];
6923 r2[4] = s * (r2[4] - r3[4] * m2);
6924 r2[5] = s * (r2[5] - r3[5] * m2);
6925 r2[6] = s * (r2[6] - r3[6] * m2);
6926 r2[7] = s * (r2[7] - r3[7] * m2);
6927 m1 = r1[3];
6928 r1[4] -= r3[4] * m1;
6929 r1[5] -= r3[5] * m1;
6930 r1[6] -= r3[6] * m1;
6931 r1[7] -= r3[7] * m1;
6932 m0 = r0[3];
6933 r0[4] -= r3[4] * m0;
6934 r0[5] -= r3[5] * m0;
6935 r0[6] -= r3[6] * m0;
6936 r0[7] -= r3[7] * m0;
6937
6938 /* Back substitute row 1. */
6939 m1 = r1[2];
6940 s = 1.0f / r1[1];
6941 r1[4] = s * (r1[4] - r2[4] * m1);
6942 r1[5] = s * (r1[5] - r2[5] * m1);
6943 r1[6] = s * (r1[6] - r2[6] * m1);
6944 r1[7] = s * (r1[7] - r2[7] * m1);
6945 m0 = r0[2];
6946 r0[4] -= r2[4] * m0;
6947 r0[5] -= r2[5] * m0;
6948 r0[6] -= r2[6] * m0;
6949 r0[7] -= r2[7] * m0;
6950
6951 /* Back substitute row 0. */
6952 m0 = r0[1];
6953 s = 1.0f / r0[0];
6954 r0[4] = s * (r0[4] - r1[4] * m0);
6955 r0[5] = s * (r0[5] - r1[5] * m0);
6956 r0[6] = s * (r0[6] - r1[6] * m0);
6957 r0[7] = s * (r0[7] - r1[7] * m0);
6958
6959 out->_11 = r0[4];
6960 out->_12 = r0[5];
6961 out->_13 = r0[6];
6962 out->_14 = r0[7];
6963 out->_21 = r1[4];
6964 out->_22 = r1[5];
6965 out->_23 = r1[6];
6966 out->_24 = r1[7];
6967 out->_31 = r2[4];
6968 out->_32 = r2[5];
6969 out->_33 = r2[6];
6970 out->_34 = r2[7];
6971 out->_41 = r3[4];
6972 out->_42 = r3[5];
6973 out->_43 = r3[6];
6974 out->_44 = r3[7];
6975
6976 return TRUE;
6977}
6978
6979/* Taken and adapted from Mesa. */
6981{
6982 float pos, neg, t, det;
6983 struct wined3d_matrix temp;
6984
6985 /* Calculate the determinant of upper left 3x3 submatrix and
6986 * determine if the matrix is singular. */
6987 pos = neg = 0.0f;
6988 t = in->_11 * in->_22 * in->_33;
6989 if (t >= 0.0f)
6990 pos += t;
6991 else
6992 neg += t;
6993
6994 t = in->_21 * in->_32 * in->_13;
6995 if (t >= 0.0f)
6996 pos += t;
6997 else
6998 neg += t;
6999 t = in->_31 * in->_12 * in->_23;
7000 if (t >= 0.0f)
7001 pos += t;
7002 else
7003 neg += t;
7004
7005 t = -in->_31 * in->_22 * in->_13;
7006 if (t >= 0.0f)
7007 pos += t;
7008 else
7009 neg += t;
7010 t = -in->_21 * in->_12 * in->_33;
7011 if (t >= 0.0f)
7012 pos += t;
7013 else
7014 neg += t;
7015
7016 t = -in->_11 * in->_32 * in->_23;
7017 if (t >= 0.0f)
7018 pos += t;
7019 else
7020 neg += t;
7021
7022 det = pos + neg;
7023
7024 if (fabsf(det) < 1e-25f)
7025 return FALSE;
7026
7027 det = 1.0f / det;
7028 temp._11 = (in->_22 * in->_33 - in->_32 * in->_23) * det;
7029 temp._12 = -(in->_12 * in->_33 - in->_32 * in->_13) * det;
7030 temp._13 = (in->_12 * in->_23 - in->_22 * in->_13) * det;
7031 temp._21 = -(in->_21 * in->_33 - in->_31 * in->_23) * det;
7032 temp._22 = (in->_11 * in->_33 - in->_31 * in->_13) * det;
7033 temp._23 = -(in->_11 * in->_23 - in->_21 * in->_13) * det;
7034 temp._31 = (in->_21 * in->_32 - in->_31 * in->_22) * det;
7035 temp._32 = -(in->_11 * in->_32 - in->_31 * in->_12) * det;
7036 temp._33 = (in->_11 * in->_22 - in->_21 * in->_12) * det;
7037
7038 *out = temp;
7039 return TRUE;
7040}
7041
7042void compute_normal_matrix(struct wined3d_matrix *normal_matrix, BOOL legacy_lighting,
7043 const struct wined3d_matrix *modelview)
7044{
7045 struct wined3d_matrix mv;
7046
7047 mv = *modelview;
7048 if (legacy_lighting)
7049 invert_matrix_3d(&mv, &mv);
7050 else
7051 invert_matrix(&mv, &mv);
7052 /* Tests show that singular modelview matrices are used unchanged as normal
7053 * matrices on D3D3 and older. There seems to be no clearly consistent
7054 * behavior on newer D3D versions so always follow older ddraw behavior. */
7055
7056 normal_matrix->_11 = mv._11;
7057 normal_matrix->_12 = mv._21;
7058 normal_matrix->_13 = mv._31;
7059 normal_matrix->_21 = mv._12;
7060 normal_matrix->_22 = mv._22;
7061 normal_matrix->_23 = mv._32;
7062 normal_matrix->_31 = mv._13;
7063 normal_matrix->_32 = mv._23;
7064 normal_matrix->_33 = mv._33;
7065}
7066
7069{
7070 block->parent = allocator->free;
7071 allocator->free = block;
7072}
7073
7075{
7077
7078 if (!allocator->free)
7079 return malloc(sizeof(*block));
7080
7081 block = allocator->free;
7082 allocator->free = block->parent;
7083
7084 return block;
7085}
7086
7088{
7089 struct wined3d_allocator *allocator = block->chunk->allocator;
7091
7092 while ((parent = block->parent) && block->sibling->free)
7093 {
7094 list_remove(&block->sibling->entry);
7097 block = parent;
7098 }
7099
7100 block->free = true;
7101 list_add_head(&block->chunk->available[block->order], &block->entry);
7102}
7103
7106 struct wined3d_allocator_block *sibling, unsigned int order, size_t offset, bool free)
7107{
7108 list_init(&block->entry);
7109 block->chunk = chunk;
7110 block->parent = parent;
7111 block->sibling = sibling;
7112 block->order = order;
7113 block->offset = offset;
7114 block->free = free;
7115}
7116
7118{
7120 size_t i;
7121
7122 if (list_empty(&chunk->available[0]))
7123 {
7124 ERR("Chunk %p is not empty.\n", chunk);
7125 return;
7126 }
7127
7128 for (i = 1; i < ARRAY_SIZE(chunk->available); ++i)
7129 {
7130 if (!list_empty(&chunk->available[i]))
7131 {
7132 ERR("Chunk %p is not empty.\n", chunk);
7133 return;
7134 }
7135 }
7136
7137 block = LIST_ENTRY(list_head(&chunk->available[0]), struct wined3d_allocator_block, entry);
7139}
7140
7142{
7144 unsigned int i;
7145
7147 return false;
7149
7150 list_init(&chunk->entry);
7151 for (i = 0; i < ARRAY_SIZE(chunk->available); ++i)
7152 {
7153 list_init(&chunk->available[i]);
7154 }
7155 list_add_head(&chunk->available[0], &block->entry);
7156 chunk->allocator = allocator;
7157 chunk->map_count = 0;
7158 chunk->map_ptr = NULL;
7159
7160 return true;
7161}
7162
7164{
7165 struct wined3d_allocator_chunk *chunk, *chunk2;
7167 size_t i;
7168
7169 for (i = 0; i < allocator->pool_count; ++i)
7170 {
7171 LIST_FOR_EACH_ENTRY_SAFE(chunk, chunk2, &allocator->pools[i].chunks, struct wined3d_allocator_chunk, entry)
7172 {
7173 list_remove(&chunk->entry);
7174 allocator->ops->allocator_destroy_chunk(chunk);
7175 }
7176 }
7177 free(allocator->pools);
7178
7179 next = allocator->free;
7180 while ((block = next))
7181 {
7182 next = block->parent;
7183 free(block);
7184 }
7185}
7186
7188 unsigned int order)
7189{
7191 unsigned int i = order;
7192
7193 while (i)
7194 {
7195 if (!list_empty(&chunk->available[i]))
7196 break;
7197 --i;
7198 }
7199
7200 if (list_empty(&chunk->available[i]))
7201 return NULL;
7202
7203 block = LIST_ENTRY(list_head(&chunk->available[i]), struct wined3d_allocator_block, entry);
7204 list_remove(&block->entry);
7205 block->free = false;
7206
7207 while (i < order)
7208 {
7209 if (!(left = wined3d_allocator_acquire_block(chunk->allocator)))
7210 {
7211 ERR("Failed to allocate left.\n");
7212 break;
7213 }
7214
7215 if (!(right = wined3d_allocator_acquire_block(chunk->allocator)))
7216 {
7217 ERR("Failed to allocate right.\n");
7219 break;
7220 }
7221
7222 wined3d_allocator_block_init(left, chunk, block, right, block->order + 1, block->offset, false);
7224 block->offset + (WINED3D_ALLOCATOR_CHUNK_SIZE >> left->order), true);
7225 list_add_head(&chunk->available[right->order], &right->entry);
7226
7227 block = left;
7228 ++i;
7229 }
7230
7231 return block;
7232}
7233
7235 struct wined3d_context *context, unsigned int memory_type, size_t size)
7236{
7239 unsigned int order;
7240
7242 return NULL;
7243
7246 else
7248
7249 LIST_FOR_EACH_ENTRY(chunk, &allocator->pools[memory_type].chunks, struct wined3d_allocator_chunk, entry)
7250 {
7252 return block;
7253 }
7254
7255 if (!(chunk = allocator->ops->allocator_create_chunk(allocator,
7256 context, memory_type, WINED3D_ALLOCATOR_CHUNK_SIZE)))
7257 return NULL;
7258
7260 return NULL;
7261
7262 return block;
7263}
7264
7266 size_t pool_count, const struct wined3d_allocator_ops *allocator_ops)
7267{
7268 size_t i;
7269
7270 allocator->ops = allocator_ops;
7271 allocator->pool_count = pool_count;
7272 if (!(allocator->pools = calloc(pool_count, sizeof(*allocator->pools))))
7273 return false;
7274 for (i = 0; i < pool_count; ++i)
7275 {
7276 list_init(&allocator->pools[i].chunks);
7277 }
7278
7279 allocator->free = NULL;
7280
7281 return true;
7282}
struct mke2fs_defaults settings[]
ios_base &_STLP_CALL internal(ios_base &__s)
Definition: _ios_base.h:311
#define isprint(c)
Definition: acclib.h:73
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
Definition: align.cpp:48
static int state
Definition: maze.c:121
unsigned int channels
Definition: audiorecord.c:89
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static struct stream g_out[STREAM_COUNT]
Definition: tcp.c:74
static struct stream g_in
Definition: tcp.c:73
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define HW_VENDOR_NVIDIA
Definition: builtin.c:4465
HDC dc
Definition: cylfrac.c:34
static const D2D1_CREATION_PROPERTIES * properties
Definition: d2d1.c:299
static float(WINAPI *pD2D1Tan)(float angle)
unsigned int component_count
unsigned short float_32_to_16(const float in)
Definition: math.c:2102
const WCHAR * vendor
Definition: db.cpp:873
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
device_type
attach_type
Definition: opentype.c:507
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT32 uint32_t
Definition: types.h:75
UINT64 uint64_t
Definition: types.h:77
UINT op
Definition: effect.c:235
void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
Definition: utils.c:1153
static void format_clear_caps(struct wined3d_format *format, unsigned int caps)
Definition: utils.c:2009
struct wined3d_allocator_block * wined3d_allocator_allocate(struct wined3d_allocator *allocator, struct wined3d_context *context, unsigned int memory_type, size_t size)
Definition: utils.c:7234
static float color_to_float(DWORD color, DWORD size, DWORD offset)
Definition: utils.c:5984
const char * debug_d3dusage(uint32_t usage)
Definition: utils.c:4895
static void convert_l4a4_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:774
#define ACCESS_TO_STR(x)
bool wined3d_allocator_init(struct wined3d_allocator *allocator, size_t pool_count, const struct wined3d_allocator_ops *allocator_ops)
Definition: utils.c:7265
#define FMT_TO_STR(format_id)
static GLenum wined3d_gl_type_to_enum(enum wined3d_gl_resource_type type)
Definition: utils.c:2226
void wined3d_allocator_cleanup(struct wined3d_allocator *allocator)
Definition: utils.c:7163
BOOL wined3d_get_primary_adapter_luid(LUID *luid)
Definition: utils.c:5761
#define WINED3D_FORMAT_COUNT
Definition: utils.c:70
static struct wined3d_format * get_format_by_idx(const struct wined3d_adapter *adapter, int fmt_idx)
Definition: utils.c:1958
void wined3d_release_dc(HWND window, HDC dc)
Definition: utils.c:6658
#define ARG2
const char * wined3d_debug_bind_flags(uint32_t bind_flags)
Definition: utils.c:4845
static void convert_r16g16(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:1053
static void convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_color_key *color_key)
Definition: utils.c:1204
static void copy_format(const struct wined3d_adapter *adapter, struct wined3d_format *dst_format, const struct wined3d_format *src_format)
Definition: utils.c:1993
static void x8_d24_unorm_download(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:1151
const char * debug_d3ddevicetype(enum wined3d_device_type device_type)
Definition: utils.c:4781
static void convert_b5g6r5_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_color_key *color_key)
Definition: utils.c:1181
static void convert_r5g5_snorm_l6_unorm_nv(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:873
const char * debug_box(const struct wined3d_box *box)
Definition: utils.c:4552
BOOL wined3d_adapter_no3d_init_format_info(struct wined3d_adapter *adapter)
Definition: utils.c:4135
#define WINED3D_TO_STR(x)
static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3160
const struct ffp_frag_desc * find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders, const struct ffp_frag_settings *settings)
Definition: utils.c:6419
const char * debug_ivec4(const struct wined3d_ivec4 *v)
Definition: utils.c:4569
enum wined3d_format_id wined3d_get_typed_format_id(const struct wined3d_adapter *adapter, const struct wined3d_format *format, enum wined3d_channel_type channel_type)
Definition: utils.c:4460
void get_modelview_matrix(const struct wined3d_stateblock_state *state, unsigned int index, struct wined3d_matrix *mat)
Definition: utils.c:5588
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:4605
static const struct wined3d_typeless_format_depth_stencil_info typeless_depth_stencil_formats[]
Definition: utils.c:280
void get_fog_start_end(const struct wined3d_context *context, const struct wined3d_state *state, float *start, float *end)
Definition: utils.c:5703
void compute_normal_matrix(struct wined3d_matrix *normal_matrix, BOOL legacy_lighting, const struct wined3d_matrix *modelview)
Definition: utils.c:7042
static void build_bc3_alpha_table(BYTE alpha0, BYTE alpha1, BYTE alpha_table[8])
Definition: utils.c:413
uint32_t wined3d_format_pack(const struct wined3d_format *format, const struct wined3d_uvec4 *value)
Definition: utils.c:5778
static void convert_s8_uint_d24_float(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:1107
const char * wined3d_debug_feature_level(enum wined3d_feature_level level)
Definition: utils.c:6619
static void convert_b8g8r8a8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_color_key *color_key)
Definition: utils.c:1271
const char * debug_d3dtexturestate(enum wined3d_texture_stage_state state)
Definition: utils.c:5214
const char * debug_d3dinput_classification(enum wined3d_input_classification classification)
Definition: utils.c:4978
BOOL is_invalid_op(const struct wined3d_state *state, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3)
Definition: utils.c:5554
static const char * debug_fixup_channel_source(enum fixup_channel_source source)
Definition: utils.c:5502
static const struct wined3d_typed_format_info typed_formats[]
Definition: utils.c:196
static struct wined3d_format_gl * get_format_gl_internal(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id)
Definition: utils.c:1982
static int get_format_idx(enum wined3d_format_id format_id)
Definition: utils.c:1932
void wined3d_gl_limits_get_texture_unit_range(const struct wined3d_gl_limits *gl_limits, enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
Definition: utils.c:6712
#define WINED3DDECLUSAGE_TO_STR(u)
#define D3DSTATE_TO_STR(u)
static GLenum lookup_gl_view_class(GLenum internal_format)
Definition: utils.c:2929
static void query_internal_format(struct wined3d_adapter *adapter, struct wined3d_format_gl *format, const struct wined3d_format_texture_info *texture_info, struct wined3d_gl_info *gl_info, BOOL srgb_format)
Definition: utils.c:3060
void wined3d_ffp_get_fs_settings(const struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info, struct ffp_frag_settings *settings)
Definition: utils.c:6141
const char * debug_d3dsamplerstate(enum wined3d_sampler_state state)
Definition: utils.c:5169
static void init_debug_buffer(struct debug_buffer *buffer, const char *default_string)
Definition: utils.c:4803
BOOL invert_matrix(struct wined3d_matrix *out, const struct wined3d_matrix *m)
Definition: utils.c:6775
static void build_dxtn_colour_table(WORD colour0, WORD colour1, DWORD colour_table[4], enum wined3d_format_id format_id)
Definition: utils.c:375
static void convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_color_key *color_key)
Definition: utils.c:1248
static BOOL init_format_block_info(struct wined3d_adapter *adapter)
Definition: utils.c:2161
enum wined3d_format_id id
Definition: utils.c:39
const char * wined3d_debug_location(uint32_t location)
Definition: utils.c:6588
static const struct wined3d_format_decompress_info format_decompress_info[]
static void format_set_caps(struct wined3d_format *format, unsigned int caps)
Definition: utils.c:2001
UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT alignment, UINT width, UINT height, UINT depth)
Definition: utils.c:4519
BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:4177
BOOL wined3d_adapter_vk_init_format_info(struct wined3d_adapter_vk *adapter_vk, const struct wined3d_vk_info *vk_info)
Definition: utils.c:4399
static void build_rgtc_colour_table(uint8_t red0, uint8_t red1, uint8_t colour_table[8])
Definition: utils.c:566
static void query_format_cap(struct wined3d_gl_info *gl_info, struct wined3d_format_gl *format, GLint internal, GLenum pname, unsigned int cap, const char *string)
Definition: utils.c:2765
unsigned int idx
Definition: utils.c:40
static struct wined3d_format * get_format_internal(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id)
Definition: utils.c:1968
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
Definition: utils.c:3258
const char * wined3d_debug_resource_access(uint32_t access)
Definition: utils.c:4828
const char * debug_const_bo_address(const struct wined3d_const_bo_address *address)
Definition: utils.c:4593
static BOOL init_typeless_formats(const struct wined3d_adapter *adapter)
Definition: utils.c:3764
static void swap_rows(float **a, float **b)
Definition: utils.c:6767
static void decompress_dxtn(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth, enum wined3d_format_id format_id)
Definition: utils.c:510
const char * debug_shader_type(enum wined3d_shader_type type)
Definition: utils.c:5313
const char * debug_vec4(const struct wined3d_vec4 *v)
Definition: utils.c:4585
BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:3849
BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other)
Definition: utils.c:6672
const char * debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type)
Definition: utils.c:5009
void get_identity_matrix(struct wined3d_matrix *mat)
Definition: utils.c:5575
static void convert_r16g16_snorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:1028
static BOOL init_format_vertex_info(const struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3735
static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3492
const char * debug_d3dtstype(enum wined3d_transform_state tstype)
Definition: utils.c:5282
static const struct wined3d_format_texture_info format_texture_info[]
Definition: utils.c:1353
static void query_view_class(struct wined3d_format_gl *format)
Definition: utils.c:3040
#define PRIM_TO_STR(prim)
const char * wined3d_debug_vkresult(VkResult vr)
Definition: utils.c:5463
void wined3d_format_convert_from_float(const struct wined3d_format *format, const struct wined3d_color *color, void *ret)
Definition: utils.c:5817
static void decompress_bc2(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:550
#define ARG1
static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_format_gl *format)
Definition: utils.c:2494
const char * debug_uvec4(const struct wined3d_uvec4 *v)
Definition: utils.c:4577
static void init_vulkan_format_info(struct wined3d_format_vk *format, const struct wined3d_vk_info *vk_info, VkPhysicalDevice vk_physical_device)
Definition: utils.c:4203
#define LOCATION_TO_STR(x)
void get_texture_matrix(const struct wined3d_stateblock_state *state, const unsigned int tex, struct wined3d_matrix *mat)
Definition: utils.c:5671
static struct wined3d_allocator_block * wined3d_allocator_acquire_block(struct wined3d_allocator *allocator)
Definition: utils.c:7074
static float wined3d_adapter_find_polyoffset_scale(struct wined3d_caps_gl_ctx *ctx, GLenum format)
Definition: utils.c:3990
const char * debug_d3dstate(uint32_t state)
Definition: utils.c:5331
static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
Definition: utils.c:3274
static struct wined3d_format_vk * wined3d_format_vk_mutable(struct wined3d_format *format)
Definition: utils.c:1953
static void decompress_bc3(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:542
void wined3d_ftoa(float value, char *s)
Definition: utils.c:6643
int wined3d_ffp_frag_program_key_compare(const void *key, const struct wine_rb_entry *entry)
Definition: utils.c:6436
#define VIEW_FLAG_TO_STR(x)
bool wined3d_allocator_chunk_init(struct wined3d_allocator_chunk *chunk, struct wined3d_allocator *allocator)
Definition: utils.c:7141
static enum fixup_channel_source fixup_source_from_char(char c)
Definition: utils.c:3439
static void convert_r5g5_snorm_l6_unorm_ext(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:834
static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:2788
void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state, float *out_min, float *out_max)
Definition: utils.c:5684
const char * debug_d3ddeclmethod(enum wined3d_decl_method method)
Definition: utils.c:4933
#define BIND_FLAG_TO_STR(x)
static struct wined3d_format_gl * get_format_gl_by_idx(const struct wined3d_adapter *adapter, int fmt_idx)
Definition: utils.c:1963
const char * debug_d3dresourcetype(enum wined3d_resource_type resource_type)
Definition: utils.c:4992
#define D3DTEXTUREFILTERTYPE_TO_STR(u)
const char * debug_d3drenderstate(enum wined3d_render_state state)
Definition: utils.c:5033
static BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, size_t format_size)
Definition: utils.c:4107
static void convert_r8g8_snorm_l8x8_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:944
static BOOL init_format_decompress_info(struct wined3d_adapter *adapter)
Definition: utils.c:2191
void wined3d_format_copy_data(const struct wined3d_format *format, const uint8_t *src, unsigned int src_row_pitch, unsigned int src_slice_pitch, uint8_t *dst, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int w, unsigned int h, unsigned int d)
Definition: utils.c:6080
static BOOL color_in_range(const struct wined3d_color_key *color_key, DWORD color)
Definition: utils.c:1173
static void decompress_bc4(const uint8_t *src, uint8_t *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:618
static void convert_r5g5_snorm_l6_unorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:802
static void convert_r32g32_float(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:1081
static const char * debug_complex_fixup(enum complex_fixup fixup)
Definition: utils.c:5522
static BOOL wined3d_get_primary_display(WCHAR *display)
Definition: utils.c:5743
const struct wined3d_format * wined3d_get_format(const struct wined3d_adapter *adapter, enum wined3d_format_id format_id, unsigned int bind_flags)
Definition: utils.c:4428
BOOL wined3d_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
Definition: utils.c:6740
const char * debug_bo_address(const struct wined3d_bo_address *address)
Definition: utils.c:4600
static void convert_r8g8b8a8_snorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:1002
static struct color_fixup_desc create_color_fixup_desc_from_string(const char *s)
Definition: utils.c:3470
static struct wined3d_format_gl * wined3d_format_gl_mutable(struct wined3d_format *format)
Definition: utils.c:1948
const char * debug_d3dtop(enum wined3d_texture_op d3dtop)
Definition: utils.c:5244
static const struct wined3d_format_ddi_info ddi_formats[]
Definition: utils.c:296
static void convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch, BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height, const struct wined3d_color_key *color_key)
Definition: utils.c:1227
#define ARG0
const struct wined3d_color_key_conversion * wined3d_format_get_color_key_conversion(const struct wined3d_texture *texture, BOOL need_alpha_ck)
Definition: utils.c:1293
void wined3d_allocator_chunk_cleanup(struct wined3d_allocator_chunk *chunk)
Definition: utils.c:7117
static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b)
Definition: utils.c:361
const char * debug_d3dtexturefiltertype(enum wined3d_texture_filter_type filter_type)
Definition: utils.c:5194
BOOL wined3d_formats_are_srgb_variants(enum wined3d_format_id format1, enum wined3d_format_id format2)
Definition: utils.c:4535
#define WINED3D_FORMAT_FOURCC_BASE
Definition: utils.c:35
static BOOL invert_matrix_3d(struct wined3d_matrix *out, const struct wined3d_matrix *in)
Definition: utils.c:6980
static void init_format_gen_mipmap_info(const struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3831
static const struct wined3d_format_channels formats[]
Definition: utils.c:82
static const struct @343 format_index_remap[]
static const struct wined3d_format_srgb_info format_srgb_info[]
Definition: utils.c:1921
static enum wined3d_channel_type map_channel_type(char t)
Definition: utils.c:2017
const char * debug_fboattachment(GLenum attachment)
Definition: utils.c:5394
bool wined3d_caps_gl_ctx_test_filling_convention(struct wined3d_caps_gl_ctx *ctx, float offset)
Definition: utils.c:3896
static void init_format_depth_bias_scale(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
Definition: utils.c:4078
static const struct wined3d_format_block_info format_block_info[]
Definition: utils.c:673
static void decompress_dxtn_block(const BYTE *src, BYTE *dst, unsigned int width, unsigned int height, unsigned int dst_row_pitch, enum wined3d_format_id format_id)
Definition: utils.c:439
static void decompress_bc1(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:558
const char * debug_d3ddeclusage(enum wined3d_decl_usage usage)
Definition: utils.c:4952
const char * debug_glerror(GLenum error)
Definition: utils.c:5445
#define WINED3DDECLMETHOD_TO_STR(u)
void wined3d_format_calculate_pitch(const struct wined3d_format *format, unsigned int alignment, unsigned int width, unsigned int height, unsigned int *row_pitch, unsigned int *slice_pitch)
Definition: utils.c:4489
static BOOL init_format_base_info(struct wined3d_adapter *adapter)
Definition: utils.c:2079
static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix)
Definition: utils.c:5594
static BOOL init_srgb_formats(struct wined3d_adapter *adapter)
Definition: utils.c:2208
const char * wined3d_debug_view_desc(const struct wined3d_view_desc *d, const struct wined3d_resource *resource)
Definition: utils.c:4867
void wined3d_format_get_float_color_key(const struct wined3d_format *format, const struct wined3d_color_key *key, struct wined3d_color *float_colors)
Definition: utils.c:5997
static void debug_append(struct debug_buffer *buffer, const char *str, const char *separator)
Definition: utils.c:4810
static void wined3d_allocator_release_block(struct wined3d_allocator *allocator, struct wined3d_allocator_block *block)
Definition: utils.c:7067
static void x8_d24_unorm_upload(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:1129
static void convert_r8g8_snorm(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:919
void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits *gl_limits, enum wined3d_shader_type shader_type, unsigned int *base, unsigned int *count)
Definition: utils.c:6694
BOOL wined3d_format_is_depth_view(enum wined3d_format_id resource_format_id, enum wined3d_format_id view_format_id)
Definition: utils.c:4476
static unsigned int fixup_sign_from_char(char c)
Definition: utils.c:3463
void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc)
Definition: utils.c:6426
static void delete_fbo_attachment(const struct wined3d_gl_info *gl_info, enum wined3d_gl_resource_type d3d_type, GLuint object)
Definition: utils.c:2249
static const struct wined3d_format_base_flags format_base_flags[]
Definition: utils.c:319
#define GLERROR_TO_STR(u)
static void draw_test_quad(struct wined3d_caps_gl_ctx *ctx, const struct wined3d_vec3 *geometry, const struct wined3d_color *color)
Definition: utils.c:2371
#define LEVEL_TO_STR(level)
void wined3d_allocator_block_free(struct wined3d_allocator_block *block)
Definition: utils.c:7087
void wined3d_format_colour_to_vk(const struct wined3d_format *format, const struct wined3d_color *c, VkClearColorValue *retval)
Definition: utils.c:5790
static struct wined3d_allocator_block * wined3d_allocator_chunk_allocate(struct wined3d_allocator_chunk *chunk, unsigned int order)
Definition: utils.c:7187
#define D3DTOP_TO_STR(u)
#define TSTYPE_TO_STR(tstype)
enum wined3d_format_id pixelformat_for_depth(DWORD depth)
Definition: utils.c:6067
static enum wined3d_format_id get_texcoord_format(const struct wined3d_vertex_declaration *decl, unsigned int index)
Definition: utils.c:5659
static void convert_r8g8_snorm_l8x8_unorm_nv(const BYTE *src, BYTE *dst, UINT src_row_pitch, UINT src_slice_pitch, UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
Definition: utils.c:973
#define FBOSTATUS_TO_STR(u)
static void create_and_bind_fbo_attachment(const struct wined3d_gl_info *gl_info, const struct wined3d_format_gl *format_gl, enum wined3d_gl_resource_type d3d_type, GLuint *object, GLenum internal)
Definition: utils.c:2271
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:4561
void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct wined3d_stream_info *si, const struct wined3d_d3d_info *d3d_info, struct wined3d_ffp_vs_settings *settings)
Definition: utils.c:6444
#define DEVTYPE_TO_STR(dev)
const char * debug_fbostatus(GLenum status)
Definition: utils.c:5423
int wined3d_ffp_vertex_program_key_compare(const void *key, const struct wine_rb_entry *entry)
Definition: utils.c:6579
static const struct wined3d_format_vertex_info format_vertex_info[]
Definition: utils.c:705
static BOOL compare_colour(DWORD c1, DWORD c2, BYTE max_diff)
Definition: utils.c:3265
static void wined3d_allocator_block_init(struct wined3d_allocator_block *block, struct wined3d_allocator_chunk *chunk, struct wined3d_allocator_block *parent, struct wined3d_allocator_block *sibling, unsigned int order, size_t offset, bool free)
Definition: utils.c:7104
static void parse_channel_desc(struct wined3d_format *format, const char *channel_desc)
Definition: utils.c:2043
static void decompress_rgtc_block(const uint8_t *src, uint8_t *dst, unsigned int width, unsigned int height, unsigned int dst_row_pitch)
Definition: utils.c:590
#define WINED3DUSAGE_TO_STR(x)
void dump_color_fixup_desc(struct color_fixup_desc fixup)
Definition: utils.c:5540
static void init_format_filter_info(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info)
Definition: utils.c:3373
void format_size(uint64_t size, wstring &s, bool show_bytes)
Definition: main.cpp:65
#define CHAR_BIT
Definition: cabinet.h:45
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
#define lstrcpyW
Definition: compat.h:749
static const WCHAR separator[]
Definition: asmname.c:65
_ACRTIMP void *__cdecl _recalloc(void *, size_t, size_t) __WINE_ALLOC_SIZE(2
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
#define isfinite(x)
Definition: math.h:363
#define copysignf(x, y)
Definition: math.h:254
#define INFINITY
Definition: math.h:272
_ACRTIMP float __cdecl fabsf(float)
unsigned short uint16_t
Definition: stdint.h:35
unsigned char uint8_t
Definition: stdint.h:33
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
unsigned char
Definition: typeof.h:29
method
Definition: dragdrop.c:54
return ret
Definition: mutex.c:147
r parent
Definition: btrfs.c:3010
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
return adapter
FxCollectionEntry * cur
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_NONE
Definition: gl.h:465
GLuint start
Definition: gl.h:1545
#define GL_SAMPLES
Definition: gl.h:1816
#define GL_R3_G3_B2
Definition: gl.h:752
#define GL_INT
Definition: gl.h:181
#define GL_TEXTURE_MIN_FILTER
Definition: gl.h:649
#define GL_TEXTURE_WRAP_R
Definition: gl.h:1518
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define GL_ALPHA8
Definition: gl.h:734
#define GL_TEXTURE_WRAP_S
Definition: gl.h:646
GLint level
Definition: gl.h:1546
#define GL_UNSIGNED_SHORT_4_4_4_4_REV
Definition: gl.h:1491
#define GL_RGBA8
Definition: gl.h:762
GLclampf green
Definition: gl.h:1740
#define GL_BGR
Definition: gl.h:1484
#define GL_UNSIGNED_SHORT
Definition: gl.h:180
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define GL_RGB16
Definition: gl.h:758
#define GL_LUMINANCE8
Definition: gl.h:738
#define GL_POLYGON_OFFSET_FILL
Definition: gl.h:283
#define GL_LUMINANCE_ALPHA
Definition: gl.h:485
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define GL_RGB5
Definition: gl.h:754
#define GL_TEXTURE_MAX_LEVEL
Definition: gl.h:1504
#define GL_DEPTH_TEST
Definition: gl.h:301
#define GL_LINEAR
Definition: gl.h:421
#define GL_LUMINANCE4_ALPHA4
Definition: gl.h:741
#define GL_SRC_ALPHA
Definition: gl.h:378
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GL_INVALID_OPERATION
Definition: gl.h:696
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
#define GL_BGRA
Definition: gl.h:1485
#define GL_RGB5_A1
Definition: gl.h:761
unsigned int GLenum
Definition: gl.h:150
#define GL_RGB8
Definition: gl.h:755
#define GL_LUMINANCE
Definition: gl.h:484
GLdouble s
Definition: gl.h:2039
#define GL_RGB4
Definition: gl.h:753
#define GL_BYTE
Definition: gl.h:177
#define GL_STACK_OVERFLOW
Definition: gl.h:697
unsigned int GLuint
Definition: gl.h:159
#define GL_UNSIGNED_INT
Definition: gl.h:182
#define GL_RGB
Definition: gl.h:502
#define GL_TEXTURE_3D
Definition: gl.h:1515
#define GL_FLOAT
Definition: gl.h:183
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define GL_SHORT
Definition: gl.h:179
GLAPI void GLAPIENTRY glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
#define GL_RED
Definition: gl.h:480
#define GL_NEAREST
Definition: gl.h:678
#define GL_UNSIGNED_BYTE
Definition: gl.h:178
#define GL_PROJECTION
Definition: gl.h:246
#define GL_NO_ERROR
Definition: gl.h:693
#define GL_MODELVIEW
Definition: gl.h:245
GLuint GLuint end
Definition: gl.h:1545
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define GL_RGB10_A2
Definition: gl.h:763
#define GL_RGBA
Definition: gl.h:503
#define GL_BLEND
Definition: gl.h:371
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define GL_ONE_MINUS_SRC_ALPHA
Definition: gl.h:379
#define GL_LUMINANCE8_ALPHA8
Definition: gl.h:743
#define GL_DEPTH_COMPONENT
Definition: gl.h:307
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLclampf GLclampf blue
Definition: gl.h:1740
#define GL_UNSIGNED_INT_8_8_8_8
Definition: gl.h:1494
#define GL_TEXTURE_WRAP_T
Definition: gl.h:647
#define GL_TEXTURE_MAG_FILTER
Definition: gl.h:648
GLdouble GLdouble t
Definition: gl.h:2047
int GLint
Definition: gl.h:156
#define GL_ALPHA
Definition: gl.h:483
#define GL_LUMINANCE16
Definition: gl.h:740
#define GL_OUT_OF_MEMORY
Definition: gl.h:699
#define GL_TRIANGLE_STRIP
Definition: gl.h:195
GLint GLint GLsizei width
Definition: gl.h:1546
#define GL_TEXTURE_2D
Definition: gl.h:645
#define GL_UNSIGNED_BYTE_3_3_2
Definition: gl.h:1486
#define GL_RGBA16
Definition: gl.h:765
#define GL_UNSIGNED_SHORT_1_5_5_5_REV
Definition: gl.h:1493
#define GL_TEXTURE_1D
Definition: gl.h:644
#define GL_CLAMP_TO_EDGE
Definition: gl.h:1481
#define GL_UNSIGNED_INT_8_8_8_8_REV
Definition: gl.h:1495
#define GL_UNSIGNED_SHORT_5_6_5
Definition: gl.h:1488
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710
#define GL_UNSIGNED_INT_2_10_10_10_REV
Definition: gl.h:1497
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_STACK_UNDERFLOW
Definition: gl.h:698
#define GL_RGBA4
Definition: gl.h:760
#define GL_LIGHTING
Definition: gl.h:310
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
Definition: glext.h:1747
#define GL_RGB10_A2UI
Definition: glext.h:2024
#define GL_R32UI
Definition: glext.h:1832
#define GL_RG16I
Definition: glext.h:1835
#define GL_DEPTH32F_STENCIL8
Definition: glext.h:1664
#define GL_NUM_SAMPLE_COUNTS
Definition: glext.h:2289
GLenum GLuint texture
Definition: glext.h:6295
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
Definition: glext.h:1237
#define GL_R16UI
Definition: glext.h:1830
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
Definition: glext.h:1998
#define GL_COLOR_ATTACHMENT5
Definition: glext.h:1719
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB
Definition: glext.h:1770
#define GL_FRAGMENT_SHADER
Definition: glext.h:419
#define GL_DEPTH_COMPONENT32F
Definition: glext.h:1663
#define GL_RGBA16F_ARB
Definition: glext.h:1647
#define GL_RGB8_SNORM
Definition: glext.h:763
#define GL_FRAMEBUFFER_UNDEFINED
Definition: glext.h:1682
#define GL_SIGNED_HILO16_NV
Definition: glext.h:3714
#define GL_DEPTH24_STENCIL8
Definition: glext.h:1687
#define GL_DEPTH_COMPONENT16
Definition: glext.h:290
#define GL_R16
Definition: glext.h:1820
#define GL_UNSIGNED_INT_10F_11F_11F_REV
Definition: glext.h:540
GLuint address
Definition: glext.h:9393
#define GL_R8_SNORM
Definition: glext.h:761
#define GL_COMPRESSED_RED_RGTC1
Definition: glext.h:1810
#define GL_RGB32F_ARB
Definition: glext.h:1642
GLenum src
Definition: glext.h:6340
#define GL_RG16
Definition: glext.h:1822
#define GL_SRGB8_EXT
Definition: glext.h:4500
#define GL_RGB8UI
Definition: glext.h:564
#define GL_COLOR_ATTACHMENT13
Definition: glext.h:1727
#define GL_R8
Definition: glext.h:1819
#define GL_RG16_SNORM
Definition: glext.h:766
#define GL_RG32F
Definition: glext.h:1826
#define GL_COMPRESSED_RG_RGTC2
Definition: glext.h:1812
#define GL_RG32UI
Definition: glext.h:1838
#define GL_RGB16_SNORM
Definition: glext.h:767
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
#define GL_RGBA16F
Definition: glext.h:524
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
Definition: glext.h:4514
GLintptr offset
Definition: glext.h:5920
#define GL_RGBA32UI
Definition: glext.h:559
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
Definition: glext.h:1996
#define GL_RGBA32F_ARB
Definition: glext.h:1641
GLuint color
Definition: glext.h:6243
#define GL_DSDT8_NV
Definition: glext.h:3727
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
Definition: glext.h:4442
#define GL_COLOR_ATTACHMENT7
Definition: glext.h:1721
#define GL_RGB16I
Definition: glext.h:568
#define GL_DSDT_MAG_VIB_NV
Definition: glext.h:3711
#define GL_RED_INTEGER
Definition: glext.h:571
#define GL_RG8
Definition: glext.h:1821
#define GL_RGB16F
Definition: glext.h:525
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
Definition: glext.h:1708
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
Definition: glext.h:1232
#define GL_UNSIGNED_SHORT_8_8_APPLE
Definition: glext.h:4249
#define GL_R16I
Definition: glext.h:1829
#define GL_R8I
Definition: glext.h:1827
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
#define GL_COLOR_ATTACHMENT9
Definition: glext.h:1723
const GLubyte * c
Definition: glext.h:8905
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
Definition: glext.h:1234
#define GL_COLOR_ATTACHMENT0
Definition: glext.h:1714
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
Definition: glext.h:9515
#define GL_R8UI
Definition: glext.h:1828
GLuint index
Definition: glext.h:6031
GLenum GLint GLuint mask
Definition: glext.h:6028
#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV
Definition: glext.h:1665
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
GLenum pname
Definition: glext.h:5645
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
Definition: glext.h:3492
GLdouble GLdouble right
Definition: glext.h:10859
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
Definition: glext.h:1235
#define GL_COLOR_ATTACHMENT11
Definition: glext.h:1725
#define GL_RGBA16_SNORM
Definition: glext.h:768
#define GL_R16_SNORM
Definition: glext.h:765
#define GL_RG8UI
Definition: glext.h:1834
#define GL_TEXTURE_CUBE_MAP_ARB
Definition: glext.h:1230
#define GL_RGB16UI
Definition: glext.h:562
#define GL_COLOR_ATTACHMENT2
Definition: glext.h:1716
#define GL_R32F
Definition: glext.h:1824
GLfloat f
Definition: glext.h:7540
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
Definition: glext.h:1709
const GLuint * shaders
Definition: glext.h:7538
#define GL_UNSIGNED_INT_24_8
Definition: glext.h:1686
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define GL_COLOR_ATTACHMENT1
Definition: glext.h:1715
#define GL_RGB565
Definition: glext.h:2164
#define GL_ARRAY_BUFFER
Definition: glext.h:336
#define GL_DEPTH_COMPONENT24_ARB
Definition: glext.h:1364
#define GL_DSDT_MAG_NV
Definition: glext.h:3710
#define GL_RGB32UI
Definition: glext.h:560
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
Definition: glext.h:1236
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT
Definition: glext.h:3489
#define GL_COLOR_ATTACHMENT3
Definition: glext.h:1717
#define GL_COLOR_ATTACHMENT8
Definition: glext.h:1722
#define GL_SRGB8_ALPHA8
Definition: glext.h:489
#define GL_RGBA32I
Definition: glext.h:565
#define GL_FRAMEBUFFER_COMPLETE
Definition: glext.h:1707
GLuint GLenum matrix
Definition: glext.h:9407
#define GL_SLUMINANCE8_ALPHA8_EXT
Definition: glext.h:4504
#define GL_RG
Definition: glext.h:1817
#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV
Definition: glext.h:3682
#define GL_RGB9_E5_EXT
Definition: glext.h:4680
GLuint in
Definition: glext.h:9616
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT
Definition: glext.h:4681
#define GL_RGBA16UI
Definition: glext.h:561
GLint left
Definition: glext.h:7726
GLenum GLenum dst
Definition: glext.h:6340
#define GL_RGBA16I
Definition: glext.h:567
#define GL_RGBA_INTEGER
Definition: glext.h:575
#define GL_COLOR_ATTACHMENT10
Definition: glext.h:1724
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
Definition: glext.h:4513
#define GL_RGB9_E5
Definition: glext.h:541
#define GL_DSDT8_MAG8_NV
Definition: glext.h:3728
#define GL_RENDERBUFFER
Definition: glext.h:1733
GLbitfield flags
Definition: glext.h:7161
#define GL_R16F
Definition: glext.h:1823
#define GL_COLOR_ATTACHMENT15
Definition: glext.h:1729
#define GL_RG8I
Definition: glext.h:1833
#define GL_FRAMEBUFFER_UNSUPPORTED
Definition: glext.h:1712
#define GL_RG_INTEGER
Definition: glext.h:1818
#define GL_COLOR_ATTACHMENT4
Definition: glext.h:1718
GLboolean GLboolean g
Definition: glext.h:6204
#define GL_FRAMEBUFFER
Definition: glext.h:1732
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define GL_HALF_FLOAT
Definition: glext.h:1785
GLfloat GLfloat p
Definition: glext.h:8902
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
Definition: glext.h:1711
#define GL_R11F_G11F_B10F
Definition: glext.h:539
#define GL_RGB_422_APPLE
Definition: glext.h:5014
#define GL_TEXTURE_2D_MULTISAMPLE
Definition: glext.h:1939
#define GL_STREAM_DRAW
Definition: glext.h:347
#define GL_COMPRESSED_SIGNED_RG_RGTC2
Definition: glext.h:1813
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
Definition: glext.h:3491
#define GL_INVALID_FRAMEBUFFER_OPERATION
Definition: glext.h:1672
#define GL_HALF_FLOAT_ARB
Definition: glext.h:1629
#define GL_DEPTH_STENCIL
Definition: glext.h:1685
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
Definition: glext.h:3490
#define GL_RGB16F_ARB
Definition: glext.h:1648
#define GL_RGB8I
Definition: glext.h:570
#define GL_HILO_NV
Definition: glext.h:3708
#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
Definition: glext.h:1997
#define GL_COLOR_ATTACHMENT12
Definition: glext.h:1726
#define GL_SRGB8_ALPHA8_EXT
Definition: glext.h:4502
#define GL_DEPTH_ATTACHMENT
Definition: glext.h:1730
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
Definition: glext.h:1710
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define GL_RGB32I
Definition: glext.h:566
#define GL_RGBA32F
Definition: glext.h:522
#define GL_RG16F
Definition: glext.h:1825
#define GL_VERTEX_SHADER
Definition: glext.h:420
#define GL_COLOR_ATTACHMENT6
Definition: glext.h:1720
#define GL_RG32I
Definition: glext.h:1837
#define GL_UNSIGNED_SHORT_8_8_REV_APPLE
Definition: glext.h:4250
#define GL_RG16UI
Definition: glext.h:1836
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
Definition: glext.h:4512
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
Definition: glext.h:819
#define GL_SLUMINANCE8_EXT
Definition: glext.h:4506
#define GL_DSDT8_MAG8_INTENSITY8_NV
Definition: glext.h:3729
#define GL_COLOR_ATTACHMENT14
Definition: glext.h:1728
#define GL_DSDT_NV
Definition: glext.h:3709
GLenum attachment
Definition: glext.h:6295
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define GL_RGBA8I
Definition: glext.h:569
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
Definition: glext.h:4511
GLenum cap
Definition: glext.h:9639
#define GL_COMPRESSED_SIGNED_RED_RGTC1
Definition: glext.h:1811
#define GL_RGB32F
Definition: glext.h:523
#define GL_SIGNED_RGBA8_NV
Definition: glext.h:3716
#define GL_RGBA8UI
Definition: glext.h:563
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
Definition: glext.h:1233
#define GL_RG8_SNORM
Definition: glext.h:762
#define GL_STENCIL_ATTACHMENT
Definition: glext.h:1731
GLdouble GLdouble z
Definition: glext.h:5874
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
Definition: glext.h:4443
#define GL_R32I
Definition: glext.h:1831
const GLfloat * m
Definition: glext.h:10848
#define GL_SRGB8
Definition: glext.h:487
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
Definition: glext.h:1995
#define GL_RGBA8_SNORM
Definition: glext.h:764
#define GL_YCBCR_422_APPLE
Definition: glext.h:4248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLuint program)
Definition: glsl_shader.c:617
void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id, BOOL program)
Definition: glsl_shader.c:485
unsigned int UINT
Definition: sysinfo.c:13
#define bits
Definition: infblock.c:15
uint32_t entry
Definition: isohybrid.c:63
#define d
Definition: ke_i.h:81
#define f
Definition: ke_i.h:83
#define a
Definition: ke_i.h:78
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79
if(dx< 0)
Definition: linetemp.h:194
#define red
Definition: linetest.c:67
#define error(str)
Definition: mkdosfs.c:1605
BOOL legacy
Definition: mkisofs.c:131
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define sprintf
Definition: sprintf.c:45
static HDC
Definition: imagelist.c:88
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
static DNS_RECORDW r3
Definition: record.c:39
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
static const char * dst_format
Definition: dib.c:1339
static const MAT2 mat
Definition: font.c:51
static SYSTEM_INFO si
Definition: virtual.c:39
static IHTMLWindow2 * window
Definition: events.c:77
static char * dest
Definition: rtl.c:149
static UINT format_id
Definition: clipboard.c:1455
#define shift
Definition: input.c:3280
#define min(a, b)
Definition: monoChain.cc:55
int other
Definition: msacm.c:1376
#define mul(aa, bb)
Definition: mvAesAlg.c:25
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define uint32_t
Definition: nsiface.idl:61
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define cap
Definition: glfuncs.h:226
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HWND WINAPI WindowFromDC(_In_ HDC hDC)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
static unsigned __int64 next
Definition: rand_nt.c:6
#define calloc
Definition: rosglue.h:14
const WCHAR * str
static calc_node_t temp
Definition: rpn_ieee.c:38
strcpy
Definition: string.h:131
int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:160
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
#define wine_rb_entry
Definition: rbtree.h:404
#define WINE_RB_ENTRY_VALUE
Definition: rbtree.h:414
#define wine_rb_put
Definition: rbtree.h:410
#define wine_rb_tree
Definition: rbtree.h:405
#define wine_rb_get
Definition: rbtree.h:409
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
VkSampleCountFlags sampleCounts
Definition: vulkan.h:9003
D3DKMT_HANDLE hAdapter
Definition: d3dkmthk.h:156
WCHAR DeviceName[32]
Definition: wingdi.h:3264
DWORD StateFlags
Definition: wingdi.h:3266
Definition: match.c:390
Definition: palette.c:466
unsigned short x_source
unsigned short y_sign_fixup
unsigned short w_source
unsigned short x_sign_fixup
unsigned short z_sign_fixup
unsigned short y_source
unsigned short w_sign_fixup
unsigned short z_source
Definition: http.c:7252
char * ptr
Definition: utils.c:4799
int size
Definition: utils.c:4800
char str[200]
Definition: utils.c:4798
Definition: copy.c:22
Definition: list.h:15
Definition: match.c:28
Definition: ps.c:97
Definition: tools.h:99
struct wined3d_gl_info gl_info
Definition: wined3d_gl.h:800
struct wined3d_adapter a
Definition: wined3d_vk.h:726
VkPhysicalDevice physical_device
Definition: wined3d_vk.h:731
struct wined3d_allocator_block * sibling
struct wined3d_allocator_chunk * chunk
struct fragment_caps ffp_fragment_caps
uint32_t full_ffp_varyings
struct wined3d_d3d_limits limits
uint32_t wined3d_creation_flags
uint32_t emulated_flatshading
uint32_t srgb_write_control
enum wined3d_format_id id
Definition: utils.c:311
unsigned int caps
Definition: utils.c:313
unsigned int attrs
Definition: utils.c:312
enum wined3d_format_id id
Definition: utils.c:666
unsigned int attrs
Definition: utils.c:670
enum wined3d_format_id id
Definition: utils.c:74
const char * channels
Definition: utils.c:79
enum wined3d_format_id id
Definition: utils.c:292
D3DDDIFORMAT ddi_format
Definition: utils.c:293
enum wined3d_format_id id
Definition: utils.c:646
void(* decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:647
struct wined3d_format f
Definition: wined3d_gl.h:1142
enum wined3d_format_id base_format_id
Definition: utils.c:1918
enum wined3d_format_id srgb_format_id
Definition: utils.c:1917
void(* decompress)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:769
enum wined3d_gl_extension extension
Definition: utils.c:762
enum wined3d_format_id id
Definition: utils.c:754
unsigned int conv_byte_count
Definition: utils.c:760
void(* upload)(const BYTE *src, BYTE *dst, unsigned int src_row_pitch, unsigned int src_slice_pitch, unsigned int dst_row_pitch, unsigned int dst_slice_pitch, unsigned int width, unsigned int height, unsigned int depth)
Definition: utils.c:763
enum wined3d_ffp_emit_idx emit_idx
Definition: utils.c:700
enum wined3d_format_id id
Definition: utils.c:699
enum wined3d_gl_extension extension
Definition: utils.c:702
unsigned int attrs
unsigned int caps[WINED3D_GL_RES_TYPE_COUNT]
enum wined3d_format_id id
enum wined3d_format_id typeless_id
uint32_t quirks
Definition: wined3d_gl.h:346
BOOL supported[WINED3D_GL_EXT_COUNT]
Definition: wined3d_gl.h:347
struct opengl_funcs gl_ops
Definition: wined3d_gl.h:353
struct wined3d_gl_limits limits
Definition: wined3d_gl.h:344
struct wined3d_fbo_ops fbo_ops
Definition: wined3d_gl.h:354
unsigned int glsl_version
Definition: wined3d_gl.h:343
unsigned int samplers[WINED3D_SHADER_TYPE_COUNT]
Definition: wined3d_gl.h:284
unsigned int graphics_samplers
Definition: wined3d_gl.h:285
unsigned int combined_samplers
Definition: wined3d_gl.h:286
unsigned int uniform_blocks[WINED3D_SHADER_TYPE_COUNT]
Definition: wined3d_gl.h:283
enum wined3d_format_id id
Definition: utils.c:179
enum wined3d_format_id typeless_id
Definition: utils.c:180
const char * channels
Definition: utils.c:181
enum wined3d_format_id typeless_id
Definition: utils.c:273
enum wined3d_format_id depth_view_id
Definition: utils.c:275
enum wined3d_format_id stencil_view_id
Definition: utils.c:276
enum wined3d_format_id depth_stencil_id
Definition: utils.c:274
struct wined3d_vertex_declaration_element * elements
#define max(a, b)
Definition: svc.c:63
#define LIST_ENTRY(type)
Definition: queue.h:175
Character const *const prefix
Definition: tempnam.cpp:195
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
Definition: pdh_main.c:64
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
Definition: vulkan.h:3140
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT
Definition: vulkan.h:3136
@ VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan.h:3137
@ VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
Definition: vulkan.h:3129
@ VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT
Definition: vulkan.h:3134
@ VK_FORMAT_FEATURE_TRANSFER_DST_BIT
Definition: vulkan.h:3143
@ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
Definition: vulkan.h:3128
@ VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
Definition: vulkan.h:3142
@ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT
Definition: vulkan.h:3135
@ VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT
Definition: vulkan.h:3131
VkFlags VkImageUsageFlags
Definition: vulkan.h:1050
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan.h:3495
void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties)
@ VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
Definition: vulkan.h:3515
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
Definition: vulkan.h:3514
VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties)
VkFlags VkFormatFeatureFlags
Definition: vulkan.h:1029
@ VK_IMAGE_TYPE_2D
Definition: vulkan.h:3503
VkResult
Definition: vulkan.h:4639
@ VK_ERROR_FRAGMENTATION_EXT
Definition: vulkan.h:4688
@ VK_ERROR_INVALID_SHADER_NV
Definition: vulkan.h:4654
@ VK_SUBOPTIMAL_KHR
Definition: vulkan.h:4678
@ VK_ERROR_EXTENSION_NOT_PRESENT
Definition: vulkan.h:4665
@ VK_INCOMPLETE
Definition: vulkan.h:4677
@ VK_ERROR_INVALID_EXTERNAL_HANDLE
Definition: vulkan.h:4646
@ VK_ERROR_DEVICE_LOST
Definition: vulkan.h:4668
@ VK_SUCCESS
Definition: vulkan.h:4672
@ VK_EVENT_SET
Definition: vulkan.h:4675
@ VK_EVENT_RESET
Definition: vulkan.h:4676
@ VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR
Definition: vulkan.h:4692
@ VK_ERROR_OUT_OF_HOST_MEMORY
Definition: vulkan.h:4671
@ VK_ERROR_INITIALIZATION_FAILED
Definition: vulkan.h:4669
@ VK_ERROR_OUT_OF_DEVICE_MEMORY
Definition: vulkan.h:4670
@ VK_ERROR_NATIVE_WINDOW_IN_USE_KHR
Definition: vulkan.h:4657
@ VK_ERROR_NOT_PERMITTED_EXT
Definition: vulkan.h:4689
@ VK_ERROR_OUT_OF_DATE_KHR
Definition: vulkan.h:4656
@ VK_TIMEOUT
Definition: vulkan.h:4674
@ VK_ERROR_FORMAT_NOT_SUPPORTED
Definition: vulkan.h:4661
@ VK_ERROR_FRAGMENTED_POOL
Definition: vulkan.h:4660
@ VK_ERROR_SURFACE_LOST_KHR
Definition: vulkan.h:4658
@ VK_NOT_READY
Definition: vulkan.h:4673
@ VK_ERROR_FEATURE_NOT_PRESENT
Definition: vulkan.h:4664
@ VK_ERROR_TOO_MANY_OBJECTS
Definition: vulkan.h:4662
@ VK_ERROR_MEMORY_MAP_FAILED
Definition: vulkan.h:4667
@ VK_ERROR_LAYER_NOT_PRESENT
Definition: vulkan.h:4666
@ VK_ERROR_INCOMPATIBLE_DRIVER
Definition: vulkan.h:4663
@ VK_ERROR_OUT_OF_POOL_MEMORY
Definition: vulkan.h:4647
VkFormat
Definition: vulkan.h:2815
@ VK_FORMAT_R16G16B16A16_UNORM
Definition: vulkan.h:2907
@ VK_FORMAT_A1R5G5B5_UNORM_PACK16
Definition: vulkan.h:2824
@ VK_FORMAT_R8G8B8A8_SRGB
Definition: vulkan.h:2859
@ VK_FORMAT_R32G32B32_UINT
Definition: vulkan.h:2920
@ VK_FORMAT_R16G16_SNORM
Definition: vulkan.h:2894
@ VK_FORMAT_BC2_UNORM_BLOCK
Definition: vulkan.h:2951
@ VK_FORMAT_D24_UNORM_S8_UINT
Definition: vulkan.h:2945
@ VK_FORMAT_D32_SFLOAT
Definition: vulkan.h:2942
@ VK_FORMAT_B8G8R8A8_UNORM
Definition: vulkan.h:2860
@ VK_FORMAT_R16G16B16A16_SNORM
Definition: vulkan.h:2908
@ VK_FORMAT_R8G8_SNORM
Definition: vulkan.h:2833
@ VK_FORMAT_BC7_SRGB_BLOCK
Definition: vulkan.h:2962
@ VK_FORMAT_R16G16_SFLOAT
Definition: vulkan.h:2899
@ VK_FORMAT_R32G32_SFLOAT
Definition: vulkan.h:2919
@ VK_FORMAT_R8_SNORM
Definition: vulkan.h:2826
@ VK_FORMAT_BC2_SRGB_BLOCK
Definition: vulkan.h:2952
@ VK_FORMAT_R16_SFLOAT
Definition: vulkan.h:2892
@ VK_FORMAT_R8G8_UNORM
Definition: vulkan.h:2832
@ VK_FORMAT_BC1_RGBA_SRGB_BLOCK
Definition: vulkan.h:2950
@ VK_FORMAT_R32_SINT
Definition: vulkan.h:2915
@ VK_FORMAT_R16G16_UINT
Definition: vulkan.h:2897
@ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32
Definition: vulkan.h:2939
@ VK_FORMAT_BC3_UNORM_BLOCK
Definition: vulkan.h:2953
@ VK_FORMAT_R8_UNORM
Definition: vulkan.h:2825
@ VK_FORMAT_R32G32B32A32_SFLOAT
Definition: vulkan.h:2925
@ VK_FORMAT_R32G32B32A32_UINT
Definition: vulkan.h:2923
@ VK_FORMAT_BC6H_SFLOAT_BLOCK
Definition: vulkan.h:2960
@ VK_FORMAT_R5G6B5_UNORM_PACK16
Definition: vulkan.h:2820
@ VK_FORMAT_R32_SFLOAT
Definition: vulkan.h:2916
@ VK_FORMAT_R4G4B4A4_UNORM_PACK16
Definition: vulkan.h:2818
@ VK_FORMAT_R16G16B16A16_SINT
Definition: vulkan.h:2912
@ VK_FORMAT_A2B10G10R10_UNORM_PACK32
Definition: vulkan.h:2880
@ VK_FORMAT_B8G8R8A8_SRGB
Definition: vulkan.h:2866
@ VK_FORMAT_R8G8B8A8_UNORM
Definition: vulkan.h:2853
@ VK_FORMAT_R16G16_SINT
Definition: vulkan.h:2898
@ VK_FORMAT_R8G8_SINT
Definition: vulkan.h:2837
@ VK_FORMAT_UNDEFINED
Definition: vulkan.h:2816
@ VK_FORMAT_R16_SINT
Definition: vulkan.h:2891
@ VK_FORMAT_BC4_SNORM_BLOCK
Definition: vulkan.h:2956
@ VK_FORMAT_R32G32B32_SINT
Definition: vulkan.h:2921
@ VK_FORMAT_R16_UNORM
Definition: vulkan.h:2886
@ VK_FORMAT_BC6H_UFLOAT_BLOCK
Definition: vulkan.h:2959
@ VK_FORMAT_R8_SINT
Definition: vulkan.h:2830
@ VK_FORMAT_BC7_UNORM_BLOCK
Definition: vulkan.h:2961
@ VK_FORMAT_D16_UNORM
Definition: vulkan.h:2940
@ VK_FORMAT_R16_UINT
Definition: vulkan.h:2890
@ VK_FORMAT_R8_UINT
Definition: vulkan.h:2829
@ VK_FORMAT_R16G16B16A16_SFLOAT
Definition: vulkan.h:2913
@ VK_FORMAT_R16G16_UNORM
Definition: vulkan.h:2893
@ VK_FORMAT_BC5_UNORM_BLOCK
Definition: vulkan.h:2957
@ VK_FORMAT_R8G8B8A8_SINT
Definition: vulkan.h:2858
@ VK_FORMAT_R32G32_UINT
Definition: vulkan.h:2917
@ VK_FORMAT_R8G8B8A8_SNORM
Definition: vulkan.h:2854
@ VK_FORMAT_R16G16B16A16_UINT
Definition: vulkan.h:2911
@ VK_FORMAT_R32G32B32A32_SINT
Definition: vulkan.h:2924
@ VK_FORMAT_BC3_SRGB_BLOCK
Definition: vulkan.h:2954
@ VK_FORMAT_R32G32B32_SFLOAT
Definition: vulkan.h:2922
@ VK_FORMAT_R8G8B8A8_UINT
Definition: vulkan.h:2857
@ VK_FORMAT_BC1_RGBA_UNORM_BLOCK
Definition: vulkan.h:2949
@ VK_FORMAT_R16_SNORM
Definition: vulkan.h:2887
@ VK_FORMAT_B10G11R11_UFLOAT_PACK32
Definition: vulkan.h:2938
@ VK_FORMAT_R8G8_UINT
Definition: vulkan.h:2836
@ VK_FORMAT_BC5_SNORM_BLOCK
Definition: vulkan.h:2958
@ VK_FORMAT_BC4_UNORM_BLOCK
Definition: vulkan.h:2955
@ VK_FORMAT_D32_SFLOAT_S8_UINT
Definition: vulkan.h:2946
@ VK_FORMAT_R32G32_SINT
Definition: vulkan.h:2918
@ VK_FORMAT_R32_UINT
Definition: vulkan.h:2914
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
int retval
Definition: wcstombs.cpp:91
#define GL_VIEW_CLASS_16_BITS
Definition: wgl.h:5007
#define GL_VIEW_CLASS_96_BITS
Definition: wgl.h:5013
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
Definition: wgl.h:679
#define GL_VIEW_CLASS_S3TC_DXT1_RGB
Definition: wgl.h:5037
#define GL_SRGB_WRITE
Definition: wgl.h:4024
#define GL_VIEW_CLASS_128_BITS
Definition: wgl.h:5006
#define GL_VIEW_CLASS_S3TC_DXT5_RGBA
Definition: wgl.h:5040
#define GL_VIEW_CLASS_S3TC_DXT1_RGBA
Definition: wgl.h:5038
#define GL_SRGB_READ
Definition: wgl.h:4023
#define GL_FILTER
Definition: wgl.h:1297
#define GL_SHADER_IMAGE_STORE
Definition: wgl.h:3857
#define GL_VIEW_CLASS_24_BITS
Definition: wgl.h:5008
#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT
Definition: wgl.h:641
#define GL_VERTEX_TEXTURE
Definition: wgl.h:4959
#define GL_VIEW_CLASS_8_BITS
Definition: wgl.h:5012
#define GL_VIEW_CLASS_BPTC_FLOAT
Definition: wgl.h:5028
#define GL_VIEW_CLASS_48_BITS
Definition: wgl.h:5010
#define GL_COMPRESSED_RGBA_BPTC_UNORM
Definition: wgl.h:634
#define GL_VIEW_CLASS_64_BITS
Definition: wgl.h:5011
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
Definition: wgl.h:643
#define GL_FRAMEBUFFER_BLEND
Definition: wgl.h:1490
#define GL_VIEW_CLASS_BPTC_UNORM
Definition: wgl.h:5029
#define GL_VIEW_CLASS_32_BITS
Definition: wgl.h:5009
#define GL_RGB_RAW_422_APPLE
Definition: wgl.h:3694
#define GL_FRAMEBUFFER_RENDERABLE
Definition: wgl.h:1521
#define GL_FULL_SUPPORT
Definition: wgl.h:1542
#define GL_VIEW_CLASS_RGTC1_RED
Definition: wgl.h:5035
#define GL_VIEW_CLASS_RGTC2_RG
Definition: wgl.h:5036
#define GL_VIEW_CLASS_S3TC_DXT3_RGBA
Definition: wgl.h:5039
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
@ D3DDDIFMT_A8R8G8B8
Definition: d3dukmdt.h:34
@ D3DDDIFMT_P8
Definition: d3dukmdt.h:51
@ D3DDDIFMT_R5G6B5
Definition: d3dukmdt.h:36
@ D3DDDIFMT_R8G8B8
Definition: d3dukmdt.h:33
@ D3DDDIFMT_A4R4G4B4
Definition: d3dukmdt.h:39
@ D3DDDIFMT_X4R4G4B4
Definition: d3dukmdt.h:43
@ D3DDDIFMT_X8R8G8B8
Definition: d3dukmdt.h:35
@ D3DDDIFMT_A1R5G5B5
Definition: d3dukmdt.h:38
@ D3DDDIFMT_X1R5G5B5
Definition: d3dukmdt.h:37
enum _D3DDDIFORMAT D3DDDIFORMAT
NTSTATUS WINAPI D3DKMTCloseAdapter(const D3DKMT_CLOSEADAPTER *desc)
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc)
@ WINED3D_SHADE_FLAT
Definition: wined3d.h:488
#define WINED3D_VIEW_READ_ONLY_DEPTH
Definition: wined3d.h:1584
#define WINED3DTA_TEMP
Definition: wined3d.h:886
#define WINED3DUSAGE_QUERY_LEGACYBUMPMAP
Definition: wined3d.h:942
static unsigned int wined3d_log2i(unsigned int x)
Definition: wined3d.h:2952
#define WINED3DUSAGE_POINTS
Definition: wined3d.h:921
#define WINED3DUSAGE_DONOTCLIP
Definition: wined3d.h:920
#define WINED3DUSAGE_DMAP
Definition: wined3d.h:928
#define WINED3D_TS_WORLD_MATRIX(index)
Definition: wined3d.h:683
@ WINED3D_FOG_LINEAR
Definition: wined3d.h:483
@ WINED3D_FOG_EXP
Definition: wined3d.h:481
@ WINED3D_FOG_NONE
Definition: wined3d.h:480
@ WINED3D_FOG_EXP2
Definition: wined3d.h:482
#define WINED3D_NORMALIZED_DEPTH_BIAS
Definition: wined3d.h:1334
wined3d_decl_usage
Definition: wined3d.h:806
@ WINED3D_DECL_USAGE_DEPTH
Definition: wined3d.h:819
@ WINED3D_DECL_USAGE_BLEND_INDICES
Definition: wined3d.h:809
@ WINED3D_DECL_USAGE_TESS_FACTOR
Definition: wined3d.h:815
@ WINED3D_DECL_USAGE_NORMAL
Definition: wined3d.h:810
@ WINED3D_DECL_USAGE_PSIZE
Definition: wined3d.h:811
@ WINED3D_DECL_USAGE_BLEND_WEIGHT
Definition: wined3d.h:808
@ WINED3D_DECL_USAGE_SAMPLE
Definition: wined3d.h:820
@ WINED3D_DECL_USAGE_POSITION
Definition: wined3d.h:807
@ WINED3D_DECL_USAGE_BINORMAL
Definition: wined3d.h:814
@ WINED3D_DECL_USAGE_COLOR
Definition: wined3d.h:817
@ WINED3D_DECL_USAGE_POSITIONT
Definition: wined3d.h:816
@ WINED3D_DECL_USAGE_TEXCOORD
Definition: wined3d.h:812
@ WINED3D_DECL_USAGE_TANGENT
Definition: wined3d.h:813
@ WINED3D_DECL_USAGE_FOG
Definition: wined3d.h:818
wined3d_render_state
Definition: wined3d.h:288
@ WINED3D_RS_TEXTUREFACTOR
Definition: wined3d.h:337
@ WINED3D_RS_COLORKEYENABLE
Definition: wined3d.h:323
@ WINED3D_RS_STENCILFAIL
Definition: wined3d.h:330
@ WINED3D_RS_NORMALDEGREE
Definition: wined3d.h:380
@ WINED3D_RS_WRAP8
Definition: wined3d.h:402
@ WINED3D_RS_LIGHTING
Definition: wined3d.h:347
@ WINED3D_RS_SOFTWAREVERTEXPROCESSING
Definition: wined3d.h:361
@ WINED3D_RS_STIPPLEDALPHA
Definition: wined3d.h:316
@ WINED3D_RS_COLORWRITEENABLE1
Definition: wined3d.h:396
@ WINED3D_RS_STENCILENABLE
Definition: wined3d.h:329
@ WINED3D_RS_COLORVERTEX
Definition: wined3d.h:351
@ WINED3D_RS_TWEENFACTOR
Definition: wined3d.h:377
@ WINED3D_RS_FOGCOLOR
Definition: wined3d.h:317
@ WINED3D_RS_WRAP4
Definition: wined3d.h:342
@ WINED3D_RS_WRAP15
Definition: wined3d.h:409
@ WINED3D_RS_ZENABLE
Definition: wined3d.h:293
@ WINED3D_RS_ANTIALIASEDLINEENABLE
Definition: wined3d.h:383
@ WINED3D_RS_SPECULARMATERIALSOURCE
Definition: wined3d.h:356
@ WINED3D_RS_STENCILPASS
Definition: wined3d.h:332
@ WINED3D_RS_WRAP13
Definition: wined3d.h:407
@ WINED3D_RS_DEBUGMONITORTOKEN
Definition: wined3d.h:373
@ WINED3D_RS_WRAP1
Definition: wined3d.h:339
@ WINED3D_RS_WRAP3
Definition: wined3d.h:341
@ WINED3D_RS_DEPTHBIAS
Definition: wined3d.h:401
@ WINED3D_RS_MAXTESSELLATIONLEVEL
Definition: wined3d.h:385
@ WINED3D_RS_DITHERENABLE
Definition: wined3d.h:309
@ WINED3D_RS_SHADEMODE
Definition: wined3d.h:295
@ WINED3D_RS_CULLMODE
Definition: wined3d.h:305
@ WINED3D_RS_BACK_STENCILPASS
Definition: wined3d.h:394
@ WINED3D_RS_WRAPV
Definition: wined3d.h:292
@ WINED3D_RS_PATCHEDGESTYLE
Definition: wined3d.h:371
@ WINED3D_RS_SCISSORTESTENABLE
Definition: wined3d.h:381
@ WINED3D_RS_LASTPIXEL
Definition: wined3d.h:302
@ WINED3D_RS_VERTEXBLEND
Definition: wined3d.h:359
@ WINED3D_RS_FOGEND
Definition: wined3d.h:320
@ WINED3D_RS_MINTESSELLATIONLEVEL
Definition: wined3d.h:384
@ WINED3D_RS_POINTSCALE_A
Definition: wined3d.h:366
@ WINED3D_RS_MULTISAMPLEMASK
Definition: wined3d.h:370
@ WINED3D_RS_BACK_STENCILFUNC
Definition: wined3d.h:395
@ WINED3D_RS_SRCBLEND
Definition: wined3d.h:303
@ WINED3D_RS_SRGBWRITEENABLE
Definition: wined3d.h:400
@ WINED3D_RS_RANGEFOGENABLE
Definition: wined3d.h:325
@ WINED3D_RS_POINTSIZE_MIN
Definition: wined3d.h:363
@ WINED3D_RS_TEXTUREPERSPECTIVE
Definition: wined3d.h:290
@ WINED3D_RS_ENABLEADAPTIVETESSELLATION
Definition: wined3d.h:390
@ WINED3D_RS_COLORWRITEENABLE3
Definition: wined3d.h:398
@ WINED3D_RS_ALPHABLENDENABLE
Definition: wined3d.h:310
@ WINED3D_RS_WRAPU
Definition: wined3d.h:291
@ WINED3D_RS_ADAPTIVETESS_X
Definition: wined3d.h:386
@ WINED3D_RS_MONOENABLE
Definition: wined3d.h:297
@ WINED3D_RS_LOCALVIEWER
Definition: wined3d.h:352
@ WINED3D_RS_ADAPTIVETESS_Z
Definition: wined3d.h:388
@ WINED3D_RS_WRAP0
Definition: wined3d.h:338
@ WINED3D_RS_STENCILMASK
Definition: wined3d.h:335
@ WINED3D_RS_BLENDOP
Definition: wined3d.h:378
@ WINED3D_RS_POINTSCALE_C
Definition: wined3d.h:368
@ WINED3D_RS_FOGSTART
Definition: wined3d.h:319
@ WINED3D_RS_STENCILFUNC
Definition: wined3d.h:333
@ WINED3D_RS_WRAP7
Definition: wined3d.h:345
@ WINED3D_RS_FOGTABLEMODE
Definition: wined3d.h:318
@ WINED3D_RS_POINTSIZE
Definition: wined3d.h:362
@ WINED3D_RS_POINTSIZE_MAX
Definition: wined3d.h:374
@ WINED3D_RS_ZWRITEENABLE
Definition: wined3d.h:300
@ WINED3D_RS_PLANEMASK
Definition: wined3d.h:299
@ WINED3D_RS_SUBPIXELX
Definition: wined3d.h:315
@ WINED3D_RS_CLIPPLANEENABLE
Definition: wined3d.h:360
@ WINED3D_RS_DESTBLEND
Definition: wined3d.h:304
@ WINED3D_RS_AMBIENTMATERIALSOURCE
Definition: wined3d.h:357
@ WINED3D_RS_WRAP6
Definition: wined3d.h:344
@ WINED3D_RS_STENCILREF
Definition: wined3d.h:334
@ WINED3D_RS_FOGENABLE
Definition: wined3d.h:311
@ WINED3D_RS_POINTSPRITEENABLE
Definition: wined3d.h:364
@ WINED3D_RS_FLUSHBATCH
Definition: wined3d.h:327
@ WINED3D_RS_BACK_STENCILZFAIL
Definition: wined3d.h:393
@ WINED3D_RS_ZFUNC
Definition: wined3d.h:306
@ WINED3D_RS_ROP2
Definition: wined3d.h:298
@ WINED3D_RS_POSITIONDEGREE
Definition: wined3d.h:379
@ WINED3D_RS_MULTISAMPLEANTIALIAS
Definition: wined3d.h:369
@ WINED3D_RS_ANTIALIAS
Definition: wined3d.h:289
@ WINED3D_RS_BACK_STENCILFAIL
Definition: wined3d.h:392
@ WINED3D_RS_COLORWRITEENABLE
Definition: wined3d.h:376
@ WINED3D_RS_SLOPESCALEDEPTHBIAS
Definition: wined3d.h:382
@ WINED3D_RS_DIFFUSEMATERIALSOURCE
Definition: wined3d.h:355
@ WINED3D_RS_ALPHAREF
Definition: wined3d.h:307
@ WINED3D_RS_NORMALIZENORMALS
Definition: wined3d.h:353
@ WINED3D_RS_ANISOTROPY
Definition: wined3d.h:326
@ WINED3D_RS_TWOSIDEDSTENCILMODE
Definition: wined3d.h:391
@ WINED3D_RS_TRANSLUCENTSORTINDEPENDENT
Definition: wined3d.h:328
@ WINED3D_RS_EMISSIVEMATERIALSOURCE
Definition: wined3d.h:358
@ WINED3D_RS_PATCHSEGMENTS
Definition: wined3d.h:372
@ WINED3D_RS_SPECULARENABLE
Definition: wined3d.h:312
@ WINED3D_RS_WRAP2
Definition: wined3d.h:340
@ WINED3D_RS_ADAPTIVETESS_W
Definition: wined3d.h:389
@ WINED3D_RS_FILLMODE
Definition: wined3d.h:294
@ WINED3D_RS_CLIPPING
Definition: wined3d.h:346
@ WINED3D_RS_WRAP10
Definition: wined3d.h:404
@ WINED3D_RS_SRCBLENDALPHA
Definition: wined3d.h:411
@ WINED3D_RS_COLORKEYBLENDENABLE
Definition: wined3d.h:354
@ WINED3D_RS_COLORWRITEENABLE2
Definition: wined3d.h:397
@ WINED3D_RS_POINTSCALEENABLE
Definition: wined3d.h:365
@ WINED3D_RS_WRAP14
Definition: wined3d.h:408
@ WINED3D_RS_FOGVERTEXMODE
Definition: wined3d.h:350
@ WINED3D_RS_STENCILWRITEMASK
Definition: wined3d.h:336
@ WINED3D_RS_AMBIENT
Definition: wined3d.h:349
@ WINED3D_RS_WRAP11
Definition: wined3d.h:405
@ WINED3D_RS_LINEPATTERN
Definition: wined3d.h:296
@ WINED3D_RS_ZVISIBLE
Definition: wined3d.h:313
@ WINED3D_RS_EXTENTS
Definition: wined3d.h:348
@ WINED3D_RS_BLENDOPALPHA
Definition: wined3d.h:413
@ WINED3D_RS_DESTBLENDALPHA
Definition: wined3d.h:412
@ WINED3D_RS_FOGDENSITY
Definition: wined3d.h:321
@ WINED3D_RS_STENCILZFAIL
Definition: wined3d.h:331
@ WINED3D_RS_SUBPIXEL
Definition: wined3d.h:314
@ WINED3D_RS_POINTSCALE_B
Definition: wined3d.h:367
@ WINED3D_RS_INDEXEDVERTEXBLENDENABLE
Definition: wined3d.h:375
@ WINED3D_RS_MIPMAPLODBIAS
Definition: wined3d.h:324
@ WINED3D_RS_WRAP9
Definition: wined3d.h:403
@ WINED3D_RS_SEPARATEALPHABLENDENABLE
Definition: wined3d.h:410
@ WINED3D_RS_STIPPLEENABLE
Definition: wined3d.h:322
@ WINED3D_RS_WRAP5
Definition: wined3d.h:343
@ WINED3D_RS_ADAPTIVETESS_Y
Definition: wined3d.h:387
@ WINED3D_RS_ALPHATESTENABLE
Definition: wined3d.h:301
@ WINED3D_RS_ALPHAFUNC
Definition: wined3d.h:308
@ WINED3D_RS_WRAP12
Definition: wined3d.h:406
#define WINED3D_VIEW_READ_ONLY_STENCIL
Definition: wined3d.h:1585
wined3d_primitive_type
Definition: wined3d.h:74
@ WINED3D_PT_LINESTRIP_ADJ
Definition: wined3d.h:83
@ WINED3D_PT_LINELIST
Definition: wined3d.h:77
@ WINED3D_PT_UNDEFINED
Definition: wined3d.h:75
@ WINED3D_PT_PATCH
Definition: wined3d.h:86
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:76
@ WINED3D_PT_TRIANGLELIST_ADJ
Definition: wined3d.h:84
@ WINED3D_PT_LINELIST_ADJ
Definition: wined3d.h:82
@ WINED3D_PT_TRIANGLESTRIP_ADJ
Definition: wined3d.h:85
@ WINED3D_PT_TRIANGLESTRIP
Definition: wined3d.h:80
@ WINED3D_PT_LINESTRIP
Definition: wined3d.h:78
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:79
@ WINED3D_PT_TRIANGLEFAN
Definition: wined3d.h:81
static int wined3d_bit_scan(unsigned int *x)
Definition: wined3d.h:2982
#define WINED3D_VIEW_TEXTURE_CUBE
Definition: wined3d.h:1582
wined3d_decl_method
Definition: wined3d.h:795
@ WINED3D_DECL_METHOD_LOOKUP
Definition: wined3d.h:801
@ WINED3D_DECL_METHOD_LOOKUP_PRESAMPLED
Definition: wined3d.h:802
@ WINED3D_DECL_METHOD_PARTIAL_V
Definition: wined3d.h:798
@ WINED3D_DECL_METHOD_CROSS_UV
Definition: wined3d.h:799
@ WINED3D_DECL_METHOD_UV
Definition: wined3d.h:800
@ WINED3D_DECL_METHOD_PARTIAL_U
Definition: wined3d.h:797
@ WINED3D_DECL_METHOD_DEFAULT
Definition: wined3d.h:796
#define WINED3DUSAGE_OWNDC
Definition: wined3d.h:935
#define WINED3DUSAGE_LEGACY_CUBEMAP
Definition: wined3d.h:934
wined3d_material_color_source
Definition: wined3d.h:520
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:909
wined3d_sampler_state
Definition: wined3d.h:554
@ WINED3D_SAMP_ELEMENT_INDEX
Definition: wined3d.h:566
@ WINED3D_SAMP_MAX_ANISOTROPY
Definition: wined3d.h:564
@ WINED3D_SAMP_MIPMAP_LOD_BIAS
Definition: wined3d.h:562
@ WINED3D_SAMP_MIN_FILTER
Definition: wined3d.h:560
@ WINED3D_SAMP_SRGB_TEXTURE
Definition: wined3d.h:565
@ WINED3D_SAMP_DMAP_OFFSET
Definition: wined3d.h:567
@ WINED3D_SAMP_MIP_FILTER
Definition: wined3d.h:561
@ WINED3D_SAMP_MAG_FILTER
Definition: wined3d.h:559
@ WINED3D_SAMP_BORDER_COLOR
Definition: wined3d.h:558
@ WINED3D_SAMP_ADDRESS_V
Definition: wined3d.h:556
@ WINED3D_SAMP_ADDRESS_U
Definition: wined3d.h:555
@ WINED3D_SAMP_ADDRESS_W
Definition: wined3d.h:557
@ WINED3D_SAMP_MAX_MIP_LEVEL
Definition: wined3d.h:563
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:52
#define WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
Definition: wined3d.h:1331
wined3d_resource_type
Definition: wined3d.h:716
@ WINED3D_RTYPE_TEXTURE_2D
Definition: wined3d.h:720
@ WINED3D_RTYPE_TEXTURE_1D
Definition: wined3d.h:719
@ WINED3D_RTYPE_NONE
Definition: wined3d.h:717
@ WINED3D_RTYPE_BUFFER
Definition: wined3d.h:718
@ WINED3D_RTYPE_TEXTURE_3D
Definition: wined3d.h:721
#define WINED3DTA_SELECTMASK
Definition: wined3d.h:880
#define WINED3D_VIEW_TEXTURE_ARRAY
Definition: wined3d.h:1583
@ WINED3D_LIGHT_SPOT
Definition: wined3d.h:67
@ WINED3D_LIGHT_PARALLELPOINT
Definition: wined3d.h:69
@ WINED3D_LIGHT_POINT
Definition: wined3d.h:66
@ WINED3D_LIGHT_DIRECTIONAL
Definition: wined3d.h:68
#define WINED3D_BIND_UNORDERED_ACCESS
Definition: wined3d.h:916
#define WINED3D_VIEW_BUFFER_RAW
Definition: wined3d.h:1579
#define WINED3DTSS_TCI_PASSTHRU
Definition: wined3d.h:874
#define WINED3DUSAGE_RESTRICTED_CONTENT
Definition: wined3d.h:925
#define WINED3DUSAGE_QUERY_SRGBREAD
Definition: wined3d.h:945
wined3d_texture_filter_type
Definition: wined3d.h:704
@ WINED3D_TEXF_GAUSSIAN_CUBIC
Definition: wined3d.h:710
@ WINED3D_TEXF_NONE
Definition: wined3d.h:705
@ WINED3D_TEXF_PYRAMIDAL_QUAD
Definition: wined3d.h:711
@ WINED3D_TEXF_FLAT_CUBIC
Definition: wined3d.h:709
@ WINED3D_TEXF_GAUSSIAN_QUAD
Definition: wined3d.h:712
@ WINED3D_TEXF_POINT
Definition: wined3d.h:706
@ WINED3D_TEXF_ANISOTROPIC
Definition: wined3d.h:708
@ WINED3D_TEXF_LINEAR
Definition: wined3d.h:707
wined3d_texture_stage_state
Definition: wined3d.h:593
@ WINED3D_TSS_COLOR_ARG2
Definition: wined3d.h:596
@ WINED3D_TSS_BUMPENV_LOFFSET
Definition: wined3d.h:606
@ WINED3D_TSS_ALPHA_OP
Definition: wined3d.h:597
@ WINED3D_TSS_BUMPENV_MAT11
Definition: wined3d.h:603
@ WINED3D_TSS_COLOR_OP
Definition: wined3d.h:594
@ WINED3D_TSS_BUMPENV_MAT10
Definition: wined3d.h:602
@ WINED3D_TSS_TEXCOORD_INDEX
Definition: wined3d.h:604
@ WINED3D_TSS_ALPHA_ARG2
Definition: wined3d.h:599
@ WINED3D_TSS_CONSTANT
Definition: wined3d.h:611
@ WINED3D_TSS_BUMPENV_MAT01
Definition: wined3d.h:601
@ WINED3D_TSS_ALPHA_ARG0
Definition: wined3d.h:609
@ WINED3D_TSS_BUMPENV_LSCALE
Definition: wined3d.h:605
@ WINED3D_TSS_COLOR_ARG0
Definition: wined3d.h:608
@ WINED3D_TSS_COLOR_ARG1
Definition: wined3d.h:595
@ WINED3D_TSS_ALPHA_ARG1
Definition: wined3d.h:598
@ WINED3D_TSS_RESULT_ARG
Definition: wined3d.h:610
@ WINED3D_TSS_BUMPENV_MAT00
Definition: wined3d.h:600
@ WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS
Definition: wined3d.h:607
#define WINED3DUSAGE_QUERY_FILTER
Definition: wined3d.h:943
#define WINED3D_CKEY_SRC_BLT
Definition: wined3d.h:1341
#define WINED3D_VIEW_FORWARD_REFERENCE
Definition: wined3d.h:1588
#define WINED3DUSAGE_OVERLAY
Definition: wined3d.h:937
#define WINED3D_BIND_SHADER_RESOURCE
Definition: wined3d.h:912
#define WINED3DUSAGE_VIDMEM_ACCOUNTING
Definition: wined3d.h:939
#define WINED3DTA_CURRENT
Definition: wined3d.h:882
#define WINED3DUSAGE_QUERY_WRAPANDMIP
Definition: wined3d.h:948
wined3d_format_id
Definition: wined3d.h:126
@ WINED3DFMT_R32G32B32_TYPELESS
Definition: wined3d.h:160
@ WINED3DFMT_RESZ
Definition: wined3d.h:275
@ WINED3DFMT_R8_TYPELESS
Definition: wined3d.h:217
@ WINED3DFMT_B2G3R3_UNORM
Definition: wined3d.h:131
@ WINED3DFMT_BC5_UNORM
Definition: wined3d.h:240
@ WINED3DFMT_R32G32B32_SINT
Definition: wined3d.h:163
@ WINED3DFMT_R8G8_UNORM
Definition: wined3d.h:206
@ WINED3DFMT_BC7_TYPELESS
Definition: wined3d.h:253
@ WINED3DFMT_BC7_UNORM_SRGB
Definition: wined3d.h:255
@ WINED3DFMT_R32G32_SINT
Definition: wined3d.h:173
@ WINED3DFMT_X24_TYPELESS_G8_UINT
Definition: wined3d.h:204
@ WINED3DFMT_BC2_UNORM_SRGB
Definition: wined3d.h:232
@ WINED3DFMT_INTZ
Definition: wined3d.h:274
@ WINED3DFMT_B4G4R4A4_UNORM
Definition: wined3d.h:130
@ WINED3DFMT_R16G16_UINT
Definition: wined3d.h:193
@ WINED3DFMT_R16G16_UNORM
Definition: wined3d.h:192
@ WINED3DFMT_R8G8_TYPELESS
Definition: wined3d.h:205
@ WINED3DFMT_R10G10B10X2_UINT
Definition: wined3d.h:145
@ WINED3DFMT_X8D24_UNORM
Definition: wined3d.h:151
@ WINED3DFMT_BC5_SNORM
Definition: wined3d.h:241
@ WINED3DFMT_R32_SINT
Definition: wined3d.h:200
@ WINED3DFMT_DXT2
Definition: wined3d.h:261
@ WINED3DFMT_D32_FLOAT
Definition: wined3d.h:197
@ WINED3DFMT_R10G10B10A2_UNORM
Definition: wined3d.h:179
@ WINED3DFMT_R8_UINT
Definition: wined3d.h:219
@ WINED3DFMT_R8G8_SNORM_Cx
Definition: wined3d.h:155
@ WINED3DFMT_R32G32_FLOAT
Definition: wined3d.h:171
@ WINED3DFMT_R16G16_SNORM
Definition: wined3d.h:194
@ WINED3DFMT_B8G8R8A8_UNORM
Definition: wined3d.h:244
@ WINED3DFMT_R16_UNORM
Definition: wined3d.h:213
@ WINED3DFMT_R24G8_TYPELESS
Definition: wined3d.h:201
@ WINED3DFMT_R10G10B10A2_TYPELESS
Definition: wined3d.h:178
@ WINED3DFMT_R32G32_UINT
Definition: wined3d.h:172
@ WINED3DFMT_R32G32B32_UINT
Definition: wined3d.h:162
@ WINED3DFMT_BC4_TYPELESS
Definition: wined3d.h:236
@ WINED3DFMT_ATI1N
Definition: wined3d.h:268
@ WINED3DFMT_BC2_UNORM
Definition: wined3d.h:231
@ WINED3DFMT_R8_UNORM
Definition: wined3d.h:218
@ WINED3DFMT_R8G8B8A8_SNORM
Definition: wined3d.h:188
@ WINED3DFMT_NV12
Definition: wined3d.h:279
@ WINED3DFMT_S8_UINT_D24_FLOAT
Definition: wined3d.h:154
@ WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
Definition: wined3d.h:182
@ WINED3DFMT_NULL
Definition: wined3d.h:276
@ WINED3DFMT_R16_TYPELESS
Definition: wined3d.h:210
@ WINED3DFMT_R16G16B16A16_SINT
Definition: wined3d.h:169
@ WINED3DFMT_D16_LOCKABLE
Definition: wined3d.h:148
@ WINED3DFMT_R10G11B11_SNORM
Definition: wined3d.h:143
@ WINED3DFMT_S1_UINT_D15_UNORM
Definition: wined3d.h:150
@ WINED3DFMT_R16_SINT
Definition: wined3d.h:216
@ WINED3DFMT_B2G3R3A8_UNORM
Definition: wined3d.h:132
@ WINED3DFMT_R8G8_B8G8_UNORM
Definition: wined3d.h:225
@ WINED3DFMT_L8A8_UNORM
Definition: wined3d.h:139
@ WINED3DFMT_R32G32B32_FLOAT
Definition: wined3d.h:161
@ WINED3DFMT_L4A4_UNORM
Definition: wined3d.h:140
@ WINED3DFMT_B8G8R8X8_UNORM
Definition: wined3d.h:245
@ WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
Definition: wined3d.h:176
@ WINED3DFMT_R8G8B8X8_UNORM
Definition: wined3d.h:134
@ WINED3DFMT_BC1_UNORM_SRGB
Definition: wined3d.h:229
@ WINED3DFMT_B5G5R5X1_UNORM
Definition: wined3d.h:129
@ WINED3DFMT_B10G10R10A2_UNORM
Definition: wined3d.h:135
@ WINED3DFMT_R16G16B16A16_FLOAT
Definition: wined3d.h:165
@ WINED3DFMT_D16_UNORM
Definition: wined3d.h:212
@ WINED3DFMT_L8_UNORM
Definition: wined3d.h:138
@ WINED3DFMT_NVHS
Definition: wined3d.h:273
@ WINED3DFMT_R8G8_SNORM
Definition: wined3d.h:208
@ WINED3DFMT_UNKNOWN
Definition: wined3d.h:127
@ WINED3DFMT_R5G5_SNORM_L6_UNORM
Definition: wined3d.h:141
@ WINED3DFMT_R8G8B8A8_TYPELESS
Definition: wined3d.h:184
@ WINED3DFMT_R8G8_UINT
Definition: wined3d.h:207
@ WINED3DFMT_BC7_UNORM
Definition: wined3d.h:254
@ WINED3DFMT_B8G8R8_UNORM
Definition: wined3d.h:128
@ WINED3DFMT_INST
Definition: wined3d.h:270
@ WINED3DFMT_DXT1
Definition: wined3d.h:260
@ WINED3DFMT_R8G8B8A8_UNORM_SRGB
Definition: wined3d.h:186
@ WINED3DFMT_R9G9B9E5_SHAREDEXP
Definition: wined3d.h:224
@ WINED3DFMT_NVDB
Definition: wined3d.h:271
@ WINED3DFMT_B8G8R8X8_TYPELESS
Definition: wined3d.h:248
@ WINED3DFMT_R32_UINT
Definition: wined3d.h:199
@ WINED3DFMT_B5G5R5A1_UNORM
Definition: wined3d.h:243
@ WINED3DFMT_R10G10B10_SNORM_A2_UNORM
Definition: wined3d.h:147
@ WINED3DFMT_R16_FLOAT
Definition: wined3d.h:211
@ WINED3DFMT_DXT3
Definition: wined3d.h:262
@ WINED3DFMT_DXT4
Definition: wined3d.h:263
@ WINED3DFMT_D32_UNORM
Definition: wined3d.h:149
@ WINED3DFMT_R8G8B8A8_UNORM
Definition: wined3d.h:185
@ WINED3DFMT_R10G10B10A2_UINT
Definition: wined3d.h:180
@ WINED3DFMT_G8R8_G8B8_UNORM
Definition: wined3d.h:226
@ WINED3DFMT_R10G10B10X2_TYPELESS
Definition: wined3d.h:144
@ WINED3DFMT_R32G32B32A32_UINT
Definition: wined3d.h:158
@ WINED3DFMT_R16G16B16A16_UNORM
Definition: wined3d.h:166
@ WINED3DFMT_BC3_UNORM
Definition: wined3d.h:234
@ WINED3DFMT_BC6H_UF16
Definition: wined3d.h:251
@ WINED3DFMT_R16G16B16A16_TYPELESS
Definition: wined3d.h:164
@ WINED3DFMT_R10G10B10A2_SNORM
Definition: wined3d.h:181
@ WINED3DFMT_R24_UNORM_X8_TYPELESS
Definition: wined3d.h:203
@ WINED3DFMT_R16
Definition: wined3d.h:277
@ WINED3DFMT_D32_FLOAT_S8X24_UINT
Definition: wined3d.h:175
@ WINED3DFMT_NVHU
Definition: wined3d.h:272
@ WINED3DFMT_R32_FLOAT
Definition: wined3d.h:198
@ WINED3DFMT_R8G8_SNORM_L8X8_UNORM
Definition: wined3d.h:142
@ WINED3DFMT_X32_TYPELESS_G8X24_UINT
Definition: wined3d.h:177
@ WINED3DFMT_YV12
Definition: wined3d.h:259
@ WINED3DFMT_B5G6R5_UNORM
Definition: wined3d.h:242
@ WINED3DFMT_R16G16B16A16_UINT
Definition: wined3d.h:167
@ WINED3DFMT_S4X4_UINT_D24_UNORM
Definition: wined3d.h:152
@ WINED3DFMT_BC1_TYPELESS
Definition: wined3d.h:227
@ WINED3DFMT_B8G8R8X8_UNORM_SRGB
Definition: wined3d.h:249
@ WINED3DFMT_DXT5
Definition: wined3d.h:264
@ WINED3DFMT_BC4_UNORM
Definition: wined3d.h:237
@ WINED3DFMT_B8G8R8A8_TYPELESS
Definition: wined3d.h:246
@ WINED3DFMT_BC3_TYPELESS
Definition: wined3d.h:233
@ WINED3DFMT_R16G16_TYPELESS
Definition: wined3d.h:190
@ WINED3DFMT_R8_SNORM
Definition: wined3d.h:220
@ WINED3DFMT_YUY2
Definition: wined3d.h:258
@ WINED3DFMT_R16G16_FLOAT
Definition: wined3d.h:191
@ WINED3DFMT_G8R8_G8B8
Definition: wined3d.h:266
@ WINED3DFMT_P8_UINT
Definition: wined3d.h:137
@ WINED3DFMT_R8G8B8A8_UINT
Definition: wined3d.h:187
@ WINED3DFMT_L16_UNORM
Definition: wined3d.h:153
@ WINED3DFMT_R16_SNORM
Definition: wined3d.h:215
@ WINED3DFMT_BC6H_TYPELESS
Definition: wined3d.h:250
@ WINED3DFMT_BC1_UNORM
Definition: wined3d.h:228
@ WINED3DFMT_R32G32B32A32_TYPELESS
Definition: wined3d.h:156
@ WINED3DFMT_R32_TYPELESS
Definition: wined3d.h:196
@ WINED3DFMT_R32G8X24_TYPELESS
Definition: wined3d.h:174
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:214
@ WINED3DFMT_R8_SINT
Definition: wined3d.h:221
@ WINED3DFMT_UYVY
Definition: wined3d.h:257
@ WINED3DFMT_BC5_TYPELESS
Definition: wined3d.h:239
@ WINED3DFMT_R8G8_SINT
Definition: wined3d.h:209
@ WINED3DFMT_R32G32B32A32_SINT
Definition: wined3d.h:159
@ WINED3DFMT_R8G8B8A8_SINT
Definition: wined3d.h:189
@ WINED3DFMT_R10G10B10X2_SNORM
Definition: wined3d.h:146
@ WINED3DFMT_R1_UNORM
Definition: wined3d.h:223
@ WINED3DFMT_ATOC
Definition: wined3d.h:282
@ WINED3DFMT_R11G11B10_FLOAT
Definition: wined3d.h:183
@ WINED3DFMT_B8G8R8A8_UNORM_SRGB
Definition: wined3d.h:247
@ WINED3DFMT_BC3_UNORM_SRGB
Definition: wined3d.h:235
@ WINED3DFMT_A8_UNORM
Definition: wined3d.h:222
@ WINED3DFMT_R32G32B32A32_FLOAT
Definition: wined3d.h:157
@ WINED3DFMT_BC2_TYPELESS
Definition: wined3d.h:230
@ WINED3DFMT_R8G8_B8G8
Definition: wined3d.h:267
@ WINED3DFMT_BC6H_SF16
Definition: wined3d.h:252
@ WINED3DFMT_ATI2N
Definition: wined3d.h:269
@ WINED3DFMT_B4G4R4X4_UNORM
Definition: wined3d.h:133
@ WINED3DFMT_MULTI2_ARGB8
Definition: wined3d.h:265
@ WINED3DFMT_AL16
Definition: wined3d.h:278
@ WINED3DFMT_D24_UNORM_S8_UINT
Definition: wined3d.h:202
@ WINED3DFMT_P8_UINT_A8_UNORM
Definition: wined3d.h:136
@ WINED3DFMT_R16G16B16A16_SNORM
Definition: wined3d.h:168
@ WINED3DFMT_BC4_SNORM
Definition: wined3d.h:238
@ WINED3DFMT_R16G16_SINT
Definition: wined3d.h:195
@ WINED3DFMT_R32G32_TYPELESS
Definition: wined3d.h:170
#define WINED3D_BIND_INDIRECT_BUFFER
Definition: wined3d.h:917
#define WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
Definition: wined3d.h:944
#define WINED3DUSAGE_NPATCHES
Definition: wined3d.h:923
wined3d_texture_op
Definition: wined3d.h:627
@ WINED3D_TOP_SELECT_ARG1
Definition: wined3d.h:629
@ WINED3D_TOP_DISABLE
Definition: wined3d.h:628
@ WINED3D_TOP_BLEND_DIFFUSE_ALPHA
Definition: wined3d.h:639
@ WINED3D_TOP_ADD
Definition: wined3d.h:634
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM
Definition: wined3d.h:642
@ WINED3D_TOP_BLEND_CURRENT_ALPHA
Definition: wined3d.h:643
@ WINED3D_TOP_ADD_SIGNED_2X
Definition: wined3d.h:636
@ WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA
Definition: wined3d.h:648
@ WINED3D_TOP_MULTIPLY_ADD
Definition: wined3d.h:652
@ WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR
Definition: wined3d.h:647
@ WINED3D_TOP_SUBTRACT
Definition: wined3d.h:637
@ WINED3D_TOP_BUMPENVMAP_LUMINANCE
Definition: wined3d.h:650
@ WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA
Definition: wined3d.h:646
@ WINED3D_TOP_MODULATE
Definition: wined3d.h:631
@ WINED3D_TOP_BUMPENVMAP
Definition: wined3d.h:649
@ WINED3D_TOP_MODULATE_4X
Definition: wined3d.h:633
@ WINED3D_TOP_SELECT_ARG2
Definition: wined3d.h:630
@ WINED3D_TOP_LERP
Definition: wined3d.h:653
@ WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR
Definition: wined3d.h:645
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA
Definition: wined3d.h:640
@ WINED3D_TOP_ADD_SIGNED
Definition: wined3d.h:635
@ WINED3D_TOP_DOTPRODUCT3
Definition: wined3d.h:651
@ WINED3D_TOP_PREMODULATE
Definition: wined3d.h:644
@ WINED3D_TOP_ADD_SMOOTH
Definition: wined3d.h:638
@ WINED3D_TOP_MODULATE_2X
Definition: wined3d.h:632
@ WINED3D_TOP_BLEND_FACTOR_ALPHA
Definition: wined3d.h:641
#define WINED3D_VIEW_BUFFER_APPEND
Definition: wined3d.h:1580
#define WINED3D_BIND_DEPTH_STENCIL
Definition: wined3d.h:915
#define WINED3DUSAGE_TEXTAPI
Definition: wined3d.h:929
@ WINED3D_CMP_ALWAYS
Definition: wined3d.h:468
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:53
#define WINED3DUSAGE_MANAGED
Definition: wined3d.h:938
@ WINED3D_VBF_1WEIGHTS
Definition: wined3d.h:452
@ WINED3D_VBF_DISABLE
Definition: wined3d.h:451
@ WINED3D_VBF_3WEIGHTS
Definition: wined3d.h:454
@ WINED3D_VBF_2WEIGHTS
Definition: wined3d.h:453
wined3d_feature_level
Definition: wined3d.h:98
@ WINED3D_FEATURE_LEVEL_11
Definition: wined3d.h:109
@ WINED3D_FEATURE_LEVEL_10_1
Definition: wined3d.h:108
@ WINED3D_FEATURE_LEVEL_8
Definition: wined3d.h:103
@ WINED3D_FEATURE_LEVEL_7
Definition: wined3d.h:102
@ WINED3D_FEATURE_LEVEL_6
Definition: wined3d.h:101
@ WINED3D_FEATURE_LEVEL_9_3
Definition: wined3d.h:106
@ WINED3D_FEATURE_LEVEL_10
Definition: wined3d.h:107
@ WINED3D_FEATURE_LEVEL_11_1
Definition: wined3d.h:110
@ WINED3D_FEATURE_LEVEL_5
Definition: wined3d.h:100
@ WINED3D_FEATURE_LEVEL_9_1
Definition: wined3d.h:104
@ WINED3D_FEATURE_LEVEL_9_2
Definition: wined3d.h:105
#define WINED3D_VIEW_BUFFER_COUNTER
Definition: wined3d.h:1581
@ WINED3D_TTFF_DISABLE
Definition: wined3d.h:618
@ WINED3D_TTFF_COUNT3
Definition: wined3d.h:621
@ WINED3D_TTFF_COUNT1
Definition: wined3d.h:619
@ WINED3D_TTFF_PROJECTED
Definition: wined3d.h:623
wined3d_shader_type
Definition: wined3d.h:840
@ WINED3D_SHADER_TYPE_HULL
Definition: wined3d.h:844
@ WINED3D_SHADER_TYPE_PIXEL
Definition: wined3d.h:841
@ WINED3D_SHADER_TYPE_GEOMETRY
Definition: wined3d.h:843
@ WINED3D_SHADER_TYPE_GRAPHICS_COUNT
Definition: wined3d.h:846
@ WINED3D_SHADER_TYPE_DOMAIN
Definition: wined3d.h:845
@ WINED3D_SHADER_TYPE_COMPUTE
Definition: wined3d.h:848
@ WINED3D_SHADER_TYPE_VERTEX
Definition: wined3d.h:842
@ WINED3D_SHADER_TYPE_COUNT
Definition: wined3d.h:849
#define WINED3D_BIND_RENDER_TARGET
Definition: wined3d.h:914
#define WINED3DUSAGE_QUERY_VERTEXTEXTURE
Definition: wined3d.h:947
#define WINED3DUSAGE_QUERY_GENMIPMAP
Definition: wined3d.h:941
#define WINED3DUSAGE_RTPATCHES
Definition: wined3d.h:922
#define WINED3D_HIGHEST_TEXTURE_STATE
Definition: wined3d.h:614
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:924
wined3d_transform_state
Definition: wined3d.h:666
@ WINED3D_TS_TEXTURE1
Definition: wined3d.h:670
@ WINED3D_TS_TEXTURE0
Definition: wined3d.h:669
@ WINED3D_TS_TEXTURE2
Definition: wined3d.h:671
@ WINED3D_TS_PROJECTION
Definition: wined3d.h:668
@ WINED3D_TS_VIEW
Definition: wined3d.h:667
@ WINED3D_TS_TEXTURE7
Definition: wined3d.h:676
@ WINED3D_TS_TEXTURE6
Definition: wined3d.h:675
@ WINED3D_TS_TEXTURE4
Definition: wined3d.h:673
@ WINED3D_TS_TEXTURE3
Definition: wined3d.h:672
@ WINED3D_TS_TEXTURE5
Definition: wined3d.h:674
#define WINED3DUSAGE_QUERY_SRGBWRITE
Definition: wined3d.h:946
#define WINED3D_MAX_FFP_TEXTURES
Definition: wined3d.h:1597
#define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER
Definition: wined3d.h:926
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:936
wined3d_device_type
Definition: wined3d.h:90
@ WINED3D_DEVICE_TYPE_SW
Definition: wined3d.h:93
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:91
@ WINED3D_DEVICE_TYPE_REF
Definition: wined3d.h:92
#define WINED3D_BIND_CONSTANT_BUFFER
Definition: wined3d.h:911
#define WINED3D_BIND_STREAM_OUTPUT
Definition: wined3d.h:913
#define WINED3D_SRGB_READ_WRITE_CONTROL
Definition: wined3d.h:1330
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:910
wined3d_input_classification
Definition: wined3d.h:1825
@ WINED3D_INPUT_PER_INSTANCE_DATA
Definition: wined3d.h:1827
@ WINED3D_INPUT_PER_VERTEX_DATA
Definition: wined3d.h:1826
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54
#define WINED3DUSAGE_SOFTWAREPROCESSING
Definition: wined3d.h:919
#define WINED3DTA_TEXTURE
Definition: wined3d.h:883
#define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE
Definition: wined3d.h:927
wined3d_gl_extension
Definition: wined3d_gl.h:42
@ ARB_TEXTURE_CUBE_MAP
Definition: wined3d_gl.h:130
@ ARB_INTERNALFORMAT_QUERY
Definition: wined3d_gl.h:91
@ WINED3D_GL_EXT_NONE
Definition: wined3d_gl.h:43
@ ARB_FRAGMENT_PROGRAM
Definition: wined3d_gl.h:80
@ ARB_DEPTH_TEXTURE
Definition: wined3d_gl.h:68
@ EXT_TEXTURE_SHARED_EXPONENT
Definition: wined3d_gl.h:200
@ ATI_TEXTURE_COMPRESSION_3DC
Definition: wined3d_gl.h:163
@ ARB_VERTEX_PROGRAM
Definition: wined3d_gl.h:154
@ ARB_TEXTURE_COMPRESSION_RGTC
Definition: wined3d_gl.h:129
@ EXT_TEXTURE_SRGB_DECODE
Definition: wined3d_gl.h:203
@ ARB_VERTEX_BUFFER_OBJECT
Definition: wined3d_gl.h:153
@ EXT_TEXTURE_INTEGER
Definition: wined3d_gl.h:196
@ ARB_ES2_COMPATIBILITY
Definition: wined3d_gl.h:75
@ ARB_MULTISAMPLE
Definition: wined3d_gl.h:95
@ ARB_TEXTURE_FLOAT
Definition: wined3d_gl.h:135
@ ARB_FRAMEBUFFER_OBJECT
Definition: wined3d_gl.h:84
@ ARB_VERTEX_SHADER
Definition: wined3d_gl.h:155
@ EXT_TEXTURE3D
Definition: wined3d_gl.h:190
@ ARB_TEXTURE_RG
Definition: wined3d_gl.h:142
@ ARB_TEXTURE_MULTISAMPLE
Definition: wined3d_gl.h:139
@ ARB_TEXTURE_RGB10_A2UI
Definition: wined3d_gl.h:143
@ ARB_INTERNALFORMAT_QUERY2
Definition: wined3d_gl.h:92
@ ARB_HALF_FLOAT_VERTEX
Definition: wined3d_gl.h:89
@ EXT_PACKED_FLOAT
Definition: wined3d_gl.h:183
@ EXT_PACKED_DEPTH_STENCIL
Definition: wined3d_gl.h:182
@ EXT_TEXTURE_SRGB
Definition: wined3d_gl.h:202
@ ARB_SHADOW
Definition: wined3d_gl.h:120
@ EXT_TEXTURE_COMPRESSION_RGTC
Definition: wined3d_gl.h:192
@ ARB_FRAGMENT_SHADER
Definition: wined3d_gl.h:82
@ EXT_FRAMEBUFFER_MULTISAMPLE
Definition: wined3d_gl.h:176
@ ARB_VERTEX_ARRAY_BGRA
Definition: wined3d_gl.h:152
@ EXT_DEPTH_BOUNDS_TEST
Definition: wined3d_gl.h:172
@ ARB_VERTEX_TYPE_2_10_10_10_REV
Definition: wined3d_gl.h:157
@ ARB_HALF_FLOAT_PIXEL
Definition: wined3d_gl.h:88
@ APPLE_YCBCR_422
Definition: wined3d_gl.h:51
@ NV_TEXTURE_SHADER
Definition: wined3d_gl.h:217
@ WINED3D_GL_LEGACY_CONTEXT
Definition: wined3d_gl.h:232
@ APPLE_RGB_422
Definition: wined3d_gl.h:50
@ ARB_TEXTURE_COMPRESSION_BPTC
Definition: wined3d_gl.h:128
@ EXT_TEXTURE_COMPRESSION_S3TC
Definition: wined3d_gl.h:193
@ EXT_TEXTURE_SNORM
Definition: wined3d_gl.h:201
@ ARB_VERTEX_TYPE_10F_11F_11F_REV
Definition: wined3d_gl.h:156
@ ARB_DEPTH_BUFFER_FLOAT
Definition: wined3d_gl.h:66
#define GL_EXTCALL(f)
Definition: wined3d_gl.h:360
#define WINED3D_QUIRK_LIMITED_TEX_FILTERING
Definition: wined3d_gl.h:329
#define WINED3D_QUIRK_BROKEN_RGBA16
Definition: wined3d_gl.h:327
#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI
Definition: wined3d_gl.h:38
#define checkGLcall(A)
Definition: wined3d_gl.h:402
#define WINED3D_FORMAT_CAP_VERTEX_ATTRIBUTE
#define WINED3D_FORMAT_CAP_FBO_ATTACHABLE_SRGB
static float float_24_to_32(DWORD in)
static BOOL wined3d_format_is_typeless(const struct wined3d_format *format)
#define STATE_IS_GRAPHICS_CONSTANT_BUFFER(a)
#define WINED3D_FORMAT_ATTR_FLOAT
#define WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY
#define WINED3D_FORMAT_CAP_UNORDERED_ACCESS
#define STATE_CLIPPLANE(a)
#define STATE_CONSTANT_BUFFER(a)
#define WINED3D_FORMAT_ATTR_HEIGHT_SCALE
wined3d_channel_type
@ WINED3D_CHANNEL_TYPE_UNUSED
@ WINED3D_CHANNEL_TYPE_UNORM
@ WINED3D_CHANNEL_TYPE_STENCIL
@ WINED3D_CHANNEL_TYPE_FLOAT
@ WINED3D_CHANNEL_TYPE_SNORM
@ WINED3D_CHANNEL_TYPE_NONE
@ WINED3D_CHANNEL_TYPE_UINT
@ WINED3D_CHANNEL_TYPE_SINT
@ WINED3D_CHANNEL_TYPE_DEPTH
#define STATE_IS_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING(a)
#define WINED3D_LOCATION_TEXTURE_SRGB
static struct color_fixup_desc create_complex_fixup_desc(enum complex_fixup complex_fixup)
#define STATE_IS_STREAM_OUTPUT(a)
#define WINED3D_FFP_TCI_SHIFT
#define WINED3D_LOCATION_SYSMEM
#define STATE_IS_VDECL(a)
wined3d_ffp_emit_idx
@ WINED3D_FFP_EMIT_D3DCOLOR
@ WINED3D_FFP_EMIT_FLOAT16_2
@ WINED3D_FFP_EMIT_UBYTE4N
@ WINED3D_FFP_EMIT_FLOAT2
@ WINED3D_FFP_EMIT_SHORT4N
@ WINED3D_FFP_EMIT_USHORT2N
@ WINED3D_FFP_EMIT_SHORT2N
@ WINED3D_FFP_EMIT_UBYTE4
@ WINED3D_FFP_EMIT_FLOAT4
@ WINED3D_FFP_EMIT_INVALID
@ WINED3D_FFP_EMIT_UDEC3
@ WINED3D_FFP_EMIT_DEC3N
@ WINED3D_FFP_EMIT_FLOAT3
@ WINED3D_FFP_EMIT_FLOAT16_4
@ WINED3D_FFP_EMIT_USHORT4N
@ WINED3D_FFP_EMIT_SHORT2
@ WINED3D_FFP_EMIT_SHORT4
@ WINED3D_FFP_EMIT_FLOAT1
#define STATE_IS_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING(a)
#define MAKEDWORD_VERSION(maj, min)
wined3d_pci_vendor
#define WINED3D_FORMAT_CAP_DECOMPRESS
#define ARG_UNUSED
static BOOL use_vs(const struct wined3d_state *state)
#define WINED3D_FORMAT_CAP_SHADOW
#define WINED3D_FORMAT_CAP_TEXTURE
#define STATE_IS_BLEND_FACTOR(a)
#define STATE_IS_STREAMSRC(a)
#define WINED3D_FORMAT_ATTR_EXTENSION
#define STATE_IS_BLEND(a)
#define WINED3D_FORMAT_ATTR_INTEGER
#define WINED3D_FORMAT_CAP_INDEX_BUFFER
static enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup)
#define STATE_SHADER(a)
#define WINED3D_ALLOCATOR_MIN_BLOCK_SIZE
static struct wined3d_texture * wined3d_state_get_ffp_texture(const struct wined3d_state *state, unsigned int idx)
#define WINED3D_LOCATION_BUFFER
#define STATE_IS_TEXTURESTAGE(a)
#define WINED3D_FORMAT_ATTR_BROKEN_PITCH
static BOOL is_complex_fixup(struct color_fixup_desc fixup)
fixup_channel_source
@ CHANNEL_SOURCE_COMPLEX1
@ CHANNEL_SOURCE_ONE
@ CHANNEL_SOURCE_W
@ CHANNEL_SOURCE_X
@ CHANNEL_SOURCE_ZERO
@ CHANNEL_SOURCE_Z
@ CHANNEL_SOURCE_Y
@ CHANNEL_SOURCE_COMPLEX0
#define WINED3D_FFP_TCI_MASK
#define WINED3D_FORMAT_ATTR_MAPPABLE
#define WINED3D_LOCATION_RB_RESOLVED
#define WINED3D_FORMAT_ATTR_COMPRESSED
#define WINED3D_MAX_ACTIVE_LIGHTS
#define STATE_IS_CLIPPLANE(a)
static enum wined3d_cmp_func wined3d_sanitize_cmp_func(enum wined3d_cmp_func func)
static void wined3d_colour_srgb_from_linear(struct wined3d_color *colour_srgb, const struct wined3d_color *colour)
#define STATE_IS_VIEWPORT(a)
#define WINED3D_ALLOCATOR_CHUNK_ORDER_COUNT
static BOOL can_use_texture_swizzle(const struct wined3d_d3d_info *d3d_info, const struct wined3d_format *format)
#define STATE_IS_STENCIL_REF(a)
#define WINED3D_FORMAT_CAP_SRGB_WRITE
static uint32_t wined3d_mask_from_size(unsigned int size)
#define WINED3D_FORMAT_CAP_FILTERING
#define WINED3D_ALLOCATOR_CHUNK_SIZE
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY
#define STATE_IS_RENDER(a)
#define STATE_IS_COMPUTE_SHADER_RESOURCE_BINDING(a)
#define WINED3D_FORMAT_CAP_FBO_ATTACHABLE
@ FOGSOURCE_VS
@ FOGSOURCE_FFP
#define WINED3D_TEXTURE_ASYNC_COLOR_KEY
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
wined3d_gl_resource_type
@ WINED3D_GL_RES_TYPE_TEX_3D
@ WINED3D_GL_RES_TYPE_TEX_CUBE
@ WINED3D_GL_RES_TYPE_BUFFER
@ WINED3D_GL_RES_TYPE_TEX_2D
@ WINED3D_GL_RES_TYPE_RB
@ WINED3D_GL_RES_TYPE_TEX_1D
@ WINED3D_GL_RES_TYPE_COUNT
#define WINED3D_LOCATION_TEXTURE_RGB
#define WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING
static void wined3d_get_material_colour_source(enum wined3d_material_color_source *diffuse, enum wined3d_material_color_source *emissive, enum wined3d_material_color_source *ambient, enum wined3d_material_color_source *specular, const struct wined3d_state *state)
#define WINED3D_FORMAT_CAP_DEPTH_STENCIL
#define WINED3D_FORMAT_ATTR_NORMALISED
static BOOL needs_srgb_write(const struct wined3d_d3d_info *d3d_info, const struct wined3d_state *state, const struct wined3d_fb_state *fb)
#define WINED3D_FORMAT_CAP_VTF
#define WINED3D_LOCATION_DRAWABLE
#define STATE_IS_COMPUTE_SHADER(a)
#define WINED3D_LOCATION_CLEARED
@ WINED3D_FFP_VS_FOG_FOGCOORD
@ WINED3D_FFP_VS_FOG_OFF
@ WINED3D_FFP_VS_FOG_DEPTH
@ WINED3D_FFP_VS_FOG_RANGE
complex_fixup
@ COMPLEX_FIXUP_P8
@ COMPLEX_FIXUP_YUY2
@ COMPLEX_FIXUP_UYVY
@ COMPLEX_FIXUP_NV12
@ COMPLEX_FIXUP_YV12
@ COMPLEX_FIXUP_YUV
#define WINED3D_LOCATION_DISCARDED
#define STATE_TEXTURESTAGE(stage, num)
#define WINED3D_FORMAT_CAP_RENDERTARGET
#define STATE_IS_DEPTH_STENCIL(a)
#define STATE_IS_COMPUTE_CONSTANT_BUFFER(a)
@ WINED3D_FFP_PS_FOG_EXP
@ WINED3D_FFP_PS_FOG_OFF
@ WINED3D_FFP_PS_FOG_EXP2
@ WINED3D_FFP_PS_FOG_LINEAR
#define WINED3D_FORMAT_CAP_BLIT
#define STATE_IS_SCISSORRECT(a)
#define STATE_IS_RASTERIZER(a)
#define STATE_IS_FRAMEBUFFER(a)
#define STATE_IS_GRAPHICS_SHADER_RESOURCE_BINDING(a)
#define WINED3D_LOCATION_RB_MULTISAMPLE
#define WINED3D_FORMAT_ATTR_BLOCKS
#define STATE_IS_INDEXBUFFER(a)
#define WINED3D_FORMAT_CAP_SRGB_READ
#define STATE_IS_DEPTH_BOUNDS(a)
#define STATE_RENDER(a)
#define WINED3D_FORMAT_ATTR_CAST_TO_BLOCK
#define STATE_IS_GRAPHICS_SHADER(a)
@ WINED3D_PROJECTION_COUNT3
@ WINED3D_PROJECTION_NONE
@ WINED3D_PROJECTION_COUNT4
#define STATE_IS_SAMPLE_MASK(a)
#define STATE_IS_BASEVERTEXINDEX(a)
#define WINED3D_FORMAT_CAP_GEN_MIPMAP
static unsigned int wined3d_popcount(unsigned int x)
#define WINED3D_FORMAT_ATTR_BUMPMAP
#define VK_CALL(f)
Definition: wined3d_vk.h:272
#define DISPLAY_DEVICE_PRIMARY_DEVICE
Definition: wingdi.h:1398
#define snprintf
Definition: wintirpc.h:48
int * display
Definition: x11stubs.c:12
static unsigned int block
Definition: xmlmemory.c:101
unsigned char BYTE
Definition: xxhash.c:193
#define const
Definition: zconf.h:233