2006-12-05 23:36:10 +01:00
|
|
|
/*
|
|
|
|
* Direct3D state management
|
|
|
|
*
|
2007-01-10 11:38:00 +01:00
|
|
|
* Copyright 2002 Lionel Ulmer
|
|
|
|
* Copyright 2002-2005 Jason Edmeades
|
|
|
|
* Copyright 2003-2004 Raphael Junqueira
|
|
|
|
* Copyright 2004 Christian Costa
|
|
|
|
* Copyright 2005 Oliver Stieber
|
|
|
|
* Copyright 2006 Henri Verbeet
|
2008-10-18 19:21:20 +02:00
|
|
|
* Copyright 2006-2008 Stefan Dösinger for CodeWeavers
|
2011-04-03 23:35:33 +02:00
|
|
|
* Copyright 2009-2011 Henri Verbeet for CodeWeavers
|
2006-12-05 23:36:10 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2012-06-01 16:56:21 +02:00
|
|
|
#include "wine/port.h"
|
|
|
|
|
2006-12-05 23:36:10 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#ifdef HAVE_FLOAT_H
|
|
|
|
# include <float.h>
|
|
|
|
#endif
|
2012-06-01 16:56:21 +02:00
|
|
|
|
2006-12-05 23:36:10 +01:00
|
|
|
#include "wined3d_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
2007-01-06 18:11:21 +01:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
|
2006-12-05 23:36:10 +01:00
|
|
|
|
2012-12-10 21:54:36 +01:00
|
|
|
/* Context activation for state handler is done by the caller. */
|
2009-05-14 19:40:56 +02:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_undefined(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2009-08-21 09:12:28 +02:00
|
|
|
ERR("Undefined state.\n");
|
2006-12-05 23:36:10 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_nop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2010-04-07 21:04:45 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
TRACE("%s: nop in current pipe config.\n", debug_d3dstate(state_id));
|
2010-04-07 21:04:45 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_fillmode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-01-02 21:45:30 +01:00
|
|
|
enum wined3d_fill_mode mode = state->render_states[WINED3D_RS_FILLMODE];
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-05 23:45:35 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
switch (mode)
|
|
|
|
{
|
2012-01-02 21:45:30 +01:00
|
|
|
case WINED3D_FILL_POINT:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
|
2006-12-05 23:45:35 +01:00
|
|
|
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
|
|
|
|
break;
|
2012-01-02 21:45:30 +01:00
|
|
|
case WINED3D_FILL_WIREFRAME:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
2006-12-05 23:45:35 +01:00
|
|
|
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
|
|
|
|
break;
|
2012-01-02 21:45:30 +01:00
|
|
|
case WINED3D_FILL_SOLID:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
2006-12-05 23:45:35 +01:00
|
|
|
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
|
|
|
|
break;
|
|
|
|
default:
|
2012-01-02 21:45:30 +01:00
|
|
|
FIXME("Unrecognized fill mode %#x.\n", mode);
|
2006-12-05 23:45:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_lighting(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
/* Lighting is not enabled if transformed vertices are drawn, but lighting
|
|
|
|
* does not affect the stream sources, so it is not grouped for
|
|
|
|
* performance reasons. This state reads the decoded vertex declaration,
|
|
|
|
* so if it is dirty don't do anything. The vertex declaration applying
|
|
|
|
* function calls this function for updating. */
|
|
|
|
if (isStateDirty(context, STATE_VDECL))
|
2007-01-10 11:37:03 +01:00
|
|
|
return;
|
2007-01-02 22:49:17 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_LIGHTING]
|
2013-09-12 12:23:29 +02:00
|
|
|
&& !context->stream_info.position_transformed)
|
2009-03-26 10:43:40 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_LIGHTING);
|
2006-12-08 01:39:55 +01:00
|
|
|
checkGLcall("glEnable GL_LIGHTING");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_LIGHTING);
|
2006-12-08 01:39:55 +01:00
|
|
|
checkGLcall("glDisable GL_LIGHTING");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_zenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-02-23 22:45:46 +01:00
|
|
|
enum wined3d_depth_buffer_type zenable = state->render_states[WINED3D_RS_ZENABLE];
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2012-02-23 22:45:46 +01:00
|
|
|
static UINT once;
|
|
|
|
|
2007-03-06 13:54:05 +01:00
|
|
|
/* No z test without depth stencil buffers */
|
2011-07-14 01:02:44 +02:00
|
|
|
if (!state->fb->depth_stencil)
|
2009-12-09 20:32:08 +01:00
|
|
|
{
|
2007-11-10 00:19:19 +01:00
|
|
|
TRACE("No Z buffer - disabling depth test\n");
|
2012-02-23 22:45:46 +01:00
|
|
|
zenable = WINED3D_ZB_FALSE;
|
2007-03-06 13:54:05 +01:00
|
|
|
}
|
|
|
|
|
2012-02-23 22:45:46 +01:00
|
|
|
switch (zenable)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-12-21 21:34:59 +01:00
|
|
|
case WINED3D_ZB_FALSE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_TEST);
|
2006-12-08 01:40:51 +01:00
|
|
|
checkGLcall("glDisable GL_DEPTH_TEST");
|
|
|
|
break;
|
2011-12-21 21:34:59 +01:00
|
|
|
case WINED3D_ZB_TRUE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
|
2006-12-08 01:40:51 +01:00
|
|
|
checkGLcall("glEnable GL_DEPTH_TEST");
|
|
|
|
break;
|
2011-12-21 21:34:59 +01:00
|
|
|
case WINED3D_ZB_USEW:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_TEST);
|
2006-12-08 01:40:51 +01:00
|
|
|
checkGLcall("glEnable GL_DEPTH_TEST");
|
|
|
|
FIXME("W buffer is not well handled\n");
|
|
|
|
break;
|
|
|
|
default:
|
2012-02-23 22:45:46 +01:00
|
|
|
FIXME("Unrecognized depth buffer type %#x.\n", zenable);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->gl_info->supported[ARB_DEPTH_CLAMP])
|
|
|
|
{
|
2013-09-12 12:23:29 +02:00
|
|
|
if (!zenable && context->stream_info.position_transformed)
|
2012-02-23 22:45:46 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_CLAMP);
|
2012-02-23 22:45:46 +01:00
|
|
|
checkGLcall("glEnable(GL_DEPTH_CLAMP)");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_CLAMP);
|
2012-02-23 22:45:46 +01:00
|
|
|
checkGLcall("glDisable(GL_DEPTH_CLAMP)");
|
|
|
|
}
|
2006-12-08 01:40:51 +01:00
|
|
|
}
|
2012-02-23 22:45:46 +01:00
|
|
|
else if (!zenable && !once++)
|
|
|
|
FIXME("Z buffer disabled, but ARB_depth_clamp isn't supported.\n");
|
2006-12-08 01:40:51 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_cullmode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2010-09-15 12:00:04 +02:00
|
|
|
/* glFrontFace() is set in context.c at context init and on an
|
|
|
|
* offscreen / onscreen rendering switch. */
|
2011-12-19 21:00:09 +01:00
|
|
|
switch (state->render_states[WINED3D_RS_CULLMODE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-01-03 23:06:54 +01:00
|
|
|
case WINED3D_CULL_NONE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_CULL_FACE);
|
2006-12-08 01:41:43 +01:00
|
|
|
checkGLcall("glDisable GL_CULL_FACE");
|
|
|
|
break;
|
2012-01-03 23:06:54 +01:00
|
|
|
case WINED3D_CULL_CW:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_CULL_FACE);
|
2006-12-08 01:41:43 +01:00
|
|
|
checkGLcall("glEnable GL_CULL_FACE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glCullFace(GL_FRONT);
|
2007-09-18 11:43:09 +02:00
|
|
|
checkGLcall("glCullFace(GL_FRONT)");
|
2006-12-08 01:41:43 +01:00
|
|
|
break;
|
2012-01-03 23:06:54 +01:00
|
|
|
case WINED3D_CULL_CCW:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_CULL_FACE);
|
2006-12-08 01:41:43 +01:00
|
|
|
checkGLcall("glEnable GL_CULL_FACE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glCullFace(GL_BACK);
|
2007-09-18 11:43:09 +02:00
|
|
|
checkGLcall("glCullFace(GL_BACK)");
|
2006-12-08 01:41:43 +01:00
|
|
|
break;
|
|
|
|
default:
|
2012-01-03 23:06:54 +01:00
|
|
|
FIXME("Unrecognized cull mode %#x.\n",
|
2011-12-19 21:00:09 +01:00
|
|
|
state->render_states[WINED3D_RS_CULLMODE]);
|
2006-12-08 01:41:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_shademode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
switch (state->render_states[WINED3D_RS_SHADEMODE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-01-02 21:45:29 +01:00
|
|
|
case WINED3D_SHADE_FLAT:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glShadeModel(GL_FLAT);
|
2006-12-08 01:42:16 +01:00
|
|
|
checkGLcall("glShadeModel(GL_FLAT)");
|
|
|
|
break;
|
2012-01-02 21:45:29 +01:00
|
|
|
case WINED3D_SHADE_GOURAUD:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glShadeModel(GL_SMOOTH);
|
2006-12-08 01:42:16 +01:00
|
|
|
checkGLcall("glShadeModel(GL_SMOOTH)");
|
|
|
|
break;
|
2012-01-02 21:45:29 +01:00
|
|
|
case WINED3D_SHADE_PHONG:
|
|
|
|
FIXME("WINED3D_SHADE_PHONG isn't supported.\n");
|
2006-12-08 01:42:16 +01:00
|
|
|
break;
|
|
|
|
default:
|
2012-01-02 21:45:29 +01:00
|
|
|
FIXME("Unrecognized shade mode %#x.\n",
|
2011-12-19 21:00:09 +01:00
|
|
|
state->render_states[WINED3D_RS_SHADEMODE]);
|
2006-12-08 01:42:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_ditherenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_DITHERENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_DITHER);
|
2006-12-08 01:42:43 +01:00
|
|
|
checkGLcall("glEnable GL_DITHER");
|
2010-09-15 12:00:04 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_DITHER);
|
2006-12-08 01:42:43 +01:00
|
|
|
checkGLcall("glDisable GL_DITHER");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_zwritenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ZWRITEENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDepthMask(1);
|
2006-12-08 01:43:25 +01:00
|
|
|
checkGLcall("glDepthMask(1)");
|
2010-09-15 12:00:04 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDepthMask(0);
|
2006-12-08 01:43:25 +01:00
|
|
|
checkGLcall("glDepthMask(0)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-20 21:42:14 +01:00
|
|
|
static GLenum gl_compare_func(enum wined3d_cmp_func f)
|
|
|
|
{
|
|
|
|
switch (f)
|
|
|
|
{
|
|
|
|
case WINED3D_CMP_NEVER:
|
|
|
|
return GL_NEVER;
|
|
|
|
case WINED3D_CMP_LESS:
|
|
|
|
return GL_LESS;
|
|
|
|
case WINED3D_CMP_EQUAL:
|
|
|
|
return GL_EQUAL;
|
|
|
|
case WINED3D_CMP_LESSEQUAL:
|
|
|
|
return GL_LEQUAL;
|
|
|
|
case WINED3D_CMP_GREATER:
|
|
|
|
return GL_GREATER;
|
|
|
|
case WINED3D_CMP_NOTEQUAL:
|
|
|
|
return GL_NOTEQUAL;
|
|
|
|
case WINED3D_CMP_GREATEREQUAL:
|
|
|
|
return GL_GEQUAL;
|
|
|
|
case WINED3D_CMP_ALWAYS:
|
|
|
|
return GL_ALWAYS;
|
|
|
|
default:
|
|
|
|
FIXME("Unrecognized compare function %#x.\n", f);
|
|
|
|
return GL_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_zfunc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-20 21:42:14 +01:00
|
|
|
GLenum depth_func = gl_compare_func(state->render_states[WINED3D_RS_ZFUNC]);
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-08 01:44:55 +01:00
|
|
|
|
2010-09-15 12:00:04 +02:00
|
|
|
if (!depth_func) return;
|
2007-09-11 15:33:14 +02:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDepthFunc(depth_func);
|
2010-09-15 12:00:04 +02:00
|
|
|
checkGLcall("glDepthFunc");
|
2006-12-08 01:44:55 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_ambient(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-29 11:35:57 +01:00
|
|
|
float col[4];
|
2006-12-08 01:45:26 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_AMBIENT], col);
|
2006-12-29 11:35:57 +01:00
|
|
|
TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
|
2006-12-08 01:45:26 +01:00
|
|
|
checkGLcall("glLightModel for MODEL_AMBIENT");
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_blendop_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
|
|
|
{
|
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
|
|
|
|
}
|
|
|
|
|
2011-12-19 15:16:53 +01:00
|
|
|
static GLenum gl_blend_op(enum wined3d_blend_op op)
|
2011-07-14 01:02:48 +02:00
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
2011-12-19 15:16:53 +01:00
|
|
|
case WINED3D_BLEND_OP_ADD:
|
2011-07-14 01:02:48 +02:00
|
|
|
return GL_FUNC_ADD_EXT;
|
2011-12-19 15:16:53 +01:00
|
|
|
case WINED3D_BLEND_OP_SUBTRACT:
|
2011-07-14 01:02:48 +02:00
|
|
|
return GL_FUNC_SUBTRACT_EXT;
|
2011-12-19 15:16:53 +01:00
|
|
|
case WINED3D_BLEND_OP_REVSUBTRACT:
|
2011-07-14 01:02:48 +02:00
|
|
|
return GL_FUNC_REVERSE_SUBTRACT_EXT;
|
2011-12-19 15:16:53 +01:00
|
|
|
case WINED3D_BLEND_OP_MIN:
|
2011-07-14 01:02:48 +02:00
|
|
|
return GL_MIN_EXT;
|
2011-12-19 15:16:53 +01:00
|
|
|
case WINED3D_BLEND_OP_MAX:
|
2011-07-14 01:02:48 +02:00
|
|
|
return GL_MAX_EXT;
|
|
|
|
default:
|
|
|
|
FIXME("Unhandled blend op %#x.\n", op);
|
|
|
|
return GL_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void state_blendop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
|
|
|
{
|
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
GLenum blend_equation_alpha = GL_FUNC_ADD_EXT;
|
|
|
|
GLenum blend_equation = GL_FUNC_ADD_EXT;
|
|
|
|
|
|
|
|
/* BLENDOPALPHA requires GL_EXT_blend_equation_separate, so make sure it is around */
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_BLENDOPALPHA]
|
2011-07-14 01:02:48 +02:00
|
|
|
&& !gl_info->supported[EXT_BLEND_EQUATION_SEPARATE])
|
|
|
|
{
|
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendEquationSeparateEXT\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
blend_equation = gl_blend_op(state->render_states[WINED3D_RS_BLENDOP]);
|
|
|
|
blend_equation_alpha = gl_blend_op(state->render_states[WINED3D_RS_BLENDOPALPHA]);
|
2011-07-14 01:02:48 +02:00
|
|
|
TRACE("blend_equation %#x, blend_equation_alpha %#x.\n", blend_equation, blend_equation_alpha);
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SEPARATEALPHABLENDENABLE])
|
2011-07-14 01:02:48 +02:00
|
|
|
{
|
|
|
|
GL_EXTCALL(glBlendEquationSeparateEXT(blend_equation, blend_equation_alpha));
|
|
|
|
checkGLcall("glBlendEquationSeparateEXT");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GL_EXTCALL(glBlendEquationEXT(blend_equation));
|
|
|
|
checkGLcall("glBlendEquation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-19 15:16:52 +01:00
|
|
|
static GLenum gl_blend_factor(enum wined3d_blend factor, const struct wined3d_format *dst_format)
|
2011-05-05 20:56:08 +02:00
|
|
|
{
|
|
|
|
switch (factor)
|
|
|
|
{
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_ZERO:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_ZERO;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_ONE:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_ONE;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_SRCCOLOR:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_SRC_COLOR;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_INVSRCCOLOR:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_ONE_MINUS_SRC_COLOR;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_SRCALPHA:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_SRC_ALPHA;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_INVSRCALPHA:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_ONE_MINUS_SRC_ALPHA;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_DESTCOLOR:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_DST_COLOR;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_INVDESTCOLOR:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_ONE_MINUS_DST_COLOR;
|
|
|
|
/* To compensate for the lack of format switching with backbuffer
|
|
|
|
* offscreen rendering, and with onscreen rendering, we modify the
|
|
|
|
* alpha test parameters for (INV)DESTALPHA if the render target
|
2011-05-09 09:03:40 +02:00
|
|
|
* doesn't support alpha blending. A nonexistent alpha channel
|
2011-12-19 15:16:52 +01:00
|
|
|
* returns 1.0, so WINED3D_BLEND_DESTALPHA becomes GL_ONE, and
|
|
|
|
* WINED3D_BLEND_INVDESTALPHA becomes GL_ZERO. */
|
|
|
|
case WINED3D_BLEND_DESTALPHA:
|
2012-08-15 00:38:25 +02:00
|
|
|
return dst_format->alpha_size ? GL_DST_ALPHA : GL_ONE;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_INVDESTALPHA:
|
2012-08-15 00:38:25 +02:00
|
|
|
return dst_format->alpha_size ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_SRCALPHASAT:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_SRC_ALPHA_SATURATE;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_BLENDFACTOR:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_CONSTANT_COLOR_EXT;
|
2011-12-19 15:16:52 +01:00
|
|
|
case WINED3D_BLEND_INVBLENDFACTOR:
|
2011-05-05 20:56:08 +02:00
|
|
|
return GL_ONE_MINUS_CONSTANT_COLOR_EXT;
|
|
|
|
default:
|
|
|
|
FIXME("Unhandled blend factor %#x.\n", factor);
|
|
|
|
return GL_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_blend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-07-14 01:02:44 +02:00
|
|
|
const struct wined3d_surface *target = state->fb->render_targets[0];
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2011-05-05 20:56:08 +02:00
|
|
|
GLenum srcBlend, dstBlend;
|
2011-12-19 15:16:52 +01:00
|
|
|
enum wined3d_blend d3d_blend;
|
2006-12-08 01:51:11 +01:00
|
|
|
|
2010-09-15 12:00:04 +02:00
|
|
|
/* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific
|
|
|
|
* blending parameters to work. */
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ALPHABLENDENABLE]
|
|
|
|
|| state->render_states[WINED3D_RS_EDGEANTIALIAS]
|
|
|
|
|| state->render_states[WINED3D_RS_ANTIALIASEDLINEENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
|
|
|
/* Disable blending in all cases even without pixelshaders.
|
|
|
|
* With blending on we could face a big performance penalty.
|
2008-03-29 15:48:15 +01:00
|
|
|
* The d3d9 visual test confirms the behavior. */
|
2009-12-09 11:51:19 +01:00
|
|
|
if (context->render_offscreen
|
2010-11-12 13:12:05 +01:00
|
|
|
&& !(target->resource.format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
|
2009-03-12 09:53:15 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
|
2008-03-28 10:02:39 +01:00
|
|
|
checkGLcall("glDisable GL_BLEND");
|
|
|
|
return;
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_BLEND);
|
2008-03-28 10:02:39 +01:00
|
|
|
checkGLcall("glEnable GL_BLEND");
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_BLEND);
|
2006-12-08 01:51:11 +01:00
|
|
|
checkGLcall("glDisable GL_BLEND");
|
|
|
|
/* Nothing more to do - get out */
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
2011-12-19 15:16:52 +01:00
|
|
|
/* WINED3D_BLEND_BOTHSRCALPHA and WINED3D_BLEND_BOTHINVSRCALPHA are legacy
|
2011-05-05 20:56:08 +02:00
|
|
|
* source blending values which are still valid up to d3d9. They should
|
|
|
|
* not occur as dest blend values. */
|
2011-12-19 21:00:09 +01:00
|
|
|
d3d_blend = state->render_states[WINED3D_RS_SRCBLEND];
|
2011-12-19 15:16:52 +01:00
|
|
|
if (d3d_blend == WINED3D_BLEND_BOTHSRCALPHA)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-05-05 20:56:08 +02:00
|
|
|
srcBlend = GL_SRC_ALPHA;
|
|
|
|
dstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
2006-12-08 01:51:11 +01:00
|
|
|
}
|
2011-12-19 15:16:52 +01:00
|
|
|
else if (d3d_blend == WINED3D_BLEND_BOTHINVSRCALPHA)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-05-05 20:56:08 +02:00
|
|
|
srcBlend = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
dstBlend = GL_SRC_ALPHA;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
srcBlend = gl_blend_factor(d3d_blend, target->resource.format);
|
2011-12-19 21:00:09 +01:00
|
|
|
dstBlend = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLEND],
|
2011-05-05 20:56:08 +02:00
|
|
|
target->resource.format);
|
2007-08-12 21:44:30 +02:00
|
|
|
}
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_EDGEANTIALIAS]
|
|
|
|
|| state->render_states[WINED3D_RS_ANTIALIASEDLINEENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_LINE_SMOOTH);
|
2006-12-08 01:51:11 +01:00
|
|
|
checkGLcall("glEnable(GL_LINE_SMOOTH)");
|
2012-07-24 11:32:27 +02:00
|
|
|
if (srcBlend != GL_SRC_ALPHA)
|
|
|
|
WARN("WINED3D_RS_EDGEANTIALIAS enabled, but unexpected src blending param.\n");
|
|
|
|
if (dstBlend != GL_ONE_MINUS_SRC_ALPHA && dstBlend != GL_ONE)
|
|
|
|
WARN("WINED3D_RS_EDGEANTIALIAS enabled, but unexpected dst blending param.\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_LINE_SMOOTH);
|
2006-12-08 01:51:11 +01:00
|
|
|
checkGLcall("glDisable(GL_LINE_SMOOTH)");
|
|
|
|
}
|
|
|
|
|
2008-02-16 16:42:11 +01:00
|
|
|
/* Re-apply BLENDOP(ALPHA) because of a possible SEPARATEALPHABLENDENABLE change */
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_BLENDOP)))
|
|
|
|
state_blendop(context, state, STATE_RENDER(WINED3D_RS_BLENDOPALPHA));
|
2008-02-16 16:42:11 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SEPARATEALPHABLENDENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-05-05 20:56:08 +02:00
|
|
|
GLenum srcBlendAlpha, dstBlendAlpha;
|
2008-02-16 16:42:11 +01:00
|
|
|
|
|
|
|
/* Separate alpha blending requires GL_EXT_blend_function_separate, so make sure it is around */
|
2009-10-29 10:37:11 +01:00
|
|
|
if (!context->gl_info->supported[EXT_BLEND_FUNC_SEPARATE])
|
|
|
|
{
|
2008-02-16 16:42:11 +01:00
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendFuncSeparateEXT\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-19 15:16:52 +01:00
|
|
|
/* WINED3D_BLEND_BOTHSRCALPHA and WINED3D_BLEND_BOTHINVSRCALPHA are legacy
|
2011-05-05 20:56:08 +02:00
|
|
|
* source blending values which are still valid up to d3d9. They should
|
|
|
|
* not occur as dest blend values. */
|
2011-12-19 21:00:09 +01:00
|
|
|
d3d_blend = state->render_states[WINED3D_RS_SRCBLENDALPHA];
|
2011-12-19 15:16:52 +01:00
|
|
|
if (d3d_blend == WINED3D_BLEND_BOTHSRCALPHA)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-05-05 20:56:08 +02:00
|
|
|
srcBlendAlpha = GL_SRC_ALPHA;
|
|
|
|
dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
2008-02-16 16:42:11 +01:00
|
|
|
}
|
2011-12-19 15:16:52 +01:00
|
|
|
else if (d3d_blend == WINED3D_BLEND_BOTHINVSRCALPHA)
|
2011-05-05 20:56:08 +02:00
|
|
|
{
|
|
|
|
srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
dstBlendAlpha = GL_SRC_ALPHA;
|
|
|
|
}
|
|
|
|
else
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-05-05 20:56:08 +02:00
|
|
|
srcBlendAlpha = gl_blend_factor(d3d_blend, target->resource.format);
|
2011-12-19 21:00:09 +01:00
|
|
|
dstBlendAlpha = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLENDALPHA],
|
2011-05-05 20:56:08 +02:00
|
|
|
target->resource.format);
|
2008-02-16 16:42:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
GL_EXTCALL(glBlendFuncSeparateEXT(srcBlend, dstBlend, srcBlendAlpha, dstBlendAlpha));
|
|
|
|
checkGLcall("glBlendFuncSeparateEXT");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-16 16:42:11 +01:00
|
|
|
TRACE("glBlendFunc src=%x, dst=%x\n", srcBlend, dstBlend);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glBlendFunc(srcBlend, dstBlend);
|
2008-02-16 16:42:11 +01:00
|
|
|
checkGLcall("glBlendFunc");
|
|
|
|
}
|
2008-01-21 05:17:49 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
/* Colorkey fixup for stage 0 alphaop depends on
|
2011-12-19 21:00:09 +01:00
|
|
|
* WINED3D_RS_ALPHABLENDENABLE state, so it may need updating. */
|
|
|
|
if (state->render_states[WINED3D_RS_COLORKEYENABLE])
|
2012-01-09 22:16:51 +01:00
|
|
|
context_apply_state(context, state, STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP));
|
2006-12-25 18:46:59 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_blendfactor_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2008-07-05 22:35:53 +02:00
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendColorEXT\n");
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_blendfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-25 18:46:59 +01:00
|
|
|
float col[4];
|
2006-12-08 01:51:11 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
TRACE("Setting blend factor to %#x.\n", state->render_states[WINED3D_RS_BLENDFACTOR]);
|
|
|
|
|
|
|
|
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_BLENDFACTOR], col);
|
2007-10-06 17:42:39 +02:00
|
|
|
GL_EXTCALL(glBlendColorEXT (col[0],col[1],col[2],col[3]));
|
2006-12-08 01:51:11 +01:00
|
|
|
checkGLcall("glBlendColor");
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_alpha(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-08 20:21:32 +01:00
|
|
|
int glParm = 0;
|
|
|
|
float ref;
|
|
|
|
BOOL enable_ckey = FALSE;
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
2009-02-19 08:53:50 +01:00
|
|
|
|
2014-01-09 12:17:00 +01:00
|
|
|
/* Find out if the texture on the first stage has a ckey set. The alpha
|
|
|
|
* state func reads the texture settings, even though alpha and texture
|
|
|
|
* are not grouped together. This is to avoid making a huge alpha +
|
|
|
|
* texture + texture stage + ckey block due to the hardly used
|
|
|
|
* WINED3D_RS_COLORKEYENABLE state(which is d3d <= 3 only). The texture
|
|
|
|
* function will call alpha in case it finds some texture + colorkeyenable
|
|
|
|
* combination which needs extra care. */
|
|
|
|
if (state->textures[0] && (state->textures[0]->color_key_flags & WINEDDSD_CKSRCBLT))
|
|
|
|
enable_ckey = TRUE;
|
2006-12-08 20:21:32 +01:00
|
|
|
|
2009-12-09 20:32:08 +01:00
|
|
|
if (enable_ckey || context->last_was_ckey)
|
2012-01-09 22:16:51 +01:00
|
|
|
context_apply_state(context, state, STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP));
|
2007-02-15 03:04:18 +01:00
|
|
|
context->last_was_ckey = enable_ckey;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ALPHATESTENABLE]
|
|
|
|
|| (state->render_states[WINED3D_RS_COLORKEYENABLE] && enable_ckey))
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
|
2006-12-08 20:21:32 +01:00
|
|
|
checkGLcall("glEnable GL_ALPHA_TEST");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
|
2006-12-08 20:21:32 +01:00
|
|
|
checkGLcall("glDisable GL_ALPHA_TEST");
|
|
|
|
/* Alpha test is disabled, don't bother setting the params - it will happen on the next
|
|
|
|
* enable call
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_COLORKEYENABLE] && enable_ckey)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2006-12-08 20:21:32 +01:00
|
|
|
glParm = GL_NOTEQUAL;
|
2009-07-07 11:08:01 +02:00
|
|
|
ref = 0.0f;
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
ref = ((float)state->render_states[WINED3D_RS_ALPHAREF]) / 255.0f;
|
2011-12-20 21:42:14 +01:00
|
|
|
glParm = gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]);
|
2006-12-08 20:21:32 +01:00
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
if (glParm)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glAlphaFunc(glParm, ref);
|
2006-12-08 20:21:32 +01:00
|
|
|
checkGLcall("glAlphaFunc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2012-07-20 00:24:27 +02:00
|
|
|
DWORD enable = 0xffffffff;
|
2006-12-08 18:01:23 +01:00
|
|
|
DWORD disable = 0x00000000;
|
|
|
|
|
2013-05-29 09:45:37 +02:00
|
|
|
if (use_vs(state) && !context->d3d_info->vs_clipping)
|
|
|
|
{
|
|
|
|
static BOOL warned;
|
|
|
|
|
|
|
|
/* The OpenGL spec says that clipping planes are disabled when using
|
|
|
|
* shaders. Direct3D planes aren't, so that is an issue. The MacOS ATI
|
|
|
|
* driver keeps clipping planes activated with shaders in some
|
|
|
|
* conditions I got sick of tracking down. The shader state handler
|
|
|
|
* disables all clip planes because of that - don't do anything here
|
|
|
|
* and keep them disabled. */
|
|
|
|
if (state->render_states[WINED3D_RS_CLIPPLANEENABLE] && !warned++)
|
|
|
|
FIXME("Clipping not supported with vertex shaders\n");
|
|
|
|
return;
|
2007-02-27 23:11:15 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:37 +02:00
|
|
|
/* glEnable(GL_CLIP_PLANEx) doesn't apply to (ARB backend) vertex shaders.
|
|
|
|
* The enabled / disabled planes are hardcoded into the shader. Update the
|
|
|
|
* shader to update the enabled clipplanes. In case of fixed function, we
|
|
|
|
* need to update the clipping field from ffp_vertex_settings. */
|
2013-08-21 08:29:27 +02:00
|
|
|
context->shader_update_mask |= 1 << WINED3D_SHADER_TYPE_VERTEX;
|
2013-05-29 09:45:37 +02:00
|
|
|
|
2007-06-07 11:48:55 +02:00
|
|
|
/* TODO: Keep track of previously enabled clipplanes to avoid unnecessary resetting
|
2006-12-08 18:01:23 +01:00
|
|
|
* of already set values
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* If enabling / disabling all
|
|
|
|
* TODO: Is this correct? Doesn't D3DRS_CLIPPING disable clipping on the viewport frustrum?
|
|
|
|
*/
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_CLIPPING])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
enable = state->render_states[WINED3D_RS_CLIPPLANEENABLE];
|
|
|
|
disable = ~state->render_states[WINED3D_RS_CLIPPLANEENABLE];
|
2011-06-05 22:48:50 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-08 18:01:23 +01:00
|
|
|
disable = 0xffffffff;
|
|
|
|
enable = 0x00;
|
|
|
|
}
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
if (enable & WINED3DCLIPPLANE0) gl_info->gl_ops.gl.p_glEnable(GL_CLIP_PLANE0);
|
|
|
|
if (enable & WINED3DCLIPPLANE1) gl_info->gl_ops.gl.p_glEnable(GL_CLIP_PLANE1);
|
|
|
|
if (enable & WINED3DCLIPPLANE2) gl_info->gl_ops.gl.p_glEnable(GL_CLIP_PLANE2);
|
|
|
|
if (enable & WINED3DCLIPPLANE3) gl_info->gl_ops.gl.p_glEnable(GL_CLIP_PLANE3);
|
|
|
|
if (enable & WINED3DCLIPPLANE4) gl_info->gl_ops.gl.p_glEnable(GL_CLIP_PLANE4);
|
|
|
|
if (enable & WINED3DCLIPPLANE5) gl_info->gl_ops.gl.p_glEnable(GL_CLIP_PLANE5);
|
|
|
|
checkGLcall("clip plane enable");
|
|
|
|
|
|
|
|
if (disable & WINED3DCLIPPLANE0) gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE0);
|
|
|
|
if (disable & WINED3DCLIPPLANE1) gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE1);
|
|
|
|
if (disable & WINED3DCLIPPLANE2) gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE2);
|
|
|
|
if (disable & WINED3DCLIPPLANE3) gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE3);
|
|
|
|
if (disable & WINED3DCLIPPLANE4) gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE4);
|
|
|
|
if (disable & WINED3DCLIPPLANE5) gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE5);
|
|
|
|
checkGLcall("clip plane disable");
|
2006-12-08 18:01:23 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_specularenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2009-10-22 10:09:54 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-08 18:38:30 +01:00
|
|
|
/* Originally this used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR)
|
|
|
|
* and (GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR) to swap between enabled/disabled
|
|
|
|
* specular color. This is wrong:
|
|
|
|
* Separate specular color means the specular colour is maintained separately, whereas
|
|
|
|
* single color means it is merged in. However in both cases they are being used to
|
|
|
|
* some extent.
|
|
|
|
* To disable specular color, set it explicitly to black and turn off GL_COLOR_SUM_EXT
|
|
|
|
* NOTE: If not supported don't give FIXMEs the impact is really minimal and very few people are
|
|
|
|
* running 1.4 yet!
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* If register combiners are enabled, enabling / disabling GL_COLOR_SUM has no effect.
|
|
|
|
* Instead, we need to setup the FinalCombiner properly.
|
|
|
|
*
|
|
|
|
* The default setup for the FinalCombiner is:
|
|
|
|
*
|
|
|
|
* <variable> <input> <mapping> <usage>
|
|
|
|
* GL_VARIABLE_A_NV GL_FOG, GL_UNSIGNED_IDENTITY_NV GL_ALPHA
|
|
|
|
* GL_VARIABLE_B_NV GL_SPARE0_PLUS_SECONDARY_COLOR_NV GL_UNSIGNED_IDENTITY_NV GL_RGB
|
|
|
|
* GL_VARIABLE_C_NV GL_FOG GL_UNSIGNED_IDENTITY_NV GL_RGB
|
|
|
|
* GL_VARIABLE_D_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
|
|
|
|
* GL_VARIABLE_E_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
|
|
|
|
* GL_VARIABLE_F_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
|
|
|
|
* GL_VARIABLE_G_NV GL_SPARE0_NV GL_UNSIGNED_IDENTITY_NV GL_ALPHA
|
|
|
|
*
|
|
|
|
* That's pretty much fine as it is, except for variable B, which needs to take
|
|
|
|
* either GL_SPARE0_PLUS_SECONDARY_COLOR_NV or GL_SPARE0_NV, depending on
|
2011-12-19 21:00:09 +01:00
|
|
|
* whether WINED3D_RS_SPECULARENABLE is enabled or not.
|
2006-12-08 18:38:30 +01:00
|
|
|
*/
|
|
|
|
|
2007-06-15 21:33:54 +02:00
|
|
|
TRACE("Setting specular enable state and materials\n");
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SPECULARENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float *)&state->material.specular);
|
2006-12-08 18:38:30 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
2007-06-15 22:38:14 +02:00
|
|
|
|
2011-11-20 20:27:13 +01:00
|
|
|
if (state->material.power > gl_info->limits.shininess)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2007-06-15 22:38:14 +02:00
|
|
|
/* glMaterialf man page says that the material says that GL_SHININESS must be between 0.0
|
2008-03-02 00:02:18 +01:00
|
|
|
* and 128.0, although in d3d neither -1 nor 129 produce an error. GL_NV_max_light_exponent
|
2009-10-29 10:37:10 +01:00
|
|
|
* allows bigger values. If the extension is supported, gl_info->limits.shininess contains the
|
|
|
|
* value reported by the extension, otherwise 128. For values > gl_info->limits.shininess clamp
|
2008-04-22 08:18:14 +02:00
|
|
|
* them, it should be safe to do so without major visual distortions.
|
2007-06-15 22:38:14 +02:00
|
|
|
*/
|
2011-11-20 20:27:13 +01:00
|
|
|
WARN("Material power = %.8e, limit %.8e\n", state->material.power, gl_info->limits.shininess);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, gl_info->limits.shininess);
|
2010-09-16 11:19:55 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, state->material.power);
|
2007-06-15 22:38:14 +02:00
|
|
|
}
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glMaterialf(GL_SHININESS)");
|
2007-06-15 22:38:14 +02:00
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_COLOR_SUM_EXT);
|
2009-10-29 10:37:11 +01:00
|
|
|
else
|
2006-12-08 18:38:30 +01:00
|
|
|
TRACE("Specular colors cannot be enabled in this version of opengl\n");
|
|
|
|
checkGLcall("glEnable(GL_COLOR_SUM)");
|
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[NV_REGISTER_COMBINERS])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2006-12-08 18:38:30 +01:00
|
|
|
GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_PLUS_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB));
|
|
|
|
checkGLcall("glFinalCombinerInputNV()");
|
|
|
|
}
|
|
|
|
} else {
|
2008-12-10 10:04:40 +01:00
|
|
|
static const GLfloat black[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
2006-12-08 18:38:30 +01:00
|
|
|
|
|
|
|
/* for the case of enabled lighting: */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
|
2006-12-08 18:38:30 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
|
|
|
/* for the case of disabled lighting: */
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_COLOR_SUM_EXT);
|
2009-10-29 10:37:11 +01:00
|
|
|
else
|
2006-12-08 18:38:30 +01:00
|
|
|
TRACE("Specular colors cannot be disabled in this version of opengl\n");
|
|
|
|
checkGLcall("glDisable(GL_COLOR_SUM)");
|
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[NV_REGISTER_COMBINERS])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2006-12-08 18:38:30 +01:00
|
|
|
GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB));
|
|
|
|
checkGLcall("glFinalCombinerInputNV()");
|
|
|
|
}
|
|
|
|
}
|
2007-06-15 21:33:54 +02:00
|
|
|
|
2011-11-20 20:27:13 +01:00
|
|
|
TRACE("diffuse {%.8e, %.8e, %.8e, %.8e}\n",
|
|
|
|
state->material.diffuse.r, state->material.diffuse.g,
|
|
|
|
state->material.diffuse.b, state->material.diffuse.a);
|
|
|
|
TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n",
|
|
|
|
state->material.ambient.r, state->material.ambient.g,
|
|
|
|
state->material.ambient.b, state->material.ambient.a);
|
|
|
|
TRACE("specular {%.8e, %.8e, %.8e, %.8e}\n",
|
|
|
|
state->material.specular.r, state->material.specular.g,
|
|
|
|
state->material.specular.b, state->material.specular.a);
|
|
|
|
TRACE("emissive {%.8e, %.8e, %.8e, %.8e}\n",
|
|
|
|
state->material.emissive.r, state->material.emissive.g,
|
|
|
|
state->material.emissive.b, state->material.emissive.a);
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient);
|
2007-06-15 21:33:54 +02:00
|
|
|
checkGLcall("glMaterialfv(GL_AMBIENT)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.diffuse);
|
2007-06-15 21:33:54 +02:00
|
|
|
checkGLcall("glMaterialfv(GL_DIFFUSE)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float *)&state->material.emissive);
|
2007-06-15 21:33:54 +02:00
|
|
|
checkGLcall("glMaterialfv(GL_EMISSION)");
|
2006-12-08 18:38:30 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-08 18:37:17 +01:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
/* Note the texture color applies to all textures whereas
|
2011-07-14 01:02:48 +02:00
|
|
|
* GL_TEXTURE_ENV_COLOR applies to active only. */
|
2006-12-29 11:35:57 +01:00
|
|
|
float col[4];
|
2011-12-19 21:00:09 +01:00
|
|
|
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col);
|
2006-12-08 18:37:17 +01:00
|
|
|
|
2008-07-06 01:31:34 +02:00
|
|
|
/* And now the default texture color as well */
|
2013-04-25 15:20:30 +02:00
|
|
|
for (i = 0; i < context->d3d_info->limits.ffp_blend_stages; ++i)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
/* Note the WINED3D_RS value applies to all textures, but GL has one
|
|
|
|
* per texture, so apply it now ready to be used! */
|
2011-08-03 01:34:15 +02:00
|
|
|
context_active_texture(context, gl_info, i);
|
2008-07-06 01:31:34 +02:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
|
2008-07-06 01:31:34 +02:00
|
|
|
checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
|
2006-12-08 18:37:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-19 10:55:38 +02:00
|
|
|
static void renderstate_stencil_twosided(struct wined3d_context *context, GLint face,
|
|
|
|
GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass)
|
|
|
|
{
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
2008-04-23 21:53:59 +02:00
|
|
|
checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
|
|
|
|
GL_EXTCALL(glActiveStencilFaceEXT(face));
|
|
|
|
checkGLcall("glActiveStencilFaceEXT(...)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glStencilFunc(func, ref, mask);
|
2008-04-23 21:53:59 +02:00
|
|
|
checkGLcall("glStencilFunc(...)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glStencilOp(stencilFail, depthFail, stencilPass);
|
2008-04-23 21:53:59 +02:00
|
|
|
checkGLcall("glStencilOp(...)");
|
2006-12-08 18:39:45 +01:00
|
|
|
}
|
|
|
|
|
2012-01-03 23:06:55 +01:00
|
|
|
static GLenum gl_stencil_op(enum wined3d_stencil_op op)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case WINED3D_STENCIL_OP_KEEP:
|
|
|
|
return GL_KEEP;
|
|
|
|
case WINED3D_STENCIL_OP_ZERO:
|
|
|
|
return GL_ZERO;
|
|
|
|
case WINED3D_STENCIL_OP_REPLACE:
|
|
|
|
return GL_REPLACE;
|
|
|
|
case WINED3D_STENCIL_OP_INCR_SAT:
|
|
|
|
return GL_INCR;
|
|
|
|
case WINED3D_STENCIL_OP_DECR_SAT:
|
|
|
|
return GL_DECR;
|
|
|
|
case WINED3D_STENCIL_OP_INVERT:
|
|
|
|
return GL_INVERT;
|
|
|
|
case WINED3D_STENCIL_OP_INCR:
|
|
|
|
return GL_INCR_WRAP_EXT;
|
|
|
|
case WINED3D_STENCIL_OP_DECR:
|
|
|
|
return GL_DECR_WRAP_EXT;
|
|
|
|
default:
|
|
|
|
FIXME("Unrecognized stencil op %#x.\n", op);
|
|
|
|
return GL_KEEP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2013-10-12 11:11:57 +02:00
|
|
|
DWORD onesided_enable;
|
|
|
|
DWORD twosided_enable;
|
2013-10-29 10:28:03 +01:00
|
|
|
GLint func;
|
|
|
|
GLint func_ccw;
|
|
|
|
GLint ref;
|
|
|
|
GLuint mask;
|
|
|
|
GLint stencilFail;
|
|
|
|
GLint stencilFail_ccw;
|
|
|
|
GLint stencilPass;
|
|
|
|
GLint stencilPass_ccw;
|
|
|
|
GLint depthFail;
|
|
|
|
GLint depthFail_ccw;
|
2006-12-08 18:39:45 +01:00
|
|
|
|
2009-12-09 20:32:08 +01:00
|
|
|
/* No stencil test without a stencil buffer. */
|
2011-07-14 01:02:44 +02:00
|
|
|
if (!state->fb->depth_stencil)
|
2009-12-09 20:32:08 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST);
|
2007-03-06 13:54:05 +01:00
|
|
|
checkGLcall("glDisable GL_STENCIL_TEST");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
onesided_enable = state->render_states[WINED3D_RS_STENCILENABLE];
|
|
|
|
twosided_enable = state->render_states[WINED3D_RS_TWOSIDEDSTENCILMODE];
|
2011-12-20 21:42:14 +01:00
|
|
|
if (!(func = gl_compare_func(state->render_states[WINED3D_RS_STENCILFUNC])))
|
2007-07-30 19:28:33 +02:00
|
|
|
func = GL_ALWAYS;
|
2011-12-20 21:42:14 +01:00
|
|
|
if (!(func_ccw = gl_compare_func(state->render_states[WINED3D_RS_CCW_STENCILFUNC])))
|
2007-09-14 11:57:42 +02:00
|
|
|
func_ccw = GL_ALWAYS;
|
2011-12-19 21:00:09 +01:00
|
|
|
ref = state->render_states[WINED3D_RS_STENCILREF];
|
|
|
|
mask = state->render_states[WINED3D_RS_STENCILMASK];
|
2012-01-03 23:06:55 +01:00
|
|
|
stencilFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILFAIL]);
|
|
|
|
depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]);
|
|
|
|
stencilPass = gl_stencil_op(state->render_states[WINED3D_RS_STENCILPASS]);
|
|
|
|
stencilFail_ccw = gl_stencil_op(state->render_states[WINED3D_RS_CCW_STENCILFAIL]);
|
|
|
|
depthFail_ccw = gl_stencil_op(state->render_states[WINED3D_RS_CCW_STENCILZFAIL]);
|
|
|
|
stencilPass_ccw = gl_stencil_op(state->render_states[WINED3D_RS_CCW_STENCILPASS]);
|
2006-12-08 18:39:45 +01:00
|
|
|
|
2007-01-09 23:42:26 +01:00
|
|
|
TRACE("(onesided %d, twosided %d, ref %x, mask %x, "
|
|
|
|
"GL_FRONT: func: %x, fail %x, zfail %x, zpass %x "
|
|
|
|
"GL_BACK: func: %x, fail %x, zfail %x, zpass %x )\n",
|
2006-12-08 18:39:45 +01:00
|
|
|
onesided_enable, twosided_enable, ref, mask,
|
|
|
|
func, stencilFail, depthFail, stencilPass,
|
|
|
|
func_ccw, stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
if (twosided_enable && onesided_enable)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST);
|
2007-09-14 12:00:46 +02:00
|
|
|
checkGLcall("glEnable GL_STENCIL_TEST");
|
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2008-04-23 21:53:59 +02:00
|
|
|
/* Apply back first, then front. This function calls glActiveStencilFaceEXT,
|
|
|
|
* which has an effect on the code below too. If we apply the front face
|
|
|
|
* afterwards, we are sure that the active stencil face is set to front,
|
|
|
|
* and other stencil functions which do not use two sided stencil do not have
|
|
|
|
* to set it back
|
|
|
|
*/
|
2009-08-19 10:55:38 +02:00
|
|
|
renderstate_stencil_twosided(context, GL_BACK,
|
|
|
|
func_ccw, ref, mask, stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
|
|
|
|
renderstate_stencil_twosided(context, GL_FRONT,
|
|
|
|
func, ref, mask, stencilFail, depthFail, stencilPass);
|
2009-10-29 10:37:11 +01:00
|
|
|
}
|
2010-01-04 21:33:10 +01:00
|
|
|
else if (gl_info->supported[ATI_SEPARATE_STENCIL])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2008-04-23 21:53:59 +02:00
|
|
|
GL_EXTCALL(glStencilFuncSeparateATI(func, func_ccw, ref, mask));
|
|
|
|
checkGLcall("glStencilFuncSeparateATI(...)");
|
|
|
|
GL_EXTCALL(glStencilOpSeparateATI(GL_FRONT, stencilFail, depthFail, stencilPass));
|
|
|
|
checkGLcall("glStencilOpSeparateATI(GL_FRONT, ...)");
|
|
|
|
GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail_ccw, depthFail_ccw, stencilPass_ccw));
|
|
|
|
checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)");
|
|
|
|
} else {
|
|
|
|
ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n");
|
|
|
|
}
|
2009-10-29 10:37:11 +01:00
|
|
|
}
|
|
|
|
else if(onesided_enable)
|
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
2007-09-14 12:02:56 +02:00
|
|
|
checkGLcall("glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
|
2006-12-08 18:39:45 +01:00
|
|
|
}
|
2007-09-14 12:02:56 +02:00
|
|
|
|
2008-04-23 21:53:59 +02:00
|
|
|
/* This code disables the ATI extension as well, since the standard stencil functions are equal
|
|
|
|
* to calling the ATI functions with GL_FRONT_AND_BACK as face parameter
|
|
|
|
*/
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_STENCIL_TEST);
|
2007-09-14 12:02:56 +02:00
|
|
|
checkGLcall("glEnable GL_STENCIL_TEST");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glStencilFunc(func, ref, mask);
|
2007-09-14 12:02:56 +02:00
|
|
|
checkGLcall("glStencilFunc(...)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glStencilOp(stencilFail, depthFail, stencilPass);
|
2007-09-14 12:02:56 +02:00
|
|
|
checkGLcall("glStencilOp(...)");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST);
|
2007-09-14 12:02:56 +02:00
|
|
|
checkGLcall("glDisable GL_STENCIL_TEST");
|
2006-12-08 18:39:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_stencilwrite2s(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
DWORD mask = state->fb->depth_stencil ? state->render_states[WINED3D_RS_STENCILWRITEMASK] : 0;
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2007-09-14 11:57:07 +02:00
|
|
|
|
2008-07-05 22:35:53 +02:00
|
|
|
GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK));
|
|
|
|
checkGLcall("glActiveStencilFaceEXT(GL_BACK)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glStencilMask(mask);
|
2008-07-05 22:35:53 +02:00
|
|
|
checkGLcall("glStencilMask");
|
|
|
|
GL_EXTCALL(glActiveStencilFaceEXT(GL_FRONT));
|
|
|
|
checkGLcall("glActiveStencilFaceEXT(GL_FRONT)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glStencilMask(mask);
|
2008-07-05 22:35:53 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_stencilwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
DWORD mask = state->fb->depth_stencil ? state->render_states[WINED3D_RS_STENCILWRITEMASK] : 0;
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2008-07-05 22:35:53 +02:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glStencilMask(mask);
|
2006-12-08 18:41:05 +01:00
|
|
|
checkGLcall("glStencilMask");
|
|
|
|
}
|
|
|
|
|
2013-06-06 10:16:49 +02:00
|
|
|
static void state_fog_vertexpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-09-10 23:05:33 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2012-07-24 11:32:27 +02:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
2009-02-19 08:53:50 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!state->render_states[WINED3D_RS_FOGENABLE])
|
2011-07-14 01:02:48 +02:00
|
|
|
return;
|
2008-12-15 19:37:36 +01:00
|
|
|
|
|
|
|
/* Table fog on: Never use fog coords, and use per-fragment fog */
|
2011-12-21 21:35:00 +01:00
|
|
|
if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glHint(GL_FOG_HINT, GL_NICEST);
|
|
|
|
if (context->fog_coord)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2008-12-15 19:37:36 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
|
|
|
context->fog_coord = FALSE;
|
|
|
|
}
|
2011-09-10 23:05:33 +02:00
|
|
|
|
|
|
|
/* Range fog is only used with per-vertex fog in d3d */
|
|
|
|
if (gl_info->supported[NV_FOG_DISTANCE])
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV);
|
2011-09-10 23:05:33 +02:00
|
|
|
checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV)");
|
|
|
|
}
|
2008-12-15 19:37:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise use per-vertex fog in any case */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glHint(GL_FOG_HINT, GL_FASTEST);
|
2008-12-15 19:37:36 +01:00
|
|
|
|
2011-12-21 21:35:00 +01:00
|
|
|
if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE || context->last_was_rhw)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2008-12-15 19:37:36 +01:00
|
|
|
/* No fog at all, or transformed vertices: Use fog coord */
|
2012-07-24 11:32:27 +02:00
|
|
|
if (!context->fog_coord)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
|
2008-12-15 19:37:36 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)");
|
|
|
|
context->fog_coord = TRUE;
|
|
|
|
}
|
2011-09-10 23:05:33 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-15 19:37:36 +01:00
|
|
|
/* Otherwise, use the fragment depth */
|
2012-07-24 11:32:27 +02:00
|
|
|
if (context->fog_coord)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2008-12-15 19:37:36 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
|
|
|
context->fog_coord = FALSE;
|
|
|
|
}
|
2011-09-10 23:05:33 +02:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_RANGEFOGENABLE])
|
2011-09-10 23:05:33 +02:00
|
|
|
{
|
|
|
|
if (gl_info->supported[NV_FOG_DISTANCE])
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV);
|
2011-09-10 23:05:33 +02:00
|
|
|
checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV)");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("Range fog enabled, but not supported by this GL implementation.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gl_info->supported[NV_FOG_DISTANCE])
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV);
|
2011-09-10 23:05:33 +02:00
|
|
|
checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV)");
|
|
|
|
}
|
2008-12-15 19:37:36 +01:00
|
|
|
}
|
|
|
|
}
|
2006-12-08 18:42:43 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
void state_fogstartend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2008-12-15 19:37:36 +01:00
|
|
|
float fogstart, fogend;
|
2006-12-08 18:42:43 +01:00
|
|
|
union {
|
|
|
|
DWORD d;
|
|
|
|
float f;
|
|
|
|
} tmpvalue;
|
|
|
|
|
2008-12-15 19:37:36 +01:00
|
|
|
switch(context->fog_source) {
|
|
|
|
case FOGSOURCE_VS:
|
2009-07-07 11:08:01 +02:00
|
|
|
fogstart = 1.0f;
|
|
|
|
fogend = 0.0f;
|
2008-12-15 19:37:36 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FOGSOURCE_COORD:
|
2009-07-07 11:08:01 +02:00
|
|
|
fogstart = 255.0f;
|
|
|
|
fogend = 0.0f;
|
2008-12-15 19:37:36 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FOGSOURCE_FFP:
|
2011-12-19 21:00:09 +01:00
|
|
|
tmpvalue.d = state->render_states[WINED3D_RS_FOGSTART];
|
2008-12-15 19:37:36 +01:00
|
|
|
fogstart = tmpvalue.f;
|
2011-12-19 21:00:09 +01:00
|
|
|
tmpvalue.d = state->render_states[WINED3D_RS_FOGEND];
|
2008-12-15 19:37:36 +01:00
|
|
|
fogend = tmpvalue.f;
|
2013-06-18 16:17:18 +02:00
|
|
|
/* Special handling for fogstart == fogend. In d3d with vertex
|
|
|
|
* fog, everything is fogged. With table fog, everything with
|
|
|
|
* fog_coord < fog_start is unfogged, and fog_coord > fog_start
|
|
|
|
* is fogged. Windows drivers disagree when fog_coord == fog_start. */
|
|
|
|
if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE
|
|
|
|
&& fogstart == fogend)
|
|
|
|
{
|
2012-06-17 16:07:30 +02:00
|
|
|
fogstart = -INFINITY;
|
2009-07-07 11:08:01 +02:00
|
|
|
fogend = 0.0f;
|
2008-12-15 19:37:36 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* This should not happen.context->fog_source is set in wined3d, not the app.
|
|
|
|
* Still this is needed to make the compiler happy
|
|
|
|
*/
|
|
|
|
ERR("Unexpected fog coordinate source\n");
|
2009-07-07 11:08:01 +02:00
|
|
|
fogstart = 0.0f;
|
|
|
|
fogend = 0.0f;
|
2008-12-15 19:37:36 +01:00
|
|
|
}
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogf(GL_FOG_START, fogstart);
|
2008-12-15 19:37:36 +01:00
|
|
|
checkGLcall("glFogf(GL_FOG_START, fogstart)");
|
|
|
|
TRACE("Fog Start == %f\n", fogstart);
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogf(GL_FOG_END, fogend);
|
2008-12-15 19:37:36 +01:00
|
|
|
checkGLcall("glFogf(GL_FOG_END, fogend)");
|
|
|
|
TRACE("Fog End == %f\n", fogend);
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2008-12-15 19:37:36 +01:00
|
|
|
enum fogsource new_source;
|
2013-06-18 16:17:18 +02:00
|
|
|
DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
|
|
|
|
DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
|
2008-12-15 19:37:36 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
2009-02-19 08:53:50 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!state->render_states[WINED3D_RS_FOGENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2006-12-08 18:42:43 +01:00
|
|
|
/* No fog? Disable it, and we're done :-) */
|
2008-12-15 19:38:48 +01:00
|
|
|
glDisableWINE(GL_FOG);
|
2006-12-08 18:42:43 +01:00
|
|
|
checkGLcall("glDisable GL_FOG");
|
2007-02-25 23:58:14 +01:00
|
|
|
return;
|
2006-12-08 18:42:43 +01:00
|
|
|
}
|
|
|
|
|
2007-03-14 18:04:56 +01:00
|
|
|
/* Fog Rules:
|
|
|
|
*
|
|
|
|
* With fixed function vertex processing, Direct3D knows 2 different fog input sources.
|
|
|
|
* It can use the Z value of the vertex, or the alpha component of the specular color.
|
|
|
|
* This depends on the fog vertex, fog table and the vertex declaration. If the Z value
|
|
|
|
* is used, fogstart, fogend and the equation type are used, otherwise linear fog with
|
|
|
|
* start = 255, end = 0 is used. Obviously the msdn is not very clear on that.
|
|
|
|
*
|
|
|
|
* FOGTABLEMODE != NONE:
|
|
|
|
* The Z value is used, with the equation specified, no matter what vertex type.
|
|
|
|
*
|
|
|
|
* FOGTABLEMODE == NONE, FOGVERTEXMODE != NONE, untransformed:
|
|
|
|
* Per vertex fog is calculated using the specified fog equation and the parameters
|
|
|
|
*
|
|
|
|
* FOGTABLEMODE == NONE, FOGVERTEXMODE != NONE, transformed, OR
|
|
|
|
* FOGTABLEMODE == NONE, FOGVERTEXMODE == NONE, untransformed:
|
|
|
|
* Linear fog with start = 255.0, end = 0.0, input comes from the specular color
|
|
|
|
*
|
2007-03-22 17:32:48 +01:00
|
|
|
*
|
|
|
|
* Rules for vertex fog with shaders:
|
|
|
|
*
|
|
|
|
* When mixing fixed function functionality with the programmable pipeline, D3D expects
|
|
|
|
* the fog computation to happen during transformation while openGL expects it to happen
|
|
|
|
* during rasterization. Also, prior to pixel shader 3.0 D3D handles fog blending after
|
|
|
|
* the pixel shader while openGL always expects the pixel shader to handle the blending.
|
|
|
|
* To solve this problem, WineD3D does:
|
|
|
|
* 1) implement a linear fog equation and fog blending at the end of every pre 3.0 pixel
|
|
|
|
* shader,
|
|
|
|
* and 2) disables the fog computation (in either the fixed function or programmable
|
|
|
|
* rasterizer) if using a vertex program.
|
|
|
|
*
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
* D3D shaders can provide an explicit fog coordinate. This fog coordinate is used with
|
|
|
|
* D3DRS_FOGTABLEMODE==D3DFOG_NONE. The FOGVERTEXMODE is ignored, d3d always uses linear
|
|
|
|
* fog with start=1.0 and end=0.0 in this case. This is similar to fog coordinates in
|
|
|
|
* the specular color, a vertex shader counts as pretransformed geometry in this case.
|
|
|
|
* There are some GL differences between specular fog coords and vertex shaders though.
|
|
|
|
*
|
|
|
|
* With table fog the vertex shader fog coordinate is ignored.
|
2007-03-22 17:32:48 +01:00
|
|
|
*
|
|
|
|
* If a fogtablemode and a fogvertexmode are specified, table fog is applied (with or
|
|
|
|
* without shaders).
|
2007-03-14 18:04:56 +01:00
|
|
|
*/
|
2007-03-22 17:32:48 +01:00
|
|
|
|
2006-12-08 18:42:43 +01:00
|
|
|
/* DX 7 sdk: "If both render states(vertex and table fog) are set to valid modes,
|
|
|
|
* the system will apply only pixel(=table) fog effects."
|
|
|
|
*/
|
2011-12-21 21:35:00 +01:00
|
|
|
if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2010-09-28 12:00:23 +02:00
|
|
|
if (use_vs(state))
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR);
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
|
|
|
new_source = FOGSOURCE_VS;
|
2010-09-28 12:00:23 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
switch (state->render_states[WINED3D_RS_FOGVERTEXMODE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
/* If processed vertices are used, fall through to the NONE case */
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_EXP:
|
|
|
|
if (!context->last_was_rhw)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_EXP);
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
|
|
|
|
new_source = FOGSOURCE_FFP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* drop through */
|
|
|
|
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_EXP2:
|
|
|
|
if (!context->last_was_rhw)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_EXP2);
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
|
|
|
|
new_source = FOGSOURCE_FFP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* drop through */
|
|
|
|
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_LINEAR:
|
|
|
|
if (!context->last_was_rhw)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR);
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
|
|
|
new_source = FOGSOURCE_FFP;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* drop through */
|
2008-12-15 19:37:36 +01:00
|
|
|
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_NONE:
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
/* Both are none? According to msdn the alpha channel of the specular
|
|
|
|
* color contains a fog factor. Set it in drawStridedSlow.
|
|
|
|
* Same happens with Vertexfog on transformed vertices
|
|
|
|
*/
|
|
|
|
new_source = FOGSOURCE_COORD;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
2006-12-08 18:42:43 +01:00
|
|
|
break;
|
2008-12-15 19:37:36 +01:00
|
|
|
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
default:
|
2011-12-19 21:00:09 +01:00
|
|
|
FIXME("Unexpected WINED3D_RS_FOGVERTEXMODE %#x.\n",
|
|
|
|
state->render_states[WINED3D_RS_FOGVERTEXMODE]);
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
new_source = FOGSOURCE_FFP; /* Make the compiler happy */
|
|
|
|
}
|
2006-12-08 18:42:43 +01:00
|
|
|
}
|
|
|
|
} else {
|
2008-12-15 19:37:36 +01:00
|
|
|
new_source = FOGSOURCE_FFP;
|
2007-01-02 22:47:10 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
switch (state->render_states[WINED3D_RS_FOGTABLEMODE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_EXP:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_EXP);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
|
2006-12-08 18:42:43 +01:00
|
|
|
break;
|
|
|
|
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_EXP2:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_EXP2);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
|
2006-12-08 18:42:43 +01:00
|
|
|
break;
|
|
|
|
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_LINEAR:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
2006-12-08 18:42:43 +01:00
|
|
|
break;
|
|
|
|
|
2011-12-21 21:35:00 +01:00
|
|
|
case WINED3D_FOG_NONE: /* Won't happen */
|
2006-12-08 18:42:43 +01:00
|
|
|
default:
|
2011-12-19 21:00:09 +01:00
|
|
|
FIXME("Unexpected WINED3D_RS_FOGTABLEMODE %#x.\n",
|
|
|
|
state->render_states[WINED3D_RS_FOGTABLEMODE]);
|
2006-12-08 18:42:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-15 19:38:48 +01:00
|
|
|
glEnableWINE(GL_FOG);
|
2008-12-14 17:00:21 +01:00
|
|
|
checkGLcall("glEnable GL_FOG");
|
2013-06-18 16:17:18 +02:00
|
|
|
if (new_source != context->fog_source || fogstart == fogend)
|
2011-07-14 01:02:48 +02:00
|
|
|
{
|
2008-12-15 19:37:36 +01:00
|
|
|
context->fog_source = new_source;
|
2011-12-19 21:00:09 +01:00
|
|
|
state_fogstartend(context, state, STATE_RENDER(WINED3D_RS_FOGSTART));
|
2006-12-08 18:42:43 +01:00
|
|
|
}
|
2007-08-21 12:30:22 +02:00
|
|
|
}
|
2006-12-08 18:42:43 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
void state_fogcolor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-29 11:35:57 +01:00
|
|
|
float col[4];
|
2011-07-14 01:02:48 +02:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_FOGCOLOR], col);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogfv(GL_FOG_COLOR, &col[0]);
|
2006-12-08 18:52:30 +01:00
|
|
|
checkGLcall("glFog GL_FOG_COLOR");
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
void state_fogdensity(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-10 16:34:45 +01:00
|
|
|
union {
|
|
|
|
DWORD d;
|
|
|
|
float f;
|
|
|
|
} tmpvalue;
|
2011-07-14 01:02:48 +02:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
tmpvalue.d = state->render_states[WINED3D_RS_FOGDENSITY];
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFogfv(GL_FOG_DENSITY, &tmpvalue.f);
|
2006-12-10 16:34:45 +01:00
|
|
|
checkGLcall("glFogf(GL_FOG_DENSITY, (float) Value)");
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_colormat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2007-01-17 21:41:21 +01:00
|
|
|
GLenum Parm = 0;
|
2007-01-10 11:26:12 +01:00
|
|
|
|
2007-02-14 16:22:07 +01:00
|
|
|
/* Depends on the decoded vertex declaration to read the existence of diffuse data.
|
2007-01-10 11:26:12 +01:00
|
|
|
* The vertex declaration will call this function if the fixed function pipeline is used.
|
|
|
|
*/
|
2007-02-12 19:18:31 +01:00
|
|
|
|
|
|
|
if(isStateDirty(context, STATE_VDECL)) {
|
2007-01-10 11:26:12 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-20 14:36:32 +02:00
|
|
|
context->num_untracked_materials = 0;
|
2013-09-12 12:23:29 +02:00
|
|
|
if ((context->stream_info.use_map & (1 << WINED3D_FFP_DIFFUSE))
|
2011-12-19 21:00:09 +01:00
|
|
|
&& state->render_states[WINED3D_RS_COLORVERTEX])
|
2009-08-24 09:27:55 +02:00
|
|
|
{
|
2006-12-10 22:44:18 +01:00
|
|
|
TRACE("diff %d, amb %d, emis %d, spec %d\n",
|
2011-12-19 21:00:09 +01:00
|
|
|
state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE],
|
|
|
|
state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE],
|
|
|
|
state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE],
|
|
|
|
state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]);
|
2006-12-10 22:44:18 +01:00
|
|
|
|
2012-01-04 23:34:55 +01:00
|
|
|
if (state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-01-04 23:34:55 +01:00
|
|
|
if (state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2006-12-10 22:44:18 +01:00
|
|
|
Parm = GL_AMBIENT_AND_DIFFUSE;
|
2010-09-23 21:33:29 +02:00
|
|
|
else
|
2006-12-10 22:44:18 +01:00
|
|
|
Parm = GL_DIFFUSE;
|
2012-01-04 23:34:55 +01:00
|
|
|
if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2007-06-20 14:36:32 +02:00
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
}
|
2012-01-04 23:34:55 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2007-06-20 14:36:32 +02:00
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
}
|
2010-09-15 12:00:04 +02:00
|
|
|
}
|
2012-01-04 23:34:55 +01:00
|
|
|
else if (state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2006-12-10 22:44:18 +01:00
|
|
|
Parm = GL_AMBIENT;
|
2012-01-04 23:34:55 +01:00
|
|
|
if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2007-06-20 14:36:32 +02:00
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
}
|
2012-01-04 23:34:55 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2007-06-20 14:36:32 +02:00
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
}
|
2010-09-15 12:00:04 +02:00
|
|
|
}
|
2012-01-04 23:34:55 +01:00
|
|
|
else if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2006-12-10 22:44:18 +01:00
|
|
|
Parm = GL_EMISSION;
|
2012-01-04 23:34:55 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2007-06-20 14:36:32 +02:00
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
}
|
2010-09-15 12:00:04 +02:00
|
|
|
}
|
2012-01-04 23:34:55 +01:00
|
|
|
else if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2006-12-10 22:44:18 +01:00
|
|
|
Parm = GL_SPECULAR;
|
|
|
|
}
|
2007-01-10 11:26:12 +01:00
|
|
|
}
|
2006-12-10 22:44:18 +01:00
|
|
|
|
2007-01-17 21:41:35 +01:00
|
|
|
/* Nothing changed, return. */
|
2007-02-12 19:18:27 +01:00
|
|
|
if (Parm == context->tracking_parm) return;
|
2007-01-17 21:41:35 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
if (!Parm)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_COLOR_MATERIAL);
|
2007-01-10 11:26:12 +01:00
|
|
|
checkGLcall("glDisable GL_COLOR_MATERIAL");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glColorMaterial(GL_FRONT_AND_BACK, Parm);
|
2007-01-10 11:26:12 +01:00
|
|
|
checkGLcall("glColorMaterial(GL_FRONT_AND_BACK, Parm)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_COLOR_MATERIAL);
|
2007-01-10 11:26:12 +01:00
|
|
|
checkGLcall("glEnable(GL_COLOR_MATERIAL)");
|
2006-12-10 22:44:18 +01:00
|
|
|
}
|
2007-01-17 21:41:35 +01:00
|
|
|
|
|
|
|
/* Apparently calls to glMaterialfv are ignored for properties we're
|
|
|
|
* tracking with glColorMaterial, so apply those here. */
|
2012-07-24 11:32:27 +02:00
|
|
|
switch (context->tracking_parm)
|
|
|
|
{
|
2007-01-17 21:41:35 +01:00
|
|
|
case GL_AMBIENT_AND_DIFFUSE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient);
|
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.diffuse);
|
2007-01-17 21:41:35 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_DIFFUSE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.diffuse);
|
2007-01-17 21:41:35 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_AMBIENT:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient);
|
2007-01-17 21:41:35 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_EMISSION:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float *)&state->material.emissive);
|
2007-01-17 21:41:35 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GL_SPECULAR:
|
|
|
|
/* Only change material color if specular is enabled, otherwise it is set to black */
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SPECULARENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float *)&state->material.specular);
|
2007-01-17 21:41:35 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
2011-11-20 20:27:13 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-10 10:04:40 +01:00
|
|
|
static const GLfloat black[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
|
2007-01-17 21:41:35 +01:00
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-02-12 19:18:27 +01:00
|
|
|
context->tracking_parm = Parm;
|
2006-12-10 22:44:18 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_linepattern(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2011-11-23 08:51:44 +01:00
|
|
|
union
|
|
|
|
{
|
|
|
|
DWORD d;
|
|
|
|
struct wined3d_line_pattern lp;
|
2006-12-10 23:20:01 +01:00
|
|
|
} tmppattern;
|
2011-12-19 21:00:09 +01:00
|
|
|
tmppattern.d = state->render_states[WINED3D_RS_LINEPATTERN];
|
2006-12-10 23:20:01 +01:00
|
|
|
|
2011-11-23 08:51:44 +01:00
|
|
|
TRACE("Line pattern: repeat %d bits %x.\n", tmppattern.lp.repeat_factor, tmppattern.lp.line_pattern);
|
2006-12-10 23:20:01 +01:00
|
|
|
|
2011-11-23 08:51:44 +01:00
|
|
|
if (tmppattern.lp.repeat_factor)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLineStipple(tmppattern.lp.repeat_factor, tmppattern.lp.line_pattern);
|
2006-12-10 23:20:01 +01:00
|
|
|
checkGLcall("glLineStipple(repeat, linepattern)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_LINE_STIPPLE);
|
2006-12-10 23:20:01 +01:00
|
|
|
checkGLcall("glEnable(GL_LINE_STIPPLE);");
|
2011-11-23 08:51:44 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_LINE_STIPPLE);
|
2006-12-10 23:20:01 +01:00
|
|
|
checkGLcall("glDisable(GL_LINE_STIPPLE);");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_normalize(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
if (isStateDirty(context, STATE_VDECL))
|
2007-08-21 18:05:27 +02:00
|
|
|
return;
|
2011-07-14 01:02:48 +02:00
|
|
|
|
2007-08-21 18:05:27 +02:00
|
|
|
/* Without vertex normals, we set the current normal to 0/0/0 to remove the diffuse factor
|
|
|
|
* from the opengl lighting equation, as d3d does. Normalization of 0/0/0 can lead to a division
|
|
|
|
* by zero and is not properly defined in opengl, so avoid it
|
|
|
|
*/
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_NORMALIZENORMALS]
|
2013-09-12 12:23:29 +02:00
|
|
|
&& (context->stream_info.use_map & (1 << WINED3D_FFP_NORMAL)))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_NORMALIZE);
|
2006-12-10 23:20:05 +01:00
|
|
|
checkGLcall("glEnable(GL_NORMALIZE);");
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_NORMALIZE);
|
2006-12-10 23:20:05 +01:00
|
|
|
checkGLcall("glDisable(GL_NORMALIZE);");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_psizemin_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2006-12-10 23:20:12 +01:00
|
|
|
union {
|
|
|
|
DWORD d;
|
|
|
|
float f;
|
|
|
|
} tmpvalue;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
tmpvalue.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
|
2009-07-07 11:08:01 +02:00
|
|
|
if (tmpvalue.f != 1.0f)
|
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
FIXME("WINED3D_RS_POINTSIZE_MIN not supported on this opengl, value is %f\n", tmpvalue.f);
|
2006-12-10 23:20:12 +01:00
|
|
|
}
|
2011-12-19 21:00:09 +01:00
|
|
|
tmpvalue.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
|
2009-07-07 11:08:01 +02:00
|
|
|
if (tmpvalue.f != 64.0f)
|
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
FIXME("WINED3D_RS_POINTSIZE_MAX not supported on this opengl, value is %f\n", tmpvalue.f);
|
2008-11-07 17:02:54 +01:00
|
|
|
}
|
|
|
|
|
2006-12-10 23:20:12 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_psizemin_ext(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
union
|
|
|
|
{
|
2008-07-05 22:45:39 +02:00
|
|
|
DWORD d;
|
|
|
|
float f;
|
2008-11-07 17:02:54 +01:00
|
|
|
} min, max;
|
2008-07-05 22:45:39 +02:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
|
|
|
|
max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
|
2008-11-07 17:02:54 +01:00
|
|
|
|
|
|
|
/* Max point size trumps min point size */
|
|
|
|
if(min.f > max.f) {
|
|
|
|
min.f = max.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, min.f);
|
|
|
|
checkGLcall("glPointParameterfEXT(...)");
|
|
|
|
GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, max.f);
|
2008-07-05 22:45:39 +02:00
|
|
|
checkGLcall("glPointParameterfEXT(...)");
|
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_psizemin_arb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
union
|
|
|
|
{
|
2008-07-05 22:45:39 +02:00
|
|
|
DWORD d;
|
|
|
|
float f;
|
2008-11-07 17:02:54 +01:00
|
|
|
} min, max;
|
2008-07-05 22:45:39 +02:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN];
|
|
|
|
max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX];
|
2008-07-05 22:45:39 +02:00
|
|
|
|
2008-11-07 17:02:54 +01:00
|
|
|
/* Max point size trumps min point size */
|
|
|
|
if(min.f > max.f) {
|
|
|
|
min.f = max.f;
|
|
|
|
}
|
2006-12-10 23:20:15 +01:00
|
|
|
|
2008-11-07 17:02:54 +01:00
|
|
|
GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MIN_ARB, min.f);
|
|
|
|
checkGLcall("glPointParameterfARB(...)");
|
|
|
|
GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MAX_ARB, max.f);
|
2008-07-05 22:47:59 +02:00
|
|
|
checkGLcall("glPointParameterfARB(...)");
|
2006-12-10 23:20:15 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_pscale(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2009-10-22 10:09:54 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-10 23:20:19 +01:00
|
|
|
/* TODO: Group this with the viewport */
|
|
|
|
/*
|
|
|
|
* POINTSCALEENABLE controls how point size value is treated. If set to
|
|
|
|
* true, the point size is scaled with respect to height of viewport.
|
|
|
|
* When set to false point size is in pixels.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Default values */
|
|
|
|
GLfloat att[3] = {1.0f, 0.0f, 0.0f};
|
2007-10-22 12:15:03 +02:00
|
|
|
union {
|
|
|
|
DWORD d;
|
|
|
|
float f;
|
|
|
|
} pointSize, A, B, C;
|
2006-12-10 23:20:19 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
pointSize.d = state->render_states[WINED3D_RS_POINTSIZE];
|
|
|
|
A.d = state->render_states[WINED3D_RS_POINTSCALE_A];
|
|
|
|
B.d = state->render_states[WINED3D_RS_POINTSCALE_B];
|
|
|
|
C.d = state->render_states[WINED3D_RS_POINTSCALE_C];
|
2006-12-10 23:20:19 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_POINTSCALEENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2011-11-21 18:48:40 +01:00
|
|
|
DWORD h = state->viewport.height;
|
2007-10-22 12:15:03 +02:00
|
|
|
GLfloat scaleFactor;
|
|
|
|
|
2009-10-29 10:37:10 +01:00
|
|
|
if (pointSize.f < gl_info->limits.pointsize_min)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
|
|
|
/* Minimum valid point size for OpenGL is driver specific. For Direct3D it is
|
2007-11-03 15:39:22 +01:00
|
|
|
* 0.0f. This means that OpenGL will clamp really small point sizes to the
|
|
|
|
* driver minimum. To correct for this we need to multiply by the scale factor when sizes
|
2007-10-22 12:15:03 +02:00
|
|
|
* are less than 1.0f. scale_factor = 1.0f / point_size.
|
|
|
|
*/
|
2009-10-29 10:37:10 +01:00
|
|
|
scaleFactor = pointSize.f / gl_info->limits.pointsize_min;
|
2007-11-03 15:39:22 +01:00
|
|
|
/* Clamp the point size, don't rely on the driver to do it. MacOS says min point size
|
|
|
|
* is 1.0, but then accepts points below that and draws too small points
|
|
|
|
*/
|
2009-10-29 10:37:10 +01:00
|
|
|
pointSize.f = gl_info->limits.pointsize_min;
|
2009-10-22 10:09:54 +02:00
|
|
|
}
|
2009-10-29 10:37:10 +01:00
|
|
|
else if(pointSize.f > gl_info->limits.pointsize_max)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2007-10-22 12:15:03 +02:00
|
|
|
/* gl already scales the input to glPointSize,
|
|
|
|
* d3d scales the result after the point size scale.
|
|
|
|
* If the point size is bigger than the max size, use the
|
|
|
|
* scaling to scale it bigger, and set the gl point size to max
|
|
|
|
*/
|
2009-10-29 10:37:10 +01:00
|
|
|
scaleFactor = pointSize.f / gl_info->limits.pointsize_max;
|
2007-10-22 12:15:03 +02:00
|
|
|
TRACE("scale: %f\n", scaleFactor);
|
2009-10-29 10:37:10 +01:00
|
|
|
pointSize.f = gl_info->limits.pointsize_max;
|
2006-12-10 23:20:19 +01:00
|
|
|
} else {
|
|
|
|
scaleFactor = 1.0f;
|
|
|
|
}
|
2010-07-28 19:07:19 +02:00
|
|
|
scaleFactor = powf(h * scaleFactor, 2);
|
2006-12-10 23:20:19 +01:00
|
|
|
|
2007-10-22 12:15:03 +02:00
|
|
|
att[0] = A.f / scaleFactor;
|
|
|
|
att[1] = B.f / scaleFactor;
|
|
|
|
att[2] = C.f / scaleFactor;
|
2006-12-10 23:20:19 +01:00
|
|
|
}
|
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_POINT_PARAMETERS])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2006-12-10 23:20:19 +01:00
|
|
|
GL_EXTCALL(glPointParameterfvARB)(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glPointParameterfvARB(GL_DISTANCE_ATTENUATION_ARB, ...)");
|
2006-12-10 23:20:19 +01:00
|
|
|
}
|
2010-01-04 21:33:10 +01:00
|
|
|
else if (gl_info->supported[EXT_POINT_PARAMETERS])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2006-12-10 23:20:19 +01:00
|
|
|
GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...)");
|
2010-09-15 12:00:04 +02:00
|
|
|
}
|
2011-12-19 21:00:09 +01:00
|
|
|
else if (state->render_states[WINED3D_RS_POINTSCALEENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2007-10-22 12:15:03 +02:00
|
|
|
WARN("POINT_PARAMETERS not supported in this version of opengl\n");
|
2006-12-10 23:20:19 +01:00
|
|
|
}
|
2007-10-22 12:15:03 +02:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPointSize(pointSize.f);
|
2007-10-22 12:15:03 +02:00
|
|
|
checkGLcall("glPointSize(...);");
|
2006-12-10 23:20:19 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_debug_monitor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-21 09:12:27 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
WARN("token: %#x.\n", state->render_states[WINED3D_RS_DEBUGMONITORTOKEN]);
|
2009-08-21 09:12:27 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_colorwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
DWORD mask0 = state->render_states[WINED3D_RS_COLORWRITEENABLE];
|
|
|
|
DWORD mask1 = state->render_states[WINED3D_RS_COLORWRITEENABLE1];
|
|
|
|
DWORD mask2 = state->render_states[WINED3D_RS_COLORWRITEENABLE2];
|
|
|
|
DWORD mask3 = state->render_states[WINED3D_RS_COLORWRITEENABLE3];
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-10 23:20:22 +01:00
|
|
|
|
|
|
|
TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
|
2010-03-25 22:51:25 +01:00
|
|
|
mask0 & WINED3DCOLORWRITEENABLE_RED ? 1 : 0,
|
|
|
|
mask0 & WINED3DCOLORWRITEENABLE_GREEN ? 1 : 0,
|
|
|
|
mask0 & WINED3DCOLORWRITEENABLE_BLUE ? 1 : 0,
|
|
|
|
mask0 & WINED3DCOLORWRITEENABLE_ALPHA ? 1 : 0);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glColorMask(mask0 & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
|
2010-03-25 22:51:25 +01:00
|
|
|
mask0 & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
|
|
|
|
mask0 & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
|
|
|
mask0 & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
|
2006-12-10 23:20:22 +01:00
|
|
|
checkGLcall("glColorMask(...)");
|
|
|
|
|
2010-03-25 22:51:25 +01:00
|
|
|
if (!((mask1 == mask0 && mask2 == mask0 && mask3 == mask0)
|
|
|
|
|| (mask1 == 0xf && mask2 == 0xf && mask3 == 0xf)))
|
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
FIXME("WINED3D_RS_COLORWRITEENABLE/1/2/3, %#x/%#x/%#x/%#x not yet implemented.\n",
|
2010-03-25 22:51:25 +01:00
|
|
|
mask0, mask1, mask2, mask3);
|
|
|
|
FIXME("Missing of cap D3DPMISCCAPS_INDEPENDENTWRITEMASKS wasn't honored?\n");
|
2006-12-10 23:20:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-25 12:02:03 +02:00
|
|
|
static void set_color_mask(const struct wined3d_gl_info *gl_info, UINT index, DWORD mask)
|
2010-03-25 22:51:24 +01:00
|
|
|
{
|
|
|
|
GL_EXTCALL(glColorMaskIndexedEXT(index,
|
|
|
|
mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
|
|
|
|
mask & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
|
|
|
|
mask & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
|
|
|
mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE));
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_colorwrite0(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2010-03-25 22:51:24 +01:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
set_color_mask(context->gl_info, 0, state->render_states[WINED3D_RS_COLORWRITEENABLE]);
|
2010-03-25 22:51:24 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_colorwrite1(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2010-03-25 22:51:24 +01:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
set_color_mask(context->gl_info, 1, state->render_states[WINED3D_RS_COLORWRITEENABLE1]);
|
2010-03-25 22:51:24 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_colorwrite2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2010-03-25 22:51:24 +01:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
set_color_mask(context->gl_info, 2, state->render_states[WINED3D_RS_COLORWRITEENABLE2]);
|
2010-03-25 22:51:24 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_colorwrite3(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2010-03-25 22:51:24 +01:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
set_color_mask(context->gl_info, 3, state->render_states[WINED3D_RS_COLORWRITEENABLE3]);
|
2010-03-25 22:51:24 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_localviewer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_LOCALVIEWER])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
|
2006-12-10 23:20:26 +01:00
|
|
|
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1)");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
|
2006-12-10 23:20:26 +01:00
|
|
|
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_lastpixel(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_LASTPIXEL])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2006-12-10 23:20:29 +01:00
|
|
|
TRACE("Last Pixel Drawing Enabled\n");
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-01 15:32:14 +01:00
|
|
|
static BOOL warned;
|
|
|
|
if (!warned) {
|
2007-03-27 09:27:52 +02:00
|
|
|
FIXME("Last Pixel Drawing Disabled, not handled yet\n");
|
2008-12-01 15:32:14 +01:00
|
|
|
warned = TRUE;
|
2007-03-27 09:27:52 +02:00
|
|
|
} else {
|
|
|
|
TRACE("Last Pixel Drawing Disabled, not handled yet\n");
|
|
|
|
}
|
2006-12-10 23:20:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_pointsprite_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2009-10-16 10:38:43 +02:00
|
|
|
static BOOL warned;
|
|
|
|
|
2006-12-10 23:20:36 +01:00
|
|
|
/* TODO: NV_POINT_SPRITE */
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!warned && state->render_states[WINED3D_RS_POINTSPRITEENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2009-05-06 19:36:08 +02:00
|
|
|
/* A FIXME, not a WARN because point sprites should be software emulated if not supported by HW */
|
|
|
|
FIXME("Point sprites not supported\n");
|
|
|
|
warned = TRUE;
|
2006-12-10 23:20:36 +01:00
|
|
|
}
|
2008-07-05 22:49:50 +02:00
|
|
|
}
|
2006-12-10 23:20:36 +01:00
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void state_pointsprite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_POINTSPRITEENABLE])
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_POINT_SPRITE_ARB);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glEnable(GL_POINT_SPRITE_ARB)");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_POINT_SPRITE_ARB);
|
2007-12-19 19:12:12 +01:00
|
|
|
checkGLcall("glDisable(GL_POINT_SPRITE_ARB)");
|
2006-12-10 23:20:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_wrap(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_WRAP0]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP1]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP2]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP3]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP4]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP5]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP6]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP7]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP8]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP9]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP10]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP11]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP12]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP13]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP14]
|
|
|
|
|| state->render_states[WINED3D_RS_WRAP15])
|
|
|
|
FIXME("(WINED3D_RS_WRAP0) Texture wrapping not yet supported.\n");
|
2006-12-10 23:20:45 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_msaa_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_MULTISAMPLEANTIALIAS])
|
2011-07-14 01:02:48 +02:00
|
|
|
WARN("Multisample antialiasing not supported by GL.\n");
|
2008-07-05 22:59:21 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_msaa(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_MULTISAMPLEANTIALIAS])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_MULTISAMPLE_ARB);
|
2008-07-05 22:59:21 +02:00
|
|
|
checkGLcall("glEnable(GL_MULTISAMPLE_ARB)");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_MULTISAMPLE_ARB);
|
2008-07-05 22:59:21 +02:00
|
|
|
checkGLcall("glDisable(GL_MULTISAMPLE_ARB)");
|
2006-12-10 23:20:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_scissor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SCISSORTESTENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST);
|
2006-12-10 23:20:48 +01:00
|
|
|
checkGLcall("glEnable(GL_SCISSOR_TEST)");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST);
|
2006-12-10 23:20:48 +01:00
|
|
|
checkGLcall("glDisable(GL_SCISSOR_TEST)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-30 19:33:43 +01:00
|
|
|
/* The Direct3D depth bias is specified in normalized depth coordinates. In
|
|
|
|
* OpenGL the bias is specified in units of "the smallest value that is
|
|
|
|
* guaranteed to produce a resolvable offset for a given implementation". To
|
|
|
|
* convert from D3D to GL we need to divide the D3D depth bias by that value.
|
|
|
|
* There's no practical way to retrieve that value from a given GL
|
|
|
|
* implementation, but the D3D application has essentially the same problem,
|
2011-04-20 16:28:05 +02:00
|
|
|
* which makes a guess of the depth buffer format's highest possible value a
|
|
|
|
* reasonable guess. Note that SLOPESCALEDEPTHBIAS is a scaling factor for the
|
|
|
|
* depth slope, and doesn't need to be scaled. */
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_depthbias(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS]
|
|
|
|
|| state->render_states[WINED3D_RS_DEPTHBIAS])
|
2009-12-30 19:33:43 +01:00
|
|
|
{
|
2011-07-14 01:02:44 +02:00
|
|
|
const struct wined3d_surface *depth = state->fb->depth_stencil;
|
2011-04-20 16:28:05 +02:00
|
|
|
float scale;
|
|
|
|
|
2009-12-30 19:33:43 +01:00
|
|
|
union
|
|
|
|
{
|
|
|
|
DWORD d;
|
|
|
|
float f;
|
|
|
|
} scale_bias, const_bias;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
scale_bias.d = state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS];
|
|
|
|
const_bias.d = state->render_states[WINED3D_RS_DEPTHBIAS];
|
2006-12-10 23:20:52 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_POLYGON_OFFSET_FILL);
|
2006-12-10 23:20:52 +01:00
|
|
|
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
|
2009-12-30 19:33:43 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
if (context->swapchain->device->wined3d->flags & WINED3D_LEGACY_DEPTH_BIAS)
|
2011-04-20 16:28:05 +02:00
|
|
|
{
|
2011-07-04 21:39:35 +02:00
|
|
|
float bias = -(float)const_bias.d;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPolygonOffset(bias, bias);
|
2011-07-04 21:39:35 +02:00
|
|
|
checkGLcall("glPolygonOffset");
|
2011-04-20 16:28:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-07-04 21:39:35 +02:00
|
|
|
if (depth)
|
|
|
|
{
|
|
|
|
const struct wined3d_format *fmt = depth->resource.format;
|
|
|
|
scale = powf(2, fmt->depth_size) - 1;
|
|
|
|
TRACE("Depth format %s, using depthbias scale of %.8e.\n",
|
|
|
|
debug_d3dformat(fmt->id), scale);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* The context manager will reapply this state on a depth stencil change */
|
|
|
|
TRACE("No depth stencil, using depthbias scale of 0.0.\n");
|
|
|
|
scale = 0.0f;
|
|
|
|
}
|
2011-04-20 16:28:05 +02:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPolygonOffset(scale_bias.f, const_bias.f * scale);
|
2011-07-04 21:39:35 +02:00
|
|
|
checkGLcall("glPolygonOffset(...)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_POLYGON_OFFSET_FILL);
|
2006-12-10 23:20:52 +01:00
|
|
|
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_zvisible(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2010-04-01 21:28:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ZVISIBLE])
|
|
|
|
FIXME("WINED3D_RS_ZVISIBLE not implemented.\n");
|
2010-04-01 21:28:51 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_perspective(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_TEXTUREPERSPECTIVE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
2006-12-10 23:20:56 +01:00
|
|
|
checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
2006-12-10 23:20:56 +01:00
|
|
|
checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_stippledalpha(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_STIPPLEDALPHA])
|
2011-07-14 01:02:48 +02:00
|
|
|
FIXME("Stippled Alpha not supported yet.\n");
|
2006-12-10 23:20:59 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_antialias(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ANTIALIAS])
|
2010-09-15 12:00:04 +02:00
|
|
|
FIXME("Antialias not supported yet.\n");
|
2006-12-10 23:21:03 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_multisampmask(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_MULTISAMPLEMASK] != 0xffffffff)
|
|
|
|
FIXME("WINED3D_RS_MULTISAMPLEMASK %#x not yet implemented.\n",
|
|
|
|
state->render_states[WINED3D_RS_MULTISAMPLEMASK]);
|
2006-12-10 23:21:07 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_patchedgestyle(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-01-04 23:34:56 +01:00
|
|
|
if (state->render_states[WINED3D_RS_PATCHEDGESTYLE] != WINED3D_PATCH_EDGE_DISCRETE)
|
2011-12-19 21:00:09 +01:00
|
|
|
FIXME("WINED3D_RS_PATCHEDGESTYLE %#x not yet implemented.\n",
|
|
|
|
state->render_states[WINED3D_RS_PATCHEDGESTYLE]);
|
2006-12-10 23:21:10 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_patchsegments(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2006-12-10 23:21:14 +01:00
|
|
|
union {
|
|
|
|
DWORD d;
|
|
|
|
float f;
|
|
|
|
} tmpvalue;
|
|
|
|
tmpvalue.f = 1.0f;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_PATCHSEGMENTS] != tmpvalue.d)
|
2007-03-28 20:37:10 +02:00
|
|
|
{
|
2007-04-03 23:39:22 +02:00
|
|
|
static BOOL displayed = FALSE;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
tmpvalue.d = state->render_states[WINED3D_RS_PATCHSEGMENTS];
|
2007-04-03 23:39:22 +02:00
|
|
|
if(!displayed)
|
2011-12-19 21:00:09 +01:00
|
|
|
FIXME("(WINED3D_RS_PATCHSEGMENTS,%f) not yet implemented\n", tmpvalue.f);
|
2007-04-03 23:39:22 +02:00
|
|
|
|
|
|
|
displayed = TRUE;
|
2007-03-28 20:37:10 +02:00
|
|
|
}
|
2006-12-10 23:21:14 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_positiondegree(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_POSITIONDEGREE] != WINED3D_DEGREE_CUBIC)
|
|
|
|
FIXME("WINED3D_RS_POSITIONDEGREE %#x not yet implemented.\n",
|
|
|
|
state->render_states[WINED3D_RS_POSITIONDEGREE]);
|
2006-12-10 23:21:21 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_normaldegree(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_NORMALDEGREE] != WINED3D_DEGREE_LINEAR)
|
|
|
|
FIXME("WINED3D_RS_NORMALDEGREE %#x not yet implemented.\n",
|
|
|
|
state->render_states[WINED3D_RS_NORMALDEGREE]);
|
2006-12-10 23:21:25 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_tessellation(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ENABLEADAPTIVETESSELLATION])
|
|
|
|
FIXME("WINED3D_RS_ENABLEADAPTIVETESSELLATION %#x not yet implemented.\n",
|
|
|
|
state->render_states[WINED3D_RS_ENABLEADAPTIVETESSELLATION]);
|
2006-12-10 23:21:27 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_nvdb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2010-09-16 08:58:26 +02:00
|
|
|
{
|
|
|
|
union {
|
|
|
|
DWORD d;
|
|
|
|
float f;
|
|
|
|
} zmin, zmax;
|
|
|
|
|
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ADAPTIVETESS_X] == WINED3DFMT_NVDB)
|
2010-09-16 08:58:26 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
zmin.d = state->render_states[WINED3D_RS_ADAPTIVETESS_Z];
|
|
|
|
zmax.d = state->render_states[WINED3D_RS_ADAPTIVETESS_W];
|
2010-09-16 08:58:26 +02:00
|
|
|
|
|
|
|
/* If zmin is larger than zmax INVALID_VALUE error is generated.
|
|
|
|
* In d3d9 test is not performed in this case*/
|
|
|
|
if (zmin.f <= zmax.f)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_DEPTH_BOUNDS_TEST_EXT);
|
2010-09-16 08:58:26 +02:00
|
|
|
checkGLcall("glEnable(GL_DEPTH_BOUNDS_TEST_EXT)");
|
|
|
|
GL_EXTCALL(glDepthBoundsEXT(zmin.f, zmax.f));
|
|
|
|
checkGLcall("glDepthBoundsEXT(...)");
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
|
2010-09-16 08:58:26 +02:00
|
|
|
checkGLcall("glDisable(GL_DEPTH_BOUNDS_TEST_EXT)");
|
|
|
|
}
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_DEPTH_BOUNDS_TEST_EXT);
|
2010-09-16 08:58:26 +02:00
|
|
|
checkGLcall("glDisable(GL_DEPTH_BOUNDS_TEST_EXT)");
|
|
|
|
}
|
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
state_tessellation(context, state, STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION));
|
2010-09-16 08:58:26 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_wrapu(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_WRAPU])
|
|
|
|
FIXME("Render state WINED3D_RS_WRAPU not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_wrapv(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_WRAPV])
|
|
|
|
FIXME("Render state WINED3D_RS_WRAPV not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_monoenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_MONOENABLE])
|
|
|
|
FIXME("Render state WINED3D_RS_MONOENABLE not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_rop2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ROP2])
|
|
|
|
FIXME("Render state WINED3D_RS_ROP2 not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_planemask(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_PLANEMASK])
|
|
|
|
FIXME("Render state WINED3D_RS_PLANEMASK not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_subpixel(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SUBPIXEL])
|
|
|
|
FIXME("Render state WINED3D_RS_SUBPIXEL not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_subpixelx(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SUBPIXELX])
|
|
|
|
FIXME("Render state WINED3D_RS_SUBPIXELX not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_stippleenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_STIPPLEENABLE])
|
|
|
|
FIXME("Render state WINED3D_RS_STIPPLEENABLE not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_mipmaplodbias(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_MIPMAPLODBIAS])
|
|
|
|
FIXME("Render state WINED3D_RS_MIPMAPLODBIAS not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_anisotropy(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ANISOTROPY])
|
|
|
|
FIXME("Render state WINED3D_RS_ANISOTROPY not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_flushbatch(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_FLUSHBATCH])
|
|
|
|
FIXME("Render state WINED3D_RS_FLUSHBATCH not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_translucentsi(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_TRANSLUCENTSORTINDEPENDENT])
|
|
|
|
FIXME("Render state WINED3D_RS_TRANSLUCENTSORTINDEPENDENT not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_extents(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_EXTENTS])
|
|
|
|
FIXME("Render state WINED3D_RS_EXTENTS not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_ckeyblend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_COLORKEYBLENDENABLE])
|
|
|
|
FIXME("Render state WINED3D_RS_COLORKEYBLENDENABLE not implemented yet.\n");
|
2006-12-15 20:02:13 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_swvp(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-09-25 13:31:48 +02:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_SOFTWAREVERTEXPROCESSING])
|
2009-09-25 13:31:48 +02:00
|
|
|
FIXME("Software vertex processing not implemented.\n");
|
|
|
|
}
|
|
|
|
|
2008-07-12 18:45:33 +02:00
|
|
|
static void get_src_and_opr(DWORD arg, BOOL is_alpha, GLenum* source, GLenum* operand) {
|
|
|
|
/* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the
|
|
|
|
* input should be used for all input components. The WINED3DTA_COMPLEMENT
|
|
|
|
* flag specifies the complement of the input should be used. */
|
|
|
|
BOOL from_alpha = is_alpha || arg & WINED3DTA_ALPHAREPLICATE;
|
|
|
|
BOOL complement = arg & WINED3DTA_COMPLEMENT;
|
|
|
|
|
|
|
|
/* Calculate the operand */
|
|
|
|
if (complement) {
|
|
|
|
if (from_alpha) *operand = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
else *operand = GL_ONE_MINUS_SRC_COLOR;
|
|
|
|
} else {
|
|
|
|
if (from_alpha) *operand = GL_SRC_ALPHA;
|
|
|
|
else *operand = GL_SRC_COLOR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate the source */
|
|
|
|
switch (arg & WINED3DTA_SELECTMASK) {
|
|
|
|
case WINED3DTA_CURRENT: *source = GL_PREVIOUS_EXT; break;
|
|
|
|
case WINED3DTA_DIFFUSE: *source = GL_PRIMARY_COLOR_EXT; break;
|
|
|
|
case WINED3DTA_TEXTURE: *source = GL_TEXTURE; break;
|
|
|
|
case WINED3DTA_TFACTOR: *source = GL_CONSTANT_EXT; break;
|
|
|
|
case WINED3DTA_SPECULAR:
|
|
|
|
/*
|
|
|
|
* According to the GL_ARB_texture_env_combine specs, SPECULAR is
|
|
|
|
* 'Secondary color' and isn't supported until base GL supports it
|
|
|
|
* There is no concept of temp registers as far as I can tell
|
|
|
|
*/
|
|
|
|
FIXME("Unhandled texture arg WINED3DTA_SPECULAR\n");
|
|
|
|
*source = GL_TEXTURE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("Unrecognized texture arg %#x\n", arg);
|
|
|
|
*source = GL_TEXTURE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup the texture operations texture stage states */
|
2010-09-23 21:33:26 +02:00
|
|
|
static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
|
2012-01-10 20:37:01 +01:00
|
|
|
BOOL isAlpha, int Stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3)
|
2008-07-12 18:45:33 +02:00
|
|
|
{
|
|
|
|
GLenum src1, src2, src3;
|
|
|
|
GLenum opr1, opr2, opr3;
|
|
|
|
GLenum comb_target;
|
|
|
|
GLenum src0_target, src1_target, src2_target;
|
|
|
|
GLenum opr0_target, opr1_target, opr2_target;
|
|
|
|
GLenum scal_target;
|
|
|
|
GLenum opr=0, invopr, src3_target, opr3_target;
|
|
|
|
BOOL Handled = FALSE;
|
|
|
|
|
|
|
|
TRACE("Alpha?(%d), Stage:%d Op(%s), a1(%d), a2(%d), a3(%d)\n", isAlpha, Stage, debug_d3dtop(op), arg1, arg2, arg3);
|
|
|
|
|
2013-09-02 09:45:41 +02:00
|
|
|
/* Operations usually involve two args, src0 and src1 and are operations
|
|
|
|
* of the form (a1 <operation> a2). However, some of the more complex
|
|
|
|
* operations take 3 parameters. Instead of the (sensible) addition of a3,
|
|
|
|
* Microsoft added in a third parameter called a0. Therefore these are
|
|
|
|
* operations of the form a0 <operation> a1 <operation> a2. I.e., the new
|
|
|
|
* parameter goes to the front.
|
|
|
|
*
|
|
|
|
* However, below we treat the new (a0) parameter as src2/opr2, so in the
|
|
|
|
* actual functions below, expect their syntax to differ slightly to those
|
|
|
|
* listed in the manuals. I.e., replace arg1 with arg3, arg2 with arg1 and
|
|
|
|
* arg3 with arg2. This affects WINED3DTOP_MULTIPLYADD and WINED3DTOP_LERP. */
|
2008-07-12 18:45:33 +02:00
|
|
|
|
2011-07-15 01:14:51 +02:00
|
|
|
if (isAlpha)
|
|
|
|
{
|
|
|
|
comb_target = GL_COMBINE_ALPHA;
|
|
|
|
src0_target = GL_SOURCE0_ALPHA;
|
|
|
|
src1_target = GL_SOURCE1_ALPHA;
|
|
|
|
src2_target = GL_SOURCE2_ALPHA;
|
|
|
|
opr0_target = GL_OPERAND0_ALPHA;
|
|
|
|
opr1_target = GL_OPERAND1_ALPHA;
|
|
|
|
opr2_target = GL_OPERAND2_ALPHA;
|
2008-07-12 18:45:33 +02:00
|
|
|
scal_target = GL_ALPHA_SCALE;
|
|
|
|
}
|
2011-07-15 01:14:51 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
comb_target = GL_COMBINE_RGB;
|
|
|
|
src0_target = GL_SOURCE0_RGB;
|
|
|
|
src1_target = GL_SOURCE1_RGB;
|
|
|
|
src2_target = GL_SOURCE2_RGB;
|
|
|
|
opr0_target = GL_OPERAND0_RGB;
|
|
|
|
opr1_target = GL_OPERAND1_RGB;
|
|
|
|
opr2_target = GL_OPERAND2_RGB;
|
|
|
|
scal_target = GL_RGB_SCALE;
|
2008-07-12 18:45:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If a texture stage references an invalid texture unit the stage just
|
|
|
|
* passes through the result from the previous stage */
|
2010-09-23 21:33:26 +02:00
|
|
|
if (is_invalid_op(state, Stage, op, arg1, arg2, arg3))
|
2010-09-23 11:48:02 +02:00
|
|
|
{
|
2008-07-12 18:45:33 +02:00
|
|
|
arg1 = WINED3DTA_CURRENT;
|
2012-01-10 20:37:01 +01:00
|
|
|
op = WINED3D_TOP_SELECT_ARG1;
|
2008-07-12 18:45:33 +02:00
|
|
|
}
|
|
|
|
|
2010-09-23 21:33:26 +02:00
|
|
|
if (isAlpha && !state->textures[Stage] && arg1 == WINED3DTA_TEXTURE)
|
2010-09-14 13:38:39 +02:00
|
|
|
{
|
2008-07-12 18:45:33 +02:00
|
|
|
get_src_and_opr(WINED3DTA_DIFFUSE, isAlpha, &src1, &opr1);
|
|
|
|
} else {
|
|
|
|
get_src_and_opr(arg1, isAlpha, &src1, &opr1);
|
|
|
|
}
|
|
|
|
get_src_and_opr(arg2, isAlpha, &src2, &opr2);
|
|
|
|
get_src_and_opr(arg3, isAlpha, &src3, &opr3);
|
|
|
|
|
|
|
|
TRACE("ct(%x), 1:(%x,%x), 2:(%x,%x), 3:(%x,%x)\n", comb_target, src1, opr1, src2, opr2, src3, opr3);
|
|
|
|
|
|
|
|
Handled = TRUE; /* Assume will be handled */
|
|
|
|
|
|
|
|
/* Other texture operations require special extensions: */
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2008-07-12 18:45:33 +02:00
|
|
|
if (isAlpha) {
|
|
|
|
opr = GL_SRC_ALPHA;
|
|
|
|
invopr = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
src3_target = GL_SOURCE3_ALPHA_NV;
|
|
|
|
opr3_target = GL_OPERAND3_ALPHA_NV;
|
|
|
|
} else {
|
|
|
|
opr = GL_SRC_COLOR;
|
|
|
|
invopr = GL_ONE_MINUS_SRC_COLOR;
|
|
|
|
src3_target = GL_SOURCE3_RGB_NV;
|
|
|
|
opr3_target = GL_OPERAND3_RGB_NV;
|
|
|
|
}
|
2012-01-10 20:37:01 +01:00
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case WINED3D_TOP_DISABLE: /* Only for alpha */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WINED3D_TOP_SELECT_ARG1: /* = a1 * 1 + 0 * 0 */
|
|
|
|
case WINED3D_TOP_SELECT_ARG2: /* = a2 * 1 + 0 * 0 */
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
if (op == WINED3D_TOP_SELECT_ARG1)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src2");
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
|
|
|
|
}
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_2X:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_4X:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 4);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD_SIGNED:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD_SIGNED_2X:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD_SMOOTH:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_PRIMARY_COLOR);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_PRIMARY_COLOR");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_PRIMARY_COLOR);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_PRIMARY_COLOR");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_TEXTURE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_TEXTURE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_TEXTURE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_TEXTURE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_FACTOR_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_CONSTANT);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_CONSTANT");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_CONSTANT);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_CONSTANT");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_TEXTURE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_TEXTURE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); /* a0 = src1/opr1 */
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1"); /* a1 = 1 (see docs) */
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2); /* a2 = arg2 */
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2"); /* a3 = src1 alpha */
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, src1");
|
|
|
|
switch (opr) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MULTIPLY_ADD:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src3);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr3);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src3_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, src3");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr3");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BUMPENVMAP:
|
|
|
|
case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
|
2008-07-12 18:45:33 +02:00
|
|
|
FIXME("Implement bump environment mapping in GL_NV_texture_env_combine4 path\n");
|
2012-12-02 16:00:46 +01:00
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2008-07-12 18:45:33 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
Handled = FALSE;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
if (Handled)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} /* GL_NV_texture_env_combine4 */
|
|
|
|
|
|
|
|
Handled = TRUE; /* Again, assume handled */
|
|
|
|
switch (op) {
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_DISABLE: /* Only for alpha */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_SELECT_ARG1:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_SELECT_ARG2:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_2X:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_4X:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 4);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD_SIGNED:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD_SIGNED_2X:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_SUBTRACT:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_TEXTURE_ENV_COMBINE])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_SUBTRACT);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_SUBTRACT");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else {
|
|
|
|
FIXME("This version of opengl does not support GL_SUBTRACT\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_PRIMARY_COLOR);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_PRIMARY_COLOR");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_TEXTURE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_TEXTURE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_FACTOR_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_CONSTANT);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_CONSTANT");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_CURRENT_ALPHA:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_PREVIOUS);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_PREVIOUS");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_DOTPRODUCT3:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_TEXTURE_ENV_DOT3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB");
|
2009-10-29 10:37:11 +01:00
|
|
|
}
|
2010-01-04 21:33:10 +01:00
|
|
|
else if (gl_info->supported[EXT_TEXTURE_ENV_DOT3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT");
|
|
|
|
} else {
|
|
|
|
FIXME("This version of opengl does not support GL_DOT3\n");
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_LERP:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src3);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src3");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr3);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr3");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_ADD_SMOOTH:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_TEXTURE);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, GL_TEXTURE");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_ALPHA);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_APHA");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
|
|
|
switch (opr1) {
|
|
|
|
case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
case GL_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
|
|
|
case GL_ONE_MINUS_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_MULTIPLY_ADD:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src1_target, src3);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src3");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr3);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr3");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
2008-07-12 18:45:33 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
} else
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
2012-01-10 20:37:01 +01:00
|
|
|
case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
|
|
|
|
case WINED3D_TOP_BUMPENVMAP:
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[NV_TEXTURE_SHADER2])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2008-07-12 18:45:33 +02:00
|
|
|
/* Technically texture shader support without register combiners is possible, but not expected to occur
|
|
|
|
* on real world cards, so for now a fixme should be enough
|
|
|
|
*/
|
|
|
|
FIXME("Implement bump mapping with GL_NV_texture_shader in non register combiner path\n");
|
|
|
|
}
|
2012-12-02 16:00:46 +01:00
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
|
|
|
|
2008-07-12 18:45:33 +02:00
|
|
|
default:
|
|
|
|
Handled = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Handled) {
|
|
|
|
BOOL combineOK = TRUE;
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2008-07-12 18:45:33 +02:00
|
|
|
DWORD op2;
|
|
|
|
|
2010-09-16 11:19:57 +02:00
|
|
|
if (isAlpha)
|
2012-01-09 22:16:51 +01:00
|
|
|
op2 = state->texture_states[Stage][WINED3D_TSS_COLOR_OP];
|
2010-09-16 11:19:57 +02:00
|
|
|
else
|
2012-01-09 22:16:51 +01:00
|
|
|
op2 = state->texture_states[Stage][WINED3D_TSS_ALPHA_OP];
|
2008-07-12 18:45:33 +02:00
|
|
|
|
|
|
|
/* Note: If COMBINE4 in effect can't go back to combine! */
|
2012-01-10 20:37:01 +01:00
|
|
|
switch (op2)
|
|
|
|
{
|
|
|
|
case WINED3D_TOP_ADD_SMOOTH:
|
|
|
|
case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
|
|
|
|
case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
|
|
|
|
case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
|
|
|
|
case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
|
|
|
|
case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
|
|
|
|
case WINED3D_TOP_MULTIPLY_ADD:
|
2008-07-12 18:45:33 +02:00
|
|
|
/* Ignore those implemented in both cases */
|
2012-01-10 20:37:01 +01:00
|
|
|
switch (op)
|
|
|
|
{
|
|
|
|
case WINED3D_TOP_SELECT_ARG1:
|
|
|
|
case WINED3D_TOP_SELECT_ARG2:
|
2008-07-12 18:45:33 +02:00
|
|
|
combineOK = FALSE;
|
|
|
|
Handled = FALSE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("Can't use COMBINE4 and COMBINE together, thisop=%s, otherop=%s, isAlpha(%d)\n", debug_d3dtop(op), debug_d3dtop(op2), isAlpha);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-15 01:14:51 +02:00
|
|
|
if (combineOK)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
|
2011-07-15 01:14:51 +02:00
|
|
|
checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE");
|
2008-07-12 18:45:33 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* After all the extensions, if still unhandled, report fixme */
|
|
|
|
FIXME("Unhandled texture operation %s\n", debug_d3dtop(op));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void tex_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-09-28 12:00:24 +02:00
|
|
|
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
2013-09-16 12:43:18 +02:00
|
|
|
BOOL tex_used = context->fixed_function_usage_map & (1 << stage);
|
|
|
|
DWORD mapped_stage = context->tex_unit_map[stage];
|
2009-10-22 10:09:54 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2006-12-19 23:00:58 +01:00
|
|
|
|
|
|
|
TRACE("Setting color op for stage %d\n", stage);
|
|
|
|
|
2008-12-15 16:35:14 +01:00
|
|
|
/* Using a pixel shader? Don't care for anything here, the shader applying does it */
|
2010-09-28 12:00:24 +02:00
|
|
|
if (use_ps(state)) return;
|
2006-12-19 23:00:58 +01:00
|
|
|
|
2007-01-03 19:18:38 +01:00
|
|
|
if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
|
|
|
|
|
2009-03-09 14:31:28 +01:00
|
|
|
if (mapped_stage != WINED3D_UNMAPPED_STAGE)
|
|
|
|
{
|
2009-10-29 10:37:10 +01:00
|
|
|
if (tex_used && mapped_stage >= gl_info->limits.textures)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2008-12-16 13:18:49 +01:00
|
|
|
FIXME("Attempt to enable unsupported stage!\n");
|
2006-12-19 23:00:58 +01:00
|
|
|
return;
|
|
|
|
}
|
2011-08-03 01:34:15 +02:00
|
|
|
context_active_texture(context, gl_info, mapped_stage);
|
2006-12-19 23:00:58 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:06 +02:00
|
|
|
if (stage >= context->lowest_disabled_stage)
|
2010-09-16 11:19:57 +02:00
|
|
|
{
|
2006-12-19 23:00:58 +01:00
|
|
|
TRACE("Stage disabled\n");
|
2009-03-09 14:31:28 +01:00
|
|
|
if (mapped_stage != WINED3D_UNMAPPED_STAGE)
|
|
|
|
{
|
2007-01-03 19:18:38 +01:00
|
|
|
/* Disable everything here */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
|
2007-01-03 19:18:38 +01:00
|
|
|
checkGLcall("glDisable(GL_TEXTURE_2D)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
|
2007-01-03 19:18:38 +01:00
|
|
|
checkGLcall("glDisable(GL_TEXTURE_3D)");
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
2007-03-28 19:17:51 +02:00
|
|
|
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
|
|
|
|
}
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
2007-11-27 22:25:07 +01:00
|
|
|
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
|
|
|
|
}
|
2007-05-07 21:08:14 +02:00
|
|
|
}
|
2006-12-19 23:00:58 +01:00
|
|
|
/* All done */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-09-23 21:33:27 +02:00
|
|
|
/* The sampler will also activate the correct texture dimensions, so no
|
|
|
|
* need to do it here if the sampler for this stage is dirty. */
|
|
|
|
if (!isStateDirty(context, STATE_SAMPLER(stage)) && tex_used)
|
2010-09-28 12:00:24 +02:00
|
|
|
texture_activate_dimensions(state->textures[stage], gl_info);
|
2006-12-19 23:00:58 +01:00
|
|
|
|
2010-09-28 12:00:24 +02:00
|
|
|
set_tex_op(gl_info, state, FALSE, stage,
|
2012-01-09 22:16:51 +01:00
|
|
|
state->texture_states[stage][WINED3D_TSS_COLOR_OP],
|
|
|
|
state->texture_states[stage][WINED3D_TSS_COLOR_ARG1],
|
|
|
|
state->texture_states[stage][WINED3D_TSS_COLOR_ARG2],
|
|
|
|
state->texture_states[stage][WINED3D_TSS_COLOR_ARG0]);
|
2006-12-19 23:00:58 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
2013-09-16 12:43:18 +02:00
|
|
|
BOOL tex_used = context->fixed_function_usage_map & (1 << stage);
|
|
|
|
DWORD mapped_stage = context->tex_unit_map[stage];
|
2010-01-04 21:33:10 +01:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2007-02-15 03:04:18 +01:00
|
|
|
DWORD op, arg1, arg2, arg0;
|
2006-12-19 23:03:37 +01:00
|
|
|
|
|
|
|
TRACE("Setting alpha op for stage %d\n", stage);
|
2008-01-09 20:37:05 +01:00
|
|
|
/* Do not care for enabled / disabled stages, just assign the settings. colorop disables / enables required stuff */
|
2009-03-09 14:31:28 +01:00
|
|
|
if (mapped_stage != WINED3D_UNMAPPED_STAGE)
|
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
if (tex_used && mapped_stage >= gl_info->limits.textures)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2008-12-16 13:18:49 +01:00
|
|
|
FIXME("Attempt to enable unsupported stage!\n");
|
2006-12-19 23:03:37 +01:00
|
|
|
return;
|
|
|
|
}
|
2011-08-03 01:34:15 +02:00
|
|
|
context_active_texture(context, gl_info, mapped_stage);
|
2006-12-19 23:03:37 +01:00
|
|
|
}
|
|
|
|
|
2012-01-09 22:16:51 +01:00
|
|
|
op = state->texture_states[stage][WINED3D_TSS_ALPHA_OP];
|
|
|
|
arg1 = state->texture_states[stage][WINED3D_TSS_ALPHA_ARG1];
|
|
|
|
arg2 = state->texture_states[stage][WINED3D_TSS_ALPHA_ARG2];
|
|
|
|
arg0 = state->texture_states[stage][WINED3D_TSS_ALPHA_ARG0];
|
2007-02-15 03:04:18 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_COLORKEYENABLE] && !stage && state->textures[0])
|
2008-12-12 09:33:51 +01:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
struct wined3d_texture *texture = state->textures[0];
|
2011-03-28 21:58:42 +02:00
|
|
|
GLenum texture_dimensions = texture->target;
|
2008-12-12 09:33:51 +01:00
|
|
|
|
|
|
|
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
|
|
|
|
{
|
2014-01-09 12:17:00 +01:00
|
|
|
if (texture->color_key_flags & WINEDDSD_CKSRCBLT && !texture->resource.format->alpha_size)
|
2008-12-12 09:33:51 +01:00
|
|
|
{
|
|
|
|
/* Color keying needs to pass alpha values from the texture through to have the alpha test work
|
|
|
|
* properly. On the other hand applications can still use texture combiners apparently. This code
|
|
|
|
* takes care that apps cannot remove the texture's alpha channel entirely.
|
|
|
|
*
|
|
|
|
* The fixup is required for Prince of Persia 3D(prison bars), while Moto racer 2 requires
|
|
|
|
* D3DTOP_MODULATE to work on color keyed surfaces. Aliens vs Predator 1 uses color keyed textures
|
|
|
|
* and alpha component of diffuse color to draw things like translucent text and perform other
|
|
|
|
* blending effects.
|
|
|
|
*
|
|
|
|
* Aliens vs Predator 1 relies on diffuse alpha having an effect, so it cannot be ignored. To
|
|
|
|
* provide the behavior expected by the game, while emulating the colorkey, diffuse alpha must be
|
|
|
|
* modulated with texture alpha. OTOH, Moto racer 2 at some points sets alphaop/alphaarg to
|
|
|
|
* SELECTARG/CURRENT, yet puts garbage in diffuse alpha (zeroes). This works on native, because the
|
|
|
|
* game disables alpha test and alpha blending. Alpha test is overwritten by wine's for purposes of
|
|
|
|
* color-keying though, so this will lead to missing geometry if texture alpha is modulated (pixels
|
|
|
|
* fail alpha test). To get around this, ALPHABLENDENABLE state is checked: if the app enables alpha
|
|
|
|
* blending, it can be expected to provide meaningful values in diffuse alpha, so it should be
|
|
|
|
* modulated with texture alpha; otherwise, selecting diffuse alpha is ignored in favour of texture
|
|
|
|
* alpha.
|
|
|
|
*
|
|
|
|
* What to do with multitexturing? So far no app has been found that uses color keying with
|
|
|
|
* multitexturing */
|
2012-01-10 20:37:01 +01:00
|
|
|
if (op == WINED3D_TOP_DISABLE)
|
2008-12-12 09:33:51 +01:00
|
|
|
{
|
2008-01-21 05:17:49 +01:00
|
|
|
arg1 = WINED3DTA_TEXTURE;
|
2012-01-10 20:37:01 +01:00
|
|
|
op = WINED3D_TOP_SELECT_ARG1;
|
2008-12-12 09:33:51 +01:00
|
|
|
}
|
2012-01-10 20:37:01 +01:00
|
|
|
else if (op == WINED3D_TOP_SELECT_ARG1 && arg1 != WINED3DTA_TEXTURE)
|
2008-12-12 09:33:51 +01:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
|
2008-12-12 09:33:51 +01:00
|
|
|
{
|
|
|
|
arg2 = WINED3DTA_TEXTURE;
|
2012-01-10 20:37:01 +01:00
|
|
|
op = WINED3D_TOP_MODULATE;
|
2008-12-12 09:33:51 +01:00
|
|
|
}
|
|
|
|
else arg1 = WINED3DTA_TEXTURE;
|
|
|
|
}
|
2012-01-10 20:37:01 +01:00
|
|
|
else if (op == WINED3D_TOP_SELECT_ARG2 && arg2 != WINED3DTA_TEXTURE)
|
2008-12-12 09:33:51 +01:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
|
2008-12-12 09:33:51 +01:00
|
|
|
{
|
|
|
|
arg1 = WINED3DTA_TEXTURE;
|
2012-01-10 20:37:01 +01:00
|
|
|
op = WINED3D_TOP_MODULATE;
|
2008-12-12 09:33:51 +01:00
|
|
|
}
|
|
|
|
else arg2 = WINED3DTA_TEXTURE;
|
2008-01-21 05:17:49 +01:00
|
|
|
}
|
|
|
|
}
|
2007-02-15 03:04:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-06 01:31:34 +02:00
|
|
|
/* tex_alphaop is shared between the ffp and nvrc because the difference only comes down to
|
|
|
|
* this if block here, and the other code(color keying, texture unit selection) are the same
|
|
|
|
*/
|
2006-12-19 23:03:37 +01:00
|
|
|
TRACE("Setting alpha op for stage %d\n", stage);
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[NV_REGISTER_COMBINERS])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
set_tex_op_nvrc(gl_info, state, TRUE, stage, op, arg1, arg2, arg0,
|
2012-01-09 22:16:51 +01:00
|
|
|
mapped_stage, state->texture_states[stage][WINED3D_TSS_RESULT_ARG]);
|
2009-12-09 20:32:08 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
set_tex_op(gl_info, state, TRUE, stage, op, arg1, arg2, arg0);
|
2006-12-19 23:03:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void transform_texture(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-09-28 12:00:23 +02:00
|
|
|
DWORD texUnit = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
2011-07-14 01:02:48 +02:00
|
|
|
const struct wined3d_device *device = context->swapchain->device;
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2013-09-16 12:43:18 +02:00
|
|
|
DWORD mapped_stage = context->tex_unit_map[texUnit];
|
2007-11-13 22:08:13 +01:00
|
|
|
BOOL generated;
|
2008-07-22 20:56:07 +02:00
|
|
|
int coordIdx;
|
2007-03-12 23:21:44 +01:00
|
|
|
|
2007-08-27 14:33:46 +02:00
|
|
|
/* Ignore this when a vertex shader is used, or if the streams aren't sorted out yet */
|
2010-09-28 12:00:23 +02:00
|
|
|
if (use_vs(state) || isStateDirty(context, STATE_VDECL))
|
2008-12-30 14:56:49 +01:00
|
|
|
{
|
2007-08-27 14:33:46 +02:00
|
|
|
TRACE("Using a vertex shader, or stream sources not sorted out yet, skipping\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-09 14:31:28 +01:00
|
|
|
if (mapped_stage == WINED3D_UNMAPPED_STAGE) return;
|
2010-05-25 12:02:03 +02:00
|
|
|
if (mapped_stage >= gl_info->limits.textures) return;
|
2007-01-01 23:53:59 +01:00
|
|
|
|
2011-08-03 01:34:15 +02:00
|
|
|
context_active_texture(context, gl_info, mapped_stage);
|
2012-01-09 22:16:51 +01:00
|
|
|
generated = (state->texture_states[texUnit][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000) != WINED3DTSS_TCI_PASSTHRU;
|
|
|
|
coordIdx = min(state->texture_states[texUnit][WINED3D_TSS_TEXCOORD_INDEX & 0x0000ffff], MAX_TEXTURES - 1);
|
2007-01-01 23:53:59 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
set_texture_matrix(gl_info, &state->transforms[WINED3D_TS_TEXTURE0 + texUnit].u.m[0][0],
|
2012-01-09 22:16:51 +01:00
|
|
|
state->texture_states[texUnit][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS],
|
2010-09-16 11:19:57 +02:00
|
|
|
generated, context->last_was_rhw,
|
2013-09-12 12:23:29 +02:00
|
|
|
context->stream_info.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))
|
|
|
|
? context->stream_info.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format->id
|
2009-03-27 10:25:56 +01:00
|
|
|
: WINED3DFMT_UNKNOWN,
|
2012-10-24 21:23:37 +02:00
|
|
|
device->shader_backend->shader_has_ffp_proj_control(device->shader_priv));
|
2007-01-01 23:53:59 +01:00
|
|
|
|
2007-11-13 22:08:13 +01:00
|
|
|
/* The sampler applying function calls us if this changes */
|
2010-09-28 12:00:23 +02:00
|
|
|
if ((context->lastWasPow2Texture & (1 << texUnit)) && state->textures[texUnit])
|
2008-12-30 14:56:49 +01:00
|
|
|
{
|
2007-11-13 22:08:13 +01:00
|
|
|
if(generated) {
|
|
|
|
FIXME("Non-power2 texture being used with generated texture coords\n");
|
|
|
|
}
|
2009-07-01 18:36:51 +02:00
|
|
|
/* NP2 texcoord fixup is implemented for pixelshaders so only enable the
|
|
|
|
fixed-function-pipeline fixup via pow2Matrix when no PS is used. */
|
2010-09-28 12:00:24 +02:00
|
|
|
if (!use_ps(state))
|
|
|
|
{
|
2009-03-26 03:19:41 +01:00
|
|
|
TRACE("Non power two matrix multiply fixup\n");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMultMatrixf(state->textures[texUnit]->pow2_matrix);
|
2009-03-26 03:19:41 +01:00
|
|
|
}
|
2007-11-13 22:08:13 +01:00
|
|
|
}
|
2007-01-01 23:53:59 +01:00
|
|
|
}
|
|
|
|
|
2011-07-12 21:17:47 +02:00
|
|
|
static void unload_tex_coords(const struct wined3d_gl_info *gl_info)
|
2009-08-19 10:55:38 +02:00
|
|
|
{
|
2009-03-25 10:12:27 +01:00
|
|
|
unsigned int texture_idx;
|
2007-05-09 19:08:10 +02:00
|
|
|
|
2011-09-01 18:20:19 +02:00
|
|
|
for (texture_idx = 0; texture_idx < gl_info->limits.texture_coords; ++texture_idx)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2007-05-09 19:08:10 +02:00
|
|
|
GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + texture_idx));
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
2007-05-09 19:08:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-12 21:17:47 +02:00
|
|
|
static void load_tex_coords(const struct wined3d_context *context, const struct wined3d_stream_info *si,
|
|
|
|
GLuint *curVBO, const struct wined3d_state *state)
|
2008-12-01 15:32:14 +01:00
|
|
|
{
|
2011-07-12 21:17:47 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2007-05-09 19:08:10 +02:00
|
|
|
unsigned int mapped_stage = 0;
|
|
|
|
unsigned int textureNo = 0;
|
|
|
|
|
2013-04-25 15:20:30 +02:00
|
|
|
for (textureNo = 0; textureNo < context->d3d_info->limits.ffp_blend_stages; ++textureNo)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2012-01-09 22:16:51 +01:00
|
|
|
int coordIdx = state->texture_states[textureNo][WINED3D_TSS_TEXCOORD_INDEX];
|
2007-05-09 19:08:27 +02:00
|
|
|
|
2013-09-16 12:43:18 +02:00
|
|
|
mapped_stage = context->tex_unit_map[textureNo];
|
2009-03-09 14:31:28 +01:00
|
|
|
if (mapped_stage == WINED3D_UNMAPPED_STAGE) continue;
|
2007-05-09 19:08:10 +02:00
|
|
|
|
2011-09-01 18:20:19 +02:00
|
|
|
if (mapped_stage >= gl_info->limits.texture_coords)
|
|
|
|
{
|
|
|
|
FIXME("Attempted to load unsupported texture coordinate %u\n", mapped_stage);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-08-24 09:27:52 +02:00
|
|
|
if (coordIdx < MAX_TEXTURES && (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2009-08-24 09:27:52 +02:00
|
|
|
const struct wined3d_stream_info_element *e = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
|
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
TRACE("Setting up texture %u, idx %d, coordindx %u, data {%#x:%p}.\n",
|
|
|
|
textureNo, mapped_stage, coordIdx, e->data.buffer_object, e->data.addr);
|
2007-05-09 19:08:27 +02:00
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
if (*curVBO != e->data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
|
2007-05-09 19:08:27 +02:00
|
|
|
checkGLcall("glBindBufferARB");
|
2011-07-11 01:06:46 +02:00
|
|
|
*curVBO = e->data.buffer_object;
|
2007-05-09 19:08:27 +02:00
|
|
|
}
|
2007-05-09 19:08:10 +02:00
|
|
|
|
|
|
|
GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
|
|
|
checkGLcall("glClientActiveTextureARB");
|
|
|
|
|
2007-05-09 19:08:27 +02:00
|
|
|
/* The coords to supply depend completely on the fvf / vertex shader */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexCoordPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
2011-07-11 01:06:46 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-05-09 19:08:27 +02:00
|
|
|
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
2007-05-09 19:08:10 +02:00
|
|
|
}
|
|
|
|
}
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[NV_REGISTER_COMBINERS])
|
2009-10-29 10:37:10 +01:00
|
|
|
{
|
|
|
|
/* The number of the mapped stages increases monotonically, so it's fine to use the last used one. */
|
2010-01-04 21:33:10 +01:00
|
|
|
for (textureNo = mapped_stage + 1; textureNo < gl_info->limits.textures; ++textureNo)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2007-05-09 19:08:10 +02:00
|
|
|
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1));
|
|
|
|
}
|
|
|
|
}
|
2008-09-17 17:51:49 +02:00
|
|
|
|
|
|
|
checkGLcall("loadTexCoords");
|
2007-05-09 19:08:10 +02:00
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void tex_coordindex(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-07-12 21:17:47 +02:00
|
|
|
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
2009-07-07 11:08:01 +02:00
|
|
|
static const GLfloat s_plane[] = { 1.0f, 0.0f, 0.0f, 0.0f };
|
|
|
|
static const GLfloat t_plane[] = { 0.0f, 1.0f, 0.0f, 0.0f };
|
|
|
|
static const GLfloat r_plane[] = { 0.0f, 0.0f, 1.0f, 0.0f };
|
|
|
|
static const GLfloat q_plane[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
2010-01-04 21:33:10 +01:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2013-09-16 12:43:18 +02:00
|
|
|
DWORD mapped_stage = context->tex_unit_map[stage];
|
2007-01-03 19:18:51 +01:00
|
|
|
|
2009-03-09 14:31:28 +01:00
|
|
|
if (mapped_stage == WINED3D_UNMAPPED_STAGE)
|
|
|
|
{
|
2007-01-03 19:18:51 +01:00
|
|
|
TRACE("No texture unit mapped to stage %d. Skipping texture coordinates.\n", stage);
|
|
|
|
return;
|
|
|
|
}
|
2006-12-19 23:04:16 +01:00
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (mapped_stage >= gl_info->limits.fragment_samplers)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2009-03-25 10:12:26 +01:00
|
|
|
WARN("stage %u not mapped to a valid texture unit (%u)\n", stage, mapped_stage);
|
2006-12-19 23:04:16 +01:00
|
|
|
return;
|
|
|
|
}
|
2011-08-03 01:34:15 +02:00
|
|
|
context_active_texture(context, gl_info, mapped_stage);
|
2006-12-19 23:04:16 +01:00
|
|
|
|
|
|
|
/* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive
|
|
|
|
*
|
2009-01-15 09:58:45 +01:00
|
|
|
* FIXME: When using generated texture coordinates, the index value is used to specify the wrapping mode.
|
2012-01-09 22:16:51 +01:00
|
|
|
* eg. SetTextureStageState( 0, WINED3D_TSS_TEXCOORDINDEX, WINED3D_TSS_TCI_CAMERASPACEPOSITION | 1 );
|
2006-12-19 23:04:16 +01:00
|
|
|
* means use the vertex position (camera-space) as the input texture coordinates
|
2011-12-19 21:00:09 +01:00
|
|
|
* for this texture stage, and the wrap mode set in the WINED3D_RS_WRAP1 render
|
2006-12-19 23:04:16 +01:00
|
|
|
* state. We do not (yet) support the WINED3DRENDERSTATE_WRAPx values, nor tie them up
|
|
|
|
* to the TEXCOORDINDEX value
|
|
|
|
*/
|
2012-01-09 22:16:51 +01:00
|
|
|
switch (state->texture_states[stage][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000)
|
2009-03-25 10:12:26 +01:00
|
|
|
{
|
|
|
|
case WINED3DTSS_TCI_PASSTHRU:
|
|
|
|
/* Use the specified texture coordinates contained within the
|
|
|
|
* vertex format. This value resolves to zero. */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_S);
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_T);
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_R);
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_Q);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_PASSTHRU - Disable texgen.");
|
2009-03-25 10:12:26 +01:00
|
|
|
break;
|
2006-12-19 23:04:16 +01:00
|
|
|
|
2009-03-25 10:12:26 +01:00
|
|
|
case WINED3DTSS_TCI_CAMERASPACEPOSITION:
|
|
|
|
/* CameraSpacePosition means use the vertex position, transformed to camera space,
|
|
|
|
* as the input texture coordinates for this stage's texture transformation. This
|
|
|
|
* equates roughly to EYE_LINEAR */
|
2006-12-19 23:04:16 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
|
|
|
gl_info->gl_ops.gl.p_glPushMatrix();
|
|
|
|
gl_info->gl_ops.gl.p_glLoadIdentity();
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glPopMatrix();
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane.");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set texgen mode.");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_S);
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_T);
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_R);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACEPOSITION - Enable texgen.");
|
|
|
|
|
2009-03-25 10:12:26 +01:00
|
|
|
break;
|
2006-12-19 23:04:16 +01:00
|
|
|
|
2009-03-25 10:12:26 +01:00
|
|
|
case WINED3DTSS_TCI_CAMERASPACENORMAL:
|
2009-03-25 10:12:26 +01:00
|
|
|
/* Note that NV_TEXGEN_REFLECTION support is implied when
|
|
|
|
* ARB_TEXTURE_CUBE_MAP is supported */
|
2010-01-04 21:33:10 +01:00
|
|
|
if (!gl_info->supported[NV_TEXGEN_REFLECTION])
|
2009-03-25 10:12:26 +01:00
|
|
|
{
|
2009-03-25 10:12:26 +01:00
|
|
|
FIXME("WINED3DTSS_TCI_CAMERASPACENORMAL not supported.\n");
|
2009-03-25 10:12:26 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
|
|
|
gl_info->gl_ops.gl.p_glPushMatrix();
|
|
|
|
gl_info->gl_ops.gl.p_glLoadIdentity();
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glPopMatrix();
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACENORMAL - Set eye plane.");
|
2009-03-25 10:12:26 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACENORMAL - Set texgen mode.");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_S);
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_T);
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_R);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACENORMAL - Enable texgen.");
|
2009-03-25 10:12:26 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR:
|
2009-03-25 10:12:26 +01:00
|
|
|
/* Note that NV_TEXGEN_REFLECTION support is implied when
|
|
|
|
* ARB_TEXTURE_CUBE_MAP is supported */
|
2010-01-04 21:33:10 +01:00
|
|
|
if (!gl_info->supported[NV_TEXGEN_REFLECTION])
|
2009-03-25 10:12:26 +01:00
|
|
|
{
|
2009-03-25 10:12:26 +01:00
|
|
|
FIXME("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR not supported.\n");
|
2009-03-25 10:12:26 +01:00
|
|
|
break;
|
2006-12-19 23:04:16 +01:00
|
|
|
}
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
|
|
|
gl_info->gl_ops.gl.p_glPushMatrix();
|
|
|
|
gl_info->gl_ops.gl.p_glLoadIdentity();
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
|
|
|
gl_info->gl_ops.gl.p_glPopMatrix();
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Set eye plane.");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Set texgen mode.");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_S);
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_T);
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_R);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Enable texgen.");
|
2009-03-25 10:12:26 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2009-03-25 10:12:26 +01:00
|
|
|
case WINED3DTSS_TCI_SPHEREMAP:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
|
|
|
gl_info->gl_ops.gl.p_glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_SPHEREMAP - Set texgen mode.");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_S);
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_GEN_T);
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_R);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("WINED3DTSS_TCI_SPHEREMAP - Enable texgen.");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2009-03-25 10:12:26 +01:00
|
|
|
default:
|
2012-01-09 22:16:51 +01:00
|
|
|
FIXME("Unhandled WINED3D_TSS_TEXCOORD_INDEX %#x.\n",
|
|
|
|
state->texture_states[stage][WINED3D_TSS_TEXCOORD_INDEX]);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_S);
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_T);
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_R);
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_GEN_Q);
|
2009-03-25 10:12:26 +01:00
|
|
|
checkGLcall("Disable texgen.");
|
|
|
|
|
2009-03-25 10:12:26 +01:00
|
|
|
break;
|
2006-12-19 23:04:16 +01:00
|
|
|
}
|
2007-01-01 23:53:59 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
/* Update the texture matrix. */
|
2012-01-11 21:27:32 +01:00
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + stage)))
|
2012-01-09 22:16:51 +01:00
|
|
|
transform_texture(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS));
|
2007-01-06 18:11:21 +01:00
|
|
|
|
2012-01-09 22:16:51 +01:00
|
|
|
if (!isStateDirty(context, STATE_VDECL) && context->namedArraysLoaded)
|
|
|
|
{
|
2007-01-06 18:11:21 +01:00
|
|
|
/* Reload the arrays if we are using fixed function arrays to reflect the selected coord input
|
2007-05-09 19:08:10 +02:00
|
|
|
* source. Call loadTexCoords directly because there is no need to reparse the vertex declaration
|
2007-01-06 18:11:21 +01:00
|
|
|
* and do all the things linked to it
|
|
|
|
* TODO: Tidy that up to reload only the arrays of the changed unit
|
|
|
|
*/
|
2010-01-04 21:33:10 +01:00
|
|
|
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
2007-05-09 19:08:10 +02:00
|
|
|
|
2011-07-12 21:17:47 +02:00
|
|
|
unload_tex_coords(gl_info);
|
2013-09-12 12:23:29 +02:00
|
|
|
load_tex_coords(context, &context->stream_info, &curVBO, state);
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
2006-12-19 23:04:16 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void sampler_texmatrix(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
const DWORD sampler = state_id - STATE_SAMPLER(0);
|
|
|
|
const struct wined3d_texture *texture = state->textures[sampler];
|
2008-07-03 20:26:06 +02:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
2009-02-19 08:53:50 +01:00
|
|
|
|
2008-07-16 22:45:45 +02:00
|
|
|
if(!texture) return;
|
2008-07-03 20:26:06 +02:00
|
|
|
/* The fixed function np2 texture emulation uses the texture matrix to fix up the coordinates
|
2011-03-18 19:10:59 +01:00
|
|
|
* wined3d_texture_apply_state_changes() multiplies the set matrix with a fixup matrix. Before the
|
2008-07-03 20:26:06 +02:00
|
|
|
* scaling is reapplied or removed, the texture matrix has to be reapplied
|
|
|
|
*
|
2008-10-20 17:56:58 +02:00
|
|
|
* The mapped stage is already active because the sampler() function below, which is part of the
|
2008-07-03 20:26:06 +02:00
|
|
|
* misc pipeline
|
|
|
|
*/
|
2011-03-28 21:58:42 +02:00
|
|
|
if (sampler < MAX_TEXTURES)
|
|
|
|
{
|
2011-03-28 21:58:44 +02:00
|
|
|
const BOOL texIsPow2 = !(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT);
|
2008-07-03 20:26:06 +02:00
|
|
|
|
2008-12-30 14:56:49 +01:00
|
|
|
if (texIsPow2 || (context->lastWasPow2Texture & (1 << sampler)))
|
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
if (texIsPow2)
|
|
|
|
context->lastWasPow2Texture |= 1 << sampler;
|
|
|
|
else
|
|
|
|
context->lastWasPow2Texture &= ~(1 << sampler);
|
|
|
|
|
|
|
|
transform_texture(context, state,
|
2013-09-16 12:43:18 +02:00
|
|
|
STATE_TEXTURESTAGE(context->tex_unit_map[sampler], WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS));
|
2008-07-03 20:26:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void sampler(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-09-28 12:00:23 +02:00
|
|
|
DWORD sampler = state_id - STATE_SAMPLER(0);
|
2013-09-16 12:43:18 +02:00
|
|
|
DWORD mapped_stage = context->tex_unit_map[sampler];
|
2009-10-22 10:09:54 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2007-01-02 00:07:55 +01:00
|
|
|
union {
|
|
|
|
float f;
|
|
|
|
DWORD d;
|
|
|
|
} tmpvalue;
|
2006-12-19 23:26:39 +01:00
|
|
|
|
|
|
|
TRACE("Sampler: %d\n", sampler);
|
|
|
|
/* Enabling and disabling texture dimensions is done by texture stage state / pixel shader setup, this function
|
|
|
|
* only has to bind textures and set the per texture states
|
|
|
|
*/
|
2007-01-03 19:18:59 +01:00
|
|
|
|
2009-03-09 14:31:28 +01:00
|
|
|
if (mapped_stage == WINED3D_UNMAPPED_STAGE)
|
|
|
|
{
|
2007-01-03 19:18:59 +01:00
|
|
|
TRACE("No sampler mapped to stage %d. Returning.\n", sampler);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-29 10:37:10 +01:00
|
|
|
if (mapped_stage >= gl_info->limits.combined_samplers)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2006-12-19 23:26:39 +01:00
|
|
|
return;
|
|
|
|
}
|
2011-08-03 01:34:15 +02:00
|
|
|
context_active_texture(context, gl_info, mapped_stage);
|
2006-12-19 23:26:39 +01:00
|
|
|
|
2010-09-28 12:00:23 +02:00
|
|
|
if (state->textures[sampler])
|
2010-09-16 11:19:58 +02:00
|
|
|
{
|
2011-03-18 19:11:00 +01:00
|
|
|
struct wined3d_texture *texture = state->textures[sampler];
|
2012-01-08 21:14:59 +01:00
|
|
|
BOOL srgb = state->sampler_states[sampler][WINED3D_SAMP_SRGB_TEXTURE];
|
2010-09-17 11:59:40 +02:00
|
|
|
|
2013-11-21 00:10:17 +01:00
|
|
|
wined3d_texture_bind(texture, context, srgb);
|
2011-03-18 19:10:59 +01:00
|
|
|
wined3d_texture_apply_state_changes(texture, state->sampler_states[sampler], gl_info);
|
2006-12-19 23:26:39 +01:00
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_TEXTURE_LOD_BIAS])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2012-01-08 21:14:59 +01:00
|
|
|
tmpvalue.d = state->sampler_states[sampler][WINED3D_SAMP_MIPMAP_LOD_BIAS];
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
|
|
|
|
GL_TEXTURE_LOD_BIAS_EXT, tmpvalue.f);
|
2010-11-05 11:17:51 +01:00
|
|
|
checkGLcall("glTexEnvf(GL_TEXTURE_LOD_BIAS_EXT, ...)");
|
2007-01-02 00:07:55 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:06 +02:00
|
|
|
if (!use_ps(state) && sampler < context->lowest_disabled_stage)
|
2008-12-30 14:56:49 +01:00
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_COLORKEYENABLE] && !sampler)
|
2010-09-14 13:38:39 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
/* If color keying is enabled update the alpha test, it
|
|
|
|
* depends on the existence of a color key in stage 0. */
|
2011-12-19 21:00:09 +01:00
|
|
|
state_alpha(context, state, WINED3D_RS_COLORKEYENABLE);
|
2006-12-19 23:26:39 +01:00
|
|
|
}
|
|
|
|
}
|
2009-03-26 03:19:41 +01:00
|
|
|
|
2009-07-01 18:36:51 +02:00
|
|
|
/* Trigger shader constant reloading (for NP2 texcoord fixup) */
|
2011-03-28 21:58:44 +02:00
|
|
|
if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT))
|
2013-08-21 08:29:28 +02:00
|
|
|
context->constant_update_mask |= WINED3D_SHADER_CONST_PS_NP2_FIXUP;
|
2009-10-22 10:09:54 +02:00
|
|
|
}
|
2011-08-26 01:12:27 +02:00
|
|
|
else
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2013-10-06 17:33:06 +02:00
|
|
|
if (sampler < context->lowest_disabled_stage)
|
2010-09-14 13:38:39 +02:00
|
|
|
{
|
2007-01-10 11:44:55 +01:00
|
|
|
/* TODO: What should I do with pixel shaders here ??? */
|
2011-12-19 21:00:09 +01:00
|
|
|
if (state->render_states[WINED3D_RS_COLORKEYENABLE] && !sampler)
|
2010-09-14 13:38:39 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
/* If color keying is enabled update the alpha test, it
|
|
|
|
* depends on the existence of a color key in stage 0. */
|
2011-12-19 21:00:09 +01:00
|
|
|
state_alpha(context, state, WINED3D_RS_COLORKEYENABLE);
|
2007-12-27 09:23:59 +01:00
|
|
|
}
|
2006-12-19 23:26:39 +01:00
|
|
|
} /* Otherwise tex_colorop disables the stage */
|
2011-08-26 01:12:27 +02:00
|
|
|
context_bind_texture(context, GL_NONE, 0);
|
2006-12-19 23:26:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
void apply_pixelshader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-07-28 19:07:19 +02:00
|
|
|
unsigned int i;
|
2006-12-19 23:22:19 +01:00
|
|
|
|
2012-11-04 19:51:32 +01:00
|
|
|
if (use_ps(state))
|
2011-07-14 01:02:48 +02:00
|
|
|
{
|
|
|
|
if (!context->last_was_pshader)
|
|
|
|
{
|
|
|
|
/* Former draw without a pixel shader, some samplers may be
|
2012-01-09 22:16:51 +01:00
|
|
|
* disabled because of WINED3D_TSS_COLOR_OP = WINED3DTOP_DISABLE
|
2011-07-14 01:02:48 +02:00
|
|
|
* make sure to enable them. */
|
|
|
|
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
|
|
|
|
{
|
|
|
|
if (!isStateDirty(context, STATE_SAMPLER(i)))
|
|
|
|
sampler(context, state, STATE_SAMPLER(i));
|
2006-12-19 23:22:19 +01:00
|
|
|
}
|
2009-01-19 12:29:49 +01:00
|
|
|
context->last_was_pshader = TRUE;
|
2006-12-19 23:22:19 +01:00
|
|
|
}
|
2011-07-14 01:02:48 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Otherwise all samplers were activated by the code above in
|
|
|
|
* earlier draws, or by sampler() if a different texture was
|
|
|
|
* bound. I don't have to do anything. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Disabled the pixel shader - color ops weren't applied while it was
|
|
|
|
* enabled, so re-apply them. */
|
2013-04-25 15:20:30 +02:00
|
|
|
for (i = 0; i < context->d3d_info->limits.ffp_blend_stages; ++i)
|
2010-01-27 20:19:42 +01:00
|
|
|
{
|
2012-01-09 22:16:51 +01:00
|
|
|
if (!isStateDirty(context, STATE_TEXTURESTAGE(i, WINED3D_TSS_COLOR_OP)))
|
|
|
|
context_apply_state(context, state, STATE_TEXTURESTAGE(i, WINED3D_TSS_COLOR_OP));
|
2006-12-19 23:22:19 +01:00
|
|
|
}
|
2009-01-19 12:29:49 +01:00
|
|
|
context->last_was_pshader = FALSE;
|
2007-02-13 19:53:20 +01:00
|
|
|
}
|
2006-12-19 23:22:19 +01:00
|
|
|
|
2013-08-21 08:29:27 +02:00
|
|
|
context->shader_update_mask |= 1 << WINED3D_SHADER_TYPE_PIXEL;
|
2006-12-19 23:22:19 +01:00
|
|
|
}
|
|
|
|
|
2012-11-16 00:29:52 +01:00
|
|
|
static void state_geometry_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2012-11-13 21:24:22 +01:00
|
|
|
{
|
2013-08-21 08:29:27 +02:00
|
|
|
context->shader_update_mask |= 1 << WINED3D_SHADER_TYPE_GEOMETRY;
|
2012-11-13 21:24:22 +01:00
|
|
|
}
|
|
|
|
|
2013-08-16 09:12:30 +02:00
|
|
|
static void shader_bumpenv(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2013-08-16 09:12:30 +02:00
|
|
|
context->constant_update_mask |= WINED3D_SHADER_CONST_PS_BUMP_ENV;
|
2008-07-04 23:54:06 +02:00
|
|
|
}
|
2007-05-04 14:28:09 +02:00
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void transform_world(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2007-01-02 22:52:11 +01:00
|
|
|
/* This function is called by transform_view below if the view matrix was changed too
|
|
|
|
*
|
|
|
|
* Deliberately no check if the vertex declaration is dirty because the vdecl state
|
|
|
|
* does not always update the world matrix, only on a switch between transformed
|
2008-01-09 20:37:05 +01:00
|
|
|
* and untransformed draws. It *may* happen that the world matrix is set 2 times during one
|
2007-01-02 22:52:11 +01:00
|
|
|
* draw, but that should be rather rare and cheaper in total.
|
2007-01-02 22:47:39 +01:00
|
|
|
*/
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
2007-01-02 22:47:39 +01:00
|
|
|
checkGLcall("glMatrixMode");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
if (context->last_was_rhw)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glLoadIdentity();
|
2007-01-02 22:52:11 +01:00
|
|
|
checkGLcall("glLoadIdentity()");
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-24 11:29:57 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
|
|
|
|
checkGLcall("glLoadMatrixf");
|
|
|
|
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(0)].u.m[0][0]);
|
|
|
|
checkGLcall("glMultMatrixf");
|
2007-01-02 22:47:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void clipplane(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2010-09-28 12:00:23 +02:00
|
|
|
UINT index = state_id - STATE_CLIPPLANE(0);
|
2012-05-22 18:01:06 +02:00
|
|
|
GLdouble plane[4];
|
2007-02-28 14:36:36 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
if (isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_VIEW)) || index >= gl_info->limits.clipplanes)
|
2007-02-28 14:36:36 +01:00
|
|
|
return;
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
|
|
|
gl_info->gl_ops.gl.p_glPushMatrix();
|
2011-02-01 02:42:22 +01:00
|
|
|
|
2007-02-28 14:36:36 +01:00
|
|
|
/* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */
|
2010-09-28 12:00:23 +02:00
|
|
|
if (!use_vs(state))
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
|
2010-09-16 11:19:56 +02:00
|
|
|
else
|
2012-07-24 11:32:27 +02:00
|
|
|
/* With vertex shaders, clip planes are not transformed in Direct3D,
|
|
|
|
* while in OpenGL they are still transformed by the model view matix. */
|
|
|
|
gl_info->gl_ops.gl.p_glLoadIdentity();
|
2007-02-28 14:36:36 +01:00
|
|
|
|
2012-05-22 18:01:06 +02:00
|
|
|
plane[0] = state->clip_planes[index].x;
|
|
|
|
plane[1] = state->clip_planes[index].y;
|
|
|
|
plane[2] = state->clip_planes[index].z;
|
|
|
|
plane[3] = state->clip_planes[index].w;
|
|
|
|
|
2010-09-28 12:00:23 +02:00
|
|
|
TRACE("Clipplane [%.8e, %.8e, %.8e, %.8e]\n",
|
2012-05-22 18:01:06 +02:00
|
|
|
plane[0], plane[1], plane[2], plane[3]);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glClipPlane(GL_CLIP_PLANE0 + index, plane);
|
2007-02-28 14:36:36 +01:00
|
|
|
checkGLcall("glClipPlane");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPopMatrix();
|
2007-02-28 14:36:36 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void transform_worldex(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-01-11 21:27:32 +01:00
|
|
|
UINT matrix = state_id - STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0));
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2007-04-27 00:43:15 +02:00
|
|
|
GLenum glMat;
|
2012-07-24 11:32:27 +02:00
|
|
|
|
2007-04-27 00:43:15 +02:00
|
|
|
TRACE("Setting world matrix %d\n", matrix);
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
if (matrix >= gl_info->limits.blends)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2007-04-27 00:43:15 +02:00
|
|
|
WARN("Unsupported blend matrix set\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-01-11 21:27:32 +01:00
|
|
|
if (isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_VIEW)))
|
|
|
|
return;
|
|
|
|
|
2007-04-27 00:43:15 +02:00
|
|
|
/* GL_MODELVIEW0_ARB: 0x1700
|
2008-10-20 17:56:58 +02:00
|
|
|
* GL_MODELVIEW1_ARB: 0x850a
|
2007-04-27 00:43:15 +02:00
|
|
|
* GL_MODELVIEW2_ARB: 0x8722
|
|
|
|
* GL_MODELVIEW3_ARB: 0x8723
|
|
|
|
* etc
|
2012-07-20 00:24:27 +02:00
|
|
|
* GL_MODELVIEW31_ARB: 0x873f
|
2007-04-27 00:43:15 +02:00
|
|
|
*/
|
|
|
|
if(matrix == 1) glMat = GL_MODELVIEW1_ARB;
|
|
|
|
else glMat = GL_MODELVIEW2_ARB - 2 + matrix;
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(glMat);
|
2007-04-27 00:43:15 +02:00
|
|
|
checkGLcall("glMatrixMode(glMat)");
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
/* World matrix 0 is multiplied with the view matrix because d3d uses 3
|
|
|
|
* matrices while gl uses only 2. To avoid weighting the view matrix
|
|
|
|
* incorrectly it has to be multiplied into every GL modelview matrix. */
|
2013-04-24 11:29:57 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
|
|
|
|
checkGLcall("glLoadMatrixf");
|
|
|
|
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(matrix)].u.m[0][0]);
|
|
|
|
checkGLcall("glMultMatrixf");
|
2007-04-27 00:43:15 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_vertexblend_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-20 21:42:13 +01:00
|
|
|
enum wined3d_vertex_blend_flags f = state->render_states[WINED3D_RS_VERTEXBLEND];
|
2010-03-31 11:29:00 +02:00
|
|
|
static unsigned int once;
|
2008-07-05 23:21:26 +02:00
|
|
|
|
2011-12-20 21:42:13 +01:00
|
|
|
if (f == WINED3D_VBF_DISABLE)
|
|
|
|
return;
|
2008-07-05 23:21:26 +02:00
|
|
|
|
2010-03-31 11:29:00 +02:00
|
|
|
if (!once++) FIXME("Vertex blend flags %#x not supported.\n", f);
|
|
|
|
else WARN("Vertex blend flags %#x not supported.\n", f);
|
2008-07-05 23:21:26 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void state_vertexblend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-12-20 21:42:13 +01:00
|
|
|
enum wined3d_vertex_blend_flags val = state->render_states[WINED3D_RS_VERTEXBLEND];
|
2011-07-14 01:02:48 +02:00
|
|
|
struct wined3d_device *device = context->swapchain->device;
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2010-03-31 11:29:00 +02:00
|
|
|
static unsigned int once;
|
2007-04-27 00:43:15 +02:00
|
|
|
|
2011-12-20 21:42:13 +01:00
|
|
|
switch (val)
|
|
|
|
{
|
|
|
|
case WINED3D_VBF_1WEIGHTS:
|
|
|
|
case WINED3D_VBF_2WEIGHTS:
|
|
|
|
case WINED3D_VBF_3WEIGHTS:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_VERTEX_BLEND_ARB);
|
2008-07-05 23:21:26 +02:00
|
|
|
checkGLcall("glEnable(GL_VERTEX_BLEND_ARB)");
|
2007-04-27 00:43:15 +02:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
/* D3D adds one more matrix which has weight (1 - sum(weights)).
|
|
|
|
* This is enabled at context creation with enabling
|
|
|
|
* GL_WEIGHT_SUM_UNITY_ARB. */
|
2011-12-19 21:00:09 +01:00
|
|
|
GL_EXTCALL(glVertexBlendARB(state->render_states[WINED3D_RS_VERTEXBLEND] + 1));
|
2008-07-05 23:21:26 +02:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
if (!device->vertexBlendUsed)
|
2009-12-09 20:32:08 +01:00
|
|
|
{
|
2009-03-25 10:12:27 +01:00
|
|
|
unsigned int i;
|
2010-05-25 12:02:03 +02:00
|
|
|
for (i = 1; i < gl_info->limits.blends; ++i)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2012-01-11 21:27:32 +01:00
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(i))))
|
|
|
|
transform_worldex(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(i)));
|
2007-10-07 10:57:46 +02:00
|
|
|
}
|
2011-07-14 01:02:48 +02:00
|
|
|
device->vertexBlendUsed = TRUE;
|
2007-04-27 00:43:15 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-12-20 21:42:13 +01:00
|
|
|
case WINED3D_VBF_TWEENING:
|
|
|
|
case WINED3D_VBF_0WEIGHTS: /* Indexed vertex blending, not supported. */
|
2010-03-31 11:29:00 +02:00
|
|
|
if (!once++) FIXME("Vertex blend flags %#x not supported.\n", val);
|
|
|
|
else WARN("Vertex blend flags %#x not supported.\n", val);
|
|
|
|
/* Fall through. */
|
2011-12-20 21:42:13 +01:00
|
|
|
case WINED3D_VBF_DISABLE:
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_VERTEX_BLEND_ARB);
|
2008-07-05 23:21:26 +02:00
|
|
|
checkGLcall("glDisable(GL_VERTEX_BLEND_ARB)");
|
2007-04-27 00:43:15 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void transform_view(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2009-10-14 10:55:16 +02:00
|
|
|
const struct wined3d_light_info *light = NULL;
|
2007-01-02 00:48:58 +01:00
|
|
|
unsigned int k;
|
|
|
|
|
|
|
|
/* If we are changing the View matrix, reset the light and clipping planes to the new view
|
|
|
|
* NOTE: We have to reset the positions even if the light/plane is not currently
|
|
|
|
* enabled, since the call to enable it will not reset the position.
|
|
|
|
* NOTE2: Apparently texture transforms do NOT need reapplying
|
|
|
|
*/
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
2007-01-02 00:48:58 +01:00
|
|
|
checkGLcall("glMatrixMode(GL_MODELVIEW)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
|
2007-01-02 00:48:58 +01:00
|
|
|
checkGLcall("glLoadMatrixf(...)");
|
|
|
|
|
|
|
|
/* Reset lights. TODO: Call light apply func */
|
2011-05-18 09:12:40 +02:00
|
|
|
for (k = 0; k < gl_info->limits.lights; ++k)
|
2009-12-09 20:32:08 +01:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
if (!(light = state->lights[k]))
|
|
|
|
continue;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightPosn);
|
2007-01-02 00:48:58 +01:00
|
|
|
checkGLcall("glLightfv posn");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + light->glIndex, GL_SPOT_DIRECTION, light->lightDirn);
|
2007-01-02 00:48:58 +01:00
|
|
|
checkGLcall("glLightfv dirn");
|
|
|
|
}
|
|
|
|
|
2007-02-28 14:36:36 +01:00
|
|
|
/* Reset Clipping Planes */
|
2010-01-04 21:33:10 +01:00
|
|
|
for (k = 0; k < gl_info->limits.clipplanes; ++k)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
if (!isStateDirty(context, STATE_CLIPPLANE(k)))
|
|
|
|
clipplane(context, state, STATE_CLIPPLANE(k));
|
2007-01-02 00:48:58 +01:00
|
|
|
}
|
2007-01-02 22:47:10 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
if (context->last_was_rhw)
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glLoadIdentity();
|
2007-01-02 22:47:39 +01:00
|
|
|
checkGLcall("glLoadIdentity()");
|
|
|
|
/* No need to update the world matrix, the identity is fine */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call the world matrix state, this will apply the combined WORLD + VIEW matrix
|
2011-07-14 01:02:48 +02:00
|
|
|
* No need to do it here if the state is scheduled for update. */
|
2012-01-11 21:27:32 +01:00
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0))))
|
|
|
|
transform_world(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
|
2007-01-02 00:48:58 +01:00
|
|
|
|
2007-04-27 00:43:15 +02:00
|
|
|
/* Avoid looping over a number of matrices if the app never used the functionality */
|
2011-07-14 01:02:48 +02:00
|
|
|
if (context->swapchain->device->vertexBlendUsed)
|
2009-10-29 10:37:10 +01:00
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
for (k = 1; k < gl_info->limits.blends; ++k)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2012-01-11 21:27:32 +01:00
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(k))))
|
|
|
|
transform_worldex(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(k)));
|
2007-04-27 00:43:15 +02:00
|
|
|
}
|
|
|
|
}
|
2007-01-02 00:25:51 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void transform_projection(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION);
|
2007-01-02 22:50:38 +01:00
|
|
|
checkGLcall("glMatrixMode(GL_PROJECTION)");
|
2011-11-01 20:15:19 +01:00
|
|
|
|
|
|
|
/* There are a couple of additional things we have to take into account
|
|
|
|
* here besides the projection transformation itself:
|
|
|
|
* - We need to flip along the y-axis in case of offscreen rendering.
|
|
|
|
* - OpenGL Z range is {-Wc,...,Wc} while D3D Z range is {0,...,Wc}.
|
|
|
|
* - D3D coordinates refer to pixel centers while GL coordinates refer
|
|
|
|
* to pixel corners.
|
|
|
|
* - D3D has a top-left filling convention. We need to maintain this
|
|
|
|
* even after the y-flip mentioned above.
|
|
|
|
* In order to handle the last two points, we translate by
|
|
|
|
* (63.0 / 128.0) / VPw and (63.0 / 128.0) / VPh. This is equivalent to
|
|
|
|
* translating slightly less than half a pixel. We want the difference to
|
|
|
|
* be large enough that it doesn't get lost due to rounding inside the
|
|
|
|
* driver, but small enough to prevent it from interfering with any
|
|
|
|
* anti-aliasing. */
|
2007-01-02 22:50:38 +01:00
|
|
|
|
2010-01-26 18:31:38 +01:00
|
|
|
if (context->last_was_rhw)
|
|
|
|
{
|
2011-11-01 20:15:19 +01:00
|
|
|
/* Transform D3D RHW coordinates to OpenGL clip coordinates. */
|
2011-11-21 18:48:40 +01:00
|
|
|
double x = state->viewport.x;
|
|
|
|
double y = state->viewport.y;
|
|
|
|
double w = state->viewport.width;
|
|
|
|
double h = state->viewport.height;
|
2011-11-01 20:15:19 +01:00
|
|
|
double x_scale = 2.0 / w;
|
|
|
|
double x_offset = ((63.0 / 64.0) - (2.0 * x) - w) / w;
|
|
|
|
double y_scale = context->render_offscreen ? 2.0 / h : 2.0 / -h;
|
|
|
|
double y_offset = context->render_offscreen
|
|
|
|
? ((63.0 / 64.0) - (2.0 * y) - h) / h
|
|
|
|
: ((63.0 / 64.0) - (2.0 * y) - h) / -h;
|
|
|
|
const GLdouble projection[] =
|
2009-08-06 08:12:19 +02:00
|
|
|
{
|
2011-11-01 20:15:19 +01:00
|
|
|
x_scale, 0.0, 0.0, 0.0,
|
|
|
|
0.0, y_scale, 0.0, 0.0,
|
|
|
|
0.0, 0.0, 2.0, 0.0,
|
|
|
|
x_offset, y_offset, -1.0, 1.0,
|
|
|
|
};
|
2010-09-05 23:38:49 +02:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLoadMatrixd(projection);
|
2011-11-01 20:15:19 +01:00
|
|
|
checkGLcall("glLoadMatrixd");
|
2010-09-05 23:38:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-11-01 20:15:20 +01:00
|
|
|
double y_scale = context->render_offscreen ? -1.0 : 1.0;
|
2011-11-21 18:48:40 +01:00
|
|
|
double x_offset = (63.0 / 64.0) / state->viewport.width;
|
2011-11-01 20:15:20 +01:00
|
|
|
double y_offset = context->render_offscreen
|
2011-11-21 18:48:40 +01:00
|
|
|
? (63.0 / 64.0) / state->viewport.height
|
|
|
|
: -(63.0 / 64.0) / state->viewport.height;
|
2011-11-01 20:15:20 +01:00
|
|
|
const GLdouble projection[] =
|
2009-08-06 08:12:19 +02:00
|
|
|
{
|
2011-11-01 20:15:20 +01:00
|
|
|
1.0, 0.0, 0.0, 0.0,
|
|
|
|
0.0, y_scale, 0.0, 0.0,
|
|
|
|
0.0, 0.0, 2.0, 0.0,
|
|
|
|
x_offset, y_offset, -1.0, 1.0,
|
|
|
|
};
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLoadMatrixd(projection);
|
2011-11-01 20:15:20 +01:00
|
|
|
checkGLcall("glLoadMatrixd");
|
2007-12-26 22:12:05 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_PROJECTION].u.m[0][0]);
|
2007-01-02 22:50:38 +01:00
|
|
|
checkGLcall("glLoadMatrixf");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-12 21:17:48 +02:00
|
|
|
/* This should match any arrays loaded in load_vertex_data.
|
|
|
|
* TODO: Only load / unload arrays if we have to. */
|
|
|
|
static void unload_vertex_data(const struct wined3d_gl_info *gl_info)
|
2009-08-19 10:55:38 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisableClientState(GL_VERTEX_ARRAY);
|
|
|
|
gl_info->gl_ops.gl.p_glDisableClientState(GL_NORMAL_ARRAY);
|
|
|
|
gl_info->gl_ops.gl.p_glDisableClientState(GL_COLOR_ARRAY);
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_VERTEX_BLEND])
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisableClientState(GL_WEIGHT_ARRAY_ARB);
|
2011-07-12 21:17:47 +02:00
|
|
|
unload_tex_coords(gl_info);
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
|
2010-05-25 12:02:03 +02:00
|
|
|
static inline void unload_numbered_array(struct wined3d_context *context, int i)
|
2008-12-08 10:30:02 +01:00
|
|
|
{
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2008-12-08 10:30:02 +01:00
|
|
|
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
|
|
|
|
checkGLcall("glDisableVertexAttribArrayARB(reg)");
|
2012-12-02 18:53:20 +01:00
|
|
|
if (gl_info->supported[ARB_INSTANCED_ARRAYS])
|
|
|
|
GL_EXTCALL(glVertexAttribDivisorARB(i, 0));
|
2008-12-08 10:30:02 +01:00
|
|
|
|
|
|
|
context->numbered_array_mask &= ~(1 << i);
|
|
|
|
}
|
|
|
|
|
2007-01-06 18:11:21 +01:00
|
|
|
/* This should match any arrays loaded in loadNumberedArrays
|
2011-07-12 21:17:46 +02:00
|
|
|
* TODO: Only load / unload arrays if we have to. */
|
|
|
|
static void unload_numbered_arrays(struct wined3d_context *context)
|
2008-12-08 10:30:02 +01:00
|
|
|
{
|
2007-01-06 18:11:21 +01:00
|
|
|
/* disable any attribs (this is the same for both GLSL and ARB modes) */
|
|
|
|
int i;
|
|
|
|
|
2011-08-26 01:12:30 +02:00
|
|
|
for (i = 0; i < context->gl_info->limits.vertex_attribs; ++i) {
|
2010-05-25 12:02:03 +02:00
|
|
|
unload_numbered_array(context, i);
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-12 21:17:46 +02:00
|
|
|
static void load_numbered_arrays(struct wined3d_context *context,
|
|
|
|
const struct wined3d_stream_info *stream_info, const struct wined3d_state *state)
|
2008-12-01 15:32:14 +01:00
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
2007-01-06 18:11:21 +01:00
|
|
|
int i;
|
|
|
|
|
2007-02-14 17:56:29 +01:00
|
|
|
/* Default to no instancing */
|
2013-09-16 12:43:20 +02:00
|
|
|
context->instance_count = 0;
|
2007-02-14 17:56:29 +01:00
|
|
|
|
2010-09-14 13:38:41 +02:00
|
|
|
for (i = 0; i < MAX_ATTRIBS; i++)
|
|
|
|
{
|
|
|
|
const struct wined3d_stream_state *stream;
|
|
|
|
|
2009-03-27 10:25:55 +01:00
|
|
|
if (!(stream_info->use_map & (1 << i)))
|
2008-12-08 10:30:02 +01:00
|
|
|
{
|
2012-06-12 17:03:49 +02:00
|
|
|
if (context->numbered_array_mask & (1 << i))
|
|
|
|
unload_numbered_array(context, i);
|
2013-10-09 22:57:45 +02:00
|
|
|
if (state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.input_registers & (1 << i))
|
2012-06-12 17:03:49 +02:00
|
|
|
GL_EXTCALL(glVertexAttrib4fARB(i, 0.0f, 0.0f, 0.0f, 0.0f));
|
2007-01-06 18:11:21 +01:00
|
|
|
continue;
|
2008-12-08 10:30:02 +01:00
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
2011-07-12 21:17:46 +02:00
|
|
|
stream = &state->streams[stream_info->elements[i].stream_idx];
|
2010-09-14 13:38:41 +02:00
|
|
|
|
|
|
|
if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2013-09-16 12:43:20 +02:00
|
|
|
if (!context->instance_count)
|
|
|
|
context->instance_count = state->streams[0].frequency ? state->streams[0].frequency : 1;
|
2012-12-02 18:53:20 +01:00
|
|
|
|
|
|
|
if (!gl_info->supported[ARB_INSTANCED_ARRAYS])
|
|
|
|
{
|
|
|
|
/* Unload instanced arrays, they will be loaded using
|
|
|
|
* immediate mode instead. */
|
|
|
|
if (context->numbered_array_mask & (1 << i))
|
|
|
|
unload_numbered_array(context, i);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
GL_EXTCALL(glVertexAttribDivisorARB(i, 1));
|
|
|
|
}
|
|
|
|
else if (gl_info->supported[ARB_INSTANCED_ARRAYS])
|
|
|
|
{
|
|
|
|
GL_EXTCALL(glVertexAttribDivisorARB(i, 0));
|
2007-02-14 17:56:29 +01:00
|
|
|
}
|
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
TRACE_(d3d_shader)("Loading array %u [VBO=%u]\n", i, stream_info->elements[i].data.buffer_object);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
2009-03-27 10:25:55 +01:00
|
|
|
if (stream_info->elements[i].stride)
|
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
if (curVBO != stream_info->elements[i].data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, stream_info->elements[i].data.buffer_object));
|
2007-02-14 17:55:56 +01:00
|
|
|
checkGLcall("glBindBufferARB");
|
2011-07-11 01:06:46 +02:00
|
|
|
curVBO = stream_info->elements[i].data.buffer_object;
|
2007-02-14 17:55:56 +01:00
|
|
|
}
|
2010-09-14 13:38:41 +02:00
|
|
|
/* Use the VBO to find out if a vertex buffer exists, not the vb
|
|
|
|
* pointer. vb can point to a user pointer data blob. In that case
|
|
|
|
* curVBO will be 0. If there is a vertex buffer but no vbo we
|
|
|
|
* won't be load converted attributes anyway. */
|
2011-02-06 23:47:49 +01:00
|
|
|
GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format,
|
|
|
|
stream_info->elements[i].format->gl_vtx_type,
|
|
|
|
stream_info->elements[i].format->gl_normalized,
|
2011-07-11 01:06:46 +02:00
|
|
|
stream_info->elements[i].stride, stream_info->elements[i].data.addr
|
2011-07-15 01:14:50 +02:00
|
|
|
+ state->load_base_vertex_index * stream_info->elements[i].stride));
|
2008-12-08 10:30:02 +01:00
|
|
|
|
|
|
|
if (!(context->numbered_array_mask & (1 << i)))
|
|
|
|
{
|
|
|
|
GL_EXTCALL(glEnableVertexAttribArrayARB(i));
|
|
|
|
context->numbered_array_mask |= (1 << i);
|
|
|
|
}
|
2010-09-14 13:38:41 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Stride = 0 means always the same values.
|
|
|
|
* glVertexAttribPointerARB doesn't do that. Instead disable the
|
|
|
|
* pointer and set up the attribute statically. But we have to
|
|
|
|
* figure out the system memory address. */
|
2011-07-15 01:14:50 +02:00
|
|
|
const BYTE *ptr = stream_info->elements[i].data.addr;
|
2011-07-11 01:06:46 +02:00
|
|
|
if (stream_info->elements[i].data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2013-09-09 15:15:36 +02:00
|
|
|
ptr += (ULONG_PTR)buffer_get_sysmem(stream->buffer, context);
|
2007-02-14 17:55:56 +01:00
|
|
|
}
|
2008-12-08 10:30:02 +01:00
|
|
|
|
2010-05-25 12:02:03 +02:00
|
|
|
if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i);
|
2007-02-14 17:55:56 +01:00
|
|
|
|
2010-08-30 20:29:49 +02:00
|
|
|
switch (stream_info->elements[i].format->id)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R32_FLOAT:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib1fvARB(i, (const GLfloat *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R32G32_FLOAT:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib2fvARB(i, (const GLfloat *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R32G32B32_FLOAT:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib3fvARB(i, (const GLfloat *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R32G32B32A32_FLOAT:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4fvARB(i, (const GLfloat *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
|
|
|
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R8G8B8A8_UINT:
|
2007-02-14 17:55:56 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4NubvARB(i, ptr));
|
|
|
|
break;
|
2009-09-25 13:31:49 +02:00
|
|
|
case WINED3DFMT_B8G8R8A8_UNORM:
|
2010-01-25 19:51:31 +01:00
|
|
|
if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
|
2009-01-23 10:22:33 +01:00
|
|
|
{
|
|
|
|
const DWORD *src = (const DWORD *)ptr;
|
|
|
|
DWORD c = *src & 0xff00ff00;
|
|
|
|
c |= (*src & 0xff0000) >> 16;
|
|
|
|
c |= (*src & 0xff) << 16;
|
|
|
|
GL_EXTCALL(glVertexAttrib4NubvARB(i, (GLubyte *)&c));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* else fallthrough */
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R8G8B8A8_UNORM:
|
2007-02-14 17:55:56 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4NubvARB(i, ptr));
|
|
|
|
break;
|
|
|
|
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16_SINT:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4svARB(i, (const GLshort *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16B16A16_SINT:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4svARB(i, (const GLshort *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
|
|
|
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16_SNORM:
|
2007-02-14 17:55:56 +01:00
|
|
|
{
|
2008-12-01 15:32:14 +01:00
|
|
|
const GLshort s[4] = {((const GLshort *)ptr)[0], ((const GLshort *)ptr)[1], 0, 1};
|
2007-02-14 17:55:56 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4NsvARB(i, s));
|
|
|
|
break;
|
|
|
|
}
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16_UNORM:
|
2007-02-14 17:55:56 +01:00
|
|
|
{
|
2008-12-01 15:32:14 +01:00
|
|
|
const GLushort s[4] = {((const GLushort *)ptr)[0], ((const GLushort *)ptr)[1], 0, 1};
|
2007-02-14 17:55:56 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4NusvARB(i, s));
|
|
|
|
break;
|
|
|
|
}
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16B16A16_SNORM:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4NsvARB(i, (const GLshort *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16B16A16_UNORM:
|
2008-11-28 15:30:12 +01:00
|
|
|
GL_EXTCALL(glVertexAttrib4NusvARB(i, (const GLushort *)ptr));
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
|
|
|
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R10G10B10A2_UINT:
|
2007-02-14 17:55:56 +01:00
|
|
|
FIXME("Unsure about WINED3DDECLTYPE_UDEC3\n");
|
2008-11-28 15:30:12 +01:00
|
|
|
/*glVertexAttrib3usvARB(i, (const GLushort *)ptr); Does not exist */
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R10G10B10A2_SNORM:
|
2007-02-14 17:55:56 +01:00
|
|
|
FIXME("Unsure about WINED3DDECLTYPE_DEC3N\n");
|
2008-11-28 15:30:12 +01:00
|
|
|
/*glVertexAttrib3NusvARB(i, (const GLushort *)ptr); Does not exist */
|
2007-02-14 17:55:56 +01:00
|
|
|
break;
|
|
|
|
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16_FLOAT:
|
2007-02-14 17:55:56 +01:00
|
|
|
/* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4
|
|
|
|
* byte float according to the IEEE standard
|
|
|
|
*/
|
|
|
|
FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_2\n");
|
|
|
|
break;
|
2009-03-27 10:25:56 +01:00
|
|
|
case WINED3DFMT_R16G16B16A16_FLOAT:
|
2007-02-14 17:55:56 +01:00
|
|
|
FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_4\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ERR("Unexpected declaration in stride 0 attributes\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
2007-02-14 17:55:56 +01:00
|
|
|
}
|
2007-12-17 18:18:19 +01:00
|
|
|
checkGLcall("Loading numbered arrays");
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
|
2013-09-16 12:43:20 +02:00
|
|
|
static void load_vertex_data(struct wined3d_context *context,
|
2011-07-12 21:17:48 +02:00
|
|
|
const struct wined3d_stream_info *si, const struct wined3d_state *state)
|
2008-12-01 15:32:14 +01:00
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
2009-03-27 10:25:55 +01:00
|
|
|
const struct wined3d_stream_info_element *e;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
|
|
TRACE("Using fast vertex array code\n");
|
2007-02-14 17:56:29 +01:00
|
|
|
|
|
|
|
/* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */
|
2013-09-16 12:43:20 +02:00
|
|
|
context->instance_count = 0;
|
2007-02-14 17:56:29 +01:00
|
|
|
|
2007-01-06 18:11:21 +01:00
|
|
|
/* Blend Data ---------------------------------------------- */
|
2009-08-24 09:27:51 +02:00
|
|
|
if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT))
|
|
|
|
|| si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2009-08-24 09:27:51 +02:00
|
|
|
e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
|
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_VERTEX_BLEND])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2010-08-30 20:29:49 +02:00
|
|
|
TRACE("Blend %u %p %u\n", e->format->component_count,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride, e->stride);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnableClientState(GL_WEIGHT_ARRAY_ARB);
|
2007-04-27 00:43:15 +02:00
|
|
|
checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
|
2007-01-06 18:11:21 +01:00
|
|
|
|
2010-08-30 20:29:49 +02:00
|
|
|
GL_EXTCALL(glVertexBlendARB(e->format->component_count + 1));
|
2007-01-06 18:11:21 +01:00
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
if (curVBO != e->data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glBindBufferARB");
|
2011-07-11 01:06:46 +02:00
|
|
|
curVBO = e->data.buffer_object;
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
|
2010-03-17 21:59:52 +01:00
|
|
|
TRACE("glWeightPointerARB(%#x, %#x, %#x, %p);\n",
|
2010-08-30 20:29:49 +02:00
|
|
|
e->format->gl_vtx_format,
|
|
|
|
e->format->gl_vtx_type,
|
2010-03-17 21:59:52 +01:00
|
|
|
e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2010-08-30 20:29:49 +02:00
|
|
|
GL_EXTCALL(glWeightPointerARB(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride));
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
|
|
checkGLcall("glWeightPointerARB");
|
|
|
|
|
2009-08-24 09:27:51 +02:00
|
|
|
if (si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2008-12-01 15:32:14 +01:00
|
|
|
static BOOL warned;
|
|
|
|
if (!warned)
|
|
|
|
{
|
2007-01-06 18:11:21 +01:00
|
|
|
FIXME("blendMatrixIndices support\n");
|
2008-12-01 15:32:14 +01:00
|
|
|
warned = TRUE;
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2007-02-16 19:15:15 +01:00
|
|
|
/* TODO: support blends in drawStridedSlow
|
|
|
|
* No need to write a FIXME here, this is done after the general vertex decl decoding
|
|
|
|
*/
|
|
|
|
WARN("unsupported blending in openGl\n");
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
2009-10-29 10:37:11 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[ARB_VERTEX_BLEND])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2007-04-27 00:43:15 +02:00
|
|
|
static const GLbyte one = 1;
|
|
|
|
GL_EXTCALL(glWeightbvARB(1, &one));
|
2010-11-05 11:17:51 +01:00
|
|
|
checkGLcall("glWeightbvARB(gl_info->max_blends, weights)");
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Point Size ----------------------------------------------*/
|
2009-08-24 09:27:51 +02:00
|
|
|
if (si->use_map & (1 << WINED3D_FFP_PSIZE))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2007-01-06 18:11:21 +01:00
|
|
|
/* no such functionality in the fixed function GL pipeline */
|
|
|
|
TRACE("Cannot change ptSize here in openGl\n");
|
|
|
|
/* TODO: Implement this function in using shaders if they are available */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Vertex Pointers -----------------------------------------*/
|
2009-08-24 09:27:51 +02:00
|
|
|
if (si->use_map & (1 << WINED3D_FFP_POSITION))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2009-08-24 09:27:51 +02:00
|
|
|
e = &si->elements[WINED3D_FFP_POSITION];
|
2010-09-14 13:38:41 +02:00
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
if (curVBO != e->data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glBindBufferARB");
|
2011-07-11 01:06:46 +02:00
|
|
|
curVBO = e->data.buffer_object;
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
|
2012-03-07 18:38:51 +01:00
|
|
|
TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n",
|
|
|
|
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glVertexPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
2012-03-07 18:38:51 +01:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glVertexPointer(...)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnableClientState(GL_VERTEX_ARRAY);
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glEnableClientState(GL_VERTEX_ARRAY)");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Normals -------------------------------------------------*/
|
2009-08-24 09:27:51 +02:00
|
|
|
if (si->use_map & (1 << WINED3D_FFP_NORMAL))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2009-08-24 09:27:51 +02:00
|
|
|
e = &si->elements[WINED3D_FFP_NORMAL];
|
2010-09-14 13:38:41 +02:00
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
if (curVBO != e->data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glBindBufferARB");
|
2011-07-11 01:06:46 +02:00
|
|
|
curVBO = e->data.buffer_object;
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
2010-03-17 21:59:52 +01:00
|
|
|
|
2010-08-30 20:29:49 +02:00
|
|
|
TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format->gl_vtx_type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glNormalPointer(e->format->gl_vtx_type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glNormalPointer(...)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnableClientState(GL_NORMAL_ARRAY);
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glNormal3f(0, 0, 0);
|
2007-08-21 18:05:27 +02:00
|
|
|
checkGLcall("glNormal3f(0, 0, 0)");
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Diffuse Colour --------------------------------------------*/
|
2009-08-24 09:27:51 +02:00
|
|
|
if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2009-08-24 09:27:51 +02:00
|
|
|
e = &si->elements[WINED3D_FFP_DIFFUSE];
|
2010-09-14 13:38:41 +02:00
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
if (curVBO != e->data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glBindBufferARB");
|
2011-07-11 01:06:46 +02:00
|
|
|
curVBO = e->data.buffer_object;
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
2007-12-19 17:10:02 +01:00
|
|
|
|
2010-03-17 21:59:52 +01:00
|
|
|
TRACE("glColorPointer(%#x, %#x %#x, %p);\n",
|
2010-08-30 20:29:49 +02:00
|
|
|
e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glColorPointer(e->format->gl_vtx_format, e->format->gl_vtx_type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnableClientState(GL_COLOR_ARRAY);
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glEnableClientState(GL_COLOR_ARRAY)");
|
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glColor4f(1, 1, 1, 1)");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Specular Colour ------------------------------------------*/
|
2009-08-24 09:27:51 +02:00
|
|
|
if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2007-01-06 18:11:21 +01:00
|
|
|
TRACE("setting specular colour\n");
|
2009-03-27 10:25:55 +01:00
|
|
|
|
2009-08-24 09:27:51 +02:00
|
|
|
e = &si->elements[WINED3D_FFP_SPECULAR];
|
2010-09-14 13:38:41 +02:00
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2010-08-30 20:29:49 +02:00
|
|
|
GLenum type = e->format->gl_vtx_type;
|
|
|
|
GLint format = e->format->gl_vtx_format;
|
2009-07-10 11:28:49 +02:00
|
|
|
|
2011-07-11 01:06:46 +02:00
|
|
|
if (curVBO != e->data.buffer_object)
|
2009-03-27 10:25:55 +01:00
|
|
|
{
|
2011-07-11 01:06:46 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->data.buffer_object));
|
2007-01-06 18:11:21 +01:00
|
|
|
checkGLcall("glBindBufferARB");
|
2011-07-11 01:06:46 +02:00
|
|
|
curVBO = e->data.buffer_object;
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
2009-07-10 11:28:49 +02:00
|
|
|
|
2010-01-04 21:33:10 +01:00
|
|
|
if (format != 4 || (gl_info->quirks & WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA))
|
2009-07-10 11:28:49 +02:00
|
|
|
{
|
|
|
|
/* Usually specular colors only allow 3 components, since they have no alpha. In D3D, the specular alpha
|
|
|
|
* contains the fog coordinate, which is passed to GL with GL_EXT_fog_coord. However, the fixed function
|
|
|
|
* vertex pipeline can pass the specular alpha through, and pixel shaders can read it. So it GL accepts
|
|
|
|
* 4 component secondary colors use it
|
|
|
|
*/
|
2010-03-17 21:59:52 +01:00
|
|
|
TRACE("glSecondaryColorPointer(%#x, %#x, %#x, %p);\n", format, type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2010-03-17 21:59:52 +01:00
|
|
|
GL_EXTCALL(glSecondaryColorPointerEXT(format, type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride));
|
2009-07-10 11:28:49 +02:00
|
|
|
checkGLcall("glSecondaryColorPointerEXT(format, type, ...)");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case GL_UNSIGNED_BYTE:
|
2010-03-17 21:59:52 +01:00
|
|
|
TRACE("glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, %#x, %p);\n", e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2010-03-17 21:59:52 +01:00
|
|
|
GL_EXTCALL(glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride));
|
2009-07-10 11:28:49 +02:00
|
|
|
checkGLcall("glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, ...)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FIXME("Add 4 component specular color pointers for type %x\n", type);
|
|
|
|
/* Make sure that the right color component is dropped */
|
2010-03-17 21:59:52 +01:00
|
|
|
TRACE("glSecondaryColorPointer(3, %#x, %#x, %p);\n", type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride);
|
2010-03-17 21:59:52 +01:00
|
|
|
GL_EXTCALL(glSecondaryColorPointerEXT(3, type, e->stride,
|
2011-07-15 01:14:50 +02:00
|
|
|
e->data.addr + state->load_base_vertex_index * e->stride));
|
2009-07-10 11:28:49 +02:00
|
|
|
checkGLcall("glSecondaryColorPointerEXT(3, type, ...)");
|
|
|
|
}
|
|
|
|
}
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
2008-12-03 14:53:44 +01:00
|
|
|
checkGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
|
2010-03-17 21:59:52 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("Specular colour is not supported in this GL implementation.\n");
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
2009-10-29 10:37:11 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-04 21:33:10 +01:00
|
|
|
if (gl_info->supported[EXT_SECONDARY_COLOR])
|
2009-10-29 10:37:11 +01:00
|
|
|
{
|
2007-01-06 18:11:21 +01:00
|
|
|
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
|
|
|
|
checkGLcall("glSecondaryColor3fEXT(0, 0, 0)");
|
2010-03-17 21:59:52 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("Specular colour is not supported in this GL implementation.\n");
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Texture coords -------------------------------------------*/
|
2011-07-12 21:17:48 +02:00
|
|
|
load_tex_coords(context, si, &curVBO, state);
|
2007-01-06 18:11:21 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void streamsrc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2013-09-12 12:23:29 +02:00
|
|
|
BOOL load_numbered = use_vs(state) && !context->use_immediate_mode_draw;
|
|
|
|
BOOL load_named = !use_vs(state) && !context->use_immediate_mode_draw;
|
2007-01-06 18:13:21 +01:00
|
|
|
|
2011-06-27 17:52:39 +02:00
|
|
|
if (isStateDirty(context, STATE_VDECL)) return;
|
2008-12-08 10:30:02 +01:00
|
|
|
if (context->numberedArraysLoaded && !load_numbered)
|
|
|
|
{
|
2011-07-12 21:17:46 +02:00
|
|
|
unload_numbered_arrays(context);
|
2008-12-08 10:30:02 +01:00
|
|
|
context->numberedArraysLoaded = FALSE;
|
|
|
|
context->numbered_array_mask = 0;
|
|
|
|
}
|
|
|
|
else if (context->namedArraysLoaded)
|
|
|
|
{
|
2011-07-12 21:17:48 +02:00
|
|
|
unload_vertex_data(context->gl_info);
|
2008-12-08 10:30:02 +01:00
|
|
|
context->namedArraysLoaded = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (load_numbered)
|
|
|
|
{
|
|
|
|
TRACE("Loading numbered arrays\n");
|
2013-09-12 12:23:29 +02:00
|
|
|
load_numbered_arrays(context, &context->stream_info, state);
|
2008-12-08 10:30:02 +01:00
|
|
|
context->numberedArraysLoaded = TRUE;
|
|
|
|
}
|
|
|
|
else if (load_named)
|
|
|
|
{
|
|
|
|
TRACE("Loading vertex data\n");
|
2013-09-12 12:23:29 +02:00
|
|
|
load_vertex_data(context, &context->stream_info, state);
|
2008-12-08 10:30:02 +01:00
|
|
|
context->namedArraysLoaded = TRUE;
|
|
|
|
}
|
2007-01-04 00:13:15 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void vdecl_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2011-06-27 17:52:39 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
if (isStateDirty(context, STATE_STREAMSRC))
|
|
|
|
return;
|
|
|
|
streamsrc(context, state, STATE_STREAMSRC);
|
2011-06-27 17:52:39 +02:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void vertexdeclaration(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2009-10-22 10:09:54 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2010-09-28 12:00:24 +02:00
|
|
|
BOOL useVertexShaderFunction = use_vs(state);
|
2008-12-15 16:35:15 +01:00
|
|
|
BOOL updateFog = FALSE;
|
2007-01-04 00:13:15 +01:00
|
|
|
BOOL transformed;
|
2007-02-12 19:18:27 +01:00
|
|
|
BOOL wasrhw = context->last_was_rhw;
|
2009-05-29 01:09:22 +02:00
|
|
|
unsigned int i;
|
2007-01-04 00:13:15 +01:00
|
|
|
|
2013-09-12 12:23:29 +02:00
|
|
|
transformed = context->stream_info.position_transformed;
|
2011-05-16 23:01:23 +02:00
|
|
|
if (transformed != context->last_was_rhw && !useVertexShaderFunction)
|
2007-01-02 22:47:10 +01:00
|
|
|
updateFog = TRUE;
|
|
|
|
|
2011-07-14 01:02:45 +02:00
|
|
|
context->last_was_rhw = transformed;
|
2007-01-02 22:47:10 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
/* Don't have to apply the matrices when vertex shaders are used. When
|
|
|
|
* vshaders are turned off this function will be called again anyway to
|
|
|
|
* make sure they're properly set. */
|
|
|
|
if (!useVertexShaderFunction)
|
|
|
|
{
|
|
|
|
/* TODO: Move this mainly to the viewport state and only apply when
|
|
|
|
* the vp has changed or transformed / untransformed was switched. */
|
|
|
|
if (wasrhw != context->last_was_rhw
|
2012-01-11 21:27:32 +01:00
|
|
|
&& !isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_PROJECTION))
|
2011-07-14 01:02:48 +02:00
|
|
|
&& !isStateDirty(context, STATE_VIEWPORT))
|
2012-01-11 21:27:32 +01:00
|
|
|
transform_projection(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION));
|
2007-01-02 22:52:11 +01:00
|
|
|
/* World matrix needs reapplication here only if we're switching between rhw and non-rhw
|
|
|
|
* mode.
|
|
|
|
*
|
|
|
|
* If a vertex shader is used, the world matrix changed and then vertex shader unbound
|
|
|
|
* this check will fail and the matrix not applied again. This is OK because a simple
|
|
|
|
* world matrix change reapplies the matrix - These checks here are only to satisfy the
|
|
|
|
* needs of the vertex declaration.
|
|
|
|
*
|
|
|
|
* World and view matrix go into the same gl matrix, so only apply them when neither is
|
|
|
|
* dirty
|
|
|
|
*/
|
2012-01-11 21:27:32 +01:00
|
|
|
if (transformed != wasrhw && !isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)))
|
|
|
|
&& !isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_VIEW)))
|
|
|
|
transform_world(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_COLORVERTEX)))
|
2013-06-14 09:07:11 +02:00
|
|
|
context_apply_state(context, state, STATE_RENDER(WINED3D_RS_COLORVERTEX));
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_LIGHTING)))
|
|
|
|
state_lighting(context, state, STATE_RENDER(WINED3D_RS_LIGHTING));
|
2011-07-14 01:02:48 +02:00
|
|
|
|
|
|
|
if (context->last_was_vshader)
|
|
|
|
{
|
|
|
|
updateFog = TRUE;
|
2007-01-10 11:26:12 +01:00
|
|
|
|
2013-04-25 15:20:24 +02:00
|
|
|
if (!context->d3d_info->vs_clipping
|
|
|
|
&& !isStateDirty(context, STATE_RENDER(WINED3D_RS_CLIPPLANEENABLE)))
|
|
|
|
{
|
2011-12-19 21:00:09 +01:00
|
|
|
state_clipping(context, state, STATE_RENDER(WINED3D_RS_CLIPPLANEENABLE));
|
2013-04-25 15:20:24 +02:00
|
|
|
}
|
2007-02-27 23:11:15 +01:00
|
|
|
|
2009-10-29 10:37:10 +01:00
|
|
|
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
clipplane(context, state, STATE_CLIPPLANE(i));
|
2009-05-29 01:09:22 +02:00
|
|
|
}
|
2007-02-27 23:11:15 +01:00
|
|
|
}
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_NORMALIZENORMALS)))
|
|
|
|
state_normalize(context, state, STATE_RENDER(WINED3D_RS_NORMALIZENORMALS));
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-02-27 23:11:15 +01:00
|
|
|
if(!context->last_was_vshader) {
|
|
|
|
static BOOL warned = FALSE;
|
2013-04-25 15:20:24 +02:00
|
|
|
if (!context->d3d_info->vs_clipping)
|
|
|
|
{
|
2009-05-08 17:24:01 +02:00
|
|
|
/* Disable all clip planes to get defined results on all drivers. See comment in the
|
|
|
|
* state_clipping state handler
|
|
|
|
*/
|
2009-10-29 10:37:10 +01:00
|
|
|
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_CLIP_PLANE0 + i);
|
2009-05-08 17:24:01 +02:00
|
|
|
checkGLcall("glDisable(GL_CLIP_PLANE0 + i)");
|
|
|
|
}
|
2007-02-27 23:11:15 +01:00
|
|
|
|
2011-12-19 21:00:09 +01:00
|
|
|
if (!warned && state->render_states[WINED3D_RS_CLIPPLANEENABLE])
|
2010-09-15 12:00:04 +02:00
|
|
|
{
|
2009-05-08 17:24:01 +02:00
|
|
|
FIXME("Clipping not supported with vertex shaders\n");
|
|
|
|
warned = TRUE;
|
|
|
|
}
|
2007-02-27 23:11:15 +01:00
|
|
|
}
|
2011-07-14 01:02:48 +02:00
|
|
|
if (wasrhw)
|
|
|
|
{
|
|
|
|
/* Apply the transform matrices when switching from rhw
|
|
|
|
* drawing to vertex shaders. Vertex shaders themselves do
|
|
|
|
* not need it, but the matrices are not reapplied
|
|
|
|
* automatically when switching back from vertex shaders to
|
|
|
|
* fixed function processing. So make sure we leave the fixed
|
|
|
|
* function vertex processing states back in a sane state
|
|
|
|
* before switching to shaders. */
|
2012-01-11 21:27:32 +01:00
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_PROJECTION)))
|
|
|
|
transform_projection(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION));
|
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0))))
|
|
|
|
transform_world(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
|
2007-11-11 21:46:17 +01:00
|
|
|
}
|
wined3d: Get rid of last_was_foggy_shader & friends.
The fog settings do not depend on wether the shader writes to oFog or not,
instead they depend on the FOGVERTEXMODE and FOGTABLEMODE settings, and if a
vertex shader is bound at all.
It works the same way as with the fixed function, and having a vertex shader
is the same as using pretransformed vertices, just that the fog coord comes
from the shader instead of the specular color:
FOGTABLEMODE != NONE: The Z coord is used, oFog is ignored
FOGTABLEMODE == NONE, with VS: oFog is used
FOGTABLEMODE == NONE, no VS, XYZ: Z is used
FOGTABLEMODE == NONE, no VS, XYZRHW: diffuse color is used
2009-01-16 15:09:18 +01:00
|
|
|
updateFog = TRUE;
|
2009-05-29 01:09:22 +02:00
|
|
|
|
|
|
|
/* Vertex shader clipping ignores the view matrix. Update all clipplanes
|
|
|
|
* (Note: ARB shaders can read the clip planes for clipping emulation even if
|
|
|
|
* device->vs_clipping is false.
|
|
|
|
*/
|
2009-10-29 10:37:10 +01:00
|
|
|
for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
2009-10-22 10:09:54 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
clipplane(context, state, STATE_CLIPPLANE(i));
|
2009-05-29 01:09:22 +02:00
|
|
|
}
|
2007-02-27 23:11:15 +01:00
|
|
|
}
|
2007-01-06 18:17:27 +01:00
|
|
|
}
|
2007-01-06 18:14:12 +01:00
|
|
|
|
2007-02-13 19:53:11 +01:00
|
|
|
context->last_was_vshader = useVertexShaderFunction;
|
2013-08-21 08:29:27 +02:00
|
|
|
context->shader_update_mask |= 1 << WINED3D_SHADER_TYPE_VERTEX;
|
2007-02-13 19:53:11 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
if (updateFog)
|
2011-12-19 21:00:09 +01:00
|
|
|
context_apply_state(context, state, STATE_RENDER(WINED3D_RS_FOGVERTEXMODE));
|
2010-04-01 11:34:44 +02:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
if (!useVertexShaderFunction)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_TEXTURES; ++i)
|
|
|
|
{
|
2012-01-11 21:27:32 +01:00
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + i)))
|
2012-01-09 22:16:51 +01:00
|
|
|
transform_texture(context, state, STATE_TEXTURESTAGE(i, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS));
|
2007-08-19 12:50:14 +02:00
|
|
|
}
|
2013-08-21 08:29:27 +02:00
|
|
|
|
2013-10-09 22:57:45 +02:00
|
|
|
if (use_ps(state) && state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.shader_version.major == 1
|
|
|
|
&& state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.shader_version.minor <= 3)
|
2013-08-21 08:29:27 +02:00
|
|
|
context->shader_update_mask |= 1 << WINED3D_SHADER_TYPE_PIXEL;
|
2007-08-19 12:50:14 +02:00
|
|
|
}
|
2012-02-23 22:45:46 +01:00
|
|
|
|
|
|
|
if (transformed != wasrhw && !isStateDirty(context, STATE_RENDER(WINED3D_RS_ZENABLE)))
|
|
|
|
state_zenable(context, state, STATE_RENDER(WINED3D_RS_ZENABLE));
|
2007-01-02 00:35:07 +01:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
const struct wined3d_surface *target = state->fb->render_targets[0];
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2011-11-21 18:48:40 +01:00
|
|
|
struct wined3d_viewport vp = state->viewport;
|
2009-10-01 15:48:52 +02:00
|
|
|
|
2011-11-21 18:48:40 +01:00
|
|
|
if (vp.width > target->resource.width)
|
|
|
|
vp.width = target->resource.width;
|
|
|
|
if (vp.height > target->resource.height)
|
|
|
|
vp.height = target->resource.height;
|
2007-11-30 21:01:29 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDepthRange(vp.min_z, vp.max_z);
|
2007-01-04 00:05:05 +01:00
|
|
|
checkGLcall("glDepthRange");
|
2011-07-14 01:02:48 +02:00
|
|
|
/* Note: GL requires lower left, DirectX supplies upper left. This is
|
|
|
|
* reversed when using offscreen rendering. */
|
2009-08-06 08:12:19 +02:00
|
|
|
if (context->render_offscreen)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glViewport(vp.x, vp.y, vp.width, vp.height);
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UINT width, height;
|
2007-11-30 21:01:29 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
target->get_drawable_size(context, &width, &height);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glViewport(vp.x, (height - (vp.y + vp.height)),
|
2011-11-21 18:48:40 +01:00
|
|
|
vp.width, vp.height);
|
2007-03-06 14:56:58 +01:00
|
|
|
}
|
2007-01-04 00:05:05 +01:00
|
|
|
checkGLcall("glViewport");
|
2008-07-02 20:16:23 +02:00
|
|
|
}
|
2007-01-04 00:05:05 +01:00
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void viewport_vertexpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-01-11 21:27:32 +01:00
|
|
|
if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_PROJECTION)))
|
|
|
|
transform_projection(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION));
|
2013-08-19 10:50:50 +02:00
|
|
|
if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE))
|
|
|
|
&& state->render_states[WINED3D_RS_POINTSCALEENABLE])
|
2011-12-19 21:00:09 +01:00
|
|
|
state_pscale(context, state, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE));
|
2010-10-26 09:11:05 +02:00
|
|
|
/* Update the position fixup. */
|
2013-08-16 09:12:30 +02:00
|
|
|
context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POS_FIXUP;
|
2007-01-04 00:05:05 +01:00
|
|
|
}
|
|
|
|
|
2013-05-29 09:45:35 +02:00
|
|
|
void light(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2011-07-14 01:02:48 +02:00
|
|
|
UINT Index = state_id - STATE_ACTIVELIGHT(0);
|
|
|
|
const struct wined3d_light_info *lightInfo = state->lights[Index];
|
2007-02-14 17:48:52 +01:00
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
if (!lightInfo)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_LIGHT0 + Index);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glDisable(GL_LIGHT0 + Index)");
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-02-14 17:48:52 +01:00
|
|
|
float quad_att;
|
2009-07-07 11:08:01 +02:00
|
|
|
float colRGBA[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
2007-02-14 17:48:52 +01:00
|
|
|
|
|
|
|
/* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
|
|
|
|
gl_info->gl_ops.gl.p_glPushMatrix();
|
|
|
|
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
|
2007-02-14 17:48:52 +01:00
|
|
|
|
|
|
|
/* Diffuse: */
|
2011-11-20 20:27:12 +01:00
|
|
|
colRGBA[0] = lightInfo->OriginalParms.diffuse.r;
|
|
|
|
colRGBA[1] = lightInfo->OriginalParms.diffuse.g;
|
|
|
|
colRGBA[2] = lightInfo->OriginalParms.diffuse.b;
|
|
|
|
colRGBA[3] = lightInfo->OriginalParms.diffuse.a;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_DIFFUSE, colRGBA);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
|
|
|
/* Specular */
|
2011-11-20 20:27:12 +01:00
|
|
|
colRGBA[0] = lightInfo->OriginalParms.specular.r;
|
|
|
|
colRGBA[1] = lightInfo->OriginalParms.specular.g;
|
|
|
|
colRGBA[2] = lightInfo->OriginalParms.specular.b;
|
|
|
|
colRGBA[3] = lightInfo->OriginalParms.specular.a;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_SPECULAR, colRGBA);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
|
|
|
/* Ambient */
|
2011-11-20 20:27:12 +01:00
|
|
|
colRGBA[0] = lightInfo->OriginalParms.ambient.r;
|
|
|
|
colRGBA[1] = lightInfo->OriginalParms.ambient.g;
|
|
|
|
colRGBA[2] = lightInfo->OriginalParms.ambient.b;
|
|
|
|
colRGBA[3] = lightInfo->OriginalParms.ambient.a;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_AMBIENT, colRGBA);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
2011-11-20 20:27:12 +01:00
|
|
|
if ((lightInfo->OriginalParms.range * lightInfo->OriginalParms.range) >= FLT_MIN)
|
|
|
|
quad_att = 1.4f / (lightInfo->OriginalParms.range * lightInfo->OriginalParms.range);
|
|
|
|
else
|
2009-07-07 11:08:01 +02:00
|
|
|
quad_att = 0.0f; /* 0 or MAX? (0 seems to be ok) */
|
2007-02-14 17:48:52 +01:00
|
|
|
|
2007-02-20 22:43:13 +01:00
|
|
|
/* Do not assign attenuation values for lights that do not use them. D3D apps are free to pass any junk,
|
|
|
|
* but gl drivers use them and may crash due to bad Attenuation values. Need for Speed most wanted sets
|
|
|
|
* Attenuation0 to NaN and crashes in the gl lib
|
|
|
|
*/
|
2007-02-14 17:48:52 +01:00
|
|
|
|
2011-11-20 20:27:12 +01:00
|
|
|
switch (lightInfo->OriginalParms.type)
|
|
|
|
{
|
2011-12-11 21:43:31 +01:00
|
|
|
case WINED3D_LIGHT_POINT:
|
2007-02-14 17:48:52 +01:00
|
|
|
/* Position */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightfv");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightf");
|
2007-02-20 22:43:13 +01:00
|
|
|
/* Attenuation - Are these right? guessing... */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_CONSTANT_ATTENUATION,
|
|
|
|
lightInfo->OriginalParms.attenuation0);
|
2007-02-20 22:43:13 +01:00
|
|
|
checkGLcall("glLightf");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_LINEAR_ATTENUATION,
|
|
|
|
lightInfo->OriginalParms.attenuation1);
|
2007-02-20 22:43:13 +01:00
|
|
|
checkGLcall("glLightf");
|
2011-11-20 20:27:12 +01:00
|
|
|
if (quad_att < lightInfo->OriginalParms.attenuation2)
|
|
|
|
quad_att = lightInfo->OriginalParms.attenuation2;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_QUADRATIC_ATTENUATION, quad_att);
|
2007-02-20 22:43:13 +01:00
|
|
|
checkGLcall("glLightf");
|
2007-02-14 17:48:52 +01:00
|
|
|
/* FIXME: Range */
|
|
|
|
break;
|
|
|
|
|
2011-12-11 21:43:31 +01:00
|
|
|
case WINED3D_LIGHT_SPOT:
|
2007-02-14 17:48:52 +01:00
|
|
|
/* Position */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightfv");
|
|
|
|
/* Direction */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_SPOT_DIRECTION, &lightInfo->lightDirn[0]);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightfv");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_SPOT_EXPONENT, lightInfo->exponent);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightf");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightf");
|
2007-02-20 22:43:13 +01:00
|
|
|
/* Attenuation - Are these right? guessing... */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_CONSTANT_ATTENUATION,
|
|
|
|
lightInfo->OriginalParms.attenuation0);
|
2007-02-20 22:43:13 +01:00
|
|
|
checkGLcall("glLightf");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_LINEAR_ATTENUATION,
|
|
|
|
lightInfo->OriginalParms.attenuation1);
|
2007-02-20 22:43:13 +01:00
|
|
|
checkGLcall("glLightf");
|
2011-11-20 20:27:12 +01:00
|
|
|
if (quad_att < lightInfo->OriginalParms.attenuation2)
|
|
|
|
quad_att = lightInfo->OriginalParms.attenuation2;
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_QUADRATIC_ATTENUATION, quad_att);
|
2007-02-20 22:43:13 +01:00
|
|
|
checkGLcall("glLightf");
|
2007-02-14 17:48:52 +01:00
|
|
|
/* FIXME: Range */
|
|
|
|
break;
|
|
|
|
|
2011-12-11 21:43:31 +01:00
|
|
|
case WINED3D_LIGHT_DIRECTIONAL:
|
2007-02-14 17:48:52 +01:00
|
|
|
/* Direction */
|
2012-07-24 11:32:27 +02:00
|
|
|
/* Note GL uses w position of 0 for direction! */
|
|
|
|
gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightfv");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightf");
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glLightf(GL_LIGHT0 + Index, GL_SPOT_EXPONENT, 0.0f);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glLightf");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-11-20 20:27:12 +01:00
|
|
|
FIXME("Unrecognized light type %#x.\n", lightInfo->OriginalParms.type);
|
2007-02-14 17:48:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Restore the modelview matrix */
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glPopMatrix();
|
2007-02-14 17:48:52 +01:00
|
|
|
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_LIGHT0 + Index);
|
2007-02-14 17:48:52 +01:00
|
|
|
checkGLcall("glEnable(GL_LIGHT0 + Index)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void scissorrect(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
2011-07-14 01:02:48 +02:00
|
|
|
const RECT *r = &state->scissor_rect;
|
|
|
|
|
|
|
|
/* Warning: glScissor uses window coordinates, not viewport coordinates,
|
|
|
|
* so our viewport correction does not apply. Warning2: Even in windowed
|
|
|
|
* mode the coords are relative to the window, not the screen. */
|
|
|
|
TRACE("Setting new scissor rect to %s.\n", wine_dbgstr_rect(r));
|
2007-07-26 00:38:50 +02:00
|
|
|
|
2009-08-06 08:12:19 +02:00
|
|
|
if (context->render_offscreen)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glScissor(r->left, r->top, r->right - r->left, r->bottom - r->top);
|
2011-07-14 01:02:48 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const struct wined3d_surface *target = state->fb->render_targets[0];
|
|
|
|
UINT height;
|
|
|
|
UINT width;
|
|
|
|
|
|
|
|
target->get_drawable_size(context, &width, &height);
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top);
|
2007-07-26 00:38:50 +02:00
|
|
|
}
|
2007-02-19 15:25:16 +01:00
|
|
|
checkGLcall("glScissor");
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void indexbuffer(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2013-09-12 12:23:29 +02:00
|
|
|
const struct wined3d_stream_info *stream_info = &context->stream_info;
|
2010-05-25 12:02:03 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2013-01-06 14:44:07 +01:00
|
|
|
if (!state->index_buffer || !stream_info->all_vbo)
|
2010-09-14 13:38:39 +02:00
|
|
|
{
|
2008-07-05 23:46:21 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
|
2010-09-20 19:41:23 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
struct wined3d_buffer *ib = state->index_buffer;
|
2009-04-06 13:38:56 +02:00
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, ib->buffer_object));
|
2007-02-19 15:25:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void frontface(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
|
2009-08-06 08:12:19 +02:00
|
|
|
if (context->render_offscreen)
|
|
|
|
{
|
2012-07-24 11:32:27 +02:00
|
|
|
gl_info->gl_ops.gl.p_glFrontFace(GL_CCW);
|
2007-09-18 11:43:09 +02:00
|
|
|
checkGLcall("glFrontFace(GL_CCW)");
|
2012-07-24 11:32:27 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl_info->gl_ops.gl.p_glFrontFace(GL_CW);
|
2007-09-18 11:43:09 +02:00
|
|
|
checkGLcall("glFrontFace(GL_CW)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void psorigin_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2011-01-07 01:16:18 +01:00
|
|
|
{
|
|
|
|
static BOOL warned;
|
|
|
|
|
|
|
|
if (!warned)
|
|
|
|
{
|
|
|
|
WARN("Point sprite coordinate origin switching not supported.\n");
|
|
|
|
warned = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void psorigin(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2011-01-07 01:16:18 +01:00
|
|
|
{
|
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
GLint origin = context->render_offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT;
|
|
|
|
|
2012-07-19 16:47:39 +02:00
|
|
|
if (gl_info->supported[NV_POINT_SPRITE])
|
2011-01-07 01:16:18 +01:00
|
|
|
{
|
|
|
|
GL_EXTCALL(glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, origin));
|
|
|
|
checkGLcall("glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, ...)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-11 18:52:38 +01:00
|
|
|
void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
|
|
|
{
|
|
|
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
|
|
|
const struct wined3d_surface *rt = state->fb->render_targets[0];
|
|
|
|
|
|
|
|
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
|
|
|
|
|
|
|
|
if (state->render_states[WINED3D_RS_SRGBWRITEENABLE]
|
|
|
|
&& rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
|
|
|
|
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
|
|
|
|
else
|
|
|
|
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
|
|
|
|
}
|
|
|
|
|
2008-07-02 02:43:52 +02:00
|
|
|
const struct StateEntryTemplate misc_state_template[] = {
|
2011-12-19 21:00:09 +01:00
|
|
|
{ STATE_RENDER(WINED3D_RS_SRCBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_DESTBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), state_blend }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_EDGEANTIALIAS), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ANTIALIASEDLINEENABLE), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SEPARATEALPHABLENDENABLE), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SRCBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_DESTBLENDALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_BLENDOPALPHA), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
2011-06-27 17:52:39 +02:00
|
|
|
{ STATE_STREAMSRC, { STATE_STREAMSRC, streamsrc }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_VDECL, { STATE_VDECL, vdecl_miscpart }, WINED3D_GL_EXT_NONE },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_FRONTFACE, { STATE_FRONTFACE, frontface }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SCISSORRECT, { STATE_SCISSORRECT, scissorrect }, WINED3D_GL_EXT_NONE },
|
2011-01-07 01:16:18 +01:00
|
|
|
{ STATE_POINTSPRITECOORDORIGIN, { STATE_POINTSPRITECOORDORIGIN, psorigin }, WINED3D_GL_VERSION_2_0 },
|
|
|
|
{ STATE_POINTSPRITECOORDORIGIN, { STATE_POINTSPRITECOORDORIGIN, psorigin_w }, WINED3D_GL_EXT_NONE },
|
|
|
|
|
2011-08-02 22:20:32 +02:00
|
|
|
/* TODO: Move shader constant loading to vertex and fragment pipeline respectively, as soon as the pshader and
|
2008-07-02 20:07:41 +02:00
|
|
|
* vshader loadings are untied from each other
|
|
|
|
*/
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2013-08-16 09:12:30 +02:00
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
2009-06-04 10:16:21 +02:00
|
|
|
|
|
|
|
{ STATE_VIEWPORT, { STATE_VIEWPORT, viewport_miscpart }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:46:21 +02:00
|
|
|
{ STATE_INDEXBUFFER, { STATE_INDEXBUFFER, indexbuffer }, ARB_VERTEX_BUFFER_OBJECT },
|
2010-04-07 21:04:45 +02:00
|
|
|
{ STATE_INDEXBUFFER, { STATE_INDEXBUFFER, state_nop }, WINED3D_GL_EXT_NONE },
|
2011-12-19 21:00:09 +01:00
|
|
|
{ STATE_RENDER(WINED3D_RS_ANTIALIAS), { STATE_RENDER(WINED3D_RS_ANTIALIAS), state_antialias }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), { STATE_RENDER(WINED3D_RS_TEXTUREPERSPECTIVE), state_perspective }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ZENABLE), { STATE_RENDER(WINED3D_RS_ZENABLE), state_zenable }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAPU), { STATE_RENDER(WINED3D_RS_WRAPU), state_wrapu }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAPV), { STATE_RENDER(WINED3D_RS_WRAPV), state_wrapv }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FILLMODE), { STATE_RENDER(WINED3D_RS_FILLMODE), state_fillmode }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SHADEMODE), { STATE_RENDER(WINED3D_RS_SHADEMODE), state_shademode }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_LINEPATTERN), { STATE_RENDER(WINED3D_RS_LINEPATTERN), state_linepattern }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_MONOENABLE), { STATE_RENDER(WINED3D_RS_MONOENABLE), state_monoenable }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ROP2), { STATE_RENDER(WINED3D_RS_ROP2), state_rop2 }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_PLANEMASK), { STATE_RENDER(WINED3D_RS_PLANEMASK), state_planemask }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ZWRITEENABLE), { STATE_RENDER(WINED3D_RS_ZWRITEENABLE), state_zwritenable }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), state_alpha }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ALPHAREF), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ALPHAFUNC), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORKEYENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_LASTPIXEL), { STATE_RENDER(WINED3D_RS_LASTPIXEL), state_lastpixel }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_CULLMODE), { STATE_RENDER(WINED3D_RS_CULLMODE), state_cullmode }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ZFUNC), { STATE_RENDER(WINED3D_RS_ZFUNC), state_zfunc }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_DITHERENABLE), { STATE_RENDER(WINED3D_RS_DITHERENABLE), state_ditherenable }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SUBPIXEL), { STATE_RENDER(WINED3D_RS_SUBPIXEL), state_subpixel }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SUBPIXELX), { STATE_RENDER(WINED3D_RS_SUBPIXELX), state_subpixelx }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STIPPLEDALPHA), { STATE_RENDER(WINED3D_RS_STIPPLEDALPHA), state_stippledalpha }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STIPPLEENABLE), { STATE_RENDER(WINED3D_RS_STIPPLEENABLE), state_stippleenable }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_MIPMAPLODBIAS), { STATE_RENDER(WINED3D_RS_MIPMAPLODBIAS), state_mipmaplodbias }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ANISOTROPY), { STATE_RENDER(WINED3D_RS_ANISOTROPY), state_anisotropy }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FLUSHBATCH), { STATE_RENDER(WINED3D_RS_FLUSHBATCH), state_flushbatch }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),{ STATE_RENDER(WINED3D_RS_TRANSLUCENTSORTINDEPENDENT),state_translucentsi }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILENABLE), { STATE_RENDER(WINED3D_RS_STENCILENABLE), state_stencil }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILFAIL), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILZFAIL), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILPASS), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILFUNC), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILREF), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILMASK), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), state_stencilwrite2s}, EXT_STENCIL_TWO_SIDE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), { STATE_RENDER(WINED3D_RS_STENCILWRITEMASK), state_stencilwrite }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_TWOSIDEDSTENCILMODE), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_CCW_STENCILFAIL), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_CCW_STENCILZFAIL), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_CCW_STENCILPASS), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_CCW_STENCILFUNC), { STATE_RENDER(WINED3D_RS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP0), { STATE_RENDER(WINED3D_RS_WRAP0), state_wrap }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP1), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP2), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP3), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP4), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP5), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP6), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP7), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP8), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP9), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP10), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP11), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP12), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP13), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP14), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_WRAP15), { STATE_RENDER(WINED3D_RS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_EXTENTS), { STATE_RENDER(WINED3D_RS_EXTENTS), state_extents }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORKEYBLENDENABLE), { STATE_RENDER(WINED3D_RS_COLORKEYBLENDENABLE), state_ckeyblend }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SOFTWAREVERTEXPROCESSING), { STATE_RENDER(WINED3D_RS_SOFTWAREVERTEXPROCESSING), state_swvp }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_PATCHEDGESTYLE), { STATE_RENDER(WINED3D_RS_PATCHEDGESTYLE), state_patchedgestyle}, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_PATCHSEGMENTS), { STATE_RENDER(WINED3D_RS_PATCHSEGMENTS), state_patchsegments }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POSITIONDEGREE), { STATE_RENDER(WINED3D_RS_POSITIONDEGREE), state_positiondegree}, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_NORMALDEGREE), { STATE_RENDER(WINED3D_RS_NORMALDEGREE), state_normaldegree }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_MINTESSELLATIONLEVEL), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_MAXTESSELLATIONLEVEL), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ADAPTIVETESS_X), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Y), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ADAPTIVETESS_Z), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ADAPTIVETESS_W), { STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),{ STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),state_nvdb }, EXT_DEPTH_BOUNDS_TEST },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),{ STATE_RENDER(WINED3D_RS_ENABLEADAPTIVETESSELLATION),state_tessellation }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), state_msaa }, ARB_MULTISAMPLE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3D_RS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK), { STATE_RENDER(WINED3D_RS_MULTISAMPLEMASK), state_multisampmask }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), { STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), state_debug_monitor }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), state_colorwrite0 }, EXT_DRAW_BUFFERS2 },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop }, EXT_BLEND_MINMAX },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop_w }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE), { STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE), state_scissor }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SLOPESCALEDEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), state_colorwrite1 }, EXT_DRAW_BUFFERS2 },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), state_colorwrite2 }, EXT_DRAW_BUFFERS2 },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), state_colorwrite3 }, EXT_DRAW_BUFFERS2 },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor }, EXT_BLEND_COLOR },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_BLENDFACTOR), { STATE_RENDER(WINED3D_RS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_DEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_ZVISIBLE), { STATE_RENDER(WINED3D_RS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE },
|
2008-07-03 14:04:59 +02:00
|
|
|
/* Samplers */
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(8), { STATE_SAMPLER(8), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(9), { STATE_SAMPLER(9), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(10), { STATE_SAMPLER(10), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(11), { STATE_SAMPLER(11), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(12), { STATE_SAMPLER(12), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(13), { STATE_SAMPLER(13), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(14), { STATE_SAMPLER(14), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(15), { STATE_SAMPLER(15), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(16), /* Vertex sampler 0 */ { STATE_SAMPLER(16), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(17), /* Vertex sampler 1 */ { STATE_SAMPLER(17), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(18), /* Vertex sampler 2 */ { STATE_SAMPLER(18), sampler }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(19), /* Vertex sampler 3 */ { STATE_SAMPLER(19), sampler }, WINED3D_GL_EXT_NONE },
|
2011-06-20 23:21:12 +02:00
|
|
|
{ STATE_BASEVERTEXINDEX, { STATE_BASEVERTEXINDEX, state_nop, }, ARB_DRAW_ELEMENTS_BASE_VERTEX },
|
2011-06-27 17:52:39 +02:00
|
|
|
{ STATE_BASEVERTEXINDEX, { STATE_STREAMSRC, NULL, }, WINED3D_GL_EXT_NONE },
|
2011-07-02 11:24:37 +02:00
|
|
|
{ STATE_FRAMEBUFFER, { STATE_FRAMEBUFFER, context_state_fb }, WINED3D_GL_EXT_NONE },
|
2013-10-09 10:39:38 +02:00
|
|
|
{ STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), context_state_drawbuf},WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY), { STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY), state_geometry_shader}, WINED3D_GL_EXT_NONE },
|
2009-06-04 10:16:21 +02:00
|
|
|
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
|
2008-07-02 17:02:19 +02:00
|
|
|
};
|
|
|
|
|
2013-04-25 12:16:47 +02:00
|
|
|
const struct StateEntryTemplate vp_ffp_states[] =
|
|
|
|
{
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_VDECL, { STATE_VDECL, vertexdeclaration }, WINED3D_GL_EXT_NONE },
|
2013-10-09 10:39:38 +02:00
|
|
|
{ STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), { STATE_VDECL, NULL }, WINED3D_GL_EXT_NONE },
|
2011-12-19 21:00:09 +01:00
|
|
|
{ STATE_MATERIAL, { STATE_RENDER(WINED3D_RS_SPECULARENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SPECULARENABLE), { STATE_RENDER(WINED3D_RS_SPECULARENABLE), state_specularenable}, WINED3D_GL_EXT_NONE },
|
2008-07-02 19:10:42 +02:00
|
|
|
/* Clip planes */
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_CLIPPLANE(0), { STATE_CLIPPLANE(0), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(1), { STATE_CLIPPLANE(1), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(2), { STATE_CLIPPLANE(2), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(3), { STATE_CLIPPLANE(3), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(4), { STATE_CLIPPLANE(4), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(5), { STATE_CLIPPLANE(5), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(6), { STATE_CLIPPLANE(6), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(7), { STATE_CLIPPLANE(7), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(8), { STATE_CLIPPLANE(8), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(9), { STATE_CLIPPLANE(9), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(10), { STATE_CLIPPLANE(10), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(11), { STATE_CLIPPLANE(11), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(12), { STATE_CLIPPLANE(12), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(13), { STATE_CLIPPLANE(13), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(14), { STATE_CLIPPLANE(14), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(15), { STATE_CLIPPLANE(15), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(16), { STATE_CLIPPLANE(16), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(17), { STATE_CLIPPLANE(17), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(18), { STATE_CLIPPLANE(18), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(19), { STATE_CLIPPLANE(19), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(20), { STATE_CLIPPLANE(20), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(21), { STATE_CLIPPLANE(21), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(22), { STATE_CLIPPLANE(22), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(23), { STATE_CLIPPLANE(23), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(24), { STATE_CLIPPLANE(24), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(25), { STATE_CLIPPLANE(25), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(26), { STATE_CLIPPLANE(26), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(27), { STATE_CLIPPLANE(27), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(28), { STATE_CLIPPLANE(28), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(29), { STATE_CLIPPLANE(29), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(30), { STATE_CLIPPLANE(30), clipplane }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_CLIPPLANE(31), { STATE_CLIPPLANE(31), clipplane }, WINED3D_GL_EXT_NONE },
|
2008-07-02 19:15:34 +02:00
|
|
|
/* Lights */
|
2013-05-29 09:45:38 +02:00
|
|
|
{ STATE_LIGHT_TYPE, { STATE_LIGHT_TYPE, state_nop }, WINED3D_GL_EXT_NONE },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_ACTIVELIGHT(0), { STATE_ACTIVELIGHT(0), light }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_ACTIVELIGHT(1), { STATE_ACTIVELIGHT(1), light }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_ACTIVELIGHT(2), { STATE_ACTIVELIGHT(2), light }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_ACTIVELIGHT(3), { STATE_ACTIVELIGHT(3), light }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_ACTIVELIGHT(4), { STATE_ACTIVELIGHT(4), light }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_ACTIVELIGHT(5), { STATE_ACTIVELIGHT(5), light }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_ACTIVELIGHT(6), { STATE_ACTIVELIGHT(6), light }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_ACTIVELIGHT(7), { STATE_ACTIVELIGHT(7), light }, WINED3D_GL_EXT_NONE },
|
2008-07-02 20:16:23 +02:00
|
|
|
/* Viewport */
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_VIEWPORT, { STATE_VIEWPORT, viewport_vertexpart }, WINED3D_GL_EXT_NONE },
|
2008-07-02 20:40:23 +02:00
|
|
|
/* Transform states follow */
|
2012-01-11 21:27:32 +01:00
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_VIEW), { STATE_TRANSFORM(WINED3D_TS_VIEW), transform_view }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_PROJECTION), { STATE_TRANSFORM(WINED3D_TS_PROJECTION), transform_projection}, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE3), { STATE_TEXTURESTAGE(3, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE4), { STATE_TEXTURESTAGE(4, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE5), { STATE_TEXTURESTAGE(5, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE6), { STATE_TEXTURESTAGE(6, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_TEXTURE7), { STATE_TEXTURESTAGE(7, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 0)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 0)), transform_world }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 1)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 1)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 2)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 2)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 3)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 3)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 4)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 4)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 5)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 5)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 6)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 6)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 7)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 7)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 8)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 8)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 9)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 9)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 10)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 10)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 11)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 11)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 12)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 12)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 13)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 13)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 14)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 14)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 15)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 15)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 16)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 16)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 17)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 17)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 18)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 18)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 19)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 19)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 20)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 20)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 21)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 21)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 22)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 22)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 23)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 23)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 24)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 24)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 25)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 25)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 26)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 26)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 27)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 27)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 28)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 28)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 29)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 29)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 30)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 30)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 31)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 31)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 32)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 32)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 33)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 33)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 34)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 34)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 35)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 35)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 36)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 36)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 37)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 37)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 38)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 38)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 39)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 39)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 40)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 40)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 41)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 41)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 42)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 42)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 43)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 43)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 44)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 44)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 45)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 45)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 46)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 46)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 47)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 47)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 48)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 48)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 49)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 49)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 50)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 50)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 51)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 51)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 52)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 52)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 53)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 53)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 54)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 54)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 55)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 55)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 56)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 56)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 57)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 57)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 58)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 58)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 59)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 59)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 60)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 60)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 61)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 61)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 62)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 62)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 63)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 63)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 64)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 64)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 65)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 65)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 66)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 66)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 67)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 67)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 68)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 68)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 69)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 69)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 70)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 70)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 71)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 71)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 72)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 72)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 73)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 73)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 74)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 74)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 75)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 75)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 76)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 76)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 77)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 77)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 78)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 78)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 79)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 79)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 80)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 80)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 81)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 81)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 82)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 82)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 83)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 83)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 84)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 84)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 85)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 85)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 86)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 86)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 87)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 87)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 88)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 88)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 89)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 89)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 90)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 90)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 91)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 91)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 92)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 92)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 93)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 93)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 94)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 94)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 95)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 95)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 96)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 96)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 97)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 97)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 98)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 98)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 99)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX( 99)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(100)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(100)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(101)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(101)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(102)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(102)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(103)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(103)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(104)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(104)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(105)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(105)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(106)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(106)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(107)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(107)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(108)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(108)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(109)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(109)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(110)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(110)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(111)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(111)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(112)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(112)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(113)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(113)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(114)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(114)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(115)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(115)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(116)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(116)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(117)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(117)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(118)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(118)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(119)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(119)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(120)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(120)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(121)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(121)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(122)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(122)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(123)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(123)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(124)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(124)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(125)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(125)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(126)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(126)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(127)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(127)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(128)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(128)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(129)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(129)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(130)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(130)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(131)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(131)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(132)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(132)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(133)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(133)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(134)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(134)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(135)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(135)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(136)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(136)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(137)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(137)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(138)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(138)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(139)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(139)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(140)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(140)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(141)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(141)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(142)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(142)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(143)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(143)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(144)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(144)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(145)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(145)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(146)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(146)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(147)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(147)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(148)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(148)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(149)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(149)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(150)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(150)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(151)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(151)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(152)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(152)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(153)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(153)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(154)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(154)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(155)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(155)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(156)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(156)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(157)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(157)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(158)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(158)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(159)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(159)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(160)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(160)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(161)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(161)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(162)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(162)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(163)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(163)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(164)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(164)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(165)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(165)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(166)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(166)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(167)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(167)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(168)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(168)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(169)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(169)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(170)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(170)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(171)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(171)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(172)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(172)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(173)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(173)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(174)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(174)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(175)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(175)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(176)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(176)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(177)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(177)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(178)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(178)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(179)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(179)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(180)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(180)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(181)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(181)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(182)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(182)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(183)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(183)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(184)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(184)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(185)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(185)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(186)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(186)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(187)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(187)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(188)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(188)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(189)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(189)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(190)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(190)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(191)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(191)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(192)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(192)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(193)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(193)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(194)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(194)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(195)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(195)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(196)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(196)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(197)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(197)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(198)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(198)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(199)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(199)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(200)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(200)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(201)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(201)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(202)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(202)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(203)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(203)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(204)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(204)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(205)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(205)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(206)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(206)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(207)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(207)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(208)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(208)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(209)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(209)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(210)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(210)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(211)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(211)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(212)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(212)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(213)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(213)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(214)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(214)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(215)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(215)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(216)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(216)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(217)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(217)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(218)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(218)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(219)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(219)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(220)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(220)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(221)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(221)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(222)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(222)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(223)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(223)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(224)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(224)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(225)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(225)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(226)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(226)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(227)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(227)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(228)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(228)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(229)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(229)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(230)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(230)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(231)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(231)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(232)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(232)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(233)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(233)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(234)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(234)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(235)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(235)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(236)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(236)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(237)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(237)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(238)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(238)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(239)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(239)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(240)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(240)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(241)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(241)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(242)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(242)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(243)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(243)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(244)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(244)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(245)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(245)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(246)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(246)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(247)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(247)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(248)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(248)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(249)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(249)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(250)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(250)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(251)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(251)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(252)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(252)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(253)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(253)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(254)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(254)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(255)), { STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(255)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(3, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(4, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(5, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(6, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(7, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), transform_texture }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(3, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(4, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(5, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(6, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_TEXCOORD_INDEX), { STATE_TEXTURESTAGE(7, WINED3D_TSS_TEXCOORD_INDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
2008-07-03 03:49:43 +02:00
|
|
|
/* Fog */
|
2011-12-19 21:00:09 +01:00
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGENABLE), { STATE_RENDER(WINED3D_RS_FOGENABLE), state_fog_vertexpart}, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGTABLEMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_RANGEFOGENABLE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_CLIPPING), { STATE_RENDER(WINED3D_RS_CLIPPING), state_clipping }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_CLIPPLANEENABLE), { STATE_RENDER(WINED3D_RS_CLIPPING), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_LIGHTING), { STATE_RENDER(WINED3D_RS_LIGHTING), state_lighting }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_AMBIENT), { STATE_RENDER(WINED3D_RS_AMBIENT), state_ambient }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_COLORVERTEX), { STATE_RENDER(WINED3D_RS_COLORVERTEX), state_colormat }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_LOCALVIEWER), { STATE_RENDER(WINED3D_RS_LOCALVIEWER), state_localviewer }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_NORMALIZENORMALS), { STATE_RENDER(WINED3D_RS_NORMALIZENORMALS), state_normalize }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_DIFFUSEMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SPECULARMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_AMBIENTMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_EMISSIVEMATERIALSOURCE), { STATE_RENDER(WINED3D_RS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_VERTEXBLEND), { STATE_RENDER(WINED3D_RS_VERTEXBLEND), state_vertexblend }, ARB_VERTEX_BLEND },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_VERTEXBLEND), { STATE_RENDER(WINED3D_RS_VERTEXBLEND), state_vertexblend_w }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSIZE), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), state_psizemin_arb }, ARB_POINT_PARAMETERS },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), state_psizemin_ext }, EXT_POINT_PARAMETERS },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), state_psizemin_w }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite }, ARB_POINT_SPRITE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), { STATE_RENDER(WINED3D_RS_POINTSPRITEENABLE), state_pointsprite_w }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), state_pscale }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSCALE_A), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSCALE_B), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSCALE_C), { STATE_RENDER(WINED3D_RS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, ARB_POINT_PARAMETERS },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, EXT_POINT_PARAMETERS },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), { STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_TWEENFACTOR), { STATE_RENDER(WINED3D_RS_VERTEXBLEND), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_INDEXEDVERTEXBLENDENABLE), { STATE_RENDER(WINED3D_RS_VERTEXBLEND), NULL }, WINED3D_GL_EXT_NONE },
|
2010-03-31 11:29:01 +02:00
|
|
|
|
2008-07-05 23:07:00 +02:00
|
|
|
/* Samplers for NP2 texture matrix adjustions. They are not needed if GL_ARB_texture_non_power_of_two is supported,
|
|
|
|
* so register a NULL state handler in that case to get the vertex part of sampler() skipped(VTF is handled in the misc states.
|
|
|
|
* otherwise, register sampler_texmatrix, which takes care of updating the texture matrix
|
|
|
|
*/
|
|
|
|
{ STATE_SAMPLER(0), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(0), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:07:00 +02:00
|
|
|
{ STATE_SAMPLER(1), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(1), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:07:00 +02:00
|
|
|
{ STATE_SAMPLER(2), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(2), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:07:00 +02:00
|
|
|
{ STATE_SAMPLER(3), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(3), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:07:00 +02:00
|
|
|
{ STATE_SAMPLER(4), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(4), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:07:00 +02:00
|
|
|
{ STATE_SAMPLER(5), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(5), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:07:00 +02:00
|
|
|
{ STATE_SAMPLER(6), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(6), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2008-07-05 23:07:00 +02:00
|
|
|
{ STATE_SAMPLER(7), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2010-07-20 18:51:54 +02:00
|
|
|
{ STATE_SAMPLER(7), { 0, NULL }, WINED3D_GL_NORMALIZED_TEXRECT },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
2013-05-29 09:45:36 +02:00
|
|
|
{ STATE_POINT_SIZE_ENABLE, { STATE_POINT_SIZE_ENABLE, state_nop }, WINED3D_GL_EXT_NONE },
|
2009-06-04 10:16:21 +02:00
|
|
|
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
|
2008-07-02 02:43:52 +02:00
|
|
|
};
|
|
|
|
|
2008-07-06 01:31:34 +02:00
|
|
|
static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
|
2012-01-09 22:16:51 +01:00
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
2013-10-09 10:39:38 +02:00
|
|
|
{ STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), apply_pixelshader }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), NULL }, WINED3D_GL_EXT_NONE },
|
2011-12-19 21:00:09 +01:00
|
|
|
{ STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), state_texfactor }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGCOLOR), { STATE_RENDER(WINED3D_RS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGDENSITY), { STATE_RENDER(WINED3D_RS_FOGDENSITY), state_fogdensity }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGENABLE), { STATE_RENDER(WINED3D_RS_FOGENABLE), state_fog_fragpart }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGTABLEMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGSTART), { STATE_RENDER(WINED3D_RS_FOGSTART), state_fogstartend }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_RENDER(WINED3D_RS_FOGEND), { STATE_RENDER(WINED3D_RS_FOGSTART), NULL }, WINED3D_GL_EXT_NONE },
|
2009-06-04 10:16:21 +02:00
|
|
|
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
|
|
|
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
|
2008-07-04 22:01:26 +02:00
|
|
|
};
|
2008-07-04 22:09:49 +02:00
|
|
|
|
2012-12-10 21:54:36 +01:00
|
|
|
/* Context activation is done by the caller. */
|
2012-07-24 11:32:26 +02:00
|
|
|
static void ffp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
|
2008-07-03 21:36:18 +02:00
|
|
|
|
2013-04-25 12:16:47 +02:00
|
|
|
static void *ffp_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
|
|
|
|
{
|
|
|
|
return shader_priv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ffp_free(struct wined3d_device *device) {}
|
|
|
|
|
|
|
|
static void vp_ffp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps)
|
|
|
|
{
|
2013-06-14 09:07:12 +02:00
|
|
|
caps->xyzrhw = FALSE;
|
2013-04-25 12:16:47 +02:00
|
|
|
caps->max_active_lights = gl_info->limits.lights;
|
|
|
|
caps->max_vertex_blend_matrices = gl_info->limits.blends;
|
|
|
|
caps->max_vertex_blend_matrix_index = 0;
|
|
|
|
caps->vertex_processing_caps = WINED3DVTXPCAPS_DIRECTIONALLIGHTS
|
|
|
|
| WINED3DVTXPCAPS_MATERIALSOURCE7
|
|
|
|
| WINED3DVTXPCAPS_POSITIONALLIGHTS
|
|
|
|
| WINED3DVTXPCAPS_LOCALVIEWER
|
|
|
|
| WINED3DVTXPCAPS_VERTEXFOG
|
2013-05-28 08:55:18 +02:00
|
|
|
| WINED3DVTXPCAPS_TEXGEN
|
|
|
|
| WINED3DVTXPCAPS_TEXGEN_SPHEREMAP;
|
2013-04-25 12:16:47 +02:00
|
|
|
caps->fvf_caps = WINED3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */
|
|
|
|
caps->max_user_clip_planes = gl_info->limits.clipplanes;
|
|
|
|
caps->raster_caps = 0;
|
|
|
|
if (gl_info->supported[NV_FOG_DISTANCE])
|
|
|
|
caps->raster_caps |= WINED3DPRASTERCAPS_FOGRANGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct wined3d_vertex_pipe_ops ffp_vertex_pipe =
|
|
|
|
{
|
|
|
|
ffp_enable,
|
|
|
|
vp_ffp_get_caps,
|
|
|
|
ffp_alloc,
|
|
|
|
ffp_free,
|
|
|
|
vp_ffp_states,
|
|
|
|
};
|
|
|
|
|
2011-04-26 19:24:15 +02:00
|
|
|
static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
|
2008-11-25 14:36:09 +01:00
|
|
|
{
|
2013-01-21 09:08:36 +01:00
|
|
|
caps->wined3d_caps = 0;
|
2011-04-26 19:24:15 +02:00
|
|
|
caps->PrimitiveMiscCaps = 0;
|
|
|
|
caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD
|
|
|
|
| WINED3DTEXOPCAPS_ADDSIGNED
|
|
|
|
| WINED3DTEXOPCAPS_ADDSIGNED2X
|
|
|
|
| WINED3DTEXOPCAPS_MODULATE
|
|
|
|
| WINED3DTEXOPCAPS_MODULATE2X
|
|
|
|
| WINED3DTEXOPCAPS_MODULATE4X
|
|
|
|
| WINED3DTEXOPCAPS_SELECTARG1
|
|
|
|
| WINED3DTEXOPCAPS_SELECTARG2
|
|
|
|
| WINED3DTEXOPCAPS_DISABLE;
|
2008-07-03 21:36:18 +02:00
|
|
|
|
2009-10-29 10:37:11 +01:00
|
|
|
if (gl_info->supported[ARB_TEXTURE_ENV_COMBINE]
|
|
|
|
|| gl_info->supported[EXT_TEXTURE_ENV_COMBINE]
|
|
|
|
|| gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
|
|
|
{
|
2011-04-26 19:24:15 +02:00
|
|
|
caps->TextureOpCaps |= WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
|
|
|
|
| WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
|
|
|
|
| WINED3DTEXOPCAPS_BLENDFACTORALPHA
|
|
|
|
| WINED3DTEXOPCAPS_BLENDCURRENTALPHA
|
|
|
|
| WINED3DTEXOPCAPS_LERP
|
|
|
|
| WINED3DTEXOPCAPS_SUBTRACT;
|
2008-07-03 21:36:18 +02:00
|
|
|
}
|
2009-10-29 10:37:11 +01:00
|
|
|
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]
|
|
|
|
|| gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
|
|
|
{
|
2011-04-26 19:24:15 +02:00
|
|
|
caps->TextureOpCaps |= WINED3DTEXOPCAPS_ADDSMOOTH
|
|
|
|
| WINED3DTEXOPCAPS_MULTIPLYADD
|
|
|
|
| WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
|
|
|
|
| WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
|
|
|
|
| WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
|
2008-07-03 21:36:18 +02:00
|
|
|
}
|
2009-10-29 10:37:11 +01:00
|
|
|
if (gl_info->supported[ARB_TEXTURE_ENV_DOT3])
|
2011-04-26 19:24:15 +02:00
|
|
|
caps->TextureOpCaps |= WINED3DTEXOPCAPS_DOTPRODUCT3;
|
2008-07-03 21:36:18 +02:00
|
|
|
|
2011-04-26 19:24:15 +02:00
|
|
|
caps->MaxTextureBlendStages = gl_info->limits.textures;
|
|
|
|
caps->MaxSimultaneousTextures = gl_info->limits.textures;
|
2008-07-03 21:36:18 +02:00
|
|
|
}
|
|
|
|
|
2008-12-03 14:53:43 +01:00
|
|
|
static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup)
|
|
|
|
{
|
|
|
|
if (TRACE_ON(d3d))
|
|
|
|
{
|
|
|
|
TRACE("Checking support for fixup:\n");
|
|
|
|
dump_color_fixup_desc(fixup);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We only support identity conversions. */
|
|
|
|
if (is_identity_fixup(fixup))
|
|
|
|
{
|
|
|
|
TRACE("[OK]\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("[FAILED]\n");
|
2008-08-07 21:51:35 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2008-07-11 16:41:28 +02:00
|
|
|
|
2008-07-04 22:09:49 +02:00
|
|
|
const struct fragment_pipeline ffp_fragment_pipeline = {
|
2008-07-04 23:15:18 +02:00
|
|
|
ffp_enable,
|
2008-07-03 21:36:18 +02:00
|
|
|
ffp_fragment_get_caps,
|
2013-04-25 12:16:47 +02:00
|
|
|
ffp_alloc,
|
|
|
|
ffp_free,
|
2008-12-03 14:53:43 +01:00
|
|
|
ffp_color_fixup_supported,
|
2008-08-23 22:41:51 +02:00
|
|
|
ffp_fragmentstate_template,
|
2008-07-04 22:09:49 +02:00
|
|
|
};
|
2008-07-04 22:01:26 +02:00
|
|
|
|
2013-04-25 12:16:47 +02:00
|
|
|
static void none_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
|
2013-01-16 08:51:47 +01:00
|
|
|
|
2013-04-25 12:16:47 +02:00
|
|
|
static void *none_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
|
2013-01-16 08:51:47 +01:00
|
|
|
{
|
2013-04-25 12:16:47 +02:00
|
|
|
return shader_priv;
|
2013-01-16 08:51:47 +01:00
|
|
|
}
|
|
|
|
|
2013-04-25 12:16:47 +02:00
|
|
|
static void none_free(struct wined3d_device *device) {}
|
|
|
|
|
|
|
|
static void vp_none_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps)
|
2013-01-16 08:51:47 +01:00
|
|
|
{
|
2013-04-25 12:16:47 +02:00
|
|
|
memset(caps, 0, sizeof(*caps));
|
2013-01-16 08:51:47 +01:00
|
|
|
}
|
|
|
|
|
2013-04-25 12:16:47 +02:00
|
|
|
const struct wined3d_vertex_pipe_ops none_vertex_pipe =
|
|
|
|
{
|
|
|
|
none_enable,
|
|
|
|
vp_none_get_caps,
|
|
|
|
none_alloc,
|
|
|
|
none_free,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void fp_none_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
|
|
|
|
{
|
|
|
|
memset(caps, 0, sizeof(*caps));
|
|
|
|
}
|
2013-01-16 08:51:47 +01:00
|
|
|
|
|
|
|
static BOOL fp_none_color_fixup_supported(struct color_fixup_desc fixup)
|
|
|
|
{
|
|
|
|
return is_identity_fixup(fixup);
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct fragment_pipeline none_fragment_pipe =
|
|
|
|
{
|
2013-04-25 12:16:47 +02:00
|
|
|
none_enable,
|
2013-01-16 08:51:47 +01:00
|
|
|
fp_none_get_caps,
|
2013-04-25 12:16:47 +02:00
|
|
|
none_alloc,
|
|
|
|
none_free,
|
2013-01-16 08:51:47 +01:00
|
|
|
fp_none_color_fixup_supported,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2008-12-01 15:32:14 +01:00
|
|
|
static unsigned int num_handlers(const APPLYSTATEFUNC *funcs)
|
|
|
|
{
|
2008-07-02 02:43:52 +02:00
|
|
|
unsigned int i;
|
|
|
|
for(i = 0; funcs[i]; i++);
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void multistate_apply_2(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
context->swapchain->device->multistate_funcs[state_id][0](context, state, state_id);
|
|
|
|
context->swapchain->device->multistate_funcs[state_id][1](context, state, state_id);
|
2008-07-02 02:43:52 +02:00
|
|
|
}
|
|
|
|
|
2011-07-14 01:02:48 +02:00
|
|
|
static void multistate_apply_3(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
2009-08-03 08:06:51 +02:00
|
|
|
{
|
2011-07-14 01:02:48 +02:00
|
|
|
context->swapchain->device->multistate_funcs[state_id][0](context, state, state_id);
|
|
|
|
context->swapchain->device->multistate_funcs[state_id][1](context, state, state_id);
|
|
|
|
context->swapchain->device->multistate_funcs[state_id][2](context, state, state_id);
|
2008-07-02 02:43:52 +02:00
|
|
|
}
|
|
|
|
|
2013-04-25 15:20:30 +02:00
|
|
|
static void prune_invalid_states(struct StateEntry *state_table, const struct wined3d_gl_info *gl_info,
|
|
|
|
const struct wined3d_d3d_info *d3d_info)
|
2010-01-28 23:40:25 +01:00
|
|
|
{
|
|
|
|
unsigned int start, last, i;
|
|
|
|
|
2013-04-25 15:20:30 +02:00
|
|
|
start = STATE_TEXTURESTAGE(d3d_info->limits.ffp_blend_stages, 0);
|
2010-01-28 23:40:25 +01:00
|
|
|
last = STATE_TEXTURESTAGE(MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE);
|
|
|
|
for (i = start; i <= last; ++i)
|
|
|
|
{
|
|
|
|
state_table[i].representative = 0;
|
|
|
|
state_table[i].apply = state_undefined;
|
|
|
|
}
|
|
|
|
|
2013-04-25 15:20:30 +02:00
|
|
|
start = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + d3d_info->limits.ffp_blend_stages);
|
2012-01-11 21:27:32 +01:00
|
|
|
last = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + MAX_TEXTURES - 1);
|
2010-01-28 23:40:25 +01:00
|
|
|
for (i = start; i <= last; ++i)
|
|
|
|
{
|
|
|
|
state_table[i].representative = 0;
|
|
|
|
state_table[i].apply = state_undefined;
|
|
|
|
}
|
2010-04-13 20:46:28 +02:00
|
|
|
|
2012-01-11 21:27:32 +01:00
|
|
|
start = STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(gl_info->limits.blends));
|
|
|
|
last = STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(255));
|
2010-04-13 20:46:28 +02:00
|
|
|
for (i = start; i <= last; ++i)
|
|
|
|
{
|
|
|
|
state_table[i].representative = 0;
|
|
|
|
state_table[i].apply = state_undefined;
|
|
|
|
}
|
2010-01-28 23:40:25 +01:00
|
|
|
}
|
|
|
|
|
2010-01-28 23:40:24 +01:00
|
|
|
static void validate_state_table(struct StateEntry *state_table)
|
|
|
|
{
|
2010-04-01 21:28:55 +02:00
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
DWORD first;
|
|
|
|
DWORD last;
|
|
|
|
}
|
|
|
|
rs_holes[] =
|
|
|
|
{
|
|
|
|
{ 1, 1},
|
|
|
|
{ 3, 3},
|
|
|
|
{ 17, 18},
|
|
|
|
{ 21, 21},
|
|
|
|
{ 42, 45},
|
2011-04-21 22:36:11 +02:00
|
|
|
{ 47, 47},
|
2010-04-01 21:28:55 +02:00
|
|
|
{ 61, 127},
|
|
|
|
{149, 150},
|
|
|
|
{169, 169},
|
|
|
|
{177, 177},
|
|
|
|
{196, 197},
|
|
|
|
{ 0, 0},
|
|
|
|
};
|
2010-04-07 21:04:48 +02:00
|
|
|
static const DWORD simple_states[] =
|
|
|
|
{
|
|
|
|
STATE_MATERIAL,
|
|
|
|
STATE_VDECL,
|
|
|
|
STATE_STREAMSRC,
|
|
|
|
STATE_INDEXBUFFER,
|
2013-10-09 10:39:38 +02:00
|
|
|
STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX),
|
|
|
|
STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY),
|
|
|
|
STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL),
|
2010-04-07 21:04:48 +02:00
|
|
|
STATE_VIEWPORT,
|
2013-05-29 09:45:38 +02:00
|
|
|
STATE_LIGHT_TYPE,
|
2010-04-07 21:04:48 +02:00
|
|
|
STATE_SCISSORRECT,
|
|
|
|
STATE_FRONTFACE,
|
2011-01-07 01:16:18 +01:00
|
|
|
STATE_POINTSPRITECOORDORIGIN,
|
2011-06-20 23:21:11 +02:00
|
|
|
STATE_BASEVERTEXINDEX,
|
2013-05-29 09:45:36 +02:00
|
|
|
STATE_FRAMEBUFFER,
|
|
|
|
STATE_POINT_SIZE_ENABLE,
|
2010-04-07 21:04:48 +02:00
|
|
|
};
|
2010-04-01 21:28:55 +02:00
|
|
|
unsigned int i, current;
|
|
|
|
|
|
|
|
for (i = STATE_RENDER(1), current = 0; i <= STATE_RENDER(WINEHIGHEST_RENDER_STATE); ++i)
|
|
|
|
{
|
|
|
|
if (!rs_holes[current].first || i < STATE_RENDER(rs_holes[current].first))
|
|
|
|
{
|
|
|
|
if (!state_table[i].representative)
|
|
|
|
ERR("State %s (%#x) should have a representative.\n", debug_d3dstate(i), i);
|
|
|
|
}
|
|
|
|
else if (state_table[i].representative)
|
|
|
|
ERR("State %s (%#x) shouldn't have a representative.\n", debug_d3dstate(i), i);
|
|
|
|
|
|
|
|
if (i == STATE_RENDER(rs_holes[current].last)) ++current;
|
|
|
|
}
|
2010-01-28 23:40:24 +01:00
|
|
|
|
2010-04-07 21:04:48 +02:00
|
|
|
for (i = 0; i < sizeof(simple_states) / sizeof(*simple_states); ++i)
|
|
|
|
{
|
|
|
|
if (!state_table[simple_states[i]].representative)
|
|
|
|
ERR("State %s (%#x) should have a representative.\n",
|
|
|
|
debug_d3dstate(simple_states[i]), simple_states[i]);
|
|
|
|
}
|
|
|
|
|
2010-01-28 23:40:24 +01:00
|
|
|
for (i = 0; i < STATE_HIGHEST + 1; ++i)
|
|
|
|
{
|
|
|
|
DWORD rep = state_table[i].representative;
|
2010-04-01 11:34:47 +02:00
|
|
|
if (rep)
|
2010-01-28 23:40:24 +01:00
|
|
|
{
|
2010-04-01 21:28:50 +02:00
|
|
|
if (state_table[rep].representative != rep)
|
2010-04-01 11:34:47 +02:00
|
|
|
{
|
|
|
|
ERR("State %s (%#x) has invalid representative %s (%#x).\n",
|
|
|
|
debug_d3dstate(i), i, debug_d3dstate(rep), rep);
|
|
|
|
state_table[i].representative = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rep != i)
|
|
|
|
{
|
|
|
|
if (state_table[i].apply)
|
|
|
|
ERR("State %s (%#x) has both a handler and representative.\n", debug_d3dstate(i), i);
|
|
|
|
}
|
|
|
|
else if (!state_table[i].apply)
|
|
|
|
{
|
|
|
|
ERR("Self representing state %s (%#x) has no handler.\n", debug_d3dstate(i), i);
|
|
|
|
}
|
2010-01-28 23:40:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-07 02:20:08 +01:00
|
|
|
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
|
2013-04-25 15:20:30 +02:00
|
|
|
const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
|
|
|
|
const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
|
|
|
|
const struct StateEntryTemplate *misc)
|
2008-12-01 15:32:14 +01:00
|
|
|
{
|
2008-07-02 02:43:52 +02:00
|
|
|
unsigned int i, type, handlers;
|
|
|
|
APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
|
|
|
|
const struct StateEntryTemplate *cur;
|
2008-07-05 22:04:16 +02:00
|
|
|
BOOL set[STATE_HIGHEST + 1];
|
2008-07-02 02:43:52 +02:00
|
|
|
|
|
|
|
memset(multistate_funcs, 0, sizeof(multistate_funcs));
|
|
|
|
|
2008-07-02 22:27:46 +02:00
|
|
|
for(i = 0; i < STATE_HIGHEST + 1; i++) {
|
|
|
|
StateTable[i].representative = 0;
|
|
|
|
StateTable[i].apply = state_undefined;
|
|
|
|
}
|
|
|
|
|
2008-07-02 02:43:52 +02:00
|
|
|
for(type = 0; type < 3; type++) {
|
|
|
|
/* This switch decides the order in which the states are applied */
|
|
|
|
switch(type) {
|
|
|
|
case 0: cur = misc; break;
|
2008-07-04 22:09:49 +02:00
|
|
|
case 1: cur = fragment->states; break;
|
2013-04-25 12:16:47 +02:00
|
|
|
case 2: cur = vertex->vp_states; break;
|
2008-07-02 02:43:52 +02:00
|
|
|
default: cur = NULL; /* Stupid compiler */
|
|
|
|
}
|
|
|
|
if(!cur) continue;
|
|
|
|
|
2008-07-05 22:04:16 +02:00
|
|
|
/* GL extension filtering should not prevent multiple handlers being applied from different
|
|
|
|
* pipeline parts
|
|
|
|
*/
|
|
|
|
memset(set, 0, sizeof(set));
|
|
|
|
|
2008-07-02 02:43:52 +02:00
|
|
|
for(i = 0; cur[i].state; i++) {
|
2009-01-07 02:20:08 +01:00
|
|
|
APPLYSTATEFUNC *funcs_array;
|
2008-07-05 22:04:16 +02:00
|
|
|
|
|
|
|
/* Only use the first matching state with the available extension from one template.
|
|
|
|
* e.g.
|
|
|
|
* {D3DRS_FOOBAR, {D3DRS_FOOBAR, func1}, XYZ_FANCY},
|
|
|
|
* {D3DRS_FOOBAR, {D3DRS_FOOBAR, func2}, 0 }
|
|
|
|
*
|
|
|
|
* if GL_XYZ_fancy is supported, ignore the 2nd line
|
|
|
|
*/
|
|
|
|
if(set[cur[i].state]) continue;
|
|
|
|
/* Skip state lines depending on unsupported extensions */
|
2009-10-29 10:37:11 +01:00
|
|
|
if (!gl_info->supported[cur[i].extension]) continue;
|
2008-07-05 22:04:16 +02:00
|
|
|
set[cur[i].state] = TRUE;
|
|
|
|
/* In some cases having an extension means that nothing has to be
|
|
|
|
* done for a state, e.g. if GL_ARB_texture_non_power_of_two is
|
|
|
|
* supported, the texture coordinate fixup can be ignored. If the
|
|
|
|
* apply function is used, mark the state set(done above) to prevent
|
|
|
|
* applying later lines, but do not record anything in the state
|
|
|
|
* table
|
|
|
|
*/
|
2010-04-01 11:34:45 +02:00
|
|
|
if (!cur[i].content.representative) continue;
|
2008-07-05 22:04:16 +02:00
|
|
|
|
2008-07-02 02:43:52 +02:00
|
|
|
handlers = num_handlers(multistate_funcs[cur[i].state]);
|
|
|
|
multistate_funcs[cur[i].state][handlers] = cur[i].content.apply;
|
|
|
|
switch(handlers) {
|
|
|
|
case 0:
|
|
|
|
StateTable[cur[i].state].apply = cur[i].content.apply;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
StateTable[cur[i].state].apply = multistate_apply_2;
|
|
|
|
dev_multistate_funcs[cur[i].state] = HeapAlloc(GetProcessHeap(),
|
|
|
|
0,
|
|
|
|
sizeof(**dev_multistate_funcs) * 2);
|
2009-01-07 02:20:08 +01:00
|
|
|
if (!dev_multistate_funcs[cur[i].state]) {
|
|
|
|
goto out_of_mem;
|
|
|
|
}
|
|
|
|
|
2008-07-02 02:43:52 +02:00
|
|
|
dev_multistate_funcs[cur[i].state][0] = multistate_funcs[cur[i].state][0];
|
|
|
|
dev_multistate_funcs[cur[i].state][1] = multistate_funcs[cur[i].state][1];
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
StateTable[cur[i].state].apply = multistate_apply_3;
|
2009-01-07 02:20:08 +01:00
|
|
|
funcs_array = HeapReAlloc(GetProcessHeap(),
|
|
|
|
0,
|
|
|
|
dev_multistate_funcs[cur[i].state],
|
|
|
|
sizeof(**dev_multistate_funcs) * 3);
|
|
|
|
if (!funcs_array) {
|
|
|
|
goto out_of_mem;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_multistate_funcs[cur[i].state] = funcs_array;
|
2008-07-02 02:43:52 +02:00
|
|
|
dev_multistate_funcs[cur[i].state][2] = multistate_funcs[cur[i].state][2];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("Unexpected amount of state handlers for state %u: %u\n",
|
|
|
|
cur[i].state, handlers + 1);
|
|
|
|
}
|
|
|
|
|
2013-05-28 08:55:17 +02:00
|
|
|
if (StateTable[cur[i].state].representative
|
|
|
|
&& StateTable[cur[i].state].representative != cur[i].content.representative)
|
|
|
|
{
|
|
|
|
FIXME("State %s (%#x) has different representatives in different pipeline parts.\n",
|
|
|
|
debug_d3dstate(cur[i].state), cur[i].state);
|
2008-07-02 02:43:52 +02:00
|
|
|
}
|
|
|
|
StateTable[cur[i].state].representative = cur[i].content.representative;
|
|
|
|
}
|
|
|
|
}
|
2009-01-07 02:20:08 +01:00
|
|
|
|
2013-04-25 15:20:30 +02:00
|
|
|
prune_invalid_states(StateTable, gl_info, d3d_info);
|
2010-01-28 23:40:24 +01:00
|
|
|
validate_state_table(StateTable);
|
|
|
|
|
2009-01-07 02:20:08 +01:00
|
|
|
return WINED3D_OK;
|
|
|
|
|
|
|
|
out_of_mem:
|
|
|
|
for (i = 0; i <= STATE_HIGHEST; ++i) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, dev_multistate_funcs[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(dev_multistate_funcs, 0, (STATE_HIGHEST + 1)*sizeof(*dev_multistate_funcs));
|
|
|
|
|
|
|
|
return E_OUTOFMEMORY;
|
2008-07-02 01:23:44 +02:00
|
|
|
}
|