36#define WINED3D_FORMAT_FOURCC_BASE (WINED3DFMT_BC7_UNORM_SRGB + 1)
70#define WINED3D_FORMAT_COUNT (WINED3D_FORMAT_FOURCC_BASE + ARRAY_SIZE(format_index_remap))
85 {
WINED3DFMT_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
87 {
WINED3DFMT_UYVY, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
88 {
WINED3DFMT_YUY2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
89 {
WINED3DFMT_YV12, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
90 {
WINED3DFMT_NV12, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
91 {
WINED3DFMT_DXT1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
92 {
WINED3DFMT_DXT2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
93 {
WINED3DFMT_DXT3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
94 {
WINED3DFMT_DXT4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
95 {
WINED3DFMT_DXT5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
96 {
WINED3DFMT_MULTI2_ARGB8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
97 {
WINED3DFMT_G8R8_G8B8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
98 {
WINED3DFMT_R8G8_B8G8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
100 {
WINED3DFMT_R8G8_SNORM_Cx, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
101 {
WINED3DFMT_R11G11B10_FLOAT, 11, 11, 10, 0, 0, 11, 22, 0, 4, 0, 0},
103 {
WINED3DFMT_P8_UINT_A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 8, 2, 0, 0},
104 {
WINED3DFMT_P8_UINT, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
106 {
WINED3DFMT_B8G8R8_UNORM, 8, 8, 8, 0, 16, 8, 0, 0, 3, 0, 0},
107 {
WINED3DFMT_B5G6R5_UNORM, 5, 6, 5, 0, 11, 5, 0, 0, 2, 0, 0},
108 {
WINED3DFMT_B5G5R5X1_UNORM, 5, 5, 5, 0, 10, 5, 0, 0, 2, 0, 0},
109 {
WINED3DFMT_B5G5R5A1_UNORM, 5, 5, 5, 1, 10, 5, 0, 15, 2, 0, 0},
110 {
WINED3DFMT_B4G4R4A4_UNORM, 4, 4, 4, 4, 8, 4, 0, 12, 2, 0, 0},
111 {
WINED3DFMT_B2G3R3_UNORM, 3, 3, 2, 0, 5, 2, 0, 0, 1, 0, 0},
112 {
WINED3DFMT_A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 0, 1, 0, 0},
113 {
WINED3DFMT_B2G3R3A8_UNORM, 3, 3, 2, 8, 5, 2, 0, 8, 2, 0, 0},
114 {
WINED3DFMT_B4G4R4X4_UNORM, 4, 4, 4, 0, 8, 4, 0, 0, 2, 0, 0},
115 {
WINED3DFMT_R8G8B8X8_UNORM, 8, 8, 8, 0, 0, 8, 16, 0, 4, 0, 0},
116 {
WINED3DFMT_B10G10R10A2_UNORM, 10, 10, 10, 2, 20, 10, 0, 30, 4, 0, 0},
118 {
WINED3DFMT_L8_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
119 {
WINED3DFMT_L8A8_UNORM, 0, 0, 0, 8, 0, 0, 0, 8, 2, 0, 0},
120 {
WINED3DFMT_L4A4_UNORM, 0, 0, 0, 4, 0, 0, 0, 4, 1, 0, 0},
121 {
WINED3DFMT_L16_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
123 {
WINED3DFMT_R5G5_SNORM_L6_UNORM, 5, 5, 0, 0, 0, 5, 0, 0, 2, 0, 0},
124 {
WINED3DFMT_R8G8_SNORM_L8X8_UNORM, 8, 8, 0, 0, 0, 8, 0, 0, 4, 0, 0},
125 {
WINED3DFMT_R8G8B8A8_SNORM, 8, 8, 8, 8, 0, 8, 16, 24, 4, 0, 0},
126 {
WINED3DFMT_R10G11B11_SNORM, 10, 11, 11, 0, 0, 10, 21, 0, 4, 0, 0},
127 {
WINED3DFMT_R10G10B10X2_UINT, 10, 10, 10, 0, 0, 10, 20, 0, 4, 0, 0},
128 {
WINED3DFMT_R10G10B10X2_SNORM, 10, 10, 10, 0, 0, 10, 20, 0, 4, 0, 0},
129 {
WINED3DFMT_R10G10B10_SNORM_A2_UNORM, 10, 10, 10, 2, 0, 10, 20, 30, 4, 0, 0},
131 {
WINED3DFMT_D16_LOCKABLE, 0, 0, 0, 0, 0, 0, 0, 0, 2, 16, 0},
132 {
WINED3DFMT_D32_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 32, 0},
133 {
WINED3DFMT_S1_UINT_D15_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 2, 15, 1},
134 {
WINED3DFMT_X8D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 0},
135 {
WINED3DFMT_S4X4_UINT_D24_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 4},
136 {
WINED3DFMT_D16_UNORM, 0, 0, 0, 0, 0, 0, 0, 0, 2, 16, 0},
137 {
WINED3DFMT_D32_FLOAT, 0, 0, 0, 0, 0, 0, 0, 0, 4, 32, 0},
138 {
WINED3DFMT_S8_UINT_D24_FLOAT, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8},
140 {
WINED3DFMT_ATI1N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
141 {
WINED3DFMT_ATI2N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
142 {
WINED3DFMT_NVDB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
143 {
WINED3DFMT_INST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
144 {
WINED3DFMT_INTZ, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8},
145 {
WINED3DFMT_RESZ, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
146 {
WINED3DFMT_NVHU, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
147 {
WINED3DFMT_NVHS, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
148 {
WINED3DFMT_NULL, 8, 8, 8, 8, 0, 8, 16, 24, 4, 0, 0},
150 {
WINED3DFMT_R16, 16, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
151 {
WINED3DFMT_AL16, 0, 0, 0, 16, 0, 0, 0, 16, 4, 0, 0},
153 {
WINED3DFMT_R9G9B9E5_SHAREDEXP, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0},
155 {
WINED3DFMT_R32G32B32A32_TYPELESS, 32, 32, 32, 32, 0, 32, 64, 96, 16, 0, 0},
156 {
WINED3DFMT_R32G32B32_TYPELESS, 32, 32, 32, 0, 0, 32, 64, 0, 12, 0, 0},
157 {
WINED3DFMT_R16G16B16A16_TYPELESS, 16, 16, 16, 16, 0, 16, 32, 48, 8, 0, 0},
158 {
WINED3DFMT_R32G32_TYPELESS, 32, 32, 0, 0, 0, 32, 0, 0, 8, 0, 0},
159 {
WINED3DFMT_R32G8X24_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 8, 32, 8},
160 {
WINED3DFMT_R10G10B10A2_TYPELESS, 10, 10, 10, 2, 0, 10, 20, 30, 4, 0, 0},
161 {
WINED3DFMT_R8G8B8A8_TYPELESS, 8, 8, 8, 8, 0, 8, 16, 24, 4, 0, 0},
162 {
WINED3DFMT_R16G16_TYPELESS, 16, 16, 0, 0, 0, 16, 0, 0, 4, 0, 0},
163 {
WINED3DFMT_R32_TYPELESS, 32, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0},
164 {
WINED3DFMT_R24G8_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8},
165 {
WINED3DFMT_R8G8_TYPELESS, 8, 8, 0, 0, 0, 8, 0, 0, 2, 0, 0},
166 {
WINED3DFMT_R16_TYPELESS, 16, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0},
167 {
WINED3DFMT_R8_TYPELESS, 8, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
168 {
WINED3DFMT_BC1_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
169 {
WINED3DFMT_BC2_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
170 {
WINED3DFMT_BC3_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
171 {
WINED3DFMT_BC4_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
172 {
WINED3DFMT_BC5_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
173 {
WINED3DFMT_BC6H_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
174 {
WINED3DFMT_BC7_TYPELESS, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
175 {
WINED3DFMT_B8G8R8A8_TYPELESS, 8, 8, 8, 8, 16, 8, 0, 24, 4, 0, 0},
176 {
WINED3DFMT_B8G8R8X8_TYPELESS, 8, 8, 8, 0, 16, 8, 0, 0, 4, 0, 0},
438 unsigned int dst_row_pitch,
unsigned int dst_slice_pitch,
441 unsigned int dst_row_pitch,
unsigned int dst_slice_pitch,
452 unsigned int x,
y,
z;
453 const unsigned char *
Source;
460 Source =
src +
z * src_slice_pitch +
y * src_row_pitch;
461 Dest =
dst +
z * dst_slice_pitch +
y * dst_row_pitch;
465 Dest[1] = (
color & 0xf0u) << 0;
466 Dest[0] = (
color & 0x0fu) << 4;
476 unsigned int x,
y,
z;
477 unsigned char r_in,
g_in, l_in;
478 const unsigned short *texel_in;
479 unsigned short *texel_out;
489 texel_out = (
unsigned short *) (
dst +
z * dst_slice_pitch +
y * dst_row_pitch);
490 texel_in = (
const unsigned short *)(
src +
z * src_slice_pitch +
y * src_row_pitch);
493 l_in = (*texel_in & 0xfc00u) >> 10;
494 g_in = (*texel_in & 0x03e0u) >> 5;
495 r_in = *texel_in & 0x001fu;
497 *texel_out = ((r_in + 16) << 11) | (l_in << 5) | (
g_in + 16);
508 unsigned int x,
y,
z;
509 unsigned char *texel_out, r_out,
g_out, r_in,
g_in, l_in;
510 const unsigned short *texel_in;
516 texel_in = (
const unsigned short *)(
src +
z * src_slice_pitch +
y * src_row_pitch);
517 texel_out =
dst +
z * dst_slice_pitch +
y * dst_row_pitch;
520 l_in = (*texel_in & 0xfc00u) >> 10;
521 g_in = (*texel_in & 0x03e0u) >> 5;
522 r_in = *texel_in & 0x001fu;
532 texel_out[0] = r_out;
533 texel_out[1] =
g_out;
534 texel_out[2] = l_in << 1 | l_in >> 5;
547 unsigned int x,
y,
z;
548 unsigned char *texel_out, ds_out, dt_out, r_in,
g_in, l_in;
549 const unsigned short *texel_in;
563 texel_in = (
const unsigned short *)(
src +
z * src_slice_pitch +
y * src_row_pitch);
564 texel_out =
dst +
z * dst_slice_pitch +
y * dst_row_pitch;
567 l_in = (*texel_in & 0xfc00u) >> 10;
568 g_in = (*texel_in & 0x03e0u) >> 5;
569 r_in = *texel_in & 0x001fu;
579 texel_out[0] = ds_out;
580 texel_out[1] = dt_out;
581 texel_out[2] = l_in << 1 | l_in >> 5;
593 unsigned int x,
y,
z;
601 Source = (
const short *)(
src +
z * src_slice_pitch +
y * src_row_pitch);
602 Dest =
dst +
z * dst_slice_pitch +
y * dst_row_pitch;
607 Dest[1] = (
color >> 8) + 128;
608 Dest[2] = (
color & 0xff) + 128;
618 unsigned int x,
y,
z;
631 Dest =
dst +
z * dst_slice_pitch +
y * dst_row_pitch;
635 Dest[0] = ((
color >> 16) & 0xff);
636 Dest[1] = ((
color >> 8 ) & 0xff) + 128;
637 Dest[2] = (
color & 0xff) + 128;
647 unsigned int x,
y,
z;
659 Dest =
dst +
z * dst_slice_pitch +
y * dst_row_pitch;
663 Dest[2] = ((
color >> 16) & 0xff);
664 Dest[1] = ((
color >> 8 ) & 0xff);
665 Dest[0] = (
color & 0xff);
676 unsigned int x,
y,
z;
685 Dest =
dst +
z * dst_slice_pitch +
y * dst_row_pitch;
689 Dest[0] = ((
color >> 16) & 0xff) + 128;
690 Dest[1] = ((
color >> 8 ) & 0xff) + 128;
691 Dest[2] = (
color & 0xff) + 128;
692 Dest[3] = ((
color >> 24) & 0xff) + 128;
702 unsigned int x,
y,
z;
704 unsigned short *Dest;
711 Dest = (
unsigned short *) (
dst +
z * dst_slice_pitch +
y * dst_row_pitch);
716 Dest[1] = (
color >> 16) + 32768;
717 Dest[2] = (
color & 0xffff) + 32768;
727 unsigned int x,
y,
z;
735 Source = (
const WORD *)(
src +
z * src_slice_pitch +
y * src_row_pitch);
736 Dest = (
WORD *) (
dst +
z * dst_slice_pitch +
y * dst_row_pitch);
755 unsigned int x,
y,
z;
763 Source = (
const float *)(
src +
z * src_slice_pitch +
y * src_row_pitch);
764 Dest = (
float *) (
dst +
z * dst_slice_pitch +
y * dst_row_pitch);
781 unsigned int x,
y,
z;
796 DWORD d24 = (d15 << 9) + (d15 >> 6);
806 unsigned int x,
y,
z;
827 unsigned int x,
y,
z;
834 float *dest_f = (
float *)(
dst +
z * dst_slice_pitch +
y * dst_row_pitch);
840 dest_s[
x * 2 + 1] =
source[
x] & 0xff;
847 unsigned int src_row_pitch,
unsigned int src_slice_pitch,
848 unsigned int dst_row_pitch,
unsigned int dst_slice_pitch,
851 unsigned int x,
y,
z;
869 unsigned int src_row_pitch,
unsigned int src_slice_pitch,
870 unsigned int dst_row_pitch,
unsigned int dst_slice_pitch,
873 unsigned int x,
y,
z;
909 FIXME(
"P8 surface loaded without a palette.\n");
921 src_row = &
src[src_pitch *
y];
925 BYTE src_color = src_row[
x];
926 dst_row[
x] = 0xff000000
927 | (
palette->colors[src_color].rgbRed << 16)
928 | (
palette->colors[src_color].rgbGreen << 8)
929 |
palette->colors[src_color].rgbBlue;
944 src_row = (
WORD *)&
src[src_pitch *
y];
945 dst_row = (
WORD *)&
dst[dst_pitch *
y];
948 WORD src_color = src_row[
x];
950 dst_row[
x] = 0x8000u | ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
952 dst_row[
x] = ((src_color & 0xffc0u) >> 1) | (src_color & 0x1fu);
967 src_row = (
WORD *)&
src[src_pitch *
y];
968 dst_row = (
WORD *)&
dst[dst_pitch *
y];
971 WORD src_color = src_row[
x];
973 dst_row[
x] = src_color & ~0x8000;
975 dst_row[
x] = src_color | 0x8000;
990 src_row = &
src[src_pitch *
y];
994 DWORD src_color = (src_row[
x * 3 + 2] << 16) | (src_row[
x * 3 + 1] << 8) | src_row[
x * 3];
996 dst_row[
x] = src_color | 0xff000000;
1005 const DWORD *src_row;
1015 DWORD src_color = src_row[
x];
1017 dst_row[
x] = src_color & ~0xff000000;
1019 dst_row[
x] = src_color | 0xff000000;
1028 const DWORD *src_row;
1038 DWORD src_color = src_row[
x];
1040 src_color &= ~0xff000000;
1041 dst_row[
x] = src_color;
1074 if (color_key_info[
i].src_format ==
format->id)
1075 return &color_key_info[
i].conversion;
1777 return &gl_info->
formats[fmt_idx];
1824 ERR(
"Invalid channel type '%c'.\n",
t);
1838 ERR(
"Failed to allocate memory.\n");
1860 format->block_height = 1;
1890 format->typeless_id = typeless_format->
id;
1975 ERR(
"Unexpected GL resource type %u.\n",
type);
1989 gl_info->
gl_ops.gl.p_glDeleteTextures(1, &
object);
1993 gl_info->
fbo_ops.glDeleteRenderbuffers(1, &
object);
2012 gl_info->
gl_ops.gl.p_glGenTextures(1,
object);
2027 gl_info->
gl_ops.gl.p_glGenTextures(1,
object);
2042 gl_info->
gl_ops.gl.p_glGenTextures(1,
object);
2056 gl_info->
gl_ops.gl.p_glGenTextures(1,
object);
2081 gl_info->
fbo_ops.glGenRenderbuffers(1,
object);
2101 while (gl_info->
gl_ops.gl.p_glGetError());
2110 {-1.0f, -1.0f, 0.0f},
2111 { 1.0f, -1.0f, 0.0f},
2112 {-1.0f, 1.0f, 0.0f},
2113 { 1.0f, 1.0f, 0.0f},
2115 static const char vs_core_header[] =
2119 "out vec4 out_color;\n"
2121 static const char vs_legacy_header[] =
2123 "attribute vec4 pos;\n"
2124 "attribute vec4 color;\n"
2125 "varying vec4 out_color;\n"
2127 static const char vs_body[] =
2130 " gl_Position = pos;\n"
2131 " out_color = color;\n"
2133 static const char fs_core[] =
2135 "in vec4 out_color;\n"
2136 "out vec4 fragment_color;\n"
2140 " fragment_color = out_color;\n"
2142 static const char fs_legacy[] =
2144 "varying vec4 out_color;\n"
2148 " gl_FragData[0] = out_color;\n"
2155 geometry = default_geometry;
2162 gl_info->
gl_ops.gl.p_glLoadIdentity();
2164 gl_info->
gl_ops.gl.p_glLoadIdentity();
2168 for (
i = 0;
i < 4; ++
i)
2169 gl_info->
gl_ops.gl.p_glVertex3fv(&geometry[
i].
x);
2170 gl_info->
gl_ops.gl.p_glEnd();
2184 if (!
ctx->test_program_id)
2198 source[0] = use_glsl_150 ? vs_core_header : vs_legacy_header;
2205 source[0] = use_glsl_150 ? fs_core : fs_legacy;
2210 GL_EXTCALL(glBindAttribLocation(
ctx->test_program_id, 0,
"pos"));
2211 GL_EXTCALL(glBindAttribLocation(
ctx->test_program_id, 1,
"color"));
2214 GL_EXTCALL(glBindFragDataLocation(
ctx->test_program_id, 0,
"fragment_color"));
2240 static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 1.0f};
2241 static const struct wined3d_color half_transparent_red = {1.0f, 0.0f, 0.0f, 0.5f};
2252 const char *type_string =
"color";
2262 gl_info->
fbo_ops.glGenRenderbuffers(1, &color_rb);
2271 checkGLcall(
"Create and attach color rb attachment");
2272 type_string =
"depth / stencil";
2280 TRACE(
"Format %s is supported as FBO %s attachment, type %u.\n",
2284 regular_fmt_used =
TRUE;
2292 WARN(
"Format %s with rendertarget flag is not supported as FBO color attachment (type %u),"
2294 format->flags[
type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2298 TRACE(
"Format %s is not supported as FBO %s attachment, type %u.\n",
2305 TRACE(
"Format %s is not supported as FBO %s attachment (type %u),"
2306 " trying rtInternal format as fallback.\n",
2309 while (gl_info->
gl_ops.gl.p_glGetError());
2320 TRACE(
"Format %s rtInternal format is supported as FBO %s attachment, type %u.\n",
2322 fallback_fmt_used =
TRUE;
2326 WARN(
"Format %s rtInternal format is not supported as FBO %s attachment, type %u.\n",
2328 format->flags[
type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2341 DWORD readback[16 * 16 * 16],
color, r_range, a_range;
2349 gl_info->
fbo_ops.glGenRenderbuffers(1, &rb);
2361 gl_info->
gl_ops.gl.p_glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
2365 while (gl_info->
gl_ops.gl.p_glGetError());
2366 TRACE(
"Format %s doesn't support post-pixelshader blending, type %u.\n",
2368 format->flags[
type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
2374 gl_info->
gl_ops.gl.p_glViewport(0, 0, 16, 1);
2376 gl_info->
gl_ops.gl.p_glViewport(0, 0, 16, 16);
2394 color = readback[7];
2404 color = readback[7 * 16 + 7];
2412 color = readback[7 * 16 + 7];
2416 gl_info->
gl_ops.gl.p_glReadPixels(0, 0, 16, 16,
2418 color = readback[7 * 16 + 7];
2429 r = (
color & 0x00ff0000u) >> 16;
2431 r_range =
format->red_size < 8 ? 1u << (8 -
format->red_size) : 1;
2432 a_range =
format->alpha_size < 8 ? 1u << (8 -
format->alpha_size) : 1;
2433 if (
format->red_size && (r < 0x7f - r_range || r > 0x7f + r_range))
2435 else if (
format->alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range))
2439 TRACE(
"Format %s doesn't support post-pixelshader blending, type %u.\n",
2442 format->flags[
type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
2446 TRACE(
"Format %s supports post-pixelshader blending, type %u.\n",
2458 gl_info->
fbo_ops.glDeleteRenderbuffers(1, &rb);
2474 TRACE(
"Format %s's sRGB format is FBO attachable, type %u.\n",
2482 WARN(
"Format %s's sRGB format is not FBO attachable, type %u.\n",
2493 gl_info->
fbo_ops.glDeleteRenderbuffers(1, &color_rb);
2500 if (fallback_fmt_used && regular_fmt_used)
2502 FIXME(
"Format %s needs different render target formats for different resource types.\n",
2535 unsigned int i,
type;
2556 TRACE(
"Format %s is supported as FBO color attachment, resource type %u.\n",
2560 regular_fmt_used =
TRUE;
2566 TRACE(
"Format %s supports post-pixelshader blending, resource type %u.\n",
2572 TRACE(
"Format %s doesn't support post-pixelshader blending, resource typed %u.\n",
2574 format->flags[
type] &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
2583 WARN(
"Format %s with rendertarget flag is not supported as FBO color attachment"
2584 " and no fallback specified, resource type %u.\n",
2586 format->flags[
type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2589 TRACE(
"Format %s is not supported as FBO color attachment,"
2599 TRACE(
"Format %s rtInternal format is supported as FBO color attachment,"
2601 fallback_fmt_used =
TRUE;
2605 WARN(
"Format %s rtInternal format is not supported as FBO color attachment,"
2607 format->flags[
type] &= ~WINED3DFMT_FLAG_RENDERTARGET;
2618 TRACE(
"Format %s's sRGB format is FBO attachable, resource type %u.\n",
2626 WARN(
"Format %s's sRGB format is not FBO attachable, resource type %u.\n",
2635 if (fallback_fmt_used && regular_fmt_used)
2637 FIXME(
"Format %s needs different render target formats for different resource types.\n",
2648 gl_info->
fbo_ops.glGenFramebuffers(1, &fbo);
2658 if (!
format->glInternal)
continue;
2662 TRACE(
"Skipping format %s because it's a compressed format.\n",
2679 gl_info->
fbo_ops.glDeleteFramebuffers(1, &fbo);
2786 if (view_classes[
i].internal_format == internal_format)
2787 return view_classes[
i].view_class;
2795 GLenum internal_view_class, gamma_view_class, rt_view_class;
2801 if (internal_view_class == gamma_view_class || gamma_view_class == rt_view_class)
2803 format->gl_view_class = internal_view_class;
2804 TRACE(
"Format %s is member of GL view class %#x.\n",
2818 unsigned int i, max_log2;
2828 if (srgb_format ||
format->glGammaInternal !=
format->glInternal)
2833 if (srgb_write_supported)
2856 if (srgb_format ||
format->glGammaInternal !=
format->glInternal)
2910 if (gl_info->
limits.samples) {
2914 for (
i = 1;
i <= max_log2; ++
i)
2915 format->multisample_types |= 1u << ((1u <<
i) - 1);
2961 format->height_scale.numerator = 1;
2962 format->height_scale.denominator = 1;
3027 if (
abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
return FALSE;
3029 if (
abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
return FALSE;
3031 if (
abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
return FALSE;
3033 if (
abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
return FALSE;
3040 static const DWORD data[] = {0x00000000, 0xffffffff};
3042 DWORD readback[16 * 1];
3055 while (gl_info->
gl_ops.gl.p_glGetError());
3059 memset(readback, 0x7e,
sizeof(readback));
3068 gl_info->
gl_ops.gl.p_glGenTextures(1, &tex);
3079 gl_info->
fbo_ops.glGenFramebuffers(1, &fbo);
3084 gl_info->
gl_ops.gl.p_glViewport(0, 0, 16, 1);
3087 gl_info->
gl_ops.gl.p_glLoadIdentity();
3089 gl_info->
gl_ops.gl.p_glLoadIdentity();
3091 gl_info->
gl_ops.gl.p_glClearColor(0, 1, 0, 0);
3095 gl_info->
gl_ops.gl.p_glTexCoord2f(0.0, 0.0);
3096 gl_info->
gl_ops.gl.p_glVertex2f(-1.0f, -1.0f);
3097 gl_info->
gl_ops.gl.p_glTexCoord2f(1.0, 0.0);
3098 gl_info->
gl_ops.gl.p_glVertex2f(1.0f, -1.0f);
3099 gl_info->
gl_ops.gl.p_glTexCoord2f(0.0, 1.0);
3100 gl_info->
gl_ops.gl.p_glVertex2f(-1.0f, 1.0f);
3101 gl_info->
gl_ops.gl.p_glTexCoord2f(1.0, 1.0);
3102 gl_info->
gl_ops.gl.p_glVertex2f(1.0f, 1.0f);
3103 gl_info->
gl_ops.gl.p_glEnd();
3106 memset(readback, 0x7f,
sizeof(readback));
3111 TRACE(
"Read back colors 0x%08x and 0x%08x close to unfiltered color, assuming no filtering\n",
3112 readback[6], readback[9]);
3117 TRACE(
"Read back colors are 0x%08x and 0x%08x, assuming texture is filtered\n",
3118 readback[6], readback[9]);
3123 gl_info->
fbo_ops.glDeleteFramebuffers(1, &fbo);
3124 gl_info->
gl_ops.gl.p_glDeleteTextures(1, &tex);
3128 if (gl_info->
gl_ops.gl.p_glGetError())
3130 FIXME(
"Error during filtering test for format %x, returning no filtering\n",
internal);
3140 unsigned int fmt_idx,
i;
3156 WARN(
"No FBO support, or no FBO ORM, guessing filter info from GL caps\n");
3159 TRACE(
"Nvidia card with texture_float support: Assuming float16 blending\n");
3162 else if (gl_info->
limits.glsl_varyings > 44)
3164 TRACE(
"More than 44 GLSL varyings - assuming d3d10 card with float16 blending\n");
3169 TRACE(
"Assuming no float16 blending\n");
3188 if (!
format->glInternal)
continue;