wined3d: Move WINED3DRS_DITHERENABLE to the state table.
[wine] / dlls / wined3d / state.c
1 /*
2  * Direct3D state management
3  *
4  * Copyright 2006 Stefan Dösinger for CodeWeavers
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include "config.h"
22 #include <stdio.h>
23 #ifdef HAVE_FLOAT_H
24 # include <float.h>
25 #endif
26 #include "wined3d_private.h"
27
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
29
30 static void state_unknown(DWORD state, IWineD3DStateBlockImpl *stateblock) {
31     /* State which does exist, but wined3d doesn't know about */
32     if(STATE_IS_RENDER(state)) {
33         WINED3DRENDERSTATETYPE RenderState = state - STATE_RENDER(0);
34         FIXME("(%s, %d) Unknown renderstate\n", debug_d3drenderstate(RenderState), stateblock->renderState[RenderState]);
35     } else {
36         FIXME("(%d) Unknown state with unknown type\n", state);
37     }
38 }
39
40 static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock) {
41     /* Used for states which are not mapped to a gl state as-is, but used somehow different,
42      * e.g as a parameter for drawing, or which are unimplemented in windows d3d
43      */
44     if(STATE_IS_RENDER(state)) {
45         WINED3DRENDERSTATETYPE RenderState = state - STATE_RENDER(0);
46         TRACE("(%s,%d) no direct mapping to gl\n", debug_d3drenderstate(RenderState), stateblock->renderState[RenderState]);
47     } else {
48         /* Shouldn't have an unknown type here */
49         FIXME("%d no direct mapping to gl of state with unknown type\n", state);
50     }
51 }
52
53 static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock) {
54     /* Print a WARN, this allows the stateblock code to loop over all states to generate a display
55      * list without causing confusing terminal output. Deliberately no special debug name here
56      * because its undefined.
57      */
58     WARN("undefined state %d\n", state);
59 }
60
61 static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock) {
62     D3DFILLMODE Value = stateblock->renderState[WINED3DRS_FILLMODE];
63
64     switch(Value) {
65         case D3DFILL_POINT:
66             glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
67             checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
68             break;
69         case D3DFILL_WIREFRAME:
70             glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
71             checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
72             break;
73         case D3DFILL_SOLID:
74             glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
75             checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
76             break;
77         default:
78             FIXME("Unrecognized WINED3DRS_FILLMODE value %d\n", Value);
79     }
80 }
81
82 static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock) {
83
84     /* TODO: Lighting is only enabled if Vertex normals are passed by the application,
85      * so merge the lighting render state with the vertex declaration once it is available
86      */
87
88     if (stateblock->renderState[WINED3DRS_LIGHTING]) {
89         glEnable(GL_LIGHTING);
90         checkGLcall("glEnable GL_LIGHTING");
91     } else {
92         glDisable(GL_LIGHTING);
93         checkGLcall("glDisable GL_LIGHTING");
94     }
95 }
96
97 static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
98     switch ((WINED3DZBUFFERTYPE) stateblock->renderState[WINED3DRS_ZENABLE]) {
99         case WINED3DZB_FALSE:
100             glDisable(GL_DEPTH_TEST);
101             checkGLcall("glDisable GL_DEPTH_TEST");
102             break;
103         case WINED3DZB_TRUE:
104             glEnable(GL_DEPTH_TEST);
105             checkGLcall("glEnable GL_DEPTH_TEST");
106             break;
107         case WINED3DZB_USEW:
108             glEnable(GL_DEPTH_TEST);
109             checkGLcall("glEnable GL_DEPTH_TEST");
110             FIXME("W buffer is not well handled\n");
111             break;
112         default:
113             FIXME("Unrecognized D3DZBUFFERTYPE value %d\n", stateblock->renderState[WINED3DRS_ZENABLE]);
114     }
115 }
116
117 static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock) {
118     /* TODO: Put this into the offscreen / onscreen rendering block due to device->render_offscreen */
119
120     /* If we are culling "back faces with clockwise vertices" then
121        set front faces to be counter clockwise and enable culling
122        of back faces                                               */
123     switch ((WINED3DCULL) stateblock->renderState[WINED3DRS_CULLMODE]) {
124         case WINED3DCULL_NONE:
125             glDisable(GL_CULL_FACE);
126             checkGLcall("glDisable GL_CULL_FACE");
127             break;
128         case WINED3DCULL_CW:
129             glEnable(GL_CULL_FACE);
130             checkGLcall("glEnable GL_CULL_FACE");
131             if (stateblock->wineD3DDevice->render_offscreen) {
132                 glFrontFace(GL_CW);
133                 checkGLcall("glFrontFace GL_CW");
134             } else {
135                 glFrontFace(GL_CCW);
136                 checkGLcall("glFrontFace GL_CCW");
137             }
138             glCullFace(GL_BACK);
139             break;
140         case WINED3DCULL_CCW:
141             glEnable(GL_CULL_FACE);
142             checkGLcall("glEnable GL_CULL_FACE");
143             if (stateblock->wineD3DDevice->render_offscreen) {
144                 glFrontFace(GL_CCW);
145                 checkGLcall("glFrontFace GL_CCW");
146             } else {
147                 glFrontFace(GL_CW);
148                 checkGLcall("glFrontFace GL_CW");
149             }
150             glCullFace(GL_BACK);
151             break;
152         default:
153             FIXME("Unrecognized/Unhandled WINED3DCULL value %d\n", stateblock->renderState[WINED3DRS_CULLMODE]);
154     }
155 }
156
157 static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock) {
158     switch ((WINED3DSHADEMODE) stateblock->renderState[WINED3DRS_SHADEMODE]) {
159         case WINED3DSHADE_FLAT:
160             glShadeModel(GL_FLAT);
161             checkGLcall("glShadeModel(GL_FLAT)");
162             break;
163         case WINED3DSHADE_GOURAUD:
164             glShadeModel(GL_SMOOTH);
165             checkGLcall("glShadeModel(GL_SMOOTH)");
166             break;
167         case WINED3DSHADE_PHONG:
168             FIXME("WINED3DSHADE_PHONG isn't supported\n");
169             break;
170         default:
171             FIXME("Unrecognized/Unhandled WINED3DSHADEMODE value %d\n", stateblock->renderState[WINED3DRS_SHADEMODE]);
172     }
173 }
174
175 static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock) {
176     if (stateblock->renderState[WINED3DRS_DITHERENABLE]) {
177         glEnable(GL_DITHER);
178         checkGLcall("glEnable GL_DITHER");
179     } else {
180         glDisable(GL_DITHER);
181         checkGLcall("glDisable GL_DITHER");
182     }
183 }
184
185 const struct StateEntry StateTable[] =
186 {
187       /* State name                                         representative,                                     apply function */
188     { /* 0,  Undefined                              */      0,                                                  state_undefined     },
189     { /* 1,  WINED3DRS_TEXTUREHANDLE                */      0 /* Handled in ddraw */,                           state_undefined     },
190     { /* 2,  WINED3DRS_ANTIALIAS                    */      STATE_RENDER(WINED3DRS_ANTIALIAS),                  state_unknown       },
191     { /* 3,  WINED3DRS_TEXTUREADDRESS               */      0 /* Handled in ddraw */,                           state_undefined     },
192     { /* 4,  WINED3DRS_TEXTUREPERSPECTIVE           */      STATE_RENDER(WINED3DRS_TEXTUREPERSPECTIVE),         state_unknown       },
193     { /* 5,  WINED3DRS_WRAPU                        */      STATE_RENDER(WINED3DRS_WRAPU),                      state_unknown       },
194     { /* 6,  WINED3DRS_WRAPV                        */      STATE_RENDER(WINED3DRS_WRAPV),                      state_unknown       },
195     { /* 7,  WINED3DRS_ZENABLE                      */      STATE_RENDER(WINED3DRS_ZENABLE),                    state_zenable       },
196     { /* 8,  WINED3DRS_FILLMODE                     */      STATE_RENDER(WINED3DRS_FILLMODE),                   state_fillmode      },
197     { /* 9,  WINED3DRS_SHADEMODE                    */      STATE_RENDER(WINED3DRS_SHADEMODE),                  state_shademode     },
198     { /* 10, WINED3DRS_LINEPATTERN                  */      STATE_RENDER(WINED3DRS_LINEPATTERN),                state_unknown       },
199     { /* 11, WINED3DRS_MONOENABLE                   */      STATE_RENDER(WINED3DRS_MONOENABLE),                 state_unknown       },
200     { /* 12, WINED3DRS_ROP2                         */      STATE_RENDER(WINED3DRS_ROP2),                       state_unknown       },
201     { /* 13, WINED3DRS_PLANEMASK                    */      STATE_RENDER(WINED3DRS_PLANEMASK),                  state_unknown       },
202     { /* 14, WINED3DRS_ZWRITEENABLE                 */      STATE_RENDER(WINED3DRS_ZWRITEENABLE),               state_unknown       },
203     { /* 15, WINED3DRS_ALPHATESTENABLE              */      STATE_RENDER(WINED3DRS_ALPHATESTENABLE),            state_unknown       },
204     { /* 16, WINED3DRS_LASTPIXEL                    */      STATE_RENDER(WINED3DRS_LASTPIXEL),                  state_unknown       },
205     { /* 17, WINED3DRS_TEXTUREMAG                   */      0 /* Handled in ddraw */,                           state_undefined     },
206     { /* 18, WINED3DRS_TEXTUREMIN                   */      0 /* Handled in ddraw */,                           state_undefined     },
207     { /* 19, WINED3DRS_SRCBLEND                     */      STATE_RENDER(WINED3DRS_ALPHABLENDENABLE),           state_unknown       },
208     { /* 20, WINED3DRS_DESTBLEND                    */      STATE_RENDER(WINED3DRS_ALPHABLENDENABLE),           state_unknown       },
209     { /* 21, WINED3DRS_TEXTUREMAPBLEND              */      0 /* Handled in ddraw */,                           state_undefined     },
210     { /* 22, WINED3DRS_CULLMODE                     */      STATE_RENDER(WINED3DRS_CULLMODE),                   state_cullmode      },
211     { /* 23, WINED3DRS_ZFUNC                        */      STATE_RENDER(WINED3DRS_ZFUNC),                      state_unknown       },
212     { /* 24, WINED3DRS_ALPHAREF                     */      STATE_RENDER(WINED3DRS_ALPHATESTENABLE),            state_unknown       },
213     { /* 25, WINED3DRS_ALPHAFUNC                    */      STATE_RENDER(WINED3DRS_ALPHATESTENABLE),            state_unknown       },
214     { /* 26, WINED3DRS_DITHERENABLE                 */      STATE_RENDER(WINED3DRS_DITHERENABLE),               state_ditherenable  },
215     { /* 27, WINED3DRS_ALPHABLENDENABLE             */      STATE_RENDER(WINED3DRS_ALPHABLENDENABLE),           state_unknown       },
216     { /* 28, WINED3DRS_FOGENABLE                    */      STATE_RENDER(WINED3DRS_FOGENABLE),                  state_unknown       },
217     { /* 29, WINED3DRS_SPECULARENABLE               */      STATE_RENDER(WINED3DRS_SPECULARENABLE),             state_unknown       },
218     { /* 30, WINED3DRS_ZVISIBLE                     */      0 /* Not supported according to the msdn */,        state_nogl          },
219     { /* 31, WINED3DRS_SUBPIXEL                     */      STATE_RENDER(WINED3DRS_SUBPIXEL),                   state_unknown       },
220     { /* 32, WINED3DRS_SUBPIXELX                    */      STATE_RENDER(WINED3DRS_SUBPIXELX),                  state_unknown       },
221     { /* 33, WINED3DRS_STIPPLEDALPHA                */      STATE_RENDER(WINED3DRS_STIPPLEDALPHA),              state_unknown       },
222     { /* 34, WINED3DRS_FOGCOLOR                     */      STATE_RENDER(WINED3DRS_FOGCOLOR),                   state_unknown       },
223     { /* 35, WINED3DRS_FOGTABLEMODE                 */      STATE_RENDER(WINED3DRS_FOGENABLE)/*vertex type*/,   state_unknown       },
224     { /* 36, WINED3DRS_FOGSTART                     */      STATE_RENDER(WINED3DRS_FOGENABLE),                  state_unknown       },
225     { /* 37, WINED3DRS_FOGEND                       */      STATE_RENDER(WINED3DRS_FOGENABLE),                  state_unknown       },
226     { /* 38, WINED3DRS_FOGDENSITY                   */      STATE_RENDER(WINED3DRS_FOGDENSITY),                 state_unknown       },
227     { /* 39, WINED3DRS_STIPPLEENABLE                */      STATE_RENDER(WINED3DRS_STIPPLEENABLE),              state_unknown       },
228     { /* 40, WINED3DRS_EDGEANTIALIAS                */      STATE_RENDER(WINED3DRS_ALPHABLENDENABLE),           state_unknown       },
229     { /* 41, WINED3DRS_COLORKEYENABLE               */      STATE_RENDER(WINED3DRS_ALPHATESTENABLE),            state_unknown       },
230     { /* 42, undefined                              */      0,                                                  state_undefined     },
231     { /* 43, WINED3DRS_BORDERCOLOR                  */      STATE_RENDER(WINED3DRS_BORDERCOLOR),                state_unknown       },
232     { /* 44, WINED3DRS_TEXTUREADDRESSU              */      0, /* Handled in ddraw */                           state_undefined     },
233     { /* 45, WINED3DRS_TEXTUREADDRESSV              */      0, /* Handled in ddraw */                           state_undefined     },
234     { /* 46, WINED3DRS_MIPMAPLODBIAS                */      STATE_RENDER(WINED3DRS_MIPMAPLODBIAS),              state_unknown       },
235     { /* 47, WINED3DRS_ZBIAS                        */      STATE_RENDER(WINED3DRS_ZBIAS),                      state_unknown       },
236     { /* 48, WINED3DRS_RANGEFOGENABLE               */      STATE_RENDER(WINED3DRS_RANGEFOGENABLE),             state_unknown       },
237     { /* 49, WINED3DRS_ANISOTROPY                   */      STATE_RENDER(WINED3DRS_ANISOTROPY),                 state_unknown       },
238     { /* 50, WINED3DRS_FLUSHBATCH                   */      STATE_RENDER(WINED3DRS_FLUSHBATCH),                 state_unknown       },
239     { /* 51, WINED3DRS_TRANSLUCENTSORTINDEPENDENT   */      STATE_RENDER(WINED3DRS_TRANSLUCENTSORTINDEPENDENT), state_unknown       },
240     { /* 52, WINED3DRS_STENCILENABLE                */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
241     { /* 53, WINED3DRS_STENCILFAIL                  */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
242     { /* 54, WINED3DRS_STENCILZFAIL                 */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
243     { /* 55, WINED3DRS_STENCILPASS                  */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
244     { /* 56, WINED3DRS_STENCILFUNC                  */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
245     { /* 57, WINED3DRS_STENCILREF                   */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
246     { /* 58, WINED3DRS_STENCILMASK                  */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
247     { /* 59, WINED3DRS_STENCILWRITEMASK             */      STATE_RENDER(WINED3DRS_STENCILWRITEMASK),           state_unknown       },
248     { /* 60, WINED3DRS_TEXTUREFACTOR                */      STATE_RENDER(WINED3DRS_TEXTUREFACTOR),              state_unknown       },
249     /* A BIG hole. If wanted, 'fixed' states like the vertex type or the bound shaders can be put here */
250     { /* 61, Undefined                              */      0,                                                  state_undefined     },
251     { /* 62, Undefined                              */      0,                                                  state_undefined     },
252     { /* 63, Undefined                              */      0,                                                  state_undefined     },
253     { /* 64, Undefined                              */      0,                                                  state_undefined     },
254     { /* 65, Undefined                              */      0,                                                  state_undefined     },
255     { /* 66, Undefined                              */      0,                                                  state_undefined     },
256     { /* 67, Undefined                              */      0,                                                  state_undefined     },
257     { /* 68, Undefined                              */      0,                                                  state_undefined     },
258     { /* 69, Undefined                              */      0,                                                  state_undefined     },
259     { /* 70, Undefined                              */      0,                                                  state_undefined     },
260     { /* 71, Undefined                              */      0,                                                  state_undefined     },
261     { /* 72, Undefined                              */      0,                                                  state_undefined     },
262     { /* 73, Undefined                              */      0,                                                  state_undefined     },
263     { /* 74, Undefined                              */      0,                                                  state_undefined     },
264     { /* 75, Undefined                              */      0,                                                  state_undefined     },
265     { /* 76, Undefined                              */      0,                                                  state_undefined     },
266     { /* 77, Undefined                              */      0,                                                  state_undefined     },
267     { /* 78, Undefined                              */      0,                                                  state_undefined     },
268     { /* 79, Undefined                              */      0,                                                  state_undefined     },
269     { /* 80, Undefined                              */      0,                                                  state_undefined     },
270     { /* 81, Undefined                              */      0,                                                  state_undefined     },
271     { /* 82, Undefined                              */      0,                                                  state_undefined     },
272     { /* 83, Undefined                              */      0,                                                  state_undefined     },
273     { /* 84, Undefined                              */      0,                                                  state_undefined     },
274     { /* 85, Undefined                              */      0,                                                  state_undefined     },
275     { /* 86, Undefined                              */      0,                                                  state_undefined     },
276     { /* 87, Undefined                              */      0,                                                  state_undefined     },
277     { /* 88, Undefined                              */      0,                                                  state_undefined     },
278     { /* 89, Undefined                              */      0,                                                  state_undefined     },
279     { /* 90, Undefined                              */      0,                                                  state_undefined     },
280     { /* 91, Undefined                              */      0,                                                  state_undefined     },
281     { /* 92, Undefined                              */      0,                                                  state_undefined     },
282     { /* 93, Undefined                              */      0,                                                  state_undefined     },
283     { /* 94, Undefined                              */      0,                                                  state_undefined     },
284     { /* 95, Undefined                              */      0,                                                  state_undefined     },
285     { /* 96, Undefined                              */      0,                                                  state_undefined     },
286     { /* 97, Undefined                              */      0,                                                  state_undefined     },
287     { /* 98, Undefined                              */      0,                                                  state_undefined     },
288     { /* 99, Undefined                              */      0,                                                  state_undefined     },
289     { /*100, Undefined                              */      0,                                                  state_undefined     },
290     { /*101, Undefined                              */      0,                                                  state_undefined     },
291     { /*102, Undefined                              */      0,                                                  state_undefined     },
292     { /*103, Undefined                              */      0,                                                  state_undefined     },
293     { /*104, Undefined                              */      0,                                                  state_undefined     },
294     { /*105, Undefined                              */      0,                                                  state_undefined     },
295     { /*106, Undefined                              */      0,                                                  state_undefined     },
296     { /*107, Undefined                              */      0,                                                  state_undefined     },
297     { /*108, Undefined                              */      0,                                                  state_undefined     },
298     { /*109, Undefined                              */      0,                                                  state_undefined     },
299     { /*110, Undefined                              */      0,                                                  state_undefined     },
300     { /*111, Undefined                              */      0,                                                  state_undefined     },
301     { /*112, Undefined                              */      0,                                                  state_undefined     },
302     { /*113, Undefined                              */      0,                                                  state_undefined     },
303     { /*114, Undefined                              */      0,                                                  state_undefined     },
304     { /*115, Undefined                              */      0,                                                  state_undefined     },
305     { /*116, Undefined                              */      0,                                                  state_undefined     },
306     { /*117, Undefined                              */      0,                                                  state_undefined     },
307     { /*118, Undefined                              */      0,                                                  state_undefined     },
308     { /*119, Undefined                              */      0,                                                  state_undefined     },
309     { /*120, Undefined                              */      0,                                                  state_undefined     },
310     { /*121, Undefined                              */      0,                                                  state_undefined     },
311     { /*122, Undefined                              */      0,                                                  state_undefined     },
312     { /*123, Undefined                              */      0,                                                  state_undefined     },
313     { /*124, Undefined                              */      0,                                                  state_undefined     },
314     { /*125, Undefined                              */      0,                                                  state_undefined     },
315     { /*126, Undefined                              */      0,                                                  state_undefined     },
316     { /*127, Undefined                              */      0,                                                  state_undefined     },
317     /* Big hole ends */
318     { /*128, WINED3DRS_WRAP0                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
319     { /*129, WINED3DRS_WRAP1                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
320     { /*130, WINED3DRS_WRAP2                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
321     { /*131, WINED3DRS_WRAP3                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
322     { /*132, WINED3DRS_WRAP4                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
323     { /*133, WINED3DRS_WRAP5                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
324     { /*134, WINED3DRS_WRAP6                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
325     { /*135, WINED3DRS_WRAP7                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
326     { /*136, WINED3DRS_CLIPPING                     */      STATE_RENDER(WINED3DRS_CLIPPING),                   state_unknown       },
327     { /*137, WINED3DRS_LIGHTING                     */      STATE_RENDER(WINED3DRS_LIGHTING) /* Vertex decl! */,state_lighting      },
328     { /*138, WINED3DRS_EXTENTS                      */      STATE_RENDER(WINED3DRS_EXTENTS),                    state_unknown       },
329     { /*139, WINED3DRS_AMBIENT                      */      STATE_RENDER(WINED3DRS_AMBIENT),                    state_unknown       },
330     { /*140, WINED3DRS_FOGVERTEXMODE                */      STATE_RENDER(WINED3DRS_FOGENABLE),                  state_unknown       },
331     { /*141, WINED3DRS_COLORVERTEX                  */      STATE_RENDER(WINED3DRS_COLORVERTEX),                state_unknown       },
332     { /*142, WINED3DRS_LOCALVIEWER                  */      STATE_RENDER(WINED3DRS_LOCALVIEWER),                state_unknown       },
333     { /*143, WINED3DRS_NORMALIZENORMALS             */      STATE_RENDER(WINED3DRS_NORMALIZENORMALS),           state_unknown       },
334     { /*144, WINED3DRS_COLORKEYBLENDENABLE          */      STATE_RENDER(WINED3DRS_COLORKEYBLENDENABLE),        state_unknown       },
335     { /*145, WINED3DRS_DIFFUSEMATERIALSOURCE        */      STATE_RENDER(WINED3DRS_COLORVERTEX),                state_unknown       },
336     { /*146, WINED3DRS_SPECULARMATERIALSOURCE       */      STATE_RENDER(WINED3DRS_COLORVERTEX),                state_unknown       },
337     { /*147, WINED3DRS_AMBIENTMATERIALSOURCE        */      STATE_RENDER(WINED3DRS_COLORVERTEX),                state_unknown       },
338     { /*148, WINED3DRS_EMISSIVEMATERIALSOURCE       */      STATE_RENDER(WINED3DRS_COLORVERTEX),                state_unknown       },
339     { /*149, Undefined                              */      0,                                                  state_undefined     },
340     { /*150, Undefined                              */      0,                                                  state_undefined     },
341     { /*151, WINED3DRS_VERTEXBLEND                  */      0,                                                  state_nogl          },
342     { /*152, WINED3DRS_CLIPPLANEENABLE              */      STATE_RENDER(WINED3DRS_CLIPPING),                   state_unknown       },
343     { /*153, WINED3DRS_SOFTWAREVERTEXPROCESSING     */      0,                                                  state_nogl          },
344     { /*154, WINED3DRS_POINTSIZE                    */      STATE_RENDER(WINED3DRS_POINTSIZE),                  state_unknown       },
345     { /*155, WINED3DRS_POINTSIZE_MIN                */      STATE_RENDER(WINED3DRS_POINTSIZE_MIN),              state_unknown       },
346     { /*156, WINED3DRS_POINTSPRITEENABLE            */      STATE_RENDER(WINED3DRS_POINTSPRITEENABLE),          state_unknown       },
347     { /*157, WINED3DRS_POINTSCALEENABLE             */      STATE_RENDER(WINED3DRS_POINTSCALEENABLE),           state_unknown       },
348     { /*158, WINED3DRS_POINTSCALE_A                 */      STATE_RENDER(WINED3DRS_POINTSCALEENABLE),           state_unknown       },
349     { /*159, WINED3DRS_POINTSCALE_B                 */      STATE_RENDER(WINED3DRS_POINTSCALEENABLE),           state_unknown       },
350     { /*160, WINED3DRS_POINTSCALE_C                 */      STATE_RENDER(WINED3DRS_POINTSCALEENABLE),           state_unknown       },
351     { /*161, WINED3DRS_MULTISAMPLEANTIALIAS         */      STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS),       state_unknown       },
352     { /*162, WINED3DRS_MULTISAMPLEMASK              */      STATE_RENDER(WINED3DRS_MULTISAMPLEMASK),            state_unknown       },
353     { /*163, WINED3DRS_PATCHEDGESTYLE               */      STATE_RENDER(WINED3DRS_PATCHEDGESTYLE),             state_unknown       },
354     { /*164, WINED3DRS_PATCHSEGMENTS                */      STATE_RENDER(WINED3DRS_PATCHSEGMENTS),              state_unknown       },
355     { /*165, WINED3DRS_DEBUGMONITORTOKEN            */      STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN),          state_unknown       },
356     { /*166, WINED3DRS_POINTSIZE_MAX                */      STATE_RENDER(WINED3DRS_POINTSIZE_MAX),              state_unknown       },
357     { /*167, WINED3DRS_INDEXEDVERTEXBLENDENABLE     */      STATE_RENDER(WINED3DRS_INDEXEDVERTEXBLENDENABLE),   state_unknown       },
358     { /*168, WINED3DRS_COLORWRITEENABLE             */      STATE_RENDER(WINED3DRS_COLORWRITEENABLE),           state_unknown       },
359     { /*169, Undefined                              */      0,                                                  state_undefined     },
360     { /*170, WINED3DRS_TWEENFACTOR                  */      0,                                                  state_nogl          },
361     { /*171, WINED3DRS_BLENDOP                      */      STATE_RENDER(WINED3DRS_BLENDOP),                    state_unknown       },
362     { /*172, WINED3DRS_POSITIONDEGREE               */      STATE_RENDER(WINED3DRS_POSITIONDEGREE),             state_unknown       },
363     { /*173, WINED3DRS_NORMALDEGREE                 */      STATE_RENDER(WINED3DRS_NORMALDEGREE),               state_unknown       },
364       /*172, WINED3DRS_POSITIONORDER                */      /* Value assigned to 2 state names */
365       /*173, WINED3DRS_NORMALORDER                  */      /* Value assigned to 2 state names */
366     { /*174, WINED3DRS_SCISSORTESTENABLE            */      STATE_RENDER(WINED3DRS_SCISSORTESTENABLE),          state_unknown       },
367     { /*175, WINED3DRS_SLOPESCALEDEPTHBIAS          */      STATE_RENDER(WINED3DRS_DEPTHBIAS),                  state_unknown       },
368     { /*176, WINED3DRS_ANTIALIASEDLINEENABLE        */      STATE_RENDER(WINED3DRS_ALPHABLENDENABLE),           state_unknown       },
369     { /*177, undefined                              */      0,                                                  state_undefined     },
370     { /*178, WINED3DRS_MINTESSELLATIONLEVEL         */      STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown       },
371     { /*179, WINED3DRS_MAXTESSELLATIONLEVEL         */      STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown       },
372     { /*180, WINED3DRS_ADAPTIVETESS_X               */      STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown       },
373     { /*181, WINED3DRS_ADAPTIVETESS_Y               */      STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown       },
374     { /*182, WINED3DRS_ADAPTIVETESS_Z               */      STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown       },
375     { /*183, WINED3DRS_ADAPTIVETESS_W               */      STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown       },
376     { /*184, WINED3DRS_ENABLEADAPTIVETESSELLATION   */      STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown       },
377     { /*185, WINED3DRS_TWOSIDEDSTENCILMODE          */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
378     { /*186, WINED3DRS_CCW_STENCILFAIL              */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
379     { /*187, WINED3DRS_CCW_STENCILZFAIL             */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
380     { /*188, WINED3DRS_CCW_STENCILPASS              */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
381     { /*189, WINED3DRS_CCW_STENCILFUNC              */      STATE_RENDER(WINED3DRS_STENCILENABLE),              state_unknown       },
382     { /*190, WINED3DRS_COLORWRITEENABLE1            */      STATE_RENDER(WINED3DRS_COLORWRITEENABLE),           state_unknown       },
383     { /*191, WINED3DRS_COLORWRITEENABLE2            */      STATE_RENDER(WINED3DRS_COLORWRITEENABLE),           state_unknown       },
384     { /*192, WINED3DRS_COLORWRITEENABLE3            */      STATE_RENDER(WINED3DRS_COLORWRITEENABLE),           state_unknown       },
385     { /*193, WINED3DRS_BLENDFACTOR                  */      STATE_RENDER(WINED3DRS_ALPHABLENDENABLE),           state_unknown       },
386     { /*194, WINED3DRS_SRGBWRITEENABLE              */      0,                                                  state_nogl          },
387     { /*195, WINED3DRS_DEPTHBIAS                    */      STATE_RENDER(WINED3DRS_DEPTHBIAS),                  state_unknown       },
388     { /*196, undefined                              */      0,                                                  state_undefined     },
389     { /*197, undefined                              */      0,                                                  state_undefined     },
390     { /*198, WINED3DRS_WRAP8                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
391     { /*199, WINED3DRS_WRAP9                        */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
392     { /*200, WINED3DRS_WRAP10                       */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
393     { /*201, WINED3DRS_WRAP11                       */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
394     { /*202, WINED3DRS_WRAP12                       */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
395     { /*203, WINED3DRS_WRAP13                       */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
396     { /*204, WINED3DRS_WRAP14                       */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
397     { /*205, WINED3DRS_WRAP15                       */      STATE_RENDER(WINED3DRS_WRAP0),                      state_unknown       },
398     { /*206, WINED3DRS_SEPARATEALPHABLENDENABLE     */      STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE),   state_unknown       },
399     { /*207, WINED3DRS_SRCBLENDALPHA                */      STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE),   state_unknown       },
400     { /*208, WINED3DRS_DESTBLENDALPHA               */      STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE),   state_unknown       },
401     { /*209, WINED3DRS_BLENDOPALPHA                 */      STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE),   state_unknown       },
402 };