2 * Direct3D state management
4 * Copyright 2002 Lionel Ulmer
5 * Copyright 2002-2005 Jason Edmeades
6 * Copyright 2003-2004 Raphael Junqueira
7 * Copyright 2004 Christian Costa
8 * Copyright 2005 Oliver Stieber
9 * Copyright 2006 Henri Verbeet
10 * Copyright 2006-2008 Stefan Dösinger for CodeWeavers
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wined3d_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
35 WINE_DECLARE_DEBUG_CHANNEL(d3d_shader
);
37 #define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
39 static void state_blendop(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
);
41 static void state_nogl(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
42 /* Used for states which are not mapped to a gl state as-is, but used somehow different,
43 * e.g as a parameter for drawing, or which are unimplemented in windows d3d
45 if(STATE_IS_RENDER(state
)) {
46 WINED3DRENDERSTATETYPE RenderState
= state
- STATE_RENDER(0);
47 TRACE("(%s,%d) no direct mapping to gl\n", debug_d3drenderstate(RenderState
), stateblock
->renderState
[RenderState
]);
49 /* Shouldn't have an unknown type here */
50 FIXME("%d no direct mapping to gl of state with unknown type\n", state
);
54 static void state_undefined(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
55 /* Print a WARN, this allows the stateblock code to loop over all states to generate a display
56 * list without causing confusing terminal output. Deliberately no special debug name here
57 * because its undefined.
59 WARN("undefined state %d\n", state
);
62 static void state_fillmode(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
63 WINED3DFILLMODE Value
= stateblock
->renderState
[WINED3DRS_FILLMODE
];
66 case WINED3DFILL_POINT
:
67 glPolygonMode(GL_FRONT_AND_BACK
, GL_POINT
);
68 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
70 case WINED3DFILL_WIREFRAME
:
71 glPolygonMode(GL_FRONT_AND_BACK
, GL_LINE
);
72 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
74 case WINED3DFILL_SOLID
:
75 glPolygonMode(GL_FRONT_AND_BACK
, GL_FILL
);
76 checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
79 FIXME("Unrecognized WINED3DRS_FILLMODE value %d\n", Value
);
83 static void state_lighting(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
86 /* Lighting is not enabled if transformed vertices are drawn
87 * but lighting does not affect the stream sources, so it is not grouped for performance reasons.
88 * This state reads the decoded vertex declaration, so if it is dirty don't do anything. The
89 * vertex declaration applying function calls this function for updating
92 if(isStateDirty(context
, STATE_VDECL
)) {
96 transformed
= ((stateblock
->wineD3DDevice
->strided_streams
.u
.s
.position
.lpData
!= NULL
||
97 stateblock
->wineD3DDevice
->strided_streams
.u
.s
.position
.VBO
!= 0) &&
98 stateblock
->wineD3DDevice
->strided_streams
.u
.s
.position_transformed
) ? TRUE
: FALSE
;
100 if (stateblock
->renderState
[WINED3DRS_LIGHTING
] && !transformed
) {
101 glEnable(GL_LIGHTING
);
102 checkGLcall("glEnable GL_LIGHTING");
104 glDisable(GL_LIGHTING
);
105 checkGLcall("glDisable GL_LIGHTING");
109 static void state_zenable(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
110 /* No z test without depth stencil buffers */
111 if(stateblock
->wineD3DDevice
->stencilBufferTarget
== NULL
) {
112 TRACE("No Z buffer - disabling depth test\n");
113 glDisable(GL_DEPTH_TEST
); /* This also disables z writing in gl */
114 checkGLcall("glDisable GL_DEPTH_TEST");
118 switch ((WINED3DZBUFFERTYPE
) stateblock
->renderState
[WINED3DRS_ZENABLE
]) {
119 case WINED3DZB_FALSE
:
120 glDisable(GL_DEPTH_TEST
);
121 checkGLcall("glDisable GL_DEPTH_TEST");
124 glEnable(GL_DEPTH_TEST
);
125 checkGLcall("glEnable GL_DEPTH_TEST");
128 glEnable(GL_DEPTH_TEST
);
129 checkGLcall("glEnable GL_DEPTH_TEST");
130 FIXME("W buffer is not well handled\n");
133 FIXME("Unrecognized D3DZBUFFERTYPE value %d\n", stateblock
->renderState
[WINED3DRS_ZENABLE
]);
137 static void state_cullmode(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
138 /* glFrontFace() is set in context.c at context init and on an offscreen / onscreen rendering
141 switch ((WINED3DCULL
) stateblock
->renderState
[WINED3DRS_CULLMODE
]) {
142 case WINED3DCULL_NONE
:
143 glDisable(GL_CULL_FACE
);
144 checkGLcall("glDisable GL_CULL_FACE");
147 glEnable(GL_CULL_FACE
);
148 checkGLcall("glEnable GL_CULL_FACE");
149 glCullFace(GL_FRONT
);
150 checkGLcall("glCullFace(GL_FRONT)");
152 case WINED3DCULL_CCW
:
153 glEnable(GL_CULL_FACE
);
154 checkGLcall("glEnable GL_CULL_FACE");
156 checkGLcall("glCullFace(GL_BACK)");
159 FIXME("Unrecognized/Unhandled WINED3DCULL value %d\n", stateblock
->renderState
[WINED3DRS_CULLMODE
]);
163 static void state_shademode(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
164 switch ((WINED3DSHADEMODE
) stateblock
->renderState
[WINED3DRS_SHADEMODE
]) {
165 case WINED3DSHADE_FLAT
:
166 glShadeModel(GL_FLAT
);
167 checkGLcall("glShadeModel(GL_FLAT)");
169 case WINED3DSHADE_GOURAUD
:
170 glShadeModel(GL_SMOOTH
);
171 checkGLcall("glShadeModel(GL_SMOOTH)");
173 case WINED3DSHADE_PHONG
:
174 FIXME("WINED3DSHADE_PHONG isn't supported\n");
177 FIXME("Unrecognized/Unhandled WINED3DSHADEMODE value %d\n", stateblock
->renderState
[WINED3DRS_SHADEMODE
]);
181 static void state_ditherenable(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
182 if (stateblock
->renderState
[WINED3DRS_DITHERENABLE
]) {
184 checkGLcall("glEnable GL_DITHER");
186 glDisable(GL_DITHER
);
187 checkGLcall("glDisable GL_DITHER");
191 static void state_zwritenable(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
192 /* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. If yes,
193 * this has to be merged with ZENABLE and ZFUNC
195 if (stateblock
->renderState
[WINED3DRS_ZWRITEENABLE
]) {
197 checkGLcall("glDepthMask(1)");
200 checkGLcall("glDepthMask(0)");
204 static void state_zfunc(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
205 int glParm
= CompareFunc(stateblock
->renderState
[WINED3DRS_ZFUNC
]);
208 if(glParm
== GL_EQUAL
|| glParm
== GL_NOTEQUAL
) {
209 static BOOL once
= FALSE
;
210 /* There are a few issues with this: First, our inability to
211 * select a proper Z depth, most of the time we're stuck with
212 * D24S8, even if the app selects D32 or D16. There seem to be
213 * some other precision problems which have to be debugged to
214 * make NOTEQUAL and EQUAL work properly
218 FIXME("D3DCMP_NOTEQUAL and D3DCMP_EQUAL do not work correctly yet\n");
223 checkGLcall("glDepthFunc");
227 static void state_ambient(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
229 D3DCOLORTOGLFLOAT4(stateblock
->renderState
[WINED3DRS_AMBIENT
], col
);
231 TRACE("Setting ambient to (%f,%f,%f,%f)\n", col
[0], col
[1], col
[2], col
[3]);
232 glLightModelfv(GL_LIGHT_MODEL_AMBIENT
, col
);
233 checkGLcall("glLightModel for MODEL_AMBIENT");
236 static void state_blend(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
237 int srcBlend
= GL_ZERO
;
238 int dstBlend
= GL_ZERO
;
239 const StaticPixelFormatDesc
*rtFormat
;
240 IWineD3DSurfaceImpl
*target
= (IWineD3DSurfaceImpl
*) stateblock
->wineD3DDevice
->render_targets
[0];
242 /* GL_LINE_SMOOTH needs GL_BLEND to work, according to the red book, and special blending params */
243 if (stateblock
->renderState
[WINED3DRS_ALPHABLENDENABLE
] ||
244 stateblock
->renderState
[WINED3DRS_EDGEANTIALIAS
] ||
245 stateblock
->renderState
[WINED3DRS_ANTIALIASEDLINEENABLE
]) {
246 const GlPixelFormatDesc
*glDesc
;
247 getFormatDescEntry(target
->resource
.format
, &GLINFO_LOCATION
, &glDesc
);
249 /* Disable blending in all cases even without pixelshaders. With blending on we could face a big performance penalty.
250 * The d3d9 visual test confirms the behavior. */
251 if(!(glDesc
->Flags
& WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING
)) {
253 checkGLcall("glDisable GL_BLEND");
257 checkGLcall("glEnable GL_BLEND");
261 checkGLcall("glDisable GL_BLEND");
262 /* Nothing more to do - get out */
266 switch (stateblock
->renderState
[WINED3DRS_DESTBLEND
]) {
267 case WINED3DBLEND_ZERO
: dstBlend
= GL_ZERO
; break;
268 case WINED3DBLEND_ONE
: dstBlend
= GL_ONE
; break;
269 case WINED3DBLEND_SRCCOLOR
: dstBlend
= GL_SRC_COLOR
; break;
270 case WINED3DBLEND_INVSRCCOLOR
: dstBlend
= GL_ONE_MINUS_SRC_COLOR
; break;
271 case WINED3DBLEND_SRCALPHA
: dstBlend
= GL_SRC_ALPHA
; break;
272 case WINED3DBLEND_INVSRCALPHA
: dstBlend
= GL_ONE_MINUS_SRC_ALPHA
; break;
273 case WINED3DBLEND_DESTCOLOR
: dstBlend
= GL_DST_COLOR
; break;
274 case WINED3DBLEND_INVDESTCOLOR
: dstBlend
= GL_ONE_MINUS_DST_COLOR
; break;
276 /* To compensate the lack of format switching with backbuffer offscreen rendering,
277 * and with onscreen rendering, we modify the alpha test parameters for (INV)DESTALPHA
278 * if the render target doesn't support alpha blending. A nonexistent alpha channel
279 * returns 1.0, so D3DBLEND_DESTALPHA is GL_ONE, and D3DBLEND_INVDESTALPHA is GL_ZERO
281 case WINED3DBLEND_DESTALPHA
:
282 rtFormat
= getFormatDescEntry(target
->resource
.format
, NULL
, NULL
);
283 dstBlend
= rtFormat
->alphaMask
? GL_DST_ALPHA
: GL_ONE
;
285 case WINED3DBLEND_INVDESTALPHA
:
286 rtFormat
= getFormatDescEntry(target
->resource
.format
, NULL
, NULL
);
287 dstBlend
= rtFormat
->alphaMask
? GL_ONE_MINUS_DST_ALPHA
: GL_ZERO
;
290 case WINED3DBLEND_SRCALPHASAT
:
291 dstBlend
= GL_SRC_ALPHA_SATURATE
;
292 WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n");
295 /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending
296 * values which are still valid up to d3d9. They should not occur as dest blend values
298 case WINED3DBLEND_BOTHSRCALPHA
: dstBlend
= GL_SRC_ALPHA
;
299 srcBlend
= GL_SRC_ALPHA
;
300 FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHSRCALPHA, what to do?\n");
303 case WINED3DBLEND_BOTHINVSRCALPHA
: dstBlend
= GL_ONE_MINUS_SRC_ALPHA
;
304 srcBlend
= GL_ONE_MINUS_SRC_ALPHA
;
305 FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n");
308 case WINED3DBLEND_BLENDFACTOR
: dstBlend
= GL_CONSTANT_COLOR
; break;
309 case WINED3DBLEND_INVBLENDFACTOR
: dstBlend
= GL_ONE_MINUS_CONSTANT_COLOR
; break;
311 FIXME("Unrecognized dst blend value %d\n", stateblock
->renderState
[WINED3DRS_DESTBLEND
]);
314 switch (stateblock
->renderState
[WINED3DRS_SRCBLEND
]) {
315 case WINED3DBLEND_ZERO
: srcBlend
= GL_ZERO
; break;
316 case WINED3DBLEND_ONE
: srcBlend
= GL_ONE
; break;
317 case WINED3DBLEND_SRCCOLOR
: srcBlend
= GL_SRC_COLOR
; break;
318 case WINED3DBLEND_INVSRCCOLOR
: srcBlend
= GL_ONE_MINUS_SRC_COLOR
; break;
319 case WINED3DBLEND_SRCALPHA
: srcBlend
= GL_SRC_ALPHA
; break;
320 case WINED3DBLEND_INVSRCALPHA
: srcBlend
= GL_ONE_MINUS_SRC_ALPHA
; break;
321 case WINED3DBLEND_DESTCOLOR
: srcBlend
= GL_DST_COLOR
; break;
322 case WINED3DBLEND_INVDESTCOLOR
: srcBlend
= GL_ONE_MINUS_DST_COLOR
; break;
323 case WINED3DBLEND_SRCALPHASAT
: srcBlend
= GL_SRC_ALPHA_SATURATE
; break;
325 case WINED3DBLEND_DESTALPHA
:
326 rtFormat
= getFormatDescEntry(target
->resource
.format
, NULL
, NULL
);
327 srcBlend
= rtFormat
->alphaMask
? GL_DST_ALPHA
: GL_ONE
;
329 case WINED3DBLEND_INVDESTALPHA
:
330 rtFormat
= getFormatDescEntry(target
->resource
.format
, NULL
, NULL
);
331 srcBlend
= rtFormat
->alphaMask
? GL_ONE_MINUS_DST_ALPHA
: GL_ZERO
;
334 case WINED3DBLEND_BOTHSRCALPHA
: srcBlend
= GL_SRC_ALPHA
;
335 dstBlend
= GL_ONE_MINUS_SRC_ALPHA
;
338 case WINED3DBLEND_BOTHINVSRCALPHA
: srcBlend
= GL_ONE_MINUS_SRC_ALPHA
;
339 dstBlend
= GL_SRC_ALPHA
;
342 case WINED3DBLEND_BLENDFACTOR
: srcBlend
= GL_CONSTANT_COLOR
; break;
343 case WINED3DBLEND_INVBLENDFACTOR
: srcBlend
= GL_ONE_MINUS_CONSTANT_COLOR
; break;
345 FIXME("Unrecognized src blend value %d\n", stateblock
->renderState
[WINED3DRS_SRCBLEND
]);
348 if(stateblock
->renderState
[WINED3DRS_EDGEANTIALIAS
] ||
349 stateblock
->renderState
[WINED3DRS_ANTIALIASEDLINEENABLE
]) {
350 glEnable(GL_LINE_SMOOTH
);
351 checkGLcall("glEnable(GL_LINE_SMOOTH)");
352 if(srcBlend
!= GL_SRC_ALPHA
) {
353 WARN("WINED3DRS_EDGEANTIALIAS enabled, but unexpected src blending param\n");
355 if(dstBlend
!= GL_ONE_MINUS_SRC_ALPHA
&& dstBlend
!= GL_ONE
) {
356 WARN("WINED3DRS_EDGEANTIALIAS enabled, but unexpected dst blending param\n");
359 glDisable(GL_LINE_SMOOTH
);
360 checkGLcall("glDisable(GL_LINE_SMOOTH)");
363 /* Re-apply BLENDOP(ALPHA) because of a possible SEPARATEALPHABLENDENABLE change */
364 if(!isStateDirty(context
, STATE_RENDER(WINED3DRS_BLENDOP
))) {
365 state_blendop(STATE_RENDER(WINED3DRS_BLENDOPALPHA
), stateblock
, context
);
368 if(stateblock
->renderState
[WINED3DRS_SEPARATEALPHABLENDENABLE
]) {
369 int srcBlendAlpha
= GL_ZERO
;
370 int dstBlendAlpha
= GL_ZERO
;
372 /* Separate alpha blending requires GL_EXT_blend_function_separate, so make sure it is around */
373 if(!GL_SUPPORT(EXT_BLEND_FUNC_SEPARATE
)) {
374 WARN("Unsupported in local OpenGL implementation: glBlendFuncSeparateEXT\n");
378 switch (stateblock
->renderState
[WINED3DRS_DESTBLENDALPHA
]) {
379 case WINED3DBLEND_ZERO
: dstBlendAlpha
= GL_ZERO
; break;
380 case WINED3DBLEND_ONE
: dstBlendAlpha
= GL_ONE
; break;
381 case WINED3DBLEND_SRCCOLOR
: dstBlendAlpha
= GL_SRC_COLOR
; break;
382 case WINED3DBLEND_INVSRCCOLOR
: dstBlendAlpha
= GL_ONE_MINUS_SRC_COLOR
; break;
383 case WINED3DBLEND_SRCALPHA
: dstBlendAlpha
= GL_SRC_ALPHA
; break;
384 case WINED3DBLEND_INVSRCALPHA
: dstBlendAlpha
= GL_ONE_MINUS_SRC_ALPHA
; break;
385 case WINED3DBLEND_DESTCOLOR
: dstBlendAlpha
= GL_DST_COLOR
; break;
386 case WINED3DBLEND_INVDESTCOLOR
: dstBlendAlpha
= GL_ONE_MINUS_DST_COLOR
; break;
387 case WINED3DBLEND_DESTALPHA
: dstBlendAlpha
= GL_DST_ALPHA
; break;
388 case WINED3DBLEND_INVDESTALPHA
: dstBlendAlpha
= GL_DST_ALPHA
; break;
389 case WINED3DBLEND_SRCALPHASAT
:
390 dstBlend
= GL_SRC_ALPHA_SATURATE
;
391 WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n");
393 /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending
394 * values which are still valid up to d3d9. They should not occur as dest blend values
396 case WINED3DBLEND_BOTHSRCALPHA
:
397 dstBlendAlpha
= GL_SRC_ALPHA
;
398 srcBlendAlpha
= GL_SRC_ALPHA
;
399 FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHSRCALPHA, what to do?\n");
401 case WINED3DBLEND_BOTHINVSRCALPHA
:
402 dstBlendAlpha
= GL_ONE_MINUS_SRC_ALPHA
;
403 srcBlendAlpha
= GL_ONE_MINUS_SRC_ALPHA
;
404 FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n");
406 case WINED3DBLEND_BLENDFACTOR
: dstBlendAlpha
= GL_CONSTANT_COLOR
; break;
407 case WINED3DBLEND_INVBLENDFACTOR
: dstBlendAlpha
= GL_ONE_MINUS_CONSTANT_COLOR
; break;
409 FIXME("Unrecognized dst blend alpha value %d\n", stateblock
->renderState
[WINED3DRS_DESTBLENDALPHA
]);
412 switch (stateblock
->renderState
[WINED3DRS_SRCBLENDALPHA
]) {
413 case WINED3DBLEND_ZERO
: srcBlendAlpha
= GL_ZERO
; break;
414 case WINED3DBLEND_ONE
: srcBlendAlpha
= GL_ONE
; break;
415 case WINED3DBLEND_SRCCOLOR
: srcBlendAlpha
= GL_SRC_COLOR
; break;
416 case WINED3DBLEND_INVSRCCOLOR
: srcBlendAlpha
= GL_ONE_MINUS_SRC_COLOR
; break;
417 case WINED3DBLEND_SRCALPHA
: srcBlendAlpha
= GL_SRC_ALPHA
; break;
418 case WINED3DBLEND_INVSRCALPHA
: srcBlendAlpha
= GL_ONE_MINUS_SRC_ALPHA
; break;
419 case WINED3DBLEND_DESTCOLOR
: srcBlendAlpha
= GL_DST_COLOR
; break;
420 case WINED3DBLEND_INVDESTCOLOR
: srcBlendAlpha
= GL_ONE_MINUS_DST_COLOR
; break;
421 case WINED3DBLEND_SRCALPHASAT
: srcBlendAlpha
= GL_SRC_ALPHA_SATURATE
; break;
422 case WINED3DBLEND_DESTALPHA
: srcBlendAlpha
= GL_DST_ALPHA
; break;
423 case WINED3DBLEND_INVDESTALPHA
: srcBlendAlpha
= GL_DST_ALPHA
; break;
424 case WINED3DBLEND_BOTHSRCALPHA
:
425 srcBlendAlpha
= GL_SRC_ALPHA
;
426 dstBlendAlpha
= GL_ONE_MINUS_SRC_ALPHA
;
428 case WINED3DBLEND_BOTHINVSRCALPHA
:
429 srcBlendAlpha
= GL_ONE_MINUS_SRC_ALPHA
;
430 dstBlendAlpha
= GL_SRC_ALPHA
;
432 case WINED3DBLEND_BLENDFACTOR
: srcBlendAlpha
= GL_CONSTANT_COLOR
; break;
433 case WINED3DBLEND_INVBLENDFACTOR
: srcBlendAlpha
= GL_ONE_MINUS_CONSTANT_COLOR
; break;
435 FIXME("Unrecognized src blend alpha value %d\n", stateblock
->renderState
[WINED3DRS_SRCBLENDALPHA
]);
438 GL_EXTCALL(glBlendFuncSeparateEXT(srcBlend
, dstBlend
, srcBlendAlpha
, dstBlendAlpha
));
439 checkGLcall("glBlendFuncSeparateEXT");
441 TRACE("glBlendFunc src=%x, dst=%x\n", srcBlend
, dstBlend
);
442 glBlendFunc(srcBlend
, dstBlend
);
443 checkGLcall("glBlendFunc");
446 /* colorkey fixup for stage 0 alphaop depends on WINED3DRS_ALPHABLENDENABLE state,
447 so it may need updating */
448 if (stateblock
->renderState
[WINED3DRS_COLORKEYENABLE
]) {
449 const struct StateEntry
*StateTable
= stateblock
->wineD3DDevice
->StateTable
;
450 StateTable
[STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
)].apply(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
), stateblock
, context
);
454 static void state_blendfactor(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
457 if(!GL_SUPPORT(EXT_BLEND_COLOR
)) {
458 WARN("Unsupported in local OpenGL implementation: glBlendColorEXT\n");
462 TRACE("Setting BlendFactor to %d\n", stateblock
->renderState
[WINED3DRS_BLENDFACTOR
]);
463 D3DCOLORTOGLFLOAT4(stateblock
->renderState
[WINED3DRS_BLENDFACTOR
], col
);
464 GL_EXTCALL(glBlendColorEXT (col
[0],col
[1],col
[2],col
[3]));
465 checkGLcall("glBlendColor");
468 static void state_alpha(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
471 BOOL enable_ckey
= FALSE
;
473 IWineD3DSurfaceImpl
*surf
;
475 /* Find out if the texture on the first stage has a ckey set
476 * The alpha state func reads the texture settings, even though alpha and texture are not grouped
477 * together. This is to avoid making a huge alpha+texture+texture stage+ckey block due to the hardly
478 * used WINED3DRS_COLORKEYENABLE state(which is d3d <= 3 only). The texture function will call alpha
479 * in case it finds some texture+colorkeyenable combination which needs extra care.
481 if(stateblock
->textures
[0] && (
482 stateblock
->textureDimensions
[0] == GL_TEXTURE_2D
||
483 stateblock
->textureDimensions
[0] == GL_TEXTURE_RECTANGLE_ARB
)) {
484 surf
= (IWineD3DSurfaceImpl
*) ((IWineD3DTextureImpl
*)stateblock
->textures
[0])->surfaces
[0];
486 if(surf
->CKeyFlags
& WINEDDSD_CKSRCBLT
) {
487 const StaticPixelFormatDesc
*fmt
= getFormatDescEntry(surf
->resource
.format
, NULL
, NULL
);
488 /* The surface conversion does not do color keying conversion for surfaces that have an alpha
489 * channel on their own. Likewise, the alpha test shouldn't be set up for color keying if the
490 * surface has alpha bits
492 if(fmt
->alphaMask
== 0x00000000) {
498 if(enable_ckey
|| context
->last_was_ckey
) {
499 const struct StateEntry
*StateTable
= stateblock
->wineD3DDevice
->StateTable
;
500 StateTable
[STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
)].apply(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
), stateblock
, context
);
502 context
->last_was_ckey
= enable_ckey
;
504 if (stateblock
->renderState
[WINED3DRS_ALPHATESTENABLE
] ||
505 (stateblock
->renderState
[WINED3DRS_COLORKEYENABLE
] && enable_ckey
)) {
506 glEnable(GL_ALPHA_TEST
);
507 checkGLcall("glEnable GL_ALPHA_TEST");
509 glDisable(GL_ALPHA_TEST
);
510 checkGLcall("glDisable GL_ALPHA_TEST");
511 /* Alpha test is disabled, don't bother setting the params - it will happen on the next
517 if(stateblock
->renderState
[WINED3DRS_COLORKEYENABLE
] && enable_ckey
) {
518 glParm
= GL_NOTEQUAL
;
521 ref
= ((float) stateblock
->renderState
[WINED3DRS_ALPHAREF
]) / 255.0f
;
522 glParm
= CompareFunc(stateblock
->renderState
[WINED3DRS_ALPHAFUNC
]);
525 glAlphaFunc(glParm
, ref
);
526 checkGLcall("glAlphaFunc");
530 static void state_clipping(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
531 DWORD enable
= 0xFFFFFFFF;
532 DWORD disable
= 0x00000000;
534 if (use_vs(stateblock
->wineD3DDevice
)) {
535 /* The spec says that opengl clipping planes are disabled when using shaders. Direct3D planes aren't,
536 * so that is an issue. The MacOS ATI driver keeps clipping planes activated with shaders in some
537 * conditions I got sick of tracking down. The shader state handler disables all clip planes because
538 * of that - don't do anything here and keep them disabled
540 if(stateblock
->renderState
[WINED3DRS_CLIPPLANEENABLE
]) {
541 static BOOL warned
= FALSE
;
543 FIXME("Clipping not supported with vertex shaders\n");
550 /* TODO: Keep track of previously enabled clipplanes to avoid unnecessary resetting
551 * of already set values
554 /* If enabling / disabling all
555 * TODO: Is this correct? Doesn't D3DRS_CLIPPING disable clipping on the viewport frustrum?
557 if (stateblock
->renderState
[WINED3DRS_CLIPPING
]) {
558 enable
= stateblock
->renderState
[WINED3DRS_CLIPPLANEENABLE
];
559 disable
= ~stateblock
->renderState
[WINED3DRS_CLIPPLANEENABLE
];
560 if(GL_SUPPORT(NV_DEPTH_CLAMP
)) {
561 glDisable(GL_DEPTH_CLAMP_NV
);
562 checkGLcall("glDisable(GL_DEPTH_CLAMP_NV)");
565 disable
= 0xffffffff;
567 if(GL_SUPPORT(NV_DEPTH_CLAMP
)) {
568 glEnable(GL_DEPTH_CLAMP_NV
);
569 checkGLcall("glEnable(GL_DEPTH_CLAMP_NV)");
573 if (enable
& WINED3DCLIPPLANE0
) { glEnable(GL_CLIP_PLANE0
); checkGLcall("glEnable(clip plane 0)"); }
574 if (enable
& WINED3DCLIPPLANE1
) { glEnable(GL_CLIP_PLANE1
); checkGLcall("glEnable(clip plane 1)"); }
575 if (enable
& WINED3DCLIPPLANE2
) { glEnable(GL_CLIP_PLANE2
); checkGLcall("glEnable(clip plane 2)"); }
576 if (enable
& WINED3DCLIPPLANE3
) { glEnable(GL_CLIP_PLANE3
); checkGLcall("glEnable(clip plane 3)"); }
577 if (enable
& WINED3DCLIPPLANE4
) { glEnable(GL_CLIP_PLANE4
); checkGLcall("glEnable(clip plane 4)"); }
578 if (enable
& WINED3DCLIPPLANE5
) { glEnable(GL_CLIP_PLANE5
); checkGLcall("glEnable(clip plane 5)"); }
580 if (disable
& WINED3DCLIPPLANE0
) { glDisable(GL_CLIP_PLANE0
); checkGLcall("glDisable(clip plane 0)"); }
581 if (disable
& WINED3DCLIPPLANE1
) { glDisable(GL_CLIP_PLANE1
); checkGLcall("glDisable(clip plane 1)"); }
582 if (disable
& WINED3DCLIPPLANE2
) { glDisable(GL_CLIP_PLANE2
); checkGLcall("glDisable(clip plane 2)"); }
583 if (disable
& WINED3DCLIPPLANE3
) { glDisable(GL_CLIP_PLANE3
); checkGLcall("glDisable(clip plane 3)"); }
584 if (disable
& WINED3DCLIPPLANE4
) { glDisable(GL_CLIP_PLANE4
); checkGLcall("glDisable(clip plane 4)"); }
585 if (disable
& WINED3DCLIPPLANE5
) { glDisable(GL_CLIP_PLANE5
); checkGLcall("glDisable(clip plane 5)"); }
587 /** update clipping status */
589 stateblock
->clip_status
.ClipUnion
= 0;
590 stateblock
->clip_status
.ClipIntersection
= 0xFFFFFFFF;
592 stateblock
->clip_status
.ClipUnion
= 0;
593 stateblock
->clip_status
.ClipIntersection
= 0;
597 static void state_blendop(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
598 int blendEquation
= GL_FUNC_ADD
;
599 int blendEquationAlpha
= GL_FUNC_ADD
;
601 if(!GL_SUPPORT(EXT_BLEND_MINMAX
)) {
602 WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
606 /* BLENDOPALPHA requires GL_EXT_blend_equation_separate, so make sure it is around */
607 if(stateblock
->renderState
[WINED3DRS_BLENDOPALPHA
] && !GL_SUPPORT(EXT_BLEND_EQUATION_SEPARATE
)) {
608 WARN("Unsupported in local OpenGL implementation: glBlendEquationSeparateEXT\n");
612 switch ((WINED3DBLENDOP
) stateblock
->renderState
[WINED3DRS_BLENDOP
]) {
613 case WINED3DBLENDOP_ADD
: blendEquation
= GL_FUNC_ADD
; break;
614 case WINED3DBLENDOP_SUBTRACT
: blendEquation
= GL_FUNC_SUBTRACT
; break;
615 case WINED3DBLENDOP_REVSUBTRACT
: blendEquation
= GL_FUNC_REVERSE_SUBTRACT
; break;
616 case WINED3DBLENDOP_MIN
: blendEquation
= GL_MIN
; break;
617 case WINED3DBLENDOP_MAX
: blendEquation
= GL_MAX
; break;
619 FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock
->renderState
[WINED3DRS_BLENDOP
]);
622 switch ((WINED3DBLENDOP
) stateblock
->renderState
[WINED3DRS_BLENDOPALPHA
]) {
623 case WINED3DBLENDOP_ADD
: blendEquationAlpha
= GL_FUNC_ADD
; break;
624 case WINED3DBLENDOP_SUBTRACT
: blendEquationAlpha
= GL_FUNC_SUBTRACT
; break;
625 case WINED3DBLENDOP_REVSUBTRACT
: blendEquationAlpha
= GL_FUNC_REVERSE_SUBTRACT
; break;
626 case WINED3DBLENDOP_MIN
: blendEquationAlpha
= GL_MIN
; break;
627 case WINED3DBLENDOP_MAX
: blendEquationAlpha
= GL_MAX
; break;
629 FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock
->renderState
[WINED3DRS_BLENDOPALPHA
]);
632 if(stateblock
->renderState
[WINED3DRS_SEPARATEALPHABLENDENABLE
]) {
633 TRACE("glBlendEquationSeparateEXT(%x, %x)\n", blendEquation
, blendEquationAlpha
);
634 GL_EXTCALL(glBlendEquationSeparateEXT(blendEquation
, blendEquationAlpha
));
635 checkGLcall("glBlendEquationSeparateEXT");
637 TRACE("glBlendEquation(%x)\n", blendEquation
);
638 GL_EXTCALL(glBlendEquationEXT(blendEquation
));
639 checkGLcall("glBlendEquation");
644 state_specularenable(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
645 /* Originally this used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR)
646 * and (GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR) to swap between enabled/disabled
647 * specular color. This is wrong:
648 * Separate specular color means the specular colour is maintained separately, whereas
649 * single color means it is merged in. However in both cases they are being used to
651 * To disable specular color, set it explicitly to black and turn off GL_COLOR_SUM_EXT
652 * NOTE: If not supported don't give FIXMEs the impact is really minimal and very few people are
656 * If register combiners are enabled, enabling / disabling GL_COLOR_SUM has no effect.
657 * Instead, we need to setup the FinalCombiner properly.
659 * The default setup for the FinalCombiner is:
661 * <variable> <input> <mapping> <usage>
662 * GL_VARIABLE_A_NV GL_FOG, GL_UNSIGNED_IDENTITY_NV GL_ALPHA
663 * GL_VARIABLE_B_NV GL_SPARE0_PLUS_SECONDARY_COLOR_NV GL_UNSIGNED_IDENTITY_NV GL_RGB
664 * GL_VARIABLE_C_NV GL_FOG GL_UNSIGNED_IDENTITY_NV GL_RGB
665 * GL_VARIABLE_D_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
666 * GL_VARIABLE_E_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
667 * GL_VARIABLE_F_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
668 * GL_VARIABLE_G_NV GL_SPARE0_NV GL_UNSIGNED_IDENTITY_NV GL_ALPHA
670 * That's pretty much fine as it is, except for variable B, which needs to take
671 * either GL_SPARE0_PLUS_SECONDARY_COLOR_NV or GL_SPARE0_NV, depending on
672 * whether WINED3DRS_SPECULARENABLE is enabled or not.
675 TRACE("Setting specular enable state and materials\n");
676 if (stateblock
->renderState
[WINED3DRS_SPECULARENABLE
]) {
677 glMaterialfv(GL_FRONT_AND_BACK
, GL_SPECULAR
, (float*) &stateblock
->material
.Specular
);
678 checkGLcall("glMaterialfv");
680 if(stateblock
->material
.Power
> GL_LIMITS(shininess
)) {
681 /* glMaterialf man page says that the material says that GL_SHININESS must be between 0.0
682 * and 128.0, although in d3d neither -1 nor 129 produce an error. GL_NV_max_light_exponent
683 * allows bigger values. If the extension is supported, GL_LIMITS(shininess) contains the
684 * value reported by the extension, otherwise 128. For values > GL_LIMITS(shininess) clamp
685 * them, it should be safe to do so without major visual distortions.
687 WARN("Material power = %f, limit %f\n", stateblock
->material
.Power
, GL_LIMITS(shininess
));
688 glMaterialf(GL_FRONT_AND_BACK
, GL_SHININESS
, GL_LIMITS(shininess
));
690 glMaterialf(GL_FRONT_AND_BACK
, GL_SHININESS
, stateblock
->material
.Power
);
692 checkGLcall("glMaterialf(GL_SHININESS)");
694 if (GL_SUPPORT(EXT_SECONDARY_COLOR
)) {
695 glEnable(GL_COLOR_SUM_EXT
);
697 TRACE("Specular colors cannot be enabled in this version of opengl\n");
699 checkGLcall("glEnable(GL_COLOR_SUM)");
701 if (GL_SUPPORT(NV_REGISTER_COMBINERS
)) {
702 GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV
, GL_SPARE0_PLUS_SECONDARY_COLOR_NV
, GL_UNSIGNED_IDENTITY_NV
, GL_RGB
));
703 checkGLcall("glFinalCombinerInputNV()");
706 float black
[4] = {0.0f
, 0.0f
, 0.0f
, 0.0f
};
708 /* for the case of enabled lighting: */
709 glMaterialfv(GL_FRONT_AND_BACK
, GL_SPECULAR
, &black
[0]);
710 checkGLcall("glMaterialfv");
712 /* for the case of disabled lighting: */
713 if (GL_SUPPORT(EXT_SECONDARY_COLOR
)) {
714 glDisable(GL_COLOR_SUM_EXT
);
716 TRACE("Specular colors cannot be disabled in this version of opengl\n");
718 checkGLcall("glDisable(GL_COLOR_SUM)");
720 if (GL_SUPPORT(NV_REGISTER_COMBINERS
)) {
721 GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV
, GL_SPARE0_NV
, GL_UNSIGNED_IDENTITY_NV
, GL_RGB
));
722 checkGLcall("glFinalCombinerInputNV()");
726 TRACE("(%p) : Diffuse (%f,%f,%f,%f)\n", stateblock
->wineD3DDevice
, stateblock
->material
.Diffuse
.r
, stateblock
->material
.Diffuse
.g
,
727 stateblock
->material
.Diffuse
.b
, stateblock
->material
.Diffuse
.a
);
728 TRACE("(%p) : Ambient (%f,%f,%f,%f)\n", stateblock
->wineD3DDevice
, stateblock
->material
.Ambient
.r
, stateblock
->material
.Ambient
.g
,
729 stateblock
->material
.Ambient
.b
, stateblock
->material
.Ambient
.a
);
730 TRACE("(%p) : Specular (%f,%f,%f,%f)\n", stateblock
->wineD3DDevice
, stateblock
->material
.Specular
.r
, stateblock
->material
.Specular
.g
,
731 stateblock
->material
.Specular
.b
, stateblock
->material
.Specular
.a
);
732 TRACE("(%p) : Emissive (%f,%f,%f,%f)\n", stateblock
->wineD3DDevice
, stateblock
->material
.Emissive
.r
, stateblock
->material
.Emissive
.g
,
733 stateblock
->material
.Emissive
.b
, stateblock
->material
.Emissive
.a
);
735 glMaterialfv(GL_FRONT_AND_BACK
, GL_AMBIENT
, (float*) &stateblock
->material
.Ambient
);
736 checkGLcall("glMaterialfv(GL_AMBIENT)");
737 glMaterialfv(GL_FRONT_AND_BACK
, GL_DIFFUSE
, (float*) &stateblock
->material
.Diffuse
);
738 checkGLcall("glMaterialfv(GL_DIFFUSE)");
739 glMaterialfv(GL_FRONT_AND_BACK
, GL_EMISSION
, (float*) &stateblock
->material
.Emissive
);
740 checkGLcall("glMaterialfv(GL_EMISSION)");
743 static void state_texfactor(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
746 /* Note the texture color applies to all textures whereas
747 * GL_TEXTURE_ENV_COLOR applies to active only
750 D3DCOLORTOGLFLOAT4(stateblock
->renderState
[WINED3DRS_TEXTUREFACTOR
], col
);
752 if (!GL_SUPPORT(NV_REGISTER_COMBINERS
)) {
753 /* And now the default texture color as well */
754 for (i
= 0; i
< GL_LIMITS(texture_stages
); i
++) {
755 /* Note the WINED3DRS value applies to all textures, but GL has one
756 * per texture, so apply it now ready to be used!
758 if (GL_SUPPORT(ARB_MULTITEXTURE
)) {
759 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ i
));
760 checkGLcall("glActiveTextureARB");
762 FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
765 glTexEnvfv(GL_TEXTURE_ENV
, GL_TEXTURE_ENV_COLOR
, &col
[0]);
766 checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
769 GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV
, &col
[0]));
774 renderstate_stencil_twosided(IWineD3DStateBlockImpl
*stateblock
, GLint face
, GLint func
, GLint ref
, GLuint mask
, GLint stencilFail
, GLint depthFail
, GLint stencilPass
) {
775 glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT
);
776 checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
777 GL_EXTCALL(glActiveStencilFaceEXT(face
));
778 checkGLcall("glActiveStencilFaceEXT(...)");
779 glStencilFunc(func
, ref
, mask
);
780 checkGLcall("glStencilFunc(...)");
781 glStencilOp(stencilFail
, depthFail
, stencilPass
);
782 checkGLcall("glStencilOp(...)");
786 state_stencil(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
787 DWORD onesided_enable
= FALSE
;
788 DWORD twosided_enable
= FALSE
;
789 GLint func
= GL_ALWAYS
;
790 GLint func_ccw
= GL_ALWAYS
;
793 GLint stencilFail
= GL_KEEP
;
794 GLint depthFail
= GL_KEEP
;
795 GLint stencilPass
= GL_KEEP
;
796 GLint stencilFail_ccw
= GL_KEEP
;
797 GLint depthFail_ccw
= GL_KEEP
;
798 GLint stencilPass_ccw
= GL_KEEP
;
800 /* No stencil test without a stencil buffer */
801 if(stateblock
->wineD3DDevice
->stencilBufferTarget
== NULL
) {
802 glDisable(GL_STENCIL_TEST
);
803 checkGLcall("glDisable GL_STENCIL_TEST");
807 onesided_enable
= stateblock
->renderState
[WINED3DRS_STENCILENABLE
];
808 twosided_enable
= stateblock
->renderState
[WINED3DRS_TWOSIDEDSTENCILMODE
];
809 if( !( func
= CompareFunc(stateblock
->renderState
[WINED3DRS_STENCILFUNC
]) ) )
811 if( !( func_ccw
= CompareFunc(stateblock
->renderState
[WINED3DRS_CCW_STENCILFUNC
]) ) )
812 func_ccw
= GL_ALWAYS
;
813 ref
= stateblock
->renderState
[WINED3DRS_STENCILREF
];
814 mask
= stateblock
->renderState
[WINED3DRS_STENCILMASK
];
815 stencilFail
= StencilOp(stateblock
->renderState
[WINED3DRS_STENCILFAIL
]);
816 depthFail
= StencilOp(stateblock
->renderState
[WINED3DRS_STENCILZFAIL
]);
817 stencilPass
= StencilOp(stateblock
->renderState
[WINED3DRS_STENCILPASS
]);
818 stencilFail_ccw
= StencilOp(stateblock
->renderState
[WINED3DRS_CCW_STENCILFAIL
]);
819 depthFail_ccw
= StencilOp(stateblock
->renderState
[WINED3DRS_CCW_STENCILZFAIL
]);
820 stencilPass_ccw
= StencilOp(stateblock
->renderState
[WINED3DRS_CCW_STENCILPASS
]);
822 TRACE("(onesided %d, twosided %d, ref %x, mask %x, "
823 "GL_FRONT: func: %x, fail %x, zfail %x, zpass %x "
824 "GL_BACK: func: %x, fail %x, zfail %x, zpass %x )\n",
825 onesided_enable
, twosided_enable
, ref
, mask
,
826 func
, stencilFail
, depthFail
, stencilPass
,
827 func_ccw
, stencilFail_ccw
, depthFail_ccw
, stencilPass_ccw
);
829 if (twosided_enable
&& onesided_enable
) {
830 glEnable(GL_STENCIL_TEST
);
831 checkGLcall("glEnable GL_STENCIL_TEST");
833 if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE
)) {
834 /* Apply back first, then front. This function calls glActiveStencilFaceEXT,
835 * which has an effect on the code below too. If we apply the front face
836 * afterwards, we are sure that the active stencil face is set to front,
837 * and other stencil functions which do not use two sided stencil do not have
840 renderstate_stencil_twosided(stateblock
, GL_BACK
, func_ccw
, ref
, mask
,
841 stencilFail_ccw
, depthFail_ccw
, stencilPass_ccw
);
842 renderstate_stencil_twosided(stateblock
, GL_FRONT
, func
, ref
, mask
,
843 stencilFail
, depthFail
, stencilPass
);
844 } else if(GL_SUPPORT(ATI_SEPARATE_STENCIL
)) {
845 GL_EXTCALL(glStencilFuncSeparateATI(func
, func_ccw
, ref
, mask
));
846 checkGLcall("glStencilFuncSeparateATI(...)");
847 GL_EXTCALL(glStencilOpSeparateATI(GL_FRONT
, stencilFail
, depthFail
, stencilPass
));
848 checkGLcall("glStencilOpSeparateATI(GL_FRONT, ...)");
849 GL_EXTCALL(glStencilOpSeparateATI(GL_BACK
, stencilFail_ccw
, depthFail_ccw
, stencilPass_ccw
));
850 checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)");
852 ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n");
854 } else if(onesided_enable
) {
855 if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE
)) {
856 glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT
);
857 checkGLcall("glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
860 /* This code disables the ATI extension as well, since the standard stencil functions are equal
861 * to calling the ATI functions with GL_FRONT_AND_BACK as face parameter
863 glEnable(GL_STENCIL_TEST
);
864 checkGLcall("glEnable GL_STENCIL_TEST");
865 glStencilFunc(func
, ref
, mask
);
866 checkGLcall("glStencilFunc(...)");
867 glStencilOp(stencilFail
, depthFail
, stencilPass
);
868 checkGLcall("glStencilOp(...)");
870 glDisable(GL_STENCIL_TEST
);
871 checkGLcall("glDisable GL_STENCIL_TEST");
875 static void state_stencilwrite(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
878 if(stateblock
->wineD3DDevice
->stencilBufferTarget
) {
879 mask
= stateblock
->renderState
[WINED3DRS_STENCILWRITEMASK
];
884 if(GL_SUPPORT(EXT_STENCIL_TWO_SIDE
)) {
885 GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK
));
886 checkGLcall("glActiveStencilFaceEXT(GL_BACK)");
888 checkGLcall("glStencilMask");
889 GL_EXTCALL(glActiveStencilFaceEXT(GL_FRONT
));
890 checkGLcall("glActiveStencilFaceEXT(GL_FRONT)");
895 checkGLcall("glStencilMask");
898 static void state_fog(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
899 /* TODO: Put this into the vertex type block once that is in the state table */
900 BOOL fogenable
= stateblock
->renderState
[WINED3DRS_FOGENABLE
];
901 BOOL is_ps3
= use_ps(stateblock
->wineD3DDevice
)
902 && ((IWineD3DPixelShaderImpl
*)stateblock
->pixelShader
)->baseShader
.hex_version
>= WINED3DPS_VERSION(3,0);
903 float fogstart
, fogend
;
911 /* No fog? Disable it, and we're done :-) */
913 checkGLcall("glDisable GL_FOG");
914 if( use_ps(stateblock
->wineD3DDevice
)
915 && ((IWineD3DPixelShaderImpl
*)stateblock
->pixelShader
)->baseShader
.hex_version
< WINED3DPS_VERSION(3,0) ) {
916 /* disable fog in the pixel shader
917 * NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but
918 * -1/(e-s) and e/(e-s) respectively.
920 glFogf(GL_FOG_START
, 0.0f
);
921 checkGLcall("glFogf(GL_FOG_START, fogstart)");
922 glFogf(GL_FOG_END
, 1.0f
);
923 checkGLcall("glFogf(GL_FOG_END, fogend)");
928 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_FOGSTART
];
929 fogstart
= tmpvalue
.f
;
930 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_FOGEND
];
935 * With fixed function vertex processing, Direct3D knows 2 different fog input sources.
936 * It can use the Z value of the vertex, or the alpha component of the specular color.
937 * This depends on the fog vertex, fog table and the vertex declaration. If the Z value
938 * is used, fogstart, fogend and the equation type are used, otherwise linear fog with
939 * start = 255, end = 0 is used. Obviously the msdn is not very clear on that.
941 * FOGTABLEMODE != NONE:
942 * The Z value is used, with the equation specified, no matter what vertex type.
944 * FOGTABLEMODE == NONE, FOGVERTEXMODE != NONE, untransformed:
945 * Per vertex fog is calculated using the specified fog equation and the parameters
947 * FOGTABLEMODE == NONE, FOGVERTEXMODE != NONE, transformed, OR
948 * FOGTABLEMODE == NONE, FOGVERTEXMODE == NONE, untransformed:
949 * Linear fog with start = 255.0, end = 0.0, input comes from the specular color
952 * Rules for vertex fog with shaders:
954 * When mixing fixed function functionality with the programmable pipeline, D3D expects
955 * the fog computation to happen during transformation while openGL expects it to happen
956 * during rasterization. Also, prior to pixel shader 3.0 D3D handles fog blending after
957 * the pixel shader while openGL always expects the pixel shader to handle the blending.
958 * To solve this problem, WineD3D does:
959 * 1) implement a linear fog equation and fog blending at the end of every pre 3.0 pixel
961 * and 2) disables the fog computation (in either the fixed function or programmable
962 * rasterizer) if using a vertex program.
965 * If a fogtablemode and a fogvertexmode are specified, table fog is applied (with or
970 if( !use_vs(stateblock
->wineD3DDevice
)
971 && stateblock
->renderState
[WINED3DRS_FOGTABLEMODE
] == WINED3DFOG_NONE
) {
972 FIXME("Implement vertex fog for pixel shader >= 3.0 and fixed function pipeline\n");
976 if (use_vs(stateblock
->wineD3DDevice
)
977 && ((IWineD3DVertexShaderImpl
*)stateblock
->vertexShader
)->baseShader
.reg_maps
.fog
) {
978 if( stateblock
->renderState
[WINED3DRS_FOGTABLEMODE
] != WINED3DFOG_NONE
) {
979 if(!is_ps3
) FIXME("Implement table fog for foggy vertex shader\n");
983 /* Set fog computation in the rasterizer to pass through the value (just blend it) */
984 glFogi(GL_FOG_MODE
, GL_LINEAR
);
985 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
990 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
991 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
992 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
993 context
->fog_coord
= FALSE
;
995 context
->last_was_foggy_shader
= TRUE
;
997 else if( use_ps(stateblock
->wineD3DDevice
) ) {
998 /* NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but
999 * -1/(e-s) and e/(e-s) respectively to simplify fog computation in the shader.
1001 WINED3DFOGMODE mode
;
1002 context
->last_was_foggy_shader
= FALSE
;
1004 /* If both fogmodes are set use the table fog mode */
1005 if(stateblock
->renderState
[WINED3DRS_FOGTABLEMODE
] == WINED3DFOG_NONE
)
1006 mode
= stateblock
->renderState
[WINED3DRS_FOGVERTEXMODE
];
1008 mode
= stateblock
->renderState
[WINED3DRS_FOGTABLEMODE
];
1011 case WINED3DFOG_EXP
:
1012 case WINED3DFOG_EXP2
:
1013 if(!is_ps3
) FIXME("Implement non linear fog for pixel shader < 3.0\n");
1018 case WINED3DFOG_LINEAR
:
1019 fogstart
= -1.0f
/(fogend
-fogstart
);
1020 fogend
*= -fogstart
;
1023 case WINED3DFOG_NONE
:
1024 if(!is_ps3
) FIXME("Implement software vertex fog for pixel shader < 3.0\n");
1028 default: FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock
->renderState
[WINED3DRS_FOGVERTEXMODE
]);
1031 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
1032 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
1033 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
1034 context
->fog_coord
= FALSE
;
1037 /* DX 7 sdk: "If both render states(vertex and table fog) are set to valid modes,
1038 * the system will apply only pixel(=table) fog effects."
1040 else if(stateblock
->renderState
[WINED3DRS_FOGTABLEMODE
] == WINED3DFOG_NONE
) {
1041 glHint(GL_FOG_HINT
, GL_FASTEST
);
1042 checkGLcall("glHint(GL_FOG_HINT, GL_FASTEST)");
1043 context
->last_was_foggy_shader
= FALSE
;
1045 switch (stateblock
->renderState
[WINED3DRS_FOGVERTEXMODE
]) {
1046 /* If processed vertices are used, fall through to the NONE case */
1047 case WINED3DFOG_EXP
: {
1048 if(!context
->last_was_rhw
) {
1049 glFogi(GL_FOG_MODE
, GL_EXP
);
1050 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
1051 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
1052 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
1053 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
1054 context
->fog_coord
= FALSE
;
1059 case WINED3DFOG_EXP2
: {
1060 if(!context
->last_was_rhw
) {
1061 glFogi(GL_FOG_MODE
, GL_EXP2
);
1062 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
1063 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
1064 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
1065 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
1066 context
->fog_coord
= FALSE
;
1071 case WINED3DFOG_LINEAR
: {
1072 if(!context
->last_was_rhw
) {
1073 glFogi(GL_FOG_MODE
, GL_LINEAR
);
1074 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
1075 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
1076 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
1077 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
1078 context
->fog_coord
= FALSE
;
1083 case WINED3DFOG_NONE
: {
1084 /* Both are none? According to msdn the alpha channel of the specular
1085 * color contains a fog factor. Set it in drawStridedSlow.
1086 * Same happens with Vertexfog on transformed vertices
1088 if(GL_SUPPORT(EXT_FOG_COORD
)) {
1089 if(context
->fog_coord
== FALSE
) {
1090 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FOG_COORDINATE_EXT
);
1091 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)");
1092 context
->fog_coord
= TRUE
;
1094 glFogi(GL_FOG_MODE
, GL_LINEAR
);
1095 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
1099 /* Disable GL fog, handle this in software in drawStridedSlow */
1104 default: FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock
->renderState
[WINED3DRS_FOGVERTEXMODE
]);
1107 glHint(GL_FOG_HINT
, GL_NICEST
);
1108 checkGLcall("glHint(GL_FOG_HINT, GL_NICEST)");
1109 context
->last_was_foggy_shader
= FALSE
;
1111 switch (stateblock
->renderState
[WINED3DRS_FOGTABLEMODE
]) {
1112 case WINED3DFOG_EXP
:
1113 glFogi(GL_FOG_MODE
, GL_EXP
);
1114 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
1115 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
1116 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
1117 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
1118 context
->fog_coord
= FALSE
;
1122 case WINED3DFOG_EXP2
:
1123 glFogi(GL_FOG_MODE
, GL_EXP2
);
1124 checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
1125 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
1126 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
1127 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
1128 context
->fog_coord
= FALSE
;
1132 case WINED3DFOG_LINEAR
:
1133 glFogi(GL_FOG_MODE
, GL_LINEAR
);
1134 checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
1135 if(GL_SUPPORT(EXT_FOG_COORD
) && context
->fog_coord
) {
1136 glFogi(GL_FOG_COORDINATE_SOURCE_EXT
, GL_FRAGMENT_DEPTH_EXT
);
1137 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
1138 context
->fog_coord
= FALSE
;
1142 case WINED3DFOG_NONE
: /* Won't happen */
1144 FIXME("Unexpected WINED3DRS_FOGTABLEMODE %d\n", stateblock
->renderState
[WINED3DRS_FOGTABLEMODE
]);
1150 checkGLcall("glEnable GL_FOG");
1152 if(fogstart
!= fogend
)
1154 glFogfv(GL_FOG_START
, &fogstart
);
1155 checkGLcall("glFogf(GL_FOG_START, fogstart)");
1156 TRACE("Fog Start == %f\n", fogstart
);
1158 glFogfv(GL_FOG_END
, &fogend
);
1159 checkGLcall("glFogf(GL_FOG_END, fogend)");
1160 TRACE("Fog End == %f\n", fogend
);
1164 glFogf(GL_FOG_START
, -1.0 / 0.0);
1165 checkGLcall("glFogf(GL_FOG_START, fogstart)");
1166 TRACE("Fog Start == %f\n", fogstart
);
1168 glFogf(GL_FOG_END
, 0.0);
1169 checkGLcall("glFogf(GL_FOG_END, fogend)");
1170 TRACE("Fog End == %f\n", fogend
);
1174 checkGLcall("glDisable GL_FOG");
1175 if( use_ps(stateblock
->wineD3DDevice
) ) {
1176 /* disable fog in the pixel shader
1177 * NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but
1178 * -1/(e-s) and e/(e-s) respectively.
1180 glFogf(GL_FOG_START
, 0.0f
);
1181 checkGLcall("glFogf(GL_FOG_START, fogstart)");
1182 glFogf(GL_FOG_END
, 1.0f
);
1183 checkGLcall("glFogf(GL_FOG_END, fogend)");
1188 static void state_rangefog(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1189 if(stateblock
->renderState
[WINED3DRS_RANGEFOGENABLE
]) {
1190 if (GL_SUPPORT(NV_FOG_DISTANCE
)) {
1191 glFogi(GL_FOG_DISTANCE_MODE_NV
, GL_EYE_RADIAL_NV
);
1192 checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV)");
1194 WARN("Range fog enabled, but not supported by this opengl implementation\n");
1197 if (GL_SUPPORT(NV_FOG_DISTANCE
)) {
1198 glFogi(GL_FOG_DISTANCE_MODE_NV
, GL_EYE_PLANE_ABSOLUTE_NV
);
1199 checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV)");
1204 static void state_fogcolor(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1206 D3DCOLORTOGLFLOAT4(stateblock
->renderState
[WINED3DRS_FOGCOLOR
], col
);
1207 glFogfv(GL_FOG_COLOR
, &col
[0]);
1208 checkGLcall("glFog GL_FOG_COLOR");
1211 static void state_fogdensity(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1216 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_FOGDENSITY
];
1217 glFogfv(GL_FOG_DENSITY
, &tmpvalue
.f
);
1218 checkGLcall("glFogf(GL_FOG_DENSITY, (float) Value)");
1221 /* TODO: Merge with primitive type + init_materials()!! */
1222 static void state_colormat(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1223 IWineD3DDeviceImpl
*device
= stateblock
->wineD3DDevice
;
1225 WineDirect3DStridedData
*diffuse
= &device
->strided_streams
.u
.s
.diffuse
;
1226 BOOL isDiffuseSupplied
;
1228 /* Depends on the decoded vertex declaration to read the existence of diffuse data.
1229 * The vertex declaration will call this function if the fixed function pipeline is used.
1232 if(isStateDirty(context
, STATE_VDECL
)) {
1236 isDiffuseSupplied
= diffuse
->lpData
|| diffuse
->VBO
;
1238 context
->num_untracked_materials
= 0;
1239 if (isDiffuseSupplied
&& stateblock
->renderState
[WINED3DRS_COLORVERTEX
]) {
1240 TRACE("diff %d, amb %d, emis %d, spec %d\n",
1241 stateblock
->renderState
[WINED3DRS_DIFFUSEMATERIALSOURCE
],
1242 stateblock
->renderState
[WINED3DRS_AMBIENTMATERIALSOURCE
],
1243 stateblock
->renderState
[WINED3DRS_EMISSIVEMATERIALSOURCE
],
1244 stateblock
->renderState
[WINED3DRS_SPECULARMATERIALSOURCE
]);
1246 if (stateblock
->renderState
[WINED3DRS_DIFFUSEMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1247 if (stateblock
->renderState
[WINED3DRS_AMBIENTMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1248 Parm
= GL_AMBIENT_AND_DIFFUSE
;
1252 if(stateblock
->renderState
[WINED3DRS_EMISSIVEMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1253 context
->untracked_materials
[context
->num_untracked_materials
] = GL_EMISSION
;
1254 context
->num_untracked_materials
++;
1256 if(stateblock
->renderState
[WINED3DRS_SPECULARMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1257 context
->untracked_materials
[context
->num_untracked_materials
] = GL_SPECULAR
;
1258 context
->num_untracked_materials
++;
1260 } else if (stateblock
->renderState
[WINED3DRS_AMBIENTMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1262 if(stateblock
->renderState
[WINED3DRS_EMISSIVEMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1263 context
->untracked_materials
[context
->num_untracked_materials
] = GL_EMISSION
;
1264 context
->num_untracked_materials
++;
1266 if(stateblock
->renderState
[WINED3DRS_SPECULARMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1267 context
->untracked_materials
[context
->num_untracked_materials
] = GL_SPECULAR
;
1268 context
->num_untracked_materials
++;
1270 } else if (stateblock
->renderState
[WINED3DRS_EMISSIVEMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1272 if(stateblock
->renderState
[WINED3DRS_SPECULARMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1273 context
->untracked_materials
[context
->num_untracked_materials
] = GL_SPECULAR
;
1274 context
->num_untracked_materials
++;
1276 } else if (stateblock
->renderState
[WINED3DRS_SPECULARMATERIALSOURCE
] == WINED3DMCS_COLOR1
) {
1281 /* Nothing changed, return. */
1282 if (Parm
== context
->tracking_parm
) return;
1285 glDisable(GL_COLOR_MATERIAL
);
1286 checkGLcall("glDisable GL_COLOR_MATERIAL");
1288 glColorMaterial(GL_FRONT_AND_BACK
, Parm
);
1289 checkGLcall("glColorMaterial(GL_FRONT_AND_BACK, Parm)");
1290 glEnable(GL_COLOR_MATERIAL
);
1291 checkGLcall("glEnable(GL_COLOR_MATERIAL)");
1294 /* Apparently calls to glMaterialfv are ignored for properties we're
1295 * tracking with glColorMaterial, so apply those here. */
1296 switch (context
->tracking_parm
) {
1297 case GL_AMBIENT_AND_DIFFUSE
:
1298 glMaterialfv(GL_FRONT_AND_BACK
, GL_AMBIENT
, (float*)&device
->updateStateBlock
->material
.Ambient
);
1299 glMaterialfv(GL_FRONT_AND_BACK
, GL_DIFFUSE
, (float*)&device
->updateStateBlock
->material
.Diffuse
);
1300 checkGLcall("glMaterialfv");
1304 glMaterialfv(GL_FRONT_AND_BACK
, GL_DIFFUSE
, (float*)&device
->updateStateBlock
->material
.Diffuse
);
1305 checkGLcall("glMaterialfv");
1309 glMaterialfv(GL_FRONT_AND_BACK
, GL_AMBIENT
, (float*)&device
->updateStateBlock
->material
.Ambient
);
1310 checkGLcall("glMaterialfv");
1314 glMaterialfv(GL_FRONT_AND_BACK
, GL_EMISSION
, (float*)&device
->updateStateBlock
->material
.Emissive
);
1315 checkGLcall("glMaterialfv");
1319 /* Only change material color if specular is enabled, otherwise it is set to black */
1320 if (device
->stateBlock
->renderState
[WINED3DRS_SPECULARENABLE
]) {
1321 glMaterialfv(GL_FRONT_AND_BACK
, GL_SPECULAR
, (float*)&device
->updateStateBlock
->material
.Specular
);
1322 checkGLcall("glMaterialfv");
1324 float black
[4] = {0.0f
, 0.0f
, 0.0f
, 0.0f
};
1325 glMaterialfv(GL_FRONT_AND_BACK
, GL_SPECULAR
, &black
[0]);
1326 checkGLcall("glMaterialfv");
1331 context
->tracking_parm
= Parm
;
1334 static void state_linepattern(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1337 WINED3DLINEPATTERN lp
;
1339 tmppattern
.d
= stateblock
->renderState
[WINED3DRS_LINEPATTERN
];
1341 TRACE("Line pattern: repeat %d bits %x\n", tmppattern
.lp
.wRepeatFactor
, tmppattern
.lp
.wLinePattern
);
1343 if (tmppattern
.lp
.wRepeatFactor
) {
1344 glLineStipple(tmppattern
.lp
.wRepeatFactor
, tmppattern
.lp
.wLinePattern
);
1345 checkGLcall("glLineStipple(repeat, linepattern)");
1346 glEnable(GL_LINE_STIPPLE
);
1347 checkGLcall("glEnable(GL_LINE_STIPPLE);");
1349 glDisable(GL_LINE_STIPPLE
);
1350 checkGLcall("glDisable(GL_LINE_STIPPLE);");
1354 static void state_zbias(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1360 if (stateblock
->renderState
[WINED3DRS_ZBIAS
]) {
1361 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_ZBIAS
];
1362 TRACE("ZBias value %f\n", tmpvalue
.f
);
1363 glPolygonOffset(0, -tmpvalue
.f
);
1364 checkGLcall("glPolygonOffset(0, -Value)");
1365 glEnable(GL_POLYGON_OFFSET_FILL
);
1366 checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL);");
1367 glEnable(GL_POLYGON_OFFSET_LINE
);
1368 checkGLcall("glEnable(GL_POLYGON_OFFSET_LINE);");
1369 glEnable(GL_POLYGON_OFFSET_POINT
);
1370 checkGLcall("glEnable(GL_POLYGON_OFFSET_POINT);");
1372 glDisable(GL_POLYGON_OFFSET_FILL
);
1373 checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL);");
1374 glDisable(GL_POLYGON_OFFSET_LINE
);
1375 checkGLcall("glDisable(GL_POLYGON_OFFSET_LINE);");
1376 glDisable(GL_POLYGON_OFFSET_POINT
);
1377 checkGLcall("glDisable(GL_POLYGON_OFFSET_POINT);");
1382 static void state_normalize(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1383 if(isStateDirty(context
, STATE_VDECL
)) {
1386 /* Without vertex normals, we set the current normal to 0/0/0 to remove the diffuse factor
1387 * from the opengl lighting equation, as d3d does. Normalization of 0/0/0 can lead to a division
1388 * by zero and is not properly defined in opengl, so avoid it
1390 if (stateblock
->renderState
[WINED3DRS_NORMALIZENORMALS
] && (
1391 stateblock
->wineD3DDevice
->strided_streams
.u
.s
.normal
.lpData
||
1392 stateblock
->wineD3DDevice
->strided_streams
.u
.s
.normal
.VBO
)) {
1393 glEnable(GL_NORMALIZE
);
1394 checkGLcall("glEnable(GL_NORMALIZE);");
1396 glDisable(GL_NORMALIZE
);
1397 checkGLcall("glDisable(GL_NORMALIZE);");
1401 static void state_psizemin(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1407 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_POINTSIZE_MIN
];
1408 if(GL_SUPPORT(ARB_POINT_PARAMETERS
)) {
1409 GL_EXTCALL(glPointParameterfARB
)(GL_POINT_SIZE_MIN_ARB
, tmpvalue
.f
);
1410 checkGLcall("glPointParameterfARB(...)");
1412 else if(GL_SUPPORT(EXT_POINT_PARAMETERS
)) {
1413 GL_EXTCALL(glPointParameterfEXT
)(GL_POINT_SIZE_MIN_EXT
, tmpvalue
.f
);
1414 checkGLcall("glPointParameterfEXT(...)");
1415 } else if(tmpvalue
.f
!= 1.0) {
1416 FIXME("WINED3DRS_POINTSIZE_MIN not supported on this opengl, value is %f\n", tmpvalue
.f
);
1420 static void state_psizemax(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1426 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_POINTSIZE_MAX
];
1427 if(GL_SUPPORT(ARB_POINT_PARAMETERS
)) {
1428 GL_EXTCALL(glPointParameterfARB
)(GL_POINT_SIZE_MAX_ARB
, tmpvalue
.f
);
1429 checkGLcall("glPointParameterfARB(...)");
1431 else if(GL_SUPPORT(EXT_POINT_PARAMETERS
)) {
1432 GL_EXTCALL(glPointParameterfEXT
)(GL_POINT_SIZE_MAX_EXT
, tmpvalue
.f
);
1433 checkGLcall("glPointParameterfEXT(...)");
1434 } else if(tmpvalue
.f
!= 64.0) {
1435 FIXME("WINED3DRS_POINTSIZE_MAX not supported on this opengl, value is %f\n", tmpvalue
.f
);
1439 static void state_pscale(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1440 /* TODO: Group this with the viewport */
1442 * POINTSCALEENABLE controls how point size value is treated. If set to
1443 * true, the point size is scaled with respect to height of viewport.
1444 * When set to false point size is in pixels.
1447 /* Default values */
1448 GLfloat att
[3] = {1.0f
, 0.0f
, 0.0f
};
1452 } pointSize
, A
, B
, C
;
1454 pointSize
.d
= stateblock
->renderState
[WINED3DRS_POINTSIZE
];
1455 A
.d
= stateblock
->renderState
[WINED3DRS_POINTSCALE_A
];
1456 B
.d
= stateblock
->renderState
[WINED3DRS_POINTSCALE_B
];
1457 C
.d
= stateblock
->renderState
[WINED3DRS_POINTSCALE_C
];
1459 if(stateblock
->renderState
[WINED3DRS_POINTSCALEENABLE
]) {
1460 GLfloat scaleFactor
;
1461 float h
= stateblock
->viewport
.Height
;
1463 if(pointSize
.f
< GL_LIMITS(pointsizemin
)) {
1465 * Minimum valid point size for OpenGL is driver specific. For Direct3D it is
1466 * 0.0f. This means that OpenGL will clamp really small point sizes to the
1467 * driver minimum. To correct for this we need to multiply by the scale factor when sizes
1468 * are less than 1.0f. scale_factor = 1.0f / point_size.
1470 scaleFactor
= pointSize
.f
/ GL_LIMITS(pointsizemin
);
1471 /* Clamp the point size, don't rely on the driver to do it. MacOS says min point size
1472 * is 1.0, but then accepts points below that and draws too small points
1474 pointSize
.f
= GL_LIMITS(pointsizemin
);
1475 } else if(pointSize
.f
> GL_LIMITS(pointsize
)) {
1476 /* gl already scales the input to glPointSize,
1477 * d3d scales the result after the point size scale.
1478 * If the point size is bigger than the max size, use the
1479 * scaling to scale it bigger, and set the gl point size to max
1481 scaleFactor
= pointSize
.f
/ GL_LIMITS(pointsize
);
1482 TRACE("scale: %f\n", scaleFactor
);
1483 pointSize
.f
= GL_LIMITS(pointsize
);
1487 scaleFactor
= pow(h
* scaleFactor
, 2);
1489 att
[0] = A
.f
/ scaleFactor
;
1490 att
[1] = B
.f
/ scaleFactor
;
1491 att
[2] = C
.f
/ scaleFactor
;
1494 if(GL_SUPPORT(ARB_POINT_PARAMETERS
)) {
1495 GL_EXTCALL(glPointParameterfvARB
)(GL_POINT_DISTANCE_ATTENUATION_ARB
, att
);
1496 checkGLcall("glPointParameterfvARB(GL_DISTANCE_ATTENUATION_ARB, ...)");
1498 else if(GL_SUPPORT(EXT_POINT_PARAMETERS
)) {
1499 GL_EXTCALL(glPointParameterfvEXT
)(GL_DISTANCE_ATTENUATION_EXT
, att
);
1500 checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...)");
1501 } else if(stateblock
->renderState
[WINED3DRS_POINTSCALEENABLE
]) {
1502 WARN("POINT_PARAMETERS not supported in this version of opengl\n");
1505 glPointSize(pointSize
.f
);
1506 checkGLcall("glPointSize(...);");
1509 static void state_colorwrite(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1510 DWORD Value
= stateblock
->renderState
[WINED3DRS_COLORWRITEENABLE
];
1512 TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
1513 Value
& WINED3DCOLORWRITEENABLE_RED
? 1 : 0,
1514 Value
& WINED3DCOLORWRITEENABLE_GREEN
? 1 : 0,
1515 Value
& WINED3DCOLORWRITEENABLE_BLUE
? 1 : 0,
1516 Value
& WINED3DCOLORWRITEENABLE_ALPHA
? 1 : 0);
1517 glColorMask(Value
& WINED3DCOLORWRITEENABLE_RED
? GL_TRUE
: GL_FALSE
,
1518 Value
& WINED3DCOLORWRITEENABLE_GREEN
? GL_TRUE
: GL_FALSE
,
1519 Value
& WINED3DCOLORWRITEENABLE_BLUE
? GL_TRUE
: GL_FALSE
,
1520 Value
& WINED3DCOLORWRITEENABLE_ALPHA
? GL_TRUE
: GL_FALSE
);
1521 checkGLcall("glColorMask(...)");
1523 /* depends on WINED3DRS_COLORWRITEENABLE. */
1524 if(stateblock
->renderState
[WINED3DRS_COLORWRITEENABLE1
] != 0x0000000F ||
1525 stateblock
->renderState
[WINED3DRS_COLORWRITEENABLE2
] != 0x0000000F ||
1526 stateblock
->renderState
[WINED3DRS_COLORWRITEENABLE3
] != 0x0000000F ) {
1527 ERR("(WINED3DRS_COLORWRITEENABLE1/2/3,%d,%d,%d) not yet implemented. Missing of cap D3DPMISCCAPS_INDEPENDENTWRITEMASKS wasn't honored?\n",
1528 stateblock
->renderState
[WINED3DRS_COLORWRITEENABLE1
],
1529 stateblock
->renderState
[WINED3DRS_COLORWRITEENABLE2
],
1530 stateblock
->renderState
[WINED3DRS_COLORWRITEENABLE3
]);
1534 static void state_localviewer(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1535 if(stateblock
->renderState
[WINED3DRS_LOCALVIEWER
]) {
1536 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER
, 1);
1537 checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1)");
1539 glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER
, 0);
1540 checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0)");
1544 static void state_lastpixel(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1545 if(stateblock
->renderState
[WINED3DRS_LASTPIXEL
]) {
1546 TRACE("Last Pixel Drawing Enabled\n");
1548 static BOOL first
= TRUE
;
1550 FIXME("Last Pixel Drawing Disabled, not handled yet\n");
1553 TRACE("Last Pixel Drawing Disabled, not handled yet\n");
1558 static void state_pointsprite(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1559 /* TODO: NV_POINT_SPRITE */
1560 if (!GL_SUPPORT(ARB_POINT_SPRITE
)) {
1561 TRACE("Point sprites not supported\n");
1565 if (stateblock
->renderState
[WINED3DRS_POINTSPRITEENABLE
]) {
1566 glEnable(GL_POINT_SPRITE_ARB
);
1567 checkGLcall("glEnable(GL_POINT_SPRITE_ARB)");
1569 glDisable(GL_POINT_SPRITE_ARB
);
1570 checkGLcall("glDisable(GL_POINT_SPRITE_ARB)");
1574 static void state_wrap(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1576 http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/texture/
1577 http://www.gamedev.net/reference/programming/features/rendererdll3/page2.asp
1578 Discussion on the ways to turn on WRAPing to solve an OpenGL conversion problem.
1579 http://www.flipcode.org/cgi-bin/fcmsg.cgi?thread_show=10248
1581 so far as I can tell, wrapping and texture-coordinate generate go hand in hand,
1584 if(stateblock
->renderState
[WINED3DRS_WRAP0
] ||
1585 stateblock
->renderState
[WINED3DRS_WRAP1
] ||
1586 stateblock
->renderState
[WINED3DRS_WRAP2
] ||
1587 stateblock
->renderState
[WINED3DRS_WRAP3
] ||
1588 stateblock
->renderState
[WINED3DRS_WRAP4
] ||
1589 stateblock
->renderState
[WINED3DRS_WRAP5
] ||
1590 stateblock
->renderState
[WINED3DRS_WRAP6
] ||
1591 stateblock
->renderState
[WINED3DRS_WRAP7
] ||
1592 stateblock
->renderState
[WINED3DRS_WRAP8
] ||
1593 stateblock
->renderState
[WINED3DRS_WRAP9
] ||
1594 stateblock
->renderState
[WINED3DRS_WRAP10
] ||
1595 stateblock
->renderState
[WINED3DRS_WRAP11
] ||
1596 stateblock
->renderState
[WINED3DRS_WRAP12
] ||
1597 stateblock
->renderState
[WINED3DRS_WRAP13
] ||
1598 stateblock
->renderState
[WINED3DRS_WRAP14
] ||
1599 stateblock
->renderState
[WINED3DRS_WRAP15
] ) {
1600 FIXME("(WINED3DRS_WRAP0) Texture wraping not yet supported\n");
1604 static void state_multisampleaa(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1605 if( GL_SUPPORT(ARB_MULTISAMPLE
) ) {
1606 if(stateblock
->renderState
[WINED3DRS_MULTISAMPLEANTIALIAS
]) {
1607 glEnable(GL_MULTISAMPLE_ARB
);
1608 checkGLcall("glEnable(GL_MULTISAMPLE_ARB)");
1610 glDisable(GL_MULTISAMPLE_ARB
);
1611 checkGLcall("glDisable(GL_MULTISAMPLE_ARB)");
1614 if(stateblock
->renderState
[WINED3DRS_MULTISAMPLEANTIALIAS
]) {
1615 WARN("Multisample antialiasing not supported by gl\n");
1620 static void state_scissor(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1621 if(stateblock
->renderState
[WINED3DRS_SCISSORTESTENABLE
]) {
1622 glEnable(GL_SCISSOR_TEST
);
1623 checkGLcall("glEnable(GL_SCISSOR_TEST)");
1625 glDisable(GL_SCISSOR_TEST
);
1626 checkGLcall("glDisable(GL_SCISSOR_TEST)");
1630 static void state_depthbias(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1636 if(stateblock
->renderState
[WINED3DRS_SLOPESCALEDEPTHBIAS
] ||
1637 stateblock
->renderState
[WINED3DRS_DEPTHBIAS
]) {
1638 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_SLOPESCALEDEPTHBIAS
];
1639 glEnable(GL_POLYGON_OFFSET_FILL
);
1640 checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
1641 glPolygonOffset(tmpvalue
.f
, *((float*)&stateblock
->renderState
[WINED3DRS_DEPTHBIAS
]));
1642 checkGLcall("glPolygonOffset(...)");
1644 glDisable(GL_POLYGON_OFFSET_FILL
);
1645 checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
1649 static void state_perspective(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1650 if (stateblock
->renderState
[WINED3DRS_TEXTUREPERSPECTIVE
]) {
1651 glHint(GL_PERSPECTIVE_CORRECTION_HINT
, GL_NICEST
);
1652 checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)");
1654 glHint(GL_PERSPECTIVE_CORRECTION_HINT
, GL_FASTEST
);
1655 checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)");
1659 static void state_stippledalpha(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1661 if (stateblock
->renderState
[WINED3DRS_STIPPLEDALPHA
])
1662 FIXME(" Stippled Alpha not supported yet.\n");
1665 static void state_antialias(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1667 if (stateblock
->renderState
[WINED3DRS_ANTIALIAS
])
1668 FIXME(" Antialias not supported yet.\n");
1671 static void state_multisampmask(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1673 if (stateblock
->renderState
[WINED3DRS_MULTISAMPLEMASK
] != 0xFFFFFFFF)
1674 FIXME("(WINED3DRS_MULTISAMPLEMASK,%d) not yet implemented\n", stateblock
->renderState
[WINED3DRS_MULTISAMPLEMASK
]);
1677 static void state_patchedgestyle(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1679 if (stateblock
->renderState
[WINED3DRS_PATCHEDGESTYLE
] != WINED3DPATCHEDGE_DISCRETE
)
1680 FIXME("(WINED3DRS_PATCHEDGESTYLE,%d) not yet implemented\n", stateblock
->renderState
[WINED3DRS_PATCHEDGESTYLE
]);
1683 static void state_patchsegments(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1691 if (stateblock
->renderState
[WINED3DRS_PATCHSEGMENTS
] != tmpvalue
.d
)
1693 static BOOL displayed
= FALSE
;
1695 tmpvalue
.d
= stateblock
->renderState
[WINED3DRS_PATCHSEGMENTS
];
1697 FIXME("(WINED3DRS_PATCHSEGMENTS,%f) not yet implemented\n", tmpvalue
.f
);
1703 static void state_positiondegree(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1705 if (stateblock
->renderState
[WINED3DRS_POSITIONDEGREE
] != WINED3DDEGREE_CUBIC
)
1706 FIXME("(WINED3DRS_POSITIONDEGREE,%d) not yet implemented\n", stateblock
->renderState
[WINED3DRS_POSITIONDEGREE
]);
1709 static void state_normaldegree(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1711 if (stateblock
->renderState
[WINED3DRS_NORMALDEGREE
] != WINED3DDEGREE_LINEAR
)
1712 FIXME("(WINED3DRS_NORMALDEGREE,%d) not yet implemented\n", stateblock
->renderState
[WINED3DRS_NORMALDEGREE
]);
1715 static void state_tessellation(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1717 if(stateblock
->renderState
[WINED3DRS_ENABLEADAPTIVETESSELLATION
])
1718 FIXME("(WINED3DRS_ENABLEADAPTIVETESSELLATION,%d) not yet implemented\n", stateblock
->renderState
[WINED3DRS_ENABLEADAPTIVETESSELLATION
]);
1721 static void state_wrapu(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1722 if(stateblock
->renderState
[WINED3DRS_WRAPU
]) {
1723 FIXME("Render state WINED3DRS_WRAPU not implemented yet\n");
1727 static void state_wrapv(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1728 if(stateblock
->renderState
[WINED3DRS_WRAPV
]) {
1729 FIXME("Render state WINED3DRS_WRAPV not implemented yet\n");
1733 static void state_monoenable(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1734 if(stateblock
->renderState
[WINED3DRS_MONOENABLE
]) {
1735 FIXME("Render state WINED3DRS_MONOENABLE not implemented yet\n");
1739 static void state_rop2(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1740 if(stateblock
->renderState
[WINED3DRS_ROP2
]) {
1741 FIXME("Render state WINED3DRS_ROP2 not implemented yet\n");
1745 static void state_planemask(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1746 if(stateblock
->renderState
[WINED3DRS_PLANEMASK
]) {
1747 FIXME("Render state WINED3DRS_PLANEMASK not implemented yet\n");
1751 static void state_subpixel(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1752 if(stateblock
->renderState
[WINED3DRS_SUBPIXEL
]) {
1753 FIXME("Render state WINED3DRS_SUBPIXEL not implemented yet\n");
1757 static void state_subpixelx(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1758 if(stateblock
->renderState
[WINED3DRS_SUBPIXELX
]) {
1759 FIXME("Render state WINED3DRS_SUBPIXELX not implemented yet\n");
1763 static void state_stippleenable(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1764 if(stateblock
->renderState
[WINED3DRS_STIPPLEENABLE
]) {
1765 FIXME("Render state WINED3DRS_STIPPLEENABLE not implemented yet\n");
1769 static void state_bordercolor(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1770 if(stateblock
->renderState
[WINED3DRS_BORDERCOLOR
]) {
1771 FIXME("Render state WINED3DRS_BORDERCOLOR not implemented yet\n");
1775 static void state_mipmaplodbias(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1776 if(stateblock
->renderState
[WINED3DRS_MIPMAPLODBIAS
]) {
1777 FIXME("Render state WINED3DRS_MIPMAPLODBIAS not implemented yet\n");
1781 static void state_anisotropy(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1782 if(stateblock
->renderState
[WINED3DRS_ANISOTROPY
]) {
1783 FIXME("Render state WINED3DRS_ANISOTROPY not implemented yet\n");
1787 static void state_flushbatch(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1788 if(stateblock
->renderState
[WINED3DRS_FLUSHBATCH
]) {
1789 FIXME("Render state WINED3DRS_FLUSHBATCH not implemented yet\n");
1793 static void state_translucentsi(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1794 if(stateblock
->renderState
[WINED3DRS_TRANSLUCENTSORTINDEPENDENT
]) {
1795 FIXME("Render state WINED3DRS_TRANSLUCENTSORTINDEPENDENT not implemented yet\n");
1799 static void state_extents(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1800 if(stateblock
->renderState
[WINED3DRS_EXTENTS
]) {
1801 FIXME("Render state WINED3DRS_EXTENTS not implemented yet\n");
1805 static void state_ckeyblend(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1806 if(stateblock
->renderState
[WINED3DRS_COLORKEYBLENDENABLE
]) {
1807 FIXME("Render state WINED3DRS_COLORKEYBLENDENABLE not implemented yet\n");
1811 static void tex_colorop(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1812 DWORD stage
= (state
- STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE
;
1813 DWORD mapped_stage
= stateblock
->wineD3DDevice
->texUnitMap
[stage
];
1814 BOOL tex_used
= stateblock
->wineD3DDevice
->fixed_function_usage_map
[stage
];
1816 TRACE("Setting color op for stage %d\n", stage
);
1818 if (stateblock
->pixelShader
&& stateblock
->wineD3DDevice
->ps_selected_mode
!= SHADER_NONE
&&
1819 ((IWineD3DPixelShaderImpl
*)stateblock
->pixelShader
)->baseShader
.function
) {
1820 /* Using a pixel shader? Don't care for anything here, the shader applying does it */
1824 if (stage
!= mapped_stage
) WARN("Using non 1:1 mapping: %d -> %d!\n", stage
, mapped_stage
);
1826 if (mapped_stage
!= -1) {
1827 if (GL_SUPPORT(ARB_MULTITEXTURE
)) {
1828 if (tex_used
&& mapped_stage
>= GL_LIMITS(textures
)) {
1829 FIXME("Attempt to enable unsupported stage!\n");
1832 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
1833 checkGLcall("glActiveTextureARB");
1834 } else if (stage
> 0) {
1835 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
1840 if (GL_SUPPORT(NV_REGISTER_COMBINERS
)) {
1841 if(stateblock
->lowest_disabled_stage
> 0) {
1842 glEnable(GL_REGISTER_COMBINERS_NV
);
1843 GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV
, stateblock
->lowest_disabled_stage
));
1845 glDisable(GL_REGISTER_COMBINERS_NV
);
1848 if(stage
>= stateblock
->lowest_disabled_stage
) {
1849 TRACE("Stage disabled\n");
1850 if (mapped_stage
!= -1) {
1851 /* Disable everything here */
1852 glDisable(GL_TEXTURE_2D
);
1853 checkGLcall("glDisable(GL_TEXTURE_2D)");
1854 glDisable(GL_TEXTURE_3D
);
1855 checkGLcall("glDisable(GL_TEXTURE_3D)");
1856 if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP
)) {
1857 glDisable(GL_TEXTURE_CUBE_MAP_ARB
);
1858 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
1860 if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE
)) {
1861 glDisable(GL_TEXTURE_RECTANGLE_ARB
);
1862 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
1864 if(GL_SUPPORT(NV_TEXTURE_SHADER2
) && mapped_stage
< GL_LIMITS(textures
)) {
1865 glTexEnvi(GL_TEXTURE_SHADER_NV
, GL_SHADER_OPERATION_NV
, GL_NONE
);
1872 /* The sampler will also activate the correct texture dimensions, so no need to do it here
1873 * if the sampler for this stage is dirty
1875 if(!isStateDirty(context
, STATE_SAMPLER(stage
))) {
1876 if (tex_used
) texture_activate_dimensions(stage
, stateblock
, context
);
1879 /* Set the texture combiners */
1880 if (GL_SUPPORT(NV_REGISTER_COMBINERS
)) {
1881 set_tex_op_nvrc((IWineD3DDevice
*)stateblock
->wineD3DDevice
, FALSE
, stage
,
1882 stateblock
->textureState
[stage
][WINED3DTSS_COLOROP
],
1883 stateblock
->textureState
[stage
][WINED3DTSS_COLORARG1
],
1884 stateblock
->textureState
[stage
][WINED3DTSS_COLORARG2
],
1885 stateblock
->textureState
[stage
][WINED3DTSS_COLORARG0
],
1887 stateblock
->textureState
[stage
][WINED3DTSS_RESULTARG
]);
1889 /* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set,
1890 * thus the texture shader may have to be updated
1892 if(GL_SUPPORT(NV_TEXTURE_SHADER2
)) {
1893 BOOL usesBump
= (stateblock
->textureState
[stage
][WINED3DTSS_COLOROP
] == WINED3DTOP_BUMPENVMAPLUMINANCE
||
1894 stateblock
->textureState
[stage
][WINED3DTSS_COLOROP
] == WINED3DTOP_BUMPENVMAP
) ? TRUE
: FALSE
;
1895 BOOL usedBump
= (context
->texShaderBumpMap
& 1 << (stage
+ 1)) ? TRUE
: FALSE
;
1896 if(usesBump
!= usedBump
) {
1897 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
+ 1));
1898 checkGLcall("glActiveTextureARB");
1899 texture_activate_dimensions(stage
+ 1, stateblock
, context
);
1900 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
1901 checkGLcall("glActiveTextureARB");
1905 set_tex_op((IWineD3DDevice
*)stateblock
->wineD3DDevice
, FALSE
, stage
,
1906 stateblock
->textureState
[stage
][WINED3DTSS_COLOROP
],
1907 stateblock
->textureState
[stage
][WINED3DTSS_COLORARG1
],
1908 stateblock
->textureState
[stage
][WINED3DTSS_COLORARG2
],
1909 stateblock
->textureState
[stage
][WINED3DTSS_COLORARG0
]);
1913 static void tex_alphaop(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
1914 DWORD stage
= (state
- STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE
;
1915 DWORD mapped_stage
= stateblock
->wineD3DDevice
->texUnitMap
[stage
];
1916 BOOL tex_used
= stateblock
->wineD3DDevice
->fixed_function_usage_map
[stage
];
1917 DWORD op
, arg1
, arg2
, arg0
;
1919 TRACE("Setting alpha op for stage %d\n", stage
);
1920 /* Do not care for enabled / disabled stages, just assign the settings. colorop disables / enables required stuff */
1921 if (mapped_stage
!= -1) {
1922 if (GL_SUPPORT(ARB_MULTITEXTURE
)) {
1923 if (tex_used
&& mapped_stage
>= GL_LIMITS(textures
)) {
1924 FIXME("Attempt to enable unsupported stage!\n");
1927 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
1928 checkGLcall("glActiveTextureARB");
1929 } else if (stage
> 0) {
1930 /* We can't do anything here */
1931 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
1936 op
= stateblock
->textureState
[stage
][WINED3DTSS_ALPHAOP
];
1937 arg1
= stateblock
->textureState
[stage
][WINED3DTSS_ALPHAARG1
];
1938 arg2
= stateblock
->textureState
[stage
][WINED3DTSS_ALPHAARG2
];
1939 arg0
= stateblock
->textureState
[stage
][WINED3DTSS_ALPHAARG0
];
1941 if(stateblock
->renderState
[WINED3DRS_COLORKEYENABLE
] && stage
== 0 &&
1942 stateblock
->textures
[0] &&
1943 (stateblock
->textureDimensions
[0] == GL_TEXTURE_2D
|| stateblock
->textureDimensions
[0] == GL_TEXTURE_RECTANGLE_ARB
)) {
1944 IWineD3DSurfaceImpl
*surf
= (IWineD3DSurfaceImpl
*) ((IWineD3DTextureImpl
*) stateblock
->textures
[0])->surfaces
[0];
1946 if(surf
->CKeyFlags
& WINEDDSD_CKSRCBLT
&&
1947 getFormatDescEntry(surf
->resource
.format
, NULL
, NULL
)->alphaMask
== 0x00000000) {
1949 /* Color keying needs to pass alpha values from the texture through to have the alpha test work properly.
1950 * On the other hand applications can still use texture combiners apparently. This code takes care that apps
1951 * cannot remove the texture's alpha channel entirely.
1953 * The fixup is required for Prince of Persia 3D(prison bars), while Moto racer 2 requires D3DTOP_MODULATE to work
1954 * on color keyed surfaces. Aliens vs Predator 1 uses color keyed textures and alpha component of diffuse color to
1955 * draw things like translucent text and perform other blending effects.
1957 * Aliens vs Predator 1 relies on diffuse alpha having an effect, so it cannot be ignored. To provide the
1958 * behavior expected by the game, while emulating the colorkey, diffuse alpha must be modulated with texture alpha.
1959 * OTOH, Moto racer 2 at some points sets alphaop/alphaarg to SELECTARG/CURRENT, yet puts garbage in diffuse alpha
1960 * (zeroes). This works on native, because the game disables alpha test and alpha blending. Alpha test is overwritten by
1961 * wine's for purposes of color-keying though, so this will lead to missing geometry if texture alpha is modulated
1962 * (pixels fail alpha test). To get around this, ALPHABLENDENABLE state is checked: if the app enables alpha blending,
1963 * it can be expected to provide meaningful values in diffuse alpha, so it should be modulated with texture alpha;
1964 * otherwise, selecting diffuse alpha is ignored in favour of texture alpha.
1966 * What to do with multitexturing? So far no app has been found that uses color keying with multitexturing
1968 if(op
== WINED3DTOP_DISABLE
) {
1969 arg1
= WINED3DTA_TEXTURE
;
1970 op
= WINED3DTOP_SELECTARG1
;
1972 else if(op
== WINED3DTOP_SELECTARG1
&& arg1
!= WINED3DTA_TEXTURE
) {
1973 if (stateblock
->renderState
[WINED3DRS_ALPHABLENDENABLE
]) {
1974 arg2
= WINED3DTA_TEXTURE
;
1975 op
= WINED3DTOP_MODULATE
;
1977 else arg1
= WINED3DTA_TEXTURE
;
1979 else if(op
== WINED3DTOP_SELECTARG2
&& arg2
!= WINED3DTA_TEXTURE
) {
1980 if (stateblock
->renderState
[WINED3DRS_ALPHABLENDENABLE
]) {
1981 arg1
= WINED3DTA_TEXTURE
;
1982 op
= WINED3DTOP_MODULATE
;
1984 else arg2
= WINED3DTA_TEXTURE
;
1989 TRACE("Setting alpha op for stage %d\n", stage
);
1990 if (GL_SUPPORT(NV_REGISTER_COMBINERS
)) {
1991 set_tex_op_nvrc((IWineD3DDevice
*)stateblock
->wineD3DDevice
, TRUE
, stage
,
1992 op
, arg1
, arg2
, arg0
,
1994 stateblock
->textureState
[stage
][WINED3DTSS_RESULTARG
]);
1996 set_tex_op((IWineD3DDevice
*)stateblock
->wineD3DDevice
, TRUE
, stage
,
1997 op
, arg1
, arg2
, arg0
);
2001 static void transform_texture(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2002 DWORD texUnit
= state
- STATE_TRANSFORM(WINED3DTS_TEXTURE0
);
2003 DWORD mapped_stage
= stateblock
->wineD3DDevice
->texUnitMap
[texUnit
];
2006 /* Ignore this when a vertex shader is used, or if the streams aren't sorted out yet */
2007 if(use_vs(stateblock
->wineD3DDevice
) ||
2008 isStateDirty(context
, STATE_VDECL
)) {
2009 TRACE("Using a vertex shader, or stream sources not sorted out yet, skipping\n");
2013 if (mapped_stage
== -1) return;
2015 if (GL_SUPPORT(ARB_MULTITEXTURE
)) {
2016 if(mapped_stage
>= GL_LIMITS(textures
)) {
2019 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
2020 checkGLcall("glActiveTextureARB");
2021 } else if (mapped_stage
> 0) {
2022 /* We can't do anything here */
2023 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
2026 generated
= (stateblock
->textureState
[texUnit
][WINED3DTSS_TEXCOORDINDEX
] & 0xFFFF0000) != WINED3DTSS_TCI_PASSTHRU
;
2028 set_texture_matrix(&stateblock
->transforms
[WINED3DTS_TEXTURE0
+ texUnit
].u
.m
[0][0],
2029 stateblock
->textureState
[texUnit
][WINED3DTSS_TEXTURETRANSFORMFLAGS
],
2031 context
->last_was_rhw
,
2032 stateblock
->wineD3DDevice
->strided_streams
.u
.s
.texCoords
[texUnit
].dwStride
?
2033 stateblock
->wineD3DDevice
->strided_streams
.u
.s
.texCoords
[texUnit
].dwType
:
2034 WINED3DDECLTYPE_UNUSED
);
2036 /* The sampler applying function calls us if this changes */
2037 if(context
->lastWasPow2Texture
[texUnit
] && stateblock
->textures
[texUnit
]) {
2039 FIXME("Non-power2 texture being used with generated texture coords\n");
2041 TRACE("Non power two matrix multiply fixup\n");
2042 glMultMatrixf(((IWineD3DTextureImpl
*) stateblock
->textures
[texUnit
])->baseTexture
.pow2Matrix
);
2046 static void unloadTexCoords(IWineD3DStateBlockImpl
*stateblock
) {
2049 for (texture_idx
= 0; texture_idx
< GL_LIMITS(texture_stages
); ++texture_idx
) {
2050 GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB
+ texture_idx
));
2051 glDisableClientState(GL_TEXTURE_COORD_ARRAY
);
2055 static void loadTexCoords(IWineD3DStateBlockImpl
*stateblock
, WineDirect3DVertexStridedData
*sd
, GLint
*curVBO
) {
2056 UINT
*offset
= stateblock
->streamOffset
;
2057 unsigned int mapped_stage
= 0;
2058 unsigned int textureNo
= 0;
2060 /* The code below uses glClientActiveTexture and glMultiTexCoord* which are all part of the GL_ARB_multitexture extension. */
2061 /* Abort if we don't support the extension. */
2062 if (!GL_SUPPORT(ARB_MULTITEXTURE
)) {
2063 FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
2067 for (textureNo
= 0; textureNo
< GL_LIMITS(texture_stages
); ++textureNo
) {
2068 int coordIdx
= stateblock
->textureState
[textureNo
][WINED3DTSS_TEXCOORDINDEX
];
2070 mapped_stage
= stateblock
->wineD3DDevice
->texUnitMap
[textureNo
];
2071 if (mapped_stage
== -1) continue;
2073 if (coordIdx
< MAX_TEXTURES
&& (sd
->u
.s
.texCoords
[coordIdx
].lpData
|| sd
->u
.s
.texCoords
[coordIdx
].VBO
)) {
2074 TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
2075 textureNo
, mapped_stage
, coordIdx
, sd
->u
.s
.texCoords
[coordIdx
].lpData
);
2077 if (*curVBO
!= sd
->u
.s
.texCoords
[coordIdx
].VBO
) {
2078 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB
, sd
->u
.s
.texCoords
[coordIdx
].VBO
));
2079 checkGLcall("glBindBufferARB");
2080 *curVBO
= sd
->u
.s
.texCoords
[coordIdx
].VBO
;
2083 GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
2084 checkGLcall("glClientActiveTextureARB");
2086 /* The coords to supply depend completely on the fvf / vertex shader */
2088 WINED3D_ATR_SIZE(sd
->u
.s
.texCoords
[coordIdx
].dwType
),
2089 WINED3D_ATR_GLTYPE(sd
->u
.s
.texCoords
[coordIdx
].dwType
),
2090 sd
->u
.s
.texCoords
[coordIdx
].dwStride
,
2091 sd
->u
.s
.texCoords
[coordIdx
].lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.texCoords
[coordIdx
].dwStride
+ offset
[sd
->u
.s
.texCoords
[coordIdx
].streamNo
]);
2092 glEnableClientState(GL_TEXTURE_COORD_ARRAY
);
2094 GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB
+ mapped_stage
, 0, 0, 0, 1));
2097 if (GL_SUPPORT(NV_REGISTER_COMBINERS
)) {
2098 /* The number of the mapped stages increases monotonically, so it's fine to use the last used one */
2099 for (textureNo
= mapped_stage
+ 1; textureNo
< GL_LIMITS(textures
); ++textureNo
) {
2100 GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB
+ textureNo
, 0, 0, 0, 1));
2105 static void tex_coordindex(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2106 DWORD stage
= (state
- STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE
;
2107 DWORD mapped_stage
= stateblock
->wineD3DDevice
->texUnitMap
[stage
];
2109 if (mapped_stage
== -1) {
2110 TRACE("No texture unit mapped to stage %d. Skipping texture coordinates.\n", stage
);
2114 if (GL_SUPPORT(ARB_MULTITEXTURE
)) {
2115 if(mapped_stage
>= GL_LIMITS(fragment_samplers
)) {
2118 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
2119 checkGLcall("glActiveTextureARB");
2120 } else if (stage
> 0) {
2121 /* We can't do anything here */
2122 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
2126 /* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive
2128 * FIXME: From MSDN: The WINED3DTSS_TCI_* flags are mutually exclusive. If you include
2129 * one flag, you can still specify an index value, which the system uses to
2130 * determine the texture wrapping mode.
2131 * eg. SetTextureStageState( 0, WINED3DTSS_TEXCOORDINDEX, WINED3DTSS_TCI_CAMERASPACEPOSITION | 1 );
2132 * means use the vertex position (camera-space) as the input texture coordinates
2133 * for this texture stage, and the wrap mode set in the WINED3DRS_WRAP1 render
2134 * state. We do not (yet) support the WINED3DRENDERSTATE_WRAPx values, nor tie them up
2135 * to the TEXCOORDINDEX value
2139 * Be careful the value of the mask 0xF0000 come from d3d8types.h infos
2141 switch (stateblock
->textureState
[stage
][WINED3DTSS_TEXCOORDINDEX
] & 0xFFFF0000) {
2142 case WINED3DTSS_TCI_PASSTHRU
:
2143 /*Use the specified texture coordinates contained within the vertex format. This value resolves to zero.*/
2144 glDisable(GL_TEXTURE_GEN_S
);
2145 glDisable(GL_TEXTURE_GEN_T
);
2146 glDisable(GL_TEXTURE_GEN_R
);
2147 glDisable(GL_TEXTURE_GEN_Q
);
2148 checkGLcall("glDisable(GL_TEXTURE_GEN_S,T,R,Q)");
2151 case WINED3DTSS_TCI_CAMERASPACEPOSITION
:
2152 /* CameraSpacePosition means use the vertex position, transformed to camera space,
2153 * as the input texture coordinates for this stage's texture transformation. This
2154 * equates roughly to EYE_LINEAR
2157 float s_plane
[] = { 1.0, 0.0, 0.0, 0.0 };
2158 float t_plane
[] = { 0.0, 1.0, 0.0, 0.0 };
2159 float r_plane
[] = { 0.0, 0.0, 1.0, 0.0 };
2160 float q_plane
[] = { 0.0, 0.0, 0.0, 1.0 };
2161 TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
2163 glMatrixMode(GL_MODELVIEW
);
2166 glTexGenfv(GL_S
, GL_EYE_PLANE
, s_plane
);
2167 glTexGenfv(GL_T
, GL_EYE_PLANE
, t_plane
);
2168 glTexGenfv(GL_R
, GL_EYE_PLANE
, r_plane
);
2169 glTexGenfv(GL_Q
, GL_EYE_PLANE
, q_plane
);
2172 TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set GL_TEXTURE_GEN_x and GL_x, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR\n");
2173 glEnable(GL_TEXTURE_GEN_S
);
2174 checkGLcall("glEnable(GL_TEXTURE_GEN_S)");
2175 glTexGeni(GL_S
, GL_TEXTURE_GEN_MODE
, GL_EYE_LINEAR
);
2176 checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
2177 glEnable(GL_TEXTURE_GEN_T
);
2178 checkGLcall("glEnable(GL_TEXTURE_GEN_T)");
2179 glTexGeni(GL_T
, GL_TEXTURE_GEN_MODE
, GL_EYE_LINEAR
);
2180 checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
2181 glEnable(GL_TEXTURE_GEN_R
);
2182 checkGLcall("glEnable(GL_TEXTURE_GEN_R)");
2183 glTexGeni(GL_R
, GL_TEXTURE_GEN_MODE
, GL_EYE_LINEAR
);
2184 checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)");
2188 case WINED3DTSS_TCI_CAMERASPACENORMAL
:
2190 if (GL_SUPPORT(NV_TEXGEN_REFLECTION
)) {
2191 float s_plane
[] = { 1.0, 0.0, 0.0, 0.0 };
2192 float t_plane
[] = { 0.0, 1.0, 0.0, 0.0 };
2193 float r_plane
[] = { 0.0, 0.0, 1.0, 0.0 };
2194 float q_plane
[] = { 0.0, 0.0, 0.0, 1.0 };
2195 TRACE("WINED3DTSS_TCI_CAMERASPACENORMAL - Set eye plane\n");
2197 glMatrixMode(GL_MODELVIEW
);
2200 glTexGenfv(GL_S
, GL_EYE_PLANE
, s_plane
);
2201 glTexGenfv(GL_T
, GL_EYE_PLANE
, t_plane
);
2202 glTexGenfv(GL_R
, GL_EYE_PLANE
, r_plane
);
2203 glTexGenfv(GL_Q
, GL_EYE_PLANE
, q_plane
);
2206 glEnable(GL_TEXTURE_GEN_S
);
2207 checkGLcall("glEnable(GL_TEXTURE_GEN_S)");
2208 glTexGeni(GL_S
, GL_TEXTURE_GEN_MODE
, GL_NORMAL_MAP_NV
);
2209 checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
2210 glEnable(GL_TEXTURE_GEN_T
);
2211 checkGLcall("glEnable(GL_TEXTURE_GEN_T)");
2212 glTexGeni(GL_T
, GL_TEXTURE_GEN_MODE
, GL_NORMAL_MAP_NV
);
2213 checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
2214 glEnable(GL_TEXTURE_GEN_R
);
2215 checkGLcall("glEnable(GL_TEXTURE_GEN_R)");
2216 glTexGeni(GL_R
, GL_TEXTURE_GEN_MODE
, GL_NORMAL_MAP_NV
);
2217 checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV)");
2222 case WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR
:
2224 if (GL_SUPPORT(NV_TEXGEN_REFLECTION
)) {
2225 float s_plane
[] = { 1.0, 0.0, 0.0, 0.0 };
2226 float t_plane
[] = { 0.0, 1.0, 0.0, 0.0 };
2227 float r_plane
[] = { 0.0, 0.0, 1.0, 0.0 };
2228 float q_plane
[] = { 0.0, 0.0, 0.0, 1.0 };
2229 TRACE("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Set eye plane\n");
2231 glMatrixMode(GL_MODELVIEW
);
2234 glTexGenfv(GL_S
, GL_EYE_PLANE
, s_plane
);
2235 glTexGenfv(GL_T
, GL_EYE_PLANE
, t_plane
);
2236 glTexGenfv(GL_R
, GL_EYE_PLANE
, r_plane
);
2237 glTexGenfv(GL_Q
, GL_EYE_PLANE
, q_plane
);
2240 glEnable(GL_TEXTURE_GEN_S
);
2241 checkGLcall("glEnable(GL_TEXTURE_GEN_S)");
2242 glTexGeni(GL_S
, GL_TEXTURE_GEN_MODE
, GL_REFLECTION_MAP_NV
);
2243 checkGLcall("glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
2244 glEnable(GL_TEXTURE_GEN_T
);
2245 checkGLcall("glEnable(GL_TEXTURE_GEN_T)");
2246 glTexGeni(GL_T
, GL_TEXTURE_GEN_MODE
, GL_REFLECTION_MAP_NV
);
2247 checkGLcall("glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
2248 glEnable(GL_TEXTURE_GEN_R
);
2249 checkGLcall("glEnable(GL_TEXTURE_GEN_R)");
2250 glTexGeni(GL_R
, GL_TEXTURE_GEN_MODE
, GL_REFLECTION_MAP_NV
);
2251 checkGLcall("glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV)");
2256 /* Unhandled types: */
2259 /* ? disable GL_TEXTURE_GEN_n ? */
2260 glDisable(GL_TEXTURE_GEN_S
);
2261 glDisable(GL_TEXTURE_GEN_T
);
2262 glDisable(GL_TEXTURE_GEN_R
);
2263 glDisable(GL_TEXTURE_GEN_Q
);
2264 FIXME("Unhandled WINED3DTSS_TEXCOORDINDEX %x\n", stateblock
->textureState
[stage
][WINED3DTSS_TEXCOORDINDEX
]);
2268 /* Update the texture matrix */
2269 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_TEXTURE0
+ stage
))) {
2270 transform_texture(STATE_TRANSFORM(WINED3DTS_TEXTURE0
+ stage
), stateblock
, context
);
2273 if(!isStateDirty(context
, STATE_VDECL
) && context
->namedArraysLoaded
) {
2274 /* Reload the arrays if we are using fixed function arrays to reflect the selected coord input
2275 * source. Call loadTexCoords directly because there is no need to reparse the vertex declaration
2276 * and do all the things linked to it
2277 * TODO: Tidy that up to reload only the arrays of the changed unit
2279 GLint curVBO
= GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT
) ? -1 : 0;
2281 unloadTexCoords(stateblock
);
2282 loadTexCoords(stateblock
, &stateblock
->wineD3DDevice
->strided_streams
, &curVBO
);
2286 static void shaderconstant(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2287 IWineD3DDeviceImpl
*device
= stateblock
->wineD3DDevice
;
2289 /* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
2290 * has an update pending
2292 if(isStateDirty(context
, STATE_VDECL
) ||
2293 isStateDirty(context
, STATE_PIXELSHADER
)) {
2297 device
->shader_backend
->shader_load_constants((IWineD3DDevice
*) device
, use_ps(device
), use_vs(device
));
2300 static void tex_bumpenvlscale(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2301 DWORD stage
= (state
- STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE
;
2307 if(stateblock
->pixelShader
&& stage
!= 0 &&
2308 ((IWineD3DPixelShaderImpl
*) stateblock
->pixelShader
)->baseShader
.reg_maps
.luminanceparams
[stage
]) {
2309 /* The pixel shader has to know the luminance scale. Do a constants update if it
2310 * isn't scheduled anyway
2312 if(!isStateDirty(context
, STATE_PIXELSHADERCONSTANT
) &&
2313 !isStateDirty(context
, STATE_PIXELSHADER
)) {
2314 shaderconstant(STATE_PIXELSHADERCONSTANT
, stateblock
, context
);
2318 tmpvalue
.d
= stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVLSCALE
];
2319 if(tmpvalue
.f
!= 0.0) {
2320 FIXME("WINED3DTSS_BUMPENVLSCALE not supported yet\n");
2324 static void tex_bumpenvloffset(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2325 DWORD stage
= (state
- STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE
;
2331 if(stateblock
->pixelShader
&& stage
!= 0 &&
2332 ((IWineD3DPixelShaderImpl
*) stateblock
->pixelShader
)->baseShader
.reg_maps
.luminanceparams
[stage
]) {
2333 /* The pixel shader has to know the luminance offset. Do a constants update if it
2334 * isn't scheduled anyway
2336 if(!isStateDirty(context
, STATE_PIXELSHADERCONSTANT
) &&
2337 !isStateDirty(context
, STATE_PIXELSHADER
)) {
2338 shaderconstant(STATE_PIXELSHADERCONSTANT
, stateblock
, context
);
2342 tmpvalue
.d
= stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVLOFFSET
];
2343 if(tmpvalue
.f
!= 0.0) {
2344 FIXME("WINED3DTSS_BUMPENVLOFFSET not supported yet\n");
2348 static void sampler(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2349 DWORD sampler
= state
- STATE_SAMPLER(0);
2350 DWORD mapped_stage
= stateblock
->wineD3DDevice
->texUnitMap
[sampler
];
2356 TRACE("Sampler: %d\n", sampler
);
2357 /* Enabling and disabling texture dimensions is done by texture stage state / pixel shader setup, this function
2358 * only has to bind textures and set the per texture states
2361 if (mapped_stage
== -1) {
2362 TRACE("No sampler mapped to stage %d. Returning.\n", sampler
);
2366 if (GL_SUPPORT(ARB_MULTITEXTURE
)) {
2367 if (mapped_stage
>= GL_LIMITS(combined_samplers
)) {
2370 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
2371 checkGLcall("glActiveTextureARB");
2372 } else if (sampler
> 0) {
2373 /* We can't do anything here */
2374 WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
2378 if(stateblock
->textures
[sampler
]) {
2379 BOOL texIsPow2
= FALSE
;
2381 /* The fixed function np2 texture emulation uses the texture matrix to fix up the coordinates
2382 * IWineD3DBaseTexture::ApplyStateChanges multiplies the set matrix with a fixup matrix. Before the
2383 * scaling is reapplied or removed, the texture matrix has to be reapplied
2385 if(!GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO
) && sampler
< MAX_TEXTURES
) {
2386 if(stateblock
->textureDimensions
[sampler
] == GL_TEXTURE_2D
||
2387 stateblock
->textureDimensions
[sampler
] == GL_TEXTURE_RECTANGLE_ARB
) {
2388 if(((IWineD3DTextureImpl
*) stateblock
->textures
[sampler
])->baseTexture
.pow2Matrix
[0] != 1.0 ||
2389 ((IWineD3DTextureImpl
*) stateblock
->textures
[sampler
])->baseTexture
.pow2Matrix
[5] != 1.0 ) {
2392 } else if(stateblock
->textureDimensions
[sampler
] == GL_TEXTURE_CUBE_MAP_ARB
) {
2393 if(((IWineD3DCubeTextureImpl
*) stateblock
->textures
[sampler
])->baseTexture
.pow2Matrix
[0] != 1.0) {
2398 if(texIsPow2
|| context
->lastWasPow2Texture
[sampler
]) {
2399 context
->lastWasPow2Texture
[sampler
] = texIsPow2
;
2400 transform_texture(STATE_TRANSFORM(WINED3DTS_TEXTURE0
+ stateblock
->wineD3DDevice
->texUnitMap
[sampler
]), stateblock
, context
);
2404 IWineD3DBaseTexture_PreLoad(stateblock
->textures
[sampler
]);
2405 IWineD3DBaseTexture_ApplyStateChanges(stateblock
->textures
[sampler
], stateblock
->textureState
[sampler
], stateblock
->samplerState
[sampler
]);
2407 if (GL_SUPPORT(EXT_TEXTURE_LOD_BIAS
)) {
2408 tmpvalue
.d
= stateblock
->samplerState
[sampler
][WINED3DSAMP_MIPMAPLODBIAS
];
2409 glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT
,
2410 GL_TEXTURE_LOD_BIAS_EXT
,
2412 checkGLcall("glTexEnvi(GL_TEXTURE_LOD_BIAS_EXT, ...)");
2415 if (stateblock
->wineD3DDevice
->ps_selected_mode
!= SHADER_NONE
&& stateblock
->pixelShader
&&
2416 ((IWineD3DPixelShaderImpl
*)stateblock
->pixelShader
)->baseShader
.function
) {
2417 /* Using a pixel shader? Verify the sampler types */
2419 /* Make sure that the texture dimensions are enabled. I don't have to disable the other
2420 * dimensions because the shader knows from which texture type to sample from. For the sake of
2421 * debugging all dimensions could be enabled and a texture with some ugly pink bound to the unused
2422 * dimensions. This should make wrong sampling sources visible :-)
2424 glEnable(stateblock
->textureDimensions
[sampler
]);
2425 checkGLcall("glEnable(stateblock->textureDimensions[sampler])");
2426 } else if(sampler
< stateblock
->lowest_disabled_stage
) {
2427 if(!isStateDirty(context
, STATE_TEXTURESTAGE(sampler
, WINED3DTSS_COLOROP
))) {
2428 texture_activate_dimensions(sampler
, stateblock
, context
);
2431 if(stateblock
->renderState
[WINED3DRS_COLORKEYENABLE
] && sampler
== 0) {
2432 /* If color keying is enabled update the alpha test, it depends on the existence
2433 * of a color key in stage 0
2435 state_alpha(WINED3DRS_COLORKEYENABLE
, stateblock
, context
);
2438 } else if(mapped_stage
< GL_LIMITS(textures
)) {
2439 if(sampler
< stateblock
->lowest_disabled_stage
) {
2440 /* TODO: What should I do with pixel shaders here ??? */
2441 if(!isStateDirty(context
, STATE_TEXTURESTAGE(sampler
, WINED3DTSS_COLOROP
))) {
2442 texture_activate_dimensions(sampler
, stateblock
, context
);
2445 if(stateblock
->renderState
[WINED3DRS_COLORKEYENABLE
] && sampler
== 0) {
2446 /* If color keying is enabled update the alpha test, it depends on the existence
2447 * of a color key in stage 0
2449 state_alpha(WINED3DRS_COLORKEYENABLE
, stateblock
, context
);
2451 } /* Otherwise tex_colorop disables the stage */
2452 glBindTexture(GL_TEXTURE_2D
, stateblock
->wineD3DDevice
->dummyTextureName
[sampler
]);
2453 checkGLcall("glBindTexture(GL_TEXTURE_2D, stateblock->wineD3DDevice->dummyTextureName[sampler])");
2457 static void pixelshader(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2458 IWineD3DDeviceImpl
*device
= stateblock
->wineD3DDevice
;
2459 BOOL use_pshader
= use_ps(device
);
2460 BOOL use_vshader
= use_vs(device
);
2461 BOOL update_fog
= FALSE
;
2465 if(!context
->last_was_pshader
) {
2466 /* Former draw without a pixel shader, some samplers
2467 * may be disabled because of WINED3DTSS_COLOROP = WINED3DTOP_DISABLE
2468 * make sure to enable them
2470 for(i
=0; i
< MAX_FRAGMENT_SAMPLERS
; i
++) {
2471 if(!isStateDirty(context
, STATE_SAMPLER(i
))) {
2472 sampler(STATE_SAMPLER(i
), stateblock
, context
);
2477 /* Otherwise all samplers were activated by the code above in earlier draws, or by sampler()
2478 * if a different texture was bound. I don't have to do anything.
2482 /* Compile and bind the shader */
2483 IWineD3DPixelShader_CompileShader(stateblock
->pixelShader
);
2485 /* Disabled the pixel shader - color ops weren't applied
2486 * while it was enabled, so re-apply them.
2488 for(i
=0; i
< MAX_TEXTURES
; i
++) {
2489 if(!isStateDirty(context
, STATE_TEXTURESTAGE(i
, WINED3DTSS_COLOROP
))) {
2490 tex_colorop(STATE_TEXTURESTAGE(i
, WINED3DTSS_COLOROP
), stateblock
, context
);
2493 if(context
->last_was_pshader
)
2497 if(!isStateDirty(context
, FFPStateTable
[STATE_VSHADER
].representative
)) {
2498 device
->shader_backend
->shader_select((IWineD3DDevice
*)stateblock
->wineD3DDevice
, use_pshader
, use_vshader
);
2500 if (!isStateDirty(context
, STATE_VERTEXSHADERCONSTANT
) && (use_vshader
|| use_pshader
)) {
2501 shaderconstant(STATE_VERTEXSHADERCONSTANT
, stateblock
, context
);
2506 state_fog(state
, stateblock
, context
);
2508 context
->last_was_pshader
= use_pshader
;
2511 static void tex_bumpenvmat(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2512 DWORD stage
= (state
- STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE
;
2514 if(stateblock
->pixelShader
&& stage
!= 0 &&
2515 ((IWineD3DPixelShaderImpl
*) stateblock
->pixelShader
)->baseShader
.reg_maps
.bumpmat
[stage
]) {
2516 /* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled
2519 if(!isStateDirty(context
, STATE_PIXELSHADERCONSTANT
) &&
2520 !isStateDirty(context
, STATE_PIXELSHADER
)) {
2521 shaderconstant(STATE_PIXELSHADERCONSTANT
, stateblock
, context
);
2525 if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP
)) {
2526 if(stage
>= GL_LIMITS(texture_stages
)) {
2527 WARN("Bump env matrix of unsupported stage set\n");
2528 } else if(GL_SUPPORT(ARB_MULTITEXTURE
)) {
2529 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ stage
));
2530 checkGLcall("GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stage))");
2532 mat
[0][0] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT00
]);
2533 mat
[1][0] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT01
]);
2534 mat
[0][1] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT10
]);
2535 mat
[1][1] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT11
]);
2536 GL_EXTCALL(glTexBumpParameterfvATI(GL_BUMP_ROT_MATRIX_ATI
, (float *) mat
));
2537 checkGLcall("glTexBumpParameterfvATI");
2538 } else if(GL_SUPPORT(NV_TEXTURE_SHADER2
)) {
2539 /* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to
2540 * offset the destination stage(always stage + 1 in d3d). In GL_NV_texture_shader, the bump
2541 * map offsetting is done in the stage reading the bump mapped texture, and the perturbation
2542 * map is read from a specified source stage(always stage - 1 for d3d). Thus set the matrix
2543 * for stage + 1. Keep the nvrc tex unit mapping in mind too
2545 DWORD mapped_stage
= stateblock
->wineD3DDevice
->texUnitMap
[stage
+ 1];
2547 if(mapped_stage
< GL_LIMITS(textures
)) {
2548 GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB
+ mapped_stage
));
2549 checkGLcall("GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage))");
2551 /* We can't just pass a pointer to the stateblock to GL due to the different matrix
2552 * format(column major vs row major)
2554 mat
[0][0] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT00
]);
2555 mat
[1][0] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT01
]);
2556 mat
[0][1] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT10
]);
2557 mat
[1][1] = *((float *) &stateblock
->textureState
[stage
][WINED3DTSS_BUMPENVMAT11
]);
2558 glTexEnvfv(GL_TEXTURE_SHADER_NV
, GL_OFFSET_TEXTURE_MATRIX_NV
, (float *) mat
);
2559 checkGLcall("glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)");
2564 static void transform_world(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2565 /* This function is called by transform_view below if the view matrix was changed too
2567 * Deliberately no check if the vertex declaration is dirty because the vdecl state
2568 * does not always update the world matrix, only on a switch between transformed
2569 * and untransformed draws. It *may* happen that the world matrix is set 2 times during one
2570 * draw, but that should be rather rare and cheaper in total.
2572 glMatrixMode(GL_MODELVIEW
);
2573 checkGLcall("glMatrixMode");
2575 if(context
->last_was_rhw
) {
2577 checkGLcall("glLoadIdentity()");
2579 /* In the general case, the view matrix is the identity matrix */
2580 if (stateblock
->wineD3DDevice
->view_ident
) {
2581 glLoadMatrixf(&stateblock
->transforms
[WINED3DTS_WORLDMATRIX(0)].u
.m
[0][0]);
2582 checkGLcall("glLoadMatrixf");
2584 glLoadMatrixf(&stateblock
->transforms
[WINED3DTS_VIEW
].u
.m
[0][0]);
2585 checkGLcall("glLoadMatrixf");
2586 glMultMatrixf(&stateblock
->transforms
[WINED3DTS_WORLDMATRIX(0)].u
.m
[0][0]);
2587 checkGLcall("glMultMatrixf");
2592 static void clipplane(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2593 UINT index
= state
- STATE_CLIPPLANE(0);
2595 if(isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_VIEW
)) || index
>= GL_LIMITS(clipplanes
)) {
2599 /* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */
2600 glMatrixMode(GL_MODELVIEW
);
2602 glLoadMatrixf(&stateblock
->transforms
[WINED3DTS_VIEW
].u
.m
[0][0]);
2604 TRACE("Clipplane [%f,%f,%f,%f]\n",
2605 stateblock
->clipplane
[index
][0],
2606 stateblock
->clipplane
[index
][1],
2607 stateblock
->clipplane
[index
][2],
2608 stateblock
->clipplane
[index
][3]);
2609 glClipPlane(GL_CLIP_PLANE0
+ index
, stateblock
->clipplane
[index
]);
2610 checkGLcall("glClipPlane");
2615 static void transform_worldex(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2616 UINT matrix
= state
- STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0));
2618 TRACE("Setting world matrix %d\n", matrix
);
2620 if(matrix
>= GL_LIMITS(blends
)) {
2621 WARN("Unsupported blend matrix set\n");
2623 } else if(isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_VIEW
))) {
2627 /* GL_MODELVIEW0_ARB: 0x1700
2628 * GL_MODELVIEW1_ARB: 0x0x850a
2629 * GL_MODELVIEW2_ARB: 0x8722
2630 * GL_MODELVIEW3_ARB: 0x8723
2632 * GL_MODELVIEW31_ARB: 0x873F
2634 if(matrix
== 1) glMat
= GL_MODELVIEW1_ARB
;
2635 else glMat
= GL_MODELVIEW2_ARB
- 2 + matrix
;
2637 glMatrixMode(glMat
);
2638 checkGLcall("glMatrixMode(glMat)");
2640 /* World matrix 0 is multiplied with the view matrix because d3d uses 3 matrices while gl uses only 2. To avoid
2641 * weighting the view matrix incorrectly it has to be multiplied into every gl modelview matrix
2643 if(stateblock
->wineD3DDevice
->view_ident
) {
2644 glLoadMatrixf(&stateblock
->transforms
[WINED3DTS_WORLDMATRIX(matrix
)].u
.m
[0][0]);
2645 checkGLcall("glLoadMatrixf")
2647 glLoadMatrixf(&stateblock
->transforms
[WINED3DTS_VIEW
].u
.m
[0][0]);
2648 checkGLcall("glLoadMatrixf")
2649 glMultMatrixf(&stateblock
->transforms
[WINED3DTS_WORLDMATRIX(matrix
)].u
.m
[0][0]);
2650 checkGLcall("glMultMatrixf")
2654 static void state_vertexblend(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2655 WINED3DVERTEXBLENDFLAGS val
= stateblock
->renderState
[WINED3DRS_VERTEXBLEND
];
2658 case WINED3DVBF_1WEIGHTS
:
2659 case WINED3DVBF_2WEIGHTS
:
2660 case WINED3DVBF_3WEIGHTS
:
2661 if(GL_SUPPORT(ARB_VERTEX_BLEND
)) {
2662 glEnable(GL_VERTEX_BLEND_ARB
);
2663 checkGLcall("glEnable(GL_VERTEX_BLEND_ARB)");
2665 /* D3D adds one more matrix which has weight (1 - sum(weights)). This is enabled at context
2666 * creation with enabling GL_WEIGHT_SUM_UNITY_ARB.
2668 GL_EXTCALL(glVertexBlendARB(stateblock
->renderState
[WINED3DRS_VERTEXBLEND
] + 1));
2670 if(!stateblock
->wineD3DDevice
->vertexBlendUsed
) {
2672 for(i
= 1; i
< GL_LIMITS(blends
); i
++) {
2673 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i
)))) {
2674 transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i
)), stateblock
, context
);
2677 stateblock
->wineD3DDevice
->vertexBlendUsed
= TRUE
;
2680 static BOOL once
= FALSE
;
2683 /* TODO: Implement vertex blending in drawStridedSlow */
2684 FIXME("Vertex blending enabled, but not supported by hardware\n");
2689 case WINED3DVBF_DISABLE
:
2690 case WINED3DVBF_0WEIGHTS
: /* for Indexed vertex blending - not supported */
2691 if(GL_SUPPORT(ARB_VERTEX_BLEND
)) {
2692 glDisable(GL_VERTEX_BLEND_ARB
);
2693 checkGLcall("glDisable(GL_VERTEX_BLEND_ARB)");
2695 TRACE("Vertex blending disabled\n");
2699 case WINED3DVBF_TWEENING
:
2700 /* Just set the vertex weight for weight 0, enable vertex blending and hope the app doesn't have
2701 * vertex weights in the vertices?
2702 * For now we don't report that as supported, so a warn should suffice
2704 WARN("Tweening not supported yet\n");
2709 static void transform_view(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2712 /* If we are changing the View matrix, reset the light and clipping planes to the new view
2713 * NOTE: We have to reset the positions even if the light/plane is not currently
2714 * enabled, since the call to enable it will not reset the position.
2715 * NOTE2: Apparently texture transforms do NOT need reapplying
2718 PLIGHTINFOEL
*light
= NULL
;
2720 glMatrixMode(GL_MODELVIEW
);
2721 checkGLcall("glMatrixMode(GL_MODELVIEW)");
2722 glLoadMatrixf(&stateblock
->transforms
[WINED3DTS_VIEW
].u
.m
[0][0]);
2723 checkGLcall("glLoadMatrixf(...)");
2725 /* Reset lights. TODO: Call light apply func */
2726 for(k
= 0; k
< stateblock
->wineD3DDevice
->maxConcurrentLights
; k
++) {
2727 light
= stateblock
->activeLights
[k
];
2728 if(!light
) continue;
2729 glLightfv(GL_LIGHT0
+ light
->glIndex
, GL_POSITION
, light
->lightPosn
);
2730 checkGLcall("glLightfv posn");
2731 glLightfv(GL_LIGHT0
+ light
->glIndex
, GL_SPOT_DIRECTION
, light
->lightDirn
);
2732 checkGLcall("glLightfv dirn");
2735 /* Reset Clipping Planes */
2736 for (k
= 0; k
< GL_LIMITS(clipplanes
); k
++) {
2737 if(!isStateDirty(context
, STATE_CLIPPLANE(k
))) {
2738 clipplane(STATE_CLIPPLANE(k
), stateblock
, context
);
2742 if(context
->last_was_rhw
) {
2744 checkGLcall("glLoadIdentity()");
2745 /* No need to update the world matrix, the identity is fine */
2749 /* Call the world matrix state, this will apply the combined WORLD + VIEW matrix
2750 * No need to do it here if the state is scheduled for update.
2752 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)))) {
2753 transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock
, context
);
2756 /* Avoid looping over a number of matrices if the app never used the functionality */
2757 if(stateblock
->wineD3DDevice
->vertexBlendUsed
) {
2758 for(k
= 1; k
< GL_LIMITS(blends
); k
++) {
2759 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k
)))) {
2760 transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k
)), stateblock
, context
);
2766 static void transform_projection(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
2767 glMatrixMode(GL_PROJECTION
);
2768 checkGLcall("glMatrixMode(GL_PROJECTION)");
2770 checkGLcall("glLoadIdentity");
2772 if(context
->last_was_rhw
) {
2773 double X
, Y
, height
, width
, minZ
, maxZ
;
2775 X
= stateblock
->viewport
.X
;
2776 Y
= stateblock
->viewport
.Y
;
2777 height
= stateblock
->viewport
.Height
;
2778 width
= stateblock
->viewport
.Width
;
2779 minZ
= stateblock
->viewport
.MinZ
;
2780 maxZ
= stateblock
->viewport
.MaxZ
;
2782 if(!stateblock
->wineD3DDevice
->untransformed
) {
2783 /* Transformed vertices are supposed to bypass the whole transform pipeline including
2784 * frustum clipping. This can't be done in opengl, so this code adjusts the Z range to
2785 * suppress depth clipping. This can be done because it is an orthogonal projection and
2786 * the Z coordinate does not affect the size of the primitives. Half Life 1 and Prince of
2787 * Persia 3D need this.
2789 * Note that using minZ and maxZ here doesn't entirely fix the problem, since view frustum
2790 * clipping is still enabled, but it seems to fix it for all apps tested so far. A minor
2791 * problem can be witnessed in half-life 1 engine based games, the weapon is clipped close
2794 * Also note that this breaks z comparison against z values filled in with clear,
2795 * but no app depending on that and disabled clipping has been found yet. Comparing
2796 * primitives against themselves works, so the Z buffer is still intact for normal hidden
2799 * We could disable clipping entirely by setting the near to infinity and far to -infinity,
2800 * but this would break Z buffer operation. Raising the range to something less than
2801 * infinity would help a bit at the cost of Z precision, but it wouldn't eliminate the
2804 TRACE("Calling glOrtho with %f, %f, %f, %f\n", width
, height
, -minZ
, -maxZ
);
2805 if(stateblock
->wineD3DDevice
->render_offscreen
) {
2806 glOrtho(X
, X
+ width
, -Y
, -Y
- height
, -minZ
, -maxZ
);
2808 glOrtho(X
, X
+ width
, Y
+ height
, Y
, -minZ
, -maxZ
);
2811 /* If the app mixes transformed and untransformed primitives we can't use the coordinate system
2812 * trick above because this would mess up transformed and untransformed Z order. Pass the z position
2813 * unmodified to opengl.
2815 * If the app depends on mixed types and disabled clipping we're out of luck without a pipeline
2816 * replacement shader.
2818 TRACE("Calling glOrtho with %f, %f, %f, %f\n", width
, height
, 1.0, -1.0);
2819 if(stateblock
->wineD3DDevice
->render_offscreen
) {
2820 glOrtho(X
, X
+ width
, -Y
, -Y
- height
, 0.0, -1.0);
2822 glOrtho(X
, X
+ width
, Y
+ height
, Y
, 0.0, -1.0);
2825 checkGLcall("glOrtho");
2827 /* Window Coord 0 is the middle of the first pixel, so translate by 1/2 pixels */
2828 glTranslatef(0.5, 0.5, 0);
2829 checkGLcall("glTranslatef(0.5, 0.5, 0)");
2830 /* D3D texture coordinates are flipped compared to OpenGL ones, so
2831 * render everything upside down when rendering offscreen. */
2832 if (stateblock
->wineD3DDevice
->render_offscreen
) {
2833 glScalef(1.0, -1.0, 1.0);
2834 checkGLcall("glScalef");
2837 /* The rule is that the window coordinate 0 does not correspond to the
2838 beginning of the first pixel, but the center of the first pixel.
2839 As a consequence if you want to correctly draw one line exactly from
2840 the left to the right end of the viewport (with all matrices set to
2841 be identity), the x coords of both ends of the line would be not
2842 -1 and 1 respectively but (-1-1/viewport_widh) and (1-1/viewport_width)
2845 1.0 / Width is used because the coord range goes from -1.0 to 1.0, then we
2846 divide by the Width/Height, so we need the half range(1.0) to translate by
2849 The other fun is that d3d's output z range after the transformation is [0;1],
2850 but opengl's is [-1;1]. Since the z buffer is in range [0;1] for both, gl
2851 scales [-1;1] to [0;1]. This would mean that we end up in [0.5;1] and loose a lot
2852 of Z buffer precision and the clear values do not match in the z test. Thus scale
2853 [0;1] to [-1;1], so when gl undoes that we utilize the full z range
2855 glTranslatef(1.0 / stateblock
->viewport
.Width
, -1.0/ stateblock
->viewport
.Height
, -1.0);
2856 checkGLcall("glTranslatef (1.0 / width, -1.0 / height, -1.0)");
2857 if (stateblock
->wineD3DDevice
->render_offscreen
) {
2858 /* D3D texture coordinates are flipped compared to OpenGL ones, so
2859 * render everything upside down when rendering offscreen. */
2860 glScalef(1.0, -1.0, 2.0);
2862 glScalef(1.0, 1.0, 2.0);
2864 checkGLcall("glScalef");
2866 glMultMatrixf(&stateblock
->transforms
[WINED3DTS_PROJECTION
].u
.m
[0][0]);
2867 checkGLcall("glLoadMatrixf");
2871 /* This should match any arrays loaded in loadVertexData.
2872 * stateblock impl is required for GL_SUPPORT
2873 * TODO: Only load / unload arrays if we have to.
2875 static inline void unloadVertexData(IWineD3DStateBlockImpl
*stateblock
) {
2876 glDisableClientState(GL_VERTEX_ARRAY
);
2877 glDisableClientState(GL_NORMAL_ARRAY
);
2878 glDisableClientState(GL_COLOR_ARRAY
);
2879 if (GL_SUPPORT(EXT_SECONDARY_COLOR
)) {
2880 glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT
);
2882 if (GL_SUPPORT(ARB_VERTEX_BLEND
)) {
2883 glDisableClientState(GL_WEIGHT_ARRAY_ARB
);
2884 } else if (GL_SUPPORT(EXT_VERTEX_WEIGHTING
)) {
2885 glDisableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT
);
2887 unloadTexCoords(stateblock
);
2890 /* This should match any arrays loaded in loadNumberedArrays
2891 * TODO: Only load / unload arrays if we have to.
2893 static inline void unloadNumberedArrays(IWineD3DStateBlockImpl
*stateblock
) {
2894 /* disable any attribs (this is the same for both GLSL and ARB modes) */
2895 GLint maxAttribs
= 16;
2898 /* Leave all the attribs disabled */
2899 glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB
, &maxAttribs
);
2900 /* MESA does not support it right not */
2901 if (glGetError() != GL_NO_ERROR
)
2903 for (i
= 0; i
< maxAttribs
; ++i
) {
2904 GL_EXTCALL(glDisableVertexAttribArrayARB(i
));
2905 checkGLcall("glDisableVertexAttribArrayARB(reg)");
2906 /* Some Windows drivers(NV GF 7) use the latest value that was used when drawing with the now
2907 * deactivated stream disabled, some other drivers(ATI, NV GF 8) set the undefined values to 0x00.
2908 * Let's set them to 0x00 to avoid hitting some undefined aspects of OpenGL. All that is really
2909 * important here is the glDisableVertexAttribArrayARB call above. The test shows that the refrast
2910 * keeps dereferencing the pointers, which would cause crashes in some games like Half Life 2: Episode Two.
2912 GL_EXTCALL(glVertexAttrib4NubARB(i
, 0, 0, 0, 0));
2913 checkGLcall("glVertexAttrib4NubARB(i, 0, 0, 0, 0)");
2917 static inline void loadNumberedArrays(IWineD3DStateBlockImpl
*stateblock
, WineDirect3DVertexStridedData
*strided
) {
2918 GLint curVBO
= GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT
) ? -1 : 0;
2920 UINT
*offset
= stateblock
->streamOffset
;
2921 IWineD3DVertexBufferImpl
*vb
;
2922 DWORD_PTR shift_index
;
2924 /* Default to no instancing */
2925 stateblock
->wineD3DDevice
->instancedDraw
= FALSE
;
2927 for (i
= 0; i
< MAX_ATTRIBS
; i
++) {
2929 if (!strided
->u
.input
[i
].lpData
&& !strided
->u
.input
[i
].VBO
)
2932 /* Do not load instance data. It will be specified using glTexCoord by drawprim */
2933 if(stateblock
->streamFlags
[strided
->u
.input
[i
].streamNo
] & WINED3DSTREAMSOURCE_INSTANCEDATA
) {
2934 GL_EXTCALL(glDisableVertexAttribArrayARB(i
));
2935 stateblock
->wineD3DDevice
->instancedDraw
= TRUE
;
2939 TRACE_(d3d_shader
)("Loading array %u [VBO=%u]\n", i
, strided
->u
.input
[i
].VBO
);
2941 if(strided
->u
.input
[i
].dwStride
) {
2942 if(curVBO
!= strided
->u
.input
[i
].VBO
) {
2943 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB
, strided
->u
.input
[i
].VBO
));
2944 checkGLcall("glBindBufferARB");
2945 curVBO
= strided
->u
.input
[i
].VBO
;
2947 vb
= (IWineD3DVertexBufferImpl
*) stateblock
->streamSource
[strided
->u
.input
[i
].streamNo
];
2948 /* Use the VBO to find out if a vertex buffer exists, not the vb pointer. vb can point to a
2949 * user pointer data blob. In that case curVBO will be 0. If there is a vertex buffer but no
2950 * vbo we won't be load converted attributes anyway
2952 if(curVBO
&& vb
->conv_shift
) {
2953 TRACE("Loading attribute from shifted buffer\n");
2954 TRACE("Attrib %d has original stride %d, new stride %d\n", i
, strided
->u
.input
[i
].dwStride
, vb
->conv_stride
);
2955 TRACE("Original offset %p, additional offset 0x%08x\n",strided
->u
.input
[i
].lpData
, vb
->conv_shift
[(DWORD_PTR
) strided
->u
.input
[i
].lpData
]);
2956 TRACE("Opengl type %x\n", WINED3D_ATR_GLTYPE(strided
->u
.input
[i
].dwType
));
2957 shift_index
= ((DWORD_PTR
) strided
->u
.input
[i
].lpData
+ offset
[strided
->u
.input
[i
].streamNo
]);
2958 shift_index
= shift_index
% strided
->u
.input
[i
].dwStride
;
2959 GL_EXTCALL(glVertexAttribPointerARB(i
,
2960 WINED3D_ATR_SIZE(strided
->u
.input
[i
].dwType
),
2961 WINED3D_ATR_GLTYPE(strided
->u
.input
[i
].dwType
),
2962 WINED3D_ATR_NORMALIZED(strided
->u
.input
[i
].dwType
),
2965 strided
->u
.input
[i
].lpData
+ vb
->conv_shift
[shift_index
] +
2966 stateblock
->loadBaseVertexIndex
* strided
->u
.input
[i
].dwStride
+
2967 offset
[strided
->u
.input
[i
].streamNo
]));
2970 GL_EXTCALL(glVertexAttribPointerARB(i
,
2971 WINED3D_ATR_SIZE(strided
->u
.input
[i
].dwType
),
2972 WINED3D_ATR_GLTYPE(strided
->u
.input
[i
].dwType
),
2973 WINED3D_ATR_NORMALIZED(strided
->u
.input
[i
].dwType
),
2974 strided
->u
.input
[i
].dwStride
,
2976 strided
->u
.input
[i
].lpData
+
2977 stateblock
->loadBaseVertexIndex
* strided
->u
.input
[i
].dwStride
+
2978 offset
[strided
->u
.input
[i
].streamNo
]) );
2980 GL_EXTCALL(glEnableVertexAttribArrayARB(i
));
2982 /* Stride = 0 means always the same values. glVertexAttribPointerARB doesn't do that. Instead disable the pointer and
2983 * set up the attribute statically. But we have to figure out the system memory address.
2985 BYTE
*ptr
= strided
->u
.input
[i
].lpData
+ offset
[strided
->u
.input
[i
].streamNo
];
2986 if(strided
->u
.input
[i
].VBO
) {
2987 vb
= (IWineD3DVertexBufferImpl
*) stateblock
->streamSource
[strided
->u
.input
[i
].streamNo
];
2988 ptr
+= (long) vb
->resource
.allocatedMemory
;
2990 GL_EXTCALL(glDisableVertexAttribArrayARB(i
));
2992 switch(strided
->u
.input
[i
].dwType
) {
2993 case WINED3DDECLTYPE_FLOAT1
:
2994 GL_EXTCALL(glVertexAttrib1fvARB(i
, (float *) ptr
));
2996 case WINED3DDECLTYPE_FLOAT2
:
2997 GL_EXTCALL(glVertexAttrib2fvARB(i
, (float *) ptr
));
2999 case WINED3DDECLTYPE_FLOAT3
:
3000 GL_EXTCALL(glVertexAttrib3fvARB(i
, (float *) ptr
));
3002 case WINED3DDECLTYPE_FLOAT4
:
3003 GL_EXTCALL(glVertexAttrib4fvARB(i
, (float *) ptr
));
3006 case WINED3DDECLTYPE_UBYTE4
:
3007 GL_EXTCALL(glVertexAttrib4NubvARB(i
, ptr
));
3009 case WINED3DDECLTYPE_UBYTE4N
:
3010 case WINED3DDECLTYPE_D3DCOLOR
:
3011 GL_EXTCALL(glVertexAttrib4NubvARB(i
, ptr
));
3014 case WINED3DDECLTYPE_SHORT2
:
3015 GL_EXTCALL(glVertexAttrib4svARB(i
, (GLshort
*) ptr
));
3017 case WINED3DDECLTYPE_SHORT4
:
3018 GL_EXTCALL(glVertexAttrib4svARB(i
, (GLshort
*) ptr
));
3021 case WINED3DDECLTYPE_SHORT2N
:
3023 GLshort s
[4] = {((short *) ptr
)[0], ((short *) ptr
)[1], 0, 1};
3024 GL_EXTCALL(glVertexAttrib4NsvARB(i
, s
));
3027 case WINED3DDECLTYPE_USHORT2N
:
3029 GLushort s
[4] = {((unsigned short *) ptr
)[0], ((unsigned short *) ptr
)[1], 0, 1};
3030 GL_EXTCALL(glVertexAttrib4NusvARB(i
, s
));
3033 case WINED3DDECLTYPE_SHORT4N
:
3034 GL_EXTCALL(glVertexAttrib4NsvARB(i
, (GLshort
*) ptr
));
3036 case WINED3DDECLTYPE_USHORT4N
:
3037 GL_EXTCALL(glVertexAttrib4NusvARB(i
, (GLushort
*) ptr
));
3040 case WINED3DDECLTYPE_UDEC3
:
3041 FIXME("Unsure about WINED3DDECLTYPE_UDEC3\n");
3042 /*glVertexAttrib3usvARB(i, (GLushort *) ptr); Does not exist */
3044 case WINED3DDECLTYPE_DEC3N
:
3045 FIXME("Unsure about WINED3DDECLTYPE_DEC3N\n");
3046 /*glVertexAttrib3NusvARB(i, (GLushort *) ptr); Does not exist */
3049 case WINED3DDECLTYPE_FLOAT16_2
:
3050 /* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4
3051 * byte float according to the IEEE standard
3053 FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_2\n");
3055 case WINED3DDECLTYPE_FLOAT16_4
:
3056 FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_4\n");
3059 case WINED3DDECLTYPE_UNUSED
:
3061 ERR("Unexpected declaration in stride 0 attributes\n");
3067 checkGLcall("Loading numbered arrays");
3070 /* Used from 2 different functions, and too big to justify making it inlined */
3071 static void loadVertexData(IWineD3DStateBlockImpl
*stateblock
, WineDirect3DVertexStridedData
*sd
) {
3072 UINT
*offset
= stateblock
->streamOffset
;
3073 GLint curVBO
= GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT
) ? -1 : 0;
3075 TRACE("Using fast vertex array code\n");
3077 /* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */
3078 stateblock
->wineD3DDevice
->instancedDraw
= FALSE
;
3080 /* Blend Data ---------------------------------------------- */
3081 if( (sd
->u
.s
.blendWeights
.lpData
) || (sd
->u
.s
.blendWeights
.VBO
) ||
3082 (sd
->u
.s
.blendMatrixIndices
.lpData
) || (sd
->u
.s
.blendMatrixIndices
.VBO
) ) {
3084 if (GL_SUPPORT(ARB_VERTEX_BLEND
)) {
3085 TRACE("Blend %d %p %d\n", WINED3D_ATR_SIZE(sd
->u
.s
.blendWeights
.dwType
),
3086 sd
->u
.s
.blendWeights
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.blendWeights
.dwStride
, sd
->u
.s
.blendWeights
.dwStride
+ offset
[sd
->u
.s
.blendWeights
.streamNo
]);
3088 glEnableClientState(GL_WEIGHT_ARRAY_ARB
);
3089 checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
3091 GL_EXTCALL(glVertexBlendARB(WINED3D_ATR_SIZE(sd
->u
.s
.blendWeights
.dwType
) + 1));
3093 VTRACE(("glWeightPointerARB(%d, GL_FLOAT, %d, %p)\n",
3094 WINED3D_ATR_SIZE(sd
->u
.s
.blendWeights
.dwType
) ,
3095 sd
->u
.s
.blendWeights
.dwStride
,
3096 sd
->u
.s
.blendWeights
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.blendWeights
.dwStride
+ offset
[sd
->u
.s
.blendWeights
.streamNo
]));
3098 if(curVBO
!= sd
->u
.s
.blendWeights
.VBO
) {
3099 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB
, sd
->u
.s
.blendWeights
.VBO
));
3100 checkGLcall("glBindBufferARB");
3101 curVBO
= sd
->u
.s
.blendWeights
.VBO
;
3104 GL_EXTCALL(glWeightPointerARB
)(
3105 WINED3D_ATR_SIZE(sd
->u
.s
.blendWeights
.dwType
),
3106 WINED3D_ATR_GLTYPE(sd
->u
.s
.blendWeights
.dwType
),
3107 sd
->u
.s
.blendWeights
.dwStride
,
3108 sd
->u
.s
.blendWeights
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.blendWeights
.dwStride
+ offset
[sd
->u
.s
.blendWeights
.streamNo
]);
3110 checkGLcall("glWeightPointerARB");
3112 if((sd
->u
.s
.blendMatrixIndices
.lpData
) || (sd
->u
.s
.blendMatrixIndices
.VBO
)){
3113 static BOOL showfixme
= TRUE
;
3115 FIXME("blendMatrixIndices support\n");
3119 } else if (GL_SUPPORT(EXT_VERTEX_WEIGHTING
)) {
3120 /* FIXME("TODO\n");*/
3123 GL_EXTCALL(glVertexWeightPointerEXT
)(
3124 WINED3D_ATR_SIZE(sd
->u
.s
.blendWeights
.dwType
),
3125 WINED3D_ATR_GLTYPE(sd
->u
.s
.blendWeights
.dwType
),
3126 sd
->u
.s
.blendWeights
.dwStride
,
3127 sd
->u
.s
.blendWeights
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.blendWeights
.dwStride
);
3128 checkGLcall("glVertexWeightPointerEXT(numBlends, ...)");
3129 glEnableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT
);
3130 checkGLcall("glEnableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT)");
3134 /* TODO: support blends in drawStridedSlow
3135 * No need to write a FIXME here, this is done after the general vertex decl decoding
3137 WARN("unsupported blending in openGl\n");
3140 if (GL_SUPPORT(ARB_VERTEX_BLEND
)) {
3141 static const GLbyte one
= 1;
3142 GL_EXTCALL(glWeightbvARB(1, &one
));
3143 checkGLcall("glWeightivARB(GL_LIMITS(blends), weights)");
3147 #if 0 /* FOG ----------------------------------------------*/
3148 if (sd
->u
.s
.fog
.lpData
|| sd
->u
.s
.fog
.VBO
) {
3150 if (GL_SUPPORT(EXT_FOG_COORD
) {
3151 glEnableClientState(GL_FOG_COORDINATE_EXT
);
3152 (GL_EXTCALL
)(FogCoordPointerEXT
)(
3153 WINED3D_ATR_GLTYPE(sd
->u
.s
.fog
.dwType
),
3154 sd
->u
.s
.fog
.dwStride
,
3155 sd
->u
.s
.fog
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.fog
.dwStride
);
3157 /* don't bother falling back to 'slow' as we don't support software FOG yet. */
3158 /* FIXME: fixme once */
3159 TRACE("Hardware support for FOG is not avaiable, FOG disabled.\n");
3162 if (GL_SUPPRT(EXT_FOR_COORD
) {
3163 /* make sure fog is disabled */
3164 glDisableClientState(GL_FOG_COORDINATE_EXT
);
3169 #if 0 /* tangents ----------------------------------------------*/
3170 if (sd
->u
.s
.tangent
.lpData
|| sd
->u
.s
.tangent
.VBO
||
3171 sd
->u
.s
.binormal
.lpData
|| sd
->u
.s
.binormal
.VBO
) {
3173 if (GL_SUPPORT(EXT_COORDINATE_FRAME
) {
3174 if (sd
->u
.s
.tangent
.lpData
|| sd
->u
.s
.tangent
.VBO
) {
3175 glEnable(GL_TANGENT_ARRAY_EXT
);
3176 (GL_EXTCALL
)(TangentPointerEXT
)(
3177 WINED3D_ATR_GLTYPE(sd
->u
.s
.tangent
.dwType
),
3178 sd
->u
.s
.tangent
.dwStride
,
3179 sd
->u
.s
.tangent
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.tangent
.dwStride
);
3181 glDisable(GL_TANGENT_ARRAY_EXT
);
3183 if (sd
->u
.s
.binormal
.lpData
|| sd
->u
.s
.binormal
.VBO
) {
3184 glEnable(GL_BINORMAL_ARRAY_EXT
);
3185 (GL_EXTCALL
)(BinormalPointerEXT
)(
3186 WINED3D_ATR_GLTYPE(sd
->u
.s
.binormal
.dwType
),
3187 sd
->u
.s
.binormal
.dwStride
,
3188 sd
->u
.s
.binormal
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.binormal
.dwStride
);
3190 glDisable(GL_BINORMAL_ARRAY_EXT
);
3194 /* don't bother falling back to 'slow' as we don't support software tangents and binormals yet . */
3195 /* FIXME: fixme once */
3196 TRACE("Hardware support for tangents and binormals is not avaiable, tangents and binormals disabled.\n");
3199 if (GL_SUPPORT(EXT_COORDINATE_FRAME
) {
3200 /* make sure fog is disabled */
3201 glDisable(GL_TANGENT_ARRAY_EXT
);
3202 glDisable(GL_BINORMAL_ARRAY_EXT
);
3207 /* Point Size ----------------------------------------------*/
3208 if (sd
->u
.s
.pSize
.lpData
|| sd
->u
.s
.pSize
.VBO
) {
3210 /* no such functionality in the fixed function GL pipeline */
3211 TRACE("Cannot change ptSize here in openGl\n");
3212 /* TODO: Implement this function in using shaders if they are available */
3216 /* Vertex Pointers -----------------------------------------*/
3217 if (sd
->u
.s
.position
.lpData
!= NULL
|| sd
->u
.s
.position
.VBO
!= 0) {
3218 /* Note dwType == float3 or float4 == 2 or 3 */
3219 VTRACE(("glVertexPointer(%d, GL_FLOAT, %d, %p)\n",
3220 sd
->u
.s
.position
.dwStride
,
3221 sd
->u
.s
.position
.dwType
+ 1,
3222 sd
->u
.s
.position
.lpData
));
3224 if(curVBO
!= sd
->u
.s
.position
.VBO
) {
3225 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB
, sd
->u
.s
.position
.VBO
));
3226 checkGLcall("glBindBufferARB");
3227 curVBO
= sd
->u
.s
.position
.VBO
;
3230 /* min(WINED3D_ATR_SIZE(position),3) to Disable RHW mode as 'w' coord
3231 handling for rhw mode should not impact screen position whereas in GL it does.
3232 This may result in very slightly distorted textures in rhw mode.
3233 There's always the other option of fixing the view matrix to
3234 prevent w from having any effect.
3236 This only applies to user pointer sources, in VBOs the vertices are fixed up
3238 if(sd
->u
.s
.position
.VBO
== 0) {
3239 glVertexPointer(3 /* min(WINED3D_ATR_SIZE(sd->u.s.position.dwType),3) */,
3240 WINED3D_ATR_GLTYPE(sd
->u
.s
.position
.dwType
),
3241 sd
->u
.s
.position
.dwStride
, sd
->u
.s
.position
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.position
.dwStride
+ offset
[sd
->u
.s
.position
.streamNo
]);
3244 WINED3D_ATR_SIZE(sd
->u
.s
.position
.dwType
),
3245 WINED3D_ATR_GLTYPE(sd
->u
.s
.position
.dwType
),
3246 sd
->u
.s
.position
.dwStride
, sd
->u
.s
.position
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.position
.dwStride
+ offset
[sd
->u
.s
.position
.streamNo
]);
3248 checkGLcall("glVertexPointer(...)");
3249 glEnableClientState(GL_VERTEX_ARRAY
);
3250 checkGLcall("glEnableClientState(GL_VERTEX_ARRAY)");
3253 /* Normals -------------------------------------------------*/
3254 if (sd
->u
.s
.normal
.lpData
|| sd
->u
.s
.normal
.VBO
) {
3255 /* Note dwType == float3 or float4 == 2 or 3 */
3256 VTRACE(("glNormalPointer(GL_FLOAT, %d, %p)\n",
3257 sd
->u
.s
.normal
.dwStride
,
3258 sd
->u
.s
.normal
.lpData
));
3259 if(curVBO
!= sd
->u
.s
.normal
.VBO
) {
3260 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB
, sd
->u
.s
.normal
.VBO
));
3261 checkGLcall("glBindBufferARB");
3262 curVBO
= sd
->u
.s
.normal
.VBO
;
3265 WINED3D_ATR_GLTYPE(sd
->u
.s
.normal
.dwType
),
3266 sd
->u
.s
.normal
.dwStride
,
3267 sd
->u
.s
.normal
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.normal
.dwStride
+ offset
[sd
->u
.s
.normal
.streamNo
]);
3268 checkGLcall("glNormalPointer(...)");
3269 glEnableClientState(GL_NORMAL_ARRAY
);
3270 checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
3273 glNormal3f(0, 0, 0);
3274 checkGLcall("glNormal3f(0, 0, 0)");
3277 /* Diffuse Colour --------------------------------------------*/
3278 /* WARNING: Data here MUST be in RGBA format, so cannot */
3279 /* go directly into fast mode from app pgm, because */
3280 /* directx requires data in BGRA format. */
3281 /* currently fixupVertices swizzles the format, but this isn't*/
3282 /* very practical when using VBOs */
3283 /* NOTE: Unless we write a vertex shader to swizzle the colour*/
3284 /* , or the user doesn't care and wants the speed advantage */
3286 if (sd
->u
.s
.diffuse
.lpData
|| sd
->u
.s
.diffuse
.VBO
) {
3287 /* Note dwType == float3 or float4 == 2 or 3 */
3288 VTRACE(("glColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n",
3289 sd
->u
.s
.diffuse
.dwStride
,
3290 sd
->u
.s
.diffuse
.lpData
));
3292 if(curVBO
!= sd
->u
.s
.diffuse
.VBO
) {
3293 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB
, sd
->u
.s
.diffuse
.VBO
));
3294 checkGLcall("glBindBufferARB");
3295 curVBO
= sd
->u
.s
.diffuse
.VBO
;
3298 glColorPointer(WINED3D_ATR_SIZE(sd
->u
.s
.diffuse
.dwType
),
3299 WINED3D_ATR_GLTYPE(sd
->u
.s
.diffuse
.dwType
),
3300 sd
->u
.s
.diffuse
.dwStride
,
3301 sd
->u
.s
.diffuse
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.diffuse
.dwStride
+ offset
[sd
->u
.s
.diffuse
.streamNo
]);
3302 checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
3303 glEnableClientState(GL_COLOR_ARRAY
);
3304 checkGLcall("glEnableClientState(GL_COLOR_ARRAY)");
3307 glColor4f(1.0f
, 1.0f
, 1.0f
, 1.0f
);
3308 checkGLcall("glColor4f(1, 1, 1, 1)");
3311 /* Specular Colour ------------------------------------------*/
3312 if (sd
->u
.s
.specular
.lpData
|| sd
->u
.s
.specular
.VBO
) {
3313 TRACE("setting specular colour\n");
3314 /* Note dwType == float3 or float4 == 2 or 3 */
3315 VTRACE(("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n",
3316 sd
->u
.s
.specular
.dwStride
,
3317 sd
->u
.s
.specular
.lpData
));
3318 if (GL_SUPPORT(EXT_SECONDARY_COLOR
)) {
3319 if(curVBO
!= sd
->u
.s
.specular
.VBO
) {
3320 GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB
, sd
->u
.s
.specular
.VBO
));
3321 checkGLcall("glBindBufferARB");
3322 curVBO
= sd
->u
.s
.specular
.VBO
;
3324 GL_EXTCALL(glSecondaryColorPointerEXT
)(WINED3D_ATR_SIZE(sd
->u
.s
.specular
.dwType
),
3325 WINED3D_ATR_GLTYPE(sd
->u
.s
.specular
.dwType
),
3326 sd
->u
.s
.specular
.dwStride
,
3327 sd
->u
.s
.specular
.lpData
+ stateblock
->loadBaseVertexIndex
* sd
->u
.s
.specular
.dwStride
+ offset
[sd
->u
.s
.specular
.streamNo
]);
3328 vcheckGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, ...)");
3329 glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT
);
3330 vcheckGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
3333 /* Missing specular color is not critical, no warnings */
3334 VTRACE(("Specular colour is not supported in this GL implementation\n"));
3338 if (GL_SUPPORT(EXT_SECONDARY_COLOR
)) {
3339 GL_EXTCALL(glSecondaryColor3fEXT
)(0, 0, 0);
3340 checkGLcall("glSecondaryColor3fEXT(0, 0, 0)");
3343 /* Missing specular color is not critical, no warnings */
3344 VTRACE(("Specular colour is not supported in this GL implementation\n"));
3348 /* Texture coords -------------------------------------------*/
3349 loadTexCoords(stateblock
, sd
, &curVBO
);
3352 static inline void drawPrimitiveTraceDataLocations(
3353 WineDirect3DVertexStridedData
*dataLocations
) {
3355 /* Dump out what parts we have supplied */
3356 TRACE("Strided Data:\n");
3357 TRACE_STRIDED((dataLocations
), position
);
3358 TRACE_STRIDED((dataLocations
), blendWeights
);
3359 TRACE_STRIDED((dataLocations
), blendMatrixIndices
);
3360 TRACE_STRIDED((dataLocations
), normal
);
3361 TRACE_STRIDED((dataLocations
), pSize
);
3362 TRACE_STRIDED((dataLocations
), diffuse
);
3363 TRACE_STRIDED((dataLocations
), specular
);
3364 TRACE_STRIDED((dataLocations
), texCoords
[0]);
3365 TRACE_STRIDED((dataLocations
), texCoords
[1]);
3366 TRACE_STRIDED((dataLocations
), texCoords
[2]);
3367 TRACE_STRIDED((dataLocations
), texCoords
[3]);
3368 TRACE_STRIDED((dataLocations
), texCoords
[4]);
3369 TRACE_STRIDED((dataLocations
), texCoords
[5]);
3370 TRACE_STRIDED((dataLocations
), texCoords
[6]);
3371 TRACE_STRIDED((dataLocations
), texCoords
[7]);
3372 TRACE_STRIDED((dataLocations
), position2
);
3373 TRACE_STRIDED((dataLocations
), normal2
);
3374 TRACE_STRIDED((dataLocations
), tangent
);
3375 TRACE_STRIDED((dataLocations
), binormal
);
3376 TRACE_STRIDED((dataLocations
), tessFactor
);
3377 TRACE_STRIDED((dataLocations
), fog
);
3378 TRACE_STRIDED((dataLocations
), depth
);
3379 TRACE_STRIDED((dataLocations
), sample
);
3384 static void streamsrc(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3385 IWineD3DDeviceImpl
*device
= stateblock
->wineD3DDevice
;
3387 WineDirect3DVertexStridedData
*dataLocations
= &device
->strided_streams
;
3388 BOOL useVertexShaderFunction
;
3390 if (device
->vs_selected_mode
!= SHADER_NONE
&& stateblock
->vertexShader
&&
3391 ((IWineD3DVertexShaderImpl
*)stateblock
->vertexShader
)->baseShader
.function
!= NULL
) {
3392 useVertexShaderFunction
= TRUE
;
3394 useVertexShaderFunction
= FALSE
;
3398 if(device
->up_strided
) {
3399 /* Note: this is a ddraw fixed-function code path */
3400 TRACE("================ Strided Input ===================\n");
3401 memcpy(dataLocations
, device
->up_strided
, sizeof(*dataLocations
));
3404 drawPrimitiveTraceDataLocations(dataLocations
);
3407 /* Note: This is a fixed function or shader codepath.
3408 * This means it must handle both types of strided data.
3409 * Shaders must go through here to zero the strided data, even if they
3410 * don't set any declaration at all
3412 TRACE("================ Vertex Declaration ===================\n");
3413 memset(dataLocations
, 0, sizeof(*dataLocations
));
3414 primitiveDeclarationConvertToStridedData((IWineD3DDevice
*) device
,
3415 useVertexShaderFunction
, dataLocations
, &fixup
);
3418 if (dataLocations
->u
.s
.position_transformed
) {
3419 useVertexShaderFunction
= FALSE
;
3422 /* Unload the old arrays before loading the new ones to get old junk out */
3423 if(context
->numberedArraysLoaded
) {
3424 unloadNumberedArrays(stateblock
);
3425 context
->numberedArraysLoaded
= FALSE
;
3427 if(context
->namedArraysLoaded
) {
3428 unloadVertexData(stateblock
);
3429 context
->namedArraysLoaded
= FALSE
;
3432 if(useVertexShaderFunction
) {
3433 if(((IWineD3DVertexDeclarationImpl
*) stateblock
->vertexDecl
)->half_float_conv_needed
&& !fixup
) {
3434 TRACE("Using drawStridedSlow with vertex shaders for FLOAT16 conversion\n");
3435 device
->useDrawStridedSlow
= TRUE
;
3436 context
->numberedArraysLoaded
= FALSE
;
3438 TRACE("Loading numbered arrays\n");
3439 loadNumberedArrays(stateblock
, dataLocations
);
3440 device
->useDrawStridedSlow
= FALSE
;
3441 context
->numberedArraysLoaded
= TRUE
;
3444 (dataLocations
->u
.s
.pSize
.lpData
== NULL
&&
3445 dataLocations
->u
.s
.diffuse
.lpData
== NULL
&&
3446 dataLocations
->u
.s
.specular
.lpData
== NULL
)) {
3447 /* Load the vertex data using named arrays */
3448 TRACE("Loading vertex data\n");
3449 loadVertexData(stateblock
, dataLocations
);
3450 device
->useDrawStridedSlow
= FALSE
;
3451 context
->namedArraysLoaded
= TRUE
;
3453 TRACE("Not loading vertex data\n");
3454 device
->useDrawStridedSlow
= TRUE
;
3457 /* Generate some fixme's if unsupported functionality is being used */
3458 #define BUFFER_OR_DATA(_attribute) dataLocations->u.s._attribute.lpData
3459 /* TODO: Either support missing functionality in fixupVertices or by creating a shader to replace the pipeline. */
3460 if (!useVertexShaderFunction
&& (BUFFER_OR_DATA(position2
) || BUFFER_OR_DATA(normal2
))) {
3461 FIXME("Tweening is only valid with vertex shaders\n");
3463 if (!useVertexShaderFunction
&& (BUFFER_OR_DATA(tangent
) || BUFFER_OR_DATA(binormal
))) {
3464 FIXME("Tangent and binormal bump mapping is only valid with vertex shaders\n");
3466 if (!useVertexShaderFunction
&& (BUFFER_OR_DATA(tessFactor
) || BUFFER_OR_DATA(fog
) || BUFFER_OR_DATA(depth
) || BUFFER_OR_DATA(sample
))) {
3467 FIXME("Extended attributes are only valid with vertex shaders\n");
3469 #undef BUFFER_OR_DATA
3472 static void vertexdeclaration(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3473 BOOL useVertexShaderFunction
= FALSE
, updateFog
= FALSE
;
3474 BOOL usePixelShaderFunction
= stateblock
->wineD3DDevice
->ps_selected_mode
!= SHADER_NONE
&& stateblock
->pixelShader
3475 && ((IWineD3DPixelShaderImpl
*)stateblock
->pixelShader
)->baseShader
.function
;
3477 /* Some stuff is in the device until we have per context tracking */
3478 IWineD3DDeviceImpl
*device
= stateblock
->wineD3DDevice
;
3479 BOOL wasrhw
= context
->last_was_rhw
;
3481 /* Shaders can be implemented using ARB_PROGRAM, GLSL, or software -
3482 * here simply check whether a shader was set, or the user disabled shaders
3484 if (use_vs(device
)) {
3485 useVertexShaderFunction
= TRUE
;
3487 if(((IWineD3DVertexShaderImpl
*)stateblock
->vertexShader
)->baseShader
.reg_maps
.fog
!= context
->last_was_foggy_shader
) {
3490 } else if(context
->last_was_foggy_shader
) {
3494 transformed
= device
->strided_streams
.u
.s
.position_transformed
;
3495 if (transformed
) useVertexShaderFunction
= FALSE
;
3497 if(transformed
!= context
->last_was_rhw
&& !useVertexShaderFunction
) {
3501 /* Reapply lighting if it is not scheduled for reapplication already */
3502 if(!isStateDirty(context
, STATE_RENDER(WINED3DRS_LIGHTING
))) {
3503 state_lighting(STATE_RENDER(WINED3DRS_LIGHTING
), stateblock
, context
);
3507 context
->last_was_rhw
= TRUE
;
3510 /* Untransformed, so relies on the view and projection matrices */
3511 context
->last_was_rhw
= FALSE
;
3512 /* This turns off the Z scale trick to 'disable' viewport frustum clipping in rhw mode*/
3513 device
->untransformed
= TRUE
;
3515 /* Todo for sw shaders: Vertex Shader output is already transformed, so set up identity matrices
3516 * Not needed as long as only hw shaders are supported
3519 /* This sets the shader output position correction constants.
3520 * TODO: Move to the viewport state
3522 if (useVertexShaderFunction
) {
3523 device
->posFixup
[1] = device
->render_offscreen
? -1.0 : 1.0;
3524 device
->posFixup
[3] = -device
->posFixup
[1] / stateblock
->viewport
.Height
;
3528 /* Don't have to apply the matrices when vertex shaders are used. When vshaders are turned
3529 * off this function will be called again anyway to make sure they're properly set
3531 if(!useVertexShaderFunction
) {
3532 /* TODO: Move this mainly to the viewport state and only apply when the vp has changed
3533 * or transformed / untransformed was switched
3535 if(wasrhw
!= context
->last_was_rhw
&&
3536 !isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_PROJECTION
)) &&
3537 !isStateDirty(context
, STATE_VIEWPORT
)) {
3538 transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION
), stateblock
, context
);
3540 /* World matrix needs reapplication here only if we're switching between rhw and non-rhw
3543 * If a vertex shader is used, the world matrix changed and then vertex shader unbound
3544 * this check will fail and the matrix not applied again. This is OK because a simple
3545 * world matrix change reapplies the matrix - These checks here are only to satisfy the
3546 * needs of the vertex declaration.
3548 * World and view matrix go into the same gl matrix, so only apply them when neither is
3551 if(transformed
!= wasrhw
&&
3552 !isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0))) &&
3553 !isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_VIEW
))) {
3554 transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock
, context
);
3557 if(!isStateDirty(context
, STATE_RENDER(WINED3DRS_COLORVERTEX
))) {
3558 state_colormat(STATE_RENDER(WINED3DRS_COLORVERTEX
), stateblock
, context
);
3561 if(context
->last_was_vshader
&& !isStateDirty(context
, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE
))) {
3562 state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE
), stateblock
, context
);
3564 if(!isStateDirty(context
, STATE_RENDER(WINED3DRS_NORMALIZENORMALS
))) {
3565 state_normalize(STATE_RENDER(WINED3DRS_NORMALIZENORMALS
), stateblock
, context
);
3568 /* We compile the shader here because we need the vertex declaration
3569 * in order to determine if we need to do any swizzling for D3DCOLOR
3570 * registers. If the shader is already compiled this call will do nothing. */
3571 IWineD3DVertexShader_CompileShader(stateblock
->vertexShader
);
3573 if(!context
->last_was_vshader
) {
3575 static BOOL warned
= FALSE
;
3576 /* Disable all clip planes to get defined results on all drivers. See comment in the
3577 * state_clipping state handler
3579 for(i
= 0; i
< GL_LIMITS(clipplanes
); i
++) {
3580 glDisable(GL_CLIP_PLANE0
+ i
);
3581 checkGLcall("glDisable(GL_CLIP_PLANE0 + i)");
3584 if(!warned
&& stateblock
->renderState
[WINED3DRS_CLIPPLANEENABLE
]) {
3585 FIXME("Clipping not supported with vertex shaders\n");
3589 /* Apply the transform matrices when switching from rhw drawing to vertex shaders. Vertex
3590 * shaders themselves do not need it, but the matrices are not reapplied automatically when
3591 * switching back from vertex shaders to fixed function processing. So make sure we leave the
3592 * fixed function vertex processing states back in a sane state before switching to shaders
3594 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_PROJECTION
))) {
3595 transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION
), stateblock
, context
);
3597 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)))) {
3598 transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock
, context
);
3604 /* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
3607 if (!isStateDirty(context
, STATE_PIXELSHADER
)) {
3608 device
->shader_backend
->shader_select((IWineD3DDevice
*)device
, usePixelShaderFunction
, useVertexShaderFunction
);
3610 if (!isStateDirty(context
, STATE_VERTEXSHADERCONSTANT
) && (useVertexShaderFunction
|| usePixelShaderFunction
)) {
3611 shaderconstant(STATE_VERTEXSHADERCONSTANT
, stateblock
, context
);
3615 context
->last_was_vshader
= useVertexShaderFunction
;
3618 state_fog(STATE_RENDER(WINED3DRS_FOGENABLE
), stateblock
, context
);
3620 if(!useVertexShaderFunction
) {
3622 for(i
= 0; i
< MAX_TEXTURES
; i
++) {
3623 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_TEXTURE0
+ i
))) {
3624 transform_texture(STATE_TRANSFORM(WINED3DTS_TEXTURE0
+ i
), stateblock
, context
);
3630 static void viewport_miscpart(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3632 IWineD3DSurfaceImpl
*target
;
3634 glDepthRange(stateblock
->viewport
.MinZ
, stateblock
->viewport
.MaxZ
);
3635 checkGLcall("glDepthRange");
3636 /* Note: GL requires lower left, DirectX supplies upper left. This is reversed when using offscreen rendering
3638 if(stateblock
->wineD3DDevice
->render_offscreen
) {
3639 glViewport(stateblock
->viewport
.X
,
3640 stateblock
->viewport
.Y
,
3641 stateblock
->viewport
.Width
, stateblock
->viewport
.Height
);
3643 target
= (IWineD3DSurfaceImpl
*) stateblock
->wineD3DDevice
->render_targets
[0];
3644 target
->get_drawable_size(target
, &width
, &height
);
3646 glViewport(stateblock
->viewport
.X
,
3647 (height
- (stateblock
->viewport
.Y
+ stateblock
->viewport
.Height
)),
3648 stateblock
->viewport
.Width
, stateblock
->viewport
.Height
);
3651 checkGLcall("glViewport");
3654 static void viewport_vertexpart(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3655 stateblock
->wineD3DDevice
->posFixup
[2] = 1.0 / stateblock
->viewport
.Width
;
3656 stateblock
->wineD3DDevice
->posFixup
[3] = -stateblock
->wineD3DDevice
->posFixup
[1] / stateblock
->viewport
.Height
;
3657 if(!isStateDirty(context
, STATE_TRANSFORM(WINED3DTS_PROJECTION
))) {
3658 transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION
), stateblock
, context
);
3660 if(!isStateDirty(context
, STATE_RENDER(WINED3DRS_POINTSCALEENABLE
))) {
3661 state_pscale(STATE_RENDER(WINED3DRS_POINTSCALEENABLE
), stateblock
, context
);
3665 static void light(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3666 UINT Index
= state
- STATE_ACTIVELIGHT(0);
3667 PLIGHTINFOEL
*lightInfo
= stateblock
->activeLights
[Index
];
3670 glDisable(GL_LIGHT0
+ Index
);
3671 checkGLcall("glDisable(GL_LIGHT0 + Index)");
3674 float colRGBA
[] = {0.0, 0.0, 0.0, 0.0};
3676 /* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
3677 glMatrixMode(GL_MODELVIEW
);
3679 glLoadMatrixf(&stateblock
->transforms
[WINED3DTS_VIEW
].u
.m
[0][0]);
3682 colRGBA
[0] = lightInfo
->OriginalParms
.Diffuse
.r
;
3683 colRGBA
[1] = lightInfo
->OriginalParms
.Diffuse
.g
;
3684 colRGBA
[2] = lightInfo
->OriginalParms
.Diffuse
.b
;
3685 colRGBA
[3] = lightInfo
->OriginalParms
.Diffuse
.a
;
3686 glLightfv(GL_LIGHT0
+ Index
, GL_DIFFUSE
, colRGBA
);
3687 checkGLcall("glLightfv");
3690 colRGBA
[0] = lightInfo
->OriginalParms
.Specular
.r
;
3691 colRGBA
[1] = lightInfo
->OriginalParms
.Specular
.g
;
3692 colRGBA
[2] = lightInfo
->OriginalParms
.Specular
.b
;
3693 colRGBA
[3] = lightInfo
->OriginalParms
.Specular
.a
;
3694 glLightfv(GL_LIGHT0
+ Index
, GL_SPECULAR
, colRGBA
);
3695 checkGLcall("glLightfv");
3698 colRGBA
[0] = lightInfo
->OriginalParms
.Ambient
.r
;
3699 colRGBA
[1] = lightInfo
->OriginalParms
.Ambient
.g
;
3700 colRGBA
[2] = lightInfo
->OriginalParms
.Ambient
.b
;
3701 colRGBA
[3] = lightInfo
->OriginalParms
.Ambient
.a
;
3702 glLightfv(GL_LIGHT0
+ Index
, GL_AMBIENT
, colRGBA
);
3703 checkGLcall("glLightfv");
3705 if ((lightInfo
->OriginalParms
.Range
*lightInfo
->OriginalParms
.Range
) >= FLT_MIN
) {
3706 quad_att
= 1.4/(lightInfo
->OriginalParms
.Range
*lightInfo
->OriginalParms
.Range
);
3708 quad_att
= 0; /* 0 or MAX? (0 seems to be ok) */
3711 /* Do not assign attenuation values for lights that do not use them. D3D apps are free to pass any junk,
3712 * but gl drivers use them and may crash due to bad Attenuation values. Need for Speed most wanted sets
3713 * Attenuation0 to NaN and crashes in the gl lib
3716 switch (lightInfo
->OriginalParms
.Type
) {
3717 case WINED3DLIGHT_POINT
:
3719 glLightfv(GL_LIGHT0
+ Index
, GL_POSITION
, &lightInfo
->lightPosn
[0]);
3720 checkGLcall("glLightfv");
3721 glLightf(GL_LIGHT0
+ Index
, GL_SPOT_CUTOFF
, lightInfo
->cutoff
);
3722 checkGLcall("glLightf");
3723 /* Attenuation - Are these right? guessing... */
3724 glLightf(GL_LIGHT0
+ Index
, GL_CONSTANT_ATTENUATION
, lightInfo
->OriginalParms
.Attenuation0
);
3725 checkGLcall("glLightf");
3726 glLightf(GL_LIGHT0
+ Index
, GL_LINEAR_ATTENUATION
, lightInfo
->OriginalParms
.Attenuation1
);
3727 checkGLcall("glLightf");
3728 if (quad_att
< lightInfo
->OriginalParms
.Attenuation2
) quad_att
= lightInfo
->OriginalParms
.Attenuation2
;
3729 glLightf(GL_LIGHT0
+ Index
, GL_QUADRATIC_ATTENUATION
, quad_att
);
3730 checkGLcall("glLightf");
3734 case WINED3DLIGHT_SPOT
:
3736 glLightfv(GL_LIGHT0
+ Index
, GL_POSITION
, &lightInfo
->lightPosn
[0]);
3737 checkGLcall("glLightfv");
3739 glLightfv(GL_LIGHT0
+ Index
, GL_SPOT_DIRECTION
, &lightInfo
->lightDirn
[0]);
3740 checkGLcall("glLightfv");
3741 glLightf(GL_LIGHT0
+ Index
, GL_SPOT_EXPONENT
, lightInfo
->exponent
);
3742 checkGLcall("glLightf");
3743 glLightf(GL_LIGHT0
+ Index
, GL_SPOT_CUTOFF
, lightInfo
->cutoff
);
3744 checkGLcall("glLightf");
3745 /* Attenuation - Are these right? guessing... */
3746 glLightf(GL_LIGHT0
+ Index
, GL_CONSTANT_ATTENUATION
, lightInfo
->OriginalParms
.Attenuation0
);
3747 checkGLcall("glLightf");
3748 glLightf(GL_LIGHT0
+ Index
, GL_LINEAR_ATTENUATION
, lightInfo
->OriginalParms
.Attenuation1
);
3749 checkGLcall("glLightf");
3750 if (quad_att
< lightInfo
->OriginalParms
.Attenuation2
) quad_att
= lightInfo
->OriginalParms
.Attenuation2
;
3751 glLightf(GL_LIGHT0
+ Index
, GL_QUADRATIC_ATTENUATION
, quad_att
);
3752 checkGLcall("glLightf");
3756 case WINED3DLIGHT_DIRECTIONAL
:
3758 glLightfv(GL_LIGHT0
+ Index
, GL_POSITION
, &lightInfo
->lightPosn
[0]); /* Note gl uses w position of 0 for direction! */
3759 checkGLcall("glLightfv");
3760 glLightf(GL_LIGHT0
+ Index
, GL_SPOT_CUTOFF
, lightInfo
->cutoff
);
3761 checkGLcall("glLightf");
3762 glLightf(GL_LIGHT0
+ Index
, GL_SPOT_EXPONENT
, 0.0f
);
3763 checkGLcall("glLightf");
3767 FIXME("Unrecognized light type %d\n", lightInfo
->OriginalParms
.Type
);
3770 /* Restore the modelview matrix */
3773 glEnable(GL_LIGHT0
+ Index
);
3774 checkGLcall("glEnable(GL_LIGHT0 + Index)");
3780 static void scissorrect(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3781 RECT
*pRect
= &stateblock
->scissorRect
;
3784 IWineD3DSurfaceImpl
*target
= (IWineD3DSurfaceImpl
*) stateblock
->wineD3DDevice
->render_targets
[0];
3786 target
->get_drawable_size(target
, &width
, &height
);
3787 /* Warning: glScissor uses window coordinates, not viewport coordinates, so our viewport correction does not apply
3788 * Warning2: Even in windowed mode the coords are relative to the window, not the screen
3790 TRACE("(%p) Setting new Scissor Rect to %d:%d-%d:%d\n", stateblock
->wineD3DDevice
, pRect
->left
, pRect
->bottom
- height
,
3791 pRect
->right
- pRect
->left
, pRect
->bottom
- pRect
->top
);
3793 if (stateblock
->wineD3DDevice
->render_offscreen
) {
3794 glScissor(pRect
->left
, pRect
->top
, pRect
->right
- pRect
->left
, pRect
->bottom
- pRect
->top
);
3796 glScissor(pRect
->left
, height
- pRect
->bottom
, pRect
->right
- pRect
->left
, pRect
->bottom
- pRect
->top
);
3798 checkGLcall("glScissor");
3801 static void indexbuffer(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3802 if(GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT
)) {
3803 if(stateblock
->streamIsUP
|| stateblock
->pIndexData
== NULL
) {
3804 GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB
, 0));
3806 IWineD3DIndexBufferImpl
*ib
= (IWineD3DIndexBufferImpl
*) stateblock
->pIndexData
;
3807 GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB
, ib
->vbo
));
3812 static void frontface(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
3813 if(stateblock
->wineD3DDevice
->render_offscreen
) {
3814 glFrontFace(GL_CCW
);
3815 checkGLcall("glFrontFace(GL_CCW)");
3818 checkGLcall("glFrontFace(GL_CW)");
3822 const struct StateEntry FFPStateTable
[] =
3824 /* State name representative, apply function */
3825 { /* 0, Undefined */ 0, state_undefined
},
3826 { /* 1, WINED3DRS_TEXTUREHANDLE */ 0 /* Handled in ddraw */, state_undefined
},
3827 { /* 2, WINED3DRS_ANTIALIAS */ STATE_RENDER(WINED3DRS_ANTIALIAS
), state_antialias
},
3828 { /* 3, WINED3DRS_TEXTUREADDRESS */ 0 /* Handled in ddraw */, state_undefined
},
3829 { /* 4, WINED3DRS_TEXTUREPERSPECTIVE */ STATE_RENDER(WINED3DRS_TEXTUREPERSPECTIVE
), state_perspective
},
3830 { /* 5, WINED3DRS_WRAPU */ STATE_RENDER(WINED3DRS_WRAPU
), state_wrapu
},
3831 { /* 6, WINED3DRS_WRAPV */ STATE_RENDER(WINED3DRS_WRAPV
), state_wrapv
},
3832 { /* 7, WINED3DRS_ZENABLE */ STATE_RENDER(WINED3DRS_ZENABLE
), state_zenable
},
3833 { /* 8, WINED3DRS_FILLMODE */ STATE_RENDER(WINED3DRS_FILLMODE
), state_fillmode
},
3834 { /* 9, WINED3DRS_SHADEMODE */ STATE_RENDER(WINED3DRS_SHADEMODE
), state_shademode
},
3835 { /* 10, WINED3DRS_LINEPATTERN */ STATE_RENDER(WINED3DRS_LINEPATTERN
), state_linepattern
},
3836 { /* 11, WINED3DRS_MONOENABLE */ STATE_RENDER(WINED3DRS_MONOENABLE
), state_monoenable
},
3837 { /* 12, WINED3DRS_ROP2 */ STATE_RENDER(WINED3DRS_ROP2
), state_rop2
},
3838 { /* 13, WINED3DRS_PLANEMASK */ STATE_RENDER(WINED3DRS_PLANEMASK
), state_planemask
},
3839 { /* 14, WINED3DRS_ZWRITEENABLE */ STATE_RENDER(WINED3DRS_ZWRITEENABLE
), state_zwritenable
},
3840 { /* 15, WINED3DRS_ALPHATESTENABLE */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE
), state_alpha
},
3841 { /* 16, WINED3DRS_LASTPIXEL */ STATE_RENDER(WINED3DRS_LASTPIXEL
), state_lastpixel
},
3842 { /* 17, WINED3DRS_TEXTUREMAG */ 0 /* Handled in ddraw */, state_undefined
},
3843 { /* 18, WINED3DRS_TEXTUREMIN */ 0 /* Handled in ddraw */, state_undefined
},
3844 { /* 19, WINED3DRS_SRCBLEND */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
3845 { /* 20, WINED3DRS_DESTBLEND */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
3846 { /* 21, WINED3DRS_TEXTUREMAPBLEND */ 0 /* Handled in ddraw */, state_undefined
},
3847 { /* 22, WINED3DRS_CULLMODE */ STATE_RENDER(WINED3DRS_CULLMODE
), state_cullmode
},
3848 { /* 23, WINED3DRS_ZFUNC */ STATE_RENDER(WINED3DRS_ZFUNC
), state_zfunc
},
3849 { /* 24, WINED3DRS_ALPHAREF */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE
), state_alpha
},
3850 { /* 25, WINED3DRS_ALPHAFUNC */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE
), state_alpha
},
3851 { /* 26, WINED3DRS_DITHERENABLE */ STATE_RENDER(WINED3DRS_DITHERENABLE
), state_ditherenable
},
3852 { /* 27, WINED3DRS_ALPHABLENDENABLE */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
3853 { /* 28, WINED3DRS_FOGENABLE */ STATE_RENDER(WINED3DRS_FOGENABLE
), state_fog
},
3854 { /* 29, WINED3DRS_SPECULARENABLE */ STATE_RENDER(WINED3DRS_SPECULARENABLE
), NULL
},
3855 { /* 30, WINED3DRS_ZVISIBLE */ 0 /* Not supported according to the msdn */, state_nogl
},
3856 { /* 31, WINED3DRS_SUBPIXEL */ STATE_RENDER(WINED3DRS_SUBPIXEL
), state_subpixel
},
3857 { /* 32, WINED3DRS_SUBPIXELX */ STATE_RENDER(WINED3DRS_SUBPIXELX
), state_subpixelx
},
3858 { /* 33, WINED3DRS_STIPPLEDALPHA */ STATE_RENDER(WINED3DRS_STIPPLEDALPHA
), state_stippledalpha
},
3859 { /* 34, WINED3DRS_FOGCOLOR */ STATE_RENDER(WINED3DRS_FOGCOLOR
), state_fogcolor
},
3860 { /* 35, WINED3DRS_FOGTABLEMODE */ STATE_RENDER(WINED3DRS_FOGENABLE
), state_fog
},
3861 { /* 36, WINED3DRS_FOGSTART */ STATE_RENDER(WINED3DRS_FOGENABLE
), state_fog
},
3862 { /* 37, WINED3DRS_FOGEND */ STATE_RENDER(WINED3DRS_FOGENABLE
), state_fog
},
3863 { /* 38, WINED3DRS_FOGDENSITY */ STATE_RENDER(WINED3DRS_FOGDENSITY
), state_fogdensity
},
3864 { /* 39, WINED3DRS_STIPPLEENABLE */ STATE_RENDER(WINED3DRS_STIPPLEENABLE
), state_stippleenable
},
3865 { /* 40, WINED3DRS_EDGEANTIALIAS */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
3866 { /* 41, WINED3DRS_COLORKEYENABLE */ STATE_RENDER(WINED3DRS_ALPHATESTENABLE
), state_alpha
},
3867 { /* 42, undefined */ 0, state_undefined
},
3868 { /* 43, WINED3DRS_BORDERCOLOR */ STATE_RENDER(WINED3DRS_BORDERCOLOR
), state_bordercolor
},
3869 { /* 44, WINED3DRS_TEXTUREADDRESSU */ 0, /* Handled in ddraw */ state_undefined
},
3870 { /* 45, WINED3DRS_TEXTUREADDRESSV */ 0, /* Handled in ddraw */ state_undefined
},
3871 { /* 46, WINED3DRS_MIPMAPLODBIAS */ STATE_RENDER(WINED3DRS_MIPMAPLODBIAS
), state_mipmaplodbias
},
3872 { /* 47, WINED3DRS_ZBIAS */ STATE_RENDER(WINED3DRS_ZBIAS
), state_zbias
},
3873 { /* 48, WINED3DRS_RANGEFOGENABLE */ STATE_RENDER(WINED3DRS_RANGEFOGENABLE
), state_rangefog
},
3874 { /* 49, WINED3DRS_ANISOTROPY */ STATE_RENDER(WINED3DRS_ANISOTROPY
), state_anisotropy
},
3875 { /* 50, WINED3DRS_FLUSHBATCH */ STATE_RENDER(WINED3DRS_FLUSHBATCH
), state_flushbatch
},
3876 { /* 51, WINED3DRS_TRANSLUCENTSORTINDEPENDENT */ STATE_RENDER(WINED3DRS_TRANSLUCENTSORTINDEPENDENT
), state_translucentsi
},
3877 { /* 52, WINED3DRS_STENCILENABLE */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
3878 { /* 53, WINED3DRS_STENCILFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
3879 { /* 54, WINED3DRS_STENCILZFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
3880 { /* 55, WINED3DRS_STENCILPASS */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
3881 { /* 56, WINED3DRS_STENCILFUNC */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
3882 { /* 57, WINED3DRS_STENCILREF */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
3883 { /* 58, WINED3DRS_STENCILMASK */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
3884 { /* 59, WINED3DRS_STENCILWRITEMASK */ STATE_RENDER(WINED3DRS_STENCILWRITEMASK
), state_stencilwrite
},
3885 { /* 60, WINED3DRS_TEXTUREFACTOR */ STATE_RENDER(WINED3DRS_TEXTUREFACTOR
), state_texfactor
},
3886 { /* 61, Undefined */ 0, state_undefined
},
3887 { /* 62, Undefined */ 0, state_undefined
},
3888 { /* 63, Undefined */ 0, state_undefined
},
3889 { /* 64, WINED3DRS_STIPPLEPATTERN00 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3890 { /* 65, WINED3DRS_STIPPLEPATTERN01 */ 0 /* Obsolete, should he handled by ddraw */, state_undefined
},
3891 { /* 66, WINED3DRS_STIPPLEPATTERN02 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3892 { /* 67, WINED3DRS_STIPPLEPATTERN03 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3893 { /* 68, WINED3DRS_STIPPLEPATTERN04 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3894 { /* 69, WINED3DRS_STIPPLEPATTERN05 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3895 { /* 70, WINED3DRS_STIPPLEPATTERN06 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3896 { /* 71, WINED3DRS_STIPPLEPATTERN07 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3897 { /* 72, WINED3DRS_STIPPLEPATTERN08 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3898 { /* 73, WINED3DRS_STIPPLEPATTERN09 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3899 { /* 74, WINED3DRS_STIPPLEPATTERN10 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3900 { /* 75, WINED3DRS_STIPPLEPATTERN11 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3901 { /* 76, WINED3DRS_STIPPLEPATTERN12 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3902 { /* 77, WINED3DRS_STIPPLEPATTERN13 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3903 { /* 78, WINED3DRS_STIPPLEPATTERN14 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3904 { /* 79, WINED3DRS_STIPPLEPATTERN15 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3905 { /* 80, WINED3DRS_STIPPLEPATTERN16 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3906 { /* 81, WINED3DRS_STIPPLEPATTERN17 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3907 { /* 82, WINED3DRS_STIPPLEPATTERN18 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3908 { /* 83, WINED3DRS_STIPPLEPATTERN19 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3909 { /* 84, WINED3DRS_STIPPLEPATTERN20 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3910 { /* 85, WINED3DRS_STIPPLEPATTERN21 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3911 { /* 86, WINED3DRS_STIPPLEPATTERN22 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3912 { /* 87, WINED3DRS_STIPPLEPATTERN23 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3913 { /* 88, WINED3DRS_STIPPLEPATTERN24 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3914 { /* 89, WINED3DRS_STIPPLEPATTERN25 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3915 { /* 90, WINED3DRS_STIPPLEPATTERN26 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3916 { /* 91, WINED3DRS_STIPPLEPATTERN27 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3917 { /* 92, WINED3DRS_STIPPLEPATTERN28 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3918 { /* 93, WINED3DRS_STIPPLEPATTERN29 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3919 { /* 94, WINED3DRS_STIPPLEPATTERN30 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3920 { /* 95, WINED3DRS_STIPPLEPATTERN31 */ 0 /* Obsolete, should be handled by ddraw */, state_undefined
},
3921 { /* 96, Undefined */ 0, state_undefined
},
3922 { /* 97, Undefined */ 0, state_undefined
},
3923 { /* 98, Undefined */ 0, state_undefined
},
3924 { /* 99, Undefined */ 0, state_undefined
},
3925 { /*100, Undefined */ 0, state_undefined
},
3926 { /*101, Undefined */ 0, state_undefined
},
3927 { /*102, Undefined */ 0, state_undefined
},
3928 { /*103, Undefined */ 0, state_undefined
},
3929 { /*104, Undefined */ 0, state_undefined
},
3930 { /*105, Undefined */ 0, state_undefined
},
3931 { /*106, Undefined */ 0, state_undefined
},
3932 { /*107, Undefined */ 0, state_undefined
},
3933 { /*108, Undefined */ 0, state_undefined
},
3934 { /*109, Undefined */ 0, state_undefined
},
3935 { /*110, Undefined */ 0, state_undefined
},
3936 { /*111, Undefined */ 0, state_undefined
},
3937 { /*112, Undefined */ 0, state_undefined
},
3938 { /*113, Undefined */ 0, state_undefined
},
3939 { /*114, Undefined */ 0, state_undefined
},
3940 { /*115, Undefined */ 0, state_undefined
},
3941 { /*116, Undefined */ 0, state_undefined
},
3942 { /*117, Undefined */ 0, state_undefined
},
3943 { /*118, Undefined */ 0, state_undefined
},
3944 { /*119, Undefined */ 0, state_undefined
},
3945 { /*120, Undefined */ 0, state_undefined
},
3946 { /*121, Undefined */ 0, state_undefined
},
3947 { /*122, Undefined */ 0, state_undefined
},
3948 { /*123, Undefined */ 0, state_undefined
},
3949 { /*124, Undefined */ 0, state_undefined
},
3950 { /*125, Undefined */ 0, state_undefined
},
3951 { /*126, Undefined */ 0, state_undefined
},
3952 { /*127, Undefined */ 0, state_undefined
},
3954 { /*128, WINED3DRS_WRAP0 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3955 { /*129, WINED3DRS_WRAP1 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3956 { /*130, WINED3DRS_WRAP2 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3957 { /*131, WINED3DRS_WRAP3 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3958 { /*132, WINED3DRS_WRAP4 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3959 { /*133, WINED3DRS_WRAP5 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3960 { /*134, WINED3DRS_WRAP6 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3961 { /*135, WINED3DRS_WRAP7 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
3962 { /*136, WINED3DRS_CLIPPING */ STATE_RENDER(WINED3DRS_CLIPPING
), state_clipping
},
3963 { /*137, WINED3DRS_LIGHTING */ STATE_RENDER(WINED3DRS_LIGHTING
), state_lighting
},
3964 { /*138, WINED3DRS_EXTENTS */ STATE_RENDER(WINED3DRS_EXTENTS
), state_extents
},
3965 { /*139, WINED3DRS_AMBIENT */ STATE_RENDER(WINED3DRS_AMBIENT
), state_ambient
},
3966 { /*140, WINED3DRS_FOGVERTEXMODE */ STATE_RENDER(WINED3DRS_FOGENABLE
), state_fog
},
3967 { /*141, WINED3DRS_COLORVERTEX */ STATE_RENDER(WINED3DRS_COLORVERTEX
), state_colormat
},
3968 { /*142, WINED3DRS_LOCALVIEWER */ STATE_RENDER(WINED3DRS_LOCALVIEWER
), state_localviewer
},
3969 { /*143, WINED3DRS_NORMALIZENORMALS */ STATE_RENDER(WINED3DRS_NORMALIZENORMALS
), state_normalize
},
3970 { /*144, WINED3DRS_COLORKEYBLENDENABLE */ STATE_RENDER(WINED3DRS_COLORKEYBLENDENABLE
), state_ckeyblend
},
3971 { /*145, WINED3DRS_DIFFUSEMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX
), state_colormat
},
3972 { /*146, WINED3DRS_SPECULARMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX
), state_colormat
},
3973 { /*147, WINED3DRS_AMBIENTMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX
), state_colormat
},
3974 { /*148, WINED3DRS_EMISSIVEMATERIALSOURCE */ STATE_RENDER(WINED3DRS_COLORVERTEX
), state_colormat
},
3975 { /*149, Undefined */ 0, state_undefined
},
3976 { /*150, Undefined */ 0, state_undefined
},
3977 { /*151, WINED3DRS_VERTEXBLEND */ STATE_RENDER(WINED3DRS_VERTEXBLEND
), state_vertexblend
},
3978 { /*152, WINED3DRS_CLIPPLANEENABLE */ STATE_RENDER(WINED3DRS_CLIPPING
), state_clipping
},
3979 { /*153, WINED3DRS_SOFTWAREVERTEXPROCESSING */ 0, state_nogl
},
3980 { /*154, WINED3DRS_POINTSIZE */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE
), state_pscale
},
3981 { /*155, WINED3DRS_POINTSIZE_MIN */ STATE_RENDER(WINED3DRS_POINTSIZE_MIN
), state_psizemin
},
3982 { /*156, WINED3DRS_POINTSPRITEENABLE */ STATE_RENDER(WINED3DRS_POINTSPRITEENABLE
), state_pointsprite
},
3983 { /*157, WINED3DRS_POINTSCALEENABLE */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE
), state_pscale
},
3984 { /*158, WINED3DRS_POINTSCALE_A */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE
), state_pscale
},
3985 { /*159, WINED3DRS_POINTSCALE_B */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE
), state_pscale
},
3986 { /*160, WINED3DRS_POINTSCALE_C */ STATE_RENDER(WINED3DRS_POINTSCALEENABLE
), state_pscale
},
3987 { /*161, WINED3DRS_MULTISAMPLEANTIALIAS */ STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS
), state_multisampleaa
},
3988 { /*162, WINED3DRS_MULTISAMPLEMASK */ STATE_RENDER(WINED3DRS_MULTISAMPLEMASK
), state_multisampmask
},
3989 { /*163, WINED3DRS_PATCHEDGESTYLE */ STATE_RENDER(WINED3DRS_PATCHEDGESTYLE
), state_patchedgestyle
},
3990 { /*164, WINED3DRS_PATCHSEGMENTS */ STATE_RENDER(WINED3DRS_PATCHSEGMENTS
), state_patchsegments
},
3991 { /*165, WINED3DRS_DEBUGMONITORTOKEN */ STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN
), state_nogl
},
3992 { /*166, WINED3DRS_POINTSIZE_MAX */ STATE_RENDER(WINED3DRS_POINTSIZE_MAX
), state_psizemax
},
3993 { /*167, WINED3DRS_INDEXEDVERTEXBLENDENABLE */ 0, state_nogl
},
3994 { /*168, WINED3DRS_COLORWRITEENABLE */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE
), state_colorwrite
},
3995 { /*169, Undefined */ 0, state_undefined
},
3996 { /*170, WINED3DRS_TWEENFACTOR */ 0, state_nogl
},
3997 { /*171, WINED3DRS_BLENDOP */ STATE_RENDER(WINED3DRS_BLENDOP
), state_blendop
},
3998 { /*172, WINED3DRS_POSITIONDEGREE */ STATE_RENDER(WINED3DRS_POSITIONDEGREE
), state_positiondegree
},
3999 { /*173, WINED3DRS_NORMALDEGREE */ STATE_RENDER(WINED3DRS_NORMALDEGREE
), state_normaldegree
},
4000 /*172, WINED3DRS_POSITIONORDER */ /* Value assigned to 2 state names */
4001 /*173, WINED3DRS_NORMALORDER */ /* Value assigned to 2 state names */
4002 { /*174, WINED3DRS_SCISSORTESTENABLE */ STATE_RENDER(WINED3DRS_SCISSORTESTENABLE
), state_scissor
},
4003 { /*175, WINED3DRS_SLOPESCALEDEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS
), state_depthbias
},
4004 { /*176, WINED3DRS_ANTIALIASEDLINEENABLE */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
4005 { /*177, undefined */ 0, state_undefined
},
4006 { /*178, WINED3DRS_MINTESSELLATIONLEVEL */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION
), state_tessellation
},
4007 { /*179, WINED3DRS_MAXTESSELLATIONLEVEL */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION
), state_tessellation
},
4008 { /*180, WINED3DRS_ADAPTIVETESS_X */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION
), state_tessellation
},
4009 { /*181, WINED3DRS_ADAPTIVETESS_Y */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION
), state_tessellation
},
4010 { /*182, WINED3DRS_ADAPTIVETESS_Z */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION
), state_tessellation
},
4011 { /*183, WINED3DRS_ADAPTIVETESS_W */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION
), state_tessellation
},
4012 { /*184, WINED3DRS_ENABLEADAPTIVETESSELLATION */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION
), state_tessellation
},
4013 { /*185, WINED3DRS_TWOSIDEDSTENCILMODE */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
4014 { /*186, WINED3DRS_CCW_STENCILFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
4015 { /*187, WINED3DRS_CCW_STENCILZFAIL */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
4016 { /*188, WINED3DRS_CCW_STENCILPASS */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
4017 { /*189, WINED3DRS_CCW_STENCILFUNC */ STATE_RENDER(WINED3DRS_STENCILENABLE
), state_stencil
},
4018 { /*190, WINED3DRS_COLORWRITEENABLE1 */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE
), state_colorwrite
},
4019 { /*191, WINED3DRS_COLORWRITEENABLE2 */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE
), state_colorwrite
},
4020 { /*192, WINED3DRS_COLORWRITEENABLE3 */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE
), state_colorwrite
},
4021 { /*193, WINED3DRS_BLENDFACTOR */ STATE_RENDER(WINED3DRS_BLENDFACTOR
), state_blendfactor
},
4022 { /*194, WINED3DRS_SRGBWRITEENABLE */ STATE_PIXELSHADER
, pixelshader
},
4023 { /*195, WINED3DRS_DEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS
), state_depthbias
},
4024 { /*196, undefined */ 0, state_undefined
},
4025 { /*197, undefined */ 0, state_undefined
},
4026 { /*198, WINED3DRS_WRAP8 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4027 { /*199, WINED3DRS_WRAP9 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4028 { /*200, WINED3DRS_WRAP10 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4029 { /*201, WINED3DRS_WRAP11 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4030 { /*202, WINED3DRS_WRAP12 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4031 { /*203, WINED3DRS_WRAP13 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4032 { /*204, WINED3DRS_WRAP14 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4033 { /*205, WINED3DRS_WRAP15 */ STATE_RENDER(WINED3DRS_WRAP0
), state_wrap
},
4034 { /*206, WINED3DRS_SEPARATEALPHABLENDENABLE */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
4035 { /*207, WINED3DRS_SRCBLENDALPHA */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
4036 { /*208, WINED3DRS_DESTBLENDALPHA */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
4037 { /*209, WINED3DRS_BLENDOPALPHA */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), NULL
},
4038 /* Texture stage states */
4039 { /*0, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP
), tex_colorop
},
4040 { /*0, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP
), tex_colorop
},
4041 { /*0, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP
), tex_colorop
},
4042 { /*0, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4043 { /*0, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4044 { /*0, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4045 { /*0, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4046 { /*0, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4047 { /*0, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4048 { /*0, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4049 { /*0, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(0, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4050 { /*0, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4051 { /*0, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4052 { /*0, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4053 { /*0, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4054 { /*0, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4055 { /*0, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4056 { /*0, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4057 { /*0, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4058 { /*0, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4059 { /*0, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4060 { /*0, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4061 { /*0, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4062 { /*0, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE0
), NULL
},
4063 { /*0, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4064 { /*0, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP
), tex_colorop
},
4065 { /*0, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4066 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP
), tex_colorop
},
4067 { /*0, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4068 { /*0, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4069 { /*0, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4070 { /*0, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4072 { /*1, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP
), tex_colorop
},
4073 { /*1, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP
), tex_colorop
},
4074 { /*1, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP
), tex_colorop
},
4075 { /*1, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4076 { /*1, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4077 { /*1, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4078 { /*1, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4079 { /*1, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4080 { /*1, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4081 { /*1, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4082 { /*1, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(1, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4083 { /*1, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4084 { /*1, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4085 { /*1, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4086 { /*1, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4087 { /*1, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4088 { /*1, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4089 { /*1, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4090 { /*1, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4091 { /*1, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4092 { /*1, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4093 { /*1, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4094 { /*1, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4095 { /*1, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE1
), NULL
},
4096 { /*1, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4097 { /*1, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP
), tex_colorop
},
4098 { /*1, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4099 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP
), tex_colorop
},
4100 { /*1, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4101 { /*1, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4102 { /*1, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4103 { /*1, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4105 { /*2, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP
), tex_colorop
},
4106 { /*2, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP
), tex_colorop
},
4107 { /*2, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP
), tex_colorop
},
4108 { /*2, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4109 { /*2, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4110 { /*2, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4111 { /*2, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4112 { /*2, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4113 { /*2, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4114 { /*2, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4115 { /*2, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(2, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4116 { /*2, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4117 { /*2, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4118 { /*2, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4119 { /*2, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4120 { /*2, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4121 { /*2, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4122 { /*2, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4123 { /*2, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4124 { /*2, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4125 { /*2, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4126 { /*2, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4127 { /*2, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4128 { /*2, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE2
), NULL
},
4129 { /*2, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4130 { /*2, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP
), tex_colorop
},
4131 { /*2, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4132 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP
), tex_colorop
},
4133 { /*2, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4134 { /*2, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4135 { /*2, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4136 { /*2, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4138 { /*3, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP
), tex_colorop
},
4139 { /*3, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP
), tex_colorop
},
4140 { /*3, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP
), tex_colorop
},
4141 { /*3, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4142 { /*3, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4143 { /*3, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4144 { /*3, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4145 { /*3, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4146 { /*3, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4147 { /*3, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4148 { /*3, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(3, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4149 { /*3, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4150 { /*3, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4151 { /*3, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4152 { /*3, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4153 { /*3, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4154 { /*3, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4155 { /*3, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4156 { /*3, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4157 { /*3, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4158 { /*3, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4159 { /*3, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4160 { /*3, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4161 { /*3, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE3
), NULL
},
4162 { /*3, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4163 { /*3, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP
), tex_colorop
},
4164 { /*3, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4165 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP
), tex_colorop
},
4166 { /*3, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4167 { /*3, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4168 { /*3, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4169 { /*3, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4171 { /*4, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP
), tex_colorop
},
4172 { /*4, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP
), tex_colorop
},
4173 { /*4, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP
), tex_colorop
},
4174 { /*4, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4175 { /*4, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4176 { /*4, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4177 { /*4, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4178 { /*4, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4179 { /*4, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4180 { /*4, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4181 { /*4, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(4, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4182 { /*4, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4183 { /*4, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4184 { /*4, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4185 { /*4, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4186 { /*4, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4187 { /*4, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4188 { /*4, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4189 { /*4, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4190 { /*4, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4191 { /*4, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4192 { /*4, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4193 { /*4, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4194 { /*4, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE4
), NULL
},
4195 { /*4, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4196 { /*4, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP
), tex_colorop
},
4197 { /*4, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4198 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP
), tex_colorop
},
4199 { /*4, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4200 { /*4, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4201 { /*4, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4202 { /*4, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4204 { /*5, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP
), tex_colorop
},
4205 { /*5, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP
), tex_colorop
},
4206 { /*5, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP
), tex_colorop
},
4207 { /*5, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4208 { /*5, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4209 { /*5, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4210 { /*5, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4211 { /*5, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4212 { /*5, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4213 { /*5, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4214 { /*5, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(5, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4215 { /*5, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4216 { /*5, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4217 { /*5, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4218 { /*5, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4219 { /*5, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4220 { /*5, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4221 { /*5, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4222 { /*5, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4223 { /*5, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4224 { /*5, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4225 { /*5, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4226 { /*5, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4227 { /*5, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE5
), NULL
},
4228 { /*5, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4229 { /*5, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP
), tex_colorop
},
4230 { /*5, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4231 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP
), tex_colorop
},
4232 { /*5, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4233 { /*5, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4234 { /*5, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4235 { /*5, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4237 { /*6, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP
), tex_colorop
},
4238 { /*6, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP
), tex_colorop
},
4239 { /*6, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP
), tex_colorop
},
4240 { /*6, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4241 { /*6, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4242 { /*6, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4243 { /*6, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4244 { /*6, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4245 { /*6, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4246 { /*6, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4247 { /*6, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(6, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4248 { /*6, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4249 { /*6, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4250 { /*6, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4251 { /*6, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4252 { /*6, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4253 { /*6, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4254 { /*6, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4255 { /*6, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4256 { /*6, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4257 { /*6, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4258 { /*6, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4259 { /*6, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4260 { /*6, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE6
), NULL
},
4261 { /*6, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4262 { /*6, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP
), tex_colorop
},
4263 { /*6, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4264 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP
), tex_colorop
},
4265 { /*6, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4266 { /*6, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4267 { /*6, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4268 { /*6, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4270 { /*7, 01, WINED3DTSS_COLOROP */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP
), tex_colorop
},
4271 { /*7, 02, WINED3DTSS_COLORARG1 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP
), tex_colorop
},
4272 { /*7, 03, WINED3DTSS_COLORARG2 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP
), tex_colorop
},
4273 { /*7, 04, WINED3DTSS_ALPHAOP */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4274 { /*7, 05, WINED3DTSS_ALPHAARG1 */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4275 { /*7, 06, WINED3DTSS_ALPHAARG2 */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4276 { /*7, 07, WINED3DTSS_BUMPENVMAT00 */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4277 { /*7, 08, WINED3DTSS_BUMPENVMAT01 */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4278 { /*7, 09, WINED3DTSS_BUMPENVMAT10 */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4279 { /*7, 10, WINED3DTSS_BUMPENVMAT11 */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00
), tex_bumpenvmat
},
4280 { /*7, 11, WINED3DTSS_TEXCOORDINDEX */ STATE_TEXTURESTAGE(7, WINED3DTSS_TEXCOORDINDEX
), tex_coordindex
},
4281 { /*7, 12, WINED3DTSS_ADDRESS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4282 { /*7, 13, WINED3DTSS_ADDRESSU */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4283 { /*7, 14, WINED3DTSS_ADDRESSV */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4284 { /*7, 15, WINED3DTSS_BORDERCOLOR */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4285 { /*7, 16, WINED3DTSS_MAGFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4286 { /*7, 17, WINED3DTSS_MINFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4287 { /*7, 18, WINED3DTSS_MIPFILTER */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4288 { /*7, 19, WINED3DTSS_MIPMAPLODBIAS */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4289 { /*7, 20, WINED3DTSS_MAXMIPLEVEL */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4290 { /*7, 21, WINED3DTSS_MAXANISOTROPY */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4291 { /*7, 22, WINED3DTSS_BUMPENVLSCALE */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE
), tex_bumpenvlscale
},
4292 { /*7, 23, WINED3DTSS_BUMPENVLOFFSET */ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLOFFSET
), tex_bumpenvloffset
},
4293 { /*7, 24, WINED3DTSS_TEXTURETRANSFORMFLAGS */ STATE_TRANSFORM(WINED3DTS_TEXTURE7
), NULL
},
4294 { /*7, 25, WINED3DTSS_ADDRESSW */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4295 { /*7, 26, WINED3DTSS_COLORARG0 */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP
), tex_colorop
},
4296 { /*7, 27, WINED3DTSS_ALPHAARG0 */ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP
), tex_alphaop
},
4297 { /*0, 28, WINED3DTSS_RESULTARG */ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP
), tex_colorop
},
4298 { /*7, 29, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4299 { /*7, 30, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4300 { /*7, 31, undefined */ 0 /* -> sampler state in ddraw / d3d8 */, state_undefined
},
4301 { /*7, 32, WINED3DTSS_CONSTANT */ 0 /* As long as we don't support D3DTA_CONSTANT */, state_nogl
},
4302 /* Sampler states */
4303 { /* 0, Sampler 0 */ STATE_SAMPLER(0), sampler
},
4304 { /* 1, Sampler 1 */ STATE_SAMPLER(1), sampler
},
4305 { /* 2, Sampler 2 */ STATE_SAMPLER(2), sampler
},
4306 { /* 3, Sampler 3 */ STATE_SAMPLER(3), sampler
},
4307 { /* 4, Sampler 3 */ STATE_SAMPLER(4), sampler
},
4308 { /* 5, Sampler 5 */ STATE_SAMPLER(5), sampler
},
4309 { /* 6, Sampler 6 */ STATE_SAMPLER(6), sampler
},
4310 { /* 7, Sampler 7 */ STATE_SAMPLER(7), sampler
},
4311 { /* 8, Sampler 8 */ STATE_SAMPLER(8), sampler
},
4312 { /* 9, Sampler 9 */ STATE_SAMPLER(9), sampler
},
4313 { /*10, Sampler 10 */ STATE_SAMPLER(10), sampler
},
4314 { /*11, Sampler 11 */ STATE_SAMPLER(11), sampler
},
4315 { /*12, Sampler 12 */ STATE_SAMPLER(12), sampler
},
4316 { /*13, Sampler 13 */ STATE_SAMPLER(13), sampler
},
4317 { /*14, Sampler 14 */ STATE_SAMPLER(14), sampler
},
4318 { /*15, Sampler 15 */ STATE_SAMPLER(15), sampler
},
4319 { /*16, Vertex sampler 0 */ STATE_SAMPLER(16), sampler
},
4320 { /*17, Vertex sampler 1 */ STATE_SAMPLER(17), sampler
},
4321 { /*18, Vertex sampler 2 */ STATE_SAMPLER(18), sampler
},
4322 { /*19, Vertex sampler 3 */ STATE_SAMPLER(19), sampler
},
4324 { /* , Pixel Shader */ STATE_PIXELSHADER
, pixelshader
},
4325 /* Transform states follow */
4326 { /* 1, undefined */ 0, state_undefined
},
4327 { /* 2, WINED3DTS_VIEW */ STATE_TRANSFORM(WINED3DTS_VIEW
), NULL
},
4328 { /* 3, WINED3DTS_PROJECTION */ STATE_TRANSFORM(WINED3DTS_PROJECTION
), NULL
},
4329 { /* 4, undefined */ 0, state_undefined
},
4330 { /* 5, undefined */ 0, state_undefined
},
4331 { /* 6, undefined */ 0, state_undefined
},
4332 { /* 7, undefined */ 0, state_undefined
},
4333 { /* 8, undefined */ 0, state_undefined
},
4334 { /* 9, undefined */ 0, state_undefined
},
4335 { /* 10, undefined */ 0, state_undefined
},
4336 { /* 11, undefined */ 0, state_undefined
},
4337 { /* 12, undefined */ 0, state_undefined
},
4338 { /* 13, undefined */ 0, state_undefined
},
4339 { /* 14, undefined */ 0, state_undefined
},
4340 { /* 15, undefined */ 0, state_undefined
},
4341 { /* 16, WINED3DTS_TEXTURE0 */ STATE_TRANSFORM(WINED3DTS_TEXTURE0
), NULL
},
4342 { /* 17, WINED3DTS_TEXTURE1 */ STATE_TRANSFORM(WINED3DTS_TEXTURE1
), NULL
},
4343 { /* 18, WINED3DTS_TEXTURE2 */ STATE_TRANSFORM(WINED3DTS_TEXTURE2
), NULL
},
4344 { /* 19, WINED3DTS_TEXTURE3 */ STATE_TRANSFORM(WINED3DTS_TEXTURE3
), NULL
},
4345 { /* 20, WINED3DTS_TEXTURE4 */ STATE_TRANSFORM(WINED3DTS_TEXTURE4
), NULL
},
4346 { /* 21, WINED3DTS_TEXTURE5 */ STATE_TRANSFORM(WINED3DTS_TEXTURE5
), NULL
},
4347 { /* 22, WINED3DTS_TEXTURE6 */ STATE_TRANSFORM(WINED3DTS_TEXTURE6
), NULL
},
4348 { /* 23, WINED3DTS_TEXTURE7 */ STATE_TRANSFORM(WINED3DTS_TEXTURE7
), NULL
},
4349 /* A huge gap between TEXTURE7 and WORLDMATRIX(0) :-( But entries are needed to catch then if a broken app sets them */
4350 { /* 24, undefined */ 0, state_undefined
},
4351 { /* 25, undefined */ 0, state_undefined
},
4352 { /* 26, undefined */ 0, state_undefined
},
4353 { /* 27, undefined */ 0, state_undefined
},
4354 { /* 28, undefined */ 0, state_undefined
},
4355 { /* 29, undefined */ 0, state_undefined
},
4356 { /* 30, undefined */ 0, state_undefined
},
4357 { /* 31, undefined */ 0, state_undefined
},
4358 { /* 32, undefined */ 0, state_undefined
},
4359 { /* 33, undefined */ 0, state_undefined
},
4360 { /* 34, undefined */ 0, state_undefined
},
4361 { /* 35, undefined */ 0, state_undefined
},
4362 { /* 36, undefined */ 0, state_undefined
},
4363 { /* 37, undefined */ 0, state_undefined
},
4364 { /* 38, undefined */ 0, state_undefined
},
4365 { /* 39, undefined */ 0, state_undefined
},
4366 { /* 40, undefined */ 0, state_undefined
},
4367 { /* 41, undefined */ 0, state_undefined
},
4368 { /* 42, undefined */ 0, state_undefined
},
4369 { /* 43, undefined */ 0, state_undefined
},
4370 { /* 44, undefined */ 0, state_undefined
},
4371 { /* 45, undefined */ 0, state_undefined
},
4372 { /* 46, undefined */ 0, state_undefined
},
4373 { /* 47, undefined */ 0, state_undefined
},
4374 { /* 48, undefined */ 0, state_undefined
},
4375 { /* 49, undefined */ 0, state_undefined
},
4376 { /* 50, undefined */ 0, state_undefined
},
4377 { /* 51, undefined */ 0, state_undefined
},
4378 { /* 52, undefined */ 0, state_undefined
},
4379 { /* 53, undefined */ 0, state_undefined
},
4380 { /* 54, undefined */ 0, state_undefined
},
4381 { /* 55, undefined */ 0, state_undefined
},
4382 { /* 56, undefined */ 0, state_undefined
},
4383 { /* 57, undefined */ 0, state_undefined
},
4384 { /* 58, undefined */ 0, state_undefined
},
4385 { /* 59, undefined */ 0, state_undefined
},
4386 { /* 60, undefined */ 0, state_undefined
},
4387 { /* 61, undefined */ 0, state_undefined
},
4388 { /* 62, undefined */ 0, state_undefined
},
4389 { /* 63, undefined */ 0, state_undefined
},
4390 { /* 64, undefined */ 0, state_undefined
},
4391 { /* 65, undefined */ 0, state_undefined
},
4392 { /* 66, undefined */ 0, state_undefined
},
4393 { /* 67, undefined */ 0, state_undefined
},
4394 { /* 68, undefined */ 0, state_undefined
},
4395 { /* 69, undefined */ 0, state_undefined
},
4396 { /* 70, undefined */ 0, state_undefined
},
4397 { /* 71, undefined */ 0, state_undefined
},
4398 { /* 72, undefined */ 0, state_undefined
},
4399 { /* 73, undefined */ 0, state_undefined
},
4400 { /* 74, undefined */ 0, state_undefined
},
4401 { /* 75, undefined */ 0, state_undefined
},
4402 { /* 76, undefined */ 0, state_undefined
},
4403 { /* 77, undefined */ 0, state_undefined
},
4404 { /* 78, undefined */ 0, state_undefined
},
4405 { /* 79, undefined */ 0, state_undefined
},
4406 { /* 80, undefined */ 0, state_undefined
},
4407 { /* 81, undefined */ 0, state_undefined
},
4408 { /* 82, undefined */ 0, state_undefined
},
4409 { /* 83, undefined */ 0, state_undefined
},
4410 { /* 84, undefined */ 0, state_undefined
},
4411 { /* 85, undefined */ 0, state_undefined
},
4412 { /* 86, undefined */ 0, state_undefined
},
4413 { /* 87, undefined */ 0, state_undefined
},
4414 { /* 88, undefined */ 0, state_undefined
},
4415 { /* 89, undefined */ 0, state_undefined
},
4416 { /* 90, undefined */ 0, state_undefined
},
4417 { /* 91, undefined */ 0, state_undefined
},
4418 { /* 92, undefined */ 0, state_undefined
},
4419 { /* 93, undefined */ 0, state_undefined
},
4420 { /* 94, undefined */ 0, state_undefined
},
4421 { /* 95, undefined */ 0, state_undefined
},
4422 { /* 96, undefined */ 0, state_undefined
},
4423 { /* 97, undefined */ 0, state_undefined
},
4424 { /* 98, undefined */ 0, state_undefined
},
4425 { /* 99, undefined */ 0, state_undefined
},
4426 { /*100, undefined */ 0, state_undefined
},
4427 { /*101, undefined */ 0, state_undefined
},
4428 { /*102, undefined */ 0, state_undefined
},
4429 { /*103, undefined */ 0, state_undefined
},
4430 { /*104, undefined */ 0, state_undefined
},
4431 { /*105, undefined */ 0, state_undefined
},
4432 { /*106, undefined */ 0, state_undefined
},
4433 { /*107, undefined */ 0, state_undefined
},
4434 { /*108, undefined */ 0, state_undefined
},
4435 { /*109, undefined */ 0, state_undefined
},
4436 { /*110, undefined */ 0, state_undefined
},
4437 { /*111, undefined */ 0, state_undefined
},
4438 { /*112, undefined */ 0, state_undefined
},
4439 { /*113, undefined */ 0, state_undefined
},
4440 { /*114, undefined */ 0, state_undefined
},
4441 { /*115, undefined */ 0, state_undefined
},
4442 { /*116, undefined */ 0, state_undefined
},
4443 { /*117, undefined */ 0, state_undefined
},
4444 { /*118, undefined */ 0, state_undefined
},
4445 { /*119, undefined */ 0, state_undefined
},
4446 { /*120, undefined */ 0, state_undefined
},
4447 { /*121, undefined */ 0, state_undefined
},
4448 { /*122, undefined */ 0, state_undefined
},
4449 { /*123, undefined */ 0, state_undefined
},
4450 { /*124, undefined */ 0, state_undefined
},
4451 { /*125, undefined */ 0, state_undefined
},
4452 { /*126, undefined */ 0, state_undefined
},
4453 { /*127, undefined */ 0, state_undefined
},
4454 { /*128, undefined */ 0, state_undefined
},
4455 { /*129, undefined */ 0, state_undefined
},
4456 { /*130, undefined */ 0, state_undefined
},
4457 { /*131, undefined */ 0, state_undefined
},
4458 { /*132, undefined */ 0, state_undefined
},
4459 { /*133, undefined */ 0, state_undefined
},
4460 { /*134, undefined */ 0, state_undefined
},
4461 { /*135, undefined */ 0, state_undefined
},
4462 { /*136, undefined */ 0, state_undefined
},
4463 { /*137, undefined */ 0, state_undefined
},
4464 { /*138, undefined */ 0, state_undefined
},
4465 { /*139, undefined */ 0, state_undefined
},
4466 { /*140, undefined */ 0, state_undefined
},
4467 { /*141, undefined */ 0, state_undefined
},
4468 { /*142, undefined */ 0, state_undefined
},
4469 { /*143, undefined */ 0, state_undefined
},
4470 { /*144, undefined */ 0, state_undefined
},
4471 { /*145, undefined */ 0, state_undefined
},
4472 { /*146, undefined */ 0, state_undefined
},
4473 { /*147, undefined */ 0, state_undefined
},
4474 { /*148, undefined */ 0, state_undefined
},
4475 { /*149, undefined */ 0, state_undefined
},
4476 { /*150, undefined */ 0, state_undefined
},
4477 { /*151, undefined */ 0, state_undefined
},
4478 { /*152, undefined */ 0, state_undefined
},
4479 { /*153, undefined */ 0, state_undefined
},
4480 { /*154, undefined */ 0, state_undefined
},
4481 { /*155, undefined */ 0, state_undefined
},
4482 { /*156, undefined */ 0, state_undefined
},
4483 { /*157, undefined */ 0, state_undefined
},
4484 { /*158, undefined */ 0, state_undefined
},
4485 { /*159, undefined */ 0, state_undefined
},
4486 { /*160, undefined */ 0, state_undefined
},
4487 { /*161, undefined */ 0, state_undefined
},
4488 { /*162, undefined */ 0, state_undefined
},
4489 { /*163, undefined */ 0, state_undefined
},
4490 { /*164, undefined */ 0, state_undefined
},
4491 { /*165, undefined */ 0, state_undefined
},
4492 { /*166, undefined */ 0, state_undefined
},
4493 { /*167, undefined */ 0, state_undefined
},
4494 { /*168, undefined */ 0, state_undefined
},
4495 { /*169, undefined */ 0, state_undefined
},
4496 { /*170, undefined */ 0, state_undefined
},
4497 { /*171, undefined */ 0, state_undefined
},
4498 { /*172, undefined */ 0, state_undefined
},
4499 { /*173, undefined */ 0, state_undefined
},
4500 { /*174, undefined */ 0, state_undefined
},
4501 { /*175, undefined */ 0, state_undefined
},
4502 { /*176, undefined */ 0, state_undefined
},
4503 { /*177, undefined */ 0, state_undefined
},
4504 { /*178, undefined */ 0, state_undefined
},
4505 { /*179, undefined */ 0, state_undefined
},
4506 { /*180, undefined */ 0, state_undefined
},
4507 { /*181, undefined */ 0, state_undefined
},
4508 { /*182, undefined */ 0, state_undefined
},
4509 { /*183, undefined */ 0, state_undefined
},
4510 { /*184, undefined */ 0, state_undefined
},
4511 { /*185, undefined */ 0, state_undefined
},
4512 { /*186, undefined */ 0, state_undefined
},
4513 { /*187, undefined */ 0, state_undefined
},
4514 { /*188, undefined */ 0, state_undefined
},
4515 { /*189, undefined */ 0, state_undefined
},
4516 { /*190, undefined */ 0, state_undefined
},
4517 { /*191, undefined */ 0, state_undefined
},
4518 { /*192, undefined */ 0, state_undefined
},
4519 { /*193, undefined */ 0, state_undefined
},
4520 { /*194, undefined */ 0, state_undefined
},
4521 { /*195, undefined */ 0, state_undefined
},
4522 { /*196, undefined */ 0, state_undefined
},
4523 { /*197, undefined */ 0, state_undefined
},
4524 { /*198, undefined */ 0, state_undefined
},
4525 { /*199, undefined */ 0, state_undefined
},
4526 { /*200, undefined */ 0, state_undefined
},
4527 { /*201, undefined */ 0, state_undefined
},
4528 { /*202, undefined */ 0, state_undefined
},
4529 { /*203, undefined */ 0, state_undefined
},
4530 { /*204, undefined */ 0, state_undefined
},
4531 { /*205, undefined */ 0, state_undefined
},
4532 { /*206, undefined */ 0, state_undefined
},
4533 { /*207, undefined */ 0, state_undefined
},
4534 { /*208, undefined */ 0, state_undefined
},
4535 { /*209, undefined */ 0, state_undefined
},
4536 { /*210, undefined */ 0, state_undefined
},
4537 { /*211, undefined */ 0, state_undefined
},
4538 { /*212, undefined */ 0, state_undefined
},
4539 { /*213, undefined */ 0, state_undefined
},
4540 { /*214, undefined */ 0, state_undefined
},
4541 { /*215, undefined */ 0, state_undefined
},
4542 { /*216, undefined */ 0, state_undefined
},
4543 { /*217, undefined */ 0, state_undefined
},
4544 { /*218, undefined */ 0, state_undefined
},
4545 { /*219, undefined */ 0, state_undefined
},
4546 { /*220, undefined */ 0, state_undefined
},
4547 { /*221, undefined */ 0, state_undefined
},
4548 { /*222, undefined */ 0, state_undefined
},
4549 { /*223, undefined */ 0, state_undefined
},
4550 { /*224, undefined */ 0, state_undefined
},
4551 { /*225, undefined */ 0, state_undefined
},
4552 { /*226, undefined */ 0, state_undefined
},
4553 { /*227, undefined */ 0, state_undefined
},
4554 { /*228, undefined */ 0, state_undefined
},
4555 { /*229, undefined */ 0, state_undefined
},
4556 { /*230, undefined */ 0, state_undefined
},
4557 { /*231, undefined */ 0, state_undefined
},
4558 { /*232, undefined */ 0, state_undefined
},
4559 { /*233, undefined */ 0, state_undefined
},
4560 { /*234, undefined */ 0, state_undefined
},
4561 { /*235, undefined */ 0, state_undefined
},
4562 { /*236, undefined */ 0, state_undefined
},
4563 { /*237, undefined */ 0, state_undefined
},
4564 { /*238, undefined */ 0, state_undefined
},
4565 { /*239, undefined */ 0, state_undefined
},
4566 { /*240, undefined */ 0, state_undefined
},
4567 { /*241, undefined */ 0, state_undefined
},
4568 { /*242, undefined */ 0, state_undefined
},
4569 { /*243, undefined */ 0, state_undefined
},
4570 { /*244, undefined */ 0, state_undefined
},
4571 { /*245, undefined */ 0, state_undefined
},
4572 { /*246, undefined */ 0, state_undefined
},
4573 { /*247, undefined */ 0, state_undefined
},
4574 { /*248, undefined */ 0, state_undefined
},
4575 { /*249, undefined */ 0, state_undefined
},
4576 { /*250, undefined */ 0, state_undefined
},
4577 { /*251, undefined */ 0, state_undefined
},
4578 { /*252, undefined */ 0, state_undefined
},
4579 { /*253, undefined */ 0, state_undefined
},
4580 { /*254, undefined */ 0, state_undefined
},
4581 { /*255, undefined */ 0, state_undefined
},
4583 { /*256, WINED3DTS_WORLDMATRIX(0) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), NULL
},
4584 { /*257, WINED3DTS_WORLDMATRIX(1) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(1)), NULL
},
4585 { /*258, WINED3DTS_WORLDMATRIX(2) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(2)), NULL
},
4586 { /*259, WINED3DTS_WORLDMATRIX(3) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(3)), NULL
},
4587 { /*260, WINED3DTS_WORLDMATRIX(4) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(4)), NULL
},
4588 { /*261, WINED3DTS_WORLDMATRIX(5) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(5)), NULL
},
4589 { /*262, WINED3DTS_WORLDMATRIX(6) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(6)), NULL
},
4590 { /*263, WINED3DTS_WORLDMATRIX(7) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(7)), NULL
},
4591 { /*264, WINED3DTS_WORLDMATRIX(8) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(8)), NULL
},
4592 { /*265, WINED3DTS_WORLDMATRIX(9) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(9)), NULL
},
4593 { /*266, WINED3DTS_WORLDMATRIX(10) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(10)), NULL
},
4594 { /*267, WINED3DTS_WORLDMATRIX(11) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(11)), NULL
},
4595 { /*268, WINED3DTS_WORLDMATRIX(12) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(12)), NULL
},
4596 { /*269, WINED3DTS_WORLDMATRIX(13) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(13)), NULL
},
4597 { /*270, WINED3DTS_WORLDMATRIX(14) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(14)), NULL
},
4598 { /*271, WINED3DTS_WORLDMATRIX(15) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(15)), NULL
},
4599 { /*272, WINED3DTS_WORLDMATRIX(16) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(16)), NULL
},
4600 { /*273, WINED3DTS_WORLDMATRIX(17) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(17)), NULL
},
4601 { /*274, WINED3DTS_WORLDMATRIX(18) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(18)), NULL
},
4602 { /*275, WINED3DTS_WORLDMATRIX(19) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(19)), NULL
},
4603 { /*276, WINED3DTS_WORLDMATRIX(20) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(20)), NULL
},
4604 { /*277, WINED3DTS_WORLDMATRIX(21) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(21)), NULL
},
4605 { /*278, WINED3DTS_WORLDMATRIX(22) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(22)), NULL
},
4606 { /*279, WINED3DTS_WORLDMATRIX(23) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(23)), NULL
},
4607 { /*280, WINED3DTS_WORLDMATRIX(24) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(24)), NULL
},
4608 { /*281, WINED3DTS_WORLDMATRIX(25) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(25)), NULL
},
4609 { /*282, WINED3DTS_WORLDMATRIX(26) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(26)), NULL
},
4610 { /*283, WINED3DTS_WORLDMATRIX(27) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(27)), NULL
},
4611 { /*284, WINED3DTS_WORLDMATRIX(28) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(28)), NULL
},
4612 { /*285, WINED3DTS_WORLDMATRIX(29) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(29)), NULL
},
4613 { /*286, WINED3DTS_WORLDMATRIX(30) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(30)), NULL
},
4614 { /*287, WINED3DTS_WORLDMATRIX(31) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(31)), NULL
},
4615 { /*288, WINED3DTS_WORLDMATRIX(32) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(32)), NULL
},
4616 { /*289, WINED3DTS_WORLDMATRIX(33) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(33)), NULL
},
4617 { /*290, WINED3DTS_WORLDMATRIX(34) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(34)), NULL
},
4618 { /*291, WINED3DTS_WORLDMATRIX(35) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(35)), NULL
},
4619 { /*292, WINED3DTS_WORLDMATRIX(36) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(36)), NULL
},
4620 { /*293, WINED3DTS_WORLDMATRIX(37) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(37)), NULL
},
4621 { /*294, WINED3DTS_WORLDMATRIX(38) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(38)), NULL
},
4622 { /*295, WINED3DTS_WORLDMATRIX(39) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(39)), NULL
},
4623 { /*296, WINED3DTS_WORLDMATRIX(40) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(40)), NULL
},
4624 { /*297, WINED3DTS_WORLDMATRIX(41) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(41)), NULL
},
4625 { /*298, WINED3DTS_WORLDMATRIX(42) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(42)), NULL
},
4626 { /*299, WINED3DTS_WORLDMATRIX(43) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(43)), NULL
},
4627 { /*300, WINED3DTS_WORLDMATRIX(44) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(44)), NULL
},
4628 { /*301, WINED3DTS_WORLDMATRIX(45) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(45)), NULL
},
4629 { /*302, WINED3DTS_WORLDMATRIX(46) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(46)), NULL
},
4630 { /*303, WINED3DTS_WORLDMATRIX(47) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(47)), NULL
},
4631 { /*304, WINED3DTS_WORLDMATRIX(48) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(48)), NULL
},
4632 { /*305, WINED3DTS_WORLDMATRIX(49) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(49)), NULL
},
4633 { /*306, WINED3DTS_WORLDMATRIX(50) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(50)), NULL
},
4634 { /*307, WINED3DTS_WORLDMATRIX(51) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(51)), NULL
},
4635 { /*308, WINED3DTS_WORLDMATRIX(52) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(52)), NULL
},
4636 { /*309, WINED3DTS_WORLDMATRIX(53) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(53)), NULL
},
4637 { /*310, WINED3DTS_WORLDMATRIX(54) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(54)), NULL
},
4638 { /*311, WINED3DTS_WORLDMATRIX(55) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(55)), NULL
},
4639 { /*312, WINED3DTS_WORLDMATRIX(56) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(56)), NULL
},
4640 { /*313, WINED3DTS_WORLDMATRIX(57) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(57)), NULL
},
4641 { /*314, WINED3DTS_WORLDMATRIX(58) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(58)), NULL
},
4642 { /*315, WINED3DTS_WORLDMATRIX(59) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(59)), NULL
},
4643 { /*316, WINED3DTS_WORLDMATRIX(60) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(60)), NULL
},
4644 { /*317, WINED3DTS_WORLDMATRIX(61) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(61)), NULL
},
4645 { /*318, WINED3DTS_WORLDMATRIX(62) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(62)), NULL
},
4646 { /*319, WINED3DTS_WORLDMATRIX(63) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(63)), NULL
},
4647 { /*320, WINED3DTS_WORLDMATRIX(64) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(64)), NULL
},
4648 { /*321, WINED3DTS_WORLDMATRIX(65) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(65)), NULL
},
4649 { /*322, WINED3DTS_WORLDMATRIX(66) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(66)), NULL
},
4650 { /*323, WINED3DTS_WORLDMATRIX(67) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(67)), NULL
},
4651 { /*324, WINED3DTS_WORLDMATRIX(68) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(68)), NULL
},
4652 { /*325, WINED3DTS_WORLDMATRIX(68) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(69)), NULL
},
4653 { /*326, WINED3DTS_WORLDMATRIX(70) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(70)), NULL
},
4654 { /*327, WINED3DTS_WORLDMATRIX(71) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(71)), NULL
},
4655 { /*328, WINED3DTS_WORLDMATRIX(72) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(72)), NULL
},
4656 { /*329, WINED3DTS_WORLDMATRIX(73) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(73)), NULL
},
4657 { /*330, WINED3DTS_WORLDMATRIX(74) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(74)), NULL
},
4658 { /*331, WINED3DTS_WORLDMATRIX(75) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(75)), NULL
},
4659 { /*332, WINED3DTS_WORLDMATRIX(76) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(76)), NULL
},
4660 { /*333, WINED3DTS_WORLDMATRIX(77) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(77)), NULL
},
4661 { /*334, WINED3DTS_WORLDMATRIX(78) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(78)), NULL
},
4662 { /*335, WINED3DTS_WORLDMATRIX(79) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(79)), NULL
},
4663 { /*336, WINED3DTS_WORLDMATRIX(80) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(80)), NULL
},
4664 { /*337, WINED3DTS_WORLDMATRIX(81) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(81)), NULL
},
4665 { /*338, WINED3DTS_WORLDMATRIX(82) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(82)), NULL
},
4666 { /*339, WINED3DTS_WORLDMATRIX(83) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(83)), NULL
},
4667 { /*340, WINED3DTS_WORLDMATRIX(84) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(84)), NULL
},
4668 { /*341, WINED3DTS_WORLDMATRIX(85) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(85)), NULL
},
4669 { /*341, WINED3DTS_WORLDMATRIX(86) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(86)), NULL
},
4670 { /*343, WINED3DTS_WORLDMATRIX(87) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(87)), NULL
},
4671 { /*344, WINED3DTS_WORLDMATRIX(88) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(88)), NULL
},
4672 { /*345, WINED3DTS_WORLDMATRIX(89) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(89)), NULL
},
4673 { /*346, WINED3DTS_WORLDMATRIX(90) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(90)), NULL
},
4674 { /*347, WINED3DTS_WORLDMATRIX(91) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(91)), NULL
},
4675 { /*348, WINED3DTS_WORLDMATRIX(92) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(92)), NULL
},
4676 { /*349, WINED3DTS_WORLDMATRIX(93) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(93)), NULL
},
4677 { /*350, WINED3DTS_WORLDMATRIX(94) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(94)), NULL
},
4678 { /*351, WINED3DTS_WORLDMATRIX(95) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(95)), NULL
},
4679 { /*352, WINED3DTS_WORLDMATRIX(96) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(96)), NULL
},
4680 { /*353, WINED3DTS_WORLDMATRIX(97) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(97)), NULL
},
4681 { /*354, WINED3DTS_WORLDMATRIX(98) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(98)), NULL
},
4682 { /*355, WINED3DTS_WORLDMATRIX(99) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(99)), NULL
},
4683 { /*356, WINED3DTS_WORLDMATRIX(100) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), NULL
},
4684 { /*357, WINED3DTS_WORLDMATRIX(101) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), NULL
},
4685 { /*358, WINED3DTS_WORLDMATRIX(102) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), NULL
},
4686 { /*359, WINED3DTS_WORLDMATRIX(103) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), NULL
},
4687 { /*360, WINED3DTS_WORLDMATRIX(104) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), NULL
},
4688 { /*361, WINED3DTS_WORLDMATRIX(105) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), NULL
},
4689 { /*362, WINED3DTS_WORLDMATRIX(106) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), NULL
},
4690 { /*363, WINED3DTS_WORLDMATRIX(107) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), NULL
},
4691 { /*364, WINED3DTS_WORLDMATRIX(108) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), NULL
},
4692 { /*365, WINED3DTS_WORLDMATRIX(109) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), NULL
},
4693 { /*366, WINED3DTS_WORLDMATRIX(110) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), NULL
},
4694 { /*367, WINED3DTS_WORLDMATRIX(111) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), NULL
},
4695 { /*368, WINED3DTS_WORLDMATRIX(112) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), NULL
},
4696 { /*369, WINED3DTS_WORLDMATRIX(113) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), NULL
},
4697 { /*370, WINED3DTS_WORLDMATRIX(114) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), NULL
},
4698 { /*371, WINED3DTS_WORLDMATRIX(115) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), NULL
},
4699 { /*372, WINED3DTS_WORLDMATRIX(116) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), NULL
},
4700 { /*373, WINED3DTS_WORLDMATRIX(117) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), NULL
},
4701 { /*374, WINED3DTS_WORLDMATRIX(118) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), NULL
},
4702 { /*375, WINED3DTS_WORLDMATRIX(119) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), NULL
},
4703 { /*376, WINED3DTS_WORLDMATRIX(120) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), NULL
},
4704 { /*377, WINED3DTS_WORLDMATRIX(121) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), NULL
},
4705 { /*378, WINED3DTS_WORLDMATRIX(122) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), NULL
},
4706 { /*379, WINED3DTS_WORLDMATRIX(123) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), NULL
},
4707 { /*380, WINED3DTS_WORLDMATRIX(124) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), NULL
},
4708 { /*381, WINED3DTS_WORLDMATRIX(125) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), NULL
},
4709 { /*382, WINED3DTS_WORLDMATRIX(126) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), NULL
},
4710 { /*383, WINED3DTS_WORLDMATRIX(127) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), NULL
},
4711 { /*384, WINED3DTS_WORLDMATRIX(128) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), NULL
},
4712 { /*385, WINED3DTS_WORLDMATRIX(129) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), NULL
},
4713 { /*386, WINED3DTS_WORLDMATRIX(130) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), NULL
},
4714 { /*387, WINED3DTS_WORLDMATRIX(131) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), NULL
},
4715 { /*388, WINED3DTS_WORLDMATRIX(132) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), NULL
},
4716 { /*389, WINED3DTS_WORLDMATRIX(133) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), NULL
},
4717 { /*390, WINED3DTS_WORLDMATRIX(134) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), NULL
},
4718 { /*391, WINED3DTS_WORLDMATRIX(135) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), NULL
},
4719 { /*392, WINED3DTS_WORLDMATRIX(136) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), NULL
},
4720 { /*393, WINED3DTS_WORLDMATRIX(137) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), NULL
},
4721 { /*394, WINED3DTS_WORLDMATRIX(138) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), NULL
},
4722 { /*395, WINED3DTS_WORLDMATRIX(139) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), NULL
},
4723 { /*396, WINED3DTS_WORLDMATRIX(140) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), NULL
},
4724 { /*397, WINED3DTS_WORLDMATRIX(141) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), NULL
},
4725 { /*398, WINED3DTS_WORLDMATRIX(142) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), NULL
},
4726 { /*399, WINED3DTS_WORLDMATRIX(143) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), NULL
},
4727 { /*400, WINED3DTS_WORLDMATRIX(144) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), NULL
},
4728 { /*401, WINED3DTS_WORLDMATRIX(145) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), NULL
},
4729 { /*402, WINED3DTS_WORLDMATRIX(146) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), NULL
},
4730 { /*403, WINED3DTS_WORLDMATRIX(147) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), NULL
},
4731 { /*404, WINED3DTS_WORLDMATRIX(148) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), NULL
},
4732 { /*405, WINED3DTS_WORLDMATRIX(149) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), NULL
},
4733 { /*406, WINED3DTS_WORLDMATRIX(150) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), NULL
},
4734 { /*407, WINED3DTS_WORLDMATRIX(151) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), NULL
},
4735 { /*408, WINED3DTS_WORLDMATRIX(152) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), NULL
},
4736 { /*409, WINED3DTS_WORLDMATRIX(153) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), NULL
},
4737 { /*410, WINED3DTS_WORLDMATRIX(154) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), NULL
},
4738 { /*411, WINED3DTS_WORLDMATRIX(155) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), NULL
},
4739 { /*412, WINED3DTS_WORLDMATRIX(156) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), NULL
},
4740 { /*413, WINED3DTS_WORLDMATRIX(157) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), NULL
},
4741 { /*414, WINED3DTS_WORLDMATRIX(158) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), NULL
},
4742 { /*415, WINED3DTS_WORLDMATRIX(159) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), NULL
},
4743 { /*416, WINED3DTS_WORLDMATRIX(160) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), NULL
},
4744 { /*417, WINED3DTS_WORLDMATRIX(161) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), NULL
},
4745 { /*418, WINED3DTS_WORLDMATRIX(162) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), NULL
},
4746 { /*419, WINED3DTS_WORLDMATRIX(163) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), NULL
},
4747 { /*420, WINED3DTS_WORLDMATRIX(164) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), NULL
},
4748 { /*421, WINED3DTS_WORLDMATRIX(165) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), NULL
},
4749 { /*422, WINED3DTS_WORLDMATRIX(166) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), NULL
},
4750 { /*423, WINED3DTS_WORLDMATRIX(167) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), NULL
},
4751 { /*424, WINED3DTS_WORLDMATRIX(168) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), NULL
},
4752 { /*425, WINED3DTS_WORLDMATRIX(168) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), NULL
},
4753 { /*426, WINED3DTS_WORLDMATRIX(170) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), NULL
},
4754 { /*427, WINED3DTS_WORLDMATRIX(171) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), NULL
},
4755 { /*428, WINED3DTS_WORLDMATRIX(172) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), NULL
},
4756 { /*429, WINED3DTS_WORLDMATRIX(173) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), NULL
},
4757 { /*430, WINED3DTS_WORLDMATRIX(174) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), NULL
},
4758 { /*431, WINED3DTS_WORLDMATRIX(175) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), NULL
},
4759 { /*432, WINED3DTS_WORLDMATRIX(176) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), NULL
},
4760 { /*433, WINED3DTS_WORLDMATRIX(177) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), NULL
},
4761 { /*434, WINED3DTS_WORLDMATRIX(178) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), NULL
},
4762 { /*435, WINED3DTS_WORLDMATRIX(179) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), NULL
},
4763 { /*436, WINED3DTS_WORLDMATRIX(180) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), NULL
},
4764 { /*437, WINED3DTS_WORLDMATRIX(181) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), NULL
},
4765 { /*438, WINED3DTS_WORLDMATRIX(182) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), NULL
},
4766 { /*439, WINED3DTS_WORLDMATRIX(183) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), NULL
},
4767 { /*440, WINED3DTS_WORLDMATRIX(184) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), NULL
},
4768 { /*441, WINED3DTS_WORLDMATRIX(185) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), NULL
},
4769 { /*441, WINED3DTS_WORLDMATRIX(186) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), NULL
},
4770 { /*443, WINED3DTS_WORLDMATRIX(187) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), NULL
},
4771 { /*444, WINED3DTS_WORLDMATRIX(188) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), NULL
},
4772 { /*445, WINED3DTS_WORLDMATRIX(189) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), NULL
},
4773 { /*446, WINED3DTS_WORLDMATRIX(190) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), NULL
},
4774 { /*447, WINED3DTS_WORLDMATRIX(191) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), NULL
},
4775 { /*448, WINED3DTS_WORLDMATRIX(192) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), NULL
},
4776 { /*449, WINED3DTS_WORLDMATRIX(193) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), NULL
},
4777 { /*450, WINED3DTS_WORLDMATRIX(194) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), NULL
},
4778 { /*451, WINED3DTS_WORLDMATRIX(195) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), NULL
},
4779 { /*452, WINED3DTS_WORLDMATRIX(196) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), NULL
},
4780 { /*453, WINED3DTS_WORLDMATRIX(197) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), NULL
},
4781 { /*454, WINED3DTS_WORLDMATRIX(198) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), NULL
},
4782 { /*455, WINED3DTS_WORLDMATRIX(199) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), NULL
},
4783 { /*356, WINED3DTS_WORLDMATRIX(200) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), NULL
},
4784 { /*457, WINED3DTS_WORLDMATRIX(201) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), NULL
},
4785 { /*458, WINED3DTS_WORLDMATRIX(202) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), NULL
},
4786 { /*459, WINED3DTS_WORLDMATRIX(203) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), NULL
},
4787 { /*460, WINED3DTS_WORLDMATRIX(204) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), NULL
},
4788 { /*461, WINED3DTS_WORLDMATRIX(205) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), NULL
},
4789 { /*462, WINED3DTS_WORLDMATRIX(206) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), NULL
},
4790 { /*463, WINED3DTS_WORLDMATRIX(207) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), NULL
},
4791 { /*464, WINED3DTS_WORLDMATRIX(208) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), NULL
},
4792 { /*465, WINED3DTS_WORLDMATRIX(209) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), NULL
},
4793 { /*466, WINED3DTS_WORLDMATRIX(210) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), NULL
},
4794 { /*467, WINED3DTS_WORLDMATRIX(211) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), NULL
},
4795 { /*468, WINED3DTS_WORLDMATRIX(212) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), NULL
},
4796 { /*469, WINED3DTS_WORLDMATRIX(213) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), NULL
},
4797 { /*470, WINED3DTS_WORLDMATRIX(214) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), NULL
},
4798 { /*471, WINED3DTS_WORLDMATRIX(215) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), NULL
},
4799 { /*472, WINED3DTS_WORLDMATRIX(216) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), NULL
},
4800 { /*473, WINED3DTS_WORLDMATRIX(217) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), NULL
},
4801 { /*474, WINED3DTS_WORLDMATRIX(218) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), NULL
},
4802 { /*475, WINED3DTS_WORLDMATRIX(219) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), NULL
},
4803 { /*476, WINED3DTS_WORLDMATRIX(220) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), NULL
},
4804 { /*477, WINED3DTS_WORLDMATRIX(221) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), NULL
},
4805 { /*478, WINED3DTS_WORLDMATRIX(222) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), NULL
},
4806 { /*479, WINED3DTS_WORLDMATRIX(223) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), NULL
},
4807 { /*480, WINED3DTS_WORLDMATRIX(224) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), NULL
},
4808 { /*481, WINED3DTS_WORLDMATRIX(225) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), NULL
},
4809 { /*482, WINED3DTS_WORLDMATRIX(226) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), NULL
},
4810 { /*483, WINED3DTS_WORLDMATRIX(227) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), NULL
},
4811 { /*484, WINED3DTS_WORLDMATRIX(228) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), NULL
},
4812 { /*485, WINED3DTS_WORLDMATRIX(229) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), NULL
},
4813 { /*486, WINED3DTS_WORLDMATRIX(230) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), NULL
},
4814 { /*487, WINED3DTS_WORLDMATRIX(231) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), NULL
},
4815 { /*488, WINED3DTS_WORLDMATRIX(232) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), NULL
},
4816 { /*489, WINED3DTS_WORLDMATRIX(233) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), NULL
},
4817 { /*490, WINED3DTS_WORLDMATRIX(234) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), NULL
},
4818 { /*491, WINED3DTS_WORLDMATRIX(235) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), NULL
},
4819 { /*492, WINED3DTS_WORLDMATRIX(236) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), NULL
},
4820 { /*493, WINED3DTS_WORLDMATRIX(237) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), NULL
},
4821 { /*494, WINED3DTS_WORLDMATRIX(238) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), NULL
},
4822 { /*495, WINED3DTS_WORLDMATRIX(239) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), NULL
},
4823 { /*496, WINED3DTS_WORLDMATRIX(240) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), NULL
},
4824 { /*497, WINED3DTS_WORLDMATRIX(241) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), NULL
},
4825 { /*498, WINED3DTS_WORLDMATRIX(242) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), NULL
},
4826 { /*499, WINED3DTS_WORLDMATRIX(243) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), NULL
},
4827 { /*500, WINED3DTS_WORLDMATRIX(244) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), NULL
},
4828 { /*501, WINED3DTS_WORLDMATRIX(245) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), NULL
},
4829 { /*502, WINED3DTS_WORLDMATRIX(246) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), NULL
},
4830 { /*503, WINED3DTS_WORLDMATRIX(247) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), NULL
},
4831 { /*504, WINED3DTS_WORLDMATRIX(248) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), NULL
},
4832 { /*505, WINED3DTS_WORLDMATRIX(249) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), NULL
},
4833 { /*506, WINED3DTS_WORLDMATRIX(250) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), NULL
},
4834 { /*507, WINED3DTS_WORLDMATRIX(251) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), NULL
},
4835 { /*508, WINED3DTS_WORLDMATRIX(252) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), NULL
},
4836 { /*509, WINED3DTS_WORLDMATRIX(253) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), NULL
},
4837 { /*510, WINED3DTS_WORLDMATRIX(254) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), NULL
},
4838 { /*511, WINED3DTS_WORLDMATRIX(255) */ STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), NULL
},
4839 /* Various Vertex states follow */
4840 { /* , STATE_STREAMSRC */ STATE_VDECL
, NULL
},
4841 { /* , STATE_INDEXBUFFER */ STATE_INDEXBUFFER
, NULL
},
4842 { /* , STATE_VDECL */ STATE_VDECL
, NULL
},
4843 { /* , STATE_VSHADER */ STATE_VDECL
, NULL
},
4844 { /* , STATE_VIEWPORT */ STATE_VIEWPORT
, NULL
},
4845 { /* , STATE_VERTEXSHADERCONSTANT */ STATE_VERTEXSHADERCONSTANT
, NULL
},
4846 { /* , STATE_PIXELSHADERCONSTANT */ STATE_VERTEXSHADERCONSTANT
, NULL
},
4848 { /* , STATE_ACTIVELIGHT(0) */ STATE_ACTIVELIGHT(0), NULL
},
4849 { /* , STATE_ACTIVELIGHT(1) */ STATE_ACTIVELIGHT(1), NULL
},
4850 { /* , STATE_ACTIVELIGHT(2) */ STATE_ACTIVELIGHT(2), NULL
},
4851 { /* , STATE_ACTIVELIGHT(3) */ STATE_ACTIVELIGHT(3), NULL
},
4852 { /* , STATE_ACTIVELIGHT(4) */ STATE_ACTIVELIGHT(4), NULL
},
4853 { /* , STATE_ACTIVELIGHT(5) */ STATE_ACTIVELIGHT(5), NULL
},
4854 { /* , STATE_ACTIVELIGHT(6) */ STATE_ACTIVELIGHT(6), NULL
},
4855 { /* , STATE_ACTIVELIGHT(7) */ STATE_ACTIVELIGHT(7), NULL
},
4857 { /* Scissor rect */ STATE_SCISSORRECT
, NULL
},
4859 { /* STATE_CLIPPLANE(0) */ STATE_CLIPPLANE(0), NULL
},
4860 { /* STATE_CLIPPLANE(1) */ STATE_CLIPPLANE(1), NULL
},
4861 { /* STATE_CLIPPLANE(2) */ STATE_CLIPPLANE(2), NULL
},
4862 { /* STATE_CLIPPLANE(3) */ STATE_CLIPPLANE(3), NULL
},
4863 { /* STATE_CLIPPLANE(4) */ STATE_CLIPPLANE(4), NULL
},
4864 { /* STATE_CLIPPLANE(5) */ STATE_CLIPPLANE(5), NULL
},
4865 { /* STATE_CLIPPLANE(6) */ STATE_CLIPPLANE(6), NULL
},
4866 { /* STATE_CLIPPLANE(7) */ STATE_CLIPPLANE(7), NULL
},
4867 { /* STATE_CLIPPLANE(8) */ STATE_CLIPPLANE(8), NULL
},
4868 { /* STATE_CLIPPLANE(9) */ STATE_CLIPPLANE(9), NULL
},
4869 { /* STATE_CLIPPLANE(10) */ STATE_CLIPPLANE(10), NULL
},
4870 { /* STATE_CLIPPLANE(11) */ STATE_CLIPPLANE(11), NULL
},
4871 { /* STATE_CLIPPLANE(12) */ STATE_CLIPPLANE(12), NULL
},
4872 { /* STATE_CLIPPLANE(13) */ STATE_CLIPPLANE(13), NULL
},
4873 { /* STATE_CLIPPLANE(14) */ STATE_CLIPPLANE(14), NULL
},
4874 { /* STATE_CLIPPLANE(15) */ STATE_CLIPPLANE(15), NULL
},
4875 { /* STATE_CLIPPLANE(16) */ STATE_CLIPPLANE(16), NULL
},
4876 { /* STATE_CLIPPLANE(17) */ STATE_CLIPPLANE(17), NULL
},
4877 { /* STATE_CLIPPLANE(18) */ STATE_CLIPPLANE(18), NULL
},
4878 { /* STATE_CLIPPLANE(19) */ STATE_CLIPPLANE(19), NULL
},
4879 { /* STATE_CLIPPLANE(20) */ STATE_CLIPPLANE(20), NULL
},
4880 { /* STATE_CLIPPLANE(21) */ STATE_CLIPPLANE(21), NULL
},
4881 { /* STATE_CLIPPLANE(22) */ STATE_CLIPPLANE(22), NULL
},
4882 { /* STATE_CLIPPLANE(23) */ STATE_CLIPPLANE(23), NULL
},
4883 { /* STATE_CLIPPLANE(24) */ STATE_CLIPPLANE(24), NULL
},
4884 { /* STATE_CLIPPLANE(25) */ STATE_CLIPPLANE(25), NULL
},
4885 { /* STATE_CLIPPLANE(26) */ STATE_CLIPPLANE(26), NULL
},
4886 { /* STATE_CLIPPLANE(27) */ STATE_CLIPPLANE(27), NULL
},
4887 { /* STATE_CLIPPLANE(28) */ STATE_CLIPPLANE(28), NULL
},
4888 { /* STATE_CLIPPLANE(29) */ STATE_CLIPPLANE(29), NULL
},
4889 { /* STATE_CLIPPLANE(30) */ STATE_CLIPPLANE(30), NULL
},
4890 { /* STATE_CLIPPLANE(31) */ STATE_CLIPPLANE(31), NULL
},
4892 { /* STATE_MATERIAL */ STATE_RENDER(WINED3DRS_SPECULARENABLE
), NULL
},
4893 { /* STATE_FRONTFACE */ STATE_FRONTFACE
, NULL
},
4896 const struct StateEntryTemplate misc_state_template
[] = {
4897 { STATE_RENDER(WINED3DRS_SRCBLEND
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4898 { STATE_RENDER(WINED3DRS_DESTBLEND
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4899 { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4900 { STATE_RENDER(WINED3DRS_EDGEANTIALIAS
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4901 { STATE_RENDER(WINED3DRS_ANTIALIASEDLINEENABLE
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4902 { STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4903 { STATE_RENDER(WINED3DRS_SRCBLENDALPHA
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4904 { STATE_RENDER(WINED3DRS_DESTBLENDALPHA
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4905 { STATE_RENDER(WINED3DRS_DESTBLENDALPHA
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4906 { STATE_RENDER(WINED3DRS_BLENDOPALPHA
), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE
), state_blend
}},
4907 { STATE_STREAMSRC
, { STATE_VDECL
, streamsrc
}},
4908 { STATE_VDECL
, { STATE_VDECL
, streamsrc
}},
4909 { STATE_FRONTFACE
, { STATE_FRONTFACE
, frontface
}},
4910 { STATE_SCISSORRECT
, { STATE_SCISSORRECT
, scissorrect
}},
4911 /* TODO: Move shader constant loading to vertex and fragment pipeline repectively, as soon as the pshader and
4912 * vshader loadings are untied from each other
4914 { STATE_VERTEXSHADERCONSTANT
, { STATE_VERTEXSHADERCONSTANT
, shaderconstant
}},
4915 { STATE_PIXELSHADERCONSTANT
, { STATE_VERTEXSHADERCONSTANT
, shaderconstant
}},
4917 { STATE_VIEWPORT
, { STATE_VIEWPORT
, viewport_miscpart
}},
4918 { STATE_INDEXBUFFER
, { STATE_INDEXBUFFER
, indexbuffer
}},
4919 {0 /* Terminate */, { 0, 0 }},
4922 const struct StateEntryTemplate ffp_vertexstate_template
[] = {
4923 { STATE_VDECL
, { STATE_VDECL
, vertexdeclaration
}},
4924 { STATE_VSHADER
, { STATE_VDECL
, vertexdeclaration
}},
4925 { STATE_MATERIAL
, { STATE_RENDER(WINED3DRS_SPECULARENABLE
), state_specularenable
}},
4926 { STATE_RENDER(WINED3DRS_SPECULARENABLE
), { STATE_RENDER(WINED3DRS_SPECULARENABLE
), state_specularenable
}},
4928 { STATE_CLIPPLANE(0), { STATE_CLIPPLANE(0), clipplane
}},
4929 { STATE_CLIPPLANE(1), { STATE_CLIPPLANE(1), clipplane
}},
4930 { STATE_CLIPPLANE(2), { STATE_CLIPPLANE(2), clipplane
}},
4931 { STATE_CLIPPLANE(3), { STATE_CLIPPLANE(3), clipplane
}},
4932 { STATE_CLIPPLANE(4), { STATE_CLIPPLANE(4), clipplane
}},
4933 { STATE_CLIPPLANE(5), { STATE_CLIPPLANE(5), clipplane
}},
4934 { STATE_CLIPPLANE(6), { STATE_CLIPPLANE(6), clipplane
}},
4935 { STATE_CLIPPLANE(7), { STATE_CLIPPLANE(7), clipplane
}},
4936 { STATE_CLIPPLANE(8), { STATE_CLIPPLANE(8), clipplane
}},
4937 { STATE_CLIPPLANE(9), { STATE_CLIPPLANE(9), clipplane
}},
4938 { STATE_CLIPPLANE(10), { STATE_CLIPPLANE(10), clipplane
}},
4939 { STATE_CLIPPLANE(11), { STATE_CLIPPLANE(11), clipplane
}},
4940 { STATE_CLIPPLANE(12), { STATE_CLIPPLANE(12), clipplane
}},
4941 { STATE_CLIPPLANE(13), { STATE_CLIPPLANE(13), clipplane
}},
4942 { STATE_CLIPPLANE(14), { STATE_CLIPPLANE(14), clipplane
}},
4943 { STATE_CLIPPLANE(15), { STATE_CLIPPLANE(15), clipplane
}},
4944 { STATE_CLIPPLANE(16), { STATE_CLIPPLANE(16), clipplane
}},
4945 { STATE_CLIPPLANE(17), { STATE_CLIPPLANE(17), clipplane
}},
4946 { STATE_CLIPPLANE(18), { STATE_CLIPPLANE(18), clipplane
}},
4947 { STATE_CLIPPLANE(19), { STATE_CLIPPLANE(19), clipplane
}},
4948 { STATE_CLIPPLANE(20), { STATE_CLIPPLANE(20), clipplane
}},
4949 { STATE_CLIPPLANE(21), { STATE_CLIPPLANE(21), clipplane
}},
4950 { STATE_CLIPPLANE(22), { STATE_CLIPPLANE(22), clipplane
}},
4951 { STATE_CLIPPLANE(23), { STATE_CLIPPLANE(23), clipplane
}},
4952 { STATE_CLIPPLANE(24), { STATE_CLIPPLANE(24), clipplane
}},
4953 { STATE_CLIPPLANE(25), { STATE_CLIPPLANE(25), clipplane
}},
4954 { STATE_CLIPPLANE(26), { STATE_CLIPPLANE(26), clipplane
}},
4955 { STATE_CLIPPLANE(27), { STATE_CLIPPLANE(27), clipplane
}},
4956 { STATE_CLIPPLANE(28), { STATE_CLIPPLANE(28), clipplane
}},
4957 { STATE_CLIPPLANE(29), { STATE_CLIPPLANE(29), clipplane
}},
4958 { STATE_CLIPPLANE(30), { STATE_CLIPPLANE(30), clipplane
}},
4959 { STATE_CLIPPLANE(31), { STATE_CLIPPLANE(31), clipplane
}},
4961 { STATE_ACTIVELIGHT(0), { STATE_ACTIVELIGHT(0), light
}},
4962 { STATE_ACTIVELIGHT(1), { STATE_ACTIVELIGHT(1), light
}},
4963 { STATE_ACTIVELIGHT(2), { STATE_ACTIVELIGHT(2), light
}},
4964 { STATE_ACTIVELIGHT(3), { STATE_ACTIVELIGHT(3), light
}},
4965 { STATE_ACTIVELIGHT(4), { STATE_ACTIVELIGHT(4), light
}},
4966 { STATE_ACTIVELIGHT(5), { STATE_ACTIVELIGHT(5), light
}},
4967 { STATE_ACTIVELIGHT(6), { STATE_ACTIVELIGHT(6), light
}},
4968 { STATE_ACTIVELIGHT(7), { STATE_ACTIVELIGHT(7), light
}},
4970 { STATE_VIEWPORT
, { STATE_VIEWPORT
, viewport_vertexpart
}},
4971 /* Transform states follow */
4972 { STATE_TRANSFORM(WINED3DTS_VIEW
), { STATE_TRANSFORM(WINED3DTS_VIEW
), transform_view
}},
4973 { STATE_TRANSFORM(WINED3DTS_PROJECTION
), { STATE_TRANSFORM(WINED3DTS_PROJECTION
), transform_projection
}},
4974 { STATE_TRANSFORM(WINED3DTS_TEXTURE0
), { STATE_TRANSFORM(WINED3DTS_TEXTURE0
), transform_texture
}},
4975 { STATE_TRANSFORM(WINED3DTS_TEXTURE1
), { STATE_TRANSFORM(WINED3DTS_TEXTURE1
), transform_texture
}},
4976 { STATE_TRANSFORM(WINED3DTS_TEXTURE2
), { STATE_TRANSFORM(WINED3DTS_TEXTURE2
), transform_texture
}},
4977 { STATE_TRANSFORM(WINED3DTS_TEXTURE3
), { STATE_TRANSFORM(WINED3DTS_TEXTURE3
), transform_texture
}},
4978 { STATE_TRANSFORM(WINED3DTS_TEXTURE4
), { STATE_TRANSFORM(WINED3DTS_TEXTURE4
), transform_texture
}},
4979 { STATE_TRANSFORM(WINED3DTS_TEXTURE5
), { STATE_TRANSFORM(WINED3DTS_TEXTURE5
), transform_texture
}},
4980 { STATE_TRANSFORM(WINED3DTS_TEXTURE6
), { STATE_TRANSFORM(WINED3DTS_TEXTURE6
), transform_texture
}},
4981 { STATE_TRANSFORM(WINED3DTS_TEXTURE7
), { STATE_TRANSFORM(WINED3DTS_TEXTURE7
), transform_texture
}},
4982 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 0)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 0)), transform_world
}},
4983 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 1)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 1)), transform_world
}},
4984 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 2)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 2)), transform_world
}},
4985 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 3)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 3)), transform_world
}},
4986 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 4)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 4)), transform_world
}},
4987 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 5)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 5)), transform_world
}},
4988 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 6)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 6)), transform_world
}},
4989 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 7)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 7)), transform_world
}},
4990 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 8)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 8)), transform_world
}},
4991 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 9)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 9)), transform_world
}},
4992 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 10)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 10)), transform_world
}},
4993 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 11)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 11)), transform_world
}},
4994 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 12)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 12)), transform_world
}},
4995 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 13)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 13)), transform_world
}},
4996 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 14)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 14)), transform_world
}},
4997 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 15)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 15)), transform_world
}},
4998 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 16)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 16)), transform_world
}},
4999 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 17)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 17)), transform_world
}},
5000 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 18)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 18)), transform_world
}},
5001 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 19)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 19)), transform_world
}},
5002 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 20)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 20)), transform_world
}},
5003 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 21)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 21)), transform_world
}},
5004 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 22)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 22)), transform_world
}},
5005 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 23)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 23)), transform_world
}},
5006 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 24)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 24)), transform_world
}},
5007 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 25)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 25)), transform_world
}},
5008 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 26)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 26)), transform_world
}},
5009 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 27)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 27)), transform_world
}},
5010 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 28)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 28)), transform_world
}},
5011 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 29)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 29)), transform_world
}},
5012 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 30)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 30)), transform_world
}},
5013 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 31)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 31)), transform_world
}},
5014 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 32)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 32)), transform_world
}},
5015 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 33)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 33)), transform_world
}},
5016 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 34)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 34)), transform_world
}},
5017 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 35)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 35)), transform_world
}},
5018 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 36)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 36)), transform_world
}},
5019 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 37)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 37)), transform_world
}},
5020 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 38)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 38)), transform_world
}},
5021 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 39)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 39)), transform_world
}},
5022 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 40)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 40)), transform_world
}},
5023 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 41)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 41)), transform_world
}},
5024 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 42)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 42)), transform_world
}},
5025 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 43)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 43)), transform_world
}},
5026 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 44)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 44)), transform_world
}},
5027 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 45)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 45)), transform_world
}},
5028 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 46)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 46)), transform_world
}},
5029 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 47)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 47)), transform_world
}},
5030 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 48)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 48)), transform_world
}},
5031 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 49)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 49)), transform_world
}},
5032 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 50)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 50)), transform_world
}},
5033 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 51)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 51)), transform_world
}},
5034 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 52)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 52)), transform_world
}},
5035 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 53)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 53)), transform_world
}},
5036 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 54)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 54)), transform_world
}},
5037 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 55)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 55)), transform_world
}},
5038 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 56)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 56)), transform_world
}},
5039 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 57)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 57)), transform_world
}},
5040 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 58)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 58)), transform_world
}},
5041 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 59)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 59)), transform_world
}},
5042 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 60)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 60)), transform_world
}},
5043 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 61)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 61)), transform_world
}},
5044 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 62)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 62)), transform_world
}},
5045 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 63)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 63)), transform_world
}},
5046 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 64)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 64)), transform_world
}},
5047 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 65)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 65)), transform_world
}},
5048 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 66)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 66)), transform_world
}},
5049 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 67)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 67)), transform_world
}},
5050 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 68)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 68)), transform_world
}},
5051 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 69)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 69)), transform_world
}},
5052 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 70)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 70)), transform_world
}},
5053 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 71)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 71)), transform_world
}},
5054 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 72)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 72)), transform_world
}},
5055 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 73)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 73)), transform_world
}},
5056 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 74)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 74)), transform_world
}},
5057 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 75)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 75)), transform_world
}},
5058 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 76)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 76)), transform_world
}},
5059 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 77)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 77)), transform_world
}},
5060 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 78)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 78)), transform_world
}},
5061 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 79)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 79)), transform_world
}},
5062 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 80)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 80)), transform_world
}},
5063 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 81)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 81)), transform_world
}},
5064 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 82)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 82)), transform_world
}},
5065 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 83)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 83)), transform_world
}},
5066 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 84)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 84)), transform_world
}},
5067 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 85)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 85)), transform_world
}},
5068 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 86)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 86)), transform_world
}},
5069 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 87)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 87)), transform_world
}},
5070 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 88)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 88)), transform_world
}},
5071 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 89)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 89)), transform_world
}},
5072 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 90)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 90)), transform_world
}},
5073 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 91)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 91)), transform_world
}},
5074 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 92)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 92)), transform_world
}},
5075 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 93)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 93)), transform_world
}},
5076 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 94)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 94)), transform_world
}},
5077 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 95)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 95)), transform_world
}},
5078 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 96)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 96)), transform_world
}},
5079 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 97)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 97)), transform_world
}},
5080 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 98)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 98)), transform_world
}},
5081 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 99)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 99)), transform_world
}},
5082 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), transform_world
}},
5083 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), transform_world
}},
5084 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), transform_world
}},
5085 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), transform_world
}},
5086 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), transform_world
}},
5087 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), transform_world
}},
5088 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), transform_world
}},
5089 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), transform_world
}},
5090 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), transform_world
}},
5091 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), transform_world
}},
5092 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), transform_world
}},
5093 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), transform_world
}},
5094 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), transform_world
}},
5095 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), transform_world
}},
5096 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), transform_world
}},
5097 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), transform_world
}},
5098 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), transform_world
}},
5099 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), transform_world
}},
5100 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), transform_world
}},
5101 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), transform_world
}},
5102 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), transform_world
}},
5103 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), transform_world
}},
5104 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), transform_world
}},
5105 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), transform_world
}},
5106 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), transform_world
}},
5107 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), transform_world
}},
5108 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), transform_world
}},
5109 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), transform_world
}},
5110 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), transform_world
}},
5111 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), transform_world
}},
5112 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), transform_world
}},
5113 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), transform_world
}},
5114 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), transform_world
}},
5115 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), transform_world
}},
5116 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), transform_world
}},
5117 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), transform_world
}},
5118 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), transform_world
}},
5119 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), transform_world
}},
5120 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), transform_world
}},
5121 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), transform_world
}},
5122 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), transform_world
}},
5123 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), transform_world
}},
5124 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), transform_world
}},
5125 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), transform_world
}},
5126 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), transform_world
}},
5127 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), transform_world
}},
5128 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), transform_world
}},
5129 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), transform_world
}},
5130 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), transform_world
}},
5131 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), transform_world
}},
5132 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), transform_world
}},
5133 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), transform_world
}},
5134 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), transform_world
}},
5135 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), transform_world
}},
5136 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), transform_world
}},
5137 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), transform_world
}},
5138 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), transform_world
}},
5139 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), transform_world
}},
5140 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), transform_world
}},
5141 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), transform_world
}},
5142 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), transform_world
}},
5143 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), transform_world
}},
5144 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), transform_world
}},
5145 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), transform_world
}},
5146 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), transform_world
}},
5147 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), transform_world
}},
5148 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), transform_world
}},
5149 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), transform_world
}},
5150 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), transform_world
}},
5151 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), transform_world
}},
5152 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), transform_world
}},
5153 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), transform_world
}},
5154 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), transform_world
}},
5155 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), transform_world
}},
5156 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), transform_world
}},
5157 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), transform_world
}},
5158 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), transform_world
}},
5159 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), transform_world
}},
5160 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), transform_world
}},
5161 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), transform_world
}},
5162 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), transform_world
}},
5163 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), transform_world
}},
5164 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), transform_world
}},
5165 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), transform_world
}},
5166 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), transform_world
}},
5167 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), transform_world
}},
5168 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), transform_world
}},
5169 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), transform_world
}},
5170 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), transform_world
}},
5171 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), transform_world
}},
5172 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), transform_world
}},
5173 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), transform_world
}},
5174 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), transform_world
}},
5175 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), transform_world
}},
5176 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), transform_world
}},
5177 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), transform_world
}},
5178 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), transform_world
}},
5179 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), transform_world
}},
5180 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), transform_world
}},
5181 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), transform_world
}},
5182 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), transform_world
}},
5183 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), transform_world
}},
5184 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), transform_world
}},
5185 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), transform_world
}},
5186 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), transform_world
}},
5187 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), transform_world
}},
5188 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), transform_world
}},
5189 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), transform_world
}},
5190 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), transform_world
}},
5191 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), transform_world
}},
5192 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), transform_world
}},
5193 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), transform_world
}},
5194 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), transform_world
}},
5195 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), transform_world
}},
5196 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), transform_world
}},
5197 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), transform_world
}},
5198 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), transform_world
}},
5199 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), transform_world
}},
5200 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), transform_world
}},
5201 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), transform_world
}},
5202 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), transform_world
}},
5203 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), transform_world
}},
5204 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), transform_world
}},
5205 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), transform_world
}},
5206 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), transform_world
}},
5207 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), transform_world
}},
5208 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), transform_world
}},
5209 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), transform_world
}},
5210 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), transform_world
}},
5211 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), transform_world
}},
5212 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), transform_world
}},
5213 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), transform_world
}},
5214 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), transform_world
}},
5215 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), transform_world
}},
5216 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), transform_world
}},
5217 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), transform_world
}},
5218 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), transform_world
}},
5219 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), transform_world
}},
5220 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), transform_world
}},
5221 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), transform_world
}},
5222 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), transform_world
}},
5223 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), transform_world
}},
5224 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), transform_world
}},
5225 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), transform_world
}},
5226 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), transform_world
}},
5227 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), transform_world
}},
5228 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), transform_world
}},
5229 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), transform_world
}},
5230 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), transform_world
}},
5231 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), transform_world
}},
5232 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), transform_world
}},
5233 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), transform_world
}},
5234 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), transform_world
}},
5235 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), transform_world
}},
5236 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), transform_world
}},
5237 { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), transform_world
}},
5238 { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE0
), transform_texture
}},
5239 { STATE_TEXTURESTAGE(1,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE1
), transform_texture
}},
5240 { STATE_TEXTURESTAGE(2,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE2
), transform_texture
}},
5241 { STATE_TEXTURESTAGE(3,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE3
), transform_texture
}},
5242 { STATE_TEXTURESTAGE(4,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE4
), transform_texture
}},
5243 { STATE_TEXTURESTAGE(5,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE5
), transform_texture
}},
5244 { STATE_TEXTURESTAGE(6,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE6
), transform_texture
}},
5245 { STATE_TEXTURESTAGE(7,WINED3DTSS_TEXTURETRANSFORMFLAGS
),{STATE_TRANSFORM(WINED3DTS_TEXTURE7
), transform_texture
}},
5246 {0 /* Terminate */, { 0, 0 }},
5249 static int num_handlers(APPLYSTATEFUNC
*funcs
) {
5251 for(i
= 0; funcs
[i
]; i
++);
5255 static void multistate_apply_2(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
5256 stateblock
->wineD3DDevice
->multistate_funcs
[state
][0](state
, stateblock
, context
);
5257 stateblock
->wineD3DDevice
->multistate_funcs
[state
][1](state
, stateblock
, context
);
5260 static void multistate_apply_3(DWORD state
, IWineD3DStateBlockImpl
*stateblock
, WineD3DContext
*context
) {
5261 stateblock
->wineD3DDevice
->multistate_funcs
[state
][0](state
, stateblock
, context
);
5262 stateblock
->wineD3DDevice
->multistate_funcs
[state
][1](state
, stateblock
, context
);
5263 stateblock
->wineD3DDevice
->multistate_funcs
[state
][2](state
, stateblock
, context
);
5266 void compile_state_table(struct StateEntry
*StateTable
,
5267 APPLYSTATEFUNC
**dev_multistate_funcs
,
5268 const struct StateEntryTemplate
*vertex
,
5269 const struct StateEntryTemplate
*fragment
,
5270 const struct StateEntryTemplate
*misc
,
5271 const struct StateEntry
*temptable
/* TODO: Remove this */) {
5272 unsigned int i
, type
, handlers
;
5273 APPLYSTATEFUNC multistate_funcs
[STATE_HIGHEST
+ 1][3];
5274 const struct StateEntryTemplate
*cur
;
5276 /* TODO: Remove this once all states are provided by templates */
5277 BOOL set
[STATE_HIGHEST
+ 1];
5278 memset(set
, 0, sizeof(set
));
5280 memset(multistate_funcs
, 0, sizeof(multistate_funcs
));
5282 for(type
= 0; type
< 3; type
++) {
5283 /* This switch decides the order in which the states are applied */
5285 case 0: cur
= misc
; break;
5286 case 1: cur
= fragment
; break;
5287 case 2: cur
= vertex
; break;
5288 default: cur
= NULL
; /* Stupid compiler */
5292 for(i
= 0; cur
[i
].state
; i
++) {
5293 set
[cur
[i
].state
] = TRUE
; /* TODO: Remove when done with the move */
5294 handlers
= num_handlers(multistate_funcs
[cur
[i
].state
]);
5295 multistate_funcs
[cur
[i
].state
][handlers
] = cur
[i
].content
.apply
;
5298 StateTable
[cur
[i
].state
].apply
= cur
[i
].content
.apply
;
5301 StateTable
[cur
[i
].state
].apply
= multistate_apply_2
;
5302 dev_multistate_funcs
[cur
[i
].state
] = HeapAlloc(GetProcessHeap(),
5304 sizeof(**dev_multistate_funcs
) * 2);
5305 dev_multistate_funcs
[cur
[i
].state
][0] = multistate_funcs
[cur
[i
].state
][0];
5306 dev_multistate_funcs
[cur
[i
].state
][1] = multistate_funcs
[cur
[i
].state
][1];
5309 StateTable
[cur
[i
].state
].apply
= multistate_apply_3
;
5310 HeapFree(GetProcessHeap(), 0, multistate_funcs
[cur
[i
].state
]);
5311 dev_multistate_funcs
[cur
[i
].state
] = HeapAlloc(GetProcessHeap(),
5313 sizeof(**dev_multistate_funcs
) * 3);
5314 dev_multistate_funcs
[cur
[i
].state
][0] = multistate_funcs
[cur
[i
].state
][0];
5315 dev_multistate_funcs
[cur
[i
].state
][1] = multistate_funcs
[cur
[i
].state
][1];
5316 dev_multistate_funcs
[cur
[i
].state
][2] = multistate_funcs
[cur
[i
].state
][2];
5319 ERR("Unexpected amount of state handlers for state %u: %u\n",
5320 cur
[i
].state
, handlers
+ 1);
5323 if(StateTable
[cur
[i
].state
].representative
&&
5324 StateTable
[cur
[i
].state
].representative
!= cur
[i
].content
.representative
) {
5325 FIXME("State %u has different representatives in different pipeline parts\n",
5328 StateTable
[cur
[i
].state
].representative
= cur
[i
].content
.representative
;
5332 /* TODO Remove this after the state move is done */
5333 for(i
= 0; i
< STATE_HIGHEST
+ 1; i
++) {
5334 if(set
[i
]) continue;
5335 StateTable
[i
] = temptable
[i
];