2 * Direct3D state management
4 * Copyright 2006 Stefan Dösinger for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wined3d_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
30 #define GLINFO_LOCATION ((IWineD3DImpl *)(stateblock->wineD3DDevice->wineD3D))->gl_info
32 static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock) {
33 /* Used for states which are not mapped to a gl state as-is, but used somehow different,
34 * e.g as a parameter for drawing, or which are unimplemented in windows d3d
36 if(STATE_IS_RENDER(state)) {
37 WINED3DRENDERSTATETYPE RenderState = state - STATE_RENDER(0);
38 TRACE("(%s,%d) no direct mapping to gl\n", debug_d3drenderstate(RenderState), stateblock->renderState[RenderState]);
40 /* Shouldn't have an unknown type here */
41 FIXME("%d no direct mapping to gl of state with unknown type\n", state);
45 static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock) {
46 /* Print a WARN, this allows the stateblock code to loop over all states to generate a display
47 * list without causing confusing terminal output. Deliberately no special debug name here
48 * because its undefined.
50 WARN("undefined state %d\n", state);
53 static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock) {
54 D3DFILLMODE Value = stateblock->renderState[WINED3DRS_FILLMODE];
58 glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
59 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
61 case D3DFILL_WIREFRAME:
62 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
63 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
66 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
67 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
70 FIXME("Unrecognized WINED3DRS_FILLMODE value %d\n", Value);
74 static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock) {
76 /* TODO: Lighting is only enabled if Vertex normals are passed by the application,
77 * so merge the lighting render state with the vertex declaration once it is available
80 if (stateblock->renderState[WINED3DRS_LIGHTING]) {
81 glEnable(GL_LIGHTING);
82 checkGLcall("glEnable GL_LIGHTING");
84 glDisable(GL_LIGHTING);
85 checkGLcall("glDisable GL_LIGHTING");
89 static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
90 switch ((WINED3DZBUFFERTYPE) stateblock->renderState[WINED3DRS_ZENABLE]) {
92 glDisable(GL_DEPTH_TEST);
93 checkGLcall("glDisable GL_DEPTH_TEST");
96 glEnable(GL_DEPTH_TEST);
97 checkGLcall("glEnable GL_DEPTH_TEST");
100 glEnable(GL_DEPTH_TEST);
101 checkGLcall("glEnable GL_DEPTH_TEST");
102 FIXME("W buffer is not well handled\n");
105 FIXME("Unrecognized D3DZBUFFERTYPE value %d\n", stateblock->renderState[WINED3DRS_ZENABLE]);
109 static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock) {
110 /* TODO: Put this into the offscreen / onscreen rendering block due to device->render_offscreen */
112 /* If we are culling "back faces with clockwise vertices" then
113 set front faces to be counter clockwise and enable culling
115 switch ((WINED3DCULL) stateblock->renderState[WINED3DRS_CULLMODE]) {
116 case WINED3DCULL_NONE:
117 glDisable(GL_CULL_FACE);
118 checkGLcall("glDisable GL_CULL_FACE");
121 glEnable(GL_CULL_FACE);
122 checkGLcall("glEnable GL_CULL_FACE");
123 if (stateblock->wineD3DDevice->render_offscreen) {
125 checkGLcall("glFrontFace GL_CW");
128 checkGLcall("glFrontFace GL_CCW");
132 case WINED3DCULL_CCW:
133 glEnable(GL_CULL_FACE);
134 checkGLcall("glEnable GL_CULL_FACE");
135 if (stateblock->wineD3DDevice->render_offscreen) {
137 checkGLcall("glFrontFace GL_CCW");
140 checkGLcall("glFrontFace GL_CW");
145 FIXME("Unrecognized/Unhandled WINED3DCULL value %d\n", stateblock->renderState[WINED3DRS_CULLMODE]);
149 static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock) {
150 switch ((WINED3DSHADEMODE) stateblock->renderState[WINED3DRS_SHADEMODE]) {
151 case WINED3DSHADE_FLAT:
152 glShadeModel(GL_FLAT);
153 checkGLcall("glShadeModel(GL_FLAT)");
155 case WINED3DSHADE_GOURAUD:
156 glShadeModel(GL_SMOOTH);
157 checkGLcall("glShadeModel(GL_SMOOTH)");
159 case WINED3DSHADE_PHONG:
160 FIXME("WINED3DSHADE_PHONG isn't supported\n");
163 FIXME("Unrecognized/Unhandled WINED3DSHADEMODE value %d\n", stateblock->renderState[WINED3DRS_SHADEMODE]);
167 static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
168 if (stateblock->renderState[WINED3DRS_DITHERENABLE]) {
170 checkGLcall("glEnable GL_DITHER");
172 glDisable(GL_DITHER);
173 checkGLcall("glDisable GL_DITHER");
177 static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
178 /* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. If yes,
179 * this has to be merged with ZENABLE and ZFUNC
181 if (stateblock->renderState[WINED3DRS_ZWRITEENABLE]) {
183 checkGLcall("glDepthMask(1)");
186 checkGLcall("glDepthMask(0)");
190 static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock) {
191 int glParm = CompareFunc(stateblock->renderState[WINED3DRS_ZFUNC]);
195 checkGLcall("glDepthFunc");
199 static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock) {
201 D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_AMBIENT], col);
203 TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
204 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
205 checkGLcall("glLightModel for MODEL_AMBIENT");
208 static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock) {
209 int srcBlend = GL_ZERO;
210 int dstBlend = GL_ZERO;
212 /* GL_LINE_SMOOTH needs GL_BLEND to work, according to the red book, and special blending params */
213 if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE] ||
214 stateblock->renderState[WINED3DRS_EDGEANTIALIAS] ||
215 stateblock->renderState[WINED3DRS_ANTIALIASEDLINEENABLE]) {
217 checkGLcall("glEnable GL_BLEND");
220 checkGLcall("glDisable GL_BLEND");
221 /* Nothing more to do - get out */
225 switch (stateblock->renderState[WINED3DRS_SRCBLEND]) {
226 case WINED3DBLEND_ZERO : srcBlend = GL_ZERO; break;
227 case WINED3DBLEND_ONE : srcBlend = GL_ONE; break;
228 case WINED3DBLEND_SRCCOLOR : srcBlend = GL_SRC_COLOR; break;
229 case WINED3DBLEND_INVSRCCOLOR : srcBlend = GL_ONE_MINUS_SRC_COLOR; break;
230 case WINED3DBLEND_SRCALPHA : srcBlend = GL_SRC_ALPHA; break;
231 case WINED3DBLEND_INVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA; break;
232 case WINED3DBLEND_DESTALPHA : srcBlend = GL_DST_ALPHA; break;
233 case WINED3DBLEND_INVDESTALPHA : srcBlend = GL_ONE_MINUS_DST_ALPHA; break;
234 case WINED3DBLEND_DESTCOLOR : srcBlend = GL_DST_COLOR; break;
235 case WINED3DBLEND_INVDESTCOLOR : srcBlend = GL_ONE_MINUS_DST_COLOR; break;
236 case WINED3DBLEND_SRCALPHASAT : srcBlend = GL_SRC_ALPHA_SATURATE; break;
238 case WINED3DBLEND_BOTHSRCALPHA : srcBlend = GL_SRC_ALPHA;
239 dstBlend = GL_SRC_ALPHA;
242 case WINED3DBLEND_BOTHINVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA;
243 dstBlend = GL_ONE_MINUS_SRC_ALPHA;
246 case WINED3DBLEND_BLENDFACTOR : srcBlend = GL_CONSTANT_COLOR; break;
247 case WINED3DBLEND_INVBLENDFACTOR : srcBlend = GL_ONE_MINUS_CONSTANT_COLOR; break;
249 FIXME("Unrecognized src blend value %d\n", stateblock->renderState[WINED3DRS_SRCBLEND]);
252 switch (stateblock->renderState[WINED3DRS_DESTBLEND]) {
253 case WINED3DBLEND_ZERO : dstBlend = GL_ZERO; break;
254 case WINED3DBLEND_ONE : dstBlend = GL_ONE; break;
255 case WINED3DBLEND_SRCCOLOR : dstBlend = GL_SRC_COLOR; break;
256 case WINED3DBLEND_INVSRCCOLOR : dstBlend = GL_ONE_MINUS_SRC_COLOR; break;
257 case WINED3DBLEND_SRCALPHA : dstBlend = GL_SRC_ALPHA; break;
258 case WINED3DBLEND_INVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA; break;
259 case WINED3DBLEND_DESTALPHA : dstBlend = GL_DST_ALPHA; break;
260 case WINED3DBLEND_INVDESTALPHA : dstBlend = GL_ONE_MINUS_DST_ALPHA; break;
261 case WINED3DBLEND_DESTCOLOR : dstBlend = GL_DST_COLOR; break;
262 case WINED3DBLEND_INVDESTCOLOR : dstBlend = GL_ONE_MINUS_DST_COLOR; break;
263 case WINED3DBLEND_SRCALPHASAT : dstBlend = GL_SRC_ALPHA_SATURATE; break;
265 case WINED3DBLEND_BOTHSRCALPHA : dstBlend = GL_SRC_ALPHA;
266 srcBlend = GL_SRC_ALPHA;
269 case WINED3DBLEND_BOTHINVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA;
270 srcBlend = GL_ONE_MINUS_SRC_ALPHA;
273 case D3DBLEND_BLENDFACTOR : dstBlend = GL_CONSTANT_COLOR; break;
274 case D3DBLEND_INVBLENDFACTOR : dstBlend = GL_ONE_MINUS_CONSTANT_COLOR; break;
276 FIXME("Unrecognized dst blend value %d\n", stateblock->renderState[WINED3DRS_DESTBLEND]);
279 if(stateblock->renderState[WINED3DRS_EDGEANTIALIAS] ||
280 stateblock->renderState[WINED3DRS_ANTIALIASEDLINEENABLE]) {
281 glEnable(GL_LINE_SMOOTH);
282 checkGLcall("glEnable(GL_LINE_SMOOTH)");
283 if(srcBlend != GL_SRC_ALPHA) {
284 FIXME("WINED3DRS_EDGEANTIALIAS enabled, but incompatible src blending param - what to do?\n");
285 srcBlend = GL_SRC_ALPHA;
287 if(dstBlend != GL_ONE_MINUS_SRC_ALPHA) {
288 FIXME("WINED3DRS_EDGEANTIALIAS enabled, but incompatible dst blending param - what to do?\n");
289 dstBlend = GL_ONE_MINUS_SRC_ALPHA;
292 glDisable(GL_LINE_SMOOTH);
293 checkGLcall("glDisable(GL_LINE_SMOOTH)");
296 TRACE("glBlendFunc src=%x, dst=%x\n", srcBlend, dstBlend);
297 glBlendFunc(srcBlend, dstBlend);
298 checkGLcall("glBlendFunc");
300 /* TODO: Remove when state management done */
301 stateblock->wineD3DDevice->dstBlend = dstBlend;
302 stateblock->wineD3DDevice->srcBlend = srcBlend;
305 static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
308 TRACE("Setting BlendFactor to %d\n", stateblock->renderState[WINED3DRS_BLENDFACTOR]);
309 D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_BLENDFACTOR], col);
310 glBlendColor (col[0],col[1],col[2],col[3]);
311 checkGLcall("glBlendColor");
314 static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock) {
317 BOOL enable_ckey = FALSE;
319 IWineD3DSurfaceImpl *surf;
321 /* Find out if the texture on the first stage has a ckey set
322 * The alpha state func reads the texture settings, even though alpha and texture are not grouped
323 * together. This is to avoid making a huge alpha+texture+texture stage+ckey block due to the hardly
324 * used WINED3DRS_COLORKEYENABLE state(which is d3d <= 3 only). The texture function will call alpha
325 * in case it finds some texture+colorkeyenable combination which needs extra care.
327 if(stateblock->textures[0]) {
328 surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *)stateblock->textures[0])->surfaces[0];
329 if(surf->CKeyFlags & DDSD_CKSRCBLT) enable_ckey = TRUE;
332 if (stateblock->renderState[WINED3DRS_ALPHATESTENABLE] ||
333 (stateblock->renderState[WINED3DRS_COLORKEYENABLE] && enable_ckey)) {
334 glEnable(GL_ALPHA_TEST);
335 checkGLcall("glEnable GL_ALPHA_TEST");
337 glDisable(GL_ALPHA_TEST);
338 checkGLcall("glDisable GL_ALPHA_TEST");
339 /* Alpha test is disabled, don't bother setting the params - it will happen on the next
345 if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && enable_ckey) {
346 glParm = GL_NOTEQUAL;
349 ref = ((float) stateblock->renderState[WINED3DRS_ALPHAREF]) / 255.0f;
350 glParm = CompareFunc(stateblock->renderState[WINED3DRS_ALPHAFUNC]);
353 stateblock->wineD3DDevice->alphafunc = glParm; /* Remove when state management done */
354 glAlphaFunc(glParm, ref);
355 checkGLcall("glAlphaFunc");
357 /* TODO: Some texture blending operations seem to affect the alpha test */
360 static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock) {
361 DWORD enable = 0xFFFFFFFF;
362 DWORD disable = 0x00000000;
364 /* TODO: Keep track of previously enabled clipplanes to avoid unneccessary resetting
365 * of already set values
368 /* If enabling / disabling all
369 * TODO: Is this correct? Doesn't D3DRS_CLIPPING disable clipping on the viewport frustrum?
371 if (stateblock->renderState[WINED3DRS_CLIPPING]) {
372 enable = stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
373 disable = ~stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
375 disable = 0xffffffff;
379 if (enable & WINED3DCLIPPLANE0) { glEnable(GL_CLIP_PLANE0); checkGLcall("glEnable(clip plane 0)"); }
380 if (enable & WINED3DCLIPPLANE1) { glEnable(GL_CLIP_PLANE1); checkGLcall("glEnable(clip plane 1)"); }
381 if (enable & WINED3DCLIPPLANE2) { glEnable(GL_CLIP_PLANE2); checkGLcall("glEnable(clip plane 2)"); }
382 if (enable & WINED3DCLIPPLANE3) { glEnable(GL_CLIP_PLANE3); checkGLcall("glEnable(clip plane 3)"); }
383 if (enable & WINED3DCLIPPLANE4) { glEnable(GL_CLIP_PLANE4); checkGLcall("glEnable(clip plane 4)"); }
384 if (enable & WINED3DCLIPPLANE5) { glEnable(GL_CLIP_PLANE5); checkGLcall("glEnable(clip plane 5)"); }
386 if (disable & WINED3DCLIPPLANE0) { glDisable(GL_CLIP_PLANE0); checkGLcall("glDisable(clip plane 0)"); }
387 if (disable & WINED3DCLIPPLANE1) { glDisable(GL_CLIP_PLANE1); checkGLcall("glDisable(clip plane 1)"); }
388 if (disable & WINED3DCLIPPLANE2) { glDisable(GL_CLIP_PLANE2); checkGLcall("glDisable(clip plane 2)"); }
389 if (disable & WINED3DCLIPPLANE3) { glDisable(GL_CLIP_PLANE3); checkGLcall("glDisable(clip plane 3)"); }
390 if (disable & WINED3DCLIPPLANE4) { glDisable(GL_CLIP_PLANE4); checkGLcall("glDisable(clip plane 4)"); }
391 if (disable & WINED3DCLIPPLANE5) { glDisable(GL_CLIP_PLANE5); checkGLcall("glDisable(clip plane 5)"); }
393 /** update clipping status */
395 stateblock->clip_status.ClipUnion = 0;
396 stateblock->clip_status.ClipIntersection = 0xFFFFFFFF;
398 stateblock->clip_status.ClipUnion = 0;
399 stateblock->clip_status.ClipIntersection = 0;
403 static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
404 int glParm = GL_FUNC_ADD;
406 if(!GL_SUPPORT(EXT_BLEND_MINMAX)) {
407 WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
411 switch ((WINED3DBLENDOP) stateblock->renderState[WINED3DRS_BLENDOP]) {
412 case WINED3DBLENDOP_ADD : glParm = GL_FUNC_ADD; break;
413 case WINED3DBLENDOP_SUBTRACT : glParm = GL_FUNC_SUBTRACT; break;
414 case WINED3DBLENDOP_REVSUBTRACT : glParm = GL_FUNC_REVERSE_SUBTRACT; break;
415 case WINED3DBLENDOP_MIN : glParm = GL_MIN; break;
416 case WINED3DBLENDOP_MAX : glParm = GL_MAX; break;
418 FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock->renderState[WINED3DRS_BLENDOP]);
421 TRACE("glBlendEquation(%x)\n", glParm);
422 GL_EXTCALL(glBlendEquation(glParm));
423 checkGLcall("glBlendEquation");
427 state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
428 /* Originally this used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR)
429 * and (GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR) to swap between enabled/disabled
430 * specular color. This is wrong:
431 * Separate specular color means the specular colour is maintained separately, whereas
432 * single color means it is merged in. However in both cases they are being used to
434 * To disable specular color, set it explicitly to black and turn off GL_COLOR_SUM_EXT
435 * NOTE: If not supported don't give FIXMEs the impact is really minimal and very few people are
439 * If register combiners are enabled, enabling / disabling GL_COLOR_SUM has no effect.
440 * Instead, we need to setup the FinalCombiner properly.
442 * The default setup for the FinalCombiner is:
444 * <variable> <input> <mapping> <usage>
445 * GL_VARIABLE_A_NV GL_FOG, GL_UNSIGNED_IDENTITY_NV GL_ALPHA
446 * GL_VARIABLE_B_NV GL_SPARE0_PLUS_SECONDARY_COLOR_NV GL_UNSIGNED_IDENTITY_NV GL_RGB
447 * GL_VARIABLE_C_NV GL_FOG GL_UNSIGNED_IDENTITY_NV GL_RGB
448 * GL_VARIABLE_D_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
449 * GL_VARIABLE_E_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
450 * GL_VARIABLE_F_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
451 * GL_VARIABLE_G_NV GL_SPARE0_NV GL_UNSIGNED_IDENTITY_NV GL_ALPHA
453 * That's pretty much fine as it is, except for variable B, which needs to take
454 * either GL_SPARE0_PLUS_SECONDARY_COLOR_NV or GL_SPARE0_NV, depending on
455 * whether WINED3DRS_SPECULARENABLE is enabled or not.
458 TRACE("Setting specular enable state\n");
459 /* TODO: Add to the material setting functions */
460 if (stateblock->renderState[WINED3DRS_SPECULARENABLE]) {
461 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &stateblock->material.Specular);
462 checkGLcall("glMaterialfv");
463 if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
464 glEnable(GL_COLOR_SUM_EXT);
466 TRACE("Specular colors cannot be enabled in this version of opengl\n");
468 checkGLcall("glEnable(GL_COLOR_SUM)");
470 if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
471 GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_PLUS_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB));
472 checkGLcall("glFinalCombinerInputNV()");
475 float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
477 /* for the case of enabled lighting: */
478 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
479 checkGLcall("glMaterialfv");
481 /* for the case of disabled lighting: */
482 if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
483 glDisable(GL_COLOR_SUM_EXT);
485 TRACE("Specular colors cannot be disabled in this version of opengl\n");
487 checkGLcall("glDisable(GL_COLOR_SUM)");
489 if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
490 GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB));
491 checkGLcall("glFinalCombinerInputNV()");
496 static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
499 /* Note the texture color applies to all textures whereas
500 * GL_TEXTURE_ENV_COLOR applies to active only
503 D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
505 if (!GL_SUPPORT(NV_REGISTER_COMBINERS)) {
506 /* And now the default texture color as well */
507 for (i = 0; i < GL_LIMITS(texture_stages); i++) {
508 /* Note the WINED3DRS value applies to all textures, but GL has one
509 * per texture, so apply it now ready to be used!
511 if (GL_SUPPORT(ARB_MULTITEXTURE)) {
512 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
513 checkGLcall("glActiveTextureARB");
515 FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
518 glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
519 checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
522 GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0]));
527 renderstate_stencil_twosided(IWineD3DStateBlockImpl *stateblock, GLint face, GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass ) {
528 #if 0 /* Don't use OpenGL 2.0 calls for now */
529 if(GL_EXTCALL(glStencilFuncSeparate) && GL_EXTCALL(glStencilOpSeparate)) {
530 GL_EXTCALL(glStencilFuncSeparate(face, func, ref, mask));
531 checkGLcall("glStencilFuncSeparate(...)");
532 GL_EXTCALL(glStencilOpSeparate(face, stencilFail, depthFail, stencilPass));
533 checkGLcall("glStencilOpSeparate(...)");
537 if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE)) {
538 glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
539 checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
540 GL_EXTCALL(glActiveStencilFaceEXT(face));
541 checkGLcall("glActiveStencilFaceEXT(...)");
542 glStencilFunc(func, ref, mask);
543 checkGLcall("glStencilFunc(...)");
544 glStencilOp(stencilFail, depthFail, stencilPass);
545 checkGLcall("glStencilOp(...)");
546 } else if(GL_SUPPORT(ATI_SEPARATE_STENCIL)) {
547 GL_EXTCALL(glStencilFuncSeparateATI(face, func, ref, mask));
548 checkGLcall("glStencilFuncSeparateATI(...)");
549 GL_EXTCALL(glStencilOpSeparateATI(face, stencilFail, depthFail, stencilPass));
550 checkGLcall("glStencilOpSeparateATI(...)");
552 ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n");
557 state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock) {
558 DWORD onesided_enable = FALSE;
559 DWORD twosided_enable = FALSE;
560 GLint func = GL_ALWAYS;
561 GLint func_ccw = GL_ALWAYS;
564 GLint stencilFail = GL_KEEP;
565 GLint depthFail = GL_KEEP;
566 GLint stencilPass = GL_KEEP;
567 GLint stencilFail_ccw = GL_KEEP;
568 GLint depthFail_ccw = GL_KEEP;
569 GLint stencilPass_ccw = GL_KEEP;
571 if( stateblock->set.renderState[WINED3DRS_STENCILENABLE] )
572 onesided_enable = stateblock->renderState[WINED3DRS_STENCILENABLE];
573 if( stateblock->set.renderState[WINED3DRS_TWOSIDEDSTENCILMODE] )
574 twosided_enable = stateblock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE];
575 if( stateblock->set.renderState[WINED3DRS_STENCILFUNC] )
576 if( !( func = CompareFunc(stateblock->renderState[WINED3DRS_STENCILFUNC]) ) )
578 if( stateblock->set.renderState[WINED3DRS_CCW_STENCILFUNC] )
579 if( !( func_ccw = CompareFunc(stateblock->renderState[WINED3DRS_CCW_STENCILFUNC]) ) )
581 if( stateblock->set.renderState[WINED3DRS_STENCILREF] )
582 ref = stateblock->renderState[WINED3DRS_STENCILREF];
583 if( stateblock->set.renderState[WINED3DRS_STENCILMASK] )
584 mask = stateblock->renderState[WINED3DRS_STENCILMASK];
585 if( stateblock->set.renderState[WINED3DRS_STENCILFAIL] )
586 stencilFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILFAIL]);
587 if( stateblock->set.renderState[WINED3DRS_STENCILZFAIL] )
588 depthFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILZFAIL]);
589 if( stateblock->set.renderState[WINED3DRS_STENCILPASS] )
590 stencilPass = StencilOp(stateblock->renderState[WINED3DRS_STENCILPASS]);
591 if( stateblock->set.renderState[WINED3DRS_CCW_STENCILFAIL] )
592 stencilFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILFAIL]);
593 if( stateblock->set.renderState[WINED3DRS_CCW_STENCILZFAIL] )
594 depthFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILZFAIL]);
595 if( stateblock->set.renderState[WINED3DRS_CCW_STENCILPASS] )
596 stencilPass_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILPASS]);
598 TRACE("(onesided %d, twosided %d, ref %x, mask %x, \
599 GL_FRONT: func: %x, fail %x, zfail %x, zpass %x \
600 GL_BACK: func: %x, fail %x, zfail %x, zpass %x )\n",
601 onesided_enable, twosided_enable, ref, mask,
602 func, stencilFail, depthFail, stencilPass,
603 func_ccw, stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
605 if (twosided_enable) {
606 renderstate_stencil_twosided(stateblock, GL_FRONT, func, ref, mask, stencilFail, depthFail, stencilPass);
607 renderstate_stencil_twosided(stateblock, GL_BACK, func_ccw, ref, mask, stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
609 if (onesided_enable) {
610 glEnable(GL_STENCIL_TEST);
611 checkGLcall("glEnable GL_STENCIL_TEST");
612 glStencilFunc(func, ref, mask);
613 checkGLcall("glStencilFunc(...)");
614 glStencilOp(stencilFail, depthFail, stencilPass);
615 checkGLcall("glStencilOp(...)");
617 glDisable(GL_STENCIL_TEST);
618 checkGLcall("glDisable GL_STENCIL_TEST");
623 static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock) {
624 glStencilMask(stateblock->renderState[WINED3DRS_STENCILWRITEMASK]);
625 checkGLcall("glStencilMask");
628 static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock) {
629 /* TODO: Put this into the vertex type block once that is in the state table */
630 BOOL fogenable = stateblock->renderState[WINED3DRS_FOGENABLE];
631 float fogstart, fogend;
639 /* No fog? Disable it, and we're done :-) */
641 checkGLcall("glDisable GL_FOG");
644 tmpvalue.d = stateblock->renderState[WINED3DRS_FOGSTART];
645 fogstart = tmpvalue.f;
646 tmpvalue.d = stateblock->renderState[WINED3DRS_FOGEND];
650 /* Activate when vertex shaders are in the state table */
651 if(stateblock->vertexShader && ((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function &&
652 ((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->usesFog) {
653 glFogi(GL_FOG_MODE, GL_LINEAR);
654 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
657 stateblock->wineD3DDevice->last_was_foggy_shader = TRUE;
661 /* DX 7 sdk: "If both render states(vertex and table fog) are set to valid modes,
662 * the system will apply only pixel(=table) fog effects."
664 /* else */ if(stateblock->renderState[WINED3DRS_FOGTABLEMODE] == D3DFOG_NONE) {
665 glHint(GL_FOG_HINT, GL_FASTEST);
666 checkGLcall("glHint(GL_FOG_HINT, GL_FASTEST)");
668 stateblock->wineD3DDevice->last_was_foggy_shader = FALSE;
670 switch (stateblock->renderState[WINED3DRS_FOGVERTEXMODE]) {
671 /* Processed vertices have their fog factor stored in the specular value. Fall too the none case.
672 * If we are drawing untransformed vertices atm, d3ddevice_set_ortho will update the fog
675 if(!stateblock->wineD3DDevice->last_was_rhw) {
676 glFogi(GL_FOG_MODE, GL_EXP);
677 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP");
678 if(GL_SUPPORT(EXT_FOG_COORD)) {
679 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
680 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT");
686 if(!stateblock->wineD3DDevice->last_was_rhw) {
687 glFogi(GL_FOG_MODE, GL_EXP2);
688 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2");
689 if(GL_SUPPORT(EXT_FOG_COORD)) {
690 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
691 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT");
696 case D3DFOG_LINEAR: {
697 if(!stateblock->wineD3DDevice->last_was_rhw) {
698 glFogi(GL_FOG_MODE, GL_LINEAR);
699 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR");
700 if(GL_SUPPORT(EXT_FOG_COORD)) {
701 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
702 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT");
708 /* Both are none? According to msdn the alpha channel of the specular
709 * color contains a fog factor. Set it in drawStridedSlow.
710 * Same happens with Vertexfog on transformed vertices
712 if(GL_SUPPORT(EXT_FOG_COORD)) {
713 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
714 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)\n");
715 glFogi(GL_FOG_MODE, GL_LINEAR);
716 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
720 /* Disable GL fog, handle this in software in drawStridedSlow */
725 default: FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock->renderState[WINED3DRS_FOGVERTEXMODE]);
728 glHint(GL_FOG_HINT, GL_NICEST);
729 checkGLcall("glHint(GL_FOG_HINT, GL_NICEST)");
731 stateblock->wineD3DDevice->last_was_foggy_shader = FALSE;
733 switch (stateblock->renderState[WINED3DRS_FOGTABLEMODE]) {
735 glFogi(GL_FOG_MODE, GL_EXP);
736 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP");
737 if(GL_SUPPORT(EXT_FOG_COORD)) {
738 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
739 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT");
744 glFogi(GL_FOG_MODE, GL_EXP2);
745 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2");
746 if(GL_SUPPORT(EXT_FOG_COORD)) {
747 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
748 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT");
753 glFogi(GL_FOG_MODE, GL_LINEAR);
754 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR");
755 if(GL_SUPPORT(EXT_FOG_COORD)) {
756 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
757 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT");
761 case D3DFOG_NONE: /* Won't happen */
763 FIXME("Unexpected WINED3DRS_FOGTABLEMODE %d\n", stateblock->renderState[WINED3DRS_FOGTABLEMODE]);
769 checkGLcall("glEnable GL_FOG");
771 glFogfv(GL_FOG_START, &fogstart);
772 checkGLcall("glFogf(GL_FOG_START, fogstart");
773 TRACE("Fog Start == %f\n", fogstart);
775 glFogfv(GL_FOG_END, &fogend);
776 checkGLcall("glFogf(GL_FOG_END, fogend");
777 TRACE("Fog End == %f\n", fogend);
780 checkGLcall("glDisable GL_FOG");
783 if (GL_SUPPORT(NV_FOG_DISTANCE)) {
784 glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV);
788 static void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
790 D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_FOGCOLOR], col);
791 /* Set the default alpha blend color */
792 glFogfv(GL_FOG_COLOR, &col[0]);
793 checkGLcall("glFog GL_FOG_COLOR");
796 static void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock) {
801 tmpvalue.d = stateblock->renderState[WINED3DRS_FOGDENSITY];
802 glFogfv(GL_FOG_DENSITY, &tmpvalue.f);
803 checkGLcall("glFogf(GL_FOG_DENSITY, (float) Value)");
806 /* TODO: Merge with primitive type + init_materials()!! */
807 static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock) {
808 GLenum Parm = GL_AMBIENT_AND_DIFFUSE;
810 if (stateblock->renderState[WINED3DRS_COLORVERTEX]) {
811 TRACE("diff %d, amb %d, emis %d, spec %d\n",
812 stateblock->renderState[WINED3DRS_DIFFUSEMATERIALSOURCE],
813 stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE],
814 stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE],
815 stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE]);
817 if (stateblock->renderState[WINED3DRS_DIFFUSEMATERIALSOURCE] == D3DMCS_COLOR1) {
818 if (stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE] == D3DMCS_COLOR1) {
819 Parm = GL_AMBIENT_AND_DIFFUSE;
823 } else if (stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE] == D3DMCS_COLOR1) {
825 } else if (stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE] == D3DMCS_COLOR1) {
827 } else if (stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == D3DMCS_COLOR1) {
834 if (stateblock->wineD3DDevice->tracking_color != DISABLED_TRACKING) stateblock->wineD3DDevice->tracking_color = NEEDS_DISABLE;
836 stateblock->wineD3DDevice->tracking_color = NEEDS_TRACKING;
837 stateblock->wineD3DDevice->tracking_parm = Parm;
841 if (stateblock->wineD3DDevice->tracking_color != DISABLED_TRACKING) stateblock->wineD3DDevice->tracking_color = NEEDS_DISABLE;
845 static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock) {
848 WINED3DLINEPATTERN lp;
850 tmppattern.d = stateblock->renderState[WINED3DRS_LINEPATTERN];
852 TRACE("Line pattern: repeat %d bits %x\n", tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
854 if (tmppattern.lp.wRepeatFactor) {
855 glLineStipple(tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
856 checkGLcall("glLineStipple(repeat, linepattern)");
857 glEnable(GL_LINE_STIPPLE);
858 checkGLcall("glEnable(GL_LINE_STIPPLE);");
860 glDisable(GL_LINE_STIPPLE);
861 checkGLcall("glDisable(GL_LINE_STIPPLE);");
865 static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock) {
871 if (stateblock->renderState[WINED3DRS_ZBIAS]) {
872 tmpvalue.d = stateblock->renderState[WINED3DRS_ZBIAS];
873 TRACE("ZBias value %f\n", tmpvalue.f);
874 glPolygonOffset(0, -tmpvalue.f);
875 checkGLcall("glPolygonOffset(0, -Value)");
876 glEnable(GL_POLYGON_OFFSET_FILL);
877 checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL);");
878 glEnable(GL_POLYGON_OFFSET_LINE);
879 checkGLcall("glEnable(GL_POLYGON_OFFSET_LINE);");
880 glEnable(GL_POLYGON_OFFSET_POINT);
881 checkGLcall("glEnable(GL_POLYGON_OFFSET_POINT);");
883 glDisable(GL_POLYGON_OFFSET_FILL);
884 checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL);");
885 glDisable(GL_POLYGON_OFFSET_LINE);
886 checkGLcall("glDisable(GL_POLYGON_OFFSET_LINE);");
887 glDisable(GL_POLYGON_OFFSET_POINT);
888 checkGLcall("glDisable(GL_POLYGON_OFFSET_POINT);");
893 static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock) {
894 if (stateblock->renderState[WINED3DRS_NORMALIZENORMALS]) {
895 glEnable(GL_NORMALIZE);
896 checkGLcall("glEnable(GL_NORMALIZE);");
898 glDisable(GL_NORMALIZE);
899 checkGLcall("glDisable(GL_NORMALIZE);");
903 static void state_psize(DWORD state, IWineD3DStateBlockImpl *stateblock) {
909 /* FIXME: check that pointSize isn't outside glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maxSize ); or -ve */
910 tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE];
911 TRACE("Set point size to %f\n", tmpvalue.f);
912 glPointSize(tmpvalue.f);
913 checkGLcall("glPointSize(...);");
916 static void state_psizemin(DWORD state, IWineD3DStateBlockImpl *stateblock) {
922 if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
923 tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
924 GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, tmpvalue.f);
925 checkGLcall("glPointParameterfEXT(...);");
927 FIXME("WINED3DRS_POINTSIZE_MIN not supported on this opengl\n");
931 static void state_psizemax(DWORD state, IWineD3DStateBlockImpl *stateblock) {
937 if (GL_SUPPORT(EXT_POINT_PARAMETERS)) {
938 tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
939 GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, tmpvalue.f);
940 checkGLcall("glPointParameterfEXT(...);");
942 FIXME("WINED3DRS_POINTSIZE_MAX not supported on this opengl\n");
946 static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock) {
947 /* TODO: Group this with the viewport */
949 * POINTSCALEENABLE controls how point size value is treated. If set to
950 * true, the point size is scaled with respect to height of viewport.
951 * When set to false point size is in pixels.
953 * http://msdn.microsoft.com/library/en-us/directx9_c/point_sprites.asp
957 GLfloat att[3] = {1.0f, 0.0f, 0.0f};
960 * Minimum valid point size for OpenGL is 1.0f. For Direct3D it is 0.0f.
961 * This means that OpenGL will clamp really small point sizes to 1.0f.
962 * To correct for this we need to multiply by the scale factor when sizes
963 * are less than 1.0f. scale_factor = 1.0f / point_size.
965 GLfloat pointSize = *((float*)&stateblock->renderState[WINED3DRS_POINTSIZE]);
966 if(pointSize > 0.0f) {
969 if(pointSize < 1.0f) {
970 scaleFactor = pointSize * pointSize;
975 if(stateblock->renderState[WINED3DRS_POINTSCALEENABLE]) {
976 att[0] = *((float*)&stateblock->renderState[WINED3DRS_POINTSCALE_A]) /
977 (stateblock->viewport.Height * stateblock->viewport.Height * scaleFactor);
978 att[1] = *((float*)&stateblock->renderState[WINED3DRS_POINTSCALE_B]) /
979 (stateblock->viewport.Height * stateblock->viewport.Height * scaleFactor);
980 att[2] = *((float*)&stateblock->renderState[WINED3DRS_POINTSCALE_C]) /
981 (stateblock->viewport.Height * stateblock->viewport.Height * scaleFactor);
985 if(GL_SUPPORT(ARB_POINT_PARAMETERS)) {
986 GL_EXTCALL(glPointParameterfvARB)(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
987 checkGLcall("glPointParameterfvARB(GL_DISTANCE_ATTENUATION_ARB, ...");
989 else if(GL_SUPPORT(EXT_POINT_PARAMETERS)) {
990 GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
991 checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...");
993 TRACE("POINT_PARAMETERS not supported in this version of opengl\n");
997 static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock) {
998 DWORD Value = stateblock->renderState[WINED3DRS_COLORWRITEENABLE];
1000 TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
1001 Value & D3DCOLORWRITEENABLE_RED ? 1 : 0,
1002 Value & D3DCOLORWRITEENABLE_GREEN ? 1 : 0,
1003 Value & D3DCOLORWRITEENABLE_BLUE ? 1 : 0,
1004 Value & D3DCOLORWRITEENABLE_ALPHA ? 1 : 0);
1005 glColorMask(Value & D3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
1006 Value & D3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
1007 Value & D3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
1008 Value & D3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
1009 checkGLcall("glColorMask(...)");
1011 /* depends on WINED3DRS_COLORWRITEENABLE. */
1012 if(stateblock->renderState[WINED3DRS_COLORWRITEENABLE1] != 0x0000000F ||
1013 stateblock->renderState[WINED3DRS_COLORWRITEENABLE2] != 0x0000000F ||
1014 stateblock->renderState[WINED3DRS_COLORWRITEENABLE3] != 0x0000000F ) {
1015 ERR("(WINED3DRS_COLORWRITEENABLE1/2/3,%d,%d,%d) not yet implemented. Missing of cap D3DPMISCCAPS_INDEPENDENTWRITEMASKS wasn't honored?\n",
1016 stateblock->renderState[WINED3DRS_COLORWRITEENABLE1],
1017 stateblock->renderState[WINED3DRS_COLORWRITEENABLE2],
1018 stateblock->renderState[WINED3DRS_COLORWRITEENABLE3]);
1022 static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1023 if(stateblock->renderState[WINED3DRS_LOCALVIEWER]) {
1024 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
1025 checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1)");
1027 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
1028 checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0)");
1032 static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1033 if(stateblock->renderState[WINED3DRS_LASTPIXEL]) {
1034 TRACE("Last Pixel Drawing Enabled\n");
1036 FIXME("Last Pixel Drawing Disabled, not handled yet\n");
1040 static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1041 /* TODO: NV_POINT_SPRITE */
1042 if (!GL_SUPPORT(ARB_POINT_SPRITE)) {
1043 TRACE("Point sprites not supported\n");
1048 * Point sprites are always enabled. Value controls texture coordinate
1049 * replacement mode. Must be set true for point sprites to use
1052 glEnable(GL_POINT_SPRITE_ARB);
1053 checkGLcall("glEnable(GL_POINT_SPRITE_ARB)");
1055 if (stateblock->renderState[WINED3DRS_POINTSPRITEENABLE]) {
1056 glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, TRUE);
1057 checkGLcall("glTexEnvf(GL_POINT_SPRITE, GL_COORD_REPLACE, TRUE)");
1059 glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, FALSE);
1060 checkGLcall("glTexEnvf(GL_POINT_SPRITE, GL_COORD_REPLACE, FALSE)");
1064 static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1066 http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/texture/
1067 http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/programmingguide/FixedFunction/Textures/texturewrapping.asp
1068 http://www.gamedev.net/reference/programming/features/rendererdll3/page2.asp
1069 Descussion that ways to turn on WRAPing to solve an opengl conversion problem.
1070 http://www.flipcode.org/cgi-bin/fcmsg.cgi?thread_show=10248
1072 so far as I can tell, wrapping and texture-coordinate generate go hand in hand,
1075 if(stateblock->renderState[WINED3DRS_WRAP0] ||
1076 stateblock->renderState[WINED3DRS_WRAP1] ||
1077 stateblock->renderState[WINED3DRS_WRAP2] ||
1078 stateblock->renderState[WINED3DRS_WRAP3] ||
1079 stateblock->renderState[WINED3DRS_WRAP4] ||
1080 stateblock->renderState[WINED3DRS_WRAP5] ||
1081 stateblock->renderState[WINED3DRS_WRAP6] ||
1082 stateblock->renderState[WINED3DRS_WRAP7] ||
1083 stateblock->renderState[WINED3DRS_WRAP8] ||
1084 stateblock->renderState[WINED3DRS_WRAP9] ||
1085 stateblock->renderState[WINED3DRS_WRAP10] ||
1086 stateblock->renderState[WINED3DRS_WRAP11] ||
1087 stateblock->renderState[WINED3DRS_WRAP12] ||
1088 stateblock->renderState[WINED3DRS_WRAP13] ||
1089 stateblock->renderState[WINED3DRS_WRAP14] ||
1090 stateblock->renderState[WINED3DRS_WRAP15] ) {
1091 ERR("(WINED3DRS_WRAP0) Texture wraping not yet supported\n");
1095 static void state_multisampleaa(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1096 if( GL_SUPPORT(ARB_MULTISAMPLE) ) {
1097 if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
1098 glEnable(GL_MULTISAMPLE_ARB);
1099 checkGLcall("glEnable(GL_MULTISAMPLE_ARB)");
1101 glDisable(GL_MULTISAMPLE_ARB);
1102 checkGLcall("glDisable(GL_MULTISAMPLE_ARB)");
1105 if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
1106 ERR("Multisample antialiasing not supported by gl\n");
1111 static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1112 if(stateblock->renderState[WINED3DRS_SCISSORTESTENABLE]) {
1113 glEnable(GL_SCISSOR_TEST);
1114 checkGLcall("glEnable(GL_SCISSOR_TEST)");
1116 glDisable(GL_SCISSOR_TEST);
1117 checkGLcall("glDisable(GL_SCISSOR_TEST)");
1121 static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1127 if(stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS] ||
1128 stateblock->renderState[WINED3DRS_DEPTHBIAS]) {
1129 tmpvalue.d = stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS];
1130 glEnable(GL_POLYGON_OFFSET_FILL);
1131 checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
1132 glPolygonOffset(tmpvalue.f, *((float*)&stateblock->renderState[WINED3DRS_DEPTHBIAS]));
1133 checkGLcall("glPolygonOffset(...)");
1135 glDisable(GL_POLYGON_OFFSET_FILL);
1136 checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
1140 static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1141 if (stateblock->renderState[WINED3DRS_TEXTUREPERSPECTIVE]) {
1142 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
1143 checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)");
1145 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
1146 checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)");
1150 static void state_stippledalpha(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1152 if (stateblock->renderState[WINED3DRS_STIPPLEDALPHA])
1153 ERR(" Stippled Alpha not supported yet.\n");
1156 static void state_antialias(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1158 if (stateblock->renderState[WINED3DRS_ANTIALIAS])
1159 ERR(" Antialias not supported yet.\n");
1162 static void state_multisampmask(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1164 if (stateblock->renderState[WINED3DRS_MULTISAMPLEMASK] != 0xFFFFFFFF)
1165 ERR("(WINED3DRS_MULTISAMPLEMASK,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_MULTISAMPLEMASK]);
1168 static void state_patchedgestyle(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1170 if (stateblock->renderState[WINED3DRS_PATCHEDGESTYLE] != D3DPATCHEDGE_DISCRETE)
1171 ERR("(WINED3DRS_PATCHEDGESTYLE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_PATCHEDGESTYLE]);
1174 static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1182 if (stateblock->renderState[WINED3DRS_PATCHSEGMENTS] != tmpvalue.d)
1183 ERR("(WINED3DRS_PATCHSEGMENTS,%d) not yet implemented\n", tmpvalue.d);
1186 static void state_positiondegree(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1188 if (stateblock->renderState[WINED3DRS_POSITIONDEGREE] != D3DDEGREE_CUBIC)
1189 ERR("(WINED3DRS_POSITIONDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_POSITIONDEGREE]);
1192 static void state_normaldegree(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1194 if (stateblock->renderState[WINED3DRS_NORMALDEGREE] != D3DDEGREE_LINEAR)
1195 ERR("(WINED3DRS_NORMALDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_NORMALDEGREE]);
1198 static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1200 if(stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION])
1201 FIXME("(WINED3DRS_ENABLEADAPTIVETESSELLATION,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION]);
1205 static void state_srgbwrite(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1206 if(stateblock->renderState[WINED3DRS_SRGBWRITEENABLE])
1207 ERR("Render state WINED3DRS_SRGBWRITEENABLE not yet implemented\n");
1210 static void state_seperateblend(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1212 if(stateblock->renderState[WINED3DRS_SEPARATEALPHABLENDENABLE])
1213 FIXME("(WINED3DRS_SEPARATEALPHABLENDENABLE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_SEPARATEALPHABLENDENABLE]);
1216 static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1217 if(stateblock->renderState[WINED3DRS_WRAPU]) {
1218 FIXME("Render state WINED3DRS_WRAPU not implemented yet\n");
1222 static void state_wrapv(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1223 if(stateblock->renderState[WINED3DRS_WRAPV]) {
1224 FIXME("Render state WINED3DRS_WRAPV not implemented yet\n");
1228 static void state_monoenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1229 if(stateblock->renderState[WINED3DRS_MONOENABLE]) {
1230 FIXME("Render state WINED3DRS_MONOENABLE not implemented yet\n");
1234 static void state_rop2(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1235 if(stateblock->renderState[WINED3DRS_ROP2]) {
1236 FIXME("Render state WINED3DRS_ROP2 not implemented yet\n");
1240 static void state_planemask(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1241 if(stateblock->renderState[WINED3DRS_PLANEMASK]) {
1242 FIXME("Render state WINED3DRS_PLANEMASK not implemented yet\n");
1246 static void state_subpixel(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1247 if(stateblock->renderState[WINED3DRS_SUBPIXEL]) {
1248 FIXME("Render state WINED3DRS_SUBPIXEL not implemented yet\n");
1252 static void state_subpixelx(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1253 if(stateblock->renderState[WINED3DRS_SUBPIXELX]) {
1254 FIXME("Render state WINED3DRS_SUBPIXELX not implemented yet\n");
1258 static void state_stippleenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1259 if(stateblock->renderState[WINED3DRS_STIPPLEENABLE]) {
1260 FIXME("Render state WINED3DRS_STIPPLEENABLE not implemented yet\n");
1264 static void state_bordercolor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1265 if(stateblock->renderState[WINED3DRS_BORDERCOLOR]) {
1266 FIXME("Render state WINED3DRS_BORDERCOLOR not implemented yet\n");
1270 static void state_mipmaplodbias(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1271 if(stateblock->renderState[WINED3DRS_MIPMAPLODBIAS]) {
1272 FIXME("Render state WINED3DRS_MIPMAPLODBIAS not implemented yet\n");
1276 static void state_anisotropy(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1277 if(stateblock->renderState[WINED3DRS_ANISOTROPY]) {
1278 FIXME("Render state WINED3DRS_ANISOTROPY not implemented yet\n");
1282 static void state_flushbatch(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1283 if(stateblock->renderState[WINED3DRS_FLUSHBATCH]) {
1284 FIXME("Render state WINED3DRS_FLUSHBATCH not implemented yet\n");
1288 static void state_translucentsi(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1289 if(stateblock->renderState[WINED3DRS_TRANSLUCENTSORTINDEPENDENT]) {
1290 FIXME("Render state WINED3DRS_TRANSLUCENTSORTINDEPENDENT not implemented yet\n");
1294 static void state_extents(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1295 if(stateblock->renderState[WINED3DRS_EXTENTS]) {
1296 FIXME("Render state WINED3DRS_EXTENTS not implemented yet\n");
1300 static void state_ckeyblend(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1301 if(stateblock->renderState[WINED3DRS_COLORKEYBLENDENABLE]) {
1302 FIXME("Render state WINED3DRS_COLORKEYBLENDENABLE not implemented yet\n");
1306 /* Activates the texture dimension according to the bound D3D texture.
1307 * Does not care for the colorop or correct gl texture unit(when using nvrc)
1308 * Requires the caller to activate the correct unit before
1310 static void activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock) {
1311 if(stateblock->textures[stage]) {
1312 glDisable(GL_TEXTURE_1D);
1313 checkGLcall("glDisable(GL_TEXTURE_1D)");
1314 switch(stateblock->textureDimensions[stage]) {
1316 glDisable(GL_TEXTURE_3D);
1317 checkGLcall("glDisable(GL_TEXTURE_3D)");
1318 glDisable(GL_TEXTURE_CUBE_MAP_ARB);
1319 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
1320 glEnable(GL_TEXTURE_2D);
1321 checkGLcall("glEnable(GL_TEXTURE_2D)");
1324 glDisable(GL_TEXTURE_CUBE_MAP_ARB);
1325 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
1326 glDisable(GL_TEXTURE_2D);
1327 checkGLcall("glDisable(GL_TEXTURE_2D)");
1328 glEnable(GL_TEXTURE_3D);
1329 checkGLcall("glEnable(GL_TEXTURE_3D)");
1331 case GL_TEXTURE_CUBE_MAP_ARB:
1332 glDisable(GL_TEXTURE_2D);
1333 checkGLcall("glDisable(GL_TEXTURE_2D)");
1334 glDisable(GL_TEXTURE_3D);
1335 checkGLcall("glDisable(GL_TEXTURE_3D)");
1336 glEnable(GL_TEXTURE_CUBE_MAP_ARB);
1337 checkGLcall("glEnable(GL_TEXTURE_CUBE_MAP_ARB)");
1341 glDisable(GL_TEXTURE_2D);
1342 checkGLcall("glDisable(GL_TEXTURE_2D)");
1343 glDisable(GL_TEXTURE_3D);
1344 checkGLcall("glDisable(GL_TEXTURE_3D)");
1345 glDisable(GL_TEXTURE_CUBE_MAP_ARB);
1346 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
1347 glEnable(GL_TEXTURE_1D);
1348 checkGLcall("glEnable(GL_TEXTURE_1D)");
1349 /* Binding textures is done by samplers. A dummy texture will be bound */
1353 static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1354 DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
1356 TRACE("Setting color op for stage %d\n", stage);
1358 if (stateblock->pixelShader && stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE &&
1359 ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function) {
1360 /* Using a pixel shader? Don't care for anything here, the shader applying does it */
1364 if (GL_SUPPORT(ARB_MULTITEXTURE)) {
1365 /* TODO: register combiners! */
1366 if(stage != stateblock->wineD3DDevice->texUnitMap[stage]) ERR("Foo: %d is %d!\n", stage, stateblock->wineD3DDevice->texUnitMap[stage]);
1367 if(stateblock->wineD3DDevice->texUnitMap[stage] >= GL_LIMITS(sampler_stages)) {
1368 if(stateblock->textureState[stage][WINED3DTSS_COLOROP] != WINED3DTOP_DISABLE &&
1369 stateblock->textureState[stage][WINED3DTSS_COLOROP] != 0) {
1370 FIXME("Attempt to enable unsupported stage!\n");
1374 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stateblock->wineD3DDevice->texUnitMap[stage]));
1375 checkGLcall("glActiveTextureARB");
1376 } else if (stage > 0) {
1377 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
1381 if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
1382 if(stateblock->lowest_disabled_stage > 0) {
1383 glEnable(GL_REGISTER_COMBINERS_NV);
1384 GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, stateblock->lowest_disabled_stage));
1386 glDisable(GL_REGISTER_COMBINERS_NV);
1389 if(stage >= stateblock->lowest_disabled_stage) {
1390 TRACE("Stage disabled\n");
1391 /* Disable everything here */
1392 glDisable(GL_TEXTURE_1D);
1393 checkGLcall("glDisable(GL_TEXTURE_1D)");
1394 glDisable(GL_TEXTURE_2D);
1395 checkGLcall("glDisable(GL_TEXTURE_2D)");
1396 glDisable(GL_TEXTURE_3D);
1397 checkGLcall("glDisable(GL_TEXTURE_3D)");
1398 glDisable(GL_TEXTURE_CUBE_MAP_ARB);
1399 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
1404 activate_dimensions(stage, stateblock);
1406 /* Set the texture combiners */
1407 if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
1408 set_tex_op_nvrc((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage,
1409 stateblock->textureState[stage][WINED3DTSS_COLOROP],
1410 stateblock->textureState[stage][WINED3DTSS_COLORARG1],
1411 stateblock->textureState[stage][WINED3DTSS_COLORARG2],
1412 stateblock->textureState[stage][WINED3DTSS_COLORARG0],
1413 stateblock->wineD3DDevice->texUnitMap[stage]);
1415 set_tex_op((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage,
1416 stateblock->textureState[stage][WINED3DTSS_COLOROP],
1417 stateblock->textureState[stage][WINED3DTSS_COLORARG1],
1418 stateblock->textureState[stage][WINED3DTSS_COLORARG2],
1419 stateblock->textureState[stage][WINED3DTSS_COLORARG0]);
1423 static void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1424 DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
1426 TRACE("Setting alpha op for stage %d\n", stage);
1427 /* Do not care for enabled / disabled stages, just assign the settigns. colorop disables / enables required stuff */
1428 if (GL_SUPPORT(ARB_MULTITEXTURE)) {
1429 /* TODO: register combiners! */
1430 if(stage >= GL_LIMITS(sampler_stages)) {
1431 if(stateblock->textureState[stage][WINED3DTSS_COLOROP] != WINED3DTOP_DISABLE &&
1432 stateblock->textureState[stage][WINED3DTSS_COLOROP] != 0) {
1433 FIXME("Attempt to enable unsupported stage!\n");
1437 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stateblock->wineD3DDevice->texUnitMap[stage]));
1438 checkGLcall("glActiveTextureARB");
1439 } else if (stage > 0) {
1440 /* We can't do anything here */
1441 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
1445 TRACE("Setting alpha op for stage %d\n", stage);
1446 if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
1447 set_tex_op_nvrc((IWineD3DDevice *)stateblock->wineD3DDevice, TRUE, stage,
1448 stateblock->textureState[stage][WINED3DTSS_ALPHAOP],
1449 stateblock->textureState[stage][WINED3DTSS_ALPHAARG1],
1450 stateblock->textureState[stage][WINED3DTSS_ALPHAARG2],
1451 stateblock->textureState[stage][WINED3DTSS_ALPHAARG0],
1452 stateblock->wineD3DDevice->texUnitMap[stage]);
1454 set_tex_op((IWineD3DDevice *)stateblock->wineD3DDevice, TRUE, stage, stateblock->textureState[stage][WINED3DTSS_ALPHAOP],
1455 stateblock->textureState[stage][WINED3DTSS_ALPHAARG1],
1456 stateblock->textureState[stage][WINED3DTSS_ALPHAARG2],
1457 stateblock->textureState[stage][WINED3DTSS_ALPHAARG0]);
1461 static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1462 DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
1464 if (GL_SUPPORT(ARB_MULTITEXTURE)) {
1465 /* TODO: register combiners! */
1466 if(stage >= GL_LIMITS(sampler_stages)) {
1469 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stateblock->wineD3DDevice->texUnitMap[stage]));
1470 checkGLcall("glActiveTextureARB");
1471 } else if (stage > 0) {
1472 /* We can't do anything here */
1473 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
1477 /* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive
1479 * FIXME: From MSDN: The WINED3DTSS_TCI_* flags are mutually exclusive. If you include
1480 * one flag, you can still specify an index value, which the system uses to
1481 * determine the texture wrapping mode.
1482 * eg. SetTextureStageState( 0, WINED3DTSS_TEXCOORDINDEX, WINED3DTSS_TCI_CAMERASPACEPOSITION | 1 );
1483 * means use the vertex position (camera-space) as the input texture coordinates
1484 * for this texture stage, and the wrap mode set in the WINED3DRS_WRAP1 render
1485 * state. We do not (yet) support the WINED3DRENDERSTATE_WRAPx values, nor tie them up
1486 * to the TEXCOORDINDEX value
1490 * Be careful the value of the mask 0xF0000 come from d3d8types.h infos
1492 switch (stateblock->textureState[stage][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) {
1493 case WINED3DTSS_TCI_PASSTHRU:
1494 /*Use the specified texture coordinates contained within the vertex format. This value resolves to zero.*/
1495 glDisable(GL_TEXTURE_GEN_S);
1496 glDisable(GL_TEXTURE_GEN_T);
1497 glDisable(GL_TEXTURE_GEN_R);
1498 glDisable(GL_TEXTURE_GEN_Q);
1499 checkGLcall("glDisable(GL_TEXTURE_GEN_S,T,R,Q)");
1502 case WINED3DTSS_TCI_CAMERASPACEPOSITION:
1503 /* CameraSpacePosition means use the vertex position, transformed to camera space,
1504 * as the input texture coordinates for this stage's texture transformation. This
1505 * equates roughly to EYE_LINEAR
1508 float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
1509 float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
1510 float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
1511 float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
1512 TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
1514 glMatrixMode(GL_MODELVIEW);
1517 glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
1518 glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
1519 glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
1520 glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
1523 TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set GL_TEXTURE_GEN_x and GL_x, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR\n");
1524 glEnable(GL_TEXTURE_GEN_S);
1525 checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
1526 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
1527 checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
1528 glEnable(GL_TEXTURE_GEN_T);
1529 checkGLcall("glEnable(GL_TEXTURE_GEN_T);");
1530 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
1531 checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
1532 glEnable(GL_TEXTURE_GEN_R);
1533 checkGLcall("glEnable(GL_TEXTURE_GEN_R);");
1534 glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
1535 checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
1539 case WINED3DTSS_TCI_CAMERASPACENORMAL:
1541 if (GL_SUPPORT(NV_TEXGEN_REFLECTION)) {
1542 float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
1543 float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
1544 float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
1545 float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
1546 TRACE("WINED3DTSS_TCI_CAMERASPACENORMAL - Set eye plane\n");
1548 glMatrixMode(GL_MODELVIEW);
1551 glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
1552 glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
1553 glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
1554 glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
1557 glEnable(GL_TEXTURE_GEN_S);
1558 checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
1559 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
1560 checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
1561 glEnable(GL_TEXTURE_GEN_T);
1562 checkGLcall("glEnable(GL_TEXTURE_GEN_T);");
1563 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
1564 checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
1565 glEnable(GL_TEXTURE_GEN_R);
1566 checkGLcall("glEnable(GL_TEXTURE_GEN_R);");
1567 glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
1568 checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
1573 case WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR:
1575 if (GL_SUPPORT(NV_TEXGEN_REFLECTION)) {
1576 float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
1577 float t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
1578 float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
1579 float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
1580 TRACE("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Set eye plane\n");
1582 glMatrixMode(GL_MODELVIEW);
1585 glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
1586 glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
1587 glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
1588 glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
1591 glEnable(GL_TEXTURE_GEN_S);
1592 checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
1593 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
1594 checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
1595 glEnable(GL_TEXTURE_GEN_T);
1596 checkGLcall("glEnable(GL_TEXTURE_GEN_T);");
1597 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
1598 checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
1599 glEnable(GL_TEXTURE_GEN_R);
1600 checkGLcall("glEnable(GL_TEXTURE_GEN_R);");
1601 glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
1602 checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
1607 /* Unhandled types: */
1610 /* ? disable GL_TEXTURE_GEN_n ? */
1611 glDisable(GL_TEXTURE_GEN_S);
1612 glDisable(GL_TEXTURE_GEN_T);
1613 glDisable(GL_TEXTURE_GEN_R);
1614 glDisable(GL_TEXTURE_GEN_Q);
1615 FIXME("Unhandled WINED3DTSS_TEXCOORDINDEX %x\n", stateblock->textureState[stage][WINED3DTSS_TEXCOORDINDEX]);
1620 static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1621 DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
1627 tmpvalue.d = stateblock->textureState[stage][WINED3DTSS_BUMPENVLSCALE];
1628 if(tmpvalue.f != 0.0) {
1629 ERR("WINED3DTSS_BUMPENVLSCALE not supported yet\n");
1633 static void tex_bumpenvloffset(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1634 DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
1640 tmpvalue.d = stateblock->textureState[stage][WINED3DTSS_BUMPENVLOFFSET];
1641 if(tmpvalue.f != 0.0) {
1642 ERR("WINED3DTSS_BUMPENVLOFFSET not supported yet\n");
1646 static void tex_resultarg(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1647 DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
1649 if(stateblock->textureState[stage][WINED3DTSS_RESULTARG] != D3DTA_CURRENT) {
1650 ERR("WINED3DTSS_RESULTARG not supported yet\n");
1654 static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1655 DWORD sampler = state - STATE_SAMPLER(0);
1657 TRACE("Sampler: %d\n", sampler);
1658 /* Enabling and disabling texture dimensions is done by texture stage state / pixel shader setup, this function
1659 * only has to bind textures and set the per texture states
1661 if (GL_SUPPORT(ARB_MULTITEXTURE)) {
1662 /* TODO: register combiners! */
1663 if(sampler >= GL_LIMITS(sampler_stages)) {
1666 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stateblock->wineD3DDevice->texUnitMap[sampler]));
1667 checkGLcall("glActiveTextureARB");
1668 } else if (sampler > 0) {
1669 /* We can't do anything here */
1670 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
1674 if(stateblock->textures[sampler]) {
1675 IWineD3DBaseTexture_PreLoad((IWineD3DBaseTexture *) stateblock->textures[sampler]);
1676 IWineD3DDevice_SetupTextureStates((IWineD3DDevice *)stateblock->wineD3DDevice, sampler, sampler, REAPPLY_ALPHAOP);
1677 IWineD3DBaseTexture_ApplyStateChanges(stateblock->textures[sampler], stateblock->textureState[sampler], stateblock->samplerState[sampler]);
1679 if (stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE && stateblock->pixelShader &&
1680 ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function) {
1681 /* Using a pixel shader? Verify the sampler types */
1683 /* Make sure that the texture dimensions are enabled. I don't have to disable the other
1684 * dimensions because the shader knows from which texture type to sample from. For the sake of
1685 * debugging all dimensions could be enabled and a texture with some ugly pink bound to the unused
1686 * dimensions. This should make wrong sampling sources visible :-)
1688 glEnable(stateblock->textureDimensions[sampler]);
1689 checkGLcall("glEnable(stateblock->textureDimensions[sampler])");
1690 } else if(sampler < stateblock->lowest_disabled_stage) {
1691 activate_dimensions(sampler, stateblock);
1693 if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
1694 /* If color keying is enabled update the alpha test, it depends on the existance
1695 * of a color key in stage 0
1697 state_alpha(WINED3DRS_COLORKEYENABLE, stateblock);
1700 } else if(sampler < GL_LIMITS(texture_stages)) {
1701 if(sampler < stateblock->lowest_disabled_stage) {
1702 /* TODO: Check if the colorop is dirty to do that job
1703 * TODO: What should I do with pixel shaders here ???
1705 activate_dimensions(sampler, stateblock);
1706 } /* Otherwise tex_colorop disables the stage */
1707 glBindTexture(GL_TEXTURE_1D, stateblock->wineD3DDevice->dummyTextureName[sampler]);
1708 checkGLcall("glBindTexture(GL_TEXTURE_1D, stateblock->wineD3DDevice->dummyTextureName[sampler])");
1712 static void pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock) {
1715 if(stateblock->pixelShader && ((IWineD3DPixelShaderImpl *) stateblock->pixelShader)->baseShader.function != NULL) {
1716 if(!stateblock->wineD3DDevice->last_was_pshader) {
1717 /* Former draw without a pixel shader, some samplers
1718 * may be disabled because of WINED3DTSS_COLOROP = WINED3DTOP_DISABLE
1719 * make sure to enable them
1721 for(i=0; i < MAX_SAMPLERS; i++) {
1722 if(!isStateDirty(stateblock->wineD3DDevice, STATE_SAMPLER(i))) {
1723 sampler(STATE_SAMPLER(i), stateblock);
1727 /* Otherwise all samplers were activated by the code above in earlier draws, or by sampler()
1728 * if a different texture was bound. I don't have to do anything.
1732 /* Compile and bind the shader */
1733 IWineD3DPixelShader_CompileShader(stateblock->pixelShader);
1736 /* Can't do that here right now, because glsl shaders depend on having both pixel and vertex shader
1737 * setup at the same time. The shader_select call will be done by drawprim until vertex shaders are
1738 * moved to the state table too
1740 stateblock->wineD3DDevice->shader_backend->shader_select(
1741 (IWineD3DDevice *) stateblock->wineD3DDevice,
1743 !stateblock->vertexShader ? FALSE : ((IWineD3DVertexShaderImpl *) stateblock->vertexShader)->baseShader.function != NULL);
1745 stateblock->wineD3DDevice->last_was_pshader = TRUE;
1747 /* Disabled the pixel shader - color ops weren't applied
1748 * while it was enabled, so re-apply them.
1750 for(i=0; i < MAX_TEXTURES; i++) {
1751 if(!isStateDirty(stateblock->wineD3DDevice, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP))) {
1752 tex_colorop(STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP), stateblock);
1755 stateblock->wineD3DDevice->last_was_pshader = FALSE;
1758 stateblock->wineD3DDevice->shader_backend->shader_select(
1759 (IWineD3DDevice *) stateblock->wineD3DDevice,
1761 !stateblock->vertexShader ? FALSE : ((IWineD3DVertexShaderImpl *) stateblock->vertexShader)->baseShader.function != NULL);
1766 const struct StateEntry StateTable[] =
1768 /* State name representative, apply function */
1769 { /* 0, Undefined */ 0, state_undefined },
1770 { /* 1, WINED3DRS_TEXTUREHANDLE */ 0 /* Handled in ddraw */, state_undefined },
1771 { /* 2, WINED3DRS_ANTIALIAS */ STATE_RENDER(WINED3DRS_ANTIALIAS), state_antialias },
1772 { /* 3, WINED3DRS_TEXTUREADDRESS */ 0 /* Handled in ddraw */, state_undefined },
1773 { /* 4, WINED3DRS_TEXTUREPERSPECTIVE */ STATE_RENDER(WINED3DRS_TEXTUREPERSPECTIVE), state_perspective },
1774 { /* 5, WINED3DRS_WRAPU */ STATE_RENDER(WINED3DRS_WRAPU), state_wrapu },
1775 { /* 6, WINED3DRS_WRAPV */ STATE_RENDER(WINED3DRS_WRAPV), state_wrapv },
1776 { /* 7, WINED3DRS_ZENABLE */ STATE_RENDER(WINED3DRS_ZENABLE), state_zenable },
1777 { /* 8, WINED3DRS_FILLMODE */ STATE_RENDER(WINED3DRS_FILLMODE), state_fillmode },
1778 { /* 9, WINED3DRS_SHADEMODE */ STATE_RENDER(WINED3DRS_SHADEMODE), state_shademode },
1779 { /* 10, WINED3DRS_LINEPATTERN */ STATE_RENDER(WINED3DRS_LINEPATTERN), state_linepattern },
1780 { /* 11, WINED3DRS_MONOENABLE */ STATE_RENDER(WINED3DRS_MONOENABLE), state_monoenable },
1781 { /* 12, WINED3DRS_ROP2 */ STATE_RENDER(WINED3DRS_ROP2), state_rop2 },
1782 { /* 13, WINED3DRS_PLANEMASK */ STATE_RENDER(WINED3DRS_PLANEMASK), state_planemask },
1783 { /* 14, WINED3DRS_ZWRITEENABLE */ STATE_RENDER(WINED3DRS_ZWRITEENABLE), state_zwritenable },
1784 { /* 15, WINED3DRS_ALPHATESTENABLE */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha },
1785 { /* 16, WINED3DRS_LASTPIXEL */ STATE_RENDER(WINED3DRS_LASTPIXEL), state_lastpixel },
1786 { /* 17, WINED3DRS_TEXTUREMAG */ 0 /* Handled in ddraw */, state_undefined },
1787 { /* 18, WINED3DRS_TEXTUREMIN */ 0 /* Handled in ddraw */, state_undefined },
1788 { /* 19, WINED3DRS_SRCBLEND */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend },
1789 { /* 20, WINED3DRS_DESTBLEND */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend },
1790 { /* 21, WINED3DRS_TEXTUREMAPBLEND */ 0 /* Handled in ddraw */, state_undefined },
1791 { /* 22, WINED3DRS_CULLMODE */ STATE_RENDER(WINED3DRS_CULLMODE), state_cullmode },
1792 { /* 23, WINED3DRS_ZFUNC */ STATE_RENDER(WINED3DRS_ZFUNC), state_zfunc },
1793 { /* 24, WINED3DRS_ALPHAREF */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha },
1794 { /* 25, WINED3DRS_ALPHAFUNC */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha },
1795 { /* 26, WINED3DRS_DITHERENABLE */ STATE_RENDER(WINED3DRS_DITHERENABLE), state_ditherenable },
1796 { /* 27, WINED3DRS_ALPHABLENDENABLE */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend },
1797 { /* 28, WINED3DRS_FOGENABLE */ STATE_RENDER(WINED3DRS_FOGENABLE), state_fog },
1798 { /* 29, WINED3DRS_SPECULARENABLE */ STATE_RENDER(WINED3DRS_SPECULARENABLE), state_specularenable},
1799 { /* 30, WINED3DRS_ZVISIBLE */ 0 /* Not supported according to the msdn */, state_nogl },
1800 { /* 31, WINED3DRS_SUBPIXEL */ STATE_RENDER(WINED3DRS_SUBPIXEL), state_subpixel },
1801 { /* 32, WINED3DRS_SUBPIXELX */ STATE_RENDER(WINED3DRS_SUBPIXELX), state_subpixelx },
1802 { /* 33, WINED3DRS_STIPPLEDALPHA */ STATE_RENDER(WINED3DRS_STIPPLEDALPHA), state_stippledalpha },
1803 { /* 34, WINED3DRS_FOGCOLOR */ STATE_RENDER(WINED3DRS_FOGCOLOR), state_fogcolor },
1804 { /* 35, WINED3DRS_FOGTABLEMODE */ STATE_RENDER(WINED3DRS_FOGENABLE), state_fog },
1805 { /* 36, WINED3DRS_FOGSTART */ STATE_RENDER(WINED3DRS_FOGENABLE), state_fog },
1806 { /* 37, WINED3DRS_FOGEND */ STATE_RENDER(WINED3DRS_FOGENABLE), state_fog },
1807 { /* 38, WINED3DRS_FOGDENSITY */ STATE_RENDER(WINED3DRS_FOGDENSITY), state_fogdensity },
1808 { /* 39, WINED3DRS_STIPPLEENABLE */ STATE_RENDER(WINED3DRS_STIPPLEENABLE), state_stippleenable },
1809 { /* 40, WINED3DRS_EDGEANTIALIAS */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend },
1810 { /* 41, WINED3DRS_COLORKEYENABLE */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha },
1811 { /* 42, undefined */ 0, state_undefined },
1812 { /* 43, WINED3DRS_BORDERCOLOR */ STATE_RENDER(WINED3DRS_BORDERCOLOR), state_bordercolor },
1813 { /* 44, WINED3DRS_TEXTUREADDRESSU */ 0, /* Handled in ddraw */ state_undefined },
1814 { /* 45, WINED3DRS_TEXTUREADDRESSV */ 0, /* Handled in ddraw */ state_undefined },
1815 { /* 46, WINED3DRS_MIPMAPLODBIAS */ STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), state_mipmaplodbias },
1816 { /* 47, WINED3DRS_ZBIAS */ STATE_RENDER(WINED3DRS_ZBIAS), state_zbias },
1817 { /* 48, WINED3DRS_RANGEFOGENABLE */ 0, state_nogl },
1818 { /* 49, WINED3DRS_ANISOTROPY */ STATE_RENDER(WINED3DRS_ANISOTROPY), state_anisotropy },
1819 { /* 50, WINED3DRS_FLUSHBATCH */ STATE_RENDER(WINED3DRS_FLUSHBATCH), state_flushbatch },
1820 { /* 51, WINED3DRS_TRANSLUCENTSORTINDEPENDENT */ STATE_RENDER(WINED3DRS_TRANSLUCENTSORTINDEPENDENT), state_translucentsi },
1821 { /* 52, WINED3DRS_STENCILENABLE */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1822 { /* 53, WINED3DRS_STENCILFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1823 { /* 54, WINED3DRS_STENCILZFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1824 { /* 55, WINED3DRS_STENCILPASS */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1825 { /* 56, WINED3DRS_STENCILFUNC */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1826 { /* 57, WINED3DRS_STENCILREF */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1827 { /* 58, WINED3DRS_STENCILMASK */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1828 { /* 59, WINED3DRS_STENCILWRITEMASK */ STATE_RENDER(WINED3DRS_STENCILWRITEMASK), state_stencilwrite },
1829 { /* 60, WINED3DRS_TEXTUREFACTOR */ STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_texfactor },
1830 { /* 61, Undefined */ 0, state_undefined },
1831 { /* 62, Undefined */ 0, state_undefined },
1832 { /* 63, Undefined */ 0, state_undefined },
1833 { /* 64, WINED3DRS_STIPPLEPATTERN00 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1834 { /* 65, WINED3DRS_STIPPLEPATTERN01 */ 0 /* Obsolete, should he handled by ddraw */, state_undefined },
1835 { /* 66, WINED3DRS_STIPPLEPATTERN02 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1836 { /* 67, WINED3DRS_STIPPLEPATTERN03 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1837 { /* 68, WINED3DRS_STIPPLEPATTERN04 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1838 { /* 69, WINED3DRS_STIPPLEPATTERN05 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1839 { /* 70, WINED3DRS_STIPPLEPATTERN06 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1840 { /* 71, WINED3DRS_STIPPLEPATTERN07 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1841 { /* 72, WINED3DRS_STIPPLEPATTERN08 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1842 { /* 73, WINED3DRS_STIPPLEPATTERN09 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1843 { /* 74, WINED3DRS_STIPPLEPATTERN10 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1844 { /* 75, WINED3DRS_STIPPLEPATTERN11 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1845 { /* 76, WINED3DRS_STIPPLEPATTERN12 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1846 { /* 77, WINED3DRS_STIPPLEPATTERN13 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1847 { /* 78, WINED3DRS_STIPPLEPATTERN14 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1848 { /* 79, WINED3DRS_STIPPLEPATTERN15 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1849 { /* 80, WINED3DRS_STIPPLEPATTERN16 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1850 { /* 81, WINED3DRS_STIPPLEPATTERN17 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1851 { /* 82, WINED3DRS_STIPPLEPATTERN18 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1852 { /* 83, WINED3DRS_STIPPLEPATTERN19 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1853 { /* 84, WINED3DRS_STIPPLEPATTERN20 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1854 { /* 85, WINED3DRS_STIPPLEPATTERN21 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1855 { /* 86, WINED3DRS_STIPPLEPATTERN22 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1856 { /* 87, WINED3DRS_STIPPLEPATTERN23 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1857 { /* 88, WINED3DRS_STIPPLEPATTERN24 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1858 { /* 89, WINED3DRS_STIPPLEPATTERN25 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1859 { /* 90, WINED3DRS_STIPPLEPATTERN26 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1860 { /* 91, WINED3DRS_STIPPLEPATTERN27 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1861 { /* 92, WINED3DRS_STIPPLEPATTERN28 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1862 { /* 93, WINED3DRS_STIPPLEPATTERN29 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1863 { /* 94, WINED3DRS_STIPPLEPATTERN30 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1864 { /* 95, WINED3DRS_STIPPLEPATTERN31 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined },
1865 { /* 96, Undefined */ 0, state_undefined },
1866 { /* 97, Undefined */ 0, state_undefined },
1867 { /* 98, Undefined */ 0, state_undefined },
1868 { /* 99, Undefined */ 0, state_undefined },
1869 { /*100, Undefined */ 0, state_undefined },
1870 { /*101, Undefined */ 0, state_undefined },
1871 { /*102, Undefined */ 0, state_undefined },
1872 { /*103, Undefined */ 0, state_undefined },
1873 { /*104, Undefined */ 0, state_undefined },
1874 { /*105, Undefined */ 0, state_undefined },
1875 { /*106, Undefined */ 0, state_undefined },
1876 { /*107, Undefined */ 0, state_undefined },
1877 { /*108, Undefined */ 0, state_undefined },
1878 { /*109, Undefined */ 0, state_undefined },
1879 { /*110, Undefined */ 0, state_undefined },
1880 { /*111, Undefined */ 0, state_undefined },
1881 { /*112, Undefined */ 0, state_undefined },
1882 { /*113, Undefined */ 0, state_undefined },
1883 { /*114, Undefined */ 0, state_undefined },
1884 { /*115, Undefined */ 0, state_undefined },
1885 { /*116, Undefined */ 0, state_undefined },
1886 { /*117, Undefined */ 0, state_undefined },
1887 { /*118, Undefined */ 0, state_undefined },
1888 { /*119, Undefined */ 0, state_undefined },
1889 { /*120, Undefined */ 0, state_undefined },
1890 { /*121, Undefined */ 0, state_undefined },
1891 { /*122, Undefined */ 0, state_undefined },
1892 { /*123, Undefined */ 0, state_undefined },
1893 { /*124, Undefined */ 0, state_undefined },
1894 { /*125, Undefined */ 0, state_undefined },
1895 { /*126, Undefined */ 0, state_undefined },
1896 { /*127, Undefined */ 0, state_undefined },
1898 { /*128, WINED3DRS_WRAP0 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1899 { /*129, WINED3DRS_WRAP1 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1900 { /*130, WINED3DRS_WRAP2 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1901 { /*131, WINED3DRS_WRAP3 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1902 { /*132, WINED3DRS_WRAP4 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1903 { /*133, WINED3DRS_WRAP5 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1904 { /*134, WINED3DRS_WRAP6 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1905 { /*135, WINED3DRS_WRAP7 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1906 { /*136, WINED3DRS_CLIPPING */ STATE_RENDER(WINED3DRS_CLIPPING), state_clipping },
1907 { /*137, WINED3DRS_LIGHTING */ STATE_RENDER(WINED3DRS_LIGHTING) /* Vertex decl! */,state_lighting },
1908 { /*138, WINED3DRS_EXTENTS */ STATE_RENDER(WINED3DRS_EXTENTS), state_extents },
1909 { /*139, WINED3DRS_AMBIENT */ STATE_RENDER(WINED3DRS_AMBIENT), state_ambient },
1910 { /*140, WINED3DRS_FOGVERTEXMODE */ STATE_RENDER(WINED3DRS_FOGENABLE), state_fog },
1911 { /*141, WINED3DRS_COLORVERTEX */ STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat },
1912 { /*142, WINED3DRS_LOCALVIEWER */ STATE_RENDER(WINED3DRS_LOCALVIEWER), state_localviewer },
1913 { /*143, WINED3DRS_NORMALIZENORMALS */ STATE_RENDER(WINED3DRS_NORMALIZENORMALS), state_normalize },
1914 { /*144, WINED3DRS_COLORKEYBLENDENABLE */ STATE_RENDER(WINED3DRS_COLORKEYBLENDENABLE), state_ckeyblend },
1915 { /*145, WINED3DRS_DIFFUSEMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat },
1916 { /*146, WINED3DRS_SPECULARMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat },
1917 { /*147, WINED3DRS_AMBIENTMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat },
1918 { /*148, WINED3DRS_EMISSIVEMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat },
1919 { /*149, Undefined */ 0, state_undefined },
1920 { /*150, Undefined */ 0, state_undefined },
1921 { /*151, WINED3DRS_VERTEXBLEND */ 0, state_nogl },
1922 { /*152, WINED3DRS_CLIPPLANEENABLE */ STATE_RENDER(WINED3DRS_CLIPPING), state_clipping },
1923 { /*153, WINED3DRS_SOFTWAREVERTEXPROCESSING */ 0, state_nogl },
1924 { /*154, WINED3DRS_POINTSIZE */ STATE_RENDER(WINED3DRS_POINTSIZE), state_psize },
1925 { /*155, WINED3DRS_POINTSIZE_MIN */ STATE_RENDER(WINED3DRS_POINTSIZE_MIN), state_psizemin },
1926 { /*156, WINED3DRS_POINTSPRITEENABLE */ STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), state_pointsprite },
1927 { /*157, WINED3DRS_POINTSCALEENABLE */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale },
1928 { /*158, WINED3DRS_POINTSCALE_A */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale },
1929 { /*159, WINED3DRS_POINTSCALE_B */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale },
1930 { /*160, WINED3DRS_POINTSCALE_C */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale },
1931 { /*161, WINED3DRS_MULTISAMPLEANTIALIAS */ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_multisampleaa },
1932 { /*162, WINED3DRS_MULTISAMPLEMASK */ STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), state_multisampmask },
1933 { /*163, WINED3DRS_PATCHEDGESTYLE */ STATE_RENDER(WINED3DRS_PATCHEDGESTYLE), state_patchedgestyle},
1934 { /*164, WINED3DRS_PATCHSEGMENTS */ STATE_RENDER(WINED3DRS_PATCHSEGMENTS), state_patchsegments },
1935 { /*165, WINED3DRS_DEBUGMONITORTOKEN */ STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN), state_nogl },
1936 { /*166, WINED3DRS_POINTSIZE_MAX */ STATE_RENDER(WINED3DRS_POINTSIZE_MAX), state_psizemax },
1937 { /*167, WINED3DRS_INDEXEDVERTEXBLENDENABLE */ 0, state_nogl },
1938 { /*168, WINED3DRS_COLORWRITEENABLE */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite },
1939 { /*169, Undefined */ 0, state_undefined },
1940 { /*170, WINED3DRS_TWEENFACTOR */ 0, state_nogl },
1941 { /*171, WINED3DRS_BLENDOP */ STATE_RENDER(WINED3DRS_BLENDOP), state_blendop },
1942 { /*172, WINED3DRS_POSITIONDEGREE */ STATE_RENDER(WINED3DRS_POSITIONDEGREE), state_positiondegree},
1943 { /*173, WINED3DRS_NORMALDEGREE */ STATE_RENDER(WINED3DRS_NORMALDEGREE), state_normaldegree },
1944 /*172, WINED3DRS_POSITIONORDER */ /* Value assigned to 2 state names */
1945 /*173, WINED3DRS_NORMALORDER */ /* Value assigned to 2 state names */
1946 { /*174, WINED3DRS_SCISSORTESTENABLE */ STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), state_scissor },
1947 { /*175, WINED3DRS_SLOPESCALEDEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias },
1948 { /*176, WINED3DRS_ANTIALIASEDLINEENABLE */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend },
1949 { /*177, undefined */ 0, state_undefined },
1950 { /*178, WINED3DRS_MINTESSELLATIONLEVEL */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation },
1951 { /*179, WINED3DRS_MAXTESSELLATIONLEVEL */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation },
1952 { /*180, WINED3DRS_ADAPTIVETESS_X */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation },
1953 { /*181, WINED3DRS_ADAPTIVETESS_Y */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation },
1954 { /*182, WINED3DRS_ADAPTIVETESS_Z */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation },
1955 { /*183, WINED3DRS_ADAPTIVETESS_W */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation },
1956 { /*184, WINED3DRS_ENABLEADAPTIVETESSELLATION */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation },
1957 { /*185, WINED3DRS_TWOSIDEDSTENCILMODE */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1958 { /*186, WINED3DRS_CCW_STENCILFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1959 { /*187, WINED3DRS_CCW_STENCILZFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1960 { /*188, WINED3DRS_CCW_STENCILPASS */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1961 { /*189, WINED3DRS_CCW_STENCILFUNC */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil },
1962 { /*190, WINED3DRS_COLORWRITEENABLE1 */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite },
1963 { /*191, WINED3DRS_COLORWRITEENABLE2 */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite },
1964 { /*192, WINED3DRS_COLORWRITEENABLE3 */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite },
1965 { /*193, WINED3DRS_BLENDFACTOR */ STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor },
1966 { /*194, WINED3DRS_SRGBWRITEENABLE */ STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), state_srgbwrite },
1967 { /*195, WINED3DRS_DEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias },
1968 { /*196, undefined */ 0, state_undefined },
1969 { /*197, undefined */ 0, state_undefined },
1970 { /*198, WINED3DRS_WRAP8 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1971 { /*199, WINED3DRS_WRAP9 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1972 { /*200, WINED3DRS_WRAP10 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1973 { /*201, WINED3DRS_WRAP11 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1974 { /*202, WINED3DRS_WRAP12 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1975 { /*203, WINED3DRS_WRAP13 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1976 { /*204, WINED3DRS_WRAP14 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1977 { /*205, WINED3DRS_WRAP15 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },
1978 { /*206, WINED3DRS_SEPARATEALPHABLENDENABLE */ STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE), state_seperateblend },
1979 { /*207, WINED3DRS_SRCBLENDALPHA */ STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE), state_seperateblend },
1980 { /*208, WINED3DRS_DESTBLENDALPHA */ STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE), state_seperateblend },
1981 { /*209, WINED3DRS_BLENDOPALPHA */ STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE), state_seperateblend },
1982 /* Texture stage states */
1983 { /*0, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
1984 { /*0, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
1985 { /*0, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
1986 { /*0, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop },
1987 { /*0, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop },
1988 { /*0, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop },
1989 { /*0, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
1990 { /*0, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
1991 { /*0, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
1992 { /*0, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
1993 { /*0, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(0, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
1994 { /*0, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
1995 { /*0, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
1996 { /*0, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
1997 { /*0, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
1998 { /*0, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
1999 { /*0, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2000 { /*0, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2001 { /*0, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2002 { /*0, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2003 { /*0, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2004 { /*0, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2005 { /*0, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2006 { /*0, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2007 { /*0, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2008 { /*0, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop },
2009 { /*0, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop },
2010 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(0, WINED3DTSS_RESULTARG), tex_resultarg },
2011 { /*0, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2012 { /*0, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2013 { /*0, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2014 { /*0, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2016 { /*1, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2017 { /*1, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2018 { /*1, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2019 { /*1, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop },
2020 { /*1, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop },
2021 { /*1, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop },
2022 { /*1, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2023 { /*1, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2024 { /*1, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2025 { /*1, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2026 { /*1, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(1, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
2027 { /*1, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2028 { /*1, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2029 { /*1, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2030 { /*1, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2031 { /*1, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2032 { /*1, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2033 { /*1, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2034 { /*1, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2035 { /*1, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2036 { /*1, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2037 { /*1, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2038 { /*1, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2039 { /*1, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2040 { /*1, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2041 { /*1, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop },
2042 { /*1, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop },
2043 { /*1, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(1, WINED3DTSS_RESULTARG), tex_resultarg },
2044 { /*1, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2045 { /*1, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2046 { /*1, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2047 { /*1, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2049 { /*2, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2050 { /*2, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2051 { /*2, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2052 { /*2, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop },
2053 { /*2, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop },
2054 { /*2, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop },
2055 { /*2, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2056 { /*2, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2057 { /*2, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2058 { /*2, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2059 { /*2, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(2, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
2060 { /*2, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2061 { /*2, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2062 { /*2, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2063 { /*2, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2064 { /*2, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2065 { /*2, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2066 { /*2, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2067 { /*2, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2068 { /*2, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2069 { /*2, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2070 { /*2, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2071 { /*2, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2072 { /*2, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2073 { /*2, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2074 { /*2, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop },
2075 { /*2, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop },
2076 { /*2, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(2, WINED3DTSS_RESULTARG), tex_resultarg },
2077 { /*2, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2078 { /*2, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2079 { /*2, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2080 { /*2, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2082 { /*3, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2083 { /*3, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2084 { /*3, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2085 { /*3, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop },
2086 { /*3, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop },
2087 { /*3, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop },
2088 { /*3, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2089 { /*3, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2090 { /*3, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2091 { /*3, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2092 { /*3, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(3, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
2093 { /*3, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2094 { /*3, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2095 { /*3, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2096 { /*3, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2097 { /*3, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2098 { /*3, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2099 { /*3, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2100 { /*3, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2101 { /*3, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2102 { /*3, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2103 { /*3, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2104 { /*3, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2105 { /*3, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2106 { /*3, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2107 { /*3, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop },
2108 { /*3, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop },
2109 { /*3, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(3, WINED3DTSS_RESULTARG), tex_resultarg },
2110 { /*3, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2111 { /*3, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2112 { /*3, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2113 { /*3, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2115 { /*4, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop },
2116 { /*4, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop },
2117 { /*4, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop },
2118 { /*4, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop },
2119 { /*4, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop },
2120 { /*4, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop },
2121 { /*4, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), state_undefined },
2122 { /*4, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), state_undefined },
2123 { /*4, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), state_undefined },
2124 { /*4, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), state_undefined },
2125 { /*4, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(4, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
2126 { /*4, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2127 { /*4, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2128 { /*4, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2129 { /*4, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2130 { /*4, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2131 { /*4, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2132 { /*4, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2133 { /*4, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2134 { /*4, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2135 { /*4, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2136 { /*4, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2137 { /*4, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2138 { /*4, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2139 { /*4, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2140 { /*4, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop },
2141 { /*4, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop },
2142 { /*4, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(4, WINED3DTSS_RESULTARG), tex_resultarg },
2143 { /*4, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2144 { /*4, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2145 { /*4, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2146 { /*4, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2148 { /*5, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2149 { /*5, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2150 { /*5, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2151 { /*5, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop },
2152 { /*5, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop },
2153 { /*5, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop },
2154 { /*5, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2155 { /*5, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2156 { /*5, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2157 { /*5, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2158 { /*5, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(5, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
2159 { /*5, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2160 { /*5, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2161 { /*5, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2162 { /*5, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2163 { /*5, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2164 { /*5, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2165 { /*5, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2166 { /*5, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2167 { /*5, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2168 { /*5, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2169 { /*5, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2170 { /*5, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2171 { /*5, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2172 { /*5, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2173 { /*5, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop },
2174 { /*5, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop },
2175 { /*5, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(5, WINED3DTSS_RESULTARG), tex_resultarg },
2176 { /*5, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2177 { /*5, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2178 { /*5, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2179 { /*5, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2181 { /*6, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2182 { /*6, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2183 { /*6, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2184 { /*6, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop },
2185 { /*6, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop },
2186 { /*6, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop },
2187 { /*6, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2188 { /*6, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2189 { /*6, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2190 { /*6, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2191 { /*6, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(6, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
2192 { /*6, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2193 { /*6, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2194 { /*6, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2195 { /*6, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2196 { /*6, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2197 { /*6, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2198 { /*6, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2199 { /*6, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2200 { /*6, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2201 { /*6, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2202 { /*6, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2203 { /*6, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2204 { /*6, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2205 { /*6, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2206 { /*6, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop },
2207 { /*6, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop },
2208 { /*6, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(6, WINED3DTSS_RESULTARG), tex_resultarg },
2209 { /*6, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2210 { /*6, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2211 { /*6, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2212 { /*6, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2214 { /*7, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2215 { /*7, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2216 { /*7, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2217 { /*7, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop },
2218 { /*7, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop },
2219 { /*7, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop },
2220 { /*7, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2221 { /*7, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2222 { /*7, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2223 { /*7, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2224 { /*7, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(7, WINED3DTSS_TEXCOORDINDEX), tex_coordindex },
2225 { /*7, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2226 { /*7, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2227 { /*7, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2228 { /*7, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2229 { /*7, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2230 { /*7, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2231 { /*7, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2232 { /*7, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2233 { /*7, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2234 { /*7, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2235 { /*7, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale },
2236 { /*7, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLOFFSET), tex_bumpenvloffset },
2237 { /*7, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ 0 /* for now, later stream sources */, state_nogl },
2238 { /*7, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2239 { /*7, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop },
2240 { /*7, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop },
2241 { /*7, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(7, WINED3DTSS_RESULTARG), tex_resultarg },
2242 { /*7, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2243 { /*7, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2244 { /*7, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined },
2245 { /*7, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl },
2246 /* Sampler states */
2247 { /* 0, Sampler 0 */ STATE_SAMPLER(0), sampler },
2248 { /* 1, Sampler 1 */ STATE_SAMPLER(1), sampler },
2249 { /* 2, Sampler 2 */ STATE_SAMPLER(2), sampler },
2250 { /* 3, Sampler 3 */ STATE_SAMPLER(3), sampler },
2251 { /* 4, Sampler 3 */ STATE_SAMPLER(4), sampler },
2252 { /* 5, Sampler 5 */ STATE_SAMPLER(5), sampler },
2253 { /* 6, Sampler 6 */ STATE_SAMPLER(6), sampler },
2254 { /* 7, Sampler 7 */ STATE_SAMPLER(7), sampler },
2255 { /* 8, Sampler 8 */ STATE_SAMPLER(8), sampler },
2256 { /* 9, Sampler 9 */ STATE_SAMPLER(9), sampler },
2257 { /*10, Sampler 10 */ STATE_SAMPLER(10), sampler },
2258 { /*11, Sampler 11 */ STATE_SAMPLER(11), sampler },
2259 { /*12, Sampler 12 */ STATE_SAMPLER(12), sampler },
2260 { /*13, Sampler 13 */ STATE_SAMPLER(13), sampler },
2261 { /*14, Sampler 14 */ STATE_SAMPLER(14), sampler },
2262 { /*15, Sampler 15 */ STATE_SAMPLER(15), sampler },
2264 { /* , Pixel Shader */ STATE_PIXELSHADER, pixelshader },
2265 /* Transform states follow */
2266 { /* 1, undefined */ 0, state_undefined },
2267 { /* 2, WINED3DTS_VIEW */ STATE_TRANSFORM(WINED3DTS_VIEW), state_undefined },
2268 { /* 3, WINED3DTS_PROJECTION */ STATE_TRANSFORM(WINED3DTS_PROJECTION), state_undefined },
2269 { /* 4, undefined */ 0, state_undefined },
2270 { /* 5, undefined */ 0, state_undefined },
2271 { /* 6, undefined */ 0, state_undefined },
2272 { /* 7, undefined */ 0, state_undefined },
2273 { /* 8, undefined */ 0, state_undefined },
2274 { /* 9, undefined */ 0, state_undefined },
2275 { /* 10, undefined */ 0, state_undefined },
2276 { /* 11, undefined */ 0, state_undefined },
2277 { /* 12, undefined */ 0, state_undefined },
2278 { /* 13, undefined */ 0, state_undefined },
2279 { /* 14, undefined */ 0, state_undefined },
2280 { /* 15, undefined */ 0, state_undefined },
2281 { /* 16, WINED3DTS_TEXTURE0 */ STATE_TRANSFORM(WINED3DTS_TEXTURE0), state_undefined },
2282 { /* 17, WINED3DTS_TEXTURE1 */ STATE_TRANSFORM(WINED3DTS_TEXTURE1), state_undefined },
2283 { /* 18, WINED3DTS_TEXTURE2 */ STATE_TRANSFORM(WINED3DTS_TEXTURE2), state_undefined },
2284 { /* 19, WINED3DTS_TEXTURE3 */ STATE_TRANSFORM(WINED3DTS_TEXTURE3), state_undefined },
2285 { /* 20, WINED3DTS_TEXTURE4 */ STATE_TRANSFORM(WINED3DTS_TEXTURE4), state_undefined },
2286 { /* 21, WINED3DTS_TEXTURE5 */ STATE_TRANSFORM(WINED3DTS_TEXTURE5), state_undefined },
2287 { /* 22, WINED3DTS_TEXTURE6 */ STATE_TRANSFORM(WINED3DTS_TEXTURE6), state_undefined },
2288 { /* 23, WINED3DTS_TEXTURE7 */ STATE_TRANSFORM(WINED3DTS_TEXTURE7), state_undefined },
2289 /* A huge gap between TEXTURE7 and WORLDMATRIX(0) :-( But entries are needed to catch then if a broken app sets them */
2290 { /* 24, undefined */ 0, state_undefined },
2291 { /* 25, undefined */ 0, state_undefined },
2292 { /* 26, undefined */ 0, state_undefined },
2293 { /* 27, undefined */ 0, state_undefined },
2294 { /* 28, undefined */ 0, state_undefined },
2295 { /* 29, undefined */ 0, state_undefined },
2296 { /* 30, undefined */ 0, state_undefined },
2297 { /* 31, undefined */ 0, state_undefined },
2298 { /* 32, undefined */ 0, state_undefined },
2299 { /* 33, undefined */ 0, state_undefined },
2300 { /* 34, undefined */ 0, state_undefined },
2301 { /* 35, undefined */ 0, state_undefined },
2302 { /* 36, undefined */ 0, state_undefined },
2303 { /* 37, undefined */ 0, state_undefined },
2304 { /* 38, undefined */ 0, state_undefined },
2305 { /* 39, undefined */ 0, state_undefined },
2306 { /* 40, undefined */ 0, state_undefined },
2307 { /* 41, undefined */ 0, state_undefined },
2308 { /* 42, undefined */ 0, state_undefined },
2309 { /* 43, undefined */ 0, state_undefined },
2310 { /* 44, undefined */ 0, state_undefined },
2311 { /* 45, undefined */ 0, state_undefined },
2312 { /* 46, undefined */ 0, state_undefined },
2313 { /* 47, undefined */ 0, state_undefined },
2314 { /* 48, undefined */ 0, state_undefined },
2315 { /* 49, undefined */ 0, state_undefined },
2316 { /* 50, undefined */ 0, state_undefined },
2317 { /* 51, undefined */ 0, state_undefined },
2318 { /* 52, undefined */ 0, state_undefined },
2319 { /* 53, undefined */ 0, state_undefined },
2320 { /* 54, undefined */ 0, state_undefined },
2321 { /* 55, undefined */ 0, state_undefined },
2322 { /* 56, undefined */ 0, state_undefined },
2323 { /* 57, undefined */ 0, state_undefined },
2324 { /* 58, undefined */ 0, state_undefined },
2325 { /* 59, undefined */ 0, state_undefined },
2326 { /* 60, undefined */ 0, state_undefined },
2327 { /* 61, undefined */ 0, state_undefined },
2328 { /* 62, undefined */ 0, state_undefined },
2329 { /* 63, undefined */ 0, state_undefined },
2330 { /* 64, undefined */ 0, state_undefined },
2331 { /* 65, undefined */ 0, state_undefined },
2332 { /* 66, undefined */ 0, state_undefined },
2333 { /* 67, undefined */ 0, state_undefined },
2334 { /* 68, undefined */ 0, state_undefined },
2335 { /* 69, undefined */ 0, state_undefined },
2336 { /* 70, undefined */ 0, state_undefined },
2337 { /* 71, undefined */ 0, state_undefined },
2338 { /* 72, undefined */ 0, state_undefined },
2339 { /* 73, undefined */ 0, state_undefined },
2340 { /* 74, undefined */ 0, state_undefined },
2341 { /* 75, undefined */ 0, state_undefined },
2342 { /* 76, undefined */ 0, state_undefined },
2343 { /* 77, undefined */ 0, state_undefined },
2344 { /* 78, undefined */ 0, state_undefined },
2345 { /* 79, undefined */ 0, state_undefined },
2346 { /* 80, undefined */ 0, state_undefined },
2347 { /* 81, undefined */ 0, state_undefined },
2348 { /* 82, undefined */ 0, state_undefined },
2349 { /* 83, undefined */ 0, state_undefined },
2350 { /* 84, undefined */ 0, state_undefined },
2351 { /* 85, undefined */ 0, state_undefined },
2352 { /* 86, undefined */ 0, state_undefined },
2353 { /* 87, undefined */ 0, state_undefined },
2354 { /* 88, undefined */ 0, state_undefined },
2355 { /* 89, undefined */ 0, state_undefined },
2356 { /* 90, undefined */ 0, state_undefined },
2357 { /* 91, undefined */ 0, state_undefined },
2358 { /* 92, undefined */ 0, state_undefined },
2359 { /* 93, undefined */ 0, state_undefined },
2360 { /* 94, undefined */ 0, state_undefined },
2361 { /* 95, undefined */ 0, state_undefined },
2362 { /* 96, undefined */ 0, state_undefined },
2363 { /* 97, undefined */ 0, state_undefined },
2364 { /* 98, undefined */ 0, state_undefined },
2365 { /* 99, undefined */ 0, state_undefined },
2366 { /*100, undefined */ 0, state_undefined },
2367 { /*101, undefined */ 0, state_undefined },
2368 { /*102, undefined */ 0, state_undefined },
2369 { /*103, undefined */ 0, state_undefined },
2370 { /*104, undefined */ 0, state_undefined },
2371 { /*105, undefined */ 0, state_undefined },
2372 { /*106, undefined */ 0, state_undefined },
2373 { /*107, undefined */ 0, state_undefined },
2374 { /*108, undefined */ 0, state_undefined },
2375 { /*109, undefined */ 0, state_undefined },
2376 { /*110, undefined */ 0, state_undefined },
2377 { /*111, undefined */ 0, state_undefined },
2378 { /*112, undefined */ 0, state_undefined },
2379 { /*113, undefined */ 0, state_undefined },
2380 { /*114, undefined */ 0, state_undefined },
2381 { /*115, undefined */ 0, state_undefined },
2382 { /*116, undefined */ 0, state_undefined },
2383 { /*117, undefined */ 0, state_undefined },
2384 { /*118, undefined */ 0, state_undefined },
2385 { /*119, undefined */ 0, state_undefined },
2386 { /*120, undefined */ 0, state_undefined },
2387 { /*121, undefined */ 0, state_undefined },
2388 { /*122, undefined */ 0, state_undefined },
2389 { /*123, undefined */ 0, state_undefined },
2390 { /*124, undefined */ 0, state_undefined },
2391 { /*125, undefined */ 0, state_undefined },
2392 { /*126, undefined */ 0, state_undefined },
2393 { /*127, undefined */ 0, state_undefined },
2394 { /*128, undefined */ 0, state_undefined },
2395 { /*129, undefined */ 0, state_undefined },
2396 { /*130, undefined */ 0, state_undefined },
2397 { /*131, undefined */ 0, state_undefined },
2398 { /*132, undefined */ 0, state_undefined },
2399 { /*133, undefined */ 0, state_undefined },
2400 { /*134, undefined */ 0, state_undefined },
2401 { /*135, undefined */ 0, state_undefined },
2402 { /*136, undefined */ 0, state_undefined },
2403 { /*137, undefined */ 0, state_undefined },
2404 { /*138, undefined */ 0, state_undefined },
2405 { /*139, undefined */ 0, state_undefined },
2406 { /*140, undefined */ 0, state_undefined },
2407 { /*141, undefined */ 0, state_undefined },
2408 { /*142, undefined */ 0, state_undefined },
2409 { /*143, undefined */ 0, state_undefined },
2410 { /*144, undefined */ 0, state_undefined },
2411 { /*145, undefined */ 0, state_undefined },
2412 { /*146, undefined */ 0, state_undefined },
2413 { /*147, undefined */ 0, state_undefined },
2414 { /*148, undefined */ 0, state_undefined },
2415 { /*149, undefined */ 0, state_undefined },
2416 { /*150, undefined */ 0, state_undefined },
2417 { /*151, undefined */ 0, state_undefined },
2418 { /*152, undefined */ 0, state_undefined },
2419 { /*153, undefined */ 0, state_undefined },
2420 { /*154, undefined */ 0, state_undefined },
2421 { /*155, undefined */ 0, state_undefined },
2422 { /*156, undefined */ 0, state_undefined },
2423 { /*157, undefined */ 0, state_undefined },
2424 { /*158, undefined */ 0, state_undefined },
2425 { /*159, undefined */ 0, state_undefined },
2426 { /*160, undefined */ 0, state_undefined },
2427 { /*161, undefined */ 0, state_undefined },
2428 { /*162, undefined */ 0, state_undefined },
2429 { /*163, undefined */ 0, state_undefined },
2430 { /*164, undefined */ 0, state_undefined },
2431 { /*165, undefined */ 0, state_undefined },
2432 { /*166, undefined */ 0, state_undefined },
2433 { /*167, undefined */ 0, state_undefined },
2434 { /*168, undefined */ 0, state_undefined },
2435 { /*169, undefined */ 0, state_undefined },
2436 { /*170, undefined */ 0, state_undefined },
2437 { /*171, undefined */ 0, state_undefined },
2438 { /*172, undefined */ 0, state_undefined },
2439 { /*173, undefined */ 0, state_undefined },
2440 { /*174, undefined */ 0, state_undefined },
2441 { /*175, undefined */ 0, state_undefined },
2442 { /*176, undefined */ 0, state_undefined },
2443 { /*177, undefined */ 0, state_undefined },
2444 { /*178, undefined */ 0, state_undefined },
2445 { /*179, undefined */ 0, state_undefined },
2446 { /*180, undefined */ 0, state_undefined },
2447 { /*181, undefined */ 0, state_undefined },
2448 { /*182, undefined */ 0, state_undefined },
2449 { /*183, undefined */ 0, state_undefined },
2450 { /*184, undefined */ 0, state_undefined },
2451 { /*185, undefined */ 0, state_undefined },
2452 { /*186, undefined */ 0, state_undefined },
2453 { /*187, undefined */ 0, state_undefined },
2454 { /*188, undefined */ 0, state_undefined },
2455 { /*189, undefined */ 0, state_undefined },
2456 { /*190, undefined */ 0, state_undefined },
2457 { /*191, undefined */ 0, state_undefined },
2458 { /*192, undefined */ 0, state_undefined },
2459 { /*193, undefined */ 0, state_undefined },
2460 { /*194, undefined */ 0, state_undefined },
2461 { /*195, undefined */ 0, state_undefined },
2462 { /*196, undefined */ 0, state_undefined },
2463 { /*197, undefined */ 0, state_undefined },
2464 { /*198, undefined */ 0, state_undefined },
2465 { /*199, undefined */ 0, state_undefined },
2466 { /*200, undefined */ 0, state_undefined },
2467 { /*201, undefined */ 0, state_undefined },
2468 { /*202, undefined */ 0, state_undefined },
2469 { /*203, undefined */ 0, state_undefined },
2470 { /*204, undefined */ 0, state_undefined },
2471 { /*205, undefined */ 0, state_undefined },
2472 { /*206, undefined */ 0, state_undefined },
2473 { /*207, undefined */ 0, state_undefined },
2474 { /*208, undefined */ 0, state_undefined },
2475 { /*209, undefined */ 0, state_undefined },
2476 { /*210, undefined */ 0, state_undefined },
2477 { /*211, undefined */ 0, state_undefined },
2478 { /*212, undefined */ 0, state_undefined },
2479 { /*213, undefined */ 0, state_undefined },
2480 { /*214, undefined */ 0, state_undefined },
2481 { /*215, undefined */ 0, state_undefined },
2482 { /*216, undefined */ 0, state_undefined },
2483 { /*217, undefined */ 0, state_undefined },
2484 { /*218, undefined */ 0, state_undefined },
2485 { /*219, undefined */ 0, state_undefined },
2486 { /*220, undefined */ 0, state_undefined },
2487 { /*221, undefined */ 0, state_undefined },
2488 { /*222, undefined */ 0, state_undefined },
2489 { /*223, undefined */ 0, state_undefined },
2490 { /*224, undefined */ 0, state_undefined },
2491 { /*225, undefined */ 0, state_undefined },
2492 { /*226, undefined */ 0, state_undefined },
2493 { /*227, undefined */ 0, state_undefined },
2494 { /*228, undefined */ 0, state_undefined },
2495 { /*229, undefined */ 0, state_undefined },
2496 { /*230, undefined */ 0, state_undefined },
2497 { /*231, undefined */ 0, state_undefined },
2498 { /*232, undefined */ 0, state_undefined },
2499 { /*233, undefined */ 0, state_undefined },
2500 { /*234, undefined */ 0, state_undefined },
2501 { /*235, undefined */ 0, state_undefined },
2502 { /*236, undefined */ 0, state_undefined },
2503 { /*237, undefined */ 0, state_undefined },
2504 { /*238, undefined */ 0, state_undefined },
2505 { /*239, undefined */ 0, state_undefined },
2506 { /*240, undefined */ 0, state_undefined },
2507 { /*241, undefined */ 0, state_undefined },
2508 { /*242, undefined */ 0, state_undefined },
2509 { /*243, undefined */ 0, state_undefined },
2510 { /*244, undefined */ 0, state_undefined },
2511 { /*245, undefined */ 0, state_undefined },
2512 { /*246, undefined */ 0, state_undefined },
2513 { /*247, undefined */ 0, state_undefined },
2514 { /*248, undefined */ 0, state_undefined },
2515 { /*249, undefined */ 0, state_undefined },
2516 { /*250, undefined */ 0, state_undefined },
2517 { /*251, undefined */ 0, state_undefined },
2518 { /*252, undefined */ 0, state_undefined },
2519 { /*253, undefined */ 0, state_undefined },
2520 { /*254, undefined */ 0, state_undefined },
2521 { /*255, undefined */ 0, state_undefined },
2523 { /*256, WINED3DTS_WORLDMATRIX(0) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), state_undefined },
2524 { /*257, WINED3DTS_WORLDMATRIX(1) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(1)), state_undefined },
2525 { /*258, WINED3DTS_WORLDMATRIX(2) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(2)), state_undefined },
2526 { /*259, WINED3DTS_WORLDMATRIX(3) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(3)), state_undefined },
2527 { /*260, WINED3DTS_WORLDMATRIX(4) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(4)), state_undefined },
2528 { /*261, WINED3DTS_WORLDMATRIX(5) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(5)), state_undefined },
2529 { /*262, WINED3DTS_WORLDMATRIX(6) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(6)), state_undefined },
2530 { /*263, WINED3DTS_WORLDMATRIX(7) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(7)), state_undefined },
2531 { /*264, WINED3DTS_WORLDMATRIX(8) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(8)), state_undefined },
2532 { /*265, WINED3DTS_WORLDMATRIX(9) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(9)), state_undefined },
2533 { /*266, WINED3DTS_WORLDMATRIX(10) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(10)), state_undefined },
2534 { /*267, WINED3DTS_WORLDMATRIX(11) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(11)), state_undefined },
2535 { /*268, WINED3DTS_WORLDMATRIX(12) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(12)), state_undefined },
2536 { /*269, WINED3DTS_WORLDMATRIX(13) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(13)), state_undefined },
2537 { /*270, WINED3DTS_WORLDMATRIX(14) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(14)), state_undefined },
2538 { /*271, WINED3DTS_WORLDMATRIX(15) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(15)), state_undefined },
2539 { /*272, WINED3DTS_WORLDMATRIX(16) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(16)), state_undefined },
2540 { /*273, WINED3DTS_WORLDMATRIX(17) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(17)), state_undefined },
2541 { /*274, WINED3DTS_WORLDMATRIX(18) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(18)), state_undefined },
2542 { /*275, WINED3DTS_WORLDMATRIX(19) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(19)), state_undefined },
2543 { /*276, WINED3DTS_WORLDMATRIX(20) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(20)), state_undefined },
2544 { /*277, WINED3DTS_WORLDMATRIX(21) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(21)), state_undefined },
2545 { /*278, WINED3DTS_WORLDMATRIX(22) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(22)), state_undefined },
2546 { /*279, WINED3DTS_WORLDMATRIX(23) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(23)), state_undefined },
2547 { /*280, WINED3DTS_WORLDMATRIX(24) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(24)), state_undefined },
2548 { /*281, WINED3DTS_WORLDMATRIX(25) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(25)), state_undefined },
2549 { /*282, WINED3DTS_WORLDMATRIX(26) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(26)), state_undefined },
2550 { /*283, WINED3DTS_WORLDMATRIX(27) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(27)), state_undefined },
2551 { /*284, WINED3DTS_WORLDMATRIX(28) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(28)), state_undefined },
2552 { /*285, WINED3DTS_WORLDMATRIX(29) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(29)), state_undefined },
2553 { /*286, WINED3DTS_WORLDMATRIX(30) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(30)), state_undefined },
2554 { /*287, WINED3DTS_WORLDMATRIX(31) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(31)), state_undefined },
2555 { /*288, WINED3DTS_WORLDMATRIX(32) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(32)), state_undefined },
2556 { /*289, WINED3DTS_WORLDMATRIX(33) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(33)), state_undefined },
2557 { /*290, WINED3DTS_WORLDMATRIX(34) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(34)), state_undefined },
2558 { /*291, WINED3DTS_WORLDMATRIX(35) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(35)), state_undefined },
2559 { /*292, WINED3DTS_WORLDMATRIX(36) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(36)), state_undefined },
2560 { /*293, WINED3DTS_WORLDMATRIX(37) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(37)), state_undefined },
2561 { /*294, WINED3DTS_WORLDMATRIX(38) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(38)), state_undefined },
2562 { /*295, WINED3DTS_WORLDMATRIX(39) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(39)), state_undefined },
2563 { /*296, WINED3DTS_WORLDMATRIX(40) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(40)), state_undefined },
2564 { /*297, WINED3DTS_WORLDMATRIX(41) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(41)), state_undefined },
2565 { /*298, WINED3DTS_WORLDMATRIX(42) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(42)), state_undefined },
2566 { /*299, WINED3DTS_WORLDMATRIX(43) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(43)), state_undefined },
2567 { /*300, WINED3DTS_WORLDMATRIX(44) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(44)), state_undefined },
2568 { /*301, WINED3DTS_WORLDMATRIX(45) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(45)), state_undefined },
2569 { /*302, WINED3DTS_WORLDMATRIX(46) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(46)), state_undefined },
2570 { /*303, WINED3DTS_WORLDMATRIX(47) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(47)), state_undefined },
2571 { /*304, WINED3DTS_WORLDMATRIX(48) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(48)), state_undefined },
2572 { /*305, WINED3DTS_WORLDMATRIX(49) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(49)), state_undefined },
2573 { /*306, WINED3DTS_WORLDMATRIX(50) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(50)), state_undefined },
2574 { /*307, WINED3DTS_WORLDMATRIX(51) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(51)), state_undefined },
2575 { /*308, WINED3DTS_WORLDMATRIX(52) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(52)), state_undefined },
2576 { /*309, WINED3DTS_WORLDMATRIX(53) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(53)), state_undefined },
2577 { /*310, WINED3DTS_WORLDMATRIX(54) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(54)), state_undefined },
2578 { /*311, WINED3DTS_WORLDMATRIX(55) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(55)), state_undefined },
2579 { /*312, WINED3DTS_WORLDMATRIX(56) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(56)), state_undefined },
2580 { /*313, WINED3DTS_WORLDMATRIX(57) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(57)), state_undefined },
2581 { /*314, WINED3DTS_WORLDMATRIX(58) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(58)), state_undefined },
2582 { /*315, WINED3DTS_WORLDMATRIX(59) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(59)), state_undefined },
2583 { /*316, WINED3DTS_WORLDMATRIX(60) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(60)), state_undefined },
2584 { /*317, WINED3DTS_WORLDMATRIX(61) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(61)), state_undefined },
2585 { /*318, WINED3DTS_WORLDMATRIX(62) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(62)), state_undefined },
2586 { /*319, WINED3DTS_WORLDMATRIX(63) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(63)), state_undefined },
2587 { /*320, WINED3DTS_WORLDMATRIX(64) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(64)), state_undefined },
2588 { /*321, WINED3DTS_WORLDMATRIX(65) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(65)), state_undefined },
2589 { /*322, WINED3DTS_WORLDMATRIX(66) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(66)), state_undefined },
2590 { /*323, WINED3DTS_WORLDMATRIX(67) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(67)), state_undefined },
2591 { /*324, WINED3DTS_WORLDMATRIX(68) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(68)), state_undefined },
2592 { /*325, WINED3DTS_WORLDMATRIX(68) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(69)), state_undefined },
2593 { /*326, WINED3DTS_WORLDMATRIX(70) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(70)), state_undefined },
2594 { /*327, WINED3DTS_WORLDMATRIX(71) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(71)), state_undefined },
2595 { /*328, WINED3DTS_WORLDMATRIX(72) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(72)), state_undefined },
2596 { /*329, WINED3DTS_WORLDMATRIX(73) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(73)), state_undefined },
2597 { /*330, WINED3DTS_WORLDMATRIX(74) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(74)), state_undefined },
2598 { /*331, WINED3DTS_WORLDMATRIX(75) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(75)), state_undefined },
2599 { /*332, WINED3DTS_WORLDMATRIX(76) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(76)), state_undefined },
2600 { /*333, WINED3DTS_WORLDMATRIX(77) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(77)), state_undefined },
2601 { /*334, WINED3DTS_WORLDMATRIX(78) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(78)), state_undefined },
2602 { /*335, WINED3DTS_WORLDMATRIX(79) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(79)), state_undefined },
2603 { /*336, WINED3DTS_WORLDMATRIX(80) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(80)), state_undefined },
2604 { /*337, WINED3DTS_WORLDMATRIX(81) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(81)), state_undefined },
2605 { /*338, WINED3DTS_WORLDMATRIX(82) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(82)), state_undefined },
2606 { /*339, WINED3DTS_WORLDMATRIX(83) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(83)), state_undefined },
2607 { /*340, WINED3DTS_WORLDMATRIX(84) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(84)), state_undefined },
2608 { /*341, WINED3DTS_WORLDMATRIX(85) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(85)), state_undefined },
2609 { /*341, WINED3DTS_WORLDMATRIX(86) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(86)), state_undefined },
2610 { /*343, WINED3DTS_WORLDMATRIX(87) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(87)), state_undefined },
2611 { /*344, WINED3DTS_WORLDMATRIX(88) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(88)), state_undefined },
2612 { /*345, WINED3DTS_WORLDMATRIX(89) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(89)), state_undefined },
2613 { /*346, WINED3DTS_WORLDMATRIX(90) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(90)), state_undefined },
2614 { /*347, WINED3DTS_WORLDMATRIX(91) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(91)), state_undefined },
2615 { /*348, WINED3DTS_WORLDMATRIX(92) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(92)), state_undefined },
2616 { /*349, WINED3DTS_WORLDMATRIX(93) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(93)), state_undefined },
2617 { /*350, WINED3DTS_WORLDMATRIX(94) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(94)), state_undefined },
2618 { /*351, WINED3DTS_WORLDMATRIX(95) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(95)), state_undefined },
2619 { /*352, WINED3DTS_WORLDMATRIX(96) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(96)), state_undefined },
2620 { /*353, WINED3DTS_WORLDMATRIX(97) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(97)), state_undefined },
2621 { /*354, WINED3DTS_WORLDMATRIX(98) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(98)), state_undefined },
2622 { /*355, WINED3DTS_WORLDMATRIX(99) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(99)), state_undefined },
2623 { /*356, WINED3DTS_WORLDMATRIX(100) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), state_undefined },
2624 { /*357, WINED3DTS_WORLDMATRIX(101) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), state_undefined },
2625 { /*358, WINED3DTS_WORLDMATRIX(102) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), state_undefined },
2626 { /*359, WINED3DTS_WORLDMATRIX(103) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), state_undefined },
2627 { /*360, WINED3DTS_WORLDMATRIX(104) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), state_undefined },
2628 { /*361, WINED3DTS_WORLDMATRIX(105) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), state_undefined },
2629 { /*362, WINED3DTS_WORLDMATRIX(106) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), state_undefined },
2630 { /*363, WINED3DTS_WORLDMATRIX(107) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), state_undefined },
2631 { /*364, WINED3DTS_WORLDMATRIX(108) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), state_undefined },
2632 { /*365, WINED3DTS_WORLDMATRIX(109) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), state_undefined },
2633 { /*366, WINED3DTS_WORLDMATRIX(110) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), state_undefined },
2634 { /*367, WINED3DTS_WORLDMATRIX(111) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), state_undefined },
2635 { /*368, WINED3DTS_WORLDMATRIX(112) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), state_undefined },
2636 { /*369, WINED3DTS_WORLDMATRIX(113) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), state_undefined },
2637 { /*370, WINED3DTS_WORLDMATRIX(114) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), state_undefined },
2638 { /*371, WINED3DTS_WORLDMATRIX(115) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), state_undefined },
2639 { /*372, WINED3DTS_WORLDMATRIX(116) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), state_undefined },
2640 { /*373, WINED3DTS_WORLDMATRIX(117) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), state_undefined },
2641 { /*374, WINED3DTS_WORLDMATRIX(118) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), state_undefined },
2642 { /*375, WINED3DTS_WORLDMATRIX(119) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), state_undefined },
2643 { /*376, WINED3DTS_WORLDMATRIX(120) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), state_undefined },
2644 { /*377, WINED3DTS_WORLDMATRIX(121) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), state_undefined },
2645 { /*378, WINED3DTS_WORLDMATRIX(122) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), state_undefined },
2646 { /*379, WINED3DTS_WORLDMATRIX(123) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), state_undefined },
2647 { /*380, WINED3DTS_WORLDMATRIX(124) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), state_undefined },
2648 { /*381, WINED3DTS_WORLDMATRIX(125) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), state_undefined },
2649 { /*382, WINED3DTS_WORLDMATRIX(126) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), state_undefined },
2650 { /*383, WINED3DTS_WORLDMATRIX(127) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), state_undefined },
2651 { /*384, WINED3DTS_WORLDMATRIX(128) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), state_undefined },
2652 { /*385, WINED3DTS_WORLDMATRIX(129) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), state_undefined },
2653 { /*386, WINED3DTS_WORLDMATRIX(130) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), state_undefined },
2654 { /*387, WINED3DTS_WORLDMATRIX(131) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), state_undefined },
2655 { /*388, WINED3DTS_WORLDMATRIX(132) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), state_undefined },
2656 { /*389, WINED3DTS_WORLDMATRIX(133) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), state_undefined },
2657 { /*390, WINED3DTS_WORLDMATRIX(134) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), state_undefined },
2658 { /*391, WINED3DTS_WORLDMATRIX(135) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), state_undefined },
2659 { /*392, WINED3DTS_WORLDMATRIX(136) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), state_undefined },
2660 { /*393, WINED3DTS_WORLDMATRIX(137) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), state_undefined },
2661 { /*394, WINED3DTS_WORLDMATRIX(138) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), state_undefined },
2662 { /*395, WINED3DTS_WORLDMATRIX(139) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), state_undefined },
2663 { /*396, WINED3DTS_WORLDMATRIX(140) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), state_undefined },
2664 { /*397, WINED3DTS_WORLDMATRIX(141) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), state_undefined },
2665 { /*398, WINED3DTS_WORLDMATRIX(142) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), state_undefined },
2666 { /*399, WINED3DTS_WORLDMATRIX(143) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), state_undefined },
2667 { /*400, WINED3DTS_WORLDMATRIX(144) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), state_undefined },
2668 { /*401, WINED3DTS_WORLDMATRIX(145) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), state_undefined },
2669 { /*402, WINED3DTS_WORLDMATRIX(146) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), state_undefined },
2670 { /*403, WINED3DTS_WORLDMATRIX(147) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), state_undefined },
2671 { /*404, WINED3DTS_WORLDMATRIX(148) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), state_undefined },
2672 { /*405, WINED3DTS_WORLDMATRIX(149) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), state_undefined },
2673 { /*406, WINED3DTS_WORLDMATRIX(150) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), state_undefined },
2674 { /*407, WINED3DTS_WORLDMATRIX(151) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), state_undefined },
2675 { /*408, WINED3DTS_WORLDMATRIX(152) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), state_undefined },
2676 { /*409, WINED3DTS_WORLDMATRIX(153) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), state_undefined },
2677 { /*410, WINED3DTS_WORLDMATRIX(154) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), state_undefined },
2678 { /*411, WINED3DTS_WORLDMATRIX(155) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), state_undefined },
2679 { /*412, WINED3DTS_WORLDMATRIX(156) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), state_undefined },
2680 { /*413, WINED3DTS_WORLDMATRIX(157) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), state_undefined },
2681 { /*414, WINED3DTS_WORLDMATRIX(158) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), state_undefined },
2682 { /*415, WINED3DTS_WORLDMATRIX(159) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), state_undefined },
2683 { /*416, WINED3DTS_WORLDMATRIX(160) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), state_undefined },
2684 { /*417, WINED3DTS_WORLDMATRIX(161) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), state_undefined },
2685 { /*418, WINED3DTS_WORLDMATRIX(162) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), state_undefined },
2686 { /*419, WINED3DTS_WORLDMATRIX(163) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), state_undefined },
2687 { /*420, WINED3DTS_WORLDMATRIX(164) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), state_undefined },
2688 { /*421, WINED3DTS_WORLDMATRIX(165) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), state_undefined },
2689 { /*422, WINED3DTS_WORLDMATRIX(166) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), state_undefined },
2690 { /*423, WINED3DTS_WORLDMATRIX(167) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), state_undefined },
2691 { /*424, WINED3DTS_WORLDMATRIX(168) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), state_undefined },
2692 { /*425, WINED3DTS_WORLDMATRIX(168) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), state_undefined },
2693 { /*426, WINED3DTS_WORLDMATRIX(170) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), state_undefined },
2694 { /*427, WINED3DTS_WORLDMATRIX(171) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), state_undefined },
2695 { /*428, WINED3DTS_WORLDMATRIX(172) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), state_undefined },
2696 { /*429, WINED3DTS_WORLDMATRIX(173) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), state_undefined },
2697 { /*430, WINED3DTS_WORLDMATRIX(174) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), state_undefined },
2698 { /*431, WINED3DTS_WORLDMATRIX(175) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), state_undefined },
2699 { /*432, WINED3DTS_WORLDMATRIX(176) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), state_undefined },
2700 { /*433, WINED3DTS_WORLDMATRIX(177) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), state_undefined },
2701 { /*434, WINED3DTS_WORLDMATRIX(178) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), state_undefined },
2702 { /*435, WINED3DTS_WORLDMATRIX(179) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), state_undefined },
2703 { /*436, WINED3DTS_WORLDMATRIX(180) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), state_undefined },
2704 { /*437, WINED3DTS_WORLDMATRIX(181) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), state_undefined },
2705 { /*438, WINED3DTS_WORLDMATRIX(182) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), state_undefined },
2706 { /*439, WINED3DTS_WORLDMATRIX(183) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), state_undefined },
2707 { /*440, WINED3DTS_WORLDMATRIX(184) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), state_undefined },
2708 { /*441, WINED3DTS_WORLDMATRIX(185) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), state_undefined },
2709 { /*441, WINED3DTS_WORLDMATRIX(186) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), state_undefined },
2710 { /*443, WINED3DTS_WORLDMATRIX(187) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), state_undefined },
2711 { /*444, WINED3DTS_WORLDMATRIX(188) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), state_undefined },
2712 { /*445, WINED3DTS_WORLDMATRIX(189) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), state_undefined },
2713 { /*446, WINED3DTS_WORLDMATRIX(190) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), state_undefined },
2714 { /*447, WINED3DTS_WORLDMATRIX(191) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), state_undefined },
2715 { /*448, WINED3DTS_WORLDMATRIX(192) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), state_undefined },
2716 { /*449, WINED3DTS_WORLDMATRIX(193) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), state_undefined },
2717 { /*450, WINED3DTS_WORLDMATRIX(194) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), state_undefined },
2718 { /*451, WINED3DTS_WORLDMATRIX(195) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), state_undefined },
2719 { /*452, WINED3DTS_WORLDMATRIX(196) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), state_undefined },
2720 { /*453, WINED3DTS_WORLDMATRIX(197) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), state_undefined },
2721 { /*454, WINED3DTS_WORLDMATRIX(198) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), state_undefined },
2722 { /*455, WINED3DTS_WORLDMATRIX(199) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), state_undefined },
2723 { /*356, WINED3DTS_WORLDMATRIX(200) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), state_undefined },
2724 { /*457, WINED3DTS_WORLDMATRIX(201) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), state_undefined },
2725 { /*458, WINED3DTS_WORLDMATRIX(202) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), state_undefined },
2726 { /*459, WINED3DTS_WORLDMATRIX(203) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), state_undefined },
2727 { /*460, WINED3DTS_WORLDMATRIX(204) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), state_undefined },
2728 { /*461, WINED3DTS_WORLDMATRIX(205) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), state_undefined },
2729 { /*462, WINED3DTS_WORLDMATRIX(206) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), state_undefined },
2730 { /*463, WINED3DTS_WORLDMATRIX(207) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), state_undefined },
2731 { /*464, WINED3DTS_WORLDMATRIX(208) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), state_undefined },
2732 { /*465, WINED3DTS_WORLDMATRIX(209) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), state_undefined },
2733 { /*466, WINED3DTS_WORLDMATRIX(210) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), state_undefined },
2734 { /*467, WINED3DTS_WORLDMATRIX(211) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), state_undefined },
2735 { /*468, WINED3DTS_WORLDMATRIX(212) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), state_undefined },
2736 { /*469, WINED3DTS_WORLDMATRIX(213) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), state_undefined },
2737 { /*470, WINED3DTS_WORLDMATRIX(214) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), state_undefined },
2738 { /*471, WINED3DTS_WORLDMATRIX(215) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), state_undefined },
2739 { /*472, WINED3DTS_WORLDMATRIX(216) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), state_undefined },
2740 { /*473, WINED3DTS_WORLDMATRIX(217) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), state_undefined },
2741 { /*474, WINED3DTS_WORLDMATRIX(218) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), state_undefined },
2742 { /*475, WINED3DTS_WORLDMATRIX(219) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), state_undefined },
2743 { /*476, WINED3DTS_WORLDMATRIX(220) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), state_undefined },
2744 { /*477, WINED3DTS_WORLDMATRIX(221) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), state_undefined },
2745 { /*478, WINED3DTS_WORLDMATRIX(222) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), state_undefined },
2746 { /*479, WINED3DTS_WORLDMATRIX(223) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), state_undefined },
2747 { /*480, WINED3DTS_WORLDMATRIX(224) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), state_undefined },
2748 { /*481, WINED3DTS_WORLDMATRIX(225) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), state_undefined },
2749 { /*482, WINED3DTS_WORLDMATRIX(226) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), state_undefined },
2750 { /*483, WINED3DTS_WORLDMATRIX(227) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), state_undefined },
2751 { /*484, WINED3DTS_WORLDMATRIX(228) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), state_undefined },
2752 { /*485, WINED3DTS_WORLDMATRIX(229) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), state_undefined },
2753 { /*486, WINED3DTS_WORLDMATRIX(230) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), state_undefined },
2754 { /*487, WINED3DTS_WORLDMATRIX(231) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), state_undefined },
2755 { /*488, WINED3DTS_WORLDMATRIX(232) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), state_undefined },
2756 { /*489, WINED3DTS_WORLDMATRIX(233) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), state_undefined },
2757 { /*490, WINED3DTS_WORLDMATRIX(234) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), state_undefined },
2758 { /*491, WINED3DTS_WORLDMATRIX(235) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), state_undefined },
2759 { /*492, WINED3DTS_WORLDMATRIX(236) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), state_undefined },
2760 { /*493, WINED3DTS_WORLDMATRIX(237) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), state_undefined },
2761 { /*494, WINED3DTS_WORLDMATRIX(238) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), state_undefined },
2762 { /*495, WINED3DTS_WORLDMATRIX(239) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), state_undefined },
2763 { /*496, WINED3DTS_WORLDMATRIX(240) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), state_undefined },
2764 { /*497, WINED3DTS_WORLDMATRIX(241) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), state_undefined },
2765 { /*498, WINED3DTS_WORLDMATRIX(242) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), state_undefined },
2766 { /*499, WINED3DTS_WORLDMATRIX(243) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), state_undefined },
2767 { /*500, WINED3DTS_WORLDMATRIX(244) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), state_undefined },
2768 { /*501, WINED3DTS_WORLDMATRIX(245) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), state_undefined },
2769 { /*502, WINED3DTS_WORLDMATRIX(246) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), state_undefined },
2770 { /*503, WINED3DTS_WORLDMATRIX(247) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), state_undefined },
2771 { /*504, WINED3DTS_WORLDMATRIX(248) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), state_undefined },
2772 { /*505, WINED3DTS_WORLDMATRIX(249) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), state_undefined },
2773 { /*506, WINED3DTS_WORLDMATRIX(250) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), state_undefined },
2774 { /*507, WINED3DTS_WORLDMATRIX(251) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), state_undefined },
2775 { /*508, WINED3DTS_WORLDMATRIX(252) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), state_undefined },
2776 { /*509, WINED3DTS_WORLDMATRIX(253) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), state_undefined },
2777 { /*510, WINED3DTS_WORLDMATRIX(254) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), state_undefined },
2778 { /*511, WINED3DTS_WORLDMATRIX(255) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), state_undefined },