ReactOS 0.4.17-dev-923-g4c9a150
ffp_gl.c
Go to the documentation of this file.
1/*
2 * GL fixed-function pipeline
3 *
4 * Copyright 2002 Lionel Ulmer
5 * Copyright 2002-2005 Jason Edmeades
6 * Copyright 2003-2004 Raphael Junqueira
7 * Copyright 2004 Christian Costa
8 * Copyright 2005 Oliver Stieber
9 * Copyright 2006 Henri Verbeet
10 * Copyright 2006-2008 Stefan Dösinger for CodeWeavers
11 * Copyright 2009-2011 Henri Verbeet for CodeWeavers
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 */
27
28#include <stdio.h>
29
30#include "wined3d_private.h"
31#include "wined3d_gl.h"
32
34
35/* Context activation for state handler is done by the caller. */
36
37static void state_undefined(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
38{
39 ERR("Undefined state %s (%#lx).\n", debug_d3dstate(state_id), state_id);
40}
41
42void state_nop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
43{
44 TRACE("%s: nop in current pipe config.\n", debug_d3dstate(state_id));
45}
46
47static void fillmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
48{
49 enum wined3d_fill_mode mode = r ? r->desc.fill_mode : WINED3D_FILL_SOLID;
50
51 switch (mode)
52 {
54 gl_info->gl_ops.gl.p_glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
55 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
56 break;
58 gl_info->gl_ops.gl.p_glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
59 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
60 break;
62 gl_info->gl_ops.gl.p_glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
63 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
64 break;
65 default:
66 FIXME("Unrecognized fill mode %#x.\n", mode);
67 }
68}
69
70static void cullmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
71{
72 enum wined3d_cull mode = r ? r->desc.cull_mode : WINED3D_CULL_BACK;
73
74 /* glFrontFace() is set in context.c at context init and on an
75 * offscreen / onscreen rendering switch. */
76 switch (mode)
77 {
79 gl_info->gl_ops.gl.p_glDisable(GL_CULL_FACE);
80 checkGLcall("glDisable GL_CULL_FACE");
81 break;
83 gl_info->gl_ops.gl.p_glEnable(GL_CULL_FACE);
84 checkGLcall("glEnable GL_CULL_FACE");
85 gl_info->gl_ops.gl.p_glCullFace(GL_FRONT);
86 checkGLcall("glCullFace(GL_FRONT)");
87 break;
89 gl_info->gl_ops.gl.p_glEnable(GL_CULL_FACE);
90 checkGLcall("glEnable GL_CULL_FACE");
91 gl_info->gl_ops.gl.p_glCullFace(GL_BACK);
92 checkGLcall("glCullFace(GL_BACK)");
93 break;
94 default:
95 FIXME("Unrecognized cull mode %#x.\n", mode);
96 }
97}
98
99void state_shademode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
100{
101 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
102
103 switch (state->render_states[WINED3D_RS_SHADEMODE])
104 {
106 gl_info->gl_ops.gl.p_glShadeModel(GL_FLAT);
107 checkGLcall("glShadeModel(GL_FLAT)");
108 break;
110 /* WINED3D_SHADE_PHONG in practice is the same as WINED3D_SHADE_GOURAUD
111 * in D3D. */
113 gl_info->gl_ops.gl.p_glShadeModel(GL_SMOOTH);
114 checkGLcall("glShadeModel(GL_SMOOTH)");
115 break;
116 default:
117 FIXME("Unrecognized shade mode %#x.\n",
118 state->render_states[WINED3D_RS_SHADEMODE]);
119 }
120}
121
122static void state_ditherenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
123{
124 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
125
126 if (state->render_states[WINED3D_RS_DITHERENABLE])
127 {
128 gl_info->gl_ops.gl.p_glEnable(GL_DITHER);
129 checkGLcall("glEnable GL_DITHER");
130 }
131 else
132 {
133 gl_info->gl_ops.gl.p_glDisable(GL_DITHER);
134 checkGLcall("glDisable GL_DITHER");
135 }
136}
137
139{
140 switch (f)
141 {
143 return GL_NEVER;
144 case WINED3D_CMP_LESS:
145 return GL_LESS;
147 return GL_EQUAL;
149 return GL_LEQUAL;
151 return GL_GREATER;
153 return GL_NOTEQUAL;
155 return GL_GEQUAL;
157 return GL_ALWAYS;
158 default:
159 if (!f)
160 WARN("Unrecognized compare function %#x.\n", f);
161 else
162 FIXME("Unrecognized compare function %#x.\n", f);
163 return GL_NONE;
164 }
165}
166
167static GLenum gl_blend_op(const struct wined3d_gl_info *gl_info, enum wined3d_blend_op op)
168{
169 switch (op)
170 {
172 return GL_FUNC_ADD;
178 return gl_info->supported[EXT_BLEND_MINMAX] ? GL_MIN : GL_FUNC_ADD;
180 return gl_info->supported[EXT_BLEND_MINMAX] ? GL_MAX : GL_FUNC_ADD;
181 default:
182 if (!op)
183 WARN("Unhandled blend op %#x.\n", op);
184 else
185 FIXME("Unhandled blend op %#x.\n", op);
186 return GL_FUNC_ADD;
187 }
188}
189
190static void blendop(const struct wined3d_state *state, const struct wined3d_gl_info *gl_info)
191{
192 const struct wined3d_blend_state *b = state->blend_state;
193 GLenum blend_equation_alpha = GL_FUNC_ADD_EXT;
194 GLenum blend_equation = GL_FUNC_ADD_EXT;
195
197 {
198 WARN("Unsupported in local OpenGL implementation: glBlendEquation.\n");
199 return;
200 }
201
202 /* BLENDOPALPHA requires GL_EXT_blend_equation_separate, so make sure it is around */
203 if (b->desc.rt[0].op_alpha && !gl_info->supported[EXT_BLEND_EQUATION_SEPARATE])
204 {
205 WARN("Unsupported in local OpenGL implementation: glBlendEquationSeparate.\n");
206 return;
207 }
208
209 blend_equation = gl_blend_op(gl_info, b->desc.rt[0].op);
210 blend_equation_alpha = gl_blend_op(gl_info, b->desc.rt[0].op_alpha);
211 TRACE("blend_equation %#x, blend_equation_alpha %#x.\n", blend_equation, blend_equation_alpha);
212
213 if (b->desc.rt[0].op != b->desc.rt[0].op_alpha)
214 {
215 GL_EXTCALL(glBlendEquationSeparate(blend_equation, blend_equation_alpha));
216 checkGLcall("glBlendEquationSeparate");
217 }
218 else
219 {
220 GL_EXTCALL(glBlendEquation(blend_equation));
221 checkGLcall("glBlendEquation");
222 }
223}
224
226{
227 switch (factor)
228 {
230 return GL_ZERO;
232 return GL_ONE;
234 return GL_SRC_COLOR;
238 return GL_SRC_ALPHA;
242 return GL_DST_COLOR;
245 /* To compensate for the lack of format switching with backbuffer
246 * offscreen rendering, and with onscreen rendering, we modify the
247 * alpha test parameters for (INV)DESTALPHA if the render target
248 * doesn't support alpha blending. A nonexistent alpha channel
249 * returns 1.0, so WINED3D_BLEND_DESTALPHA becomes GL_ONE, and
250 * WINED3D_BLEND_INVDESTALPHA becomes GL_ZERO. */
252 return dst_format->alpha_size ? GL_DST_ALPHA : GL_ONE;
254 return dst_format->alpha_size ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
262 return GL_SRC1_COLOR;
266 return GL_SRC1_ALPHA;
269 default:
270 if (!factor)
271 WARN("Unhandled blend factor %#x.\n", factor);
272 else
273 FIXME("Unhandled blend factor %#x.\n", factor);
274 return GL_NONE;
275 }
276}
277
278static void gl_blend_from_d3d(GLenum *src_blend, GLenum *dst_blend,
279 enum wined3d_blend d3d_src_blend, enum wined3d_blend d3d_dst_blend,
280 const struct wined3d_format *rt_format)
281{
282 /* WINED3D_BLEND_BOTHSRCALPHA and WINED3D_BLEND_BOTHINVSRCALPHA are legacy
283 * source blending values which are still valid up to d3d9. They should
284 * not occur as dest blend values. */
285 if (d3d_src_blend == WINED3D_BLEND_BOTHSRCALPHA)
286 {
287 *src_blend = GL_SRC_ALPHA;
288 *dst_blend = GL_ONE_MINUS_SRC_ALPHA;
289 }
290 else if (d3d_src_blend == WINED3D_BLEND_BOTHINVSRCALPHA)
291 {
292 *src_blend = GL_ONE_MINUS_SRC_ALPHA;
293 *dst_blend = GL_SRC_ALPHA;
294 }
295 else
296 {
297 *src_blend = gl_blend_factor(d3d_src_blend, rt_format);
298 *dst_blend = gl_blend_factor(d3d_dst_blend, rt_format);
299 }
300}
301
302static void state_blend_factor_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
303{
304 WARN("Unsupported in local OpenGL implementation: glBlendColor.\n");
305}
306
307static void state_blend_factor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
308{
309 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
310 const struct wined3d_color *factor = &state->blend_factor;
311
312 TRACE("Setting blend factor to %s.\n", debug_color(factor));
313
315 checkGLcall("glBlendColor");
316}
317
319{
320 const struct wined3d_blend_state *b = state->blend_state;
321
322 if (!state->fb.render_targets[index])
323 return FALSE;
324
325 if (!b->desc.rt[index].enable)
326 return FALSE;
327
328 /* Disable blending in all cases even without pixel shaders.
329 * With blending on we could face a big performance penalty.
330 * The d3d9 visual test confirms the behavior. */
331 if (!(state->fb.render_targets[index]->format_caps & WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING))
332 return FALSE;
333
334 return TRUE;
335}
336
337static void blend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
338{
339 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
340 const struct wined3d_blend_state *b = state->blend_state;
341 const struct wined3d_format *rt_format;
342 GLenum src_blend, dst_blend;
343 unsigned int mask;
344
345 if (gl_info->supported[ARB_MULTISAMPLE])
346 {
347 if (b && b->desc.alpha_to_coverage)
348 gl_info->gl_ops.gl.p_glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
349 else
350 gl_info->gl_ops.gl.p_glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
351 checkGLcall("glEnable GL_SAMPLE_ALPHA_TO_COVERAGE");
352 }
353
354 if (b && b->desc.independent)
355 WARN("Independent blend is not supported by this GL implementation.\n");
356
357 mask = b ? b->desc.rt[0].writemask : 0xf;
358
359 gl_info->gl_ops.gl.p_glColorMask(mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
363 checkGLcall("glColorMask");
364
365 if (!b || !is_blend_enabled(context, state, 0))
366 {
367 gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
368 checkGLcall("glDisable GL_BLEND");
369 return;
370 }
371
372 gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
373 checkGLcall("glEnable GL_BLEND");
374
375 rt_format = state->fb.render_targets[0]->format;
376
377 gl_blend_from_d3d(&src_blend, &dst_blend, b->desc.rt[0].src, b->desc.rt[0].dst, rt_format);
378
379 blendop(state, gl_info);
380
381 if (b->desc.rt[0].src != b->desc.rt[0].src_alpha || b->desc.rt[0].dst != b->desc.rt[0].dst_alpha)
382 {
383 GLenum src_blend_alpha, dst_blend_alpha;
384
385 /* Separate alpha blending requires GL_EXT_blend_function_separate, so make sure it is around */
386 if (!gl_info->supported[EXT_BLEND_FUNC_SEPARATE])
387 {
388 WARN("Unsupported in local OpenGL implementation: glBlendFuncSeparate.\n");
389 return;
390 }
391
392 gl_blend_from_d3d(&src_blend_alpha, &dst_blend_alpha, b->desc.rt[0].src_alpha, b->desc.rt[0].dst_alpha, rt_format);
393
394 GL_EXTCALL(glBlendFuncSeparate(src_blend, dst_blend, src_blend_alpha, dst_blend_alpha));
395 checkGLcall("glBlendFuncSeparate");
396 }
397 else
398 {
399 TRACE("glBlendFunc src=%x, dst=%x.\n", src_blend, dst_blend);
400 gl_info->gl_ops.gl.p_glBlendFunc(src_blend, dst_blend);
401 checkGLcall("glBlendFunc");
402 }
403}
404
405static void set_color_mask(const struct wined3d_gl_info *gl_info, UINT index, DWORD mask)
406{
407 GL_EXTCALL(glColorMaski(index,
412 checkGLcall("glColorMaski");
413}
414
415static void blend_db2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
416{
417 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
418 GLenum src_blend, dst_blend, src_blend_alpha, dst_blend_alpha;
419 const struct wined3d_blend_state *b = state->blend_state;
420 const struct wined3d_format *rt_format;
421 BOOL dual_source = b && b->dual_source;
422 unsigned int i;
423
424 if (b && b->desc.alpha_to_coverage)
425 gl_info->gl_ops.gl.p_glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
426 else
427 gl_info->gl_ops.gl.p_glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
428 checkGLcall("glEnable GL_SAMPLE_ALPHA_TO_COVERAGE");
429
430 if (context->last_was_dual_source_blend != dual_source)
431 {
432 /* Dual source blending changes the location of the output varyings. */
433 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
434 context->last_was_dual_source_blend = dual_source;
435 }
436
437 if (!b || !b->desc.independent)
438 {
439 blend(context, state, state_id);
440 return;
441 }
442
443 rt_format = state->fb.render_targets[0]->format;
444 gl_blend_from_d3d(&src_blend, &dst_blend, b->desc.rt[0].src, b->desc.rt[0].dst, rt_format);
445 gl_blend_from_d3d(&src_blend_alpha, &dst_blend_alpha, b->desc.rt[0].src_alpha, b->desc.rt[0].dst_alpha, rt_format);
446
447 GL_EXTCALL(glBlendFuncSeparate(src_blend, dst_blend, src_blend_alpha, dst_blend_alpha));
448 checkGLcall("glBlendFuncSeparate");
449
450 GL_EXTCALL(glBlendEquationSeparate(gl_blend_op(gl_info, b->desc.rt[0].op),
451 gl_blend_op(gl_info, b->desc.rt[0].op_alpha)));
452 checkGLcall("glBlendEquationSeparate");
453
454 for (i = 0; i < WINED3D_MAX_RENDER_TARGETS; ++i)
455 {
456 set_color_mask(gl_info, i, b->desc.rt[i].writemask);
457
459 {
460 GL_EXTCALL(glDisablei(GL_BLEND, i));
461 checkGLcall("glDisablei GL_BLEND");
462 continue;
463 }
464
465 GL_EXTCALL(glEnablei(GL_BLEND, i));
466 checkGLcall("glEnablei GL_BLEND");
467
468 if (b->desc.rt[i].src != b->desc.rt[0].src
469 || b->desc.rt[i].dst != b->desc.rt[0].dst
470 || b->desc.rt[i].op != b->desc.rt[0].op
471 || b->desc.rt[i].src_alpha != b->desc.rt[0].src_alpha
472 || b->desc.rt[i].dst_alpha != b->desc.rt[0].dst_alpha
473 || b->desc.rt[i].op_alpha != b->desc.rt[0].op_alpha)
474 WARN("Independent blend equations and blend functions are not supported by this GL implementation.\n");
475 }
476}
477
478static void blend_dbb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
479{
480 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
481 const struct wined3d_blend_state *b = state->blend_state;
482 BOOL dual_source = b && b->dual_source;
483 unsigned int i;
484
485 if (b && b->desc.alpha_to_coverage)
486 gl_info->gl_ops.gl.p_glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
487 else
488 gl_info->gl_ops.gl.p_glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
489 checkGLcall("glEnable GL_SAMPLE_ALPHA_TO_COVERAGE");
490
491 if (context->last_was_dual_source_blend != dual_source)
492 {
493 /* Dual source blending changes the location of the output varyings. */
494 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL;
495 context->last_was_dual_source_blend = dual_source;
496 }
497
498 if (!b || !b->desc.independent)
499 {
500 blend(context, state, state_id);
501 return;
502 }
503
504 for (i = 0; i < WINED3D_MAX_RENDER_TARGETS; ++i)
505 {
506 GLenum src_blend, dst_blend, src_blend_alpha, dst_blend_alpha;
507 const struct wined3d_format *rt_format;
508
509 set_color_mask(gl_info, i, b->desc.rt[i].writemask);
510
512 {
513 GL_EXTCALL(glDisablei(GL_BLEND, i));
514 checkGLcall("glDisablei GL_BLEND");
515 continue;
516 }
517
518 GL_EXTCALL(glEnablei(GL_BLEND, i));
519 checkGLcall("glEnablei GL_BLEND");
520
521 rt_format = state->fb.render_targets[i]->format;
522 gl_blend_from_d3d(&src_blend, &dst_blend, b->desc.rt[i].src, b->desc.rt[i].dst, rt_format);
523 gl_blend_from_d3d(&src_blend_alpha, &dst_blend_alpha,
524 b->desc.rt[i].src_alpha, b->desc.rt[i].dst_alpha, rt_format);
525
526 GL_EXTCALL(glBlendFuncSeparatei(i, src_blend, dst_blend, src_blend_alpha, dst_blend_alpha));
527 checkGLcall("glBlendFuncSeparatei");
528
529 GL_EXTCALL(glBlendEquationSeparatei(i, gl_blend_op(gl_info, b->desc.rt[i].op),
530 gl_blend_op(gl_info, b->desc.rt[i].op_alpha)));
531 checkGLcall("glBlendEquationSeparatei");
532 }
533}
534
535void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
536{
537 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
538 uint32_t enable_mask;
539
540 /* glEnable(GL_CLIP_PLANEx) doesn't apply to (ARB backend) vertex shaders.
541 * The enabled / disabled planes are hardcoded into the shader. Update the
542 * shader to update the enabled clipplanes. In case of fixed function, we
543 * need to update the clipping field from ffp_vertex_settings. */
544 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
545
546 /* If enabling / disabling all
547 * TODO: Is this correct? Doesn't D3DRS_CLIPPING disable clipping on the viewport frustrum?
548 */
549 enable_mask = state->render_states[WINED3D_RS_CLIPPING] ?
550 state->render_states[WINED3D_RS_CLIPPLANEENABLE] : 0;
551 wined3d_context_gl_enable_clip_distances(context_gl, enable_mask);
552}
553
555 GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass)
556{
557 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
558
559 gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
560 checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
561 GL_EXTCALL(glActiveStencilFaceEXT(face));
562 checkGLcall("glActiveStencilFaceEXT(...)");
563 gl_info->gl_ops.gl.p_glStencilFunc(func, ref, mask);
564 checkGLcall("glStencilFunc(...)");
565 gl_info->gl_ops.gl.p_glStencilOp(stencilFail, depthFail, stencilPass);
566 checkGLcall("glStencilOp(...)");
567}
568
570{
571 switch (op)
572 {
574 return GL_KEEP;
576 return GL_ZERO;
578 return GL_REPLACE;
580 return GL_INCR;
582 return GL_DECR;
584 return GL_INVERT;
586 return GL_INCR_WRAP;
588 return GL_DECR_WRAP;
589 default:
590 if (!op)
591 WARN("Unrecognized stencil op %#x.\n", op);
592 else
593 FIXME("Unrecognized stencil op %#x.\n", op);
594 return GL_KEEP;
595 }
596}
597
598static void state_stencil(struct wined3d_context *context, const struct wined3d_state *state)
599{
600 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
601 const struct wined3d_depth_stencil_state *d = state->depth_stencil_state;
602 GLint func;
603 GLint func_back;
604 GLint ref;
605 GLuint mask;
606 GLint stencilFail;
607 GLint stencilFail_back;
608 GLint stencilPass;
609 GLint stencilPass_back;
610 GLint depthFail;
611 GLint depthFail_back;
612
613 /* No stencil test without a stencil buffer. */
614 if (!state->fb.depth_stencil || !d || !d->desc.stencil)
615 {
616 gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST);
617 checkGLcall("glDisable GL_STENCIL_TEST");
618 return;
619 }
620
621 if (!(func = wined3d_gl_compare_func(d->desc.front.func)))
622 func = GL_ALWAYS;
623 if (!(func_back = wined3d_gl_compare_func(d->desc.back.func)))
624 func_back = GL_ALWAYS;
625 mask = d->desc.stencil_read_mask;
626 ref = state->stencil_ref & wined3d_mask_from_size(state->fb.depth_stencil->format->stencil_size);
627 stencilFail = gl_stencil_op(d->desc.front.fail_op);
628 depthFail = gl_stencil_op(d->desc.front.depth_fail_op);
629 stencilPass = gl_stencil_op(d->desc.front.pass_op);
630 stencilFail_back = gl_stencil_op(d->desc.back.fail_op);
631 depthFail_back = gl_stencil_op(d->desc.back.depth_fail_op);
632 stencilPass_back = gl_stencil_op(d->desc.back.pass_op);
633
634 TRACE("(ref %x, mask %x, "
635 "GL_FRONT: func: %x, fail %x, zfail %x, zpass %x "
636 "GL_BACK: func: %x, fail %x, zfail %x, zpass %x)\n",
637 ref, mask,
638 func, stencilFail, depthFail, stencilPass,
639 func_back, stencilFail_back, depthFail_back, stencilPass_back);
640
641 if (memcmp(&d->desc.front, &d->desc.back, sizeof(d->desc.front)))
642 {
643 gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST);
644 checkGLcall("glEnable GL_STENCIL_TEST");
645
646 if (gl_info->supported[WINED3D_GL_VERSION_2_0])
647 {
648 GL_EXTCALL(glStencilFuncSeparate(GL_FRONT, func, ref, mask));
649 GL_EXTCALL(glStencilOpSeparate(GL_FRONT, stencilFail, depthFail, stencilPass));
650 GL_EXTCALL(glStencilFuncSeparate(GL_BACK, func_back, ref, mask));
651 GL_EXTCALL(glStencilOpSeparate(GL_BACK, stencilFail_back, depthFail_back, stencilPass_back));
652 checkGLcall("setting two sided stencil state");
653 }
654 else if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
655 {
656 /* Apply back first, then front. This function calls glActiveStencilFaceEXT,
657 * which has an effect on the code below too. If we apply the front face
658 * afterwards, we are sure that the active stencil face is set to front,
659 * and other stencil functions which do not use two sided stencil do not have
660 * to set it back
661 */
663 func_back, ref, mask, stencilFail_back, depthFail_back, stencilPass_back);
665 func, ref, mask, stencilFail, depthFail, stencilPass);
666 }
667 else if (gl_info->supported[ATI_SEPARATE_STENCIL])
668 {
669 GL_EXTCALL(glStencilFuncSeparateATI(func, func_back, ref, mask));
670 checkGLcall("glStencilFuncSeparateATI(...)");
671 GL_EXTCALL(glStencilOpSeparateATI(GL_FRONT, stencilFail, depthFail, stencilPass));
672 checkGLcall("glStencilOpSeparateATI(GL_FRONT, ...)");
673 GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail_back, depthFail_back, stencilPass_back));
674 checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)");
675 }
676 else
677 {
678 FIXME("Separate (two sided) stencil not supported on this version of OpenGL. Caps weren't honored?\n");
679 }
680 }
681 else
682 {
683 if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
684 {
685 gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
686 checkGLcall("glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
687 }
688
689 /* This code disables the ATI extension as well, since the standard stencil functions are equal
690 * to calling the ATI functions with GL_FRONT_AND_BACK as face parameter
691 */
692 gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST);
693 checkGLcall("glEnable GL_STENCIL_TEST");
694 gl_info->gl_ops.gl.p_glStencilFunc(func, ref, mask);
695 checkGLcall("glStencilFunc(...)");
696 gl_info->gl_ops.gl.p_glStencilOp(stencilFail, depthFail, stencilPass);
697 checkGLcall("glStencilOp(...)");
698 }
699}
700
701static void depth(struct wined3d_context *context, const struct wined3d_state *state)
702{
703 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
704 const struct wined3d_depth_stencil_state *d = state->depth_stencil_state;
705 BOOL enable_depth = d ? d->desc.depth : TRUE;
706 GLenum depth_func = GL_LESS;
707
708 if (!state->fb.depth_stencil)
709 {
710 TRACE("No depth/stencil buffer is attached; disabling depth test.\n");
711 enable_depth = FALSE;
712 }
713
714 if (enable_depth)
715 {
716 gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
717 checkGLcall("glEnable GL_DEPTH_TEST");
718 }
719 else
720 {
721 gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
722 checkGLcall("glDisable GL_DEPTH_TEST");
723 }
724
725 if (!d || d->desc.depth_write)
726 {
727 gl_info->gl_ops.gl.p_glDepthMask(GL_TRUE);
728 checkGLcall("glDepthMask(GL_TRUE)");
729 }
730 else
731 {
732 gl_info->gl_ops.gl.p_glDepthMask(GL_FALSE);
733 checkGLcall("glDepthMask(GL_FALSE)");
734 }
735
736 if (d)
737 depth_func = wined3d_gl_compare_func(d->desc.depth_func);
738 if (depth_func)
739 {
740 gl_info->gl_ops.gl.p_glDepthFunc(depth_func);
741 checkGLcall("glDepthFunc");
742 }
743
744 if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST])
745 {
746 /* If min is larger than max, an INVALID_VALUE error is generated.
747 * In d3d9, the test is not performed in this case. */
748 if (state->depth_bounds_enable && state->depth_bounds_min <= state->depth_bounds_max)
749 {
750 gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_BOUNDS_TEST_EXT);
751 checkGLcall("glEnable(GL_DEPTH_BOUNDS_TEST_EXT)");
752 GL_EXTCALL(glDepthBoundsEXT(state->depth_bounds_min, state->depth_bounds_max));
753 checkGLcall("glDepthBoundsEXT");
754 }
755 else
756 {
757 gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
758 checkGLcall("glDisable(GL_DEPTH_BOUNDS_TEST_EXT)");
759 }
760 }
761
762 if (context->stream_info.position_transformed)
763 context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PROJ;
764}
765
766static void depth_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
767{
768 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
769 const struct wined3d_depth_stencil_state *d = state->depth_stencil_state;
770 GLuint stencil_write_mask = 0;
771
774
775 if (state->fb.depth_stencil)
776 stencil_write_mask = d ? d->desc.stencil_write_mask : ~0u;
777
778 gl_info->gl_ops.gl.p_glStencilMask(stencil_write_mask);
779 checkGLcall("glStencilMask");
780}
781
782static void depth_stencil_2s(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
783{
784 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
785 const struct wined3d_depth_stencil_state *d = state->depth_stencil_state;
786 GLuint stencil_write_mask = 0;
787
790
791 if (state->fb.depth_stencil)
792 stencil_write_mask = d ? d->desc.stencil_write_mask : ~0u;
793
794 GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK));
795 checkGLcall("glActiveStencilFaceEXT(GL_BACK)");
796 gl_info->gl_ops.gl.p_glStencilMask(stencil_write_mask);
797 checkGLcall("glStencilMask");
798 GL_EXTCALL(glActiveStencilFaceEXT(GL_FRONT));
799 checkGLcall("glActiveStencilFaceEXT(GL_FRONT)");
800 gl_info->gl_ops.gl.p_glStencilMask(stencil_write_mask);
801}
802
803static void state_linepattern(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
804{
805 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
806 union
807 {
808 DWORD d;
809 struct wined3d_line_pattern lp;
810 } tmppattern;
811 tmppattern.d = state->render_states[WINED3D_RS_LINEPATTERN];
812
813 TRACE("Line pattern: repeat %d bits %x.\n", tmppattern.lp.repeat_factor, tmppattern.lp.line_pattern);
814
815 if (tmppattern.lp.repeat_factor)
816 {
817 gl_info->gl_ops.gl.p_glLineStipple(tmppattern.lp.repeat_factor, tmppattern.lp.line_pattern);
818 checkGLcall("glLineStipple(repeat, linepattern)");
819 gl_info->gl_ops.gl.p_glEnable(GL_LINE_STIPPLE);
820 checkGLcall("glEnable(GL_LINE_STIPPLE);");
821 }
822 else
823 {
824 gl_info->gl_ops.gl.p_glDisable(GL_LINE_STIPPLE);
825 checkGLcall("glDisable(GL_LINE_STIPPLE);");
826 }
827}
828
829static void state_linepattern_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
830{
831 static unsigned int once;
832
833 if (!once++)
834 FIXME("Setting line patterns is not supported in OpenGL core contexts.\n");
835}
836
837static void state_msaa_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
838{
839 if (state->render_states[WINED3D_RS_MULTISAMPLEANTIALIAS])
840 WARN("Multisample antialiasing not supported by GL.\n");
841}
842
843static void state_msaa(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
844{
845 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
846
847 if (state->render_states[WINED3D_RS_MULTISAMPLEANTIALIAS])
848 {
849 gl_info->gl_ops.gl.p_glEnable(GL_MULTISAMPLE_ARB);
850 checkGLcall("glEnable(GL_MULTISAMPLE_ARB)");
851 }
852 else
853 {
854 gl_info->gl_ops.gl.p_glDisable(GL_MULTISAMPLE_ARB);
855 checkGLcall("glDisable(GL_MULTISAMPLE_ARB)");
856 }
857}
858
859static void line_antialias(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
860{
861 if (r && r->desc.line_antialias)
862 {
863 gl_info->gl_ops.gl.p_glEnable(GL_LINE_SMOOTH);
864 checkGLcall("glEnable(GL_LINE_SMOOTH)");
865 }
866 else
867 {
868 gl_info->gl_ops.gl.p_glDisable(GL_LINE_SMOOTH);
869 checkGLcall("glDisable(GL_LINE_SMOOTH)");
870 }
871}
872
873static void scissor(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
874{
875 if (r && r->desc.scissor)
876 {
877 gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST);
878 checkGLcall("glEnable(GL_SCISSOR_TEST)");
879 }
880 else
881 {
882 gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
883 checkGLcall("glDisable(GL_SCISSOR_TEST)");
884 }
885}
886
887/* The Direct3D depth bias is specified in normalized depth coordinates. In
888 * OpenGL the bias is specified in units of "the smallest value that is
889 * guaranteed to produce a resolvable offset for a given implementation". To
890 * convert from D3D to GL we need to divide the D3D depth bias by that value.
891 * We try to detect the value from GL with test draws. On most drivers (r300g,
892 * 600g, Nvidia, i965 on Mesa) the value is 2^23 for fixed point depth buffers,
893 * for r200 and i965 on OSX it is 2^24, for r500 on OSX it is 2^22. For floating
894 * point buffers it is 2^22, 2^23 or 2^24 depending on the GPU. The value does
895 * not depend on the depth buffer precision on any driver.
896 *
897 * Two games that are picky regarding depth bias are Mass Effect 2 (flickering
898 * decals) and F.E.A.R and F.E.A.R. 2 (semi-transparent guns).
899 *
900 * Note that SLOPESCALEDEPTHBIAS is a scaling factor for the depth slope, and
901 * doesn't need to be scaled to account for GL vs D3D differences. */
902static void depthbias(struct wined3d_context *context, const struct wined3d_state *state)
903{
904 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
905 const struct wined3d_rasterizer_state *r = state->rasterizer_state;
906 float scale_bias = r ? r->desc.scale_bias : 0.0f;
907 union
908 {
909 DWORD d;
910 float f;
911 } const_bias;
912
913 const_bias.f = r ? r->desc.depth_bias : 0.0f;
914
915 if (scale_bias || const_bias.f)
916 {
917 const struct wined3d_rendertarget_view *depth = state->fb.depth_stencil;
918 float factor, units, scale, clamp;
919
920 clamp = r ? r->desc.depth_bias_clamp : 0.0f;
921
922 if (context->d3d_info->wined3d_creation_flags & WINED3D_LEGACY_DEPTH_BIAS)
923 {
924 factor = units = -(float)const_bias.d;
925 }
926 else
927 {
928 if (depth)
929 {
930 scale = depth->format->depth_bias_scale;
931
932 TRACE("Depth format %s, using depthbias scale of %.8e.\n",
933 debug_d3dformat(depth->format->id), scale);
934 }
935 else
936 {
937 /* The context manager will reapply this state on a depth stencil change */
938 TRACE("No depth stencil, using depth bias scale of 0.0.\n");
939 scale = 0.0f;
940 }
941
942 factor = scale_bias;
943 units = const_bias.f * scale;
944 }
945
946 gl_info->gl_ops.gl.p_glEnable(GL_POLYGON_OFFSET_FILL);
948 {
949 gl_info->gl_ops.ext.p_glPolygonOffsetClamp(factor, units, clamp);
950 }
951 else
952 {
953 if (clamp != 0.0f)
954 WARN("Ignoring depth bias clamp %.8e.\n", clamp);
955 gl_info->gl_ops.gl.p_glPolygonOffset(factor, units);
956 }
957 }
958 else
959 {
960 gl_info->gl_ops.gl.p_glDisable(GL_POLYGON_OFFSET_FILL);
961 }
962
963 checkGLcall("depth bias");
964}
965
966static void state_sample_mask(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
967{
968 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
969 unsigned int sample_mask = state->sample_mask;
970
971 TRACE("Setting sample mask to %#x.\n", sample_mask);
972 if (sample_mask != 0xffffffff)
973 {
974 gl_info->gl_ops.gl.p_glEnable(GL_SAMPLE_MASK);
975 checkGLcall("glEnable GL_SAMPLE_MASK");
976 GL_EXTCALL(glSampleMaski(0, sample_mask));
977 checkGLcall("glSampleMaski");
978 }
979 else
980 {
981 gl_info->gl_ops.gl.p_glDisable(GL_SAMPLE_MASK);
982 checkGLcall("glDisable GL_SAMPLE_MASK");
983 }
984}
985
986static void state_sample_mask_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
987{
988 WARN("Unsupported in local OpenGL implementation: glSampleMaski.\n");
989}
990
991static void state_compute_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
992{
993 context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_COMPUTE;
994}
995
996static void state_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
997{
998 enum wined3d_shader_type shader_type = state_id - STATE_SHADER(0);
999 context->shader_update_mask |= 1u << shader_type;
1000}
1001
1002void clipplane(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1003{
1004 context->constant_update_mask |= WINED3D_SHADER_CONST_VS_CLIP_PLANES;
1005}
1006
1008{
1009 for (unsigned int i = 0; i < gl_info->limits.user_clip_distances; ++i)
1010 {
1011 GLdouble plane[4];
1012
1013 gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
1014 gl_info->gl_ops.gl.p_glPushMatrix();
1015 gl_info->gl_ops.gl.p_glLoadIdentity();
1016
1017 plane[0] = state->clip_planes[i].x;
1018 plane[1] = state->clip_planes[i].y;
1019 plane[2] = state->clip_planes[i].z;
1020 plane[3] = state->clip_planes[i].w;
1021
1022 gl_info->gl_ops.gl.p_glClipPlane(GL_CLIP_PLANE0 + i, plane);
1023 checkGLcall("glClipPlane");
1024
1025 gl_info->gl_ops.gl.p_glPopMatrix();
1026 }
1027}
1028
1029static void streamsrc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1030{
1032}
1033
1034static void vdecl_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1035{
1037 return;
1039}
1040
1041static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1042{
1043 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1044 float min_z, max_z;
1045
1046 if (gl_info->supported[ARB_VIEWPORT_ARRAY])
1047 {
1048 GLdouble depth_ranges[2 * WINED3D_MAX_VIEWPORTS];
1049 GLfloat viewports[4 * WINED3D_MAX_VIEWPORTS];
1050
1051 unsigned int i, reset_count = 0;
1052
1053 for (i = 0; i < state->viewport_count; ++i)
1054 {
1055 wined3d_viewport_get_z_range(&state->viewports[i], &min_z, &max_z);
1056 depth_ranges[i * 2] = min_z;
1057 depth_ranges[i * 2 + 1] = max_z;
1058
1059 viewports[i * 4] = state->viewports[i].x;
1060 viewports[i * 4 + 1] = state->viewports[i].y;
1061 viewports[i * 4 + 2] = state->viewports[i].width;
1062 viewports[i * 4 + 3] = state->viewports[i].height;
1063
1064 /* Don't pass fractionals to GL if we earlier decided not to use
1065 * this functionality for two reasons: First, GL might offer us
1066 * fewer than 8 bits, and still make use of the fractional, in
1067 * addition to the emulation we apply in shader_get_position_fixup.
1068 * Second, even if GL tells us it has no subpixel precision (Mac OS!)
1069 * it might still do something with the fractional amount, e.g.
1070 * round it upwards. I can't find any info on rounding in
1071 * GL_ARB_viewport_array. */
1072 if (!context->d3d_info->subpixel_viewport)
1073 {
1074 viewports[i * 4] = floor(viewports[i * 4]);
1075 viewports[i * 4 + 1] = floor(viewports[i * 4 + 1]);
1076 viewports[i * 4 + 2] = floor(viewports[i * 4 + 2]);
1077 viewports[i * 4 + 3] = floor(viewports[i * 4 + 3]);
1078 }
1079 }
1080
1081 if (context->viewport_count > state->viewport_count)
1082 reset_count = context->viewport_count - state->viewport_count;
1083
1084 if (reset_count)
1085 {
1086 memset(&depth_ranges[state->viewport_count * 2], 0, reset_count * 2 * sizeof(*depth_ranges));
1087 memset(&viewports[state->viewport_count * 4], 0, reset_count * 4 * sizeof(*viewports));
1088 }
1089
1090 GL_EXTCALL(glDepthRangeArrayv(0, state->viewport_count + reset_count, depth_ranges));
1091 GL_EXTCALL(glViewportArrayv(0, state->viewport_count + reset_count, viewports));
1092 context->viewport_count = state->viewport_count;
1093 }
1094 else
1095 {
1096 wined3d_viewport_get_z_range(&state->viewports[0], &min_z, &max_z);
1097 gl_info->gl_ops.gl.p_glDepthRange(min_z, max_z);
1098 gl_info->gl_ops.gl.p_glViewport(state->viewports[0].x, state->viewports[0].y,
1099 state->viewports[0].width, state->viewports[0].height);
1100 }
1101 checkGLcall("setting clip space and viewport");
1102}
1103
1105 const struct wined3d_state *state, DWORD state_id)
1106{
1107 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1108 /* See get_projection_matrix() in glsl_shader.c for a discussion about those values. */
1109 float pixel_center_offset = context->d3d_info->wined3d_creation_flags
1110 & WINED3D_PIXEL_CENTER_INTEGER ? 0.5f : 0.0f;
1111 GLdouble depth_ranges[2 * WINED3D_MAX_VIEWPORTS];
1112 GLfloat viewports[4 * WINED3D_MAX_VIEWPORTS];
1113 unsigned int i, reset_count = 0;
1114 float min_z, max_z;
1115
1116 pixel_center_offset += context->d3d_info->filling_convention_offset / 2.0f;
1117
1118 GL_EXTCALL(glClipControl(GL_UPPER_LEFT, GL_ZERO_TO_ONE));
1119
1120 for (i = 0; i < state->viewport_count; ++i)
1121 {
1122 wined3d_viewport_get_z_range(&state->viewports[i], &min_z, &max_z);
1123 depth_ranges[i * 2] = min_z;
1124 depth_ranges[i * 2 + 1] = max_z;
1125
1126 viewports[i * 4] = state->viewports[i].x + pixel_center_offset;
1127 viewports[i * 4 + 1] = state->viewports[i].y + pixel_center_offset;
1128 viewports[i * 4 + 2] = state->viewports[i].width;
1129 viewports[i * 4 + 3] = state->viewports[i].height;
1130 }
1131
1132 if (context->viewport_count > state->viewport_count)
1133 reset_count = context->viewport_count - state->viewport_count;
1134
1135 if (reset_count)
1136 {
1137 memset(&depth_ranges[state->viewport_count * 2], 0, reset_count * 2 * sizeof(*depth_ranges));
1138 memset(&viewports[state->viewport_count * 4], 0, reset_count * 4 * sizeof(*viewports));
1139 }
1140
1141 GL_EXTCALL(glDepthRangeArrayv(0, state->viewport_count + reset_count, depth_ranges));
1142 GL_EXTCALL(glViewportArrayv(0, state->viewport_count + reset_count, viewports));
1143 context->viewport_count = state->viewport_count;
1144
1145 checkGLcall("setting clip space and viewport");
1146}
1147
1148static void scissorrect(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1149{
1150 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1151 const RECT *r;
1152
1153 /* Warning: glScissor uses window coordinates, not viewport coordinates,
1154 * so our viewport correction does not apply. Warning2: Even in windowed
1155 * mode the coords are relative to the window, not the screen. */
1156
1157 if (gl_info->supported[ARB_VIEWPORT_ARRAY])
1158 {
1160 unsigned int i, reset_count = 0;
1161
1162 for (i = 0; i < state->scissor_rect_count; ++i)
1163 {
1164 r = &state->scissor_rects[i];
1165
1166 sr[i * 4] = r->left;
1167 sr[i * 4 + 1] = r->top;
1168 sr[i * 4 + 2] = r->right - r->left;
1169 sr[i * 4 + 3] = r->bottom - r->top;
1170 }
1171
1172 if (context->scissor_rect_count > state->scissor_rect_count)
1173 reset_count = context->scissor_rect_count - state->scissor_rect_count;
1174
1175 if (reset_count)
1176 memset(&sr[state->scissor_rect_count * 4], 0, reset_count * 4 * sizeof(GLint));
1177
1178 GL_EXTCALL(glScissorArrayv(0, state->scissor_rect_count + reset_count, sr));
1179 checkGLcall("glScissorArrayv");
1180 context->scissor_rect_count = state->scissor_rect_count;
1181 }
1182 else
1183 {
1184 r = &state->scissor_rects[0];
1185 gl_info->gl_ops.gl.p_glScissor(r->left, r->top, r->right - r->left, r->bottom - r->top);
1186 checkGLcall("glScissor");
1187 }
1188}
1189
1190static void indexbuffer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1191{
1192 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1193 const struct wined3d_stream_info *stream_info = &context->stream_info;
1194 struct wined3d_buffer *buffer;
1195
1196 if (!state->index_buffer || !stream_info->all_vbo)
1197 {
1198 GL_EXTCALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
1199 return;
1200 }
1201
1202 buffer = state->index_buffer;
1203 if (buffer->buffer_object)
1204 {
1205 GL_EXTCALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, wined3d_bo_gl(buffer->buffer_object)->id));
1207 }
1208 else
1209 {
1210 GL_EXTCALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
1211 }
1212}
1213
1214static void depth_clip(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
1215{
1216 if (!gl_info->supported[ARB_DEPTH_CLAMP])
1217 {
1218 if (r && !r->desc.depth_clip)
1219 FIXME("Depth clamp not supported by this GL implementation.\n");
1220 return;
1221 }
1222
1223 if (r && !r->desc.depth_clip)
1224 gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_CLAMP);
1225 else
1226 gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_CLAMP);
1227 checkGLcall("depth clip");
1228}
1229
1230static void rasterizer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1231{
1232 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1233 const struct wined3d_rasterizer_state *r = state->rasterizer_state;
1234
1235 /* Rendering without ARB_clip_control requires flipping position manually.
1236 * This also means that all primitives will be backwards, so we need to
1237 * also swap which side is the front face. */
1238 gl_info->gl_ops.gl.p_glFrontFace(r && r->desc.front_ccw ? GL_CW : GL_CCW);
1239 checkGLcall("glFrontFace");
1241 fillmode(r, gl_info);
1242 cullmode(r, gl_info);
1243 depth_clip(r, gl_info);
1244 scissor(r, gl_info);
1245 line_antialias(r, gl_info);
1246}
1247
1248static void rasterizer_cc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1249{
1250 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1251 const struct wined3d_rasterizer_state *r = state->rasterizer_state;
1252 GLenum mode;
1253
1254 mode = r && r->desc.front_ccw ? GL_CCW : GL_CW;
1255
1256 gl_info->gl_ops.gl.p_glFrontFace(mode);
1257 checkGLcall("glFrontFace");
1259 fillmode(r, gl_info);
1260 cullmode(r, gl_info);
1261 depth_clip(r, gl_info);
1262 scissor(r, gl_info);
1263 line_antialias(r, gl_info);
1264}
1265
1266void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1267{
1268 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1269
1270 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1271
1272 if (needs_srgb_write(context->d3d_info, state, &state->fb))
1273 gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
1274 else
1275 gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
1276}
1277
1278static void state_cb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1279{
1280 const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
1282 struct wined3d_buffer *buffer;
1283 unsigned int i, base, count;
1284 struct wined3d_bo_gl *bo_gl;
1285
1286 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1287
1290 else
1292
1293 /* If a shader has not been set, buffer objects are not yet initialised. */
1294 if (!state->shader[shader_type])
1295 return;
1296
1298 for (i = 0; i < count; ++i)
1299 {
1301
1302 if (!buffer_state->buffer)
1303 {
1304 GL_EXTCALL(glBindBufferBase(GL_UNIFORM_BUFFER, base + i, 0));
1305 continue;
1306 }
1307
1308 buffer = buffer_state->buffer;
1309 bo_gl = wined3d_bo_gl(buffer->buffer_object);
1310 GL_EXTCALL(glBindBufferRange(GL_UNIFORM_BUFFER, base + i,
1311 bo_gl->id, bo_gl->b.buffer_offset + buffer_state->offset,
1312 min(buffer_state->size, buffer->resource.size - buffer_state->offset)));
1313
1315 }
1316 checkGLcall("bind constant buffers");
1317}
1318
1319static void state_cb_warn(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1320{
1321 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1322
1323 WARN("Constant buffers (%s) no supported.\n", debug_d3dstate(state_id));
1324}
1325
1327 const struct wined3d_state *state, DWORD state_id)
1328{
1329 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1330
1331 context->update_shader_resource_bindings = 1;
1332}
1333
1335 const struct wined3d_state *state, DWORD state_id)
1336{
1337 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1338 context->update_compute_shader_resource_bindings = 1;
1339}
1340
1342 const struct wined3d_state *state, DWORD state_id)
1343{
1344 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1345 context->update_unordered_access_view_bindings = 1;
1346}
1347
1349 const struct wined3d_state *state, DWORD state_id)
1350{
1351 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1352 context->update_compute_unordered_access_view_bindings = 1;
1353}
1354
1355static void state_uav_warn(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1356{
1357 WARN("ARB_shader_image_load_store is not supported by this OpenGL implementation.\n");
1358}
1359
1360static void state_so(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1361{
1362 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
1363 const struct wined3d_gl_info *gl_info = context_gl->gl_info;
1364 struct wined3d_buffer *buffer;
1365 unsigned int offset, size, i;
1366 struct wined3d_bo_gl *bo_gl;
1367
1368 TRACE("context %p, state %p, state_id %#lx.\n", context, state, state_id);
1369
1371
1372 for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i)
1373 {
1374 if (!state->stream_output[i].buffer)
1375 {
1376 GL_EXTCALL(glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, i, 0));
1377 continue;
1378 }
1379
1380 buffer = state->stream_output[i].buffer;
1381 offset = state->stream_output[i].offset;
1382 bo_gl = wined3d_bo_gl(buffer->buffer_object);
1383 if (offset == ~0u)
1384 {
1385 FIXME("Appending to stream output buffers not implemented.\n");
1386 offset = 0;
1387 }
1388 size = buffer->resource.size - offset;
1389 GL_EXTCALL(glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, i,
1390 bo_gl->id, bo_gl->b.buffer_offset + offset, size));
1392 }
1393 checkGLcall("bind transform feedback buffers");
1394}
1395
1396static void state_so_warn(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1397{
1398 WARN("Transform feedback not supported.\n");
1399}
1400
1402{
1456 {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
1457};
1458
1460{
1461 return TRUE;
1462}
1463
1465{
1466}
1467
1469
1470static void none_pipe_disable(const struct wined3d_context *context) {}
1471
1472static void *none_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
1473{
1474 return shader_priv;
1475}
1476
1478
1479static void vp_none_get_caps(const struct wined3d_adapter *adapter, struct wined3d_vertex_caps *caps)
1480{
1481 memset(caps, 0, sizeof(*caps));
1482}
1483
1484static unsigned int vp_none_get_emul_mask(const struct wined3d_adapter *adapter)
1485{
1486 return 0;
1487}
1488
1490{
1491 .vp_apply_draw_state = none_pipe_apply_draw_state,
1492 .vp_disable = none_pipe_disable,
1493 .vp_get_caps = vp_none_get_caps,
1494 .vp_get_emul_mask = vp_none_get_emul_mask,
1495 .vp_alloc = none_alloc,
1496 .vp_free = none_free,
1497};
1498
1499static void fp_none_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps)
1500{
1501 memset(caps, 0, sizeof(*caps));
1502}
1503
1504static unsigned int fp_none_get_emul_mask(const struct wined3d_adapter *adapter)
1505{
1506 return 0;
1507}
1508
1510{
1511 return is_identity_fixup(fixup);
1512}
1513
1515{
1516 .fp_apply_draw_state = none_pipe_apply_draw_state,
1517 .fp_disable = none_pipe_disable,
1518 .get_caps = fp_none_get_caps,
1519 .get_emul_mask = fp_none_get_emul_mask,
1520 .alloc_private = none_alloc,
1521 .free_private = none_free,
1522 .allocate_context_data = ffp_none_context_alloc,
1523 .free_context_data = ffp_none_context_free,
1524 .color_fixup_supported = fp_none_color_fixup_supported,
1525};
1526
1527static unsigned int num_handlers(const APPLYSTATEFUNC *funcs)
1528{
1529 unsigned int i;
1530 for(i = 0; funcs[i]; i++);
1531 return i;
1532}
1533
1534static void multistate_apply_2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1535{
1536 context->device->multistate_funcs[state_id][0](context, state, state_id);
1537 context->device->multistate_funcs[state_id][1](context, state, state_id);
1538}
1539
1540static void multistate_apply_3(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
1541{
1542 context->device->multistate_funcs[state_id][0](context, state, state_id);
1543 context->device->multistate_funcs[state_id][1](context, state, state_id);
1544 context->device->multistate_funcs[state_id][2](context, state, state_id);
1545}
1546
1547static void prune_invalid_states(struct wined3d_state_entry *state_table, const struct wined3d_d3d_info *d3d_info)
1548{
1549 unsigned int start, last, i;
1550
1551 start = STATE_TEXTURESTAGE(d3d_info->ffp_fragment_caps.max_blend_stages, 0);
1553 for (i = start; i <= last; ++i)
1554 {
1555 state_table[i].representative = 0;
1556 state_table[i].apply = state_undefined;
1557 }
1558}
1559
1561{
1562 static const struct
1563 {
1564 DWORD first;
1565 DWORD last;
1566 }
1567 rs_holes[] =
1568 {
1569 { 1, 8},
1570 { 11, 14},
1571 { 16, 24},
1572 { 27, 27},
1573 { 30, 33},
1574 { 39, 40},
1575 { 42, 47},
1576 { 49, 135},
1577 {138, 139},
1578 {144, 144},
1579 {149, 150},
1580 {153, 153},
1581 {157, 160},
1582 {162, 165},
1583 {167, 193},
1584 {195, 209},
1585 { 0, 0},
1586 };
1587 static const unsigned int simple_states[] =
1588 {
1618 };
1619 unsigned int i, current;
1620
1622 {
1623 if (!rs_holes[current].first || i < STATE_RENDER(rs_holes[current].first))
1624 {
1625 if (!state_table[i].representative)
1626 ERR("State %s (%#x) should have a representative.\n", debug_d3dstate(i), i);
1627 }
1628 else if (state_table[i].representative)
1629 ERR("State %s (%#x) shouldn't have a representative.\n", debug_d3dstate(i), i);
1630
1631 if (i == STATE_RENDER(rs_holes[current].last)) ++current;
1632 }
1633
1634 for (i = 0; i < ARRAY_SIZE(simple_states); ++i)
1635 {
1636 if (!state_table[simple_states[i]].representative)
1637 ERR("State %s (%#x) should have a representative.\n",
1638 debug_d3dstate(simple_states[i]), simple_states[i]);
1639 }
1640
1641 for (i = 0; i < STATE_HIGHEST + 1; ++i)
1642 {
1643 unsigned int rep = state_table[i].representative;
1644 if (rep)
1645 {
1646 if (state_table[rep].representative != rep)
1647 {
1648 ERR("State %s (%#x) has invalid representative %s (%#x).\n",
1649 debug_d3dstate(i), i, debug_d3dstate(rep), rep);
1650 state_table[i].representative = 0;
1651 }
1652
1653 if (rep != i)
1654 {
1655 if (state_table[i].apply)
1656 ERR("State %s (%#x) has both a handler and representative.\n", debug_d3dstate(i), i);
1657 }
1658 else if (!state_table[i].apply)
1659 {
1660 ERR("Self representing state %s (%#x) has no handler.\n", debug_d3dstate(i), i);
1661 }
1662 }
1663 }
1664}
1665
1667 const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions,
1668 const struct wined3d_vertex_pipe_ops *vertex, const struct wined3d_fragment_pipe_ops *fragment,
1669 const struct wined3d_state_entry_template *misc)
1670{
1671 APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
1672 const struct wined3d_state_entry_template *cur;
1673 unsigned int i, type, handlers;
1674 BOOL set[STATE_HIGHEST + 1];
1675
1676 memset(multistate_funcs, 0, sizeof(multistate_funcs));
1677
1678 for (i = 0; i < STATE_HIGHEST + 1; ++i)
1679 {
1680 state_table[i].representative = 0;
1681 state_table[i].apply = state_undefined;
1682 }
1683
1684 for (type = 0; type < 3; ++type)
1685 {
1686 /* This switch decides the order in which the states are applied */
1687 switch (type)
1688 {
1689 case 0: cur = misc; break;
1690 case 1: cur = fragment->states; break;
1691 case 2: cur = vertex->vp_states; break;
1692 default: cur = NULL; /* Stupid compiler */
1693 }
1694 if (!cur) continue;
1695
1696 /* GL extension filtering should not prevent multiple handlers being applied from different
1697 * pipeline parts
1698 */
1699 memset(set, 0, sizeof(set));
1700
1701 for (i = 0; cur[i].state; ++i)
1702 {
1703 APPLYSTATEFUNC *funcs_array;
1704
1705 /* Only use the first matching state with the available extension from one template.
1706 * e.g.
1707 * {D3DRS_FOOBAR, {D3DRS_FOOBAR, func1}, XYZ_FANCY},
1708 * {D3DRS_FOOBAR, {D3DRS_FOOBAR, func2}, 0 }
1709 *
1710 * if GL_XYZ_fancy is supported, ignore the 2nd line
1711 */
1712 if (set[cur[i].state]) continue;
1713 /* Skip state lines depending on unsupported extensions */
1714 if (!supported_extensions[cur[i].extension]) continue;
1715 set[cur[i].state] = TRUE;
1716 /* In some cases having an extension means that nothing has to be
1717 * done for a state, e.g. if GL_ARB_texture_non_power_of_two is
1718 * supported, the texture coordinate fixup can be ignored. If the
1719 * apply function is used, mark the state set(done above) to prevent
1720 * applying later lines, but do not record anything in the state
1721 * table
1722 */
1723 if (!cur[i].content.representative) continue;
1724
1725 handlers = num_handlers(multistate_funcs[cur[i].state]);
1726 multistate_funcs[cur[i].state][handlers] = cur[i].content.apply;
1727 switch (handlers)
1728 {
1729 case 0:
1730 state_table[cur[i].state].apply = cur[i].content.apply;
1731 break;
1732 case 1:
1733 state_table[cur[i].state].apply = multistate_apply_2;
1734 if (!(dev_multistate_funcs[cur[i].state] = calloc(2, sizeof(**dev_multistate_funcs))))
1735 goto out_of_mem;
1736
1737 dev_multistate_funcs[cur[i].state][0] = multistate_funcs[cur[i].state][0];
1738 dev_multistate_funcs[cur[i].state][1] = multistate_funcs[cur[i].state][1];
1739 break;
1740 case 2:
1741 state_table[cur[i].state].apply = multistate_apply_3;
1742 if (!(funcs_array = realloc(dev_multistate_funcs[cur[i].state],
1743 sizeof(**dev_multistate_funcs) * 3)))
1744 goto out_of_mem;
1745
1746 dev_multistate_funcs[cur[i].state] = funcs_array;
1747 dev_multistate_funcs[cur[i].state][2] = multistate_funcs[cur[i].state][2];
1748 break;
1749 default:
1750 ERR("Unexpected amount of state handlers for state %u: %u.\n",
1751 cur[i].state, handlers + 1);
1752 }
1753
1754 if (state_table[cur[i].state].representative
1755 && state_table[cur[i].state].representative != cur[i].content.representative)
1756 {
1757 FIXME("State %s (%#x) has different representatives in different pipeline parts.\n",
1759 }
1760 state_table[cur[i].state].representative = cur[i].content.representative;
1761 }
1762 }
1763
1766
1767 return WINED3D_OK;
1768
1769out_of_mem:
1770 for (i = 0; i <= STATE_HIGHEST; ++i)
1771 {
1772 free(dev_multistate_funcs[i]);
1773 }
1774
1775 memset(dev_multistate_funcs, 0, (STATE_HIGHEST + 1) * sizeof(*dev_multistate_funcs));
1776
1777 return E_OUTOFMEMORY;
1778}
static int state
Definition: maze.c:121
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: _set.h:50
void wined3d_context_gl_enable_clip_distances(struct wined3d_context_gl *context_gl, uint32_t enable_mask)
Definition: context_gl.c:2408
void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: context_gl.c:3426
void wined3d_context_gl_end_transform_feedback(struct wined3d_context_gl *context_gl)
Definition: context_gl.c:4228
void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl *context_gl, const struct wined3d_state *state)
Definition: context_gl.c:5095
void context_state_drawbuf(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: context_gl.c:3722
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#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
UINT op
Definition: effect.c:235
static const struct @282 state_table[]
const char * debug_d3dformat(enum wined3d_format_id format_id)
Definition: utils.c:4605
const char * debug_d3dstate(uint32_t state)
Definition: utils.c:5331
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
const char * debug_color(const struct wined3d_color *color)
Definition: utils.c:4561
content
Definition: atl_ax.c:990
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
_ACRTIMP double __cdecl floor(double)
Definition: floor.c:18
static xmlCharEncodingHandlerPtr * handlers
Definition: encoding.c:1380
static void vdecl_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1034
static void blend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:337
static BOOL is_blend_enabled(struct wined3d_context *context, const struct wined3d_state *state, UINT index)
Definition: ffp_gl.c:318
static void state_cb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1278
static void state_msaa_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:837
void state_nop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:42
const struct wined3d_vertex_pipe_ops none_vertex_pipe
Definition: ffp_gl.c:1489
static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1041
static void state_msaa(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:843
static void prune_invalid_states(struct wined3d_state_entry *state_table, const struct wined3d_d3d_info *d3d_info)
Definition: ffp_gl.c:1547
static void state_sample_mask(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:966
static GLenum gl_blend_op(const struct wined3d_gl_info *gl_info, enum wined3d_blend_op op)
Definition: ffp_gl.c:167
static void scissor(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
Definition: ffp_gl.c:873
void ffp_vertex_update_clip_plane_constants(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state)
Definition: ffp_gl.c:1007
static void state_blend_factor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:307
static void blend_db2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:415
static void none_pipe_disable(const struct wined3d_context *context)
Definition: ffp_gl.c:1470
static void blend_dbb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:478
static void state_uav_warn(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1355
static void state_cs_resource_binding(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1334
static void state_stencil(struct wined3d_context *context, const struct wined3d_state *state)
Definition: ffp_gl.c:598
static void multistate_apply_2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1534
void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1266
static void state_shader_resource_binding(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1326
const struct wined3d_fragment_pipe_ops none_fragment_pipe
Definition: ffp_gl.c:1514
static void none_free(struct wined3d_device *device, struct wined3d_context *context)
Definition: ffp_gl.c:1477
static void fp_none_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps)
Definition: ffp_gl.c:1499
static void state_ditherenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:122
static void depthbias(struct wined3d_context *context, const struct wined3d_state *state)
Definition: ffp_gl.c:902
static void state_undefined(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:37
static void scissorrect(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1148
static void state_cs_uav_binding(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1348
static void line_antialias(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
Definition: ffp_gl.c:859
static void set_color_mask(const struct wined3d_gl_info *gl_info, UINT index, DWORD mask)
Definition: ffp_gl.c:405
static void * none_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
Definition: ffp_gl.c:1472
static void indexbuffer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1190
static void blendop(const struct wined3d_state *state, const struct wined3d_gl_info *gl_info)
Definition: ffp_gl.c:190
static BOOL ffp_none_context_alloc(struct wined3d_context *context)
Definition: ffp_gl.c:1459
static void state_sample_mask_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:986
static void state_so_warn(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1396
static void state_blend_factor_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:302
static void cullmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
Definition: ffp_gl.c:70
static BOOL fp_none_color_fixup_supported(struct color_fixup_desc fixup)
Definition: ffp_gl.c:1509
static void multistate_apply_3(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1540
static void viewport_miscpart_cc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1104
const struct wined3d_state_entry_template misc_state_template_gl[]
Definition: ffp_gl.c:1401
static void gl_blend_from_d3d(GLenum *src_blend, GLenum *dst_blend, enum wined3d_blend d3d_src_blend, enum wined3d_blend d3d_dst_blend, const struct wined3d_format *rt_format)
Definition: ffp_gl.c:278
static void streamsrc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1029
static unsigned int vp_none_get_emul_mask(const struct wined3d_adapter *adapter)
Definition: ffp_gl.c:1484
static void state_compute_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:991
static void renderstate_stencil_twosided(struct wined3d_context *context, GLint face, GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass)
Definition: ffp_gl.c:554
static unsigned int fp_none_get_emul_mask(const struct wined3d_adapter *adapter)
Definition: ffp_gl.c:1504
static void depth_stencil_2s(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:782
static void rasterizer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1230
static void none_pipe_apply_draw_state(struct wined3d_context *context, const struct wined3d_state *state)
Definition: ffp_gl.c:1468
static void state_uav_binding(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1341
static GLenum gl_blend_factor(enum wined3d_blend factor, const struct wined3d_format *dst_format)
Definition: ffp_gl.c:225
static void ffp_none_context_free(struct wined3d_context *context)
Definition: ffp_gl.c:1464
static void rasterizer_cc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1248
void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:535
static void state_linepattern(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:803
static void depth_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:766
static void state_cb_warn(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1319
static void validate_state_table(struct wined3d_state_entry *state_table)
Definition: ffp_gl.c:1560
static void depth_clip(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
Definition: ffp_gl.c:1214
static void state_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:996
void clipplane(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1002
static unsigned int num_handlers(const APPLYSTATEFUNC *funcs)
Definition: ffp_gl.c:1527
static void fillmode(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
Definition: ffp_gl.c:47
static void state_so(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:1360
static void state_linepattern_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:829
GLenum wined3d_gl_compare_func(enum wined3d_cmp_func f)
Definition: ffp_gl.c:138
static void vp_none_get_caps(const struct wined3d_adapter *adapter, struct wined3d_vertex_caps *caps)
Definition: ffp_gl.c:1479
static GLenum gl_stencil_op(enum wined3d_stencil_op op)
Definition: ffp_gl.c:569
HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEFUNC **dev_multistate_funcs, const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions, const struct wined3d_vertex_pipe_ops *vertex, const struct wined3d_fragment_pipe_ops *fragment, const struct wined3d_state_entry_template *misc)
Definition: ffp_gl.c:1666
void state_shademode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:99
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
return adapter
FxCollectionEntry * cur
#define GL_NEVER
Definition: gl.h:293
#define GL_TRUE
Definition: gl.h:174
#define GL_ALWAYS
Definition: gl.h:300
#define GL_NONE
Definition: gl.h:465
#define GL_CLIP_PLANE0
Definition: gl.h:346
GLuint start
Definition: gl.h:1545
#define GL_POINT
Definition: gl.h:265
#define GL_LESS
Definition: gl.h:294
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLAPI void GLAPIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
float GLfloat
Definition: gl.h:161
#define GL_FRONT_AND_BACK
Definition: gl.h:336
#define GL_SRC_ALPHA_SATURATE
Definition: gl.h:384
#define GL_POLYGON_OFFSET_FILL
Definition: gl.h:283
#define GL_NOTEQUAL
Definition: gl.h:298
#define GL_ONE_MINUS_DST_ALPHA
Definition: gl.h:381
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define GL_ONE_MINUS_DST_COLOR
Definition: gl.h:383
#define GL_CW
Definition: gl.h:268
#define GL_DEPTH_TEST
Definition: gl.h:301
#define GL_STENCIL_TEST
Definition: gl.h:449
#define GL_DECR
Definition: gl.h:462
double GLdouble
Definition: gl.h:163
#define GL_SRC_ALPHA
Definition: gl.h:378
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GL_SMOOTH
Definition: gl.h:339
unsigned int GLenum
Definition: gl.h:150
#define GL_LINE_STIPPLE
Definition: gl.h:257
#define GL_BACK
Definition: gl.h:271
unsigned int GLuint
Definition: gl.h:159
#define GL_SRC_COLOR
Definition: gl.h:376
#define GL_ZERO
Definition: gl.h:374
#define GL_DITHER
Definition: gl.h:501
#define GL_FUNC_REVERSE_SUBTRACT
Definition: gl.h:1628
#define GL_CCW
Definition: gl.h:269
#define GL_LEQUAL
Definition: gl.h:296
#define GL_MODELVIEW
Definition: gl.h:245
#define GL_CULL_FACE
Definition: gl.h:276
#define GL_GEQUAL
Definition: gl.h:299
#define GL_FILL
Definition: gl.h:267
#define GL_SAMPLE_ALPHA_TO_COVERAGE
Definition: gl.h:1812
#define GL_MIN
Definition: gl.h:1624
#define GL_BLEND
Definition: gl.h:371
#define GL_ONE_MINUS_SRC_ALPHA
Definition: gl.h:379
#define GL_GREATER
Definition: gl.h:297
#define GL_ONE
Definition: gl.h:375
#define GL_INCR
Definition: gl.h:461
#define GL_DST_ALPHA
Definition: gl.h:380
#define GL_LINE
Definition: gl.h:266
GLAPI void GLAPIENTRY glBlendEquation(GLenum mode)
#define GL_FALSE
Definition: gl.h:173
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define GL_SCISSOR_TEST
Definition: gl.h:589
#define GL_EQUAL
Definition: gl.h:295
#define GL_DST_COLOR
Definition: gl.h:382
int GLint
Definition: gl.h:156
#define GL_FUNC_SUBTRACT
Definition: gl.h:1627
#define GL_MAX
Definition: gl.h:1625
#define GL_FRONT
Definition: gl.h:270
#define GL_FLAT
Definition: gl.h:338
#define GL_REPLACE
Definition: gl.h:460
#define GL_INVERT
Definition: gl.h:435
#define GL_LINE_SMOOTH
Definition: gl.h:256
#define GL_FUNC_ADD
Definition: gl.h:1626
#define GL_KEEP
Definition: gl.h:459
#define GL_ONE_MINUS_SRC_COLOR
Definition: gl.h:377
GLenum func
Definition: glext.h:6028
#define GL_UNIFORM_BUFFER
Definition: glext.h:1846
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
#define GL_CONSTANT_COLOR_EXT
Definition: glext.h:2407
#define GL_SRC1_ALPHA
Definition: glext.h:381
GLuint buffer
Definition: glext.h:5915
#define GL_ONE_MINUS_CONSTANT_COLOR_EXT
Definition: glext.h:2408
GLsizeiptr size
Definition: glext.h:5919
GLenum clamp
Definition: glext.h:6216
GLintptr offset
Definition: glext.h:5920
#define GL_FRAMEBUFFER_SRGB
Definition: glext.h:1758
#define GL_SAMPLE_MASK
Definition: glext.h:1936
GLuint index
Definition: glext.h:6031
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define GL_SRC1_COLOR
Definition: glext.h:2002
#define GL_UPPER_LEFT
Definition: glext.h:462
#define GL_ONE_MINUS_SRC1_COLOR
Definition: glext.h:2004
GLenum mode
Definition: glext.h:6217
GLfloat units
Definition: glext.h:11727
#define GL_STENCIL_TEST_TWO_SIDE_EXT
Definition: glext.h:4210
#define GL_FUNC_ADD_EXT
Definition: glext.h:2737
const GLint * first
Definition: glext.h:5794
#define GL_TRANSFORM_FEEDBACK_BUFFER
Definition: glext.h:557
#define GL_ONE_MINUS_SRC1_ALPHA
Definition: glext.h:2005
#define GL_ELEMENT_ARRAY_BUFFER
Definition: glext.h:337
#define GL_DECR_WRAP
Definition: glext.h:297
#define GL_DEPTH_CLAMP
Definition: glext.h:1896
#define GL_INCR_WRAP
Definition: glext.h:296
#define GL_MULTISAMPLE_ARB
Definition: glext.h:1213
#define GL_DEPTH_BOUNDS_TEST_EXT
Definition: glext.h:4377
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 factor
Definition: glfuncs.h:178
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 * u
Definition: glfuncs.h:240
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 GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
unsigned int UINT
Definition: sysinfo.c:13
#define d
Definition: ke_i.h:81
#define f
Definition: ke_i.h:83
struct task_struct * current
Definition: linux.c:32
static const char * dst_format
Definition: dib.c:1339
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
Definition: sync.c:64
static void stream_info(IStream *stream, HGLOBAL *hmem, int *size, int *pos)
static float(__cdecl *square_half_float)(float x
#define min(a, b)
Definition: monoChain.cc:55
#define calloc
Definition: rosglue.h:14
static struct __wine_debug_functions funcs
Definition: debug.c:48
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dcommon.idl:28
Definition: http.c:7252
Definition: devices.h:37
Definition: send.c:48
Definition: mesh.c:4665
struct wined3d_bo b
Definition: wined3d_gl.h:415
const struct wined3d_gl_info * gl_info
Definition: wined3d_gl.h:603
struct fragment_caps ffp_fragment_caps
const struct wined3d_state_entry_template * states
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
unsigned int extension
#define GL_ZERO_TO_ONE
Definition: wgl.h:5094
@ WINED3D_SHADE_GOURAUD
Definition: wined3d.h:489
@ WINED3D_SHADE_PHONG
Definition: wined3d.h:490
@ WINED3D_SHADE_FLAT
Definition: wined3d.h:488
wined3d_blend_op
Definition: wined3d.h:441
@ WINED3D_BLEND_OP_ADD
Definition: wined3d.h:442
@ WINED3D_BLEND_OP_MIN
Definition: wined3d.h:445
@ WINED3D_BLEND_OP_MAX
Definition: wined3d.h:446
@ WINED3D_BLEND_OP_SUBTRACT
Definition: wined3d.h:443
@ WINED3D_BLEND_OP_REVSUBTRACT
Definition: wined3d.h:444
@ WINED3D_RS_DITHERENABLE
Definition: wined3d.h:309
@ WINED3D_RS_SHADEMODE
Definition: wined3d.h:295
@ WINED3D_RS_CLIPPLANEENABLE
Definition: wined3d.h:360
@ WINED3D_RS_MULTISAMPLEANTIALIAS
Definition: wined3d.h:369
@ WINED3D_RS_CLIPPING
Definition: wined3d.h:346
@ WINED3D_RS_LINEPATTERN
Definition: wined3d.h:296
#define WINED3D_OK
Definition: wined3d.h:33
#define WINED3DCOLORWRITEENABLE_RED
Definition: wined3d.h:866
#define WINED3DCOLORWRITEENABLE_BLUE
Definition: wined3d.h:868
#define WINED3D_MAX_VIEWPORTS
Definition: wined3d.h:1590
#define WINED3D_MAX_RENDER_TARGETS
Definition: wined3d.h:1606
wined3d_cmp_func
Definition: wined3d.h:460
@ WINED3D_CMP_ALWAYS
Definition: wined3d.h:468
@ WINED3D_CMP_GREATER
Definition: wined3d.h:465
@ WINED3D_CMP_LESSEQUAL
Definition: wined3d.h:464
@ WINED3D_CMP_NOTEQUAL
Definition: wined3d.h:466
@ WINED3D_CMP_LESS
Definition: wined3d.h:462
@ WINED3D_CMP_EQUAL
Definition: wined3d.h:463
@ WINED3D_CMP_GREATEREQUAL
Definition: wined3d.h:467
@ WINED3D_CMP_NEVER
Definition: wined3d.h:461
wined3d_blend
Definition: wined3d.h:418
@ WINED3D_BLEND_ONE
Definition: wined3d.h:420
@ WINED3D_BLEND_INVDESTCOLOR
Definition: wined3d.h:428
@ WINED3D_BLEND_DESTCOLOR
Definition: wined3d.h:427
@ WINED3D_BLEND_INVSRCALPHA
Definition: wined3d.h:424
@ WINED3D_BLEND_INVSRCCOLOR
Definition: wined3d.h:422
@ WINED3D_BLEND_INVDESTALPHA
Definition: wined3d.h:426
@ WINED3D_BLEND_INVBLENDFACTOR
Definition: wined3d.h:433
@ WINED3D_BLEND_INVSRC1COLOR
Definition: wined3d.h:435
@ WINED3D_BLEND_SRC1ALPHA
Definition: wined3d.h:436
@ WINED3D_BLEND_ZERO
Definition: wined3d.h:419
@ WINED3D_BLEND_SRC1COLOR
Definition: wined3d.h:434
@ WINED3D_BLEND_BOTHINVSRCALPHA
Definition: wined3d.h:431
@ WINED3D_BLEND_BOTHSRCALPHA
Definition: wined3d.h:430
@ WINED3D_BLEND_SRCALPHA
Definition: wined3d.h:423
@ WINED3D_BLEND_SRCALPHASAT
Definition: wined3d.h:429
@ WINED3D_BLEND_BLENDFACTOR
Definition: wined3d.h:432
@ WINED3D_BLEND_INVSRC1ALPHA
Definition: wined3d.h:437
@ WINED3D_BLEND_SRCCOLOR
Definition: wined3d.h:421
@ WINED3D_BLEND_DESTALPHA
Definition: wined3d.h:425
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_DOMAIN
Definition: wined3d.h:845
@ WINED3D_SHADER_TYPE_COMPUTE
Definition: wined3d.h:848
@ WINED3D_SHADER_TYPE_VERTEX
Definition: wined3d.h:842
#define WINED3D_LEGACY_DEPTH_BIAS
Definition: wined3d.h:1322
#define WINED3DCOLORWRITEENABLE_ALPHA
Definition: wined3d.h:869
#define WINED3D_HIGHEST_TEXTURE_STATE
Definition: wined3d.h:614
wined3d_fill_mode
Definition: wined3d.h:494
@ WINED3D_FILL_SOLID
Definition: wined3d.h:497
@ WINED3D_FILL_WIREFRAME
Definition: wined3d.h:496
@ WINED3D_FILL_POINT
Definition: wined3d.h:495
#define WINED3D_MAX_FFP_TEXTURES
Definition: wined3d.h:1597
wined3d_stencil_op
Definition: wined3d.h:508
@ WINED3D_STENCIL_OP_INCR
Definition: wined3d.h:515
@ WINED3D_STENCIL_OP_KEEP
Definition: wined3d.h:509
@ WINED3D_STENCIL_OP_REPLACE
Definition: wined3d.h:511
@ WINED3D_STENCIL_OP_INVERT
Definition: wined3d.h:514
@ WINED3D_STENCIL_OP_DECR_SAT
Definition: wined3d.h:513
@ WINED3D_STENCIL_OP_DECR
Definition: wined3d.h:516
@ WINED3D_STENCIL_OP_ZERO
Definition: wined3d.h:510
@ WINED3D_STENCIL_OP_INCR_SAT
Definition: wined3d.h:512
wined3d_cull
Definition: wined3d.h:501
@ WINED3D_CULL_NONE
Definition: wined3d.h:502
@ WINED3D_CULL_FRONT
Definition: wined3d.h:503
@ WINED3D_CULL_BACK
Definition: wined3d.h:504
#define WINED3DCOLORWRITEENABLE_GREEN
Definition: wined3d.h:867
#define WINED3D_PIXEL_CENTER_INTEGER
Definition: wined3d.h:1328
#define WINEHIGHEST_RENDER_STATE
Definition: wined3d.h:415
@ EXT_STENCIL_TWO_SIDE
Definition: wined3d_gl.h:188
@ EXT_BLEND_EQUATION_SEPARATE
Definition: wined3d_gl.h:168
@ ATI_SEPARATE_STENCIL
Definition: wined3d_gl.h:162
@ EXT_BLEND_MINMAX
Definition: wined3d_gl.h:170
@ WINED3D_GL_EXT_NONE
Definition: wined3d_gl.h:43
@ ARB_DRAW_ELEMENTS_BASE_VERTEX
Definition: wined3d_gl.h:72
@ WINED3D_GL_BLEND_EQUATION
Definition: wined3d_gl.h:231
@ ARB_VERTEX_BUFFER_OBJECT
Definition: wined3d_gl.h:153
@ ARB_MULTISAMPLE
Definition: wined3d_gl.h:95
@ ARB_POLYGON_OFFSET_CLAMP
Definition: wined3d_gl.h:102
@ WINED3D_GL_VERSION_3_2
Definition: wined3d_gl.h:236
@ ARB_TEXTURE_MULTISAMPLE
Definition: wined3d_gl.h:139
@ ARB_DEPTH_CLAMP
Definition: wined3d_gl.h:67
@ EXT_BLEND_FUNC_SEPARATE
Definition: wined3d_gl.h:169
@ ARB_UNIFORM_BUFFER_OBJECT
Definition: wined3d_gl.h:151
@ EXT_BLEND_COLOR
Definition: wined3d_gl.h:167
@ EXT_BLEND_SUBTRACT
Definition: wined3d_gl.h:171
@ EXT_DEPTH_BOUNDS_TEST
Definition: wined3d_gl.h:172
@ ARB_VIEWPORT_ARRAY
Definition: wined3d_gl.h:158
@ WINED3D_GL_LEGACY_CONTEXT
Definition: wined3d_gl.h:232
@ WINED3D_GL_VERSION_2_0
Definition: wined3d_gl.h:235
@ ARB_CLIP_CONTROL
Definition: wined3d_gl.h:58
@ ARB_SHADER_IMAGE_LOAD_STORE
Definition: wined3d_gl.h:111
@ EXT_DRAW_BUFFERS2
Definition: wined3d_gl.h:173
@ ARB_DRAW_BUFFERS_BLEND
Definition: wined3d_gl.h:71
#define GL_EXTCALL(f)
Definition: wined3d_gl.h:360
#define checkGLcall(A)
Definition: wined3d_gl.h:402
#define STATE_BASEVERTEXINDEX
#define STATE_IS_GRAPHICS_CONSTANT_BUFFER(a)
#define STATE_DEPTH_STENCIL
static bool isStateDirty(const struct wined3d_context *context, unsigned int state_id)
#define STATE_STENCIL_REF
#define STATE_CONSTANT_BUFFER(a)
#define STATE_HIGHEST
#define STATE_GRAPHICS_SHADER_RESOURCE_BINDING
#define STATE_STREAM_OUTPUT
#define STATE_DEPTH_BOUNDS
#define STATE_SHADER(a)
static void wined3d_buffer_validate_user(struct wined3d_buffer *buffer)
#define STATE_BLEND_FACTOR
static uint32_t wined3d_mask_from_size(unsigned int size)
#define STATE_SAMPLE_MASK
#define STATE_SCISSORRECT
#define STATE_STREAMSRC
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
#define STATE_COMPUTE_SHADER_RESOURCE_BINDING
#define WINED3D_FORMAT_CAP_POSTPIXELSHADER_BLENDING
#define STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING
#define STATE_RASTERIZER
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_SHADER_CONST_FFP_PROJ
#define STATE_TEXTURESTAGE(stage, num)
#define STATE_GRAPHICS_CONSTANT_BUFFER(a)
static void wined3d_viewport_get_z_range(const struct wined3d_viewport *vp, float *min_z, float *max_z)
#define STATE_INDEXBUFFER
#define STATE_VDECL
#define STATE_VIEWPORT
void(* APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id)
#define STATE_FRAMEBUFFER
#define WINED3D_SHADER_CONST_VS_CLIP_PLANES
#define STATE_RENDER(a)
#define STATE_BLEND
#define STATE_GRAPHICS_UNORDERED_ACCESS_VIEW_BINDING