2008-08-23 22:41:51 +02:00
|
|
|
|
|
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-03-29 02:36:13 +01:00
|
|
|
|
* Copyright 2006-2008 Stefan D<EFBFBD>singer 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"
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#ifdef HAVE_FLOAT_H
|
|
|
|
|
# include <float.h>
|
|
|
|
|
#endif
|
|
|
|
|
#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
|
|
|
|
|
2007-06-09 14:27:41 +02:00
|
|
|
|
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
|
2006-12-08 20:21:43 +01:00
|
|
|
|
|
2008-02-16 16:42:11 +01:00
|
|
|
|
static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-06 13:22:12 +01:00
|
|
|
|
/* Used for states which are not mapped to a gl state as-is, but used somehow different,
|
|
|
|
|
* e.g as a parameter for drawing, or which are unimplemented in windows d3d
|
|
|
|
|
*/
|
|
|
|
|
if(STATE_IS_RENDER(state)) {
|
|
|
|
|
WINED3DRENDERSTATETYPE RenderState = state - STATE_RENDER(0);
|
|
|
|
|
TRACE("(%s,%d) no direct mapping to gl\n", debug_d3drenderstate(RenderState), stateblock->renderState[RenderState]);
|
|
|
|
|
} else {
|
|
|
|
|
/* Shouldn't have an unknown type here */
|
|
|
|
|
FIXME("%d no direct mapping to gl of state with unknown type\n", state);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-06 13:22:12 +01:00
|
|
|
|
/* Print a WARN, this allows the stateblock code to loop over all states to generate a display
|
|
|
|
|
* list without causing confusing terminal output. Deliberately no special debug name here
|
|
|
|
|
* because its undefined.
|
|
|
|
|
*/
|
|
|
|
|
WARN("undefined state %d\n", state);
|
2006-12-05 23:36:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-02-15 13:32:13 +01:00
|
|
|
|
WINED3DFILLMODE Value = stateblock->renderState[WINED3DRS_FILLMODE];
|
2006-12-05 23:45:35 +01:00
|
|
|
|
|
|
|
|
|
switch(Value) {
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFILL_POINT:
|
2006-12-05 23:45:35 +01:00
|
|
|
|
glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
|
|
|
|
|
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
|
|
|
|
|
break;
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFILL_WIREFRAME:
|
2006-12-05 23:45:35 +01:00
|
|
|
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
|
|
|
|
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
|
|
|
|
|
break;
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFILL_SOLID:
|
2006-12-05 23:45:35 +01:00
|
|
|
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
|
|
|
|
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized WINED3DRS_FILLMODE value %d\n", Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-02-16 19:08:34 +01:00
|
|
|
|
BOOL transformed;
|
2006-12-08 01:39:55 +01:00
|
|
|
|
|
2007-02-16 19:08:34 +01:00
|
|
|
|
/* Lighting is not enabled if transformed vertices are drawn
|
2007-01-02 22:49:17 +01:00
|
|
|
|
* but lighting does not affect the stream sources, so it is not grouped for performance reasons.
|
2008-01-09 20:37:05 +01:00
|
|
|
|
* 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
|
2006-12-08 01:39:55 +01:00
|
|
|
|
*/
|
|
|
|
|
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(isStateDirty(context, STATE_VDECL)) {
|
2007-01-10 11:37:03 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2007-01-02 22:49:17 +01:00
|
|
|
|
|
2007-02-16 19:08:34 +01:00
|
|
|
|
transformed = ((stateblock->wineD3DDevice->strided_streams.u.s.position.lpData != NULL ||
|
|
|
|
|
stateblock->wineD3DDevice->strided_streams.u.s.position.VBO != 0) &&
|
|
|
|
|
stateblock->wineD3DDevice->strided_streams.u.s.position_transformed) ? TRUE : FALSE;
|
2007-01-02 22:49:17 +01:00
|
|
|
|
|
2007-02-16 19:08:34 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_LIGHTING] && !transformed) {
|
2006-12-08 01:39:55 +01:00
|
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
|
checkGLcall("glEnable GL_LIGHTING");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
|
checkGLcall("glDisable GL_LIGHTING");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-03-06 13:54:05 +01:00
|
|
|
|
/* No z test without depth stencil buffers */
|
|
|
|
|
if(stateblock->wineD3DDevice->stencilBufferTarget == NULL) {
|
2007-11-10 00:19:19 +01:00
|
|
|
|
TRACE("No Z buffer - disabling depth test\n");
|
2007-03-06 13:54:05 +01:00
|
|
|
|
glDisable(GL_DEPTH_TEST); /* This also disables z writing in gl */
|
|
|
|
|
checkGLcall("glDisable GL_DEPTH_TEST");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-08 01:40:51 +01:00
|
|
|
|
switch ((WINED3DZBUFFERTYPE) stateblock->renderState[WINED3DRS_ZENABLE]) {
|
|
|
|
|
case WINED3DZB_FALSE:
|
|
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
|
checkGLcall("glDisable GL_DEPTH_TEST");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DZB_TRUE:
|
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
|
checkGLcall("glEnable GL_DEPTH_TEST");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DZB_USEW:
|
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
|
checkGLcall("glEnable GL_DEPTH_TEST");
|
|
|
|
|
FIXME("W buffer is not well handled\n");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized D3DZBUFFERTYPE value %d\n", stateblock->renderState[WINED3DRS_ZENABLE]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-09-18 11:43:09 +02:00
|
|
|
|
/* glFrontFace() is set in context.c at context init and on an offscreen / onscreen rendering
|
|
|
|
|
* switch
|
|
|
|
|
*/
|
2006-12-08 01:41:43 +01:00
|
|
|
|
switch ((WINED3DCULL) stateblock->renderState[WINED3DRS_CULLMODE]) {
|
|
|
|
|
case WINED3DCULL_NONE:
|
|
|
|
|
glDisable(GL_CULL_FACE);
|
|
|
|
|
checkGLcall("glDisable GL_CULL_FACE");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DCULL_CW:
|
|
|
|
|
glEnable(GL_CULL_FACE);
|
|
|
|
|
checkGLcall("glEnable GL_CULL_FACE");
|
2007-09-18 11:43:09 +02:00
|
|
|
|
glCullFace(GL_FRONT);
|
|
|
|
|
checkGLcall("glCullFace(GL_FRONT)");
|
2006-12-08 01:41:43 +01:00
|
|
|
|
break;
|
|
|
|
|
case WINED3DCULL_CCW:
|
|
|
|
|
glEnable(GL_CULL_FACE);
|
|
|
|
|
checkGLcall("glEnable GL_CULL_FACE");
|
|
|
|
|
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:
|
|
|
|
|
FIXME("Unrecognized/Unhandled WINED3DCULL value %d\n", stateblock->renderState[WINED3DRS_CULLMODE]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 01:42:16 +01:00
|
|
|
|
switch ((WINED3DSHADEMODE) stateblock->renderState[WINED3DRS_SHADEMODE]) {
|
|
|
|
|
case WINED3DSHADE_FLAT:
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
checkGLcall("glShadeModel(GL_FLAT)");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DSHADE_GOURAUD:
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
checkGLcall("glShadeModel(GL_SMOOTH)");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DSHADE_PHONG:
|
|
|
|
|
FIXME("WINED3DSHADE_PHONG isn't supported\n");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized/Unhandled WINED3DSHADEMODE value %d\n", stateblock->renderState[WINED3DRS_SHADEMODE]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 01:42:43 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_DITHERENABLE]) {
|
|
|
|
|
glEnable(GL_DITHER);
|
|
|
|
|
checkGLcall("glEnable GL_DITHER");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_DITHER);
|
|
|
|
|
checkGLcall("glDisable GL_DITHER");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 01:43:25 +01:00
|
|
|
|
/* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. If yes,
|
|
|
|
|
* this has to be merged with ZENABLE and ZFUNC
|
|
|
|
|
*/
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_ZWRITEENABLE]) {
|
|
|
|
|
glDepthMask(1);
|
|
|
|
|
checkGLcall("glDepthMask(1)");
|
|
|
|
|
} else {
|
|
|
|
|
glDepthMask(0);
|
|
|
|
|
checkGLcall("glDepthMask(0)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 01:44:55 +01:00
|
|
|
|
int glParm = CompareFunc(stateblock->renderState[WINED3DRS_ZFUNC]);
|
|
|
|
|
|
|
|
|
|
if(glParm) {
|
2007-09-11 15:33:14 +02:00
|
|
|
|
if(glParm == GL_EQUAL || glParm == GL_NOTEQUAL) {
|
2007-10-07 10:57:46 +02:00
|
|
|
|
static BOOL once = FALSE;
|
2007-09-11 15:33:14 +02:00
|
|
|
|
/* There are a few issues with this: First, our inability to
|
|
|
|
|
* select a proper Z depth, most of the time we're stuck with
|
|
|
|
|
* D24S8, even if the app selects D32 or D16. There seem to be
|
|
|
|
|
* some other precision problems which have to be debugged to
|
|
|
|
|
* make NOTEQUAL and EQUAL work properly
|
|
|
|
|
*/
|
2007-10-07 10:57:46 +02:00
|
|
|
|
if(!once) {
|
|
|
|
|
once = TRUE;
|
|
|
|
|
FIXME("D3DCMP_NOTEQUAL and D3DCMP_EQUAL do not work correctly yet\n");
|
|
|
|
|
}
|
2007-09-11 15:33:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-08 01:44:55 +01:00
|
|
|
|
glDepthFunc(glParm);
|
|
|
|
|
checkGLcall("glDepthFunc");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-29 11:35:57 +01:00
|
|
|
|
float col[4];
|
|
|
|
|
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_AMBIENT], col);
|
2006-12-08 01:45:26 +01:00
|
|
|
|
|
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]);
|
|
|
|
|
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
|
2006-12-08 01:45:26 +01:00
|
|
|
|
checkGLcall("glLightModel for MODEL_AMBIENT");
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 01:51:11 +01:00
|
|
|
|
int srcBlend = GL_ZERO;
|
|
|
|
|
int dstBlend = GL_ZERO;
|
2007-12-06 22:33:26 +01:00
|
|
|
|
const StaticPixelFormatDesc *rtFormat;
|
|
|
|
|
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
|
2006-12-08 01:51:11 +01:00
|
|
|
|
|
|
|
|
|
/* GL_LINE_SMOOTH needs GL_BLEND to work, according to the red book, and special blending params */
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_EDGEANTIALIAS] ||
|
2006-12-25 18:46:59 +01:00
|
|
|
|
stateblock->renderState[WINED3DRS_ANTIALIASEDLINEENABLE]) {
|
2008-03-28 10:02:39 +01:00
|
|
|
|
const GlPixelFormatDesc *glDesc;
|
|
|
|
|
getFormatDescEntry(target->resource.format, &GLINFO_LOCATION, &glDesc);
|
|
|
|
|
|
2008-03-29 15:48:15 +01:00
|
|
|
|
/* Disable blending in all cases even without pixelshaders. With blending on we could face a big performance penalty.
|
|
|
|
|
* The d3d9 visual test confirms the behavior. */
|
|
|
|
|
if(!(glDesc->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) {
|
2008-03-28 10:02:39 +01:00
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
checkGLcall("glDisable GL_BLEND");
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
checkGLcall("glEnable GL_BLEND");
|
|
|
|
|
}
|
2006-12-08 01:51:11 +01:00
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
checkGLcall("glDisable GL_BLEND");
|
|
|
|
|
/* Nothing more to do - get out */
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
switch (stateblock->renderState[WINED3DRS_DESTBLEND]) {
|
|
|
|
|
case WINED3DBLEND_ZERO : dstBlend = GL_ZERO; break;
|
|
|
|
|
case WINED3DBLEND_ONE : dstBlend = GL_ONE; break;
|
|
|
|
|
case WINED3DBLEND_SRCCOLOR : dstBlend = GL_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCCOLOR : dstBlend = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_SRCALPHA : dstBlend = GL_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_DESTCOLOR : dstBlend = GL_DST_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVDESTCOLOR : dstBlend = GL_ONE_MINUS_DST_COLOR; break;
|
2007-08-12 21:38:24 +02:00
|
|
|
|
|
2007-12-06 22:33:26 +01:00
|
|
|
|
/* To compensate 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 doesn't support alpha blending. A nonexistent alpha channel
|
|
|
|
|
* returns 1.0, so D3DBLEND_DESTALPHA is GL_ONE, and D3DBLEND_INVDESTALPHA is GL_ZERO
|
|
|
|
|
*/
|
|
|
|
|
case WINED3DBLEND_DESTALPHA :
|
|
|
|
|
rtFormat = getFormatDescEntry(target->resource.format, NULL, NULL);
|
|
|
|
|
dstBlend = rtFormat->alphaMask ? GL_DST_ALPHA : GL_ONE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DBLEND_INVDESTALPHA :
|
|
|
|
|
rtFormat = getFormatDescEntry(target->resource.format, NULL, NULL);
|
|
|
|
|
dstBlend = rtFormat->alphaMask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
|
|
|
|
break;
|
|
|
|
|
|
2007-08-12 21:38:24 +02:00
|
|
|
|
case WINED3DBLEND_SRCALPHASAT :
|
|
|
|
|
dstBlend = GL_SRC_ALPHA_SATURATE;
|
|
|
|
|
WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n");
|
|
|
|
|
break;
|
2006-12-08 01:51:11 +01:00
|
|
|
|
|
2007-08-12 21:44:30 +02:00
|
|
|
|
/* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending
|
|
|
|
|
* values which are still valid up to d3d9. They should not occur as dest blend values
|
|
|
|
|
*/
|
2006-12-08 01:51:11 +01:00
|
|
|
|
case WINED3DBLEND_BOTHSRCALPHA : dstBlend = GL_SRC_ALPHA;
|
|
|
|
|
srcBlend = GL_SRC_ALPHA;
|
2007-08-12 21:44:30 +02:00
|
|
|
|
FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHSRCALPHA, what to do?\n");
|
2006-12-08 01:51:11 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DBLEND_BOTHINVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
|
srcBlend = GL_ONE_MINUS_SRC_ALPHA;
|
2007-08-12 21:44:30 +02:00
|
|
|
|
FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n");
|
2006-12-08 01:51:11 +01:00
|
|
|
|
break;
|
|
|
|
|
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DBLEND_BLENDFACTOR : dstBlend = GL_CONSTANT_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVBLENDFACTOR : dstBlend = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
2006-12-08 01:51:11 +01:00
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized dst blend value %d\n", stateblock->renderState[WINED3DRS_DESTBLEND]);
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-12 21:44:30 +02:00
|
|
|
|
switch (stateblock->renderState[WINED3DRS_SRCBLEND]) {
|
|
|
|
|
case WINED3DBLEND_ZERO : srcBlend = GL_ZERO; break;
|
|
|
|
|
case WINED3DBLEND_ONE : srcBlend = GL_ONE; break;
|
|
|
|
|
case WINED3DBLEND_SRCCOLOR : srcBlend = GL_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCCOLOR : srcBlend = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_SRCALPHA : srcBlend = GL_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_DESTCOLOR : srcBlend = GL_DST_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVDESTCOLOR : srcBlend = GL_ONE_MINUS_DST_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_SRCALPHASAT : srcBlend = GL_SRC_ALPHA_SATURATE; break;
|
|
|
|
|
|
2007-12-06 22:33:26 +01:00
|
|
|
|
case WINED3DBLEND_DESTALPHA :
|
|
|
|
|
rtFormat = getFormatDescEntry(target->resource.format, NULL, NULL);
|
|
|
|
|
srcBlend = rtFormat->alphaMask ? GL_DST_ALPHA : GL_ONE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DBLEND_INVDESTALPHA :
|
|
|
|
|
rtFormat = getFormatDescEntry(target->resource.format, NULL, NULL);
|
|
|
|
|
srcBlend = rtFormat->alphaMask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
|
|
|
|
break;
|
|
|
|
|
|
2007-08-12 21:44:30 +02:00
|
|
|
|
case WINED3DBLEND_BOTHSRCALPHA : srcBlend = GL_SRC_ALPHA;
|
|
|
|
|
dstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DBLEND_BOTHINVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
|
dstBlend = GL_SRC_ALPHA;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DBLEND_BLENDFACTOR : srcBlend = GL_CONSTANT_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVBLENDFACTOR : srcBlend = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized src blend value %d\n", stateblock->renderState[WINED3DRS_SRCBLEND]);
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-08 01:51:11 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_EDGEANTIALIAS] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_ANTIALIASEDLINEENABLE]) {
|
|
|
|
|
glEnable(GL_LINE_SMOOTH);
|
|
|
|
|
checkGLcall("glEnable(GL_LINE_SMOOTH)");
|
|
|
|
|
if(srcBlend != GL_SRC_ALPHA) {
|
2007-07-23 21:35:15 +02:00
|
|
|
|
WARN("WINED3DRS_EDGEANTIALIAS enabled, but unexpected src blending param\n");
|
2006-12-08 01:51:11 +01:00
|
|
|
|
}
|
2007-07-23 21:35:15 +02:00
|
|
|
|
if(dstBlend != GL_ONE_MINUS_SRC_ALPHA && dstBlend != GL_ONE) {
|
|
|
|
|
WARN("WINED3DRS_EDGEANTIALIAS enabled, but unexpected dst blending param\n");
|
2006-12-08 01:51:11 +01:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_LINE_SMOOTH);
|
|
|
|
|
checkGLcall("glDisable(GL_LINE_SMOOTH)");
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-16 16:42:11 +01:00
|
|
|
|
/* Re-apply BLENDOP(ALPHA) because of a possible SEPARATEALPHABLENDENABLE change */
|
|
|
|
|
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_BLENDOP))) {
|
|
|
|
|
state_blendop(STATE_RENDER(WINED3DRS_BLENDOPALPHA), stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_SEPARATEALPHABLENDENABLE]) {
|
|
|
|
|
int srcBlendAlpha = GL_ZERO;
|
|
|
|
|
int dstBlendAlpha = GL_ZERO;
|
|
|
|
|
|
|
|
|
|
/* Separate alpha blending requires GL_EXT_blend_function_separate, so make sure it is around */
|
|
|
|
|
if(!GL_SUPPORT(EXT_BLEND_FUNC_SEPARATE)) {
|
|
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendFuncSeparateEXT\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (stateblock->renderState[WINED3DRS_DESTBLENDALPHA]) {
|
|
|
|
|
case WINED3DBLEND_ZERO : dstBlendAlpha = GL_ZERO; break;
|
|
|
|
|
case WINED3DBLEND_ONE : dstBlendAlpha = GL_ONE; break;
|
|
|
|
|
case WINED3DBLEND_SRCCOLOR : dstBlendAlpha = GL_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCCOLOR : dstBlendAlpha = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_SRCALPHA : dstBlendAlpha = GL_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCALPHA : dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_DESTCOLOR : dstBlendAlpha = GL_DST_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVDESTCOLOR : dstBlendAlpha = GL_ONE_MINUS_DST_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_DESTALPHA : dstBlendAlpha = GL_DST_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_INVDESTALPHA : dstBlendAlpha = GL_DST_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_SRCALPHASAT :
|
|
|
|
|
dstBlend = GL_SRC_ALPHA_SATURATE;
|
|
|
|
|
WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n");
|
|
|
|
|
break;
|
|
|
|
|
/* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending
|
|
|
|
|
* values which are still valid up to d3d9. They should not occur as dest blend values
|
|
|
|
|
*/
|
|
|
|
|
case WINED3DBLEND_BOTHSRCALPHA :
|
|
|
|
|
dstBlendAlpha = GL_SRC_ALPHA;
|
|
|
|
|
srcBlendAlpha = GL_SRC_ALPHA;
|
|
|
|
|
FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHSRCALPHA, what to do?\n");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DBLEND_BOTHINVSRCALPHA :
|
|
|
|
|
dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
|
srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
|
FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DBLEND_BLENDFACTOR : dstBlendAlpha = GL_CONSTANT_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVBLENDFACTOR : dstBlendAlpha = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized dst blend alpha value %d\n", stateblock->renderState[WINED3DRS_DESTBLENDALPHA]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (stateblock->renderState[WINED3DRS_SRCBLENDALPHA]) {
|
|
|
|
|
case WINED3DBLEND_ZERO : srcBlendAlpha = GL_ZERO; break;
|
|
|
|
|
case WINED3DBLEND_ONE : srcBlendAlpha = GL_ONE; break;
|
|
|
|
|
case WINED3DBLEND_SRCCOLOR : srcBlendAlpha = GL_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCCOLOR : srcBlendAlpha = GL_ONE_MINUS_SRC_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_SRCALPHA : srcBlendAlpha = GL_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_INVSRCALPHA : srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_DESTCOLOR : srcBlendAlpha = GL_DST_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVDESTCOLOR : srcBlendAlpha = GL_ONE_MINUS_DST_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_SRCALPHASAT : srcBlendAlpha = GL_SRC_ALPHA_SATURATE; break;
|
|
|
|
|
case WINED3DBLEND_DESTALPHA : srcBlendAlpha = GL_DST_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_INVDESTALPHA : srcBlendAlpha = GL_DST_ALPHA; break;
|
|
|
|
|
case WINED3DBLEND_BOTHSRCALPHA :
|
|
|
|
|
srcBlendAlpha = GL_SRC_ALPHA;
|
|
|
|
|
dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DBLEND_BOTHINVSRCALPHA :
|
|
|
|
|
srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
|
|
|
|
dstBlendAlpha = GL_SRC_ALPHA;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DBLEND_BLENDFACTOR : srcBlendAlpha = GL_CONSTANT_COLOR; break;
|
|
|
|
|
case WINED3DBLEND_INVBLENDFACTOR : srcBlendAlpha = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized src blend alpha value %d\n", stateblock->renderState[WINED3DRS_SRCBLENDALPHA]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GL_EXTCALL(glBlendFuncSeparateEXT(srcBlend, dstBlend, srcBlendAlpha, dstBlendAlpha));
|
|
|
|
|
checkGLcall("glBlendFuncSeparateEXT");
|
|
|
|
|
} else {
|
|
|
|
|
TRACE("glBlendFunc src=%x, dst=%x\n", srcBlend, dstBlend);
|
|
|
|
|
glBlendFunc(srcBlend, dstBlend);
|
|
|
|
|
checkGLcall("glBlendFunc");
|
|
|
|
|
}
|
2008-01-21 05:17:49 +01:00
|
|
|
|
|
|
|
|
|
/* colorkey fixup for stage 0 alphaop depends on WINED3DRS_ALPHABLENDENABLE state,
|
|
|
|
|
so it may need updating */
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_COLORKEYENABLE]) {
|
2008-07-02 01:23:44 +02:00
|
|
|
|
const struct StateEntry *StateTable = stateblock->wineD3DDevice->StateTable;
|
2008-03-22 14:31:52 +01:00
|
|
|
|
StateTable[STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP)].apply(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), stateblock, context);
|
2008-01-21 05:17:49 +01:00
|
|
|
|
}
|
2006-12-25 18:46:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:35:53 +02:00
|
|
|
|
static void state_blendfactor_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendColorEXT\n");
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-25 18:46:59 +01:00
|
|
|
|
float col[4];
|
2006-12-08 01:51:11 +01:00
|
|
|
|
|
|
|
|
|
TRACE("Setting BlendFactor to %d\n", stateblock->renderState[WINED3DRS_BLENDFACTOR]);
|
|
|
|
|
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_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");
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 20:21:32 +01:00
|
|
|
|
int glParm = 0;
|
|
|
|
|
float ref;
|
|
|
|
|
BOOL enable_ckey = FALSE;
|
|
|
|
|
|
|
|
|
|
IWineD3DSurfaceImpl *surf;
|
|
|
|
|
|
|
|
|
|
/* 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 WINED3DRS_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.
|
|
|
|
|
*/
|
2007-11-27 22:25:07 +01:00
|
|
|
|
if(stateblock->textures[0] && (
|
|
|
|
|
stateblock->textureDimensions[0] == GL_TEXTURE_2D ||
|
|
|
|
|
stateblock->textureDimensions[0] == GL_TEXTURE_RECTANGLE_ARB)) {
|
2006-12-08 20:21:32 +01:00
|
|
|
|
surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *)stateblock->textures[0])->surfaces[0];
|
2007-02-15 03:05:54 +01:00
|
|
|
|
|
2007-04-14 22:44:55 +02:00
|
|
|
|
if(surf->CKeyFlags & WINEDDSD_CKSRCBLT) {
|
2007-07-27 13:22:54 +02:00
|
|
|
|
const StaticPixelFormatDesc *fmt = getFormatDescEntry(surf->resource.format, NULL, NULL);
|
2007-02-15 03:05:54 +01:00
|
|
|
|
/* The surface conversion does not do color keying conversion for surfaces that have an alpha
|
|
|
|
|
* channel on their own. Likewise, the alpha test shouldn't be set up for color keying if the
|
|
|
|
|
* surface has alpha bits
|
|
|
|
|
*/
|
|
|
|
|
if(fmt->alphaMask == 0x00000000) {
|
|
|
|
|
enable_ckey = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-08 20:21:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-15 03:04:18 +01:00
|
|
|
|
if(enable_ckey || context->last_was_ckey) {
|
2008-07-02 01:23:44 +02:00
|
|
|
|
const struct StateEntry *StateTable = stateblock->wineD3DDevice->StateTable;
|
2008-03-22 14:31:52 +01:00
|
|
|
|
StateTable[STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP)].apply(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), stateblock, context);
|
2007-02-15 03:04:18 +01:00
|
|
|
|
}
|
|
|
|
|
context->last_was_ckey = enable_ckey;
|
|
|
|
|
|
2006-12-08 20:21:32 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_ALPHATESTENABLE] ||
|
|
|
|
|
(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && enable_ckey)) {
|
|
|
|
|
glEnable(GL_ALPHA_TEST);
|
|
|
|
|
checkGLcall("glEnable GL_ALPHA_TEST");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_ALPHA_TEST);
|
|
|
|
|
checkGLcall("glDisable GL_ALPHA_TEST");
|
|
|
|
|
/* Alpha test is disabled, don't bother setting the params - it will happen on the next
|
|
|
|
|
* enable call
|
|
|
|
|
*/
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && enable_ckey) {
|
|
|
|
|
glParm = GL_NOTEQUAL;
|
|
|
|
|
ref = 0.0;
|
|
|
|
|
} else {
|
|
|
|
|
ref = ((float) stateblock->renderState[WINED3DRS_ALPHAREF]) / 255.0f;
|
|
|
|
|
glParm = CompareFunc(stateblock->renderState[WINED3DRS_ALPHAFUNC]);
|
|
|
|
|
}
|
|
|
|
|
if(glParm) {
|
|
|
|
|
glAlphaFunc(glParm, ref);
|
|
|
|
|
checkGLcall("glAlphaFunc");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 18:01:23 +01:00
|
|
|
|
DWORD enable = 0xFFFFFFFF;
|
|
|
|
|
DWORD disable = 0x00000000;
|
|
|
|
|
|
2007-03-12 23:22:00 +01:00
|
|
|
|
if (use_vs(stateblock->wineD3DDevice)) {
|
2007-02-27 23:11:15 +01:00
|
|
|
|
/* The spec says that opengl 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
|
2008-01-09 20:37:05 +01:00
|
|
|
|
* conditions I got sick of tracking down. The shader state handler disables all clip planes because
|
2007-02-27 23:11:15 +01:00
|
|
|
|
* of that - don't do anything here and keep them disabled
|
|
|
|
|
*/
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]) {
|
|
|
|
|
static BOOL warned = FALSE;
|
|
|
|
|
if(!warned) {
|
|
|
|
|
FIXME("Clipping not supported with vertex shaders\n");
|
|
|
|
|
warned = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
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?
|
|
|
|
|
*/
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_CLIPPING]) {
|
|
|
|
|
enable = stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
|
|
|
|
|
disable = ~stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
|
2007-09-11 16:41:01 +02:00
|
|
|
|
if(GL_SUPPORT(NV_DEPTH_CLAMP)) {
|
|
|
|
|
glDisable(GL_DEPTH_CLAMP_NV);
|
|
|
|
|
checkGLcall("glDisable(GL_DEPTH_CLAMP_NV)");
|
|
|
|
|
}
|
2006-12-08 18:01:23 +01:00
|
|
|
|
} else {
|
|
|
|
|
disable = 0xffffffff;
|
|
|
|
|
enable = 0x00;
|
2007-09-11 16:41:01 +02:00
|
|
|
|
if(GL_SUPPORT(NV_DEPTH_CLAMP)) {
|
|
|
|
|
glEnable(GL_DEPTH_CLAMP_NV);
|
|
|
|
|
checkGLcall("glEnable(GL_DEPTH_CLAMP_NV)");
|
|
|
|
|
}
|
2006-12-08 18:01:23 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (enable & WINED3DCLIPPLANE0) { glEnable(GL_CLIP_PLANE0); checkGLcall("glEnable(clip plane 0)"); }
|
|
|
|
|
if (enable & WINED3DCLIPPLANE1) { glEnable(GL_CLIP_PLANE1); checkGLcall("glEnable(clip plane 1)"); }
|
|
|
|
|
if (enable & WINED3DCLIPPLANE2) { glEnable(GL_CLIP_PLANE2); checkGLcall("glEnable(clip plane 2)"); }
|
|
|
|
|
if (enable & WINED3DCLIPPLANE3) { glEnable(GL_CLIP_PLANE3); checkGLcall("glEnable(clip plane 3)"); }
|
|
|
|
|
if (enable & WINED3DCLIPPLANE4) { glEnable(GL_CLIP_PLANE4); checkGLcall("glEnable(clip plane 4)"); }
|
|
|
|
|
if (enable & WINED3DCLIPPLANE5) { glEnable(GL_CLIP_PLANE5); checkGLcall("glEnable(clip plane 5)"); }
|
|
|
|
|
|
|
|
|
|
if (disable & WINED3DCLIPPLANE0) { glDisable(GL_CLIP_PLANE0); checkGLcall("glDisable(clip plane 0)"); }
|
|
|
|
|
if (disable & WINED3DCLIPPLANE1) { glDisable(GL_CLIP_PLANE1); checkGLcall("glDisable(clip plane 1)"); }
|
|
|
|
|
if (disable & WINED3DCLIPPLANE2) { glDisable(GL_CLIP_PLANE2); checkGLcall("glDisable(clip plane 2)"); }
|
|
|
|
|
if (disable & WINED3DCLIPPLANE3) { glDisable(GL_CLIP_PLANE3); checkGLcall("glDisable(clip plane 3)"); }
|
|
|
|
|
if (disable & WINED3DCLIPPLANE4) { glDisable(GL_CLIP_PLANE4); checkGLcall("glDisable(clip plane 4)"); }
|
|
|
|
|
if (disable & WINED3DCLIPPLANE5) { glDisable(GL_CLIP_PLANE5); checkGLcall("glDisable(clip plane 5)"); }
|
|
|
|
|
|
|
|
|
|
/** update clipping status */
|
|
|
|
|
if (enable) {
|
|
|
|
|
stateblock->clip_status.ClipUnion = 0;
|
|
|
|
|
stateblock->clip_status.ClipIntersection = 0xFFFFFFFF;
|
|
|
|
|
} else {
|
|
|
|
|
stateblock->clip_status.ClipUnion = 0;
|
|
|
|
|
stateblock->clip_status.ClipIntersection = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:35:53 +02:00
|
|
|
|
static void state_blendop_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2008-02-16 16:42:11 +01:00
|
|
|
|
int blendEquation = GL_FUNC_ADD;
|
|
|
|
|
int blendEquationAlpha = GL_FUNC_ADD;
|
2006-12-08 20:21:43 +01:00
|
|
|
|
|
2008-02-16 16:42:11 +01:00
|
|
|
|
/* BLENDOPALPHA requires GL_EXT_blend_equation_separate, so make sure it is around */
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_BLENDOPALPHA] && !GL_SUPPORT(EXT_BLEND_EQUATION_SEPARATE)) {
|
|
|
|
|
WARN("Unsupported in local OpenGL implementation: glBlendEquationSeparateEXT\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-08 20:21:43 +01:00
|
|
|
|
switch ((WINED3DBLENDOP) stateblock->renderState[WINED3DRS_BLENDOP]) {
|
2008-02-16 16:42:11 +01:00
|
|
|
|
case WINED3DBLENDOP_ADD : blendEquation = GL_FUNC_ADD; break;
|
|
|
|
|
case WINED3DBLENDOP_SUBTRACT : blendEquation = GL_FUNC_SUBTRACT; break;
|
|
|
|
|
case WINED3DBLENDOP_REVSUBTRACT : blendEquation = GL_FUNC_REVERSE_SUBTRACT; break;
|
|
|
|
|
case WINED3DBLENDOP_MIN : blendEquation = GL_MIN; break;
|
|
|
|
|
case WINED3DBLENDOP_MAX : blendEquation = GL_MAX; break;
|
2006-12-08 20:21:43 +01:00
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock->renderState[WINED3DRS_BLENDOP]);
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-16 16:42:11 +01:00
|
|
|
|
switch ((WINED3DBLENDOP) stateblock->renderState[WINED3DRS_BLENDOPALPHA]) {
|
|
|
|
|
case WINED3DBLENDOP_ADD : blendEquationAlpha = GL_FUNC_ADD; break;
|
|
|
|
|
case WINED3DBLENDOP_SUBTRACT : blendEquationAlpha = GL_FUNC_SUBTRACT; break;
|
|
|
|
|
case WINED3DBLENDOP_REVSUBTRACT : blendEquationAlpha = GL_FUNC_REVERSE_SUBTRACT; break;
|
|
|
|
|
case WINED3DBLENDOP_MIN : blendEquationAlpha = GL_MIN; break;
|
|
|
|
|
case WINED3DBLENDOP_MAX : blendEquationAlpha = GL_MAX; break;
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock->renderState[WINED3DRS_BLENDOPALPHA]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_SEPARATEALPHABLENDENABLE]) {
|
|
|
|
|
TRACE("glBlendEquationSeparateEXT(%x, %x)\n", blendEquation, blendEquationAlpha);
|
|
|
|
|
GL_EXTCALL(glBlendEquationSeparateEXT(blendEquation, blendEquationAlpha));
|
|
|
|
|
checkGLcall("glBlendEquationSeparateEXT");
|
|
|
|
|
} else {
|
|
|
|
|
TRACE("glBlendEquation(%x)\n", blendEquation);
|
|
|
|
|
GL_EXTCALL(glBlendEquationEXT(blendEquation));
|
|
|
|
|
checkGLcall("glBlendEquation");
|
|
|
|
|
}
|
2006-12-08 20:21:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-08 18:38:30 +01:00
|
|
|
|
static void
|
2007-02-12 19:18:22 +01:00
|
|
|
|
state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
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
|
|
|
|
|
* whether WINED3DRS_SPECULARENABLE is enabled or not.
|
|
|
|
|
*/
|
|
|
|
|
|
2007-06-15 21:33:54 +02:00
|
|
|
|
TRACE("Setting specular enable state and materials\n");
|
2006-12-08 18:38:30 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_SPECULARENABLE]) {
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &stateblock->material.Specular);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
2007-06-15 22:38:14 +02:00
|
|
|
|
|
2008-03-02 00:02:18 +01:00
|
|
|
|
if(stateblock->material.Power > GL_LIMITS(shininess)) {
|
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
|
|
|
|
|
* allows bigger values. If the extension is supported, GL_LIMITS(shininess) contains the
|
|
|
|
|
* value reported by the extension, otherwise 128. For values > GL_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
|
|
|
|
*/
|
2008-03-02 00:02:18 +01:00
|
|
|
|
WARN("Material power = %f, limit %f\n", stateblock->material.Power, GL_LIMITS(shininess));
|
|
|
|
|
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, GL_LIMITS(shininess));
|
2007-06-15 22:38:14 +02:00
|
|
|
|
} else {
|
|
|
|
|
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, stateblock->material.Power);
|
|
|
|
|
}
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glMaterialf(GL_SHININESS)");
|
2007-06-15 22:38:14 +02:00
|
|
|
|
|
2006-12-08 18:38:30 +01:00
|
|
|
|
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
|
|
|
|
glEnable(GL_COLOR_SUM_EXT);
|
|
|
|
|
} else {
|
|
|
|
|
TRACE("Specular colors cannot be enabled in this version of opengl\n");
|
|
|
|
|
}
|
|
|
|
|
checkGLcall("glEnable(GL_COLOR_SUM)");
|
|
|
|
|
|
|
|
|
|
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
|
|
|
|
|
GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_PLUS_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB));
|
|
|
|
|
checkGLcall("glFinalCombinerInputNV()");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
|
|
|
|
|
|
|
|
|
/* for the case of enabled lighting: */
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
|
|
|
|
|
/* for the case of disabled lighting: */
|
|
|
|
|
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
|
|
|
|
glDisable(GL_COLOR_SUM_EXT);
|
|
|
|
|
} else {
|
|
|
|
|
TRACE("Specular colors cannot be disabled in this version of opengl\n");
|
|
|
|
|
}
|
|
|
|
|
checkGLcall("glDisable(GL_COLOR_SUM)");
|
|
|
|
|
|
|
|
|
|
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
TRACE("(%p) : Diffuse (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Diffuse.r, stateblock->material.Diffuse.g,
|
|
|
|
|
stateblock->material.Diffuse.b, stateblock->material.Diffuse.a);
|
|
|
|
|
TRACE("(%p) : Ambient (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Ambient.r, stateblock->material.Ambient.g,
|
|
|
|
|
stateblock->material.Ambient.b, stateblock->material.Ambient.a);
|
|
|
|
|
TRACE("(%p) : Specular (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Specular.r, stateblock->material.Specular.g,
|
|
|
|
|
stateblock->material.Specular.b, stateblock->material.Specular.a);
|
|
|
|
|
TRACE("(%p) : Emissive (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Emissive.r, stateblock->material.Emissive.g,
|
|
|
|
|
stateblock->material.Emissive.b, stateblock->material.Emissive.a);
|
|
|
|
|
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*) &stateblock->material.Ambient);
|
|
|
|
|
checkGLcall("glMaterialfv(GL_AMBIENT)");
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) &stateblock->material.Diffuse);
|
|
|
|
|
checkGLcall("glMaterialfv(GL_DIFFUSE)");
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) &stateblock->material.Emissive);
|
|
|
|
|
checkGLcall("glMaterialfv(GL_EMISSION)");
|
2006-12-08 18:38:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 18:37:17 +01:00
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
/* Note the texture color applies to all textures whereas
|
|
|
|
|
* GL_TEXTURE_ENV_COLOR applies to active only
|
|
|
|
|
*/
|
2006-12-29 11:35:57 +01:00
|
|
|
|
float col[4];
|
|
|
|
|
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_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 */
|
|
|
|
|
for (i = 0; i < GL_LIMITS(texture_stages); i++) {
|
|
|
|
|
/* Note the WINED3DRS value applies to all textures, but GL has one
|
|
|
|
|
* per texture, so apply it now ready to be used!
|
|
|
|
|
*/
|
|
|
|
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
|
|
|
|
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
|
|
|
|
|
checkGLcall("glActiveTextureARB");
|
|
|
|
|
} else if (i>0) {
|
|
|
|
|
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
2006-12-08 18:37:17 +01:00
|
|
|
|
}
|
2008-07-06 01:31:34 +02:00
|
|
|
|
|
|
|
|
|
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
|
|
|
|
|
checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
|
2006-12-08 18:37:17 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-08 18:39:45 +01:00
|
|
|
|
static void
|
|
|
|
|
renderstate_stencil_twosided(IWineD3DStateBlockImpl *stateblock, GLint face, GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass ) {
|
2008-04-23 21:53:59 +02:00
|
|
|
|
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
|
|
|
|
checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
|
|
|
|
|
GL_EXTCALL(glActiveStencilFaceEXT(face));
|
|
|
|
|
checkGLcall("glActiveStencilFaceEXT(...)");
|
|
|
|
|
glStencilFunc(func, ref, mask);
|
|
|
|
|
checkGLcall("glStencilFunc(...)");
|
|
|
|
|
glStencilOp(stencilFail, depthFail, stencilPass);
|
|
|
|
|
checkGLcall("glStencilOp(...)");
|
2006-12-08 18:39:45 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2007-02-12 19:18:22 +01:00
|
|
|
|
state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 18:39:45 +01:00
|
|
|
|
DWORD onesided_enable = FALSE;
|
|
|
|
|
DWORD twosided_enable = FALSE;
|
|
|
|
|
GLint func = GL_ALWAYS;
|
|
|
|
|
GLint func_ccw = GL_ALWAYS;
|
|
|
|
|
GLint ref = 0;
|
|
|
|
|
GLuint mask = 0;
|
|
|
|
|
GLint stencilFail = GL_KEEP;
|
|
|
|
|
GLint depthFail = GL_KEEP;
|
|
|
|
|
GLint stencilPass = GL_KEEP;
|
|
|
|
|
GLint stencilFail_ccw = GL_KEEP;
|
|
|
|
|
GLint depthFail_ccw = GL_KEEP;
|
|
|
|
|
GLint stencilPass_ccw = GL_KEEP;
|
|
|
|
|
|
2007-03-06 13:54:05 +01:00
|
|
|
|
/* No stencil test without a stencil buffer */
|
|
|
|
|
if(stateblock->wineD3DDevice->stencilBufferTarget == NULL) {
|
|
|
|
|
glDisable(GL_STENCIL_TEST);
|
|
|
|
|
checkGLcall("glDisable GL_STENCIL_TEST");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-30 19:28:33 +02:00
|
|
|
|
onesided_enable = stateblock->renderState[WINED3DRS_STENCILENABLE];
|
|
|
|
|
twosided_enable = stateblock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE];
|
|
|
|
|
if( !( func = CompareFunc(stateblock->renderState[WINED3DRS_STENCILFUNC]) ) )
|
|
|
|
|
func = GL_ALWAYS;
|
|
|
|
|
if( !( func_ccw = CompareFunc(stateblock->renderState[WINED3DRS_CCW_STENCILFUNC]) ) )
|
2007-09-14 11:57:42 +02:00
|
|
|
|
func_ccw = GL_ALWAYS;
|
2007-07-30 19:28:33 +02:00
|
|
|
|
ref = stateblock->renderState[WINED3DRS_STENCILREF];
|
|
|
|
|
mask = stateblock->renderState[WINED3DRS_STENCILMASK];
|
|
|
|
|
stencilFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILFAIL]);
|
|
|
|
|
depthFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILZFAIL]);
|
|
|
|
|
stencilPass = StencilOp(stateblock->renderState[WINED3DRS_STENCILPASS]);
|
|
|
|
|
stencilFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILFAIL]);
|
|
|
|
|
depthFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILZFAIL]);
|
|
|
|
|
stencilPass_ccw = StencilOp(stateblock->renderState[WINED3DRS_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);
|
|
|
|
|
|
2007-09-14 12:00:46 +02:00
|
|
|
|
if (twosided_enable && onesided_enable) {
|
|
|
|
|
glEnable(GL_STENCIL_TEST);
|
|
|
|
|
checkGLcall("glEnable GL_STENCIL_TEST");
|
|
|
|
|
|
2008-04-23 21:53:59 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
|
|
|
|
|
/* 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
|
|
|
|
|
*/
|
|
|
|
|
renderstate_stencil_twosided(stateblock, GL_BACK, func_ccw, ref, mask,
|
|
|
|
|
stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
|
|
|
|
|
renderstate_stencil_twosided(stateblock, GL_FRONT, func, ref, mask,
|
|
|
|
|
stencilFail, depthFail, stencilPass);
|
|
|
|
|
} else if(GL_SUPPORT(ATI_SEPARATE_STENCIL)) {
|
|
|
|
|
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");
|
|
|
|
|
}
|
2007-09-14 12:02:56 +02:00
|
|
|
|
} else if(onesided_enable) {
|
|
|
|
|
if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
|
|
|
|
|
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
|
|
|
|
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
|
|
|
|
|
*/
|
2007-09-14 12:02:56 +02:00
|
|
|
|
glEnable(GL_STENCIL_TEST);
|
|
|
|
|
checkGLcall("glEnable GL_STENCIL_TEST");
|
|
|
|
|
glStencilFunc(func, ref, mask);
|
|
|
|
|
checkGLcall("glStencilFunc(...)");
|
|
|
|
|
glStencilOp(stencilFail, depthFail, stencilPass);
|
|
|
|
|
checkGLcall("glStencilOp(...)");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_STENCIL_TEST);
|
|
|
|
|
checkGLcall("glDisable GL_STENCIL_TEST");
|
2006-12-08 18:39:45 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:35:53 +02:00
|
|
|
|
static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-09-14 11:57:07 +02:00
|
|
|
|
DWORD mask;
|
|
|
|
|
|
2007-03-06 13:54:05 +01:00
|
|
|
|
if(stateblock->wineD3DDevice->stencilBufferTarget) {
|
2007-09-14 11:57:07 +02:00
|
|
|
|
mask = stateblock->renderState[WINED3DRS_STENCILWRITEMASK];
|
|
|
|
|
} else {
|
|
|
|
|
mask = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:35:53 +02:00
|
|
|
|
GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK));
|
|
|
|
|
checkGLcall("glActiveStencilFaceEXT(GL_BACK)");
|
|
|
|
|
glStencilMask(mask);
|
|
|
|
|
checkGLcall("glStencilMask");
|
|
|
|
|
GL_EXTCALL(glActiveStencilFaceEXT(GL_FRONT));
|
|
|
|
|
checkGLcall("glActiveStencilFaceEXT(GL_FRONT)");
|
|
|
|
|
glStencilMask(mask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
DWORD mask;
|
|
|
|
|
|
|
|
|
|
if(stateblock->wineD3DDevice->stencilBufferTarget) {
|
|
|
|
|
mask = stateblock->renderState[WINED3DRS_STENCILWRITEMASK];
|
2007-03-06 13:54:05 +01:00
|
|
|
|
} else {
|
2008-07-05 22:35:53 +02:00
|
|
|
|
mask = 0;
|
2007-03-06 13:54:05 +01:00
|
|
|
|
}
|
2008-07-05 22:35:53 +02:00
|
|
|
|
|
|
|
|
|
glStencilMask(mask);
|
2006-12-08 18:41:05 +01:00
|
|
|
|
checkGLcall("glStencilMask");
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
BOOL fogenable = stateblock->renderState[WINED3DRS_FOGENABLE];
|
2007-03-22 17:32:48 +01:00
|
|
|
|
BOOL is_ps3 = use_ps(stateblock->wineD3DDevice)
|
|
|
|
|
&& ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.hex_version >= WINED3DPS_VERSION(3,0);
|
2006-12-08 18:42:43 +01:00
|
|
|
|
float fogstart, fogend;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
|
|
|
|
if (!fogenable) {
|
|
|
|
|
/* No fog? Disable it, and we're done :-) */
|
|
|
|
|
glDisable(GL_FOG);
|
|
|
|
|
checkGLcall("glDisable GL_FOG");
|
2007-03-22 17:32:48 +01:00
|
|
|
|
if( use_ps(stateblock->wineD3DDevice)
|
|
|
|
|
&& ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.hex_version < WINED3DPS_VERSION(3,0) ) {
|
|
|
|
|
/* disable fog in the pixel shader
|
|
|
|
|
* NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but
|
|
|
|
|
* -1/(e-s) and e/(e-s) respectively.
|
|
|
|
|
*/
|
|
|
|
|
glFogf(GL_FOG_START, 0.0f);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_START, fogstart)");
|
2007-03-22 17:32:48 +01:00
|
|
|
|
glFogf(GL_FOG_END, 1.0f);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_END, fogend)");
|
2007-03-22 17:32:48 +01:00
|
|
|
|
}
|
2007-02-25 23:58:14 +01:00
|
|
|
|
return;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_FOGSTART];
|
|
|
|
|
fogstart = tmpvalue.f;
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_FOGEND];
|
|
|
|
|
fogend = tmpvalue.f;
|
|
|
|
|
|
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.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
|
|
|
|
if( is_ps3 ) {
|
|
|
|
|
if( !use_vs(stateblock->wineD3DDevice)
|
|
|
|
|
&& stateblock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE ) {
|
|
|
|
|
FIXME("Implement vertex fog for pixel shader >= 3.0 and fixed function pipeline\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-12 23:22:00 +01:00
|
|
|
|
if (use_vs(stateblock->wineD3DDevice)
|
2007-04-20 21:49:21 +02:00
|
|
|
|
&& ((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.reg_maps.fog) {
|
2007-03-22 17:32:48 +01:00
|
|
|
|
if( stateblock->renderState[WINED3DRS_FOGTABLEMODE] != WINED3DFOG_NONE ) {
|
|
|
|
|
if(!is_ps3) FIXME("Implement table fog for foggy vertex shader\n");
|
|
|
|
|
/* Disable fog */
|
|
|
|
|
fogenable = FALSE;
|
|
|
|
|
} else {
|
|
|
|
|
/* Set fog computation in the rasterizer to pass through the value (just blend it) */
|
|
|
|
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
2007-02-26 02:03:00 +01:00
|
|
|
|
fogstart = 1.0;
|
|
|
|
|
fogend = 0.0;
|
|
|
|
|
}
|
2007-08-13 23:19:37 +02:00
|
|
|
|
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2007-08-13 23:19:37 +02:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2007-08-13 23:19:37 +02:00
|
|
|
|
}
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->last_was_foggy_shader = TRUE;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
2007-03-22 17:32:48 +01:00
|
|
|
|
else if( use_ps(stateblock->wineD3DDevice) ) {
|
|
|
|
|
/* NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but
|
|
|
|
|
* -1/(e-s) and e/(e-s) respectively to simplify fog computation in the shader.
|
|
|
|
|
*/
|
|
|
|
|
WINED3DFOGMODE mode;
|
|
|
|
|
context->last_was_foggy_shader = FALSE;
|
|
|
|
|
|
|
|
|
|
/* If both fogmodes are set use the table fog mode */
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE)
|
|
|
|
|
mode = stateblock->renderState[WINED3DRS_FOGVERTEXMODE];
|
|
|
|
|
else
|
|
|
|
|
mode = stateblock->renderState[WINED3DRS_FOGTABLEMODE];
|
|
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
|
case WINED3DFOG_EXP:
|
|
|
|
|
case WINED3DFOG_EXP2:
|
|
|
|
|
if(!is_ps3) FIXME("Implement non linear fog for pixel shader < 3.0\n");
|
|
|
|
|
/* Disable fog */
|
|
|
|
|
fogenable = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DFOG_LINEAR:
|
|
|
|
|
fogstart = -1.0f/(fogend-fogstart);
|
|
|
|
|
fogend *= -fogstart;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DFOG_NONE:
|
|
|
|
|
if(!is_ps3) FIXME("Implement software vertex fog for pixel shader < 3.0\n");
|
|
|
|
|
/* Disable fog */
|
|
|
|
|
fogenable = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
default: FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock->renderState[WINED3DRS_FOGVERTEXMODE]);
|
|
|
|
|
}
|
2007-08-13 23:19:37 +02:00
|
|
|
|
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2007-08-13 23:19:37 +02:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2007-08-13 23:19:37 +02: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."
|
|
|
|
|
*/
|
2007-02-15 13:32:13 +01:00
|
|
|
|
else if(stateblock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glHint(GL_FOG_HINT, GL_FASTEST);
|
|
|
|
|
checkGLcall("glHint(GL_FOG_HINT, GL_FASTEST)");
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->last_was_foggy_shader = FALSE;
|
2007-01-02 22:47:10 +01:00
|
|
|
|
|
2006-12-08 18:42:43 +01:00
|
|
|
|
switch (stateblock->renderState[WINED3DRS_FOGVERTEXMODE]) {
|
2007-03-14 18:04:56 +01:00
|
|
|
|
/* If processed vertices are used, fall through to the NONE case */
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_EXP: {
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(!context->last_was_rhw) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_MODE, GL_EXP);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_EXP2: {
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(!context->last_was_rhw) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_MODE, GL_EXP2);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_LINEAR: {
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(!context->last_was_rhw) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_NONE: {
|
2006-12-08 18:42:43 +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
|
|
|
|
|
*/
|
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD)) {
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(context->fog_coord == FALSE) {
|
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = TRUE;
|
|
|
|
|
}
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
|
|
|
|
fogstart = 0xff;
|
|
|
|
|
fogend = 0x0;
|
|
|
|
|
} else {
|
|
|
|
|
/* Disable GL fog, handle this in software in drawStridedSlow */
|
|
|
|
|
fogenable = FALSE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default: FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock->renderState[WINED3DRS_FOGVERTEXMODE]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
glHint(GL_FOG_HINT, GL_NICEST);
|
|
|
|
|
checkGLcall("glHint(GL_FOG_HINT, GL_NICEST)");
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->last_was_foggy_shader = FALSE;
|
2007-01-02 22:47:10 +01:00
|
|
|
|
|
2006-12-08 18:42:43 +01:00
|
|
|
|
switch (stateblock->renderState[WINED3DRS_FOGTABLEMODE]) {
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_EXP:
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_MODE, GL_EXP);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_EXP2:
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_MODE, GL_EXP2);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_LINEAR:
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) {
|
2006-12-08 18:42:43 +01:00
|
|
|
|
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
2007-08-14 02:31:10 +02:00
|
|
|
|
context->fog_coord = FALSE;
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2007-02-15 13:32:13 +01:00
|
|
|
|
case WINED3DFOG_NONE: /* Won't happen */
|
2006-12-08 18:42:43 +01:00
|
|
|
|
default:
|
|
|
|
|
FIXME("Unexpected WINED3DRS_FOGTABLEMODE %d\n", stateblock->renderState[WINED3DRS_FOGTABLEMODE]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(fogenable) {
|
|
|
|
|
glEnable(GL_FOG);
|
|
|
|
|
checkGLcall("glEnable GL_FOG");
|
|
|
|
|
|
2007-08-13 23:19:37 +02:00
|
|
|
|
if(fogstart != fogend)
|
|
|
|
|
{
|
|
|
|
|
glFogfv(GL_FOG_START, &fogstart);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_START, fogstart)");
|
2007-08-13 23:19:37 +02:00
|
|
|
|
TRACE("Fog Start == %f\n", fogstart);
|
|
|
|
|
|
|
|
|
|
glFogfv(GL_FOG_END, &fogend);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_END, fogend)");
|
2007-08-13 23:19:37 +02:00
|
|
|
|
TRACE("Fog End == %f\n", fogend);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
glFogf(GL_FOG_START, -1.0 / 0.0);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_START, fogstart)");
|
2007-08-13 23:19:37 +02:00
|
|
|
|
TRACE("Fog Start == %f\n", fogstart);
|
2006-12-08 18:42:43 +01:00
|
|
|
|
|
2007-08-13 23:19:37 +02:00
|
|
|
|
glFogf(GL_FOG_END, 0.0);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_END, fogend)");
|
2007-08-13 23:19:37 +02:00
|
|
|
|
TRACE("Fog End == %f\n", fogend);
|
|
|
|
|
}
|
2006-12-08 18:42:43 +01:00
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_FOG);
|
|
|
|
|
checkGLcall("glDisable GL_FOG");
|
2007-03-22 17:32:48 +01:00
|
|
|
|
if( use_ps(stateblock->wineD3DDevice) ) {
|
|
|
|
|
/* disable fog in the pixel shader
|
|
|
|
|
* NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but
|
|
|
|
|
* -1/(e-s) and e/(e-s) respectively.
|
|
|
|
|
*/
|
|
|
|
|
glFogf(GL_FOG_START, 0.0f);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_START, fogstart)");
|
2007-03-22 17:32:48 +01:00
|
|
|
|
glFogf(GL_FOG_END, 1.0f);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glFogf(GL_FOG_END, fogend)");
|
2007-03-22 17:32:48 +01:00
|
|
|
|
}
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
2007-08-21 12:30:22 +02:00
|
|
|
|
}
|
2006-12-08 18:42:43 +01:00
|
|
|
|
|
2008-07-05 22:38:43 +02:00
|
|
|
|
static void state_rangefog_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_RANGEFOGENABLE]) {
|
|
|
|
|
WARN("Range fog enabled, but not supported by this opengl implementation\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-21 12:30:22 +02:00
|
|
|
|
static void state_rangefog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_RANGEFOGENABLE]) {
|
2008-07-05 22:38:43 +02:00
|
|
|
|
glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV);
|
|
|
|
|
checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV)");
|
2007-08-21 12:30:22 +02:00
|
|
|
|
} else {
|
2008-07-05 22:38:43 +02:00
|
|
|
|
glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV);
|
|
|
|
|
checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV)");
|
2006-12-08 18:42:43 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-29 11:35:57 +01:00
|
|
|
|
float col[4];
|
|
|
|
|
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_FOGCOLOR], col);
|
|
|
|
|
glFogfv(GL_FOG_COLOR, &col[0]);
|
2006-12-08 18:52:30 +01:00
|
|
|
|
checkGLcall("glFog GL_FOG_COLOR");
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 16:34:45 +01:00
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_FOGDENSITY];
|
|
|
|
|
glFogfv(GL_FOG_DENSITY, &tmpvalue.f);
|
|
|
|
|
checkGLcall("glFogf(GL_FOG_DENSITY, (float) Value)");
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-10 22:44:18 +01:00
|
|
|
|
/* TODO: Merge with primitive type + init_materials()!! */
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2008-01-23 22:39:59 +01:00
|
|
|
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
2007-01-17 21:41:21 +01:00
|
|
|
|
GLenum Parm = 0;
|
2007-01-17 21:41:35 +01:00
|
|
|
|
WineDirect3DStridedData *diffuse = &device->strided_streams.u.s.diffuse;
|
2007-01-10 11:26:12 +01:00
|
|
|
|
BOOL isDiffuseSupplied;
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isDiffuseSupplied = diffuse->lpData || diffuse->VBO;
|
2006-12-10 22:44:18 +01:00
|
|
|
|
|
2007-06-20 14:36:32 +02:00
|
|
|
|
context->num_untracked_materials = 0;
|
2007-01-17 21:41:21 +01:00
|
|
|
|
if (isDiffuseSupplied && stateblock->renderState[WINED3DRS_COLORVERTEX]) {
|
2006-12-10 22:44:18 +01:00
|
|
|
|
TRACE("diff %d, amb %d, emis %d, spec %d\n",
|
|
|
|
|
stateblock->renderState[WINED3DRS_DIFFUSEMATERIALSOURCE],
|
|
|
|
|
stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE],
|
|
|
|
|
stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE],
|
|
|
|
|
stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE]);
|
|
|
|
|
|
2007-02-15 13:32:13 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_DIFFUSEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
2006-12-10 22:44:18 +01:00
|
|
|
|
Parm = GL_AMBIENT_AND_DIFFUSE;
|
|
|
|
|
} else {
|
|
|
|
|
Parm = GL_DIFFUSE;
|
|
|
|
|
}
|
2007-06-20 14:36:32 +02:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
|
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
|
}
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
|
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
|
}
|
2007-02-15 13:32:13 +01:00
|
|
|
|
} else if (stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
2006-12-10 22:44:18 +01:00
|
|
|
|
Parm = GL_AMBIENT;
|
2007-06-20 14:36:32 +02:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
|
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
|
}
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
|
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
|
}
|
2007-02-15 13:32:13 +01:00
|
|
|
|
} else if (stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
2006-12-10 22:44:18 +01:00
|
|
|
|
Parm = GL_EMISSION;
|
2007-06-20 14:36:32 +02:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
|
|
|
|
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
|
|
|
|
context->num_untracked_materials++;
|
|
|
|
|
}
|
2007-02-15 13:32:13 +01:00
|
|
|
|
} else if (stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
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
|
|
|
|
|
2007-01-17 21:41:21 +01:00
|
|
|
|
if(!Parm) {
|
2007-01-10 11:26:12 +01:00
|
|
|
|
glDisable(GL_COLOR_MATERIAL);
|
|
|
|
|
checkGLcall("glDisable GL_COLOR_MATERIAL");
|
2006-12-10 22:44:18 +01:00
|
|
|
|
} else {
|
2007-01-10 11:26:12 +01:00
|
|
|
|
glColorMaterial(GL_FRONT_AND_BACK, Parm);
|
|
|
|
|
checkGLcall("glColorMaterial(GL_FRONT_AND_BACK, Parm)");
|
|
|
|
|
glEnable(GL_COLOR_MATERIAL);
|
|
|
|
|
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. */
|
2007-02-12 19:18:27 +01:00
|
|
|
|
switch (context->tracking_parm) {
|
2007-01-17 21:41:35 +01:00
|
|
|
|
case GL_AMBIENT_AND_DIFFUSE:
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*)&device->updateStateBlock->material.Ambient);
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*)&device->updateStateBlock->material.Diffuse);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GL_DIFFUSE:
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*)&device->updateStateBlock->material.Diffuse);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GL_AMBIENT:
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*)&device->updateStateBlock->material.Ambient);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GL_EMISSION:
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*)&device->updateStateBlock->material.Emissive);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GL_SPECULAR:
|
|
|
|
|
/* Only change material color if specular is enabled, otherwise it is set to black */
|
|
|
|
|
if (device->stateBlock->renderState[WINED3DRS_SPECULARENABLE]) {
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*)&device->updateStateBlock->material.Specular);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
} else {
|
|
|
|
|
float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
|
|
|
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
|
|
|
|
|
checkGLcall("glMaterialfv");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->tracking_parm = Parm;
|
2006-12-10 22:44:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:01 +01:00
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
WINED3DLINEPATTERN lp;
|
|
|
|
|
} tmppattern;
|
|
|
|
|
tmppattern.d = stateblock->renderState[WINED3DRS_LINEPATTERN];
|
|
|
|
|
|
|
|
|
|
TRACE("Line pattern: repeat %d bits %x\n", tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
|
|
|
|
|
|
|
|
|
|
if (tmppattern.lp.wRepeatFactor) {
|
|
|
|
|
glLineStipple(tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
|
|
|
|
|
checkGLcall("glLineStipple(repeat, linepattern)");
|
|
|
|
|
glEnable(GL_LINE_STIPPLE);
|
|
|
|
|
checkGLcall("glEnable(GL_LINE_STIPPLE);");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_LINE_STIPPLE);
|
|
|
|
|
checkGLcall("glDisable(GL_LINE_STIPPLE);");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:19:57 +01:00
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_ZBIAS]) {
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_ZBIAS];
|
|
|
|
|
TRACE("ZBias value %f\n", tmpvalue.f);
|
|
|
|
|
glPolygonOffset(0, -tmpvalue.f);
|
|
|
|
|
checkGLcall("glPolygonOffset(0, -Value)");
|
|
|
|
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
|
|
|
|
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL);");
|
|
|
|
|
glEnable(GL_POLYGON_OFFSET_LINE);
|
|
|
|
|
checkGLcall("glEnable(GL_POLYGON_OFFSET_LINE);");
|
|
|
|
|
glEnable(GL_POLYGON_OFFSET_POINT);
|
|
|
|
|
checkGLcall("glEnable(GL_POLYGON_OFFSET_POINT);");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
|
|
|
|
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL);");
|
|
|
|
|
glDisable(GL_POLYGON_OFFSET_LINE);
|
|
|
|
|
checkGLcall("glDisable(GL_POLYGON_OFFSET_LINE);");
|
|
|
|
|
glDisable(GL_POLYGON_OFFSET_POINT);
|
|
|
|
|
checkGLcall("glDisable(GL_POLYGON_OFFSET_POINT);");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-10 23:20:05 +01:00
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-08-21 18:05:27 +02:00
|
|
|
|
if(isStateDirty(context, STATE_VDECL)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* 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
|
|
|
|
|
*/
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_NORMALIZENORMALS] && (
|
|
|
|
|
stateblock->wineD3DDevice->strided_streams.u.s.normal.lpData ||
|
|
|
|
|
stateblock->wineD3DDevice->strided_streams.u.s.normal.VBO)) {
|
2006-12-10 23:20:05 +01:00
|
|
|
|
glEnable(GL_NORMALIZE);
|
|
|
|
|
checkGLcall("glEnable(GL_NORMALIZE);");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_NORMALIZE);
|
|
|
|
|
checkGLcall("glDisable(GL_NORMALIZE);");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:45:39 +02:00
|
|
|
|
static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:12 +01:00
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
2007-01-10 11:32:07 +01:00
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
|
2008-07-05 22:45:39 +02:00
|
|
|
|
if(tmpvalue.f != 1.0) {
|
2007-01-10 11:32:07 +01:00
|
|
|
|
FIXME("WINED3DRS_POINTSIZE_MIN not supported on this opengl, value is %f\n", tmpvalue.f);
|
2006-12-10 23:20:12 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:45:39 +02:00
|
|
|
|
static void state_psizemin_ext(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
|
|
|
|
|
GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, tmpvalue.f);
|
|
|
|
|
checkGLcall("glPointParameterfEXT(...)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void state_psizemin_arb(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
|
|
|
|
|
GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MIN_ARB, tmpvalue.f);
|
|
|
|
|
checkGLcall("glPointParameterfARB(...)");
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:47:59 +02:00
|
|
|
|
static void state_psizemax_arb(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:15 +01:00
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
2007-01-10 11:32:07 +01:00
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
|
2008-07-05 22:47:59 +02:00
|
|
|
|
GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MAX_ARB, tmpvalue.f);
|
|
|
|
|
checkGLcall("glPointParameterfARB(...)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void state_psizemax_ext(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
|
|
|
|
|
GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, tmpvalue.f);
|
|
|
|
|
checkGLcall("glPointParameterfEXT(...)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void state_psizemax_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
|
|
|
|
|
if(tmpvalue.f != 64.0) {
|
2007-01-10 11:32:07 +01:00
|
|
|
|
FIXME("WINED3DRS_POINTSIZE_MAX not supported on this opengl, value is %f\n", tmpvalue.f);
|
2006-12-10 23:20:15 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
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
|
|
|
|
|
2007-10-22 12:15:03 +02:00
|
|
|
|
pointSize.d = stateblock->renderState[WINED3DRS_POINTSIZE];
|
|
|
|
|
A.d = stateblock->renderState[WINED3DRS_POINTSCALE_A];
|
|
|
|
|
B.d = stateblock->renderState[WINED3DRS_POINTSCALE_B];
|
|
|
|
|
C.d = stateblock->renderState[WINED3DRS_POINTSCALE_C];
|
2006-12-10 23:20:19 +01:00
|
|
|
|
|
2007-10-22 12:15:03 +02:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_POINTSCALEENABLE]) {
|
|
|
|
|
GLfloat scaleFactor;
|
|
|
|
|
float h = stateblock->viewport.Height;
|
|
|
|
|
|
2007-11-03 15:39:22 +01:00
|
|
|
|
if(pointSize.f < GL_LIMITS(pointsizemin)) {
|
2007-10-22 12:15:03 +02:00
|
|
|
|
/*
|
2007-11-03 15:39:22 +01:00
|
|
|
|
* Minimum valid point size for OpenGL is driver specific. For Direct3D it is
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2007-11-03 15:39:22 +01:00
|
|
|
|
scaleFactor = pointSize.f / GL_LIMITS(pointsizemin);
|
|
|
|
|
/* 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
|
|
|
|
|
*/
|
|
|
|
|
pointSize.f = GL_LIMITS(pointsizemin);
|
2007-10-22 12:15:03 +02:00
|
|
|
|
} else if(pointSize.f > GL_LIMITS(pointsize)) {
|
|
|
|
|
/* 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
|
|
|
|
|
*/
|
|
|
|
|
scaleFactor = pointSize.f / GL_LIMITS(pointsize);
|
|
|
|
|
TRACE("scale: %f\n", scaleFactor);
|
|
|
|
|
pointSize.f = GL_LIMITS(pointsize);
|
2006-12-10 23:20:19 +01:00
|
|
|
|
} else {
|
|
|
|
|
scaleFactor = 1.0f;
|
|
|
|
|
}
|
2007-10-22 12:15:03 +02:00
|
|
|
|
scaleFactor = pow(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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(GL_SUPPORT(ARB_POINT_PARAMETERS)) {
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
else if(GL_SUPPORT(EXT_POINT_PARAMETERS)) {
|
|
|
|
|
GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...)");
|
2007-10-22 12:15:03 +02:00
|
|
|
|
} else if(stateblock->renderState[WINED3DRS_POINTSCALEENABLE]) {
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
glPointSize(pointSize.f);
|
|
|
|
|
checkGLcall("glPointSize(...);");
|
2006-12-10 23:20:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:22 +01:00
|
|
|
|
DWORD Value = stateblock->renderState[WINED3DRS_COLORWRITEENABLE];
|
|
|
|
|
|
|
|
|
|
TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
|
2007-02-15 13:32:13 +01:00
|
|
|
|
Value & WINED3DCOLORWRITEENABLE_RED ? 1 : 0,
|
|
|
|
|
Value & WINED3DCOLORWRITEENABLE_GREEN ? 1 : 0,
|
|
|
|
|
Value & WINED3DCOLORWRITEENABLE_BLUE ? 1 : 0,
|
|
|
|
|
Value & WINED3DCOLORWRITEENABLE_ALPHA ? 1 : 0);
|
|
|
|
|
glColorMask(Value & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
|
|
|
|
|
Value & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
|
|
|
|
|
Value & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
|
|
|
|
Value & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
|
2006-12-10 23:20:22 +01:00
|
|
|
|
checkGLcall("glColorMask(...)");
|
|
|
|
|
|
|
|
|
|
/* depends on WINED3DRS_COLORWRITEENABLE. */
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_COLORWRITEENABLE1] != 0x0000000F ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_COLORWRITEENABLE2] != 0x0000000F ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_COLORWRITEENABLE3] != 0x0000000F ) {
|
|
|
|
|
ERR("(WINED3DRS_COLORWRITEENABLE1/2/3,%d,%d,%d) not yet implemented. Missing of cap D3DPMISCCAPS_INDEPENDENTWRITEMASKS wasn't honored?\n",
|
|
|
|
|
stateblock->renderState[WINED3DRS_COLORWRITEENABLE1],
|
|
|
|
|
stateblock->renderState[WINED3DRS_COLORWRITEENABLE2],
|
|
|
|
|
stateblock->renderState[WINED3DRS_COLORWRITEENABLE3]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:26 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_LOCALVIEWER]) {
|
|
|
|
|
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
|
|
|
|
|
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1)");
|
|
|
|
|
} else {
|
|
|
|
|
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
|
|
|
|
|
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:29 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_LASTPIXEL]) {
|
|
|
|
|
TRACE("Last Pixel Drawing Enabled\n");
|
|
|
|
|
} else {
|
2007-03-27 09:27:52 +02:00
|
|
|
|
static BOOL first = TRUE;
|
|
|
|
|
if(first) {
|
|
|
|
|
FIXME("Last Pixel Drawing Disabled, not handled yet\n");
|
|
|
|
|
first = FALSE;
|
|
|
|
|
} else {
|
|
|
|
|
TRACE("Last Pixel Drawing Disabled, not handled yet\n");
|
|
|
|
|
}
|
2006-12-10 23:20:29 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:49:50 +02:00
|
|
|
|
static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:36 +01:00
|
|
|
|
/* TODO: NV_POINT_SPRITE */
|
2008-07-05 22:49:50 +02:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_POINTSPRITEENABLE]) {
|
2006-12-10 23:20:36 +01:00
|
|
|
|
TRACE("Point sprites not supported\n");
|
|
|
|
|
}
|
2008-07-05 22:49:50 +02:00
|
|
|
|
}
|
2006-12-10 23:20:36 +01:00
|
|
|
|
|
2008-07-05 22:49:50 +02:00
|
|
|
|
static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:36 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_POINTSPRITEENABLE]) {
|
2007-06-17 00:26:17 +02:00
|
|
|
|
glEnable(GL_POINT_SPRITE_ARB);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_POINT_SPRITE_ARB)");
|
2006-12-10 23:20:36 +01:00
|
|
|
|
} else {
|
2007-06-17 00:26:17 +02:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:45 +01:00
|
|
|
|
/**
|
|
|
|
|
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/texture/
|
|
|
|
|
http://www.gamedev.net/reference/programming/features/rendererdll3/page2.asp
|
2008-01-09 20:37:05 +01:00
|
|
|
|
Discussion on the ways to turn on WRAPing to solve an OpenGL conversion problem.
|
2006-12-10 23:20:45 +01:00
|
|
|
|
http://www.flipcode.org/cgi-bin/fcmsg.cgi?thread_show=10248
|
|
|
|
|
|
|
|
|
|
so far as I can tell, wrapping and texture-coordinate generate go hand in hand,
|
|
|
|
|
*/
|
|
|
|
|
TRACE("Stub\n");
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_WRAP0] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP1] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP2] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP3] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP4] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP5] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP6] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP7] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP8] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP9] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP10] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP11] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP12] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP13] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP14] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_WRAP15] ) {
|
2007-04-03 23:38:21 +02:00
|
|
|
|
FIXME("(WINED3DRS_WRAP0) Texture wraping not yet supported\n");
|
2006-12-10 23:20:45 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 22:59:21 +02:00
|
|
|
|
static void state_msaa_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
|
|
|
|
|
WARN("Multisample antialiasing not supported by gl\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void state_msaa(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
|
|
|
|
|
glEnable(GL_MULTISAMPLE_ARB);
|
|
|
|
|
checkGLcall("glEnable(GL_MULTISAMPLE_ARB)");
|
2006-12-10 23:20:40 +01:00
|
|
|
|
} else {
|
2008-07-05 22:59:21 +02:00
|
|
|
|
glDisable(GL_MULTISAMPLE_ARB);
|
|
|
|
|
checkGLcall("glDisable(GL_MULTISAMPLE_ARB)");
|
2006-12-10 23:20:40 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:48 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_SCISSORTESTENABLE]) {
|
|
|
|
|
glEnable(GL_SCISSOR_TEST);
|
|
|
|
|
checkGLcall("glEnable(GL_SCISSOR_TEST)");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_SCISSOR_TEST);
|
|
|
|
|
checkGLcall("glDisable(GL_SCISSOR_TEST)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:52 +01:00
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS] ||
|
|
|
|
|
stateblock->renderState[WINED3DRS_DEPTHBIAS]) {
|
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS];
|
|
|
|
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
|
|
|
|
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
|
|
|
|
|
glPolygonOffset(tmpvalue.f, *((float*)&stateblock->renderState[WINED3DRS_DEPTHBIAS]));
|
|
|
|
|
checkGLcall("glPolygonOffset(...)");
|
|
|
|
|
} else {
|
|
|
|
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
|
|
|
|
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:56 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_TEXTUREPERSPECTIVE]) {
|
|
|
|
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
|
|
|
|
checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)");
|
|
|
|
|
} else {
|
|
|
|
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
|
|
|
|
checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_stippledalpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:20:59 +01:00
|
|
|
|
TRACE("Stub\n");
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_STIPPLEDALPHA])
|
2007-04-03 23:38:21 +02:00
|
|
|
|
FIXME(" Stippled Alpha not supported yet.\n");
|
2006-12-10 23:20:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_antialias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:21:03 +01:00
|
|
|
|
TRACE("Stub\n");
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_ANTIALIAS])
|
2007-04-03 23:38:21 +02:00
|
|
|
|
FIXME(" Antialias not supported yet.\n");
|
2006-12-10 23:21:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_multisampmask(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:21:07 +01:00
|
|
|
|
TRACE("Stub\n");
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_MULTISAMPLEMASK] != 0xFFFFFFFF)
|
2007-04-03 23:38:21 +02:00
|
|
|
|
FIXME("(WINED3DRS_MULTISAMPLEMASK,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_MULTISAMPLEMASK]);
|
2006-12-10 23:21:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_patchedgestyle(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:21:10 +01:00
|
|
|
|
TRACE("Stub\n");
|
2007-02-15 13:32:13 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_PATCHEDGESTYLE] != WINED3DPATCHEDGE_DISCRETE)
|
2007-04-03 23:38:21 +02:00
|
|
|
|
FIXME("(WINED3DRS_PATCHEDGESTYLE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_PATCHEDGESTYLE]);
|
2006-12-10 23:21:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:21:14 +01:00
|
|
|
|
union {
|
|
|
|
|
DWORD d;
|
|
|
|
|
float f;
|
|
|
|
|
} tmpvalue;
|
|
|
|
|
tmpvalue.f = 1.0f;
|
|
|
|
|
|
|
|
|
|
TRACE("Stub\n");
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_PATCHSEGMENTS] != tmpvalue.d)
|
2007-03-28 20:37:10 +02:00
|
|
|
|
{
|
2007-04-03 23:39:22 +02:00
|
|
|
|
static BOOL displayed = FALSE;
|
|
|
|
|
|
2007-03-28 20:37:10 +02:00
|
|
|
|
tmpvalue.d = stateblock->renderState[WINED3DRS_PATCHSEGMENTS];
|
2007-04-03 23:39:22 +02:00
|
|
|
|
if(!displayed)
|
|
|
|
|
FIXME("(WINED3DRS_PATCHSEGMENTS,%f) not yet implemented\n", tmpvalue.f);
|
|
|
|
|
|
|
|
|
|
displayed = TRUE;
|
2007-03-28 20:37:10 +02:00
|
|
|
|
}
|
2006-12-10 23:21:14 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_positiondegree(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:21:21 +01:00
|
|
|
|
TRACE("Stub\n");
|
2007-02-15 13:32:13 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_POSITIONDEGREE] != WINED3DDEGREE_CUBIC)
|
2007-04-03 23:38:21 +02:00
|
|
|
|
FIXME("(WINED3DRS_POSITIONDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_POSITIONDEGREE]);
|
2006-12-10 23:21:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_normaldegree(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:21:25 +01:00
|
|
|
|
TRACE("Stub\n");
|
2007-02-15 13:32:13 +01:00
|
|
|
|
if (stateblock->renderState[WINED3DRS_NORMALDEGREE] != WINED3DDEGREE_LINEAR)
|
2007-04-03 23:38:21 +02:00
|
|
|
|
FIXME("(WINED3DRS_NORMALDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_NORMALDEGREE]);
|
2006-12-10 23:21:25 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-10 23:21:27 +01:00
|
|
|
|
TRACE("Stub\n");
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION])
|
|
|
|
|
FIXME("(WINED3DRS_ENABLEADAPTIVETESSELLATION,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION]);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_WRAPU]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_WRAPU not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_wrapv(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_WRAPV]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_WRAPV not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_monoenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_MONOENABLE]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_MONOENABLE not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_rop2(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_ROP2]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_ROP2 not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_planemask(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_PLANEMASK]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_PLANEMASK not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_subpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_SUBPIXEL]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_SUBPIXEL not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_subpixelx(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_SUBPIXELX]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_SUBPIXELX not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_stippleenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_STIPPLEENABLE]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_STIPPLEENABLE not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_bordercolor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_BORDERCOLOR]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_BORDERCOLOR not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_mipmaplodbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_MIPMAPLODBIAS]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_MIPMAPLODBIAS not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_anisotropy(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_ANISOTROPY]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_ANISOTROPY not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_flushbatch(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_FLUSHBATCH]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_FLUSHBATCH not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_translucentsi(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_TRANSLUCENTSORTINDEPENDENT]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_TRANSLUCENTSORTINDEPENDENT not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_extents(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_EXTENTS]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_EXTENTS not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void state_ckeyblend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-15 20:02:13 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_COLORKEYBLENDENABLE]) {
|
|
|
|
|
FIXME("Render state WINED3DRS_COLORKEYBLENDENABLE not implemented yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-12 18:45:33 +02:00
|
|
|
|
/* Set texture operations up - The following avoids lots of ifdefs in this routine!*/
|
|
|
|
|
#if defined (GL_VERSION_1_3)
|
|
|
|
|
# define useext(A) A
|
|
|
|
|
#elif defined (GL_EXT_texture_env_combine)
|
|
|
|
|
# define useext(A) A##_EXT
|
|
|
|
|
#elif defined (GL_ARB_texture_env_combine)
|
|
|
|
|
# define useext(A) A##_ARB
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
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 */
|
|
|
|
|
static void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
|
|
|
|
IWineD3DStateBlockImpl *stateblock = This->stateBlock; /* for GLINFO_LOCATION */
|
|
|
|
|
|
|
|
|
|
TRACE("Alpha?(%d), Stage:%d Op(%s), a1(%d), a2(%d), a3(%d)\n", isAlpha, Stage, debug_d3dtop(op), arg1, arg2, arg3);
|
|
|
|
|
|
|
|
|
|
/* This is called by a state handler which has the gl lock held and a context for the thread */
|
|
|
|
|
|
|
|
|
|
/* Note: Operations usually involve two ars, 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 */
|
|
|
|
|
|
|
|
|
|
if (isAlpha) {
|
|
|
|
|
comb_target = useext(GL_COMBINE_ALPHA);
|
|
|
|
|
src0_target = useext(GL_SOURCE0_ALPHA);
|
|
|
|
|
src1_target = useext(GL_SOURCE1_ALPHA);
|
|
|
|
|
src2_target = useext(GL_SOURCE2_ALPHA);
|
|
|
|
|
opr0_target = useext(GL_OPERAND0_ALPHA);
|
|
|
|
|
opr1_target = useext(GL_OPERAND1_ALPHA);
|
|
|
|
|
opr2_target = useext(GL_OPERAND2_ALPHA);
|
|
|
|
|
scal_target = GL_ALPHA_SCALE;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
comb_target = useext(GL_COMBINE_RGB);
|
|
|
|
|
src0_target = useext(GL_SOURCE0_RGB);
|
|
|
|
|
src1_target = useext(GL_SOURCE1_RGB);
|
|
|
|
|
src2_target = useext(GL_SOURCE2_RGB);
|
|
|
|
|
opr0_target = useext(GL_OPERAND0_RGB);
|
|
|
|
|
opr1_target = useext(GL_OPERAND1_RGB);
|
|
|
|
|
opr2_target = useext(GL_OPERAND2_RGB);
|
|
|
|
|
scal_target = useext(GL_RGB_SCALE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If a texture stage references an invalid texture unit the stage just
|
|
|
|
|
* passes through the result from the previous stage */
|
|
|
|
|
if (is_invalid_op(This, Stage, op, arg1, arg2, arg3)) {
|
|
|
|
|
arg1 = WINED3DTA_CURRENT;
|
|
|
|
|
op = WINED3DTOP_SELECTARG1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* From MSDN (WINED3DTSS_ALPHAARG1) :
|
|
|
|
|
The default argument is WINED3DTA_TEXTURE. If no texture is set for this stage,
|
|
|
|
|
then the default argument is WINED3DTA_DIFFUSE.
|
|
|
|
|
FIXME? If texture added/removed, may need to reset back as well? */
|
|
|
|
|
if (isAlpha && This->stateBlock->textures[Stage] == NULL && arg1 == WINED3DTA_TEXTURE) {
|
|
|
|
|
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: */
|
|
|
|
|
if (GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
switch (op) {
|
|
|
|
|
case WINED3DTOP_DISABLE: /* Only for alpha */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_SELECTARG1: /* = a1 * 1 + 0 * 0 */
|
|
|
|
|
case WINED3DTOP_SELECTARG2: /* = a2 * 1 + 0 * 0 */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
if (op == WINED3DTOP_SELECTARG1) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
} else {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_MODULATE:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATE2X:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATE4X:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 4);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_ADD:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_ADDSIGNED:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_ADDSIGNED2X:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_ADDSMOOTH:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_BLENDDIFFUSEALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, useext(GL_PRIMARY_COLOR));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, useext(GL_PRIMARY_COLOR)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, useext(GL_PRIMARY_COLOR));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, useext(GL_PRIMARY_COLOR)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BLENDTEXTUREALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_TEXTURE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_TEXTURE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_TEXTURE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_TEXTURE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BLENDFACTORALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, useext(GL_CONSTANT));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, useext(GL_CONSTANT)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, useext(GL_CONSTANT));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, useext(GL_CONSTANT)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_TEXTURE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_TEXTURE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); /* a0 = src1/opr1 */
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1"); /* a1 = 1 (see docs) */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2); /* a2 = arg2 */
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2"); /* a3 = src1 alpha */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MULTIPLYADD:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src3_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src3_target, src3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_BUMPENVMAP:
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_BUMPENVMAPLUMINANCE:
|
|
|
|
|
FIXME("Implement bump environment mapping in GL_NV_texture_env_combine4 path\n");
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
}
|
|
|
|
|
if (Handled) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV");
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} /* GL_NV_texture_env_combine4 */
|
|
|
|
|
|
|
|
|
|
Handled = TRUE; /* Again, assume handled */
|
|
|
|
|
switch (op) {
|
|
|
|
|
case WINED3DTOP_DISABLE: /* Only for alpha */
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_SELECTARG1:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_SELECTARG2:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATE:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATE2X:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATE4X:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 4);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_ADD:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_ADDSIGNED:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext((GL_ADD_SIGNED)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_ADDSIGNED2X:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_SUBTRACT:
|
|
|
|
|
if (GL_SUPPORT(ARB_TEXTURE_ENV_COMBINE)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_SUBTRACT);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_SUBTRACT)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else {
|
|
|
|
|
FIXME("This version of opengl does not support GL_SUBTRACT\n");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTOP_BLENDDIFFUSEALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, useext(GL_PRIMARY_COLOR));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_PRIMARY_COLOR");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BLENDTEXTUREALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_TEXTURE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_TEXTURE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BLENDFACTORALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, useext(GL_CONSTANT));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_CONSTANT");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BLENDCURRENTALPHA:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, useext(GL_PREVIOUS));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_PREVIOUS");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_DOTPRODUCT3:
|
|
|
|
|
if (GL_SUPPORT(ARB_TEXTURE_ENV_DOT3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB");
|
|
|
|
|
} else if (GL_SUPPORT(EXT_TEXTURE_ENV_DOT3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT");
|
|
|
|
|
} else {
|
|
|
|
|
FIXME("This version of opengl does not support GL_DOT3\n");
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_LERP:
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_ADDSMOOTH:
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_TEXTURE);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, GL_TEXTURE");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_APHA");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_MULTIPLYADD:
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3)) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src1_target, src3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
|
|
|
|
} else
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DTOP_BUMPENVMAPLUMINANCE:
|
|
|
|
|
if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) {
|
|
|
|
|
/* Some apps use BUMPENVMAPLUMINANCE instead of D3DTOP_BUMPENVMAP, although
|
|
|
|
|
* they check for the non-luminance cap flag. Well, give them what they asked
|
|
|
|
|
* for :-)
|
|
|
|
|
*/
|
|
|
|
|
WARN("Application uses WINED3DTOP_BUMPENVMAPLUMINANCE\n");
|
|
|
|
|
} else {
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* Fall through */
|
|
|
|
|
case WINED3DTOP_BUMPENVMAP:
|
|
|
|
|
if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) {
|
|
|
|
|
TRACE("Using ati bumpmap on stage %d, target %d\n", Stage, Stage + 1);
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_BUMP_ENVMAP_ATI);
|
|
|
|
|
checkGLcall("glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_BUMP_ENVMAP_ATI)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, GL_BUMP_TARGET_ATI, GL_TEXTURE0_ARB + Stage + 1);
|
|
|
|
|
checkGLcall("glTexEnvi(GL_TEXTURE_ENV, GL_BUMP_TARGET_ATI, GL_TEXTURE0_ARB + Stage + 1)");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src0_target, src3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr3);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr3");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
|
|
|
|
|
|
|
|
|
Handled = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
} else if(GL_SUPPORT(NV_TEXTURE_SHADER2)) {
|
|
|
|
|
/* 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");
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
Handled = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Handled) {
|
|
|
|
|
BOOL combineOK = TRUE;
|
|
|
|
|
if (GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
|
|
|
|
|
DWORD op2;
|
|
|
|
|
|
|
|
|
|
if (isAlpha) {
|
|
|
|
|
op2 = This->stateBlock->textureState[Stage][WINED3DTSS_COLOROP];
|
|
|
|
|
} else {
|
|
|
|
|
op2 = This->stateBlock->textureState[Stage][WINED3DTSS_ALPHAOP];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Note: If COMBINE4 in effect can't go back to combine! */
|
|
|
|
|
switch (op2) {
|
|
|
|
|
case WINED3DTOP_ADDSMOOTH:
|
|
|
|
|
case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
|
|
|
|
case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
|
|
|
|
case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
|
|
|
|
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
|
|
|
|
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
|
|
|
|
case WINED3DTOP_MULTIPLYADD:
|
|
|
|
|
/* Ignore those implemented in both cases */
|
|
|
|
|
switch (op) {
|
|
|
|
|
case WINED3DTOP_SELECTARG1:
|
|
|
|
|
case WINED3DTOP_SELECTARG2:
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (combineOK) {
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE));
|
|
|
|
|
checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE)");
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* After all the extensions, if still unhandled, report fixme */
|
|
|
|
|
FIXME("Unhandled texture operation %s\n", debug_d3dtop(op));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-19 23:00:58 +01:00
|
|
|
|
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
2007-01-03 19:18:38 +01:00
|
|
|
|
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
2007-07-01 23:41:04 +02:00
|
|
|
|
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map[stage];
|
2006-12-19 23:00:58 +01:00
|
|
|
|
|
|
|
|
|
TRACE("Setting color op for stage %d\n", stage);
|
|
|
|
|
|
|
|
|
|
if (stateblock->pixelShader && stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE &&
|
|
|
|
|
((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function) {
|
|
|
|
|
/* Using a pixel shader? Don't care for anything here, the shader applying does it */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-03 19:18:38 +01:00
|
|
|
|
if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
|
|
|
|
|
|
|
|
|
|
if (mapped_stage != -1) {
|
|
|
|
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
2007-07-01 23:41:47 +02:00
|
|
|
|
if (tex_used && mapped_stage >= GL_LIMITS(textures)) {
|
|
|
|
|
FIXME("Attempt to enable unsupported stage!\n");
|
2007-01-03 19:18:38 +01:00
|
|
|
|
return;
|
2006-12-19 23:00:58 +01:00
|
|
|
|
}
|
2007-01-03 19:18:38 +01:00
|
|
|
|
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
|
|
|
|
checkGLcall("glActiveTextureARB");
|
|
|
|
|
} else if (stage > 0) {
|
|
|
|
|
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
2006-12-19 23:00:58 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(stage >= stateblock->lowest_disabled_stage) {
|
|
|
|
|
TRACE("Stage disabled\n");
|
2007-01-03 19:18:38 +01:00
|
|
|
|
if (mapped_stage != -1) {
|
|
|
|
|
/* Disable everything here */
|
|
|
|
|
glDisable(GL_TEXTURE_2D);
|
|
|
|
|
checkGLcall("glDisable(GL_TEXTURE_2D)");
|
|
|
|
|
glDisable(GL_TEXTURE_3D);
|
|
|
|
|
checkGLcall("glDisable(GL_TEXTURE_3D)");
|
2007-03-28 19:17:51 +02:00
|
|
|
|
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) {
|
|
|
|
|
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
|
|
|
|
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
|
|
|
|
|
}
|
2007-11-27 22:25:07 +01:00
|
|
|
|
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) {
|
|
|
|
|
glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-10 11:44:55 +01: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
|
|
|
|
|
*/
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_SAMPLER(stage))) {
|
2008-04-23 22:23:57 +02:00
|
|
|
|
if (tex_used) texture_activate_dimensions(stage, stateblock, context);
|
2007-01-10 11:44:55 +01:00
|
|
|
|
}
|
2006-12-19 23:00:58 +01:00
|
|
|
|
|
2008-07-06 01:31:34 +02:00
|
|
|
|
set_tex_op((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage,
|
|
|
|
|
stateblock->textureState[stage][WINED3DTSS_COLOROP],
|
|
|
|
|
stateblock->textureState[stage][WINED3DTSS_COLORARG1],
|
|
|
|
|
stateblock->textureState[stage][WINED3DTSS_COLORARG2],
|
|
|
|
|
stateblock->textureState[stage][WINED3DTSS_COLORARG0]);
|
2006-12-19 23:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-07-06 01:31:34 +02:00
|
|
|
|
void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-19 23:03:37 +01:00
|
|
|
|
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
2007-01-03 19:18:44 +01:00
|
|
|
|
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
2007-07-01 23:41:47 +02:00
|
|
|
|
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map[stage];
|
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 */
|
2007-01-03 19:18:44 +01:00
|
|
|
|
if (mapped_stage != -1) {
|
|
|
|
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
2007-07-01 23:41:47 +02:00
|
|
|
|
if (tex_used && mapped_stage >= GL_LIMITS(textures)) {
|
|
|
|
|
FIXME("Attempt to enable unsupported stage!\n");
|
2007-01-03 19:18:44 +01:00
|
|
|
|
return;
|
2006-12-19 23:03:37 +01:00
|
|
|
|
}
|
2007-01-03 19:18:44 +01:00
|
|
|
|
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
|
|
|
|
checkGLcall("glActiveTextureARB");
|
|
|
|
|
} else if (stage > 0) {
|
|
|
|
|
/* We can't do anything here */
|
|
|
|
|
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
2006-12-19 23:03:37 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-15 03:04:18 +01:00
|
|
|
|
op = stateblock->textureState[stage][WINED3DTSS_ALPHAOP];
|
|
|
|
|
arg1 = stateblock->textureState[stage][WINED3DTSS_ALPHAARG1];
|
|
|
|
|
arg2 = stateblock->textureState[stage][WINED3DTSS_ALPHAARG2];
|
|
|
|
|
arg0 = stateblock->textureState[stage][WINED3DTSS_ALPHAARG0];
|
|
|
|
|
|
|
|
|
|
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && stage == 0 &&
|
2007-11-27 22:25:07 +01:00
|
|
|
|
stateblock->textures[0] &&
|
|
|
|
|
(stateblock->textureDimensions[0] == GL_TEXTURE_2D || stateblock->textureDimensions[0] == GL_TEXTURE_RECTANGLE_ARB)) {
|
2007-02-15 03:04:18 +01:00
|
|
|
|
IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *) stateblock->textures[0])->surfaces[0];
|
|
|
|
|
|
2007-04-14 22:44:55 +02:00
|
|
|
|
if(surf->CKeyFlags & WINEDDSD_CKSRCBLT &&
|
2007-07-27 13:22:54 +02:00
|
|
|
|
getFormatDescEntry(surf->resource.format, NULL, NULL)->alphaMask == 0x00000000) {
|
2007-02-15 03:04:18 +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
|
2008-01-21 05:17:49 +01:00
|
|
|
|
* 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.
|
2007-02-15 03:04:18 +01:00
|
|
|
|
*
|
2008-01-21 05:17:49 +01:00
|
|
|
|
* 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.
|
|
|
|
|
|
2007-02-15 03:04:18 +01:00
|
|
|
|
* What to do with multitexturing? So far no app has been found that uses color keying with multitexturing
|
|
|
|
|
*/
|
2008-01-21 05:17:49 +01:00
|
|
|
|
if(op == WINED3DTOP_DISABLE) {
|
|
|
|
|
arg1 = WINED3DTA_TEXTURE;
|
|
|
|
|
op = WINED3DTOP_SELECTARG1;
|
|
|
|
|
}
|
|
|
|
|
else if(op == WINED3DTOP_SELECTARG1 && arg1 != WINED3DTA_TEXTURE) {
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE]) {
|
|
|
|
|
arg2 = WINED3DTA_TEXTURE;
|
|
|
|
|
op = WINED3DTOP_MODULATE;
|
|
|
|
|
}
|
|
|
|
|
else arg1 = WINED3DTA_TEXTURE;
|
|
|
|
|
}
|
|
|
|
|
else if(op == WINED3DTOP_SELECTARG2 && arg2 != WINED3DTA_TEXTURE) {
|
|
|
|
|
if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE]) {
|
|
|
|
|
arg1 = WINED3DTA_TEXTURE;
|
|
|
|
|
op = WINED3DTOP_MODULATE;
|
|
|
|
|
}
|
|
|
|
|
else arg2 = WINED3DTA_TEXTURE;
|
|
|
|
|
}
|
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);
|
|
|
|
|
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
|
|
|
|
|
set_tex_op_nvrc((IWineD3DDevice *)stateblock->wineD3DDevice, TRUE, stage,
|
2007-02-15 03:04:18 +01:00
|
|
|
|
op, arg1, arg2, arg0,
|
2008-03-29 13:55:59 +01:00
|
|
|
|
mapped_stage,
|
|
|
|
|
stateblock->textureState[stage][WINED3DTSS_RESULTARG]);
|
2006-12-19 23:03:37 +01:00
|
|
|
|
} else {
|
2007-02-15 03:04:18 +01:00
|
|
|
|
set_tex_op((IWineD3DDevice *)stateblock->wineD3DDevice, TRUE, stage,
|
|
|
|
|
op, arg1, arg2, arg0);
|
2006-12-19 23:03:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2008-08-26 21:25:56 +02:00
|
|
|
|
DWORD texUnit = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
2007-03-12 23:21:44 +01:00
|
|
|
|
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[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 */
|
2007-10-12 10:18:52 +02:00
|
|
|
|
if(use_vs(stateblock->wineD3DDevice) ||
|
2007-08-27 14:33:46 +02:00
|
|
|
|
isStateDirty(context, STATE_VDECL)) {
|
|
|
|
|
TRACE("Using a vertex shader, or stream sources not sorted out yet, skipping\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-04 01:34:55 +01:00
|
|
|
|
if (mapped_stage == -1) return;
|
2007-01-01 23:53:59 +01:00
|
|
|
|
|
|
|
|
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
2007-03-12 23:21:44 +01:00
|
|
|
|
if(mapped_stage >= GL_LIMITS(textures)) {
|
2007-01-01 23:53:59 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2007-03-12 23:21:44 +01:00
|
|
|
|
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
2007-01-01 23:53:59 +01:00
|
|
|
|
checkGLcall("glActiveTextureARB");
|
2007-03-12 23:21:44 +01:00
|
|
|
|
} else if (mapped_stage > 0) {
|
2007-01-01 23:53:59 +01:00
|
|
|
|
/* We can't do anything here */
|
|
|
|
|
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2007-11-13 22:08:13 +01:00
|
|
|
|
generated = (stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) != WINED3DTSS_TCI_PASSTHRU;
|
2008-07-22 20:56:07 +02:00
|
|
|
|
coordIdx = min(stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX & 0x0000FFFF], MAX_TEXTURES - 1);
|
2007-01-01 23:53:59 +01:00
|
|
|
|
|
2008-01-23 22:39:59 +01:00
|
|
|
|
set_texture_matrix(&stateblock->transforms[WINED3DTS_TEXTURE0 + texUnit].u.m[0][0],
|
2007-01-01 23:53:59 +01:00
|
|
|
|
stateblock->textureState[texUnit][WINED3DTSS_TEXTURETRANSFORMFLAGS],
|
2007-11-13 22:08:13 +01:00
|
|
|
|
generated,
|
2007-08-27 14:33:46 +02:00
|
|
|
|
context->last_was_rhw,
|
2008-07-22 20:56:07 +02:00
|
|
|
|
stateblock->wineD3DDevice->strided_streams.u.s.texCoords[coordIdx].dwStride ?
|
|
|
|
|
stateblock->wineD3DDevice->strided_streams.u.s.texCoords[coordIdx].dwType:
|
2008-08-23 22:41:51 +02:00
|
|
|
|
WINED3DDECLTYPE_UNUSED,
|
|
|
|
|
stateblock->wineD3DDevice->frag_pipe->ffp_proj_control);
|
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 */
|
|
|
|
|
if(context->lastWasPow2Texture[texUnit] && stateblock->textures[texUnit]) {
|
|
|
|
|
if(generated) {
|
|
|
|
|
FIXME("Non-power2 texture being used with generated texture coords\n");
|
|
|
|
|
}
|
|
|
|
|
TRACE("Non power two matrix multiply fixup\n");
|
|
|
|
|
glMultMatrixf(((IWineD3DTextureImpl *) stateblock->textures[texUnit])->baseTexture.pow2Matrix);
|
|
|
|
|
}
|
2007-01-01 23:53:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-05-09 19:08:10 +02:00
|
|
|
|
static void unloadTexCoords(IWineD3DStateBlockImpl *stateblock) {
|
|
|
|
|
int texture_idx;
|
|
|
|
|
|
2007-06-20 14:23:04 +02:00
|
|
|
|
for (texture_idx = 0; texture_idx < GL_LIMITS(texture_stages); ++texture_idx) {
|
2007-05-09 19:08:10 +02:00
|
|
|
|
GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + texture_idx));
|
|
|
|
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, WineDirect3DVertexStridedData *sd, GLint *curVBO) {
|
|
|
|
|
UINT *offset = stateblock->streamOffset;
|
|
|
|
|
unsigned int mapped_stage = 0;
|
|
|
|
|
unsigned int textureNo = 0;
|
|
|
|
|
|
2007-05-09 19:08:27 +02:00
|
|
|
|
/* The code below uses glClientActiveTexture and glMultiTexCoord* which are all part of the GL_ARB_multitexture extension. */
|
|
|
|
|
/* Abort if we don't support the extension. */
|
|
|
|
|
if (!GL_SUPPORT(ARB_MULTITEXTURE)) {
|
|
|
|
|
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-09 19:08:10 +02:00
|
|
|
|
for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
|
2007-05-09 19:08:27 +02:00
|
|
|
|
int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
|
|
|
|
|
|
|
|
|
|
mapped_stage = stateblock->wineD3DDevice->texUnitMap[textureNo];
|
|
|
|
|
if (mapped_stage == -1) continue;
|
2007-05-09 19:08:10 +02:00
|
|
|
|
|
2007-05-09 19:08:27 +02:00
|
|
|
|
if (coordIdx < MAX_TEXTURES && (sd->u.s.texCoords[coordIdx].lpData || sd->u.s.texCoords[coordIdx].VBO)) {
|
|
|
|
|
TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
|
|
|
|
|
textureNo, mapped_stage, coordIdx, sd->u.s.texCoords[coordIdx].lpData);
|
|
|
|
|
|
|
|
|
|
if (*curVBO != sd->u.s.texCoords[coordIdx].VBO) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.texCoords[coordIdx].VBO));
|
|
|
|
|
checkGLcall("glBindBufferARB");
|
|
|
|
|
*curVBO = sd->u.s.texCoords[coordIdx].VBO;
|
|
|
|
|
}
|
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 */
|
|
|
|
|
glTexCoordPointer(
|
|
|
|
|
WINED3D_ATR_SIZE(sd->u.s.texCoords[coordIdx].dwType),
|
|
|
|
|
WINED3D_ATR_GLTYPE(sd->u.s.texCoords[coordIdx].dwType),
|
|
|
|
|
sd->u.s.texCoords[coordIdx].dwStride,
|
|
|
|
|
sd->u.s.texCoords[coordIdx].lpData + stateblock->loadBaseVertexIndex * sd->u.s.texCoords[coordIdx].dwStride + offset[sd->u.s.texCoords[coordIdx].streamNo]);
|
|
|
|
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
|
|
|
} else {
|
|
|
|
|
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
2007-05-09 19:08:10 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
|
|
|
|
|
/* The number of the mapped stages increases monotonically, so it's fine to use the last used one */
|
|
|
|
|
for (textureNo = mapped_stage + 1; textureNo < GL_LIMITS(textures); ++textureNo) {
|
|
|
|
|
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-19 23:04:16 +01:00
|
|
|
|
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
2007-01-03 19:18:51 +01:00
|
|
|
|
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
|
|
|
|
|
|
|
|
|
if (mapped_stage == -1) {
|
|
|
|
|
TRACE("No texture unit mapped to stage %d. Skipping texture coordinates.\n", stage);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2006-12-19 23:04:16 +01:00
|
|
|
|
|
|
|
|
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
2007-06-25 22:45:21 +02:00
|
|
|
|
if(mapped_stage >= GL_LIMITS(fragment_samplers)) {
|
2006-12-19 23:04:16 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2007-01-03 19:18:51 +01:00
|
|
|
|
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
2006-12-19 23:04:16 +01:00
|
|
|
|
checkGLcall("glActiveTextureARB");
|
|
|
|
|
} else if (stage > 0) {
|
|
|
|
|
/* We can't do anything here */
|
|
|
|
|
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive
|
|
|
|
|
*
|
|
|
|
|
* FIXME: From MSDN: The WINED3DTSS_TCI_* flags are mutually exclusive. If you include
|
|
|
|
|
* one flag, you can still specify an index value, which the system uses to
|
|
|
|
|
* determine the texture wrapping mode.
|
|
|
|
|
* eg. SetTextureStageState( 0, WINED3DTSS_TEXCOORDINDEX, WINED3DTSS_TCI_CAMERASPACEPOSITION | 1 );
|
|
|
|
|
* means use the vertex position (camera-space) as the input texture coordinates
|
|
|
|
|
* for this texture stage, and the wrap mode set in the WINED3DRS_WRAP1 render
|
|
|
|
|
* state. We do not (yet) support the WINED3DRENDERSTATE_WRAPx values, nor tie them up
|
|
|
|
|
* to the TEXCOORDINDEX value
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Be careful the value of the mask 0xF0000 come from d3d8types.h infos
|
|
|
|
|
*/
|
|
|
|
|
switch (stateblock->textureState[stage][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) {
|
|
|
|
|
case WINED3DTSS_TCI_PASSTHRU:
|
|
|
|
|
/*Use the specified texture coordinates contained within the vertex format. This value resolves to zero.*/
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_S);
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_T);
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_R);
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_Q);
|
|
|
|
|
checkGLcall("glDisable(GL_TEXTURE_GEN_S,T,R,Q)");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
|
|
|
|
float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
|
|
|
|
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
|
|
|
|
|
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
|
|
|
|
|
TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
|
|
|
|
|
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
glPushMatrix();
|
|
|
|
|
glLoadIdentity();
|
|
|
|
|
glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
|
|
|
|
glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
|
|
|
|
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
|
|
|
|
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
|
|
|
|
glPopMatrix();
|
|
|
|
|
|
|
|
|
|
TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set GL_TEXTURE_GEN_x and GL_x, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR\n");
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_S);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_S)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
|
|
|
|
checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_T);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_T)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
|
|
|
|
checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_R);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_R)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
|
|
|
|
checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTSS_TCI_CAMERASPACENORMAL:
|
|
|
|
|
{
|
|
|
|
|
if (GL_SUPPORT(NV_TEXGEN_REFLECTION)) {
|
|
|
|
|
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
|
|
|
|
float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
|
|
|
|
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
|
|
|
|
|
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
|
|
|
|
|
TRACE("WINED3DTSS_TCI_CAMERASPACENORMAL - Set eye plane\n");
|
|
|
|
|
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
glPushMatrix();
|
|
|
|
|
glLoadIdentity();
|
|
|
|
|
glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
|
|
|
|
glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
|
|
|
|
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
|
|
|
|
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
|
|
|
|
glPopMatrix();
|
|
|
|
|
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_S);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_S)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
|
|
|
|
checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_T);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_T)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
|
|
|
|
checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_R);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_R)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
|
|
|
|
checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR:
|
|
|
|
|
{
|
|
|
|
|
if (GL_SUPPORT(NV_TEXGEN_REFLECTION)) {
|
|
|
|
|
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
|
|
|
|
|
float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
|
|
|
|
|
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
|
|
|
|
|
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
|
|
|
|
|
TRACE("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Set eye plane\n");
|
|
|
|
|
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
glPushMatrix();
|
|
|
|
|
glLoadIdentity();
|
|
|
|
|
glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
|
|
|
|
glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
|
|
|
|
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
|
|
|
|
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
|
|
|
|
glPopMatrix();
|
|
|
|
|
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_S);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_S)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
|
|
|
|
checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_T);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_T)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
|
|
|
|
checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
|
|
|
|
|
glEnable(GL_TEXTURE_GEN_R);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glEnable(GL_TEXTURE_GEN_R)");
|
2006-12-19 23:04:16 +01:00
|
|
|
|
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
|
|
|
|
checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Unhandled types: */
|
|
|
|
|
default:
|
|
|
|
|
/* Todo: */
|
|
|
|
|
/* ? disable GL_TEXTURE_GEN_n ? */
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_S);
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_T);
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_R);
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_Q);
|
|
|
|
|
FIXME("Unhandled WINED3DTSS_TEXCOORDINDEX %x\n", stateblock->textureState[stage][WINED3DTSS_TEXCOORDINDEX]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-01-01 23:53:59 +01:00
|
|
|
|
|
|
|
|
|
/* Update the texture matrix */
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_TEXTURE0 + stage))) {
|
2008-08-26 21:25:56 +02:00
|
|
|
|
transform_texture(STATE_TEXTURESTAGE(stage, WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
|
2007-01-01 23:53:59 +01:00
|
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
2007-02-12 19:18:31 +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
|
|
|
|
|
*/
|
2007-05-09 19:08:10 +02:00
|
|
|
|
GLint curVBO = GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT) ? -1 : 0;
|
|
|
|
|
|
|
|
|
|
unloadTexCoords(stateblock);
|
|
|
|
|
loadTexCoords(stateblock, &stateblock->wineD3DDevice->strided_streams, &curVBO);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
2006-12-19 23:04:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-09-01 20:11:17 +02:00
|
|
|
|
static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
|
|
|
|
|
|
|
|
|
/* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
|
|
|
|
|
* has an update pending
|
|
|
|
|
*/
|
|
|
|
|
if(isStateDirty(context, STATE_VDECL) ||
|
|
|
|
|
isStateDirty(context, STATE_PIXELSHADER)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
device->shader_backend->shader_load_constants((IWineD3DDevice *) device, use_ps(device), use_vs(device));
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-19 23:05:08 +01:00
|
|
|
|
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
|
|
|
|
|
2007-09-01 20:11:17 +02:00
|
|
|
|
if(stateblock->pixelShader && stage != 0 &&
|
2008-03-05 03:18:55 +01:00
|
|
|
|
((IWineD3DPixelShaderImpl *) stateblock->pixelShader)->baseShader.reg_maps.luminanceparams[stage]) {
|
2007-09-01 20:11:17 +02:00
|
|
|
|
/* The pixel shader has to know the luminance scale. Do a constants update if it
|
|
|
|
|
* isn't scheduled anyway
|
|
|
|
|
*/
|
|
|
|
|
if(!isStateDirty(context, STATE_PIXELSHADERCONSTANT) &&
|
|
|
|
|
!isStateDirty(context, STATE_PIXELSHADER)) {
|
|
|
|
|
shaderconstant(STATE_PIXELSHADERCONSTANT, stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-19 23:34:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-07-03 20:26:06 +02:00
|
|
|
|
static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
BOOL texIsPow2 = FALSE;
|
|
|
|
|
DWORD sampler = state - STATE_SAMPLER(0);
|
2008-07-16 22:45:45 +02:00
|
|
|
|
IWineD3DBaseTexture *texture = stateblock->textures[sampler];
|
2008-07-03 20:26:06 +02: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
|
|
|
|
|
* IWineD3DBaseTexture::ApplyStateChanges multiplies the set matrix with a fixup matrix. Before the
|
|
|
|
|
* scaling is reapplied or removed, the texture matrix has to be reapplied
|
|
|
|
|
*
|
|
|
|
|
* The mapped stage is alrady active because the sampler() function below, which is part of the
|
|
|
|
|
* misc pipeline
|
|
|
|
|
*/
|
2008-07-05 23:07:00 +02:00
|
|
|
|
if(sampler < MAX_TEXTURES) {
|
2008-07-03 20:26:06 +02:00
|
|
|
|
if(stateblock->textureDimensions[sampler] == GL_TEXTURE_2D ||
|
|
|
|
|
stateblock->textureDimensions[sampler] == GL_TEXTURE_RECTANGLE_ARB) {
|
2008-07-16 22:45:45 +02:00
|
|
|
|
if(((IWineD3DTextureImpl *)texture)->baseTexture.pow2Matrix[0] != 1.0 ||
|
|
|
|
|
((IWineD3DTextureImpl *)texture)->baseTexture.pow2Matrix[5] != 1.0 ) {
|
2008-07-03 20:26:06 +02:00
|
|
|
|
texIsPow2 = TRUE;
|
|
|
|
|
}
|
|
|
|
|
} else if(stateblock->textureDimensions[sampler] == GL_TEXTURE_CUBE_MAP_ARB) {
|
2008-07-16 22:45:45 +02:00
|
|
|
|
if(((IWineD3DCubeTextureImpl *)texture)->baseTexture.pow2Matrix[0] != 1.0) {
|
2008-07-03 20:26:06 +02:00
|
|
|
|
texIsPow2 = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(texIsPow2 || context->lastWasPow2Texture[sampler]) {
|
|
|
|
|
context->lastWasPow2Texture[sampler] = texIsPow2;
|
2008-08-26 21:25:56 +02:00
|
|
|
|
transform_texture(STATE_TEXTURESTAGE(stateblock->wineD3DDevice->texUnitMap[sampler], WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
|
2008-07-03 20:26:06 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2006-12-19 23:26:39 +01:00
|
|
|
|
DWORD sampler = state - STATE_SAMPLER(0);
|
2007-01-03 19:18:59 +01:00
|
|
|
|
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
|
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
|
|
|
|
|
|
|
|
|
if (mapped_stage == -1) {
|
|
|
|
|
TRACE("No sampler mapped to stage %d. Returning.\n", sampler);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-19 23:26:39 +01:00
|
|
|
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
2007-06-25 22:45:28 +02:00
|
|
|
|
if (mapped_stage >= GL_LIMITS(combined_samplers)) {
|
2006-12-19 23:26:39 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2007-01-03 19:18:59 +01:00
|
|
|
|
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
2006-12-19 23:26:39 +01:00
|
|
|
|
checkGLcall("glActiveTextureARB");
|
|
|
|
|
} else if (sampler > 0) {
|
|
|
|
|
/* We can't do anything here */
|
|
|
|
|
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(stateblock->textures[sampler]) {
|
2008-01-23 22:39:59 +01:00
|
|
|
|
IWineD3DBaseTexture_PreLoad(stateblock->textures[sampler]);
|
2006-12-19 23:26:39 +01:00
|
|
|
|
IWineD3DBaseTexture_ApplyStateChanges(stateblock->textures[sampler], stateblock->textureState[sampler], stateblock->samplerState[sampler]);
|
|
|
|
|
|
2007-01-02 00:07:55 +01:00
|
|
|
|
if (GL_SUPPORT(EXT_TEXTURE_LOD_BIAS)) {
|
|
|
|
|
tmpvalue.d = stateblock->samplerState[sampler][WINED3DSAMP_MIPMAPLODBIAS];
|
|
|
|
|
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
|
|
|
|
|
GL_TEXTURE_LOD_BIAS_EXT,
|
|
|
|
|
tmpvalue.f);
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glTexEnvi(GL_TEXTURE_LOD_BIAS_EXT, ...)");
|
2007-01-02 00:07:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-08-12 19:46:54 +02:00
|
|
|
|
if(!use_ps(stateblock->wineD3DDevice) && sampler < stateblock->lowest_disabled_stage) {
|
2006-12-19 23:26:39 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
|
2007-01-04 10:47:11 +01:00
|
|
|
|
/* If color keying is enabled update the alpha test, it depends on the existence
|
2006-12-19 23:26:39 +01:00
|
|
|
|
* of a color key in stage 0
|
|
|
|
|
*/
|
2007-02-12 19:18:22 +01:00
|
|
|
|
state_alpha(WINED3DRS_COLORKEYENABLE, stateblock, context);
|
2006-12-19 23:26:39 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-11-28 12:13:08 +01:00
|
|
|
|
} else if(mapped_stage < GL_LIMITS(textures)) {
|
2006-12-19 23:26:39 +01:00
|
|
|
|
if(sampler < stateblock->lowest_disabled_stage) {
|
2007-01-10 11:44:55 +01:00
|
|
|
|
/* TODO: What should I do with pixel shaders here ??? */
|
2007-12-27 09:23:59 +01:00
|
|
|
|
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
|
|
|
|
|
/* If color keying is enabled update the alpha test, it depends on the existence
|
|
|
|
|
* of a color key in stage 0
|
|
|
|
|
*/
|
|
|
|
|
state_alpha(WINED3DRS_COLORKEYENABLE, stateblock, context);
|
|
|
|
|
}
|
2006-12-19 23:26:39 +01:00
|
|
|
|
} /* Otherwise tex_colorop disables the stage */
|
2007-03-29 18:45:04 +02:00
|
|
|
|
glBindTexture(GL_TEXTURE_2D, stateblock->wineD3DDevice->dummyTextureName[sampler]);
|
|
|
|
|
checkGLcall("glBindTexture(GL_TEXTURE_2D, stateblock->wineD3DDevice->dummyTextureName[sampler])");
|
2006-12-19 23:26:39 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-04 17:55:26 +02:00
|
|
|
|
void apply_pshader_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
|
|
|
|
|
|
|
|
|
if (use_ps(device)) {
|
|
|
|
|
if(!context->last_was_pshader) {
|
|
|
|
|
state_fog(state, stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
context->last_was_pshader = TRUE;
|
|
|
|
|
} else {
|
|
|
|
|
if(context->last_was_pshader) {
|
|
|
|
|
state_fog(state, stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
context->last_was_pshader = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-06 01:31:34 +02:00
|
|
|
|
void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-03-12 23:22:00 +01:00
|
|
|
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
|
|
|
|
BOOL use_pshader = use_ps(device);
|
|
|
|
|
BOOL use_vshader = use_vs(device);
|
2006-12-19 23:22:19 +01:00
|
|
|
|
int i;
|
|
|
|
|
|
2007-03-12 23:22:00 +01:00
|
|
|
|
if (use_pshader) {
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(!context->last_was_pshader) {
|
2006-12-19 23:22:19 +01:00
|
|
|
|
/* Former draw without a pixel shader, some samplers
|
|
|
|
|
* may be disabled because of WINED3DTSS_COLOROP = WINED3DTOP_DISABLE
|
|
|
|
|
* make sure to enable them
|
|
|
|
|
*/
|
2007-06-25 22:45:40 +02:00
|
|
|
|
for(i=0; i < MAX_FRAGMENT_SAMPLERS; i++) {
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_SAMPLER(i))) {
|
2007-02-12 19:18:22 +01:00
|
|
|
|
sampler(STATE_SAMPLER(i), stateblock, context);
|
2006-12-19 23:22:19 +01: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.
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compile and bind the shader */
|
|
|
|
|
IWineD3DPixelShader_CompileShader(stateblock->pixelShader);
|
|
|
|
|
} else {
|
|
|
|
|
/* Disabled the pixel shader - color ops weren't applied
|
|
|
|
|
* while it was enabled, so re-apply them.
|
|
|
|
|
*/
|
|
|
|
|
for(i=0; i < MAX_TEXTURES; i++) {
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP))) {
|
2008-07-06 01:31:34 +02:00
|
|
|
|
device->StateTable[STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP)].apply
|
|
|
|
|
(STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP), stateblock, context);
|
2006-12-19 23:22:19 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-02-13 19:53:20 +01:00
|
|
|
|
}
|
2006-12-19 23:22:19 +01:00
|
|
|
|
|
2008-07-02 21:56:38 +02:00
|
|
|
|
if(!isStateDirty(context, device->StateTable[STATE_VSHADER].representative)) {
|
2007-03-12 23:22:00 +01:00
|
|
|
|
device->shader_backend->shader_select((IWineD3DDevice *)stateblock->wineD3DDevice, use_pshader, use_vshader);
|
2007-01-06 18:17:27 +01:00
|
|
|
|
|
2007-03-12 23:22:00 +01:00
|
|
|
|
if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (use_vshader || use_pshader)) {
|
2007-02-13 19:53:20 +01:00
|
|
|
|
shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
|
2007-01-06 18:14:12 +01:00
|
|
|
|
}
|
2006-12-19 23:22:19 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-04 23:54:06 +02:00
|
|
|
|
static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-02-15 03:05:17 +01:00
|
|
|
|
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
|
|
|
|
if(stateblock->pixelShader && stage != 0 &&
|
2008-03-05 03:18:55 +01:00
|
|
|
|
((IWineD3DPixelShaderImpl *) stateblock->pixelShader)->baseShader.reg_maps.bumpmat[stage]) {
|
2007-02-15 03:05:17 +01:00
|
|
|
|
/* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled
|
|
|
|
|
* anyway
|
|
|
|
|
*/
|
|
|
|
|
if(!isStateDirty(context, STATE_PIXELSHADERCONSTANT) &&
|
2008-07-04 23:54:06 +02:00
|
|
|
|
!isStateDirty(context, STATE_PIXELSHADER)) {
|
2007-02-15 03:05:17 +01:00
|
|
|
|
shaderconstant(STATE_PIXELSHADERCONSTANT, stateblock, context);
|
2008-07-12 04:16:28 +02:00
|
|
|
|
}
|
2007-02-15 03:05:17 +01:00
|
|
|
|
}
|
2008-07-04 23:54:06 +02:00
|
|
|
|
}
|
2007-05-04 14:28:09 +02:00
|
|
|
|
|
2008-07-04 23:54:06 +02:00
|
|
|
|
static void tex_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
|
|
|
|
float mat[2][2];
|
2008-07-05 23:14:00 +02:00
|
|
|
|
|
|
|
|
|
if(stage >= GL_LIMITS(texture_stages)) {
|
|
|
|
|
WARN("Bump env matrix of unsupported stage set\n");
|
|
|
|
|
} else if(GL_SUPPORT(ARB_MULTITEXTURE)) {
|
|
|
|
|
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stage));
|
|
|
|
|
checkGLcall("GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stage))");
|
|
|
|
|
}
|
|
|
|
|
mat[0][0] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT00]);
|
|
|
|
|
mat[1][0] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT01]);
|
|
|
|
|
mat[0][1] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT10]);
|
|
|
|
|
mat[1][1] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT11]);
|
|
|
|
|
GL_EXTCALL(glTexBumpParameterfvATI(GL_BUMP_ROT_MATRIX_ATI, (float *) mat));
|
|
|
|
|
checkGLcall("glTexBumpParameterfvATI");
|
2007-02-15 02:57:49 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
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
|
|
|
|
*/
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
checkGLcall("glMatrixMode");
|
|
|
|
|
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(context->last_was_rhw) {
|
2007-01-02 22:52:11 +01:00
|
|
|
|
glLoadIdentity();
|
|
|
|
|
checkGLcall("glLoadIdentity()");
|
2007-01-02 22:47:39 +01:00
|
|
|
|
} else {
|
2007-01-02 22:52:11 +01:00
|
|
|
|
/* In the general case, the view matrix is the identity matrix */
|
|
|
|
|
if (stateblock->wineD3DDevice->view_ident) {
|
2008-01-23 22:39:59 +01:00
|
|
|
|
glLoadMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
|
2007-01-02 22:52:11 +01:00
|
|
|
|
checkGLcall("glLoadMatrixf");
|
|
|
|
|
} else {
|
2008-01-23 22:39:59 +01:00
|
|
|
|
glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
2007-01-02 22:52:11 +01:00
|
|
|
|
checkGLcall("glLoadMatrixf");
|
2008-01-23 22:39:59 +01:00
|
|
|
|
glMultMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
|
2007-01-02 22:52:11 +01:00
|
|
|
|
checkGLcall("glMultMatrixf");
|
|
|
|
|
}
|
2007-01-02 22:47:39 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-28 14:36:36 +01:00
|
|
|
|
static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
UINT index = state - STATE_CLIPPLANE(0);
|
|
|
|
|
|
2007-03-02 14:58:40 +01:00
|
|
|
|
if(isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW)) || index >= GL_LIMITS(clipplanes)) {
|
2007-02-28 14:36:36 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
glPushMatrix();
|
2008-01-23 22:39:59 +01:00
|
|
|
|
glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
2007-02-28 14:36:36 +01:00
|
|
|
|
|
|
|
|
|
TRACE("Clipplane [%f,%f,%f,%f]\n",
|
|
|
|
|
stateblock->clipplane[index][0],
|
|
|
|
|
stateblock->clipplane[index][1],
|
|
|
|
|
stateblock->clipplane[index][2],
|
|
|
|
|
stateblock->clipplane[index][3]);
|
|
|
|
|
glClipPlane(GL_CLIP_PLANE0 + index, stateblock->clipplane[index]);
|
|
|
|
|
checkGLcall("glClipPlane");
|
|
|
|
|
|
|
|
|
|
glPopMatrix();
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-27 00:43:15 +02:00
|
|
|
|
static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
UINT matrix = state - STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0));
|
|
|
|
|
GLenum glMat;
|
|
|
|
|
TRACE("Setting world matrix %d\n", matrix);
|
|
|
|
|
|
|
|
|
|
if(matrix >= GL_LIMITS(blends)) {
|
|
|
|
|
WARN("Unsupported blend matrix set\n");
|
|
|
|
|
return;
|
|
|
|
|
} else if(isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW))) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* GL_MODELVIEW0_ARB: 0x1700
|
|
|
|
|
* GL_MODELVIEW1_ARB: 0x0x850a
|
|
|
|
|
* GL_MODELVIEW2_ARB: 0x8722
|
|
|
|
|
* GL_MODELVIEW3_ARB: 0x8723
|
|
|
|
|
* etc
|
|
|
|
|
* GL_MODELVIEW31_ARB: 0x873F
|
|
|
|
|
*/
|
|
|
|
|
if(matrix == 1) glMat = GL_MODELVIEW1_ARB;
|
|
|
|
|
else glMat = GL_MODELVIEW2_ARB - 2 + matrix;
|
|
|
|
|
|
|
|
|
|
glMatrixMode(glMat);
|
|
|
|
|
checkGLcall("glMatrixMode(glMat)");
|
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
*/
|
|
|
|
|
if(stateblock->wineD3DDevice->view_ident) {
|
|
|
|
|
glLoadMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(matrix)].u.m[0][0]);
|
|
|
|
|
checkGLcall("glLoadMatrixf")
|
|
|
|
|
} else {
|
|
|
|
|
glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
|
|
|
|
checkGLcall("glLoadMatrixf")
|
|
|
|
|
glMultMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(matrix)].u.m[0][0]);
|
|
|
|
|
checkGLcall("glMultMatrixf")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-05 23:21:26 +02:00
|
|
|
|
static void state_vertexblend_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
static BOOL once = FALSE;
|
|
|
|
|
|
|
|
|
|
switch(stateblock->renderState[WINED3DRS_VERTEXBLEND]) {
|
|
|
|
|
case WINED3DVBF_1WEIGHTS:
|
|
|
|
|
case WINED3DVBF_2WEIGHTS:
|
|
|
|
|
case WINED3DVBF_3WEIGHTS:
|
|
|
|
|
if(!once) {
|
|
|
|
|
once = TRUE;
|
|
|
|
|
/* TODO: Implement vertex blending in drawStridedSlow */
|
|
|
|
|
FIXME("Vertex blending enabled, but not supported by hardware\n");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DVBF_TWEENING:
|
|
|
|
|
WARN("Tweening not supported yet\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-27 00:43:15 +02:00
|
|
|
|
static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
WINED3DVERTEXBLENDFLAGS val = stateblock->renderState[WINED3DRS_VERTEXBLEND];
|
|
|
|
|
|
|
|
|
|
switch(val) {
|
|
|
|
|
case WINED3DVBF_1WEIGHTS:
|
|
|
|
|
case WINED3DVBF_2WEIGHTS:
|
|
|
|
|
case WINED3DVBF_3WEIGHTS:
|
2008-07-05 23:21:26 +02:00
|
|
|
|
glEnable(GL_VERTEX_BLEND_ARB);
|
|
|
|
|
checkGLcall("glEnable(GL_VERTEX_BLEND_ARB)");
|
2007-04-27 00:43:15 +02:00
|
|
|
|
|
2008-07-05 23:21:26 +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.
|
|
|
|
|
*/
|
|
|
|
|
GL_EXTCALL(glVertexBlendARB(stateblock->renderState[WINED3DRS_VERTEXBLEND] + 1));
|
|
|
|
|
|
|
|
|
|
if(!stateblock->wineD3DDevice->vertexBlendUsed) {
|
|
|
|
|
int i;
|
|
|
|
|
for(i = 1; i < GL_LIMITS(blends); i++) {
|
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i)))) {
|
|
|
|
|
transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i)), stateblock, context);
|
2007-04-27 00:43:15 +02:00
|
|
|
|
}
|
2007-10-07 10:57:46 +02:00
|
|
|
|
}
|
2008-07-05 23:21:26 +02:00
|
|
|
|
stateblock->wineD3DDevice->vertexBlendUsed = TRUE;
|
2007-04-27 00:43:15 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DVBF_DISABLE:
|
|
|
|
|
case WINED3DVBF_0WEIGHTS: /* for Indexed vertex blending - not supported */
|
2008-07-05 23:21:26 +02:00
|
|
|
|
glDisable(GL_VERTEX_BLEND_ARB);
|
|
|
|
|
checkGLcall("glDisable(GL_VERTEX_BLEND_ARB)");
|
2007-04-27 00:43:15 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DVBF_TWEENING:
|
|
|
|
|
/* Just set the vertex weight for weight 0, enable vertex blending and hope the app doesn't have
|
|
|
|
|
* vertex weights in the vertices?
|
|
|
|
|
* For now we don't report that as supported, so a warn should suffice
|
|
|
|
|
*/
|
|
|
|
|
WARN("Tweening not supported yet\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
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
|
|
|
|
|
*/
|
|
|
|
|
|
2007-02-14 17:46:54 +01:00
|
|
|
|
PLIGHTINFOEL *light = NULL;
|
2007-01-02 00:48:58 +01:00
|
|
|
|
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
checkGLcall("glMatrixMode(GL_MODELVIEW)");
|
2008-01-23 22:39:59 +01:00
|
|
|
|
glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
2007-01-02 00:48:58 +01:00
|
|
|
|
checkGLcall("glLoadMatrixf(...)");
|
|
|
|
|
|
|
|
|
|
/* Reset lights. TODO: Call light apply func */
|
2007-02-14 17:46:54 +01:00
|
|
|
|
for(k = 0; k < stateblock->wineD3DDevice->maxConcurrentLights; k++) {
|
|
|
|
|
light = stateblock->activeLights[k];
|
|
|
|
|
if(!light) continue;
|
|
|
|
|
glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightPosn);
|
2007-01-02 00:48:58 +01:00
|
|
|
|
checkGLcall("glLightfv posn");
|
2007-02-14 17:46:54 +01:00
|
|
|
|
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 */
|
2007-01-02 00:48:58 +01:00
|
|
|
|
for (k = 0; k < GL_LIMITS(clipplanes); k++) {
|
2007-02-28 14:36:36 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_CLIPPLANE(k))) {
|
|
|
|
|
clipplane(STATE_CLIPPLANE(k), stateblock, context);
|
|
|
|
|
}
|
2007-01-02 00:48:58 +01:00
|
|
|
|
}
|
2007-01-02 22:47:10 +01:00
|
|
|
|
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(context->last_was_rhw) {
|
2007-01-02 22:47:39 +01:00
|
|
|
|
glLoadIdentity();
|
|
|
|
|
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
|
|
|
|
|
* No need to do it here if the state is scheduled for update.
|
|
|
|
|
*/
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)))) {
|
2007-02-12 19:18:22 +01:00
|
|
|
|
transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock, context);
|
2007-01-02 22:47:39 +01:00
|
|
|
|
}
|
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 */
|
|
|
|
|
if(stateblock->wineD3DDevice->vertexBlendUsed) {
|
|
|
|
|
for(k = 1; k < GL_LIMITS(blends); k++) {
|
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k)))) {
|
|
|
|
|
transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k)), stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-02 00:25:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-01-02 22:50:38 +01:00
|
|
|
|
glMatrixMode(GL_PROJECTION);
|
|
|
|
|
checkGLcall("glMatrixMode(GL_PROJECTION)");
|
|
|
|
|
glLoadIdentity();
|
|
|
|
|
checkGLcall("glLoadIdentity");
|
|
|
|
|
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(context->last_was_rhw) {
|
2007-01-02 22:50:38 +01:00
|
|
|
|
double X, Y, height, width, minZ, maxZ;
|
|
|
|
|
|
|
|
|
|
X = stateblock->viewport.X;
|
|
|
|
|
Y = stateblock->viewport.Y;
|
|
|
|
|
height = stateblock->viewport.Height;
|
|
|
|
|
width = stateblock->viewport.Width;
|
|
|
|
|
minZ = stateblock->viewport.MinZ;
|
|
|
|
|
maxZ = stateblock->viewport.MaxZ;
|
|
|
|
|
|
|
|
|
|
if(!stateblock->wineD3DDevice->untransformed) {
|
|
|
|
|
/* Transformed vertices are supposed to bypass the whole transform pipeline including
|
|
|
|
|
* frustum clipping. This can't be done in opengl, so this code adjusts the Z range to
|
|
|
|
|
* suppress depth clipping. This can be done because it is an orthogonal projection and
|
2007-08-31 20:32:52 +02:00
|
|
|
|
* the Z coordinate does not affect the size of the primitives. Half Life 1 and Prince of
|
|
|
|
|
* Persia 3D need this.
|
|
|
|
|
*
|
|
|
|
|
* Note that using minZ and maxZ here doesn't entirely fix the problem, since view frustum
|
|
|
|
|
* clipping is still enabled, but it seems to fix it for all apps tested so far. A minor
|
|
|
|
|
* problem can be witnessed in half-life 1 engine based games, the weapon is clipped close
|
|
|
|
|
* to the viewer.
|
|
|
|
|
*
|
|
|
|
|
* Also note that this breaks z comparison against z values filled in with clear,
|
|
|
|
|
* but no app depending on that and disabled clipping has been found yet. Comparing
|
|
|
|
|
* primitives against themselves works, so the Z buffer is still intact for normal hidden
|
|
|
|
|
* surface removal.
|
|
|
|
|
*
|
|
|
|
|
* We could disable clipping entirely by setting the near to infinity and far to -infinity,
|
|
|
|
|
* but this would break Z buffer operation. Raising the range to something less than
|
|
|
|
|
* infinity would help a bit at the cost of Z precision, but it wouldn't eliminate the
|
|
|
|
|
* problem either.
|
2007-01-02 22:50:38 +01:00
|
|
|
|
*/
|
|
|
|
|
TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, -minZ, -maxZ);
|
2007-03-03 02:35:17 +01:00
|
|
|
|
if(stateblock->wineD3DDevice->render_offscreen) {
|
2007-03-03 13:51:43 +01:00
|
|
|
|
glOrtho(X, X + width, -Y, -Y - height, -minZ, -maxZ);
|
2007-03-03 02:35:17 +01:00
|
|
|
|
} else {
|
|
|
|
|
glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
|
|
|
|
|
}
|
2007-01-02 22:50:38 +01:00
|
|
|
|
} else {
|
|
|
|
|
/* If the app mixes transformed and untransformed primitives we can't use the coordinate system
|
|
|
|
|
* trick above because this would mess up transformed and untransformed Z order. Pass the z position
|
|
|
|
|
* unmodified to opengl.
|
|
|
|
|
*
|
|
|
|
|
* If the app depends on mixed types and disabled clipping we're out of luck without a pipeline
|
|
|
|
|
* replacement shader.
|
|
|
|
|
*/
|
|
|
|
|
TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, 1.0, -1.0);
|
2007-03-03 02:35:17 +01:00
|
|
|
|
if(stateblock->wineD3DDevice->render_offscreen) {
|
2007-08-31 20:32:52 +02:00
|
|
|
|
glOrtho(X, X + width, -Y, -Y - height, 0.0, -1.0);
|
2007-03-03 02:35:17 +01:00
|
|
|
|
} else {
|
2007-08-31 20:32:52 +02:00
|
|
|
|
glOrtho(X, X + width, Y + height, Y, 0.0, -1.0);
|
2007-03-03 02:35:17 +01:00
|
|
|
|
}
|
2007-01-02 22:50:38 +01:00
|
|
|
|
}
|
|
|
|
|
checkGLcall("glOrtho");
|
|
|
|
|
|
2007-08-19 19:43:44 +02:00
|
|
|
|
/* Window Coord 0 is the middle of the first pixel, so translate by 1/2 pixels */
|
|
|
|
|
glTranslatef(0.5, 0.5, 0);
|
|
|
|
|
checkGLcall("glTranslatef(0.5, 0.5, 0)");
|
2007-01-02 22:50:38 +01:00
|
|
|
|
/* D3D texture coordinates are flipped compared to OpenGL ones, so
|
|
|
|
|
* render everything upside down when rendering offscreen. */
|
|
|
|
|
if (stateblock->wineD3DDevice->render_offscreen) {
|
2007-12-25 23:14:05 +01:00
|
|
|
|
glScalef(1.0, -1.0, 1.0);
|
|
|
|
|
checkGLcall("glScalef");
|
2007-01-02 22:50:38 +01:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* The rule is that the window coordinate 0 does not correspond to the
|
|
|
|
|
beginning of the first pixel, but the center of the first pixel.
|
|
|
|
|
As a consequence if you want to correctly draw one line exactly from
|
|
|
|
|
the left to the right end of the viewport (with all matrices set to
|
|
|
|
|
be identity), the x coords of both ends of the line would be not
|
|
|
|
|
-1 and 1 respectively but (-1-1/viewport_widh) and (1-1/viewport_width)
|
2007-08-19 19:43:44 +02:00
|
|
|
|
instead.
|
|
|
|
|
|
|
|
|
|
1.0 / Width is used because the coord range goes from -1.0 to 1.0, then we
|
|
|
|
|
divide by the Width/Height, so we need the half range(1.0) to translate by
|
|
|
|
|
half a pixel.
|
2007-08-31 20:32:52 +02:00
|
|
|
|
|
|
|
|
|
The other fun is that d3d's output z range after the transformation is [0;1],
|
|
|
|
|
but opengl's is [-1;1]. Since the z buffer is in range [0;1] for both, gl
|
|
|
|
|
scales [-1;1] to [0;1]. This would mean that we end up in [0.5;1] and loose a lot
|
|
|
|
|
of Z buffer precision and the clear values do not match in the z test. Thus scale
|
|
|
|
|
[0;1] to [-1;1], so when gl undoes that we utilize the full z range
|
2007-08-19 19:43:44 +02:00
|
|
|
|
*/
|
2007-08-31 20:32:52 +02:00
|
|
|
|
glTranslatef(1.0 / stateblock->viewport.Width, -1.0/ stateblock->viewport.Height, -1.0);
|
|
|
|
|
checkGLcall("glTranslatef (1.0 / width, -1.0 / height, -1.0)");
|
2007-01-02 22:50:38 +01:00
|
|
|
|
if (stateblock->wineD3DDevice->render_offscreen) {
|
2007-12-26 22:12:05 +01:00
|
|
|
|
/* D3D texture coordinates are flipped compared to OpenGL ones, so
|
|
|
|
|
* render everything upside down when rendering offscreen. */
|
|
|
|
|
glScalef(1.0, -1.0, 2.0);
|
|
|
|
|
} else {
|
|
|
|
|
glScalef(1.0, 1.0, 2.0);
|
2007-01-02 22:50:38 +01:00
|
|
|
|
}
|
2007-12-26 22:12:05 +01:00
|
|
|
|
checkGLcall("glScalef");
|
|
|
|
|
|
2008-01-23 22:39:59 +01:00
|
|
|
|
glMultMatrixf(&stateblock->transforms[WINED3DTS_PROJECTION].u.m[0][0]);
|
2007-01-02 22:50:38 +01:00
|
|
|
|
checkGLcall("glLoadMatrixf");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-06 18:11:21 +01:00
|
|
|
|
/* This should match any arrays loaded in loadVertexData.
|
|
|
|
|
* stateblock impl is required for GL_SUPPORT
|
|
|
|
|
* TODO: Only load / unload arrays if we have to.
|
|
|
|
|
*/
|
|
|
|
|
static inline void unloadVertexData(IWineD3DStateBlockImpl *stateblock) {
|
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
|
|
|
|
glDisableClientState(GL_NORMAL_ARRAY);
|
|
|
|
|
glDisableClientState(GL_COLOR_ARRAY);
|
|
|
|
|
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
|
|
|
|
glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
|
|
|
|
}
|
2007-05-06 23:47:20 +02:00
|
|
|
|
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
|
|
|
|
|
glDisableClientState(GL_WEIGHT_ARRAY_ARB);
|
|
|
|
|
}
|
2007-05-09 19:08:10 +02:00
|
|
|
|
unloadTexCoords(stateblock);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This should match any arrays loaded in loadNumberedArrays
|
|
|
|
|
* TODO: Only load / unload arrays if we have to.
|
|
|
|
|
*/
|
|
|
|
|
static inline void unloadNumberedArrays(IWineD3DStateBlockImpl *stateblock) {
|
|
|
|
|
/* disable any attribs (this is the same for both GLSL and ARB modes) */
|
2008-03-22 18:28:52 +01:00
|
|
|
|
GLint maxAttribs = 16;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Leave all the attribs disabled */
|
|
|
|
|
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &maxAttribs);
|
|
|
|
|
/* MESA does not support it right not */
|
|
|
|
|
if (glGetError() != GL_NO_ERROR)
|
|
|
|
|
maxAttribs = 16;
|
|
|
|
|
for (i = 0; i < maxAttribs; ++i) {
|
|
|
|
|
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
|
2007-12-19 19:12:12 +01:00
|
|
|
|
checkGLcall("glDisableVertexAttribArrayARB(reg)");
|
2008-04-07 14:36:53 +02:00
|
|
|
|
/* Some Windows drivers(NV GF 7) use the latest value that was used when drawing with the now
|
|
|
|
|
* deactivated stream disabled, some other drivers(ATI, NV GF 8) set the undefined values to 0x00.
|
|
|
|
|
* Let's set them to 0x00 to avoid hitting some undefined aspects of OpenGL. All that is really
|
|
|
|
|
* important here is the glDisableVertexAttribArrayARB call above. The test shows that the refrast
|
2008-04-22 08:18:14 +02:00
|
|
|
|
* keeps dereferencing the pointers, which would cause crashes in some games like Half Life 2: Episode Two.
|
2008-04-07 14:36:53 +02:00
|
|
|
|
*/
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4NubARB(i, 0, 0, 0, 0));
|
|
|
|
|
checkGLcall("glVertexAttrib4NubARB(i, 0, 0, 0, 0)");
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock, WineDirect3DVertexStridedData *strided) {
|
|
|
|
|
GLint curVBO = GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT) ? -1 : 0;
|
|
|
|
|
int i;
|
2007-01-17 00:06:34 +01:00
|
|
|
|
UINT *offset = stateblock->streamOffset;
|
2007-12-19 17:18:39 +01:00
|
|
|
|
IWineD3DVertexBufferImpl *vb;
|
2007-12-20 23:40:12 +01:00
|
|
|
|
DWORD_PTR shift_index;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
2007-02-14 17:56:29 +01:00
|
|
|
|
/* Default to no instancing */
|
|
|
|
|
stateblock->wineD3DDevice->instancedDraw = FALSE;
|
|
|
|
|
|
2007-01-06 18:11:21 +01:00
|
|
|
|
for (i = 0; i < MAX_ATTRIBS; i++) {
|
|
|
|
|
|
|
|
|
|
if (!strided->u.input[i].lpData && !strided->u.input[i].VBO)
|
|
|
|
|
continue;
|
|
|
|
|
|
2007-02-14 17:56:29 +01:00
|
|
|
|
/* Do not load instance data. It will be specified using glTexCoord by drawprim */
|
2007-02-14 23:30:16 +01:00
|
|
|
|
if(stateblock->streamFlags[strided->u.input[i].streamNo] & WINED3DSTREAMSOURCE_INSTANCEDATA) {
|
2007-02-14 17:56:29 +01:00
|
|
|
|
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
|
|
|
|
|
stateblock->wineD3DDevice->instancedDraw = TRUE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-06 18:11:21 +01:00
|
|
|
|
TRACE_(d3d_shader)("Loading array %u [VBO=%u]\n", i, strided->u.input[i].VBO);
|
|
|
|
|
|
2007-02-14 17:55:56 +01:00
|
|
|
|
if(strided->u.input[i].dwStride) {
|
|
|
|
|
if(curVBO != strided->u.input[i].VBO) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, strided->u.input[i].VBO));
|
|
|
|
|
checkGLcall("glBindBufferARB");
|
|
|
|
|
curVBO = strided->u.input[i].VBO;
|
|
|
|
|
}
|
2007-12-19 17:18:39 +01:00
|
|
|
|
vb = (IWineD3DVertexBufferImpl *) stateblock->streamSource[strided->u.input[i].streamNo];
|
|
|
|
|
/* 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
|
|
|
|
|
*/
|
|
|
|
|
if(curVBO && vb->conv_shift) {
|
|
|
|
|
TRACE("Loading attribute from shifted buffer\n");
|
|
|
|
|
TRACE("Attrib %d has original stride %d, new stride %d\n", i, strided->u.input[i].dwStride, vb->conv_stride);
|
|
|
|
|
TRACE("Original offset %p, additional offset 0x%08x\n",strided->u.input[i].lpData, vb->conv_shift[(DWORD_PTR) strided->u.input[i].lpData]);
|
|
|
|
|
TRACE("Opengl type %x\n", WINED3D_ATR_GLTYPE(strided->u.input[i].dwType));
|
2007-12-20 23:40:12 +01:00
|
|
|
|
shift_index = ((DWORD_PTR) strided->u.input[i].lpData + offset[strided->u.input[i].streamNo]);
|
|
|
|
|
shift_index = shift_index % strided->u.input[i].dwStride;
|
2007-12-19 17:18:39 +01:00
|
|
|
|
GL_EXTCALL(glVertexAttribPointerARB(i,
|
|
|
|
|
WINED3D_ATR_SIZE(strided->u.input[i].dwType),
|
|
|
|
|
WINED3D_ATR_GLTYPE(strided->u.input[i].dwType),
|
|
|
|
|
WINED3D_ATR_NORMALIZED(strided->u.input[i].dwType),
|
|
|
|
|
vb->conv_stride,
|
|
|
|
|
|
2007-12-20 23:40:12 +01:00
|
|
|
|
strided->u.input[i].lpData + vb->conv_shift[shift_index] +
|
2007-12-19 17:18:39 +01:00
|
|
|
|
stateblock->loadBaseVertexIndex * strided->u.input[i].dwStride +
|
|
|
|
|
offset[strided->u.input[i].streamNo]));
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
GL_EXTCALL(glVertexAttribPointerARB(i,
|
|
|
|
|
WINED3D_ATR_SIZE(strided->u.input[i].dwType),
|
|
|
|
|
WINED3D_ATR_GLTYPE(strided->u.input[i].dwType),
|
|
|
|
|
WINED3D_ATR_NORMALIZED(strided->u.input[i].dwType),
|
|
|
|
|
strided->u.input[i].dwStride,
|
|
|
|
|
|
|
|
|
|
strided->u.input[i].lpData +
|
|
|
|
|
stateblock->loadBaseVertexIndex * strided->u.input[i].dwStride +
|
|
|
|
|
offset[strided->u.input[i].streamNo]) );
|
|
|
|
|
}
|
2007-02-14 17:55:56 +01:00
|
|
|
|
GL_EXTCALL(glEnableVertexAttribArrayARB(i));
|
|
|
|
|
} 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.
|
|
|
|
|
*/
|
|
|
|
|
BYTE *ptr = strided->u.input[i].lpData + offset[strided->u.input[i].streamNo];
|
|
|
|
|
if(strided->u.input[i].VBO) {
|
2007-12-19 17:18:39 +01:00
|
|
|
|
vb = (IWineD3DVertexBufferImpl *) stateblock->streamSource[strided->u.input[i].streamNo];
|
2007-02-14 17:55:56 +01:00
|
|
|
|
ptr += (long) vb->resource.allocatedMemory;
|
|
|
|
|
}
|
|
|
|
|
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
|
|
|
|
|
|
|
|
|
|
switch(strided->u.input[i].dwType) {
|
|
|
|
|
case WINED3DDECLTYPE_FLOAT1:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib1fvARB(i, (float *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DDECLTYPE_FLOAT2:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib2fvARB(i, (float *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DDECLTYPE_FLOAT3:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib3fvARB(i, (float *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DDECLTYPE_FLOAT4:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4fvARB(i, (float *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DDECLTYPE_UBYTE4:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4NubvARB(i, ptr));
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DDECLTYPE_UBYTE4N:
|
|
|
|
|
case WINED3DDECLTYPE_D3DCOLOR:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4NubvARB(i, ptr));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DDECLTYPE_SHORT2:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4svARB(i, (GLshort *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DDECLTYPE_SHORT4:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4svARB(i, (GLshort *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DDECLTYPE_SHORT2N:
|
|
|
|
|
{
|
|
|
|
|
GLshort s[4] = {((short *) ptr)[0], ((short *) ptr)[1], 0, 1};
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4NsvARB(i, s));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case WINED3DDECLTYPE_USHORT2N:
|
|
|
|
|
{
|
|
|
|
|
GLushort s[4] = {((unsigned short *) ptr)[0], ((unsigned short *) ptr)[1], 0, 1};
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4NusvARB(i, s));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case WINED3DDECLTYPE_SHORT4N:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4NsvARB(i, (GLshort *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
case WINED3DDECLTYPE_USHORT4N:
|
|
|
|
|
GL_EXTCALL(glVertexAttrib4NusvARB(i, (GLushort *) ptr));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DDECLTYPE_UDEC3:
|
|
|
|
|
FIXME("Unsure about WINED3DDECLTYPE_UDEC3\n");
|
2007-02-14 17:56:29 +01:00
|
|
|
|
/*glVertexAttrib3usvARB(i, (GLushort *) ptr); Does not exist */
|
2007-02-14 17:55:56 +01:00
|
|
|
|
break;
|
|
|
|
|
case WINED3DDECLTYPE_DEC3N:
|
|
|
|
|
FIXME("Unsure about WINED3DDECLTYPE_DEC3N\n");
|
2007-02-14 17:56:29 +01:00
|
|
|
|
/*glVertexAttrib3NusvARB(i, (GLushort *) ptr); Does not exist */
|
2007-02-14 17:55:56 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DDECLTYPE_FLOAT16_2:
|
|
|
|
|
/* 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;
|
|
|
|
|
case WINED3DDECLTYPE_FLOAT16_4:
|
|
|
|
|
FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_4\n");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DDECLTYPE_UNUSED:
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Used from 2 different functions, and too big to justify making it inlined */
|
|
|
|
|
static void loadVertexData(IWineD3DStateBlockImpl *stateblock, WineDirect3DVertexStridedData *sd) {
|
2007-01-17 00:06:34 +01:00
|
|
|
|
UINT *offset = stateblock->streamOffset;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
GLint curVBO = GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT) ? -1 : 0;
|
|
|
|
|
|
|
|
|
|
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 */
|
|
|
|
|
stateblock->wineD3DDevice->instancedDraw = FALSE;
|
|
|
|
|
|
2007-01-06 18:11:21 +01:00
|
|
|
|
/* Blend Data ---------------------------------------------- */
|
|
|
|
|
if( (sd->u.s.blendWeights.lpData) || (sd->u.s.blendWeights.VBO) ||
|
|
|
|
|
(sd->u.s.blendMatrixIndices.lpData) || (sd->u.s.blendMatrixIndices.VBO) ) {
|
|
|
|
|
|
|
|
|
|
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
|
|
|
|
|
TRACE("Blend %d %p %d\n", WINED3D_ATR_SIZE(sd->u.s.blendWeights.dwType),
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.blendWeights.lpData + stateblock->loadBaseVertexIndex * sd->u.s.blendWeights.dwStride, sd->u.s.blendWeights.dwStride + offset[sd->u.s.blendWeights.streamNo]);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
2007-04-27 00:43:15 +02:00
|
|
|
|
glEnableClientState(GL_WEIGHT_ARRAY_ARB);
|
|
|
|
|
checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
2007-04-27 00:43:15 +02:00
|
|
|
|
GL_EXTCALL(glVertexBlendARB(WINED3D_ATR_SIZE(sd->u.s.blendWeights.dwType) + 1));
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
|
|
|
|
VTRACE(("glWeightPointerARB(%d, GL_FLOAT, %d, %p)\n",
|
|
|
|
|
WINED3D_ATR_SIZE(sd->u.s.blendWeights.dwType) ,
|
|
|
|
|
sd->u.s.blendWeights.dwStride,
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.blendWeights.lpData + stateblock->loadBaseVertexIndex * sd->u.s.blendWeights.dwStride + offset[sd->u.s.blendWeights.streamNo]));
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
|
|
|
|
if(curVBO != sd->u.s.blendWeights.VBO) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.blendWeights.VBO));
|
|
|
|
|
checkGLcall("glBindBufferARB");
|
|
|
|
|
curVBO = sd->u.s.blendWeights.VBO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GL_EXTCALL(glWeightPointerARB)(
|
|
|
|
|
WINED3D_ATR_SIZE(sd->u.s.blendWeights.dwType),
|
|
|
|
|
WINED3D_ATR_GLTYPE(sd->u.s.blendWeights.dwType),
|
|
|
|
|
sd->u.s.blendWeights.dwStride,
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.blendWeights.lpData + stateblock->loadBaseVertexIndex * sd->u.s.blendWeights.dwStride + offset[sd->u.s.blendWeights.streamNo]);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
|
|
|
|
checkGLcall("glWeightPointerARB");
|
|
|
|
|
|
|
|
|
|
if((sd->u.s.blendMatrixIndices.lpData) || (sd->u.s.blendMatrixIndices.VBO)){
|
|
|
|
|
static BOOL showfixme = TRUE;
|
|
|
|
|
if(showfixme){
|
|
|
|
|
FIXME("blendMatrixIndices support\n");
|
|
|
|
|
showfixme = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} 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
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
|
2007-04-27 00:43:15 +02:00
|
|
|
|
static const GLbyte one = 1;
|
|
|
|
|
GL_EXTCALL(glWeightbvARB(1, &one));
|
|
|
|
|
checkGLcall("glWeightivARB(GL_LIMITS(blends), weights)");
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Point Size ----------------------------------------------*/
|
|
|
|
|
if (sd->u.s.pSize.lpData || sd->u.s.pSize.VBO) {
|
|
|
|
|
|
|
|
|
|
/* 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 -----------------------------------------*/
|
|
|
|
|
if (sd->u.s.position.lpData != NULL || sd->u.s.position.VBO != 0) {
|
|
|
|
|
/* Note dwType == float3 or float4 == 2 or 3 */
|
|
|
|
|
VTRACE(("glVertexPointer(%d, GL_FLOAT, %d, %p)\n",
|
|
|
|
|
sd->u.s.position.dwStride,
|
|
|
|
|
sd->u.s.position.dwType + 1,
|
|
|
|
|
sd->u.s.position.lpData));
|
|
|
|
|
|
|
|
|
|
if(curVBO != sd->u.s.position.VBO) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.position.VBO));
|
|
|
|
|
checkGLcall("glBindBufferARB");
|
|
|
|
|
curVBO = sd->u.s.position.VBO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* min(WINED3D_ATR_SIZE(position),3) to Disable RHW mode as 'w' coord
|
|
|
|
|
handling for rhw mode should not impact screen position whereas in GL it does.
|
2008-01-23 15:16:30 +01:00
|
|
|
|
This may result in very slightly distorted textures in rhw mode.
|
|
|
|
|
There's always the other option of fixing the view matrix to
|
|
|
|
|
prevent w from having any effect.
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
|
|
|
|
This only applies to user pointer sources, in VBOs the vertices are fixed up
|
|
|
|
|
*/
|
|
|
|
|
if(sd->u.s.position.VBO == 0) {
|
|
|
|
|
glVertexPointer(3 /* min(WINED3D_ATR_SIZE(sd->u.s.position.dwType),3) */,
|
|
|
|
|
WINED3D_ATR_GLTYPE(sd->u.s.position.dwType),
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.position.dwStride, sd->u.s.position.lpData + stateblock->loadBaseVertexIndex * sd->u.s.position.dwStride + offset[sd->u.s.position.streamNo]);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
} else {
|
|
|
|
|
glVertexPointer(
|
|
|
|
|
WINED3D_ATR_SIZE(sd->u.s.position.dwType),
|
|
|
|
|
WINED3D_ATR_GLTYPE(sd->u.s.position.dwType),
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.position.dwStride, sd->u.s.position.lpData + stateblock->loadBaseVertexIndex * sd->u.s.position.dwStride + offset[sd->u.s.position.streamNo]);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
|
|
|
|
checkGLcall("glVertexPointer(...)");
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
|
checkGLcall("glEnableClientState(GL_VERTEX_ARRAY)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Normals -------------------------------------------------*/
|
|
|
|
|
if (sd->u.s.normal.lpData || sd->u.s.normal.VBO) {
|
|
|
|
|
/* Note dwType == float3 or float4 == 2 or 3 */
|
|
|
|
|
VTRACE(("glNormalPointer(GL_FLOAT, %d, %p)\n",
|
|
|
|
|
sd->u.s.normal.dwStride,
|
|
|
|
|
sd->u.s.normal.lpData));
|
|
|
|
|
if(curVBO != sd->u.s.normal.VBO) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.normal.VBO));
|
|
|
|
|
checkGLcall("glBindBufferARB");
|
|
|
|
|
curVBO = sd->u.s.normal.VBO;
|
|
|
|
|
}
|
|
|
|
|
glNormalPointer(
|
|
|
|
|
WINED3D_ATR_GLTYPE(sd->u.s.normal.dwType),
|
|
|
|
|
sd->u.s.normal.dwStride,
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.normal.lpData + stateblock->loadBaseVertexIndex * sd->u.s.normal.dwStride + offset[sd->u.s.normal.streamNo]);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
checkGLcall("glNormalPointer(...)");
|
|
|
|
|
glEnableClientState(GL_NORMAL_ARRAY);
|
|
|
|
|
checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
|
|
|
|
|
|
|
|
|
|
} else {
|
2007-08-21 18:05:27 +02:00
|
|
|
|
glNormal3f(0, 0, 0);
|
|
|
|
|
checkGLcall("glNormal3f(0, 0, 0)");
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Diffuse Colour --------------------------------------------*/
|
|
|
|
|
/* WARNING: Data here MUST be in RGBA format, so cannot */
|
|
|
|
|
/* go directly into fast mode from app pgm, because */
|
|
|
|
|
/* directx requires data in BGRA format. */
|
2008-01-23 15:16:30 +01:00
|
|
|
|
/* currently fixupVertices swizzles the format, but this isn't*/
|
2008-04-22 08:18:14 +02:00
|
|
|
|
/* very practical when using VBOs */
|
2008-01-23 15:16:30 +01:00
|
|
|
|
/* NOTE: Unless we write a vertex shader to swizzle the colour*/
|
2007-01-06 18:11:21 +01:00
|
|
|
|
/* , or the user doesn't care and wants the speed advantage */
|
|
|
|
|
|
|
|
|
|
if (sd->u.s.diffuse.lpData || sd->u.s.diffuse.VBO) {
|
|
|
|
|
/* Note dwType == float3 or float4 == 2 or 3 */
|
|
|
|
|
VTRACE(("glColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n",
|
|
|
|
|
sd->u.s.diffuse.dwStride,
|
|
|
|
|
sd->u.s.diffuse.lpData));
|
|
|
|
|
|
|
|
|
|
if(curVBO != sd->u.s.diffuse.VBO) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.diffuse.VBO));
|
|
|
|
|
checkGLcall("glBindBufferARB");
|
|
|
|
|
curVBO = sd->u.s.diffuse.VBO;
|
|
|
|
|
}
|
2007-12-19 17:10:02 +01:00
|
|
|
|
|
|
|
|
|
glColorPointer(WINED3D_ATR_SIZE(sd->u.s.diffuse.dwType),
|
|
|
|
|
WINED3D_ATR_GLTYPE(sd->u.s.diffuse.dwType),
|
2007-01-06 18:11:21 +01:00
|
|
|
|
sd->u.s.diffuse.dwStride,
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.diffuse.lpData + stateblock->loadBaseVertexIndex * sd->u.s.diffuse.dwStride + offset[sd->u.s.diffuse.streamNo]);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
|
|
|
|
|
glEnableClientState(GL_COLOR_ARRAY);
|
|
|
|
|
checkGLcall("glEnableClientState(GL_COLOR_ARRAY)");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
|
|
|
checkGLcall("glColor4f(1, 1, 1, 1)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Specular Colour ------------------------------------------*/
|
|
|
|
|
if (sd->u.s.specular.lpData || sd->u.s.specular.VBO) {
|
|
|
|
|
TRACE("setting specular colour\n");
|
|
|
|
|
/* Note dwType == float3 or float4 == 2 or 3 */
|
|
|
|
|
VTRACE(("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n",
|
|
|
|
|
sd->u.s.specular.dwStride,
|
|
|
|
|
sd->u.s.specular.lpData));
|
|
|
|
|
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
|
|
|
|
if(curVBO != sd->u.s.specular.VBO) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.specular.VBO));
|
|
|
|
|
checkGLcall("glBindBufferARB");
|
|
|
|
|
curVBO = sd->u.s.specular.VBO;
|
|
|
|
|
}
|
2007-12-19 17:10:02 +01:00
|
|
|
|
GL_EXTCALL(glSecondaryColorPointerEXT)(WINED3D_ATR_SIZE(sd->u.s.specular.dwType),
|
|
|
|
|
WINED3D_ATR_GLTYPE(sd->u.s.specular.dwType),
|
2007-01-06 18:11:21 +01:00
|
|
|
|
sd->u.s.specular.dwStride,
|
2007-01-17 00:06:34 +01:00
|
|
|
|
sd->u.s.specular.lpData + stateblock->loadBaseVertexIndex * sd->u.s.specular.dwStride + offset[sd->u.s.specular.streamNo]);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
vcheckGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, ...)");
|
|
|
|
|
glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
|
|
|
|
vcheckGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
/* Missing specular color is not critical, no warnings */
|
|
|
|
|
VTRACE(("Specular colour is not supported in this GL implementation\n"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
|
|
|
|
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
|
|
|
|
|
checkGLcall("glSecondaryColor3fEXT(0, 0, 0)");
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
/* Missing specular color is not critical, no warnings */
|
|
|
|
|
VTRACE(("Specular colour is not supported in this GL implementation\n"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Texture coords -------------------------------------------*/
|
2007-05-09 19:08:10 +02:00
|
|
|
|
loadTexCoords(stateblock, sd, &curVBO);
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
|
static inline void drawPrimitiveTraceDataLocations(
|
2007-01-06 18:12:21 +01:00
|
|
|
|
WineDirect3DVertexStridedData *dataLocations) {
|
|
|
|
|
|
|
|
|
|
/* Dump out what parts we have supplied */
|
|
|
|
|
TRACE("Strided Data:\n");
|
|
|
|
|
TRACE_STRIDED((dataLocations), position);
|
|
|
|
|
TRACE_STRIDED((dataLocations), blendWeights);
|
|
|
|
|
TRACE_STRIDED((dataLocations), blendMatrixIndices);
|
|
|
|
|
TRACE_STRIDED((dataLocations), normal);
|
|
|
|
|
TRACE_STRIDED((dataLocations), pSize);
|
|
|
|
|
TRACE_STRIDED((dataLocations), diffuse);
|
|
|
|
|
TRACE_STRIDED((dataLocations), specular);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[0]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[1]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[2]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[3]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[4]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[5]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[6]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), texCoords[7]);
|
|
|
|
|
TRACE_STRIDED((dataLocations), position2);
|
|
|
|
|
TRACE_STRIDED((dataLocations), normal2);
|
|
|
|
|
TRACE_STRIDED((dataLocations), tangent);
|
|
|
|
|
TRACE_STRIDED((dataLocations), binormal);
|
|
|
|
|
TRACE_STRIDED((dataLocations), tessFactor);
|
|
|
|
|
TRACE_STRIDED((dataLocations), fog);
|
|
|
|
|
TRACE_STRIDED((dataLocations), depth);
|
|
|
|
|
TRACE_STRIDED((dataLocations), sample);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-02 17:02:19 +02:00
|
|
|
|
static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-01-02 22:47:10 +01:00
|
|
|
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
BOOL fixup = FALSE;
|
|
|
|
|
WineDirect3DVertexStridedData *dataLocations = &device->strided_streams;
|
2008-07-02 16:33:24 +02:00
|
|
|
|
BOOL useVertexShaderFunction;
|
|
|
|
|
|
|
|
|
|
if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader &&
|
|
|
|
|
((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) {
|
|
|
|
|
useVertexShaderFunction = TRUE;
|
|
|
|
|
} else {
|
|
|
|
|
useVertexShaderFunction = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-02 22:47:10 +01:00
|
|
|
|
|
|
|
|
|
if(device->up_strided) {
|
2007-01-02 21:31:08 +01:00
|
|
|
|
/* Note: this is a ddraw fixed-function code path */
|
|
|
|
|
TRACE("================ Strided Input ===================\n");
|
2007-01-06 18:11:21 +01:00
|
|
|
|
memcpy(dataLocations, device->up_strided, sizeof(*dataLocations));
|
2007-01-06 18:12:21 +01:00
|
|
|
|
|
|
|
|
|
if(TRACE_ON(d3d)) {
|
|
|
|
|
drawPrimitiveTraceDataLocations(dataLocations);
|
|
|
|
|
}
|
2007-06-04 14:16:32 +02:00
|
|
|
|
} else {
|
2007-01-02 21:31:08 +01:00
|
|
|
|
/* Note: This is a fixed function or shader codepath.
|
|
|
|
|
* This means it must handle both types of strided data.
|
|
|
|
|
* Shaders must go through here to zero the strided data, even if they
|
|
|
|
|
* don't set any declaration at all
|
|
|
|
|
*/
|
|
|
|
|
TRACE("================ Vertex Declaration ===================\n");
|
2007-01-06 18:11:21 +01:00
|
|
|
|
memset(dataLocations, 0, sizeof(*dataLocations));
|
2007-03-12 23:22:16 +01:00
|
|
|
|
primitiveDeclarationConvertToStridedData((IWineD3DDevice *) device,
|
|
|
|
|
useVertexShaderFunction, dataLocations, &fixup);
|
2007-06-04 14:16:32 +02:00
|
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
|
2007-03-12 23:22:00 +01:00
|
|
|
|
if (dataLocations->u.s.position_transformed) {
|
|
|
|
|
useVertexShaderFunction = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-06 18:11:21 +01:00
|
|
|
|
/* Unload the old arrays before loading the new ones to get old junk out */
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(context->numberedArraysLoaded) {
|
2007-01-06 18:11:21 +01:00
|
|
|
|
unloadNumberedArrays(stateblock);
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->numberedArraysLoaded = FALSE;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(context->namedArraysLoaded) {
|
2007-01-06 18:11:21 +01:00
|
|
|
|
unloadVertexData(stateblock);
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->namedArraysLoaded = FALSE;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(useVertexShaderFunction) {
|
2007-12-19 17:18:39 +01:00
|
|
|
|
if(((IWineD3DVertexDeclarationImpl *) stateblock->vertexDecl)->half_float_conv_needed && !fixup) {
|
|
|
|
|
TRACE("Using drawStridedSlow with vertex shaders for FLOAT16 conversion\n");
|
|
|
|
|
device->useDrawStridedSlow = TRUE;
|
|
|
|
|
context->numberedArraysLoaded = FALSE;
|
|
|
|
|
} else {
|
|
|
|
|
TRACE("Loading numbered arrays\n");
|
|
|
|
|
loadNumberedArrays(stateblock, dataLocations);
|
|
|
|
|
device->useDrawStridedSlow = FALSE;
|
|
|
|
|
context->numberedArraysLoaded = TRUE;
|
|
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
} else if (fixup ||
|
|
|
|
|
(dataLocations->u.s.pSize.lpData == NULL &&
|
|
|
|
|
dataLocations->u.s.diffuse.lpData == NULL &&
|
|
|
|
|
dataLocations->u.s.specular.lpData == NULL)) {
|
|
|
|
|
/* Load the vertex data using named arrays */
|
|
|
|
|
TRACE("Loading vertex data\n");
|
|
|
|
|
loadVertexData(stateblock, dataLocations);
|
|
|
|
|
device->useDrawStridedSlow = FALSE;
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->namedArraysLoaded = TRUE;
|
2007-01-06 18:11:21 +01:00
|
|
|
|
} else {
|
|
|
|
|
TRACE("Not loading vertex data\n");
|
|
|
|
|
device->useDrawStridedSlow = TRUE;
|
|
|
|
|
}
|
2007-01-06 18:13:21 +01:00
|
|
|
|
|
|
|
|
|
/* Generate some fixme's if unsupported functionality is being used */
|
|
|
|
|
#define BUFFER_OR_DATA(_attribute) dataLocations->u.s._attribute.lpData
|
|
|
|
|
/* TODO: Either support missing functionality in fixupVertices or by creating a shader to replace the pipeline. */
|
|
|
|
|
if (!useVertexShaderFunction && (BUFFER_OR_DATA(position2) || BUFFER_OR_DATA(normal2))) {
|
|
|
|
|
FIXME("Tweening is only valid with vertex shaders\n");
|
|
|
|
|
}
|
2008-07-05 23:37:47 +02:00
|
|
|
|
if (!useVertexShaderFunction && BUFFER_OR_DATA(binormal)) {
|
|
|
|
|
FIXME("Binormal bump mapping is only valid with vertex shaders\n");
|
2007-01-06 18:13:21 +01:00
|
|
|
|
}
|
|
|
|
|
if (!useVertexShaderFunction && (BUFFER_OR_DATA(tessFactor) || BUFFER_OR_DATA(fog) || BUFFER_OR_DATA(depth) || BUFFER_OR_DATA(sample))) {
|
|
|
|
|
FIXME("Extended attributes are only valid with vertex shaders\n");
|
|
|
|
|
}
|
|
|
|
|
#undef BUFFER_OR_DATA
|
2007-01-04 00:13:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 19:18:22 +01:00
|
|
|
|
static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-08-27 14:33:46 +02:00
|
|
|
|
BOOL useVertexShaderFunction = FALSE, updateFog = FALSE;
|
2007-02-13 19:53:11 +01:00
|
|
|
|
BOOL usePixelShaderFunction = stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE && stateblock->pixelShader
|
|
|
|
|
&& ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function;
|
2007-01-04 00:13:15 +01:00
|
|
|
|
BOOL transformed;
|
|
|
|
|
/* Some stuff is in the device until we have per context tracking */
|
|
|
|
|
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
|
2007-02-12 19:18:27 +01:00
|
|
|
|
BOOL wasrhw = context->last_was_rhw;
|
2007-01-04 00:13:15 +01:00
|
|
|
|
|
|
|
|
|
/* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
|
|
|
|
|
* here simply check whether a shader was set, or the user disabled shaders
|
|
|
|
|
*/
|
2008-07-02 16:33:24 +02:00
|
|
|
|
if (use_vs(device)) {
|
2007-01-04 00:13:15 +01:00
|
|
|
|
useVertexShaderFunction = TRUE;
|
|
|
|
|
|
2007-04-20 21:49:21 +02:00
|
|
|
|
if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.reg_maps.fog != context->last_was_foggy_shader) {
|
2007-01-04 00:13:15 +01:00
|
|
|
|
updateFog = TRUE;
|
|
|
|
|
}
|
2007-02-12 19:18:27 +01:00
|
|
|
|
} else if(context->last_was_foggy_shader) {
|
2007-01-04 00:13:15 +01:00
|
|
|
|
updateFog = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-12 23:22:06 +01:00
|
|
|
|
transformed = device->strided_streams.u.s.position_transformed;
|
2007-03-12 23:22:00 +01:00
|
|
|
|
if (transformed) useVertexShaderFunction = FALSE;
|
2007-01-02 22:47:10 +01:00
|
|
|
|
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(transformed != context->last_was_rhw && !useVertexShaderFunction) {
|
2007-01-02 22:47:10 +01:00
|
|
|
|
updateFog = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-20 15:57:10 +01:00
|
|
|
|
/* Reapply lighting if it is not scheduled for reapplication already */
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_LIGHTING))) {
|
2007-02-12 19:18:22 +01:00
|
|
|
|
state_lighting(STATE_RENDER(WINED3DRS_LIGHTING), stateblock, context);
|
2007-01-02 22:47:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-03-12 23:22:00 +01:00
|
|
|
|
if (transformed) {
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->last_was_rhw = TRUE;
|
2007-01-02 22:47:10 +01:00
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
/* Untransformed, so relies on the view and projection matrices */
|
2007-02-12 19:18:27 +01:00
|
|
|
|
context->last_was_rhw = FALSE;
|
2007-01-02 22:47:39 +01:00
|
|
|
|
/* This turns off the Z scale trick to 'disable' viewport frustum clipping in rhw mode*/
|
2007-01-02 22:47:10 +01:00
|
|
|
|
device->untransformed = TRUE;
|
|
|
|
|
|
2007-01-02 22:52:11 +01:00
|
|
|
|
/* Todo for sw shaders: Vertex Shader output is already transformed, so set up identity matrices
|
|
|
|
|
* Not needed as long as only hw shaders are supported
|
2007-01-02 22:47:39 +01:00
|
|
|
|
*/
|
2007-01-02 22:47:10 +01:00
|
|
|
|
|
2007-01-02 22:52:11 +01:00
|
|
|
|
/* This sets the shader output position correction constants.
|
|
|
|
|
* TODO: Move to the viewport state
|
|
|
|
|
*/
|
2007-01-02 22:47:10 +01:00
|
|
|
|
if (useVertexShaderFunction) {
|
|
|
|
|
device->posFixup[1] = device->render_offscreen ? -1.0 : 1.0;
|
2007-11-21 23:46:15 +01:00
|
|
|
|
device->posFixup[3] = -device->posFixup[1] / stateblock->viewport.Height;
|
2007-01-02 22:47:10 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-02 22:52:11 +01: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
|
2007-01-02 22:50:38 +01:00
|
|
|
|
*/
|
2007-01-02 22:52:11 +01:00
|
|
|
|
if(!useVertexShaderFunction) {
|
|
|
|
|
/* TODO: Move this mainly to the viewport state and only apply when the vp has changed
|
|
|
|
|
* or transformed / untransformed was switched
|
|
|
|
|
*/
|
2007-02-12 19:18:27 +01:00
|
|
|
|
if(wasrhw != context->last_was_rhw &&
|
2007-02-12 19:18:31 +01:00
|
|
|
|
!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION)) &&
|
|
|
|
|
!isStateDirty(context, STATE_VIEWPORT)) {
|
2007-02-12 19:18:22 +01:00
|
|
|
|
transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
|
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
|
|
|
|
|
*/
|
|
|
|
|
if(transformed != wasrhw &&
|
2007-02-12 19:18:31 +01:00
|
|
|
|
!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0))) &&
|
|
|
|
|
!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW))) {
|
2007-02-12 19:18:22 +01:00
|
|
|
|
transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock, context);
|
2007-01-02 22:52:11 +01:00
|
|
|
|
}
|
2007-01-10 11:26:12 +01:00
|
|
|
|
|
2007-02-12 19:18:31 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_COLORVERTEX))) {
|
2007-02-12 19:18:22 +01:00
|
|
|
|
state_colormat(STATE_RENDER(WINED3DRS_COLORVERTEX), stateblock, context);
|
2007-01-10 11:26:12 +01:00
|
|
|
|
}
|
2007-02-27 23:11:15 +01:00
|
|
|
|
|
|
|
|
|
if(context->last_was_vshader && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) {
|
|
|
|
|
state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context);
|
|
|
|
|
}
|
2007-08-21 18:05:27 +02:00
|
|
|
|
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_NORMALIZENORMALS))) {
|
|
|
|
|
state_normalize(STATE_RENDER(WINED3DRS_NORMALIZENORMALS), stateblock, context);
|
|
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
} else {
|
|
|
|
|
/* We compile the shader here because we need the vertex declaration
|
|
|
|
|
* in order to determine if we need to do any swizzling for D3DCOLOR
|
|
|
|
|
* registers. If the shader is already compiled this call will do nothing. */
|
|
|
|
|
IWineD3DVertexShader_CompileShader(stateblock->vertexShader);
|
2007-02-27 23:11:15 +01:00
|
|
|
|
|
|
|
|
|
if(!context->last_was_vshader) {
|
|
|
|
|
int i;
|
|
|
|
|
static BOOL warned = FALSE;
|
|
|
|
|
/* Disable all clip planes to get defined results on all drivers. See comment in the
|
|
|
|
|
* state_clipping state handler
|
|
|
|
|
*/
|
|
|
|
|
for(i = 0; i < GL_LIMITS(clipplanes); i++) {
|
|
|
|
|
glDisable(GL_CLIP_PLANE0 + i);
|
|
|
|
|
checkGLcall("glDisable(GL_CLIP_PLANE0 + i)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!warned && stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]) {
|
|
|
|
|
FIXME("Clipping not supported with vertex shaders\n");
|
|
|
|
|
warned = TRUE;
|
|
|
|
|
}
|
2007-11-11 21:46:17 +01:00
|
|
|
|
if(wasrhw) {
|
|
|
|
|
/* Apply the transform matrices when switching from rhw drawing to vertex shaders. Vertex
|
2007-12-07 01:03:54 +01:00
|
|
|
|
* shaders themselves do not need it, but the matrices are not reapplied automatically when
|
2007-11-11 21:46:17 +01:00
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
|
|
|
|
|
transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)))) {
|
|
|
|
|
transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
/* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
|
|
|
|
|
* application
|
|
|
|
|
*/
|
|
|
|
|
if (!isStateDirty(context, STATE_PIXELSHADER)) {
|
|
|
|
|
device->shader_backend->shader_select((IWineD3DDevice *)device, usePixelShaderFunction, useVertexShaderFunction);
|
2007-01-06 18:14:12 +01:00
|
|
|
|
|
2007-02-13 19:53:11 +01:00
|
|
|
|
if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (useVertexShaderFunction || usePixelShaderFunction)) {
|
|
|
|
|
shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
|
2007-01-06 18:14:12 +01:00
|
|
|
|
}
|
2007-01-06 18:11:21 +01:00
|
|
|
|
}
|
2007-01-02 22:50:38 +01:00
|
|
|
|
|
2007-02-13 19:53:11 +01:00
|
|
|
|
context->last_was_vshader = useVertexShaderFunction;
|
|
|
|
|
|
2007-01-02 22:47:10 +01:00
|
|
|
|
if(updateFog) {
|
2007-02-12 19:18:22 +01:00
|
|
|
|
state_fog(STATE_RENDER(WINED3DRS_FOGENABLE), stateblock, context);
|
2007-01-02 22:47:10 +01:00
|
|
|
|
}
|
2007-08-27 14:33:46 +02:00
|
|
|
|
if(!useVertexShaderFunction) {
|
2007-08-19 12:50:14 +02:00
|
|
|
|
int i;
|
|
|
|
|
for(i = 0; i < MAX_TEXTURES; i++) {
|
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_TEXTURE0 + i))) {
|
2008-08-26 21:25:56 +02:00
|
|
|
|
transform_texture(STATE_TEXTURESTAGE(i, WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
|
2007-08-19 12:50:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-02 00:35:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-07-02 20:16:23 +02:00
|
|
|
|
static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-11-30 21:01:29 +01:00
|
|
|
|
UINT width, height;
|
|
|
|
|
IWineD3DSurfaceImpl *target;
|
|
|
|
|
|
2007-01-04 00:05:05 +01:00
|
|
|
|
glDepthRange(stateblock->viewport.MinZ, stateblock->viewport.MaxZ);
|
|
|
|
|
checkGLcall("glDepthRange");
|
2007-03-06 14:56:58 +01:00
|
|
|
|
/* Note: GL requires lower left, DirectX supplies upper left. This is reversed when using offscreen rendering
|
|
|
|
|
*/
|
|
|
|
|
if(stateblock->wineD3DDevice->render_offscreen) {
|
|
|
|
|
glViewport(stateblock->viewport.X,
|
|
|
|
|
stateblock->viewport.Y,
|
|
|
|
|
stateblock->viewport.Width, stateblock->viewport.Height);
|
|
|
|
|
} else {
|
2007-11-30 21:01:29 +01:00
|
|
|
|
target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
|
|
|
|
|
target->get_drawable_size(target, &width, &height);
|
|
|
|
|
|
2007-03-06 14:56:58 +01:00
|
|
|
|
glViewport(stateblock->viewport.X,
|
2007-11-30 21:01:29 +01:00
|
|
|
|
(height - (stateblock->viewport.Y + stateblock->viewport.Height)),
|
2007-03-06 14:56:58 +01:00
|
|
|
|
stateblock->viewport.Width, stateblock->viewport.Height);
|
|
|
|
|
}
|
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
|
|
|
|
|
2008-07-02 20:16:23 +02:00
|
|
|
|
static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2007-08-19 19:43:44 +02:00
|
|
|
|
stateblock->wineD3DDevice->posFixup[2] = 1.0 / stateblock->viewport.Width;
|
2007-11-21 23:46:15 +01:00
|
|
|
|
stateblock->wineD3DDevice->posFixup[3] = -stateblock->wineD3DDevice->posFixup[1] / stateblock->viewport.Height;
|
2007-02-15 13:32:13 +01:00
|
|
|
|
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
|
|
|
|
|
transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
|
2007-01-04 00:05:05 +01:00
|
|
|
|
}
|
2007-10-22 12:15:03 +02:00
|
|
|
|
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_POINTSCALEENABLE))) {
|
|
|
|
|
state_pscale(STATE_RENDER(WINED3DRS_POINTSCALEENABLE), stateblock, context);
|
|
|
|
|
}
|
2007-01-04 00:05:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-02-14 17:48:52 +01:00
|
|
|
|
static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
UINT Index = state - STATE_ACTIVELIGHT(0);
|
|
|
|
|
PLIGHTINFOEL *lightInfo = stateblock->activeLights[Index];
|
|
|
|
|
|
|
|
|
|
if(!lightInfo) {
|
|
|
|
|
glDisable(GL_LIGHT0 + Index);
|
|
|
|
|
checkGLcall("glDisable(GL_LIGHT0 + Index)");
|
|
|
|
|
} else {
|
|
|
|
|
float quad_att;
|
|
|
|
|
float colRGBA[] = {0.0, 0.0, 0.0, 0.0};
|
|
|
|
|
|
|
|
|
|
/* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
|
glPushMatrix();
|
2008-01-23 22:39:59 +01:00
|
|
|
|
glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
2007-02-14 17:48:52 +01:00
|
|
|
|
|
|
|
|
|
/* Diffuse: */
|
|
|
|
|
colRGBA[0] = lightInfo->OriginalParms.Diffuse.r;
|
|
|
|
|
colRGBA[1] = lightInfo->OriginalParms.Diffuse.g;
|
|
|
|
|
colRGBA[2] = lightInfo->OriginalParms.Diffuse.b;
|
|
|
|
|
colRGBA[3] = lightInfo->OriginalParms.Diffuse.a;
|
|
|
|
|
glLightfv(GL_LIGHT0 + Index, GL_DIFFUSE, colRGBA);
|
|
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
|
|
|
|
|
/* Specular */
|
|
|
|
|
colRGBA[0] = lightInfo->OriginalParms.Specular.r;
|
|
|
|
|
colRGBA[1] = lightInfo->OriginalParms.Specular.g;
|
|
|
|
|
colRGBA[2] = lightInfo->OriginalParms.Specular.b;
|
|
|
|
|
colRGBA[3] = lightInfo->OriginalParms.Specular.a;
|
|
|
|
|
glLightfv(GL_LIGHT0 + Index, GL_SPECULAR, colRGBA);
|
|
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
|
|
|
|
|
/* Ambient */
|
|
|
|
|
colRGBA[0] = lightInfo->OriginalParms.Ambient.r;
|
|
|
|
|
colRGBA[1] = lightInfo->OriginalParms.Ambient.g;
|
|
|
|
|
colRGBA[2] = lightInfo->OriginalParms.Ambient.b;
|
|
|
|
|
colRGBA[3] = lightInfo->OriginalParms.Ambient.a;
|
|
|
|
|
glLightfv(GL_LIGHT0 + Index, GL_AMBIENT, colRGBA);
|
|
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
|
|
|
|
|
if ((lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range) >= FLT_MIN) {
|
|
|
|
|
quad_att = 1.4/(lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range);
|
|
|
|
|
} else {
|
|
|
|
|
quad_att = 0; /* 0 or MAX? (0 seems to be ok) */
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
switch (lightInfo->OriginalParms.Type) {
|
|
|
|
|
case WINED3DLIGHT_POINT:
|
|
|
|
|
/* Position */
|
|
|
|
|
glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]);
|
|
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
|
|
|
|
checkGLcall("glLightf");
|
2007-02-20 22:43:13 +01:00
|
|
|
|
/* Attenuation - Are these right? guessing... */
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_CONSTANT_ATTENUATION, lightInfo->OriginalParms.Attenuation0);
|
|
|
|
|
checkGLcall("glLightf");
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_LINEAR_ATTENUATION, lightInfo->OriginalParms.Attenuation1);
|
|
|
|
|
checkGLcall("glLightf");
|
|
|
|
|
if (quad_att < lightInfo->OriginalParms.Attenuation2) quad_att = lightInfo->OriginalParms.Attenuation2;
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_QUADRATIC_ATTENUATION, quad_att);
|
|
|
|
|
checkGLcall("glLightf");
|
2007-02-14 17:48:52 +01:00
|
|
|
|
/* FIXME: Range */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DLIGHT_SPOT:
|
|
|
|
|
/* Position */
|
|
|
|
|
glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]);
|
|
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
/* Direction */
|
|
|
|
|
glLightfv(GL_LIGHT0 + Index, GL_SPOT_DIRECTION, &lightInfo->lightDirn[0]);
|
|
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_SPOT_EXPONENT, lightInfo->exponent);
|
|
|
|
|
checkGLcall("glLightf");
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
|
|
|
|
checkGLcall("glLightf");
|
2007-02-20 22:43:13 +01:00
|
|
|
|
/* Attenuation - Are these right? guessing... */
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_CONSTANT_ATTENUATION, lightInfo->OriginalParms.Attenuation0);
|
|
|
|
|
checkGLcall("glLightf");
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_LINEAR_ATTENUATION, lightInfo->OriginalParms.Attenuation1);
|
|
|
|
|
checkGLcall("glLightf");
|
|
|
|
|
if (quad_att < lightInfo->OriginalParms.Attenuation2) quad_att = lightInfo->OriginalParms.Attenuation2;
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_QUADRATIC_ATTENUATION, quad_att);
|
|
|
|
|
checkGLcall("glLightf");
|
2007-02-14 17:48:52 +01:00
|
|
|
|
/* FIXME: Range */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WINED3DLIGHT_DIRECTIONAL:
|
|
|
|
|
/* Direction */
|
|
|
|
|
glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]); /* Note gl uses w position of 0 for direction! */
|
|
|
|
|
checkGLcall("glLightfv");
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
|
|
|
|
checkGLcall("glLightf");
|
|
|
|
|
glLightf(GL_LIGHT0 + Index, GL_SPOT_EXPONENT, 0.0f);
|
|
|
|
|
checkGLcall("glLightf");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
FIXME("Unrecognized light type %d\n", lightInfo->OriginalParms.Type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Restore the modelview matrix */
|
|
|
|
|
glPopMatrix();
|
|
|
|
|
|
|
|
|
|
glEnable(GL_LIGHT0 + Index);
|
|
|
|
|
checkGLcall("glEnable(GL_LIGHT0 + Index)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-19 15:25:16 +01:00
|
|
|
|
static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
RECT *pRect = &stateblock->scissorRect;
|
2007-11-30 20:28:13 +01:00
|
|
|
|
UINT height;
|
|
|
|
|
UINT width;
|
|
|
|
|
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
|
2007-11-10 22:36:28 +01:00
|
|
|
|
|
2007-11-30 20:28:13 +01:00
|
|
|
|
target->get_drawable_size(target, &width, &height);
|
2007-02-19 15:25:16 +01:00
|
|
|
|
/* 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
|
|
|
|
|
*/
|
2007-11-30 20:28:13 +01:00
|
|
|
|
TRACE("(%p) Setting new Scissor Rect to %d:%d-%d:%d\n", stateblock->wineD3DDevice, pRect->left, pRect->bottom - height,
|
2007-02-19 15:25:16 +01:00
|
|
|
|
pRect->right - pRect->left, pRect->bottom - pRect->top);
|
2007-07-26 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
if (stateblock->wineD3DDevice->render_offscreen) {
|
|
|
|
|
glScissor(pRect->left, pRect->top, pRect->right - pRect->left, pRect->bottom - pRect->top);
|
|
|
|
|
} else {
|
2007-11-30 20:28:13 +01:00
|
|
|
|
glScissor(pRect->left, height - pRect->bottom, pRect->right - pRect->left, pRect->bottom - pRect->top);
|
2007-07-26 00:38:50 +02:00
|
|
|
|
}
|
2007-02-19 15:25:16 +01:00
|
|
|
|
checkGLcall("glScissor");
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-19 15:25:32 +01:00
|
|
|
|
static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
2008-07-05 23:46:21 +02:00
|
|
|
|
if(stateblock->streamIsUP || stateblock->pIndexData == NULL ) {
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
|
|
|
|
|
} else {
|
|
|
|
|
IWineD3DIndexBufferImpl *ib = (IWineD3DIndexBufferImpl *) stateblock->pIndexData;
|
|
|
|
|
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, ib->vbo));
|
2007-02-19 15:25:32 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-18 11:43:09 +02:00
|
|
|
|
static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
if(stateblock->wineD3DDevice->render_offscreen) {
|
|
|
|
|
glFrontFace(GL_CCW);
|
|
|
|
|
checkGLcall("glFrontFace(GL_CCW)");
|
|
|
|
|
} else {
|
|
|
|
|
glFrontFace(GL_CW);
|
|
|
|
|
checkGLcall("glFrontFace(GL_CW)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-02 02:43:52 +02:00
|
|
|
|
const struct StateEntryTemplate misc_state_template[] = {
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_SRCBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_DESTBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_EDGEANTIALIAS), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ANTIALIASEDLINEENABLE), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SRCBLENDALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_DESTBLENDALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_DESTBLENDALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_BLENDOPALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, 0 },
|
|
|
|
|
{ STATE_STREAMSRC, { STATE_VDECL, streamsrc }, 0 },
|
|
|
|
|
{ STATE_VDECL, { STATE_VDECL, streamsrc }, 0 },
|
|
|
|
|
{ STATE_FRONTFACE, { STATE_FRONTFACE, frontface }, 0 },
|
|
|
|
|
{ STATE_SCISSORRECT, { STATE_SCISSORRECT, scissorrect }, 0 },
|
2008-07-02 20:07:41 +02:00
|
|
|
|
/* TODO: Move shader constant loading to vertex and fragment pipeline repectively, as soon as the pshader and
|
|
|
|
|
* vshader loadings are untied from each other
|
|
|
|
|
*/
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_VERTEXSHADERCONSTANT, { STATE_VERTEXSHADERCONSTANT, shaderconstant }, 0 },
|
|
|
|
|
{ STATE_PIXELSHADERCONSTANT, { STATE_VERTEXSHADERCONSTANT, shaderconstant }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-08-20 18:31:05 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
|
|
|
|
|
{ STATE_VIEWPORT, { STATE_VIEWPORT, viewport_miscpart }, 0 },
|
2008-07-05 23:46:21 +02:00
|
|
|
|
{ STATE_INDEXBUFFER, { STATE_INDEXBUFFER, indexbuffer }, ARB_VERTEX_BUFFER_OBJECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_ANTIALIAS), { STATE_RENDER(WINED3DRS_ANTIALIAS), state_antialias }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_TEXTUREPERSPECTIVE), { STATE_RENDER(WINED3DRS_TEXTUREPERSPECTIVE), state_perspective }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ZENABLE), { STATE_RENDER(WINED3DRS_ZENABLE), state_zenable }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAPU), { STATE_RENDER(WINED3DRS_WRAPU), state_wrapu }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAPV), { STATE_RENDER(WINED3DRS_WRAPV), state_wrapv }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FILLMODE), { STATE_RENDER(WINED3DRS_FILLMODE), state_fillmode }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SHADEMODE), { STATE_RENDER(WINED3DRS_SHADEMODE), state_shademode }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_LINEPATTERN), { STATE_RENDER(WINED3DRS_LINEPATTERN), state_linepattern }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_MONOENABLE), { STATE_RENDER(WINED3DRS_MONOENABLE), state_monoenable }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ROP2), { STATE_RENDER(WINED3DRS_ROP2), state_rop2 }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_PLANEMASK), { STATE_RENDER(WINED3DRS_PLANEMASK), state_planemask }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ZWRITEENABLE), { STATE_RENDER(WINED3DRS_ZWRITEENABLE), state_zwritenable }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ALPHATESTENABLE), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ALPHAREF), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ALPHAFUNC), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_COLORKEYENABLE), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_LASTPIXEL), { STATE_RENDER(WINED3DRS_LASTPIXEL), state_lastpixel }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_CULLMODE), { STATE_RENDER(WINED3DRS_CULLMODE), state_cullmode }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ZFUNC), { STATE_RENDER(WINED3DRS_ZFUNC), state_zfunc }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_DITHERENABLE), { STATE_RENDER(WINED3DRS_DITHERENABLE), state_ditherenable }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SUBPIXEL), { STATE_RENDER(WINED3DRS_SUBPIXEL), state_subpixel }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SUBPIXELX), { STATE_RENDER(WINED3DRS_SUBPIXELX), state_subpixelx }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STIPPLEDALPHA), { STATE_RENDER(WINED3DRS_STIPPLEDALPHA), state_stippledalpha }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ZBIAS), { STATE_RENDER(WINED3DRS_ZBIAS), state_zbias }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STIPPLEENABLE), { STATE_RENDER(WINED3DRS_STIPPLEENABLE), state_stippleenable }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), { STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), state_mipmaplodbias }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ANISOTROPY), { STATE_RENDER(WINED3DRS_ANISOTROPY), state_anisotropy }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FLUSHBATCH), { STATE_RENDER(WINED3DRS_FLUSHBATCH), state_flushbatch }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_TRANSLUCENTSORTINDEPENDENT), { STATE_RENDER(WINED3DRS_TRANSLUCENTSORTINDEPENDENT), state_translucentsi }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILENABLE), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILZFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILPASS), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILFUNC), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILREF), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILMASK), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
2008-07-05 22:35:53 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILWRITEMASK), { STATE_RENDER(WINED3DRS_STENCILWRITEMASK), state_stencilwrite2s}, EXT_STENCIL_TWO_SIDE },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_STENCILWRITEMASK), { STATE_RENDER(WINED3DRS_STENCILWRITEMASK), state_stencilwrite }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_TWOSIDEDSTENCILMODE), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_CCW_STENCILFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_CCW_STENCILZFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_CCW_STENCILPASS), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_CCW_STENCILFUNC), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP0), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP1), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP2), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP3), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP4), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP5), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP6), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP7), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP8), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP9), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP10), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP11), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP12), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP13), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP14), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_WRAP15), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_EXTENTS), { STATE_RENDER(WINED3DRS_EXTENTS), state_extents }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_COLORKEYBLENDENABLE), { STATE_RENDER(WINED3DRS_COLORKEYBLENDENABLE), state_ckeyblend }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_PATCHEDGESTYLE), { STATE_RENDER(WINED3DRS_PATCHEDGESTYLE), state_patchedgestyle}, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_PATCHSEGMENTS), { STATE_RENDER(WINED3DRS_PATCHSEGMENTS), state_patchsegments }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POSITIONDEGREE), { STATE_RENDER(WINED3DRS_POSITIONDEGREE), state_positiondegree}, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_NORMALDEGREE), { STATE_RENDER(WINED3DRS_NORMALDEGREE), state_normaldegree }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_MINTESSELLATIONLEVEL), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_MAXTESSELLATIONLEVEL), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ADAPTIVETESS_X), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ADAPTIVETESS_Y), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ADAPTIVETESS_Z), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ADAPTIVETESS_W), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, 0 },
|
2008-07-05 22:59:21 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa }, ARB_MULTISAMPLE },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa_w }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), { STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), state_multisampmask }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, 0 },
|
2008-07-05 22:35:53 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop }, EXT_BLEND_MINMAX },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop_w }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), { STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), state_scissor }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SLOPESCALEDEPTHBIAS), { STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, 0 },
|
2008-07-05 22:35:53 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor }, EXT_BLEND_COLOR },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor_w }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_DEPTHBIAS), { STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias }, 0 },
|
2008-07-03 14:04:59 +02:00
|
|
|
|
/* Samplers */
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(8), { STATE_SAMPLER(8), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(9), { STATE_SAMPLER(9), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(10), { STATE_SAMPLER(10), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(11), { STATE_SAMPLER(11), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(12), { STATE_SAMPLER(12), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(13), { STATE_SAMPLER(13), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(14), { STATE_SAMPLER(14), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(15), { STATE_SAMPLER(15), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(16), /* Vertex sampler 0 */ { STATE_SAMPLER(16), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(17), /* Vertex sampler 1 */ { STATE_SAMPLER(17), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(18), /* Vertex sampler 2 */ { STATE_SAMPLER(18), sampler }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(19), /* Vertex sampler 3 */ { STATE_SAMPLER(19), sampler }, 0 },
|
|
|
|
|
{0 /* Terminate */, { 0, 0 }, 0 },
|
2008-07-02 17:02:19 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const struct StateEntryTemplate ffp_vertexstate_template[] = {
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_VDECL, { STATE_VDECL, vertexdeclaration }, 0 },
|
|
|
|
|
{ STATE_VSHADER, { STATE_VDECL, vertexdeclaration }, 0 },
|
|
|
|
|
{ STATE_MATERIAL, { STATE_RENDER(WINED3DRS_SPECULARENABLE), state_specularenable}, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SPECULARENABLE), { STATE_RENDER(WINED3DRS_SPECULARENABLE), state_specularenable}, 0 },
|
2008-07-02 19:10:42 +02:00
|
|
|
|
/* Clip planes */
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_CLIPPLANE(0), { STATE_CLIPPLANE(0), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(1), { STATE_CLIPPLANE(1), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(2), { STATE_CLIPPLANE(2), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(3), { STATE_CLIPPLANE(3), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(4), { STATE_CLIPPLANE(4), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(5), { STATE_CLIPPLANE(5), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(6), { STATE_CLIPPLANE(6), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(7), { STATE_CLIPPLANE(7), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(8), { STATE_CLIPPLANE(8), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(9), { STATE_CLIPPLANE(9), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(10), { STATE_CLIPPLANE(10), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(11), { STATE_CLIPPLANE(11), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(12), { STATE_CLIPPLANE(12), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(13), { STATE_CLIPPLANE(13), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(14), { STATE_CLIPPLANE(14), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(15), { STATE_CLIPPLANE(15), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(16), { STATE_CLIPPLANE(16), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(17), { STATE_CLIPPLANE(17), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(18), { STATE_CLIPPLANE(18), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(19), { STATE_CLIPPLANE(19), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(20), { STATE_CLIPPLANE(20), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(21), { STATE_CLIPPLANE(21), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(22), { STATE_CLIPPLANE(22), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(23), { STATE_CLIPPLANE(23), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(24), { STATE_CLIPPLANE(24), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(25), { STATE_CLIPPLANE(25), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(26), { STATE_CLIPPLANE(26), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(27), { STATE_CLIPPLANE(27), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(28), { STATE_CLIPPLANE(28), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(29), { STATE_CLIPPLANE(29), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(30), { STATE_CLIPPLANE(30), clipplane }, 0 },
|
|
|
|
|
{ STATE_CLIPPLANE(31), { STATE_CLIPPLANE(31), clipplane }, 0 },
|
2008-07-02 19:15:34 +02:00
|
|
|
|
/* Lights */
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_ACTIVELIGHT(0), { STATE_ACTIVELIGHT(0), light }, 0 },
|
|
|
|
|
{ STATE_ACTIVELIGHT(1), { STATE_ACTIVELIGHT(1), light }, 0 },
|
|
|
|
|
{ STATE_ACTIVELIGHT(2), { STATE_ACTIVELIGHT(2), light }, 0 },
|
|
|
|
|
{ STATE_ACTIVELIGHT(3), { STATE_ACTIVELIGHT(3), light }, 0 },
|
|
|
|
|
{ STATE_ACTIVELIGHT(4), { STATE_ACTIVELIGHT(4), light }, 0 },
|
|
|
|
|
{ STATE_ACTIVELIGHT(5), { STATE_ACTIVELIGHT(5), light }, 0 },
|
|
|
|
|
{ STATE_ACTIVELIGHT(6), { STATE_ACTIVELIGHT(6), light }, 0 },
|
|
|
|
|
{ STATE_ACTIVELIGHT(7), { STATE_ACTIVELIGHT(7), light }, 0 },
|
2008-07-02 20:16:23 +02:00
|
|
|
|
/* Viewport */
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_VIEWPORT, { STATE_VIEWPORT, viewport_vertexpart }, 0 },
|
2008-07-02 20:40:23 +02:00
|
|
|
|
/* Transform states follow */
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_VIEW), { STATE_TRANSFORM(WINED3DTS_VIEW), transform_view }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_PROJECTION), { STATE_TRANSFORM(WINED3DTS_PROJECTION), transform_projection}, 0 },
|
2008-08-26 21:25:56 +02:00
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE0), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE1), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE2), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE3), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE4), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE5), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE6), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_TEXTURE7), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), transform_texture }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 0)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 0)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 1)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 1)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 2)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 2)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 3)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 3)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 4)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 4)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 5)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 5)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 6)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 6)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 7)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 7)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 8)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 8)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 9)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 9)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 10)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 10)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 11)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 11)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 12)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 12)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 13)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 13)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 14)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 14)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 15)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 15)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 16)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 16)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 17)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 17)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 18)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 18)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 19)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 19)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 20)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 20)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 21)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 21)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 22)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 22)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 23)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 23)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 24)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 24)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 25)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 25)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 26)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 26)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 27)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 27)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 28)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 28)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 29)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 29)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 30)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 30)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 31)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 31)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 32)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 32)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 33)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 33)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 34)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 34)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 35)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 35)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 36)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 36)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 37)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 37)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 38)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 38)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 39)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 39)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 40)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 40)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 41)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 41)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 42)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 42)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 43)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 43)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 44)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 44)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 45)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 45)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 46)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 46)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 47)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 47)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 48)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 48)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 49)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 49)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 50)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 50)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 51)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 51)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 52)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 52)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 53)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 53)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 54)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 54)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 55)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 55)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 56)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 56)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 57)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 57)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 58)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 58)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 59)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 59)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 60)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 60)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 61)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 61)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 62)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 62)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 63)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 63)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 64)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 64)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 65)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 65)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 66)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 66)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 67)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 67)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 68)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 68)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 69)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 69)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 70)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 70)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 71)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 71)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 72)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 72)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 73)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 73)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 74)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 74)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 75)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 75)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 76)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 76)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 77)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 77)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 78)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 78)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 79)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 79)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 80)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 80)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 81)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 81)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 82)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 82)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 83)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 83)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 84)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 84)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 85)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 85)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 86)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 86)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 87)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 87)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 88)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 88)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 89)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 89)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 90)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 90)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 91)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 91)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 92)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 92)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 93)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 93)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 94)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 94)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 95)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 95)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 96)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 96)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 97)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 97)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 98)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 98)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 99)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 99)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), transform_world }, 0 },
|
|
|
|
|
{ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), transform_world }, 0 },
|
2008-08-26 21:25:56 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(1,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(2,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(3,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(4,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(5,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(6,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(7,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(0, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(1, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(2, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(3, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(4, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(5, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(6, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(7, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, 0 },
|
2008-07-03 03:49:43 +02:00
|
|
|
|
/* Fog */
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_FOGENABLE), { STATE_RENDER(WINED3DRS_FOGENABLE), state_fog }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FOGTABLEMODE), { STATE_RENDER(WINED3DRS_FOGENABLE), state_fog }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FOGSTART), { STATE_RENDER(WINED3DRS_FOGENABLE), state_fog }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FOGEND), { STATE_RENDER(WINED3DRS_FOGENABLE), state_fog }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FOGVERTEXMODE), { STATE_RENDER(WINED3DRS_FOGENABLE), state_fog }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FOGCOLOR), { STATE_RENDER(WINED3DRS_FOGCOLOR), state_fogcolor }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_FOGDENSITY), { STATE_RENDER(WINED3DRS_FOGDENSITY), state_fogdensity }, 0 },
|
2008-07-05 22:38:43 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_RANGEFOGENABLE), { STATE_RENDER(WINED3DRS_RANGEFOGENABLE), state_rangefog }, NV_FOG_DISTANCE },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_RANGEFOGENABLE), { STATE_RENDER(WINED3DRS_RANGEFOGENABLE), state_rangefog_w }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_CLIPPING), { STATE_RENDER(WINED3DRS_CLIPPING), state_clipping }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), { STATE_RENDER(WINED3DRS_CLIPPING), state_clipping }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_LIGHTING), { STATE_RENDER(WINED3DRS_LIGHTING), state_lighting }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_AMBIENT), { STATE_RENDER(WINED3DRS_AMBIENT), state_ambient }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_COLORVERTEX), { STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_LOCALVIEWER), { STATE_RENDER(WINED3DRS_LOCALVIEWER), state_localviewer }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_NORMALIZENORMALS), { STATE_RENDER(WINED3DRS_NORMALIZENORMALS), state_normalize }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_DIFFUSEMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SPECULARMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_AMBIENTMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_EMISSIVEMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat }, 0 },
|
2008-07-05 23:21:26 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_VERTEXBLEND), { STATE_RENDER(WINED3DRS_VERTEXBLEND), state_vertexblend }, ARB_VERTEX_BLEND },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_VERTEXBLEND), { STATE_RENDER(WINED3DRS_VERTEXBLEND), state_vertexblend_w }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSIZE), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale }, 0 },
|
2008-07-05 22:45:39 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSIZE_MIN), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), state_psizemin_arb }, ARB_POINT_PARAMETERS },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSIZE_MIN), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), state_psizemin_ext }, EXT_POINT_PARAMETERS },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSIZE_MIN), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), state_psizemin_w }, 0 },
|
2008-07-05 22:49:50 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), { STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), state_pointsprite }, ARB_POINT_SPRITE },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), { STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), state_pointsprite_w }, 0 },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSCALEENABLE), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSCALE_A), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSCALE_B), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSCALE_C), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale }, 0 },
|
2008-07-05 22:47:59 +02:00
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), state_psizemax_arb }, ARB_POINT_PARAMETERS },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), state_psizemax_ext }, EXT_POINT_PARAMETERS },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), state_psizemax_w }, 0 },
|
2008-08-04 17:55:26 +02:00
|
|
|
|
/* pixel shaders need a different fog input */
|
|
|
|
|
{ STATE_PIXELSHADER, { STATE_PIXELSHADER, apply_pshader_fog }, 0 },
|
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 },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(0), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texmatrix }, 0 },
|
2008-07-05 23:07:00 +02:00
|
|
|
|
{ STATE_SAMPLER(1), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(1), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texmatrix }, 0 },
|
2008-07-05 23:07:00 +02:00
|
|
|
|
{ STATE_SAMPLER(2), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(2), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texmatrix }, 0 },
|
2008-07-05 23:07:00 +02:00
|
|
|
|
{ STATE_SAMPLER(3), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(3), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texmatrix }, 0 },
|
2008-07-05 23:07:00 +02:00
|
|
|
|
{ STATE_SAMPLER(4), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(4), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texmatrix }, 0 },
|
2008-07-05 23:07:00 +02:00
|
|
|
|
{ STATE_SAMPLER(5), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(5), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texmatrix }, 0 },
|
2008-07-05 23:07:00 +02:00
|
|
|
|
{ STATE_SAMPLER(6), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(6), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texmatrix }, 0 },
|
2008-07-05 23:07:00 +02:00
|
|
|
|
{ STATE_SAMPLER(7), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
2008-07-09 01:59:10 +02:00
|
|
|
|
{ STATE_SAMPLER(7), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texmatrix }, 0 },
|
|
|
|
|
{0 /* Terminate */, { 0, 0 }, 0 },
|
2008-07-02 02:43:52 +02:00
|
|
|
|
};
|
|
|
|
|
|
2008-07-06 01:31:34 +02:00
|
|
|
|
static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(0, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(1, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(2, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(3, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(4, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(5, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(6, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
2008-07-05 23:14:00 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), tex_bumpenvmat }, ATI_ENVMAP_BUMPMAP },
|
2008-07-05 22:04:16 +02:00
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop }, 0 },
|
|
|
|
|
{ STATE_TEXTURESTAGE(7, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl }, 0 },
|
|
|
|
|
{ STATE_PIXELSHADER, { STATE_PIXELSHADER, apply_pixelshader }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), { STATE_PIXELSHADER, apply_pixelshader }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_BORDERCOLOR), { STATE_RENDER(WINED3DRS_BORDERCOLOR), state_bordercolor }, 0 },
|
|
|
|
|
{ STATE_RENDER(WINED3DRS_TEXTUREFACTOR), { STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_texfactor }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, 0 },
|
|
|
|
|
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, 0 },
|
|
|
|
|
{0 /* Terminate */, { 0, 0 }, 0 },
|
2008-07-04 22:01:26 +02:00
|
|
|
|
};
|
2008-07-04 22:09:49 +02:00
|
|
|
|
#undef GLINFO_LOCATION
|
|
|
|
|
|
|
|
|
|
#define GLINFO_LOCATION (*gl_info)
|
2008-07-04 23:15:18 +02:00
|
|
|
|
static void ffp_enable(IWineD3DDevice *iface, BOOL enable) { }
|
2008-07-03 21:36:18 +02:00
|
|
|
|
|
|
|
|
|
static void ffp_fragment_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *pCaps) {
|
|
|
|
|
pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD |
|
|
|
|
|
WINED3DTEXOPCAPS_ADDSIGNED |
|
|
|
|
|
WINED3DTEXOPCAPS_ADDSIGNED2X |
|
|
|
|
|
WINED3DTEXOPCAPS_MODULATE |
|
|
|
|
|
WINED3DTEXOPCAPS_MODULATE2X |
|
|
|
|
|
WINED3DTEXOPCAPS_MODULATE4X |
|
|
|
|
|
WINED3DTEXOPCAPS_SELECTARG1 |
|
|
|
|
|
WINED3DTEXOPCAPS_SELECTARG2 |
|
|
|
|
|
WINED3DTEXOPCAPS_DISABLE;
|
|
|
|
|
|
|
|
|
|
if (GL_SUPPORT(ARB_TEXTURE_ENV_COMBINE) ||
|
|
|
|
|
GL_SUPPORT(EXT_TEXTURE_ENV_COMBINE) ||
|
|
|
|
|
GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
|
|
|
|
|
pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA |
|
|
|
|
|
WINED3DTEXOPCAPS_BLENDTEXTUREALPHA |
|
|
|
|
|
WINED3DTEXOPCAPS_BLENDFACTORALPHA |
|
|
|
|
|
WINED3DTEXOPCAPS_BLENDCURRENTALPHA |
|
|
|
|
|
WINED3DTEXOPCAPS_LERP |
|
|
|
|
|
WINED3DTEXOPCAPS_SUBTRACT;
|
|
|
|
|
}
|
|
|
|
|
if (GL_SUPPORT(ATI_TEXTURE_ENV_COMBINE3) ||
|
|
|
|
|
GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
|
|
|
|
|
pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_ADDSMOOTH |
|
|
|
|
|
WINED3DTEXOPCAPS_MULTIPLYADD |
|
|
|
|
|
WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR |
|
|
|
|
|
WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
|
|
|
|
|
WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
|
|
|
|
|
}
|
|
|
|
|
if (GL_SUPPORT(ARB_TEXTURE_ENV_DOT3))
|
|
|
|
|
pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_DOTPRODUCT3;
|
|
|
|
|
|
|
|
|
|
if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) {
|
|
|
|
|
pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pCaps->MaxTextureBlendStages = GL_LIMITS(texture_stages);
|
|
|
|
|
pCaps->MaxSimultaneousTextures = GL_LIMITS(textures);
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-11 16:41:28 +02:00
|
|
|
|
static HRESULT ffp_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
|
|
|
|
|
static void ffp_fragment_free(IWineD3DDevice *iface) {}
|
2008-08-07 21:51:35 +02:00
|
|
|
|
static BOOL ffp_conv_supported(WINED3DFORMAT fmt) {
|
|
|
|
|
TRACE("Checking shader format support for format %s: [FAILED]", debug_d3dformat(fmt));
|
|
|
|
|
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,
|
2008-07-11 16:41:28 +02:00
|
|
|
|
ffp_fragment_alloc,
|
|
|
|
|
ffp_fragment_free,
|
2008-08-07 21:51:35 +02:00
|
|
|
|
ffp_conv_supported,
|
2008-08-23 22:41:51 +02:00
|
|
|
|
ffp_fragmentstate_template,
|
|
|
|
|
FALSE /* we cannot disable projected textures. The vertex pipe has to do it */
|
2008-07-04 22:09:49 +02:00
|
|
|
|
};
|
2008-07-04 22:01:26 +02:00
|
|
|
|
|
2008-07-02 02:43:52 +02:00
|
|
|
|
static int num_handlers(APPLYSTATEFUNC *funcs) {
|
|
|
|
|
unsigned int i;
|
|
|
|
|
for(i = 0; funcs[i]; i++);
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void multistate_apply_2(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
stateblock->wineD3DDevice->multistate_funcs[state][0](state, stateblock, context);
|
|
|
|
|
stateblock->wineD3DDevice->multistate_funcs[state][1](state, stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void multistate_apply_3(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
|
|
|
|
stateblock->wineD3DDevice->multistate_funcs[state][0](state, stateblock, context);
|
|
|
|
|
stateblock->wineD3DDevice->multistate_funcs[state][1](state, stateblock, context);
|
|
|
|
|
stateblock->wineD3DDevice->multistate_funcs[state][2](state, stateblock, context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void compile_state_table(struct StateEntry *StateTable,
|
|
|
|
|
APPLYSTATEFUNC **dev_multistate_funcs,
|
2008-07-05 22:04:16 +02:00
|
|
|
|
WineD3D_GL_Info *gl_info,
|
2008-07-02 02:43:52 +02:00
|
|
|
|
const struct StateEntryTemplate *vertex,
|
2008-07-04 22:09:49 +02:00
|
|
|
|
const struct fragment_pipeline *fragment,
|
2008-07-02 21:56:38 +02:00
|
|
|
|
const struct StateEntryTemplate *misc) {
|
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;
|
2008-07-02 02:43:52 +02:00
|
|
|
|
case 2: cur = vertex; break;
|
|
|
|
|
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++) {
|
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 */
|
|
|
|
|
if(cur[i].extension && !GL_SUPPORT(cur[i].extension)) continue;
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
if(!cur[i].content.apply) continue;
|
|
|
|
|
|
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);
|
|
|
|
|
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;
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, multistate_funcs[cur[i].state]);
|
|
|
|
|
dev_multistate_funcs[cur[i].state] = HeapAlloc(GetProcessHeap(),
|
|
|
|
|
0,
|
|
|
|
|
sizeof(**dev_multistate_funcs) * 3);
|
|
|
|
|
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];
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StateTable[cur[i].state].representative &&
|
|
|
|
|
StateTable[cur[i].state].representative != cur[i].content.representative) {
|
|
|
|
|
FIXME("State %u has different representatives in different pipeline parts\n",
|
|
|
|
|
cur[i].state);
|
|
|
|
|
}
|
|
|
|
|
StateTable[cur[i].state].representative = cur[i].content.representative;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-07-02 01:23:44 +02:00
|
|
|
|
}
|
2008-07-05 22:04:16 +02:00
|
|
|
|
#undef GLINFO_LOCATION
|