1 | /*
|
---|
2 | * Direct3D state management
|
---|
3 | *
|
---|
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
|
---|
11 | * Copyright 2009 Henri Verbeet for CodeWeavers
|
---|
12 | *
|
---|
13 | * This library is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU Lesser General Public
|
---|
15 | * License as published by the Free Software Foundation; either
|
---|
16 | * version 2.1 of the License, or (at your option) any later version.
|
---|
17 | *
|
---|
18 | * This library is distributed in the hope that it will be useful,
|
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * Lesser General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU Lesser General Public
|
---|
24 | * License along with this library; if not, write to the Free Software
|
---|
25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
26 | */
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
30 | * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
31 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
32 | * a choice of LGPL license versions is made available with the language indicating
|
---|
33 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
34 | * of the LGPL is applied is otherwise unspecified.
|
---|
35 | */
|
---|
36 |
|
---|
37 | #include "config.h"
|
---|
38 | #include <stdio.h>
|
---|
39 | #ifdef HAVE_FLOAT_H
|
---|
40 | # include <float.h>
|
---|
41 | #endif
|
---|
42 | #include "wined3d_private.h"
|
---|
43 |
|
---|
44 | WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
---|
45 | WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
|
---|
46 |
|
---|
47 | #define GLINFO_LOCATION (*context->gl_info)
|
---|
48 |
|
---|
49 | /* GL locking for state handlers is done by the caller. */
|
---|
50 |
|
---|
51 | static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
|
---|
52 |
|
---|
53 | static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
54 | {
|
---|
55 | ERR("Undefined state.\n");
|
---|
56 | }
|
---|
57 |
|
---|
58 | static void state_nop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
59 | {
|
---|
60 | TRACE("%s: nop in current pipe config.\n", debug_d3dstate(state));
|
---|
61 | }
|
---|
62 |
|
---|
63 | static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
64 | {
|
---|
65 | WINED3DFILLMODE Value = stateblock->renderState[WINED3DRS_FILLMODE];
|
---|
66 |
|
---|
67 | switch(Value) {
|
---|
68 | case WINED3DFILL_POINT:
|
---|
69 | glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
|
---|
70 | checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)");
|
---|
71 | break;
|
---|
72 | case WINED3DFILL_WIREFRAME:
|
---|
73 | glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
---|
74 | checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)");
|
---|
75 | break;
|
---|
76 | case WINED3DFILL_SOLID:
|
---|
77 | glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
---|
78 | checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
|
---|
79 | break;
|
---|
80 | default:
|
---|
81 | FIXME("Unrecognized WINED3DRS_FILLMODE value %d\n", Value);
|
---|
82 | }
|
---|
83 | }
|
---|
84 |
|
---|
85 | static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
86 | {
|
---|
87 | /* Lighting is not enabled if transformed vertices are drawn
|
---|
88 | * but lighting does not affect the stream sources, so it is not grouped for performance reasons.
|
---|
89 | * This state reads the decoded vertex declaration, so if it is dirty don't do anything. The
|
---|
90 | * vertex declaration applying function calls this function for updating
|
---|
91 | */
|
---|
92 |
|
---|
93 | if(isStateDirty(context, STATE_VDECL)) {
|
---|
94 | return;
|
---|
95 | }
|
---|
96 |
|
---|
97 | if (stateblock->renderState[WINED3DRS_LIGHTING]
|
---|
98 | && !stateblock->device->strided_streams.position_transformed)
|
---|
99 | {
|
---|
100 | glEnable(GL_LIGHTING);
|
---|
101 | checkGLcall("glEnable GL_LIGHTING");
|
---|
102 | } else {
|
---|
103 | glDisable(GL_LIGHTING);
|
---|
104 | checkGLcall("glDisable GL_LIGHTING");
|
---|
105 | }
|
---|
106 | }
|
---|
107 |
|
---|
108 | static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
109 | {
|
---|
110 | /* No z test without depth stencil buffers */
|
---|
111 | if (!stateblock->device->stencilBufferTarget)
|
---|
112 | {
|
---|
113 | TRACE("No Z buffer - disabling depth test\n");
|
---|
114 | glDisable(GL_DEPTH_TEST); /* This also disables z writing in gl */
|
---|
115 | checkGLcall("glDisable GL_DEPTH_TEST");
|
---|
116 | return;
|
---|
117 | }
|
---|
118 |
|
---|
119 | switch ((WINED3DZBUFFERTYPE) stateblock->renderState[WINED3DRS_ZENABLE]) {
|
---|
120 | case WINED3DZB_FALSE:
|
---|
121 | glDisable(GL_DEPTH_TEST);
|
---|
122 | checkGLcall("glDisable GL_DEPTH_TEST");
|
---|
123 | break;
|
---|
124 | case WINED3DZB_TRUE:
|
---|
125 | glEnable(GL_DEPTH_TEST);
|
---|
126 | checkGLcall("glEnable GL_DEPTH_TEST");
|
---|
127 | break;
|
---|
128 | case WINED3DZB_USEW:
|
---|
129 | glEnable(GL_DEPTH_TEST);
|
---|
130 | checkGLcall("glEnable GL_DEPTH_TEST");
|
---|
131 | FIXME("W buffer is not well handled\n");
|
---|
132 | break;
|
---|
133 | default:
|
---|
134 | FIXME("Unrecognized D3DZBUFFERTYPE value %d\n", stateblock->renderState[WINED3DRS_ZENABLE]);
|
---|
135 | }
|
---|
136 | }
|
---|
137 |
|
---|
138 | static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
139 | {
|
---|
140 | /* glFrontFace() is set in context.c at context init and on an offscreen / onscreen rendering
|
---|
141 | * switch
|
---|
142 | */
|
---|
143 | switch ((WINED3DCULL) stateblock->renderState[WINED3DRS_CULLMODE]) {
|
---|
144 | case WINED3DCULL_NONE:
|
---|
145 | glDisable(GL_CULL_FACE);
|
---|
146 | checkGLcall("glDisable GL_CULL_FACE");
|
---|
147 | break;
|
---|
148 | case WINED3DCULL_CW:
|
---|
149 | glEnable(GL_CULL_FACE);
|
---|
150 | checkGLcall("glEnable GL_CULL_FACE");
|
---|
151 | glCullFace(GL_FRONT);
|
---|
152 | checkGLcall("glCullFace(GL_FRONT)");
|
---|
153 | break;
|
---|
154 | case WINED3DCULL_CCW:
|
---|
155 | glEnable(GL_CULL_FACE);
|
---|
156 | checkGLcall("glEnable GL_CULL_FACE");
|
---|
157 | glCullFace(GL_BACK);
|
---|
158 | checkGLcall("glCullFace(GL_BACK)");
|
---|
159 | break;
|
---|
160 | default:
|
---|
161 | FIXME("Unrecognized/Unhandled WINED3DCULL value %d\n", stateblock->renderState[WINED3DRS_CULLMODE]);
|
---|
162 | }
|
---|
163 | }
|
---|
164 |
|
---|
165 | static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
166 | {
|
---|
167 | switch ((WINED3DSHADEMODE) stateblock->renderState[WINED3DRS_SHADEMODE]) {
|
---|
168 | case WINED3DSHADE_FLAT:
|
---|
169 | glShadeModel(GL_FLAT);
|
---|
170 | checkGLcall("glShadeModel(GL_FLAT)");
|
---|
171 | break;
|
---|
172 | case WINED3DSHADE_GOURAUD:
|
---|
173 | glShadeModel(GL_SMOOTH);
|
---|
174 | checkGLcall("glShadeModel(GL_SMOOTH)");
|
---|
175 | break;
|
---|
176 | case WINED3DSHADE_PHONG:
|
---|
177 | FIXME("WINED3DSHADE_PHONG isn't supported\n");
|
---|
178 | break;
|
---|
179 | default:
|
---|
180 | FIXME("Unrecognized/Unhandled WINED3DSHADEMODE value %d\n", stateblock->renderState[WINED3DRS_SHADEMODE]);
|
---|
181 | }
|
---|
182 | }
|
---|
183 |
|
---|
184 | static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
185 | {
|
---|
186 | if (stateblock->renderState[WINED3DRS_DITHERENABLE]) {
|
---|
187 | glEnable(GL_DITHER);
|
---|
188 | checkGLcall("glEnable GL_DITHER");
|
---|
189 | } else {
|
---|
190 | glDisable(GL_DITHER);
|
---|
191 | checkGLcall("glDisable GL_DITHER");
|
---|
192 | }
|
---|
193 | }
|
---|
194 |
|
---|
195 | static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
196 | {
|
---|
197 | /* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. If yes,
|
---|
198 | * this has to be merged with ZENABLE and ZFUNC
|
---|
199 | */
|
---|
200 | if (stateblock->renderState[WINED3DRS_ZWRITEENABLE]) {
|
---|
201 | glDepthMask(1);
|
---|
202 | checkGLcall("glDepthMask(1)");
|
---|
203 | } else {
|
---|
204 | glDepthMask(0);
|
---|
205 | checkGLcall("glDepthMask(0)");
|
---|
206 | }
|
---|
207 | }
|
---|
208 |
|
---|
209 | static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
210 | {
|
---|
211 | int glParm = CompareFunc(stateblock->renderState[WINED3DRS_ZFUNC]);
|
---|
212 |
|
---|
213 | if(glParm) {
|
---|
214 | if(glParm == GL_EQUAL || glParm == GL_NOTEQUAL) {
|
---|
215 | static BOOL once = FALSE;
|
---|
216 | /* There are a few issues with this: First, our inability to
|
---|
217 | * select a proper Z depth, most of the time we're stuck with
|
---|
218 | * D24S8, even if the app selects D32 or D16. There seem to be
|
---|
219 | * some other precision problems which have to be debugged to
|
---|
220 | * make NOTEQUAL and EQUAL work properly
|
---|
221 | */
|
---|
222 | if(!once) {
|
---|
223 | once = TRUE;
|
---|
224 | FIXME("D3DCMP_NOTEQUAL and D3DCMP_EQUAL do not work correctly yet\n");
|
---|
225 | }
|
---|
226 | }
|
---|
227 |
|
---|
228 | glDepthFunc(glParm);
|
---|
229 | checkGLcall("glDepthFunc");
|
---|
230 | }
|
---|
231 | }
|
---|
232 |
|
---|
233 | static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
234 | {
|
---|
235 | float col[4];
|
---|
236 | D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_AMBIENT], col);
|
---|
237 |
|
---|
238 | TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
|
---|
239 | glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
|
---|
240 | checkGLcall("glLightModel for MODEL_AMBIENT");
|
---|
241 | }
|
---|
242 |
|
---|
243 | static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
244 | {
|
---|
245 | IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *)stateblock->device->render_targets[0];
|
---|
246 | int srcBlend = GL_ZERO;
|
---|
247 | int dstBlend = GL_ZERO;
|
---|
248 |
|
---|
249 | /* GL_LINE_SMOOTH needs GL_BLEND to work, according to the red book, and special blending params */
|
---|
250 | if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE] ||
|
---|
251 | stateblock->renderState[WINED3DRS_EDGEANTIALIAS] ||
|
---|
252 | stateblock->renderState[WINED3DRS_ANTIALIASEDLINEENABLE]) {
|
---|
253 |
|
---|
254 | /* Disable blending in all cases even without pixelshaders. With blending on we could face a big performance penalty.
|
---|
255 | * The d3d9 visual test confirms the behavior. */
|
---|
256 | if (context->render_offscreen
|
---|
257 | && !(target->resource.format_desc->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING))
|
---|
258 | {
|
---|
259 | glDisable(GL_BLEND);
|
---|
260 | checkGLcall("glDisable GL_BLEND");
|
---|
261 | return;
|
---|
262 | } else {
|
---|
263 | glEnable(GL_BLEND);
|
---|
264 | checkGLcall("glEnable GL_BLEND");
|
---|
265 | }
|
---|
266 | } else {
|
---|
267 | glDisable(GL_BLEND);
|
---|
268 | checkGLcall("glDisable GL_BLEND");
|
---|
269 | /* Nothing more to do - get out */
|
---|
270 | return;
|
---|
271 | };
|
---|
272 |
|
---|
273 | switch (stateblock->renderState[WINED3DRS_DESTBLEND]) {
|
---|
274 | case WINED3DBLEND_ZERO : dstBlend = GL_ZERO; break;
|
---|
275 | case WINED3DBLEND_ONE : dstBlend = GL_ONE; break;
|
---|
276 | case WINED3DBLEND_SRCCOLOR : dstBlend = GL_SRC_COLOR; break;
|
---|
277 | case WINED3DBLEND_INVSRCCOLOR : dstBlend = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
278 | case WINED3DBLEND_SRCALPHA : dstBlend = GL_SRC_ALPHA; break;
|
---|
279 | case WINED3DBLEND_INVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
280 | case WINED3DBLEND_DESTCOLOR : dstBlend = GL_DST_COLOR; break;
|
---|
281 | case WINED3DBLEND_INVDESTCOLOR : dstBlend = GL_ONE_MINUS_DST_COLOR; break;
|
---|
282 |
|
---|
283 | /* To compensate the lack of format switching with backbuffer offscreen rendering,
|
---|
284 | * and with onscreen rendering, we modify the alpha test parameters for (INV)DESTALPHA
|
---|
285 | * if the render target doesn't support alpha blending. A nonexistent alpha channel
|
---|
286 | * returns 1.0, so D3DBLEND_DESTALPHA is GL_ONE, and D3DBLEND_INVDESTALPHA is GL_ZERO
|
---|
287 | */
|
---|
288 | case WINED3DBLEND_DESTALPHA :
|
---|
289 | dstBlend = target->resource.format_desc->alpha_mask ? GL_DST_ALPHA : GL_ONE;
|
---|
290 | break;
|
---|
291 | case WINED3DBLEND_INVDESTALPHA :
|
---|
292 | dstBlend = target->resource.format_desc->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
---|
293 | break;
|
---|
294 |
|
---|
295 | case WINED3DBLEND_SRCALPHASAT :
|
---|
296 | dstBlend = GL_SRC_ALPHA_SATURATE;
|
---|
297 | WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n");
|
---|
298 | break;
|
---|
299 |
|
---|
300 | /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending
|
---|
301 | * values which are still valid up to d3d9. They should not occur as dest blend values
|
---|
302 | */
|
---|
303 | case WINED3DBLEND_BOTHSRCALPHA : dstBlend = GL_SRC_ALPHA;
|
---|
304 | srcBlend = GL_SRC_ALPHA;
|
---|
305 | FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHSRCALPHA, what to do?\n");
|
---|
306 | break;
|
---|
307 |
|
---|
308 | case WINED3DBLEND_BOTHINVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
---|
309 | srcBlend = GL_ONE_MINUS_SRC_ALPHA;
|
---|
310 | FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n");
|
---|
311 | break;
|
---|
312 |
|
---|
313 | case WINED3DBLEND_BLENDFACTOR : dstBlend = GL_CONSTANT_COLOR; break;
|
---|
314 | case WINED3DBLEND_INVBLENDFACTOR : dstBlend = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
---|
315 | default:
|
---|
316 | FIXME("Unrecognized dst blend value %d\n", stateblock->renderState[WINED3DRS_DESTBLEND]);
|
---|
317 | }
|
---|
318 |
|
---|
319 | switch (stateblock->renderState[WINED3DRS_SRCBLEND]) {
|
---|
320 | case WINED3DBLEND_ZERO : srcBlend = GL_ZERO; break;
|
---|
321 | case WINED3DBLEND_ONE : srcBlend = GL_ONE; break;
|
---|
322 | case WINED3DBLEND_SRCCOLOR : srcBlend = GL_SRC_COLOR; break;
|
---|
323 | case WINED3DBLEND_INVSRCCOLOR : srcBlend = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
324 | case WINED3DBLEND_SRCALPHA : srcBlend = GL_SRC_ALPHA; break;
|
---|
325 | case WINED3DBLEND_INVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
326 | case WINED3DBLEND_DESTCOLOR : srcBlend = GL_DST_COLOR; break;
|
---|
327 | case WINED3DBLEND_INVDESTCOLOR : srcBlend = GL_ONE_MINUS_DST_COLOR; break;
|
---|
328 | case WINED3DBLEND_SRCALPHASAT : srcBlend = GL_SRC_ALPHA_SATURATE; break;
|
---|
329 |
|
---|
330 | case WINED3DBLEND_DESTALPHA :
|
---|
331 | srcBlend = target->resource.format_desc->alpha_mask ? GL_DST_ALPHA : GL_ONE;
|
---|
332 | break;
|
---|
333 | case WINED3DBLEND_INVDESTALPHA :
|
---|
334 | srcBlend = target->resource.format_desc->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO;
|
---|
335 | break;
|
---|
336 |
|
---|
337 | case WINED3DBLEND_BOTHSRCALPHA : srcBlend = GL_SRC_ALPHA;
|
---|
338 | dstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
---|
339 | break;
|
---|
340 |
|
---|
341 | case WINED3DBLEND_BOTHINVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA;
|
---|
342 | dstBlend = GL_SRC_ALPHA;
|
---|
343 | break;
|
---|
344 |
|
---|
345 | case WINED3DBLEND_BLENDFACTOR : srcBlend = GL_CONSTANT_COLOR; break;
|
---|
346 | case WINED3DBLEND_INVBLENDFACTOR : srcBlend = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
---|
347 | default:
|
---|
348 | FIXME("Unrecognized src blend value %d\n", stateblock->renderState[WINED3DRS_SRCBLEND]);
|
---|
349 | }
|
---|
350 |
|
---|
351 | if(stateblock->renderState[WINED3DRS_EDGEANTIALIAS] ||
|
---|
352 | stateblock->renderState[WINED3DRS_ANTIALIASEDLINEENABLE]) {
|
---|
353 | glEnable(GL_LINE_SMOOTH);
|
---|
354 | checkGLcall("glEnable(GL_LINE_SMOOTH)");
|
---|
355 | if(srcBlend != GL_SRC_ALPHA) {
|
---|
356 | WARN("WINED3DRS_EDGEANTIALIAS enabled, but unexpected src blending param\n");
|
---|
357 | }
|
---|
358 | if(dstBlend != GL_ONE_MINUS_SRC_ALPHA && dstBlend != GL_ONE) {
|
---|
359 | WARN("WINED3DRS_EDGEANTIALIAS enabled, but unexpected dst blending param\n");
|
---|
360 | }
|
---|
361 | } else {
|
---|
362 | glDisable(GL_LINE_SMOOTH);
|
---|
363 | checkGLcall("glDisable(GL_LINE_SMOOTH)");
|
---|
364 | }
|
---|
365 |
|
---|
366 | /* Re-apply BLENDOP(ALPHA) because of a possible SEPARATEALPHABLENDENABLE change */
|
---|
367 | if(!isStateDirty(context, STATE_RENDER(WINED3DRS_BLENDOP))) {
|
---|
368 | state_blendop(STATE_RENDER(WINED3DRS_BLENDOPALPHA), stateblock, context);
|
---|
369 | }
|
---|
370 |
|
---|
371 | if(stateblock->renderState[WINED3DRS_SEPARATEALPHABLENDENABLE]) {
|
---|
372 | int srcBlendAlpha = GL_ZERO;
|
---|
373 | int dstBlendAlpha = GL_ZERO;
|
---|
374 |
|
---|
375 | /* Separate alpha blending requires GL_EXT_blend_function_separate, so make sure it is around */
|
---|
376 | if (!context->gl_info->supported[EXT_BLEND_FUNC_SEPARATE])
|
---|
377 | {
|
---|
378 | WARN("Unsupported in local OpenGL implementation: glBlendFuncSeparateEXT\n");
|
---|
379 | return;
|
---|
380 | }
|
---|
381 |
|
---|
382 | switch (stateblock->renderState[WINED3DRS_DESTBLENDALPHA]) {
|
---|
383 | case WINED3DBLEND_ZERO : dstBlendAlpha = GL_ZERO; break;
|
---|
384 | case WINED3DBLEND_ONE : dstBlendAlpha = GL_ONE; break;
|
---|
385 | case WINED3DBLEND_SRCCOLOR : dstBlendAlpha = GL_SRC_COLOR; break;
|
---|
386 | case WINED3DBLEND_INVSRCCOLOR : dstBlendAlpha = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
387 | case WINED3DBLEND_SRCALPHA : dstBlendAlpha = GL_SRC_ALPHA; break;
|
---|
388 | case WINED3DBLEND_INVSRCALPHA : dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
389 | case WINED3DBLEND_DESTCOLOR : dstBlendAlpha = GL_DST_COLOR; break;
|
---|
390 | case WINED3DBLEND_INVDESTCOLOR : dstBlendAlpha = GL_ONE_MINUS_DST_COLOR; break;
|
---|
391 | case WINED3DBLEND_DESTALPHA : dstBlendAlpha = GL_DST_ALPHA; break;
|
---|
392 | case WINED3DBLEND_INVDESTALPHA : dstBlendAlpha = GL_DST_ALPHA; break;
|
---|
393 | case WINED3DBLEND_SRCALPHASAT :
|
---|
394 | dstBlend = GL_SRC_ALPHA_SATURATE;
|
---|
395 | WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n");
|
---|
396 | break;
|
---|
397 | /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending
|
---|
398 | * values which are still valid up to d3d9. They should not occur as dest blend values
|
---|
399 | */
|
---|
400 | case WINED3DBLEND_BOTHSRCALPHA :
|
---|
401 | dstBlendAlpha = GL_SRC_ALPHA;
|
---|
402 | srcBlendAlpha = GL_SRC_ALPHA;
|
---|
403 | FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHSRCALPHA, what to do?\n");
|
---|
404 | break;
|
---|
405 | case WINED3DBLEND_BOTHINVSRCALPHA :
|
---|
406 | dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
---|
407 | srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
---|
408 | FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n");
|
---|
409 | break;
|
---|
410 | case WINED3DBLEND_BLENDFACTOR : dstBlendAlpha = GL_CONSTANT_COLOR; break;
|
---|
411 | case WINED3DBLEND_INVBLENDFACTOR : dstBlendAlpha = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
---|
412 | default:
|
---|
413 | FIXME("Unrecognized dst blend alpha value %d\n", stateblock->renderState[WINED3DRS_DESTBLENDALPHA]);
|
---|
414 | }
|
---|
415 |
|
---|
416 | switch (stateblock->renderState[WINED3DRS_SRCBLENDALPHA]) {
|
---|
417 | case WINED3DBLEND_ZERO : srcBlendAlpha = GL_ZERO; break;
|
---|
418 | case WINED3DBLEND_ONE : srcBlendAlpha = GL_ONE; break;
|
---|
419 | case WINED3DBLEND_SRCCOLOR : srcBlendAlpha = GL_SRC_COLOR; break;
|
---|
420 | case WINED3DBLEND_INVSRCCOLOR : srcBlendAlpha = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
421 | case WINED3DBLEND_SRCALPHA : srcBlendAlpha = GL_SRC_ALPHA; break;
|
---|
422 | case WINED3DBLEND_INVSRCALPHA : srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
423 | case WINED3DBLEND_DESTCOLOR : srcBlendAlpha = GL_DST_COLOR; break;
|
---|
424 | case WINED3DBLEND_INVDESTCOLOR : srcBlendAlpha = GL_ONE_MINUS_DST_COLOR; break;
|
---|
425 | case WINED3DBLEND_SRCALPHASAT : srcBlendAlpha = GL_SRC_ALPHA_SATURATE; break;
|
---|
426 | case WINED3DBLEND_DESTALPHA : srcBlendAlpha = GL_DST_ALPHA; break;
|
---|
427 | case WINED3DBLEND_INVDESTALPHA : srcBlendAlpha = GL_DST_ALPHA; break;
|
---|
428 | case WINED3DBLEND_BOTHSRCALPHA :
|
---|
429 | srcBlendAlpha = GL_SRC_ALPHA;
|
---|
430 | dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
---|
431 | break;
|
---|
432 | case WINED3DBLEND_BOTHINVSRCALPHA :
|
---|
433 | srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA;
|
---|
434 | dstBlendAlpha = GL_SRC_ALPHA;
|
---|
435 | break;
|
---|
436 | case WINED3DBLEND_BLENDFACTOR : srcBlendAlpha = GL_CONSTANT_COLOR; break;
|
---|
437 | case WINED3DBLEND_INVBLENDFACTOR : srcBlendAlpha = GL_ONE_MINUS_CONSTANT_COLOR; break;
|
---|
438 | default:
|
---|
439 | FIXME("Unrecognized src blend alpha value %d\n", stateblock->renderState[WINED3DRS_SRCBLENDALPHA]);
|
---|
440 | }
|
---|
441 |
|
---|
442 | GL_EXTCALL(glBlendFuncSeparateEXT(srcBlend, dstBlend, srcBlendAlpha, dstBlendAlpha));
|
---|
443 | checkGLcall("glBlendFuncSeparateEXT");
|
---|
444 | } else {
|
---|
445 | TRACE("glBlendFunc src=%x, dst=%x\n", srcBlend, dstBlend);
|
---|
446 | glBlendFunc(srcBlend, dstBlend);
|
---|
447 | checkGLcall("glBlendFunc");
|
---|
448 | }
|
---|
449 |
|
---|
450 | /* colorkey fixup for stage 0 alphaop depends on WINED3DRS_ALPHABLENDENABLE state,
|
---|
451 | so it may need updating */
|
---|
452 | if (stateblock->renderState[WINED3DRS_COLORKEYENABLE])
|
---|
453 | stateblock_apply_state(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), stateblock, context);
|
---|
454 | }
|
---|
455 |
|
---|
456 | static void state_blendfactor_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
457 | {
|
---|
458 | WARN("Unsupported in local OpenGL implementation: glBlendColorEXT\n");
|
---|
459 | }
|
---|
460 |
|
---|
461 | static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
462 | {
|
---|
463 | float col[4];
|
---|
464 |
|
---|
465 | TRACE("Setting BlendFactor to %d\n", stateblock->renderState[WINED3DRS_BLENDFACTOR]);
|
---|
466 | D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_BLENDFACTOR], col);
|
---|
467 | GL_EXTCALL(glBlendColorEXT (col[0],col[1],col[2],col[3]));
|
---|
468 | checkGLcall("glBlendColor");
|
---|
469 | }
|
---|
470 |
|
---|
471 | static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
472 | {
|
---|
473 | int glParm = 0;
|
---|
474 | float ref;
|
---|
475 | BOOL enable_ckey = FALSE;
|
---|
476 |
|
---|
477 | TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
|
---|
478 |
|
---|
479 | /* Find out if the texture on the first stage has a ckey set
|
---|
480 | * The alpha state func reads the texture settings, even though alpha and texture are not grouped
|
---|
481 | * together. This is to avoid making a huge alpha+texture+texture stage+ckey block due to the hardly
|
---|
482 | * used WINED3DRS_COLORKEYENABLE state(which is d3d <= 3 only). The texture function will call alpha
|
---|
483 | * in case it finds some texture+colorkeyenable combination which needs extra care.
|
---|
484 | */
|
---|
485 | if (stateblock->textures[0])
|
---|
486 | {
|
---|
487 | UINT texture_dimensions = IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[0]);
|
---|
488 |
|
---|
489 | if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
|
---|
490 | {
|
---|
491 | IWineD3DSurfaceImpl *surf;
|
---|
492 |
|
---|
493 | surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *)stateblock->textures[0])->surfaces[0];
|
---|
494 |
|
---|
495 | if (surf->CKeyFlags & WINEDDSD_CKSRCBLT)
|
---|
496 | {
|
---|
497 | /* The surface conversion does not do color keying conversion for surfaces that have an alpha
|
---|
498 | * channel on their own. Likewise, the alpha test shouldn't be set up for color keying if the
|
---|
499 | * surface has alpha bits */
|
---|
500 | if (!surf->resource.format_desc->alpha_mask) enable_ckey = TRUE;
|
---|
501 | }
|
---|
502 | }
|
---|
503 | }
|
---|
504 |
|
---|
505 | if (enable_ckey || context->last_was_ckey)
|
---|
506 | stateblock_apply_state(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), stateblock, context);
|
---|
507 | context->last_was_ckey = enable_ckey;
|
---|
508 |
|
---|
509 | if (stateblock->renderState[WINED3DRS_ALPHATESTENABLE] ||
|
---|
510 | (stateblock->renderState[WINED3DRS_COLORKEYENABLE] && enable_ckey)) {
|
---|
511 | glEnable(GL_ALPHA_TEST);
|
---|
512 | checkGLcall("glEnable GL_ALPHA_TEST");
|
---|
513 | } else {
|
---|
514 | glDisable(GL_ALPHA_TEST);
|
---|
515 | checkGLcall("glDisable GL_ALPHA_TEST");
|
---|
516 | /* Alpha test is disabled, don't bother setting the params - it will happen on the next
|
---|
517 | * enable call
|
---|
518 | */
|
---|
519 | return;
|
---|
520 | }
|
---|
521 |
|
---|
522 | if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && enable_ckey) {
|
---|
523 | glParm = GL_NOTEQUAL;
|
---|
524 | ref = 0.0f;
|
---|
525 | } else {
|
---|
526 | ref = ((float) stateblock->renderState[WINED3DRS_ALPHAREF]) / 255.0f;
|
---|
527 | glParm = CompareFunc(stateblock->renderState[WINED3DRS_ALPHAFUNC]);
|
---|
528 | }
|
---|
529 | if(glParm) {
|
---|
530 | glAlphaFunc(glParm, ref);
|
---|
531 | checkGLcall("glAlphaFunc");
|
---|
532 | }
|
---|
533 | }
|
---|
534 |
|
---|
535 | static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
536 | {
|
---|
537 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
538 | DWORD enable = 0xFFFFFFFF;
|
---|
539 | DWORD disable = 0x00000000;
|
---|
540 |
|
---|
541 | if (!stateblock->device->vs_clipping && use_vs(stateblock))
|
---|
542 | {
|
---|
543 | /* The spec says that opengl clipping planes are disabled when using shaders. Direct3D planes aren't,
|
---|
544 | * so that is an issue. The MacOS ATI driver keeps clipping planes activated with shaders in some
|
---|
545 | * conditions I got sick of tracking down. The shader state handler disables all clip planes because
|
---|
546 | * of that - don't do anything here and keep them disabled
|
---|
547 | */
|
---|
548 | if(stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]) {
|
---|
549 | static BOOL warned = FALSE;
|
---|
550 | if(!warned) {
|
---|
551 | FIXME("Clipping not supported with vertex shaders\n");
|
---|
552 | warned = TRUE;
|
---|
553 | }
|
---|
554 | }
|
---|
555 | return;
|
---|
556 | }
|
---|
557 |
|
---|
558 | /* TODO: Keep track of previously enabled clipplanes to avoid unnecessary resetting
|
---|
559 | * of already set values
|
---|
560 | */
|
---|
561 |
|
---|
562 | /* If enabling / disabling all
|
---|
563 | * TODO: Is this correct? Doesn't D3DRS_CLIPPING disable clipping on the viewport frustrum?
|
---|
564 | */
|
---|
565 | if (stateblock->renderState[WINED3DRS_CLIPPING]) {
|
---|
566 | enable = stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
|
---|
567 | disable = ~stateblock->renderState[WINED3DRS_CLIPPLANEENABLE];
|
---|
568 | if (gl_info->supported[ARB_DEPTH_CLAMP])
|
---|
569 | {
|
---|
570 | glDisable(GL_DEPTH_CLAMP);
|
---|
571 | checkGLcall("glDisable(GL_DEPTH_CLAMP)");
|
---|
572 | }
|
---|
573 | } else {
|
---|
574 | disable = 0xffffffff;
|
---|
575 | enable = 0x00;
|
---|
576 | if (gl_info->supported[ARB_DEPTH_CLAMP])
|
---|
577 | {
|
---|
578 | glEnable(GL_DEPTH_CLAMP);
|
---|
579 | checkGLcall("glEnable(GL_DEPTH_CLAMP)");
|
---|
580 | }
|
---|
581 | else
|
---|
582 | {
|
---|
583 | FIXME("Clipping disabled, but ARB_depth_clamp isn't supported.\n");
|
---|
584 | }
|
---|
585 | }
|
---|
586 |
|
---|
587 | if (enable & WINED3DCLIPPLANE0) { glEnable(GL_CLIP_PLANE0); checkGLcall("glEnable(clip plane 0)"); }
|
---|
588 | if (enable & WINED3DCLIPPLANE1) { glEnable(GL_CLIP_PLANE1); checkGLcall("glEnable(clip plane 1)"); }
|
---|
589 | if (enable & WINED3DCLIPPLANE2) { glEnable(GL_CLIP_PLANE2); checkGLcall("glEnable(clip plane 2)"); }
|
---|
590 | if (enable & WINED3DCLIPPLANE3) { glEnable(GL_CLIP_PLANE3); checkGLcall("glEnable(clip plane 3)"); }
|
---|
591 | if (enable & WINED3DCLIPPLANE4) { glEnable(GL_CLIP_PLANE4); checkGLcall("glEnable(clip plane 4)"); }
|
---|
592 | if (enable & WINED3DCLIPPLANE5) { glEnable(GL_CLIP_PLANE5); checkGLcall("glEnable(clip plane 5)"); }
|
---|
593 |
|
---|
594 | if (disable & WINED3DCLIPPLANE0) { glDisable(GL_CLIP_PLANE0); checkGLcall("glDisable(clip plane 0)"); }
|
---|
595 | if (disable & WINED3DCLIPPLANE1) { glDisable(GL_CLIP_PLANE1); checkGLcall("glDisable(clip plane 1)"); }
|
---|
596 | if (disable & WINED3DCLIPPLANE2) { glDisable(GL_CLIP_PLANE2); checkGLcall("glDisable(clip plane 2)"); }
|
---|
597 | if (disable & WINED3DCLIPPLANE3) { glDisable(GL_CLIP_PLANE3); checkGLcall("glDisable(clip plane 3)"); }
|
---|
598 | if (disable & WINED3DCLIPPLANE4) { glDisable(GL_CLIP_PLANE4); checkGLcall("glDisable(clip plane 4)"); }
|
---|
599 | if (disable & WINED3DCLIPPLANE5) { glDisable(GL_CLIP_PLANE5); checkGLcall("glDisable(clip plane 5)"); }
|
---|
600 |
|
---|
601 | /** update clipping status */
|
---|
602 | if (enable) {
|
---|
603 | stateblock->clip_status.ClipUnion = 0;
|
---|
604 | stateblock->clip_status.ClipIntersection = 0xFFFFFFFF;
|
---|
605 | } else {
|
---|
606 | stateblock->clip_status.ClipUnion = 0;
|
---|
607 | stateblock->clip_status.ClipIntersection = 0;
|
---|
608 | }
|
---|
609 | }
|
---|
610 |
|
---|
611 | static void state_blendop_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
612 | {
|
---|
613 | WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
|
---|
614 | }
|
---|
615 |
|
---|
616 | static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
617 | {
|
---|
618 | int blendEquation = GL_FUNC_ADD;
|
---|
619 | int blendEquationAlpha = GL_FUNC_ADD;
|
---|
620 |
|
---|
621 | /* BLENDOPALPHA requires GL_EXT_blend_equation_separate, so make sure it is around */
|
---|
622 | if (stateblock->renderState[WINED3DRS_BLENDOPALPHA]
|
---|
623 | && !context->gl_info->supported[EXT_BLEND_EQUATION_SEPARATE])
|
---|
624 | {
|
---|
625 | WARN("Unsupported in local OpenGL implementation: glBlendEquationSeparateEXT\n");
|
---|
626 | return;
|
---|
627 | }
|
---|
628 |
|
---|
629 | switch ((WINED3DBLENDOP) stateblock->renderState[WINED3DRS_BLENDOP]) {
|
---|
630 | case WINED3DBLENDOP_ADD : blendEquation = GL_FUNC_ADD; break;
|
---|
631 | case WINED3DBLENDOP_SUBTRACT : blendEquation = GL_FUNC_SUBTRACT; break;
|
---|
632 | case WINED3DBLENDOP_REVSUBTRACT : blendEquation = GL_FUNC_REVERSE_SUBTRACT; break;
|
---|
633 | case WINED3DBLENDOP_MIN : blendEquation = GL_MIN; break;
|
---|
634 | case WINED3DBLENDOP_MAX : blendEquation = GL_MAX; break;
|
---|
635 | default:
|
---|
636 | FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock->renderState[WINED3DRS_BLENDOP]);
|
---|
637 | }
|
---|
638 |
|
---|
639 | switch ((WINED3DBLENDOP) stateblock->renderState[WINED3DRS_BLENDOPALPHA]) {
|
---|
640 | case WINED3DBLENDOP_ADD : blendEquationAlpha = GL_FUNC_ADD; break;
|
---|
641 | case WINED3DBLENDOP_SUBTRACT : blendEquationAlpha = GL_FUNC_SUBTRACT; break;
|
---|
642 | case WINED3DBLENDOP_REVSUBTRACT : blendEquationAlpha = GL_FUNC_REVERSE_SUBTRACT; break;
|
---|
643 | case WINED3DBLENDOP_MIN : blendEquationAlpha = GL_MIN; break;
|
---|
644 | case WINED3DBLENDOP_MAX : blendEquationAlpha = GL_MAX; break;
|
---|
645 | default:
|
---|
646 | FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock->renderState[WINED3DRS_BLENDOPALPHA]);
|
---|
647 | }
|
---|
648 |
|
---|
649 | if(stateblock->renderState[WINED3DRS_SEPARATEALPHABLENDENABLE]) {
|
---|
650 | TRACE("glBlendEquationSeparateEXT(%x, %x)\n", blendEquation, blendEquationAlpha);
|
---|
651 | GL_EXTCALL(glBlendEquationSeparateEXT(blendEquation, blendEquationAlpha));
|
---|
652 | checkGLcall("glBlendEquationSeparateEXT");
|
---|
653 | } else {
|
---|
654 | TRACE("glBlendEquation(%x)\n", blendEquation);
|
---|
655 | GL_EXTCALL(glBlendEquationEXT(blendEquation));
|
---|
656 | checkGLcall("glBlendEquation");
|
---|
657 | }
|
---|
658 | }
|
---|
659 |
|
---|
660 | static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
661 | {
|
---|
662 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
663 | /* Originally this used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR)
|
---|
664 | * and (GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR) to swap between enabled/disabled
|
---|
665 | * specular color. This is wrong:
|
---|
666 | * Separate specular color means the specular colour is maintained separately, whereas
|
---|
667 | * single color means it is merged in. However in both cases they are being used to
|
---|
668 | * some extent.
|
---|
669 | * To disable specular color, set it explicitly to black and turn off GL_COLOR_SUM_EXT
|
---|
670 | * NOTE: If not supported don't give FIXMEs the impact is really minimal and very few people are
|
---|
671 | * running 1.4 yet!
|
---|
672 | *
|
---|
673 | *
|
---|
674 | * If register combiners are enabled, enabling / disabling GL_COLOR_SUM has no effect.
|
---|
675 | * Instead, we need to setup the FinalCombiner properly.
|
---|
676 | *
|
---|
677 | * The default setup for the FinalCombiner is:
|
---|
678 | *
|
---|
679 | * <variable> <input> <mapping> <usage>
|
---|
680 | * GL_VARIABLE_A_NV GL_FOG, GL_UNSIGNED_IDENTITY_NV GL_ALPHA
|
---|
681 | * GL_VARIABLE_B_NV GL_SPARE0_PLUS_SECONDARY_COLOR_NV GL_UNSIGNED_IDENTITY_NV GL_RGB
|
---|
682 | * GL_VARIABLE_C_NV GL_FOG GL_UNSIGNED_IDENTITY_NV GL_RGB
|
---|
683 | * GL_VARIABLE_D_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
|
---|
684 | * GL_VARIABLE_E_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
|
---|
685 | * GL_VARIABLE_F_NV GL_ZERO GL_UNSIGNED_IDENTITY_NV GL_RGB
|
---|
686 | * GL_VARIABLE_G_NV GL_SPARE0_NV GL_UNSIGNED_IDENTITY_NV GL_ALPHA
|
---|
687 | *
|
---|
688 | * That's pretty much fine as it is, except for variable B, which needs to take
|
---|
689 | * either GL_SPARE0_PLUS_SECONDARY_COLOR_NV or GL_SPARE0_NV, depending on
|
---|
690 | * whether WINED3DRS_SPECULARENABLE is enabled or not.
|
---|
691 | */
|
---|
692 |
|
---|
693 | TRACE("Setting specular enable state and materials\n");
|
---|
694 | if (stateblock->renderState[WINED3DRS_SPECULARENABLE]) {
|
---|
695 | glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &stateblock->material.Specular);
|
---|
696 | checkGLcall("glMaterialfv");
|
---|
697 |
|
---|
698 | if (stateblock->material.Power > gl_info->limits.shininess)
|
---|
699 | {
|
---|
700 | /* glMaterialf man page says that the material says that GL_SHININESS must be between 0.0
|
---|
701 | * and 128.0, although in d3d neither -1 nor 129 produce an error. GL_NV_max_light_exponent
|
---|
702 | * allows bigger values. If the extension is supported, gl_info->limits.shininess contains the
|
---|
703 | * value reported by the extension, otherwise 128. For values > gl_info->limits.shininess clamp
|
---|
704 | * them, it should be safe to do so without major visual distortions.
|
---|
705 | */
|
---|
706 | WARN("Material power = %f, limit %f\n", stateblock->material.Power, gl_info->limits.shininess);
|
---|
707 | glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, gl_info->limits.shininess);
|
---|
708 | } else {
|
---|
709 | glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, stateblock->material.Power);
|
---|
710 | }
|
---|
711 | checkGLcall("glMaterialf(GL_SHININESS)");
|
---|
712 |
|
---|
713 | if (gl_info->supported[EXT_SECONDARY_COLOR])
|
---|
714 | {
|
---|
715 | glEnable(GL_COLOR_SUM_EXT);
|
---|
716 | }
|
---|
717 | else
|
---|
718 | {
|
---|
719 | TRACE("Specular colors cannot be enabled in this version of opengl\n");
|
---|
720 | }
|
---|
721 | checkGLcall("glEnable(GL_COLOR_SUM)");
|
---|
722 |
|
---|
723 | if (gl_info->supported[NV_REGISTER_COMBINERS])
|
---|
724 | {
|
---|
725 | GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_PLUS_SECONDARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB));
|
---|
726 | checkGLcall("glFinalCombinerInputNV()");
|
---|
727 | }
|
---|
728 | } else {
|
---|
729 | static const GLfloat black[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
---|
730 |
|
---|
731 | /* for the case of enabled lighting: */
|
---|
732 | glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
|
---|
733 | checkGLcall("glMaterialfv");
|
---|
734 |
|
---|
735 | /* for the case of disabled lighting: */
|
---|
736 | if (gl_info->supported[EXT_SECONDARY_COLOR])
|
---|
737 | {
|
---|
738 | glDisable(GL_COLOR_SUM_EXT);
|
---|
739 | }
|
---|
740 | else
|
---|
741 | {
|
---|
742 | TRACE("Specular colors cannot be disabled in this version of opengl\n");
|
---|
743 | }
|
---|
744 | checkGLcall("glDisable(GL_COLOR_SUM)");
|
---|
745 |
|
---|
746 | if (gl_info->supported[NV_REGISTER_COMBINERS])
|
---|
747 | {
|
---|
748 | GL_EXTCALL(glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB));
|
---|
749 | checkGLcall("glFinalCombinerInputNV()");
|
---|
750 | }
|
---|
751 | }
|
---|
752 |
|
---|
753 | TRACE("(%p) : Diffuse {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
|
---|
754 | stateblock->material.Diffuse.r, stateblock->material.Diffuse.g,
|
---|
755 | stateblock->material.Diffuse.b, stateblock->material.Diffuse.a);
|
---|
756 | TRACE("(%p) : Ambient {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
|
---|
757 | stateblock->material.Ambient.r, stateblock->material.Ambient.g,
|
---|
758 | stateblock->material.Ambient.b, stateblock->material.Ambient.a);
|
---|
759 | TRACE("(%p) : Specular {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
|
---|
760 | stateblock->material.Specular.r, stateblock->material.Specular.g,
|
---|
761 | stateblock->material.Specular.b, stateblock->material.Specular.a);
|
---|
762 | TRACE("(%p) : Emissive {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
|
---|
763 | stateblock->material.Emissive.r, stateblock->material.Emissive.g,
|
---|
764 | stateblock->material.Emissive.b, stateblock->material.Emissive.a);
|
---|
765 |
|
---|
766 | glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*) &stateblock->material.Ambient);
|
---|
767 | checkGLcall("glMaterialfv(GL_AMBIENT)");
|
---|
768 | glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) &stateblock->material.Diffuse);
|
---|
769 | checkGLcall("glMaterialfv(GL_DIFFUSE)");
|
---|
770 | glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) &stateblock->material.Emissive);
|
---|
771 | checkGLcall("glMaterialfv(GL_EMISSION)");
|
---|
772 | }
|
---|
773 |
|
---|
774 | static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
775 | {
|
---|
776 | unsigned int i;
|
---|
777 |
|
---|
778 | /* Note the texture color applies to all textures whereas
|
---|
779 | * GL_TEXTURE_ENV_COLOR applies to active only
|
---|
780 | */
|
---|
781 | float col[4];
|
---|
782 | D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
|
---|
783 |
|
---|
784 | /* And now the default texture color as well */
|
---|
785 | for (i = 0; i < context->gl_info->limits.texture_stages; ++i)
|
---|
786 | {
|
---|
787 | /* Note the WINED3DRS value applies to all textures, but GL has one
|
---|
788 | * per texture, so apply it now ready to be used!
|
---|
789 | */
|
---|
790 | GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
|
---|
791 | checkGLcall("glActiveTextureARB");
|
---|
792 |
|
---|
793 | glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
|
---|
794 | checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
|
---|
795 | }
|
---|
796 | }
|
---|
797 |
|
---|
798 | static void renderstate_stencil_twosided(struct wined3d_context *context, GLint face,
|
---|
799 | GLint func, GLint ref, GLuint mask, GLint stencilFail, GLint depthFail, GLint stencilPass)
|
---|
800 | {
|
---|
801 | glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
---|
802 | checkGLcall("glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
|
---|
803 | GL_EXTCALL(glActiveStencilFaceEXT(face));
|
---|
804 | checkGLcall("glActiveStencilFaceEXT(...)");
|
---|
805 | glStencilFunc(func, ref, mask);
|
---|
806 | checkGLcall("glStencilFunc(...)");
|
---|
807 | glStencilOp(stencilFail, depthFail, stencilPass);
|
---|
808 | checkGLcall("glStencilOp(...)");
|
---|
809 | }
|
---|
810 |
|
---|
811 | static void state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
812 | {
|
---|
813 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
814 | DWORD onesided_enable = FALSE;
|
---|
815 | DWORD twosided_enable = FALSE;
|
---|
816 | GLint func = GL_ALWAYS;
|
---|
817 | GLint func_ccw = GL_ALWAYS;
|
---|
818 | GLint ref = 0;
|
---|
819 | GLuint mask = 0;
|
---|
820 | GLint stencilFail = GL_KEEP;
|
---|
821 | GLint depthFail = GL_KEEP;
|
---|
822 | GLint stencilPass = GL_KEEP;
|
---|
823 | GLint stencilFail_ccw = GL_KEEP;
|
---|
824 | GLint depthFail_ccw = GL_KEEP;
|
---|
825 | GLint stencilPass_ccw = GL_KEEP;
|
---|
826 |
|
---|
827 | /* No stencil test without a stencil buffer. */
|
---|
828 | if (!stateblock->device->stencilBufferTarget)
|
---|
829 | {
|
---|
830 | glDisable(GL_STENCIL_TEST);
|
---|
831 | checkGLcall("glDisable GL_STENCIL_TEST");
|
---|
832 | return;
|
---|
833 | }
|
---|
834 |
|
---|
835 | onesided_enable = stateblock->renderState[WINED3DRS_STENCILENABLE];
|
---|
836 | twosided_enable = stateblock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE];
|
---|
837 | if( !( func = CompareFunc(stateblock->renderState[WINED3DRS_STENCILFUNC]) ) )
|
---|
838 | func = GL_ALWAYS;
|
---|
839 | if( !( func_ccw = CompareFunc(stateblock->renderState[WINED3DRS_CCW_STENCILFUNC]) ) )
|
---|
840 | func_ccw = GL_ALWAYS;
|
---|
841 | ref = stateblock->renderState[WINED3DRS_STENCILREF];
|
---|
842 | mask = stateblock->renderState[WINED3DRS_STENCILMASK];
|
---|
843 | stencilFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILFAIL]);
|
---|
844 | depthFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILZFAIL]);
|
---|
845 | stencilPass = StencilOp(stateblock->renderState[WINED3DRS_STENCILPASS]);
|
---|
846 | stencilFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILFAIL]);
|
---|
847 | depthFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILZFAIL]);
|
---|
848 | stencilPass_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILPASS]);
|
---|
849 |
|
---|
850 | TRACE("(onesided %d, twosided %d, ref %x, mask %x, "
|
---|
851 | "GL_FRONT: func: %x, fail %x, zfail %x, zpass %x "
|
---|
852 | "GL_BACK: func: %x, fail %x, zfail %x, zpass %x )\n",
|
---|
853 | onesided_enable, twosided_enable, ref, mask,
|
---|
854 | func, stencilFail, depthFail, stencilPass,
|
---|
855 | func_ccw, stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
|
---|
856 |
|
---|
857 | if (twosided_enable && onesided_enable) {
|
---|
858 | glEnable(GL_STENCIL_TEST);
|
---|
859 | checkGLcall("glEnable GL_STENCIL_TEST");
|
---|
860 |
|
---|
861 | if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
|
---|
862 | {
|
---|
863 | /* Apply back first, then front. This function calls glActiveStencilFaceEXT,
|
---|
864 | * which has an effect on the code below too. If we apply the front face
|
---|
865 | * afterwards, we are sure that the active stencil face is set to front,
|
---|
866 | * and other stencil functions which do not use two sided stencil do not have
|
---|
867 | * to set it back
|
---|
868 | */
|
---|
869 | renderstate_stencil_twosided(context, GL_BACK,
|
---|
870 | func_ccw, ref, mask, stencilFail_ccw, depthFail_ccw, stencilPass_ccw);
|
---|
871 | renderstate_stencil_twosided(context, GL_FRONT,
|
---|
872 | func, ref, mask, stencilFail, depthFail, stencilPass);
|
---|
873 | }
|
---|
874 | else if (gl_info->supported[ATI_SEPARATE_STENCIL])
|
---|
875 | {
|
---|
876 | GL_EXTCALL(glStencilFuncSeparateATI(func, func_ccw, ref, mask));
|
---|
877 | checkGLcall("glStencilFuncSeparateATI(...)");
|
---|
878 | GL_EXTCALL(glStencilOpSeparateATI(GL_FRONT, stencilFail, depthFail, stencilPass));
|
---|
879 | checkGLcall("glStencilOpSeparateATI(GL_FRONT, ...)");
|
---|
880 | GL_EXTCALL(glStencilOpSeparateATI(GL_BACK, stencilFail_ccw, depthFail_ccw, stencilPass_ccw));
|
---|
881 | checkGLcall("glStencilOpSeparateATI(GL_BACK, ...)");
|
---|
882 | } else {
|
---|
883 | ERR("Separate (two sided) stencil not supported on this version of opengl. Caps weren't honored?\n");
|
---|
884 | }
|
---|
885 | }
|
---|
886 | else if(onesided_enable)
|
---|
887 | {
|
---|
888 | if (gl_info->supported[EXT_STENCIL_TWO_SIDE])
|
---|
889 | {
|
---|
890 | glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
|
---|
891 | checkGLcall("glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT)");
|
---|
892 | }
|
---|
893 |
|
---|
894 | /* This code disables the ATI extension as well, since the standard stencil functions are equal
|
---|
895 | * to calling the ATI functions with GL_FRONT_AND_BACK as face parameter
|
---|
896 | */
|
---|
897 | glEnable(GL_STENCIL_TEST);
|
---|
898 | checkGLcall("glEnable GL_STENCIL_TEST");
|
---|
899 | glStencilFunc(func, ref, mask);
|
---|
900 | checkGLcall("glStencilFunc(...)");
|
---|
901 | glStencilOp(stencilFail, depthFail, stencilPass);
|
---|
902 | checkGLcall("glStencilOp(...)");
|
---|
903 | } else {
|
---|
904 | glDisable(GL_STENCIL_TEST);
|
---|
905 | checkGLcall("glDisable GL_STENCIL_TEST");
|
---|
906 | }
|
---|
907 | }
|
---|
908 |
|
---|
909 | static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
910 | {
|
---|
911 | DWORD mask = stateblock->device->stencilBufferTarget ? stateblock->renderState[WINED3DRS_STENCILWRITEMASK] : 0;
|
---|
912 |
|
---|
913 | GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK));
|
---|
914 | checkGLcall("glActiveStencilFaceEXT(GL_BACK)");
|
---|
915 | glStencilMask(mask);
|
---|
916 | checkGLcall("glStencilMask");
|
---|
917 | GL_EXTCALL(glActiveStencilFaceEXT(GL_FRONT));
|
---|
918 | checkGLcall("glActiveStencilFaceEXT(GL_FRONT)");
|
---|
919 | glStencilMask(mask);
|
---|
920 | }
|
---|
921 |
|
---|
922 | static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
923 | {
|
---|
924 | DWORD mask = stateblock->device->stencilBufferTarget ? stateblock->renderState[WINED3DRS_STENCILWRITEMASK] : 0;
|
---|
925 |
|
---|
926 | glStencilMask(mask);
|
---|
927 | checkGLcall("glStencilMask");
|
---|
928 | }
|
---|
929 |
|
---|
930 | static void state_fog_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
931 | {
|
---|
932 |
|
---|
933 | TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
|
---|
934 |
|
---|
935 | if (!stateblock->renderState[WINED3DRS_FOGENABLE]) return;
|
---|
936 |
|
---|
937 | /* Table fog on: Never use fog coords, and use per-fragment fog */
|
---|
938 | if(stateblock->renderState[WINED3DRS_FOGTABLEMODE] != WINED3DFOG_NONE) {
|
---|
939 | glHint(GL_FOG_HINT, GL_NICEST);
|
---|
940 | if(context->fog_coord) {
|
---|
941 | glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
---|
942 | checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
---|
943 | context->fog_coord = FALSE;
|
---|
944 | }
|
---|
945 | return;
|
---|
946 | }
|
---|
947 |
|
---|
948 | /* Otherwise use per-vertex fog in any case */
|
---|
949 | glHint(GL_FOG_HINT, GL_FASTEST);
|
---|
950 |
|
---|
951 | if(stateblock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE || context->last_was_rhw) {
|
---|
952 | /* No fog at all, or transformed vertices: Use fog coord */
|
---|
953 | if(!context->fog_coord) {
|
---|
954 | glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
|
---|
955 | checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)");
|
---|
956 | context->fog_coord = TRUE;
|
---|
957 | }
|
---|
958 | } else {
|
---|
959 | /* Otherwise, use the fragment depth */
|
---|
960 | if(context->fog_coord) {
|
---|
961 | glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
|
---|
962 | checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)");
|
---|
963 | context->fog_coord = FALSE;
|
---|
964 | }
|
---|
965 | }
|
---|
966 | }
|
---|
967 |
|
---|
968 | void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
969 | {
|
---|
970 | float fogstart, fogend;
|
---|
971 | union {
|
---|
972 | DWORD d;
|
---|
973 | float f;
|
---|
974 | } tmpvalue;
|
---|
975 |
|
---|
976 | switch(context->fog_source) {
|
---|
977 | case FOGSOURCE_VS:
|
---|
978 | fogstart = 1.0f;
|
---|
979 | fogend = 0.0f;
|
---|
980 | break;
|
---|
981 |
|
---|
982 | case FOGSOURCE_COORD:
|
---|
983 | fogstart = 255.0f;
|
---|
984 | fogend = 0.0f;
|
---|
985 | break;
|
---|
986 |
|
---|
987 | case FOGSOURCE_FFP:
|
---|
988 | tmpvalue.d = stateblock->renderState[WINED3DRS_FOGSTART];
|
---|
989 | fogstart = tmpvalue.f;
|
---|
990 | tmpvalue.d = stateblock->renderState[WINED3DRS_FOGEND];
|
---|
991 | fogend = tmpvalue.f;
|
---|
992 | /* In GL, fogstart == fogend disables fog, in D3D everything's fogged.*/
|
---|
993 | if(fogstart == fogend) {
|
---|
994 | unsigned long fNegInf = 0xff800000;
|
---|
995 | fogstart = *(float*)(&fNegInf); /* -1.0/0.0 */
|
---|
996 | fogend = 0.0f;
|
---|
997 | }
|
---|
998 | break;
|
---|
999 |
|
---|
1000 | default:
|
---|
1001 | /* This should not happen.context->fog_source is set in wined3d, not the app.
|
---|
1002 | * Still this is needed to make the compiler happy
|
---|
1003 | */
|
---|
1004 | ERR("Unexpected fog coordinate source\n");
|
---|
1005 | fogstart = 0.0f;
|
---|
1006 | fogend = 0.0f;
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | glFogf(GL_FOG_START, fogstart);
|
---|
1010 | checkGLcall("glFogf(GL_FOG_START, fogstart)");
|
---|
1011 | TRACE("Fog Start == %f\n", fogstart);
|
---|
1012 |
|
---|
1013 | glFogf(GL_FOG_END, fogend);
|
---|
1014 | checkGLcall("glFogf(GL_FOG_END, fogend)");
|
---|
1015 | TRACE("Fog End == %f\n", fogend);
|
---|
1016 | }
|
---|
1017 |
|
---|
1018 | void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1019 | {
|
---|
1020 | enum fogsource new_source;
|
---|
1021 |
|
---|
1022 | TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
|
---|
1023 |
|
---|
1024 | if (!stateblock->renderState[WINED3DRS_FOGENABLE]) {
|
---|
1025 | /* No fog? Disable it, and we're done :-) */
|
---|
1026 | glDisableWINE(GL_FOG);
|
---|
1027 | checkGLcall("glDisable GL_FOG");
|
---|
1028 | return;
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 | /* Fog Rules:
|
---|
1032 | *
|
---|
1033 | * With fixed function vertex processing, Direct3D knows 2 different fog input sources.
|
---|
1034 | * It can use the Z value of the vertex, or the alpha component of the specular color.
|
---|
1035 | * This depends on the fog vertex, fog table and the vertex declaration. If the Z value
|
---|
1036 | * is used, fogstart, fogend and the equation type are used, otherwise linear fog with
|
---|
1037 | * start = 255, end = 0 is used. Obviously the msdn is not very clear on that.
|
---|
1038 | *
|
---|
1039 | * FOGTABLEMODE != NONE:
|
---|
1040 | * The Z value is used, with the equation specified, no matter what vertex type.
|
---|
1041 | *
|
---|
1042 | * FOGTABLEMODE == NONE, FOGVERTEXMODE != NONE, untransformed:
|
---|
1043 | * Per vertex fog is calculated using the specified fog equation and the parameters
|
---|
1044 | *
|
---|
1045 | * FOGTABLEMODE == NONE, FOGVERTEXMODE != NONE, transformed, OR
|
---|
1046 | * FOGTABLEMODE == NONE, FOGVERTEXMODE == NONE, untransformed:
|
---|
1047 | * Linear fog with start = 255.0, end = 0.0, input comes from the specular color
|
---|
1048 | *
|
---|
1049 | *
|
---|
1050 | * Rules for vertex fog with shaders:
|
---|
1051 | *
|
---|
1052 | * When mixing fixed function functionality with the programmable pipeline, D3D expects
|
---|
1053 | * the fog computation to happen during transformation while openGL expects it to happen
|
---|
1054 | * during rasterization. Also, prior to pixel shader 3.0 D3D handles fog blending after
|
---|
1055 | * the pixel shader while openGL always expects the pixel shader to handle the blending.
|
---|
1056 | * To solve this problem, WineD3D does:
|
---|
1057 | * 1) implement a linear fog equation and fog blending at the end of every pre 3.0 pixel
|
---|
1058 | * shader,
|
---|
1059 | * and 2) disables the fog computation (in either the fixed function or programmable
|
---|
1060 | * rasterizer) if using a vertex program.
|
---|
1061 | *
|
---|
1062 | * D3D shaders can provide an explicit fog coordinate. This fog coordinate is used with
|
---|
1063 | * D3DRS_FOGTABLEMODE==D3DFOG_NONE. The FOGVERTEXMODE is ignored, d3d always uses linear
|
---|
1064 | * fog with start=1.0 and end=0.0 in this case. This is similar to fog coordinates in
|
---|
1065 | * the specular color, a vertex shader counts as pretransformed geometry in this case.
|
---|
1066 | * There are some GL differences between specular fog coords and vertex shaders though.
|
---|
1067 | *
|
---|
1068 | * With table fog the vertex shader fog coordinate is ignored.
|
---|
1069 | *
|
---|
1070 | * If a fogtablemode and a fogvertexmode are specified, table fog is applied (with or
|
---|
1071 | * without shaders).
|
---|
1072 | */
|
---|
1073 |
|
---|
1074 | /* DX 7 sdk: "If both render states(vertex and table fog) are set to valid modes,
|
---|
1075 | * the system will apply only pixel(=table) fog effects."
|
---|
1076 | */
|
---|
1077 | if(stateblock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
|
---|
1078 | if(use_vs(stateblock)) {
|
---|
1079 | glFogi(GL_FOG_MODE, GL_LINEAR);
|
---|
1080 | checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
---|
1081 | new_source = FOGSOURCE_VS;
|
---|
1082 | } else {
|
---|
1083 | switch (stateblock->renderState[WINED3DRS_FOGVERTEXMODE]) {
|
---|
1084 | /* If processed vertices are used, fall through to the NONE case */
|
---|
1085 | case WINED3DFOG_EXP:
|
---|
1086 | if(!context->last_was_rhw) {
|
---|
1087 | glFogi(GL_FOG_MODE, GL_EXP);
|
---|
1088 | checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
|
---|
1089 | new_source = FOGSOURCE_FFP;
|
---|
1090 | break;
|
---|
1091 | }
|
---|
1092 | /* drop through */
|
---|
1093 |
|
---|
1094 | case WINED3DFOG_EXP2:
|
---|
1095 | if(!context->last_was_rhw) {
|
---|
1096 | glFogi(GL_FOG_MODE, GL_EXP2);
|
---|
1097 | checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
|
---|
1098 | new_source = FOGSOURCE_FFP;
|
---|
1099 | break;
|
---|
1100 | }
|
---|
1101 | /* drop through */
|
---|
1102 |
|
---|
1103 | case WINED3DFOG_LINEAR:
|
---|
1104 | if(!context->last_was_rhw) {
|
---|
1105 | glFogi(GL_FOG_MODE, GL_LINEAR);
|
---|
1106 | checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
---|
1107 | new_source = FOGSOURCE_FFP;
|
---|
1108 | break;
|
---|
1109 | }
|
---|
1110 | /* drop through */
|
---|
1111 |
|
---|
1112 | case WINED3DFOG_NONE:
|
---|
1113 | /* Both are none? According to msdn the alpha channel of the specular
|
---|
1114 | * color contains a fog factor. Set it in drawStridedSlow.
|
---|
1115 | * Same happens with Vertexfog on transformed vertices
|
---|
1116 | */
|
---|
1117 | new_source = FOGSOURCE_COORD;
|
---|
1118 | glFogi(GL_FOG_MODE, GL_LINEAR);
|
---|
1119 | checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
---|
1120 | break;
|
---|
1121 |
|
---|
1122 | default:
|
---|
1123 | FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock->renderState[WINED3DRS_FOGVERTEXMODE]);
|
---|
1124 | new_source = FOGSOURCE_FFP; /* Make the compiler happy */
|
---|
1125 | }
|
---|
1126 | }
|
---|
1127 | } else {
|
---|
1128 | new_source = FOGSOURCE_FFP;
|
---|
1129 |
|
---|
1130 | switch (stateblock->renderState[WINED3DRS_FOGTABLEMODE]) {
|
---|
1131 | case WINED3DFOG_EXP:
|
---|
1132 | glFogi(GL_FOG_MODE, GL_EXP);
|
---|
1133 | checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)");
|
---|
1134 | break;
|
---|
1135 |
|
---|
1136 | case WINED3DFOG_EXP2:
|
---|
1137 | glFogi(GL_FOG_MODE, GL_EXP2);
|
---|
1138 | checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)");
|
---|
1139 | break;
|
---|
1140 |
|
---|
1141 | case WINED3DFOG_LINEAR:
|
---|
1142 | glFogi(GL_FOG_MODE, GL_LINEAR);
|
---|
1143 | checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)");
|
---|
1144 | break;
|
---|
1145 |
|
---|
1146 | case WINED3DFOG_NONE: /* Won't happen */
|
---|
1147 | default:
|
---|
1148 | FIXME("Unexpected WINED3DRS_FOGTABLEMODE %d\n", stateblock->renderState[WINED3DRS_FOGTABLEMODE]);
|
---|
1149 | }
|
---|
1150 | }
|
---|
1151 |
|
---|
1152 | glEnableWINE(GL_FOG);
|
---|
1153 | checkGLcall("glEnable GL_FOG");
|
---|
1154 | if(new_source != context->fog_source) {
|
---|
1155 | context->fog_source = new_source;
|
---|
1156 | state_fogstartend(STATE_RENDER(WINED3DRS_FOGSTART), stateblock, context);
|
---|
1157 | }
|
---|
1158 | }
|
---|
1159 |
|
---|
1160 | static void state_rangefog_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1161 | {
|
---|
1162 | if(stateblock->renderState[WINED3DRS_RANGEFOGENABLE]) {
|
---|
1163 | WARN("Range fog enabled, but not supported by this opengl implementation\n");
|
---|
1164 | }
|
---|
1165 | }
|
---|
1166 |
|
---|
1167 | static void state_rangefog(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1168 | {
|
---|
1169 | if(stateblock->renderState[WINED3DRS_RANGEFOGENABLE]) {
|
---|
1170 | glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV);
|
---|
1171 | checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV)");
|
---|
1172 | } else {
|
---|
1173 | glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV);
|
---|
1174 | checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_PLANE_ABSOLUTE_NV)");
|
---|
1175 | }
|
---|
1176 | }
|
---|
1177 |
|
---|
1178 | void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1179 | {
|
---|
1180 | float col[4];
|
---|
1181 | D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_FOGCOLOR], col);
|
---|
1182 | glFogfv(GL_FOG_COLOR, &col[0]);
|
---|
1183 | checkGLcall("glFog GL_FOG_COLOR");
|
---|
1184 | }
|
---|
1185 |
|
---|
1186 | void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1187 | {
|
---|
1188 | union {
|
---|
1189 | DWORD d;
|
---|
1190 | float f;
|
---|
1191 | } tmpvalue;
|
---|
1192 | tmpvalue.d = stateblock->renderState[WINED3DRS_FOGDENSITY];
|
---|
1193 | glFogfv(GL_FOG_DENSITY, &tmpvalue.f);
|
---|
1194 | checkGLcall("glFogf(GL_FOG_DENSITY, (float) Value)");
|
---|
1195 | }
|
---|
1196 |
|
---|
1197 | static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1198 | {
|
---|
1199 | IWineD3DDeviceImpl *device = stateblock->device;
|
---|
1200 | GLenum Parm = 0;
|
---|
1201 |
|
---|
1202 | /* Depends on the decoded vertex declaration to read the existence of diffuse data.
|
---|
1203 | * The vertex declaration will call this function if the fixed function pipeline is used.
|
---|
1204 | */
|
---|
1205 |
|
---|
1206 | if(isStateDirty(context, STATE_VDECL)) {
|
---|
1207 | return;
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 | context->num_untracked_materials = 0;
|
---|
1211 | if ((device->strided_streams.use_map & (1 << WINED3D_FFP_DIFFUSE))
|
---|
1212 | && stateblock->renderState[WINED3DRS_COLORVERTEX])
|
---|
1213 | {
|
---|
1214 | TRACE("diff %d, amb %d, emis %d, spec %d\n",
|
---|
1215 | stateblock->renderState[WINED3DRS_DIFFUSEMATERIALSOURCE],
|
---|
1216 | stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE],
|
---|
1217 | stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE],
|
---|
1218 | stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE]);
|
---|
1219 |
|
---|
1220 | if (stateblock->renderState[WINED3DRS_DIFFUSEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1221 | if (stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1222 | Parm = GL_AMBIENT_AND_DIFFUSE;
|
---|
1223 | } else {
|
---|
1224 | Parm = GL_DIFFUSE;
|
---|
1225 | }
|
---|
1226 | if(stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1227 | context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
---|
1228 | context->num_untracked_materials++;
|
---|
1229 | }
|
---|
1230 | if(stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1231 | context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
---|
1232 | context->num_untracked_materials++;
|
---|
1233 | }
|
---|
1234 | } else if (stateblock->renderState[WINED3DRS_AMBIENTMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1235 | Parm = GL_AMBIENT;
|
---|
1236 | if(stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1237 | context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
---|
1238 | context->num_untracked_materials++;
|
---|
1239 | }
|
---|
1240 | if(stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1241 | context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
---|
1242 | context->num_untracked_materials++;
|
---|
1243 | }
|
---|
1244 | } else if (stateblock->renderState[WINED3DRS_EMISSIVEMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1245 | Parm = GL_EMISSION;
|
---|
1246 | if(stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1247 | context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
---|
1248 | context->num_untracked_materials++;
|
---|
1249 | }
|
---|
1250 | } else if (stateblock->renderState[WINED3DRS_SPECULARMATERIALSOURCE] == WINED3DMCS_COLOR1) {
|
---|
1251 | Parm = GL_SPECULAR;
|
---|
1252 | }
|
---|
1253 | }
|
---|
1254 |
|
---|
1255 | /* Nothing changed, return. */
|
---|
1256 | if (Parm == context->tracking_parm) return;
|
---|
1257 |
|
---|
1258 | if(!Parm) {
|
---|
1259 | glDisable(GL_COLOR_MATERIAL);
|
---|
1260 | checkGLcall("glDisable GL_COLOR_MATERIAL");
|
---|
1261 | } else {
|
---|
1262 | glColorMaterial(GL_FRONT_AND_BACK, Parm);
|
---|
1263 | checkGLcall("glColorMaterial(GL_FRONT_AND_BACK, Parm)");
|
---|
1264 | glEnable(GL_COLOR_MATERIAL);
|
---|
1265 | checkGLcall("glEnable(GL_COLOR_MATERIAL)");
|
---|
1266 | }
|
---|
1267 |
|
---|
1268 | /* Apparently calls to glMaterialfv are ignored for properties we're
|
---|
1269 | * tracking with glColorMaterial, so apply those here. */
|
---|
1270 | switch (context->tracking_parm) {
|
---|
1271 | case GL_AMBIENT_AND_DIFFUSE:
|
---|
1272 | glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*)&device->updateStateBlock->material.Ambient);
|
---|
1273 | glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*)&device->updateStateBlock->material.Diffuse);
|
---|
1274 | checkGLcall("glMaterialfv");
|
---|
1275 | break;
|
---|
1276 |
|
---|
1277 | case GL_DIFFUSE:
|
---|
1278 | glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*)&device->updateStateBlock->material.Diffuse);
|
---|
1279 | checkGLcall("glMaterialfv");
|
---|
1280 | break;
|
---|
1281 |
|
---|
1282 | case GL_AMBIENT:
|
---|
1283 | glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*)&device->updateStateBlock->material.Ambient);
|
---|
1284 | checkGLcall("glMaterialfv");
|
---|
1285 | break;
|
---|
1286 |
|
---|
1287 | case GL_EMISSION:
|
---|
1288 | glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*)&device->updateStateBlock->material.Emissive);
|
---|
1289 | checkGLcall("glMaterialfv");
|
---|
1290 | break;
|
---|
1291 |
|
---|
1292 | case GL_SPECULAR:
|
---|
1293 | /* Only change material color if specular is enabled, otherwise it is set to black */
|
---|
1294 | if (device->stateBlock->renderState[WINED3DRS_SPECULARENABLE]) {
|
---|
1295 | glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*)&device->updateStateBlock->material.Specular);
|
---|
1296 | checkGLcall("glMaterialfv");
|
---|
1297 | } else {
|
---|
1298 | static const GLfloat black[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
---|
1299 | glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
|
---|
1300 | checkGLcall("glMaterialfv");
|
---|
1301 | }
|
---|
1302 | break;
|
---|
1303 | }
|
---|
1304 |
|
---|
1305 | context->tracking_parm = Parm;
|
---|
1306 | }
|
---|
1307 |
|
---|
1308 | static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1309 | {
|
---|
1310 | union {
|
---|
1311 | DWORD d;
|
---|
1312 | WINED3DLINEPATTERN lp;
|
---|
1313 | } tmppattern;
|
---|
1314 | tmppattern.d = stateblock->renderState[WINED3DRS_LINEPATTERN];
|
---|
1315 |
|
---|
1316 | TRACE("Line pattern: repeat %d bits %x\n", tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
|
---|
1317 |
|
---|
1318 | if (tmppattern.lp.wRepeatFactor) {
|
---|
1319 | glLineStipple(tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
|
---|
1320 | checkGLcall("glLineStipple(repeat, linepattern)");
|
---|
1321 | glEnable(GL_LINE_STIPPLE);
|
---|
1322 | checkGLcall("glEnable(GL_LINE_STIPPLE);");
|
---|
1323 | } else {
|
---|
1324 | glDisable(GL_LINE_STIPPLE);
|
---|
1325 | checkGLcall("glDisable(GL_LINE_STIPPLE);");
|
---|
1326 | }
|
---|
1327 | }
|
---|
1328 |
|
---|
1329 | static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1330 | {
|
---|
1331 | union {
|
---|
1332 | DWORD d;
|
---|
1333 | float f;
|
---|
1334 | } tmpvalue;
|
---|
1335 |
|
---|
1336 | if (stateblock->renderState[WINED3DRS_ZBIAS]) {
|
---|
1337 | tmpvalue.d = stateblock->renderState[WINED3DRS_ZBIAS];
|
---|
1338 | TRACE("ZBias value %f\n", tmpvalue.f);
|
---|
1339 | glPolygonOffset(0, -tmpvalue.f);
|
---|
1340 | checkGLcall("glPolygonOffset(0, -Value)");
|
---|
1341 | glEnable(GL_POLYGON_OFFSET_FILL);
|
---|
1342 | checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL);");
|
---|
1343 | glEnable(GL_POLYGON_OFFSET_LINE);
|
---|
1344 | checkGLcall("glEnable(GL_POLYGON_OFFSET_LINE);");
|
---|
1345 | glEnable(GL_POLYGON_OFFSET_POINT);
|
---|
1346 | checkGLcall("glEnable(GL_POLYGON_OFFSET_POINT);");
|
---|
1347 | } else {
|
---|
1348 | glDisable(GL_POLYGON_OFFSET_FILL);
|
---|
1349 | checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL);");
|
---|
1350 | glDisable(GL_POLYGON_OFFSET_LINE);
|
---|
1351 | checkGLcall("glDisable(GL_POLYGON_OFFSET_LINE);");
|
---|
1352 | glDisable(GL_POLYGON_OFFSET_POINT);
|
---|
1353 | checkGLcall("glDisable(GL_POLYGON_OFFSET_POINT);");
|
---|
1354 | }
|
---|
1355 | }
|
---|
1356 |
|
---|
1357 |
|
---|
1358 | static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1359 | {
|
---|
1360 | if(isStateDirty(context, STATE_VDECL)) {
|
---|
1361 | return;
|
---|
1362 | }
|
---|
1363 | /* Without vertex normals, we set the current normal to 0/0/0 to remove the diffuse factor
|
---|
1364 | * from the opengl lighting equation, as d3d does. Normalization of 0/0/0 can lead to a division
|
---|
1365 | * by zero and is not properly defined in opengl, so avoid it
|
---|
1366 | */
|
---|
1367 | if (stateblock->renderState[WINED3DRS_NORMALIZENORMALS]
|
---|
1368 | && (stateblock->device->strided_streams.use_map & (1 << WINED3D_FFP_NORMAL)))
|
---|
1369 | {
|
---|
1370 | glEnable(GL_NORMALIZE);
|
---|
1371 | checkGLcall("glEnable(GL_NORMALIZE);");
|
---|
1372 | } else {
|
---|
1373 | glDisable(GL_NORMALIZE);
|
---|
1374 | checkGLcall("glDisable(GL_NORMALIZE);");
|
---|
1375 | }
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1379 | {
|
---|
1380 | union {
|
---|
1381 | DWORD d;
|
---|
1382 | float f;
|
---|
1383 | } tmpvalue;
|
---|
1384 |
|
---|
1385 | tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
|
---|
1386 | if (tmpvalue.f != 1.0f)
|
---|
1387 | {
|
---|
1388 | FIXME("WINED3DRS_POINTSIZE_MIN not supported on this opengl, value is %f\n", tmpvalue.f);
|
---|
1389 | }
|
---|
1390 | tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
|
---|
1391 | if (tmpvalue.f != 64.0f)
|
---|
1392 | {
|
---|
1393 | FIXME("WINED3DRS_POINTSIZE_MAX not supported on this opengl, value is %f\n", tmpvalue.f);
|
---|
1394 | }
|
---|
1395 |
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 | static void state_psizemin_ext(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1399 | {
|
---|
1400 | union {
|
---|
1401 | DWORD d;
|
---|
1402 | float f;
|
---|
1403 | } min, max;
|
---|
1404 |
|
---|
1405 | min.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
|
---|
1406 | max.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
|
---|
1407 |
|
---|
1408 | /* Max point size trumps min point size */
|
---|
1409 | if(min.f > max.f) {
|
---|
1410 | min.f = max.f;
|
---|
1411 | }
|
---|
1412 |
|
---|
1413 | GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MIN_EXT, min.f);
|
---|
1414 | checkGLcall("glPointParameterfEXT(...)");
|
---|
1415 | GL_EXTCALL(glPointParameterfEXT)(GL_POINT_SIZE_MAX_EXT, max.f);
|
---|
1416 | checkGLcall("glPointParameterfEXT(...)");
|
---|
1417 | }
|
---|
1418 |
|
---|
1419 | static void state_psizemin_arb(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1420 | {
|
---|
1421 | union {
|
---|
1422 | DWORD d;
|
---|
1423 | float f;
|
---|
1424 | } min, max;
|
---|
1425 |
|
---|
1426 | min.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
|
---|
1427 | max.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
|
---|
1428 |
|
---|
1429 | /* Max point size trumps min point size */
|
---|
1430 | if(min.f > max.f) {
|
---|
1431 | min.f = max.f;
|
---|
1432 | }
|
---|
1433 |
|
---|
1434 | GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MIN_ARB, min.f);
|
---|
1435 | checkGLcall("glPointParameterfARB(...)");
|
---|
1436 | GL_EXTCALL(glPointParameterfARB)(GL_POINT_SIZE_MAX_ARB, max.f);
|
---|
1437 | checkGLcall("glPointParameterfARB(...)");
|
---|
1438 | }
|
---|
1439 |
|
---|
1440 | static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1441 | {
|
---|
1442 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
1443 | /* TODO: Group this with the viewport */
|
---|
1444 | /*
|
---|
1445 | * POINTSCALEENABLE controls how point size value is treated. If set to
|
---|
1446 | * true, the point size is scaled with respect to height of viewport.
|
---|
1447 | * When set to false point size is in pixels.
|
---|
1448 | */
|
---|
1449 |
|
---|
1450 | /* Default values */
|
---|
1451 | GLfloat att[3] = {1.0f, 0.0f, 0.0f};
|
---|
1452 | union {
|
---|
1453 | DWORD d;
|
---|
1454 | float f;
|
---|
1455 | } pointSize, A, B, C;
|
---|
1456 |
|
---|
1457 | pointSize.d = stateblock->renderState[WINED3DRS_POINTSIZE];
|
---|
1458 | A.d = stateblock->renderState[WINED3DRS_POINTSCALE_A];
|
---|
1459 | B.d = stateblock->renderState[WINED3DRS_POINTSCALE_B];
|
---|
1460 | C.d = stateblock->renderState[WINED3DRS_POINTSCALE_C];
|
---|
1461 |
|
---|
1462 | if(stateblock->renderState[WINED3DRS_POINTSCALEENABLE]) {
|
---|
1463 | GLfloat scaleFactor;
|
---|
1464 | float h = stateblock->viewport.Height;
|
---|
1465 |
|
---|
1466 | if (pointSize.f < gl_info->limits.pointsize_min)
|
---|
1467 | {
|
---|
1468 | /* Minimum valid point size for OpenGL is driver specific. For Direct3D it is
|
---|
1469 | * 0.0f. This means that OpenGL will clamp really small point sizes to the
|
---|
1470 | * driver minimum. To correct for this we need to multiply by the scale factor when sizes
|
---|
1471 | * are less than 1.0f. scale_factor = 1.0f / point_size.
|
---|
1472 | */
|
---|
1473 | scaleFactor = pointSize.f / gl_info->limits.pointsize_min;
|
---|
1474 | /* Clamp the point size, don't rely on the driver to do it. MacOS says min point size
|
---|
1475 | * is 1.0, but then accepts points below that and draws too small points
|
---|
1476 | */
|
---|
1477 | pointSize.f = gl_info->limits.pointsize_min;
|
---|
1478 | }
|
---|
1479 | else if(pointSize.f > gl_info->limits.pointsize_max)
|
---|
1480 | {
|
---|
1481 | /* gl already scales the input to glPointSize,
|
---|
1482 | * d3d scales the result after the point size scale.
|
---|
1483 | * If the point size is bigger than the max size, use the
|
---|
1484 | * scaling to scale it bigger, and set the gl point size to max
|
---|
1485 | */
|
---|
1486 | scaleFactor = pointSize.f / gl_info->limits.pointsize_max;
|
---|
1487 | TRACE("scale: %f\n", scaleFactor);
|
---|
1488 | pointSize.f = gl_info->limits.pointsize_max;
|
---|
1489 | } else {
|
---|
1490 | scaleFactor = 1.0f;
|
---|
1491 | }
|
---|
1492 | scaleFactor = pow(h * scaleFactor, 2);
|
---|
1493 |
|
---|
1494 | att[0] = A.f / scaleFactor;
|
---|
1495 | att[1] = B.f / scaleFactor;
|
---|
1496 | att[2] = C.f / scaleFactor;
|
---|
1497 | }
|
---|
1498 |
|
---|
1499 | if (gl_info->supported[ARB_POINT_PARAMETERS])
|
---|
1500 | {
|
---|
1501 | GL_EXTCALL(glPointParameterfvARB)(GL_POINT_DISTANCE_ATTENUATION_ARB, att);
|
---|
1502 | checkGLcall("glPointParameterfvARB(GL_DISTANCE_ATTENUATION_ARB, ...)");
|
---|
1503 | }
|
---|
1504 | else if (gl_info->supported[EXT_POINT_PARAMETERS])
|
---|
1505 | {
|
---|
1506 | GL_EXTCALL(glPointParameterfvEXT)(GL_DISTANCE_ATTENUATION_EXT, att);
|
---|
1507 | checkGLcall("glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, ...)");
|
---|
1508 | } else if(stateblock->renderState[WINED3DRS_POINTSCALEENABLE]) {
|
---|
1509 | WARN("POINT_PARAMETERS not supported in this version of opengl\n");
|
---|
1510 | }
|
---|
1511 |
|
---|
1512 | glPointSize(pointSize.f);
|
---|
1513 | checkGLcall("glPointSize(...);");
|
---|
1514 | }
|
---|
1515 |
|
---|
1516 | static void state_debug_monitor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1517 | {
|
---|
1518 | WARN("token: %#x\n", stateblock->renderState[WINED3DRS_DEBUGMONITORTOKEN]);
|
---|
1519 | }
|
---|
1520 |
|
---|
1521 | static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1522 | {
|
---|
1523 | DWORD mask0 = stateblock->renderState[WINED3DRS_COLORWRITEENABLE];
|
---|
1524 | DWORD mask1 = stateblock->renderState[WINED3DRS_COLORWRITEENABLE1];
|
---|
1525 | DWORD mask2 = stateblock->renderState[WINED3DRS_COLORWRITEENABLE2];
|
---|
1526 | DWORD mask3 = stateblock->renderState[WINED3DRS_COLORWRITEENABLE3];
|
---|
1527 |
|
---|
1528 | TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
|
---|
1529 | mask0 & WINED3DCOLORWRITEENABLE_RED ? 1 : 0,
|
---|
1530 | mask0 & WINED3DCOLORWRITEENABLE_GREEN ? 1 : 0,
|
---|
1531 | mask0 & WINED3DCOLORWRITEENABLE_BLUE ? 1 : 0,
|
---|
1532 | mask0 & WINED3DCOLORWRITEENABLE_ALPHA ? 1 : 0);
|
---|
1533 | glColorMask(mask0 & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
|
---|
1534 | mask0 & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
|
---|
1535 | mask0 & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
---|
1536 | mask0 & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
|
---|
1537 | checkGLcall("glColorMask(...)");
|
---|
1538 |
|
---|
1539 | if (!((mask1 == mask0 && mask2 == mask0 && mask3 == mask0)
|
---|
1540 | || (mask1 == 0xf && mask2 == 0xf && mask3 == 0xf)))
|
---|
1541 | {
|
---|
1542 | FIXME("WINED3DRS_COLORWRITEENABLE/1/2/3, %#x/%#x/%#x/%#x not yet implemented.\n",
|
---|
1543 | mask0, mask1, mask2, mask3);
|
---|
1544 | FIXME("Missing of cap D3DPMISCCAPS_INDEPENDENTWRITEMASKS wasn't honored?\n");
|
---|
1545 | }
|
---|
1546 | }
|
---|
1547 |
|
---|
1548 | static void set_color_mask(struct wined3d_context *context, UINT index, DWORD mask)
|
---|
1549 | {
|
---|
1550 | GL_EXTCALL(glColorMaskIndexedEXT(index,
|
---|
1551 | mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
|
---|
1552 | mask & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
|
---|
1553 | mask & WINED3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
---|
1554 | mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE));
|
---|
1555 | }
|
---|
1556 |
|
---|
1557 | static void state_colorwrite0(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1558 | {
|
---|
1559 | set_color_mask(context, 0, stateblock->renderState[WINED3DRS_COLORWRITEENABLE]);
|
---|
1560 | }
|
---|
1561 |
|
---|
1562 | static void state_colorwrite1(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1563 | {
|
---|
1564 | set_color_mask(context, 1, stateblock->renderState[WINED3DRS_COLORWRITEENABLE1]);
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | static void state_colorwrite2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1568 | {
|
---|
1569 | set_color_mask(context, 2, stateblock->renderState[WINED3DRS_COLORWRITEENABLE2]);
|
---|
1570 | }
|
---|
1571 |
|
---|
1572 | static void state_colorwrite3(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1573 | {
|
---|
1574 | set_color_mask(context, 3, stateblock->renderState[WINED3DRS_COLORWRITEENABLE3]);
|
---|
1575 | }
|
---|
1576 |
|
---|
1577 | static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1578 | {
|
---|
1579 | if(stateblock->renderState[WINED3DRS_LOCALVIEWER]) {
|
---|
1580 | glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
|
---|
1581 | checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1)");
|
---|
1582 | } else {
|
---|
1583 | glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
|
---|
1584 | checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 0)");
|
---|
1585 | }
|
---|
1586 | }
|
---|
1587 |
|
---|
1588 | static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1589 | {
|
---|
1590 | if(stateblock->renderState[WINED3DRS_LASTPIXEL]) {
|
---|
1591 | TRACE("Last Pixel Drawing Enabled\n");
|
---|
1592 | } else {
|
---|
1593 | static BOOL warned;
|
---|
1594 | if (!warned) {
|
---|
1595 | FIXME("Last Pixel Drawing Disabled, not handled yet\n");
|
---|
1596 | warned = TRUE;
|
---|
1597 | } else {
|
---|
1598 | TRACE("Last Pixel Drawing Disabled, not handled yet\n");
|
---|
1599 | }
|
---|
1600 | }
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 | static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1604 | {
|
---|
1605 | static BOOL warned;
|
---|
1606 |
|
---|
1607 | /* TODO: NV_POINT_SPRITE */
|
---|
1608 | if (!warned && stateblock->renderState[WINED3DRS_POINTSPRITEENABLE]) {
|
---|
1609 | /* A FIXME, not a WARN because point sprites should be software emulated if not supported by HW */
|
---|
1610 | FIXME("Point sprites not supported\n");
|
---|
1611 | warned = TRUE;
|
---|
1612 | }
|
---|
1613 | }
|
---|
1614 |
|
---|
1615 | static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1616 | {
|
---|
1617 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
1618 |
|
---|
1619 | if (stateblock->renderState[WINED3DRS_POINTSPRITEENABLE])
|
---|
1620 | {
|
---|
1621 | static BOOL warned;
|
---|
1622 |
|
---|
1623 | if (gl_info->limits.point_sprite_units < gl_info->limits.textures && !warned)
|
---|
1624 | {
|
---|
1625 | if (use_ps(stateblock) || stateblock->lowest_disabled_stage > gl_info->limits.point_sprite_units)
|
---|
1626 | {
|
---|
1627 | FIXME("The app uses point sprite texture coordinates on more units than supported by the driver\n");
|
---|
1628 | warned = TRUE;
|
---|
1629 | }
|
---|
1630 | }
|
---|
1631 |
|
---|
1632 | glEnable(GL_POINT_SPRITE_ARB);
|
---|
1633 | checkGLcall("glEnable(GL_POINT_SPRITE_ARB)");
|
---|
1634 | } else {
|
---|
1635 | glDisable(GL_POINT_SPRITE_ARB);
|
---|
1636 | checkGLcall("glDisable(GL_POINT_SPRITE_ARB)");
|
---|
1637 | }
|
---|
1638 | }
|
---|
1639 |
|
---|
1640 | static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1641 | {
|
---|
1642 | /**
|
---|
1643 | http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/texture/
|
---|
1644 | http://www.gamedev.net/reference/programming/features/rendererdll3/page2.asp
|
---|
1645 | Discussion on the ways to turn on WRAPing to solve an OpenGL conversion problem.
|
---|
1646 | http://www.flipcode.org/cgi-bin/fcmsg.cgi?thread_show=10248
|
---|
1647 |
|
---|
1648 | so far as I can tell, wrapping and texture-coordinate generate go hand in hand,
|
---|
1649 | */
|
---|
1650 | TRACE("Stub\n");
|
---|
1651 | if(stateblock->renderState[WINED3DRS_WRAP0] ||
|
---|
1652 | stateblock->renderState[WINED3DRS_WRAP1] ||
|
---|
1653 | stateblock->renderState[WINED3DRS_WRAP2] ||
|
---|
1654 | stateblock->renderState[WINED3DRS_WRAP3] ||
|
---|
1655 | stateblock->renderState[WINED3DRS_WRAP4] ||
|
---|
1656 | stateblock->renderState[WINED3DRS_WRAP5] ||
|
---|
1657 | stateblock->renderState[WINED3DRS_WRAP6] ||
|
---|
1658 | stateblock->renderState[WINED3DRS_WRAP7] ||
|
---|
1659 | stateblock->renderState[WINED3DRS_WRAP8] ||
|
---|
1660 | stateblock->renderState[WINED3DRS_WRAP9] ||
|
---|
1661 | stateblock->renderState[WINED3DRS_WRAP10] ||
|
---|
1662 | stateblock->renderState[WINED3DRS_WRAP11] ||
|
---|
1663 | stateblock->renderState[WINED3DRS_WRAP12] ||
|
---|
1664 | stateblock->renderState[WINED3DRS_WRAP13] ||
|
---|
1665 | stateblock->renderState[WINED3DRS_WRAP14] ||
|
---|
1666 | stateblock->renderState[WINED3DRS_WRAP15] ) {
|
---|
1667 | FIXME("(WINED3DRS_WRAP0) Texture wrapping not yet supported\n");
|
---|
1668 | }
|
---|
1669 | }
|
---|
1670 |
|
---|
1671 | static void state_msaa_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1672 | {
|
---|
1673 | if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
|
---|
1674 | WARN("Multisample antialiasing not supported by gl\n");
|
---|
1675 | }
|
---|
1676 | }
|
---|
1677 |
|
---|
1678 | static void state_msaa(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1679 | {
|
---|
1680 | if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
|
---|
1681 | glEnable(GL_MULTISAMPLE_ARB);
|
---|
1682 | checkGLcall("glEnable(GL_MULTISAMPLE_ARB)");
|
---|
1683 | } else {
|
---|
1684 | glDisable(GL_MULTISAMPLE_ARB);
|
---|
1685 | checkGLcall("glDisable(GL_MULTISAMPLE_ARB)");
|
---|
1686 | }
|
---|
1687 | }
|
---|
1688 |
|
---|
1689 | static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1690 | {
|
---|
1691 | if(stateblock->renderState[WINED3DRS_SCISSORTESTENABLE]) {
|
---|
1692 | glEnable(GL_SCISSOR_TEST);
|
---|
1693 | checkGLcall("glEnable(GL_SCISSOR_TEST)");
|
---|
1694 | } else {
|
---|
1695 | glDisable(GL_SCISSOR_TEST);
|
---|
1696 | checkGLcall("glDisable(GL_SCISSOR_TEST)");
|
---|
1697 | }
|
---|
1698 | }
|
---|
1699 |
|
---|
1700 | /* The Direct3D depth bias is specified in normalized depth coordinates. In
|
---|
1701 | * OpenGL the bias is specified in units of "the smallest value that is
|
---|
1702 | * guaranteed to produce a resolvable offset for a given implementation". To
|
---|
1703 | * convert from D3D to GL we need to divide the D3D depth bias by that value.
|
---|
1704 | * There's no practical way to retrieve that value from a given GL
|
---|
1705 | * implementation, but the D3D application has essentially the same problem,
|
---|
1706 | * which makes a guess of 1e-6f seem reasonable here. Note that
|
---|
1707 | * SLOPESCALEDEPTHBIAS is a scaling factor for the depth slope, and doesn't
|
---|
1708 | * need to be scaled. */
|
---|
1709 | static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1710 | {
|
---|
1711 | if (stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS]
|
---|
1712 | || stateblock->renderState[WINED3DRS_DEPTHBIAS])
|
---|
1713 | {
|
---|
1714 | union
|
---|
1715 | {
|
---|
1716 | DWORD d;
|
---|
1717 | float f;
|
---|
1718 | } scale_bias, const_bias;
|
---|
1719 |
|
---|
1720 | scale_bias.d = stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS];
|
---|
1721 | const_bias.d = stateblock->renderState[WINED3DRS_DEPTHBIAS];
|
---|
1722 |
|
---|
1723 | glEnable(GL_POLYGON_OFFSET_FILL);
|
---|
1724 | checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
|
---|
1725 |
|
---|
1726 | glPolygonOffset(scale_bias.f, const_bias.f * 1e6f);
|
---|
1727 | checkGLcall("glPolygonOffset(...)");
|
---|
1728 | } else {
|
---|
1729 | glDisable(GL_POLYGON_OFFSET_FILL);
|
---|
1730 | checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
|
---|
1731 | }
|
---|
1732 | }
|
---|
1733 |
|
---|
1734 | static void state_zvisible(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1735 | {
|
---|
1736 | if (stateblock->renderState[WINED3DRS_ZVISIBLE])
|
---|
1737 | FIXME("WINED3DRS_ZVISIBLE not implemented.\n");
|
---|
1738 | }
|
---|
1739 |
|
---|
1740 | static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1741 | {
|
---|
1742 | if (stateblock->renderState[WINED3DRS_TEXTUREPERSPECTIVE]) {
|
---|
1743 | glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
---|
1744 | checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)");
|
---|
1745 | } else {
|
---|
1746 | glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
---|
1747 | checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)");
|
---|
1748 | }
|
---|
1749 | }
|
---|
1750 |
|
---|
1751 | static void state_stippledalpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1752 | {
|
---|
1753 | TRACE("Stub\n");
|
---|
1754 | if (stateblock->renderState[WINED3DRS_STIPPLEDALPHA])
|
---|
1755 | FIXME(" Stippled Alpha not supported yet.\n");
|
---|
1756 | }
|
---|
1757 |
|
---|
1758 | static void state_antialias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1759 | {
|
---|
1760 | TRACE("Stub\n");
|
---|
1761 | if (stateblock->renderState[WINED3DRS_ANTIALIAS])
|
---|
1762 | FIXME(" Antialias not supported yet.\n");
|
---|
1763 | }
|
---|
1764 |
|
---|
1765 | static void state_multisampmask(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1766 | {
|
---|
1767 | TRACE("Stub\n");
|
---|
1768 | if (stateblock->renderState[WINED3DRS_MULTISAMPLEMASK] != 0xFFFFFFFF)
|
---|
1769 | FIXME("(WINED3DRS_MULTISAMPLEMASK,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_MULTISAMPLEMASK]);
|
---|
1770 | }
|
---|
1771 |
|
---|
1772 | static void state_patchedgestyle(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1773 | {
|
---|
1774 | TRACE("Stub\n");
|
---|
1775 | if (stateblock->renderState[WINED3DRS_PATCHEDGESTYLE] != WINED3DPATCHEDGE_DISCRETE)
|
---|
1776 | FIXME("(WINED3DRS_PATCHEDGESTYLE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_PATCHEDGESTYLE]);
|
---|
1777 | }
|
---|
1778 |
|
---|
1779 | static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1780 | {
|
---|
1781 | union {
|
---|
1782 | DWORD d;
|
---|
1783 | float f;
|
---|
1784 | } tmpvalue;
|
---|
1785 | tmpvalue.f = 1.0f;
|
---|
1786 |
|
---|
1787 | TRACE("Stub\n");
|
---|
1788 | if (stateblock->renderState[WINED3DRS_PATCHSEGMENTS] != tmpvalue.d)
|
---|
1789 | {
|
---|
1790 | static BOOL displayed = FALSE;
|
---|
1791 |
|
---|
1792 | tmpvalue.d = stateblock->renderState[WINED3DRS_PATCHSEGMENTS];
|
---|
1793 | if(!displayed)
|
---|
1794 | FIXME("(WINED3DRS_PATCHSEGMENTS,%f) not yet implemented\n", tmpvalue.f);
|
---|
1795 |
|
---|
1796 | displayed = TRUE;
|
---|
1797 | }
|
---|
1798 | }
|
---|
1799 |
|
---|
1800 | static void state_positiondegree(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1801 | {
|
---|
1802 | TRACE("Stub\n");
|
---|
1803 | if (stateblock->renderState[WINED3DRS_POSITIONDEGREE] != WINED3DDEGREE_CUBIC)
|
---|
1804 | FIXME("(WINED3DRS_POSITIONDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_POSITIONDEGREE]);
|
---|
1805 | }
|
---|
1806 |
|
---|
1807 | static void state_normaldegree(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1808 | {
|
---|
1809 | TRACE("Stub\n");
|
---|
1810 | if (stateblock->renderState[WINED3DRS_NORMALDEGREE] != WINED3DDEGREE_LINEAR)
|
---|
1811 | FIXME("(WINED3DRS_NORMALDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_NORMALDEGREE]);
|
---|
1812 | }
|
---|
1813 |
|
---|
1814 | static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1815 | {
|
---|
1816 | TRACE("Stub\n");
|
---|
1817 | if(stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION])
|
---|
1818 | FIXME("(WINED3DRS_ENABLEADAPTIVETESSELLATION,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION]);
|
---|
1819 | }
|
---|
1820 |
|
---|
1821 | static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1822 | {
|
---|
1823 | if(stateblock->renderState[WINED3DRS_WRAPU]) {
|
---|
1824 | FIXME("Render state WINED3DRS_WRAPU not implemented yet\n");
|
---|
1825 | }
|
---|
1826 | }
|
---|
1827 |
|
---|
1828 | static void state_wrapv(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1829 | {
|
---|
1830 | if(stateblock->renderState[WINED3DRS_WRAPV]) {
|
---|
1831 | FIXME("Render state WINED3DRS_WRAPV not implemented yet\n");
|
---|
1832 | }
|
---|
1833 | }
|
---|
1834 |
|
---|
1835 | static void state_monoenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1836 | {
|
---|
1837 | if(stateblock->renderState[WINED3DRS_MONOENABLE]) {
|
---|
1838 | FIXME("Render state WINED3DRS_MONOENABLE not implemented yet\n");
|
---|
1839 | }
|
---|
1840 | }
|
---|
1841 |
|
---|
1842 | static void state_rop2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1843 | {
|
---|
1844 | if(stateblock->renderState[WINED3DRS_ROP2]) {
|
---|
1845 | FIXME("Render state WINED3DRS_ROP2 not implemented yet\n");
|
---|
1846 | }
|
---|
1847 | }
|
---|
1848 |
|
---|
1849 | static void state_planemask(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1850 | {
|
---|
1851 | if(stateblock->renderState[WINED3DRS_PLANEMASK]) {
|
---|
1852 | FIXME("Render state WINED3DRS_PLANEMASK not implemented yet\n");
|
---|
1853 | }
|
---|
1854 | }
|
---|
1855 |
|
---|
1856 | static void state_subpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1857 | {
|
---|
1858 | if(stateblock->renderState[WINED3DRS_SUBPIXEL]) {
|
---|
1859 | FIXME("Render state WINED3DRS_SUBPIXEL not implemented yet\n");
|
---|
1860 | }
|
---|
1861 | }
|
---|
1862 |
|
---|
1863 | static void state_subpixelx(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1864 | {
|
---|
1865 | if(stateblock->renderState[WINED3DRS_SUBPIXELX]) {
|
---|
1866 | FIXME("Render state WINED3DRS_SUBPIXELX not implemented yet\n");
|
---|
1867 | }
|
---|
1868 | }
|
---|
1869 |
|
---|
1870 | static void state_stippleenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1871 | {
|
---|
1872 | if(stateblock->renderState[WINED3DRS_STIPPLEENABLE]) {
|
---|
1873 | FIXME("Render state WINED3DRS_STIPPLEENABLE not implemented yet\n");
|
---|
1874 | }
|
---|
1875 | }
|
---|
1876 |
|
---|
1877 | static void state_mipmaplodbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1878 | {
|
---|
1879 | if(stateblock->renderState[WINED3DRS_MIPMAPLODBIAS]) {
|
---|
1880 | FIXME("Render state WINED3DRS_MIPMAPLODBIAS not implemented yet\n");
|
---|
1881 | }
|
---|
1882 | }
|
---|
1883 |
|
---|
1884 | static void state_anisotropy(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1885 | {
|
---|
1886 | if(stateblock->renderState[WINED3DRS_ANISOTROPY]) {
|
---|
1887 | FIXME("Render state WINED3DRS_ANISOTROPY not implemented yet\n");
|
---|
1888 | }
|
---|
1889 | }
|
---|
1890 |
|
---|
1891 | static void state_flushbatch(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1892 | {
|
---|
1893 | if(stateblock->renderState[WINED3DRS_FLUSHBATCH]) {
|
---|
1894 | FIXME("Render state WINED3DRS_FLUSHBATCH not implemented yet\n");
|
---|
1895 | }
|
---|
1896 | }
|
---|
1897 |
|
---|
1898 | static void state_translucentsi(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1899 | {
|
---|
1900 | if(stateblock->renderState[WINED3DRS_TRANSLUCENTSORTINDEPENDENT]) {
|
---|
1901 | FIXME("Render state WINED3DRS_TRANSLUCENTSORTINDEPENDENT not implemented yet\n");
|
---|
1902 | }
|
---|
1903 | }
|
---|
1904 |
|
---|
1905 | static void state_extents(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1906 | {
|
---|
1907 | if(stateblock->renderState[WINED3DRS_EXTENTS]) {
|
---|
1908 | FIXME("Render state WINED3DRS_EXTENTS not implemented yet\n");
|
---|
1909 | }
|
---|
1910 | }
|
---|
1911 |
|
---|
1912 | static void state_ckeyblend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1913 | {
|
---|
1914 | if(stateblock->renderState[WINED3DRS_COLORKEYBLENDENABLE]) {
|
---|
1915 | FIXME("Render state WINED3DRS_COLORKEYBLENDENABLE not implemented yet\n");
|
---|
1916 | }
|
---|
1917 | }
|
---|
1918 |
|
---|
1919 | static void state_swvp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
1920 | {
|
---|
1921 | if (stateblock->renderState[WINED3DRS_SOFTWAREVERTEXPROCESSING])
|
---|
1922 | {
|
---|
1923 | FIXME("Software vertex processing not implemented.\n");
|
---|
1924 | }
|
---|
1925 | }
|
---|
1926 |
|
---|
1927 | /* Set texture operations up - The following avoids lots of ifdefs in this routine!*/
|
---|
1928 | #if defined (GL_VERSION_1_3)
|
---|
1929 | # define useext(A) A
|
---|
1930 | #elif defined (GL_EXT_texture_env_combine)
|
---|
1931 | # define useext(A) A##_EXT
|
---|
1932 | #elif defined (GL_ARB_texture_env_combine)
|
---|
1933 | # define useext(A) A##_ARB
|
---|
1934 | #endif
|
---|
1935 |
|
---|
1936 | static void get_src_and_opr(DWORD arg, BOOL is_alpha, GLenum* source, GLenum* operand) {
|
---|
1937 | /* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the
|
---|
1938 | * input should be used for all input components. The WINED3DTA_COMPLEMENT
|
---|
1939 | * flag specifies the complement of the input should be used. */
|
---|
1940 | BOOL from_alpha = is_alpha || arg & WINED3DTA_ALPHAREPLICATE;
|
---|
1941 | BOOL complement = arg & WINED3DTA_COMPLEMENT;
|
---|
1942 |
|
---|
1943 | /* Calculate the operand */
|
---|
1944 | if (complement) {
|
---|
1945 | if (from_alpha) *operand = GL_ONE_MINUS_SRC_ALPHA;
|
---|
1946 | else *operand = GL_ONE_MINUS_SRC_COLOR;
|
---|
1947 | } else {
|
---|
1948 | if (from_alpha) *operand = GL_SRC_ALPHA;
|
---|
1949 | else *operand = GL_SRC_COLOR;
|
---|
1950 | }
|
---|
1951 |
|
---|
1952 | /* Calculate the source */
|
---|
1953 | switch (arg & WINED3DTA_SELECTMASK) {
|
---|
1954 | case WINED3DTA_CURRENT: *source = GL_PREVIOUS_EXT; break;
|
---|
1955 | case WINED3DTA_DIFFUSE: *source = GL_PRIMARY_COLOR_EXT; break;
|
---|
1956 | case WINED3DTA_TEXTURE: *source = GL_TEXTURE; break;
|
---|
1957 | case WINED3DTA_TFACTOR: *source = GL_CONSTANT_EXT; break;
|
---|
1958 | case WINED3DTA_SPECULAR:
|
---|
1959 | /*
|
---|
1960 | * According to the GL_ARB_texture_env_combine specs, SPECULAR is
|
---|
1961 | * 'Secondary color' and isn't supported until base GL supports it
|
---|
1962 | * There is no concept of temp registers as far as I can tell
|
---|
1963 | */
|
---|
1964 | FIXME("Unhandled texture arg WINED3DTA_SPECULAR\n");
|
---|
1965 | *source = GL_TEXTURE;
|
---|
1966 | break;
|
---|
1967 | default:
|
---|
1968 | FIXME("Unrecognized texture arg %#x\n", arg);
|
---|
1969 | *source = GL_TEXTURE;
|
---|
1970 | break;
|
---|
1971 | }
|
---|
1972 | }
|
---|
1973 |
|
---|
1974 | /* Setup the texture operations texture stage states */
|
---|
1975 | static void set_tex_op(const struct wined3d_context *context, IWineD3DDevice *iface,
|
---|
1976 | BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3)
|
---|
1977 | {
|
---|
1978 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
1979 | GLenum src1, src2, src3;
|
---|
1980 | GLenum opr1, opr2, opr3;
|
---|
1981 | GLenum comb_target;
|
---|
1982 | GLenum src0_target, src1_target, src2_target;
|
---|
1983 | GLenum opr0_target, opr1_target, opr2_target;
|
---|
1984 | GLenum scal_target;
|
---|
1985 | GLenum opr=0, invopr, src3_target, opr3_target;
|
---|
1986 | BOOL Handled = FALSE;
|
---|
1987 | IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
---|
1988 |
|
---|
1989 | TRACE("Alpha?(%d), Stage:%d Op(%s), a1(%d), a2(%d), a3(%d)\n", isAlpha, Stage, debug_d3dtop(op), arg1, arg2, arg3);
|
---|
1990 |
|
---|
1991 | /* This is called by a state handler which has the gl lock held and a context for the thread */
|
---|
1992 |
|
---|
1993 | /* Note: Operations usually involve two ars, src0 and src1 and are operations of
|
---|
1994 | the form (a1 <operation> a2). However, some of the more complex operations
|
---|
1995 | take 3 parameters. Instead of the (sensible) addition of a3, Microsoft added
|
---|
1996 | in a third parameter called a0. Therefore these are operations of the form
|
---|
1997 | a0 <operation> a1 <operation> a2, i.e., the new parameter goes to the front.
|
---|
1998 |
|
---|
1999 | However, below we treat the new (a0) parameter as src2/opr2, so in the actual
|
---|
2000 | functions below, expect their syntax to differ slightly to those listed in the
|
---|
2001 | manuals, i.e., replace arg1 with arg3, arg2 with arg1 and arg3 with arg2
|
---|
2002 | This affects WINED3DTOP_MULTIPLYADD and WINED3DTOP_LERP */
|
---|
2003 |
|
---|
2004 | if (isAlpha) {
|
---|
2005 | comb_target = useext(GL_COMBINE_ALPHA);
|
---|
2006 | src0_target = useext(GL_SOURCE0_ALPHA);
|
---|
2007 | src1_target = useext(GL_SOURCE1_ALPHA);
|
---|
2008 | src2_target = useext(GL_SOURCE2_ALPHA);
|
---|
2009 | opr0_target = useext(GL_OPERAND0_ALPHA);
|
---|
2010 | opr1_target = useext(GL_OPERAND1_ALPHA);
|
---|
2011 | opr2_target = useext(GL_OPERAND2_ALPHA);
|
---|
2012 | scal_target = GL_ALPHA_SCALE;
|
---|
2013 | }
|
---|
2014 | else {
|
---|
2015 | comb_target = useext(GL_COMBINE_RGB);
|
---|
2016 | src0_target = useext(GL_SOURCE0_RGB);
|
---|
2017 | src1_target = useext(GL_SOURCE1_RGB);
|
---|
2018 | src2_target = useext(GL_SOURCE2_RGB);
|
---|
2019 | opr0_target = useext(GL_OPERAND0_RGB);
|
---|
2020 | opr1_target = useext(GL_OPERAND1_RGB);
|
---|
2021 | opr2_target = useext(GL_OPERAND2_RGB);
|
---|
2022 | scal_target = useext(GL_RGB_SCALE);
|
---|
2023 | }
|
---|
2024 |
|
---|
2025 | /* If a texture stage references an invalid texture unit the stage just
|
---|
2026 | * passes through the result from the previous stage */
|
---|
2027 | if (is_invalid_op(This, Stage, op, arg1, arg2, arg3)) {
|
---|
2028 | arg1 = WINED3DTA_CURRENT;
|
---|
2029 | op = WINED3DTOP_SELECTARG1;
|
---|
2030 | }
|
---|
2031 |
|
---|
2032 | if (isAlpha && This->stateBlock->textures[Stage] == NULL && arg1 == WINED3DTA_TEXTURE) {
|
---|
2033 | get_src_and_opr(WINED3DTA_DIFFUSE, isAlpha, &src1, &opr1);
|
---|
2034 | } else {
|
---|
2035 | get_src_and_opr(arg1, isAlpha, &src1, &opr1);
|
---|
2036 | }
|
---|
2037 | get_src_and_opr(arg2, isAlpha, &src2, &opr2);
|
---|
2038 | get_src_and_opr(arg3, isAlpha, &src3, &opr3);
|
---|
2039 |
|
---|
2040 | TRACE("ct(%x), 1:(%x,%x), 2:(%x,%x), 3:(%x,%x)\n", comb_target, src1, opr1, src2, opr2, src3, opr3);
|
---|
2041 |
|
---|
2042 | Handled = TRUE; /* Assume will be handled */
|
---|
2043 |
|
---|
2044 | /* Other texture operations require special extensions: */
|
---|
2045 | if (gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
---|
2046 | {
|
---|
2047 | if (isAlpha) {
|
---|
2048 | opr = GL_SRC_ALPHA;
|
---|
2049 | invopr = GL_ONE_MINUS_SRC_ALPHA;
|
---|
2050 | src3_target = GL_SOURCE3_ALPHA_NV;
|
---|
2051 | opr3_target = GL_OPERAND3_ALPHA_NV;
|
---|
2052 | } else {
|
---|
2053 | opr = GL_SRC_COLOR;
|
---|
2054 | invopr = GL_ONE_MINUS_SRC_COLOR;
|
---|
2055 | src3_target = GL_SOURCE3_RGB_NV;
|
---|
2056 | opr3_target = GL_OPERAND3_RGB_NV;
|
---|
2057 | }
|
---|
2058 | switch (op) {
|
---|
2059 | case WINED3DTOP_DISABLE: /* Only for alpha */
|
---|
2060 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2061 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
---|
2062 | glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
|
---|
2063 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2064 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
|
---|
2065 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2066 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2067 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2068 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2069 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2070 | glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
---|
2071 | checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
|
---|
2072 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
---|
2073 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
---|
2074 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2075 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2076 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2077 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
---|
2078 | break;
|
---|
2079 | case WINED3DTOP_SELECTARG1: /* = a1 * 1 + 0 * 0 */
|
---|
2080 | case WINED3DTOP_SELECTARG2: /* = a2 * 1 + 0 * 0 */
|
---|
2081 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2082 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2083 | if (op == WINED3DTOP_SELECTARG1) {
|
---|
2084 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2085 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2086 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2087 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2088 | } else {
|
---|
2089 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
|
---|
2090 | checkGLcall("GL_TEXTURE_ENV, src0_target, src2");
|
---|
2091 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
|
---|
2092 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
|
---|
2093 | }
|
---|
2094 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2095 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2096 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2097 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2098 | glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
---|
2099 | checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
|
---|
2100 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
---|
2101 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
---|
2102 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2103 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2104 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2105 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
---|
2106 | break;
|
---|
2107 |
|
---|
2108 | case WINED3DTOP_MODULATE:
|
---|
2109 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2110 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
---|
2111 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2112 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2113 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2114 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2115 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2116 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2117 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2118 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2119 | glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
---|
2120 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2121 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
---|
2122 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2123 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2124 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2125 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2126 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
---|
2127 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2128 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2129 | break;
|
---|
2130 | case WINED3DTOP_MODULATE2X:
|
---|
2131 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2132 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
---|
2133 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2134 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2135 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2136 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2137 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2138 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2139 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2140 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2141 | glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
---|
2142 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2143 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
---|
2144 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2145 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2146 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2147 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2148 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
---|
2149 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
---|
2150 | checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
---|
2151 | break;
|
---|
2152 | case WINED3DTOP_MODULATE4X:
|
---|
2153 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2154 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
---|
2155 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2156 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2157 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2158 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2159 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2160 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2161 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2162 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2163 | glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
|
---|
2164 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2165 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
---|
2166 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2167 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2168 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2169 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2170 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr1");
|
---|
2171 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 4);
|
---|
2172 | checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
|
---|
2173 | break;
|
---|
2174 |
|
---|
2175 | case WINED3DTOP_ADD:
|
---|
2176 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2177 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2178 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2179 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2180 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2181 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2182 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2183 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2184 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2185 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2186 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2187 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2188 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2189 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2190 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2191 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2192 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
---|
2193 | checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
---|
2194 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2195 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2196 | break;
|
---|
2197 |
|
---|
2198 | case WINED3DTOP_ADDSIGNED:
|
---|
2199 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
---|
2200 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED)");
|
---|
2201 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2202 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2203 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2204 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2205 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2206 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2207 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2208 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2209 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2210 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2211 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2212 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2213 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2214 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2215 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
---|
2216 | checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
---|
2217 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2218 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2219 | break;
|
---|
2220 |
|
---|
2221 | case WINED3DTOP_ADDSIGNED2X:
|
---|
2222 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
---|
2223 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED)");
|
---|
2224 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2225 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2226 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2227 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2228 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2229 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2230 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2231 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2232 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2233 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2234 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2235 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2236 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2237 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2238 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
---|
2239 | checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
---|
2240 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
---|
2241 | checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
---|
2242 | break;
|
---|
2243 |
|
---|
2244 | case WINED3DTOP_ADDSMOOTH:
|
---|
2245 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2246 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2247 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2248 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2249 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2250 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2251 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2252 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2253 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2254 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2255 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2256 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2257 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2258 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2259 | glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
---|
2260 | checkGLcall("GL_TEXTURE_ENV, src3_target, src1");
|
---|
2261 | switch (opr1) {
|
---|
2262 | case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
2263 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
---|
2264 | case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2265 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2266 | }
|
---|
2267 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2268 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
---|
2269 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2270 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2271 | break;
|
---|
2272 |
|
---|
2273 | case WINED3DTOP_BLENDDIFFUSEALPHA:
|
---|
2274 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2275 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2276 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2277 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2278 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2279 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2280 | glTexEnvi(GL_TEXTURE_ENV, src1_target, useext(GL_PRIMARY_COLOR));
|
---|
2281 | checkGLcall("GL_TEXTURE_ENV, src1_target, useext(GL_PRIMARY_COLOR)");
|
---|
2282 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2283 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2284 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2285 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2286 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2287 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2288 | glTexEnvi(GL_TEXTURE_ENV, src3_target, useext(GL_PRIMARY_COLOR));
|
---|
2289 | checkGLcall("GL_TEXTURE_ENV, src3_target, useext(GL_PRIMARY_COLOR)");
|
---|
2290 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
---|
2291 | checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
---|
2292 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2293 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2294 | break;
|
---|
2295 | case WINED3DTOP_BLENDTEXTUREALPHA:
|
---|
2296 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2297 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2298 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2299 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2300 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2301 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2302 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_TEXTURE);
|
---|
2303 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_TEXTURE");
|
---|
2304 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2305 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2306 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2307 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2308 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2309 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2310 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_TEXTURE);
|
---|
2311 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_TEXTURE");
|
---|
2312 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
---|
2313 | checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
---|
2314 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2315 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2316 | break;
|
---|
2317 | case WINED3DTOP_BLENDFACTORALPHA:
|
---|
2318 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2319 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2320 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2321 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2322 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2323 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2324 | glTexEnvi(GL_TEXTURE_ENV, src1_target, useext(GL_CONSTANT));
|
---|
2325 | checkGLcall("GL_TEXTURE_ENV, src1_target, useext(GL_CONSTANT)");
|
---|
2326 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2327 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2328 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2329 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2330 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2331 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2332 | glTexEnvi(GL_TEXTURE_ENV, src3_target, useext(GL_CONSTANT));
|
---|
2333 | checkGLcall("GL_TEXTURE_ENV, src3_target, useext(GL_CONSTANT)");
|
---|
2334 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
---|
2335 | checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
---|
2336 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2337 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2338 | break;
|
---|
2339 | case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
---|
2340 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2341 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2342 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2343 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2344 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2345 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2346 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2347 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2348 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2349 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2350 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2351 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2352 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2353 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2354 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_TEXTURE);
|
---|
2355 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_TEXTURE");
|
---|
2356 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA);
|
---|
2357 | checkGLcall("GL_TEXTURE_ENV, opr3_target, GL_ONE_MINUS_SRC_ALPHA");
|
---|
2358 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2359 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2360 | break;
|
---|
2361 | case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
---|
2362 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2363 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
|
---|
2364 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); /* a0 = src1/opr1 */
|
---|
2365 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2366 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2367 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1"); /* a1 = 1 (see docs) */
|
---|
2368 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2369 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2370 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2371 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2372 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2); /* a2 = arg2 */
|
---|
2373 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2374 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2375 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2"); /* a3 = src1 alpha */
|
---|
2376 | glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
---|
2377 | checkGLcall("GL_TEXTURE_ENV, src3_target, src1");
|
---|
2378 | switch (opr) {
|
---|
2379 | case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2380 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2381 | }
|
---|
2382 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2383 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
---|
2384 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2385 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2386 | break;
|
---|
2387 | case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
---|
2388 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2389 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2390 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2391 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2392 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2393 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2394 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2395 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2396 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2397 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2398 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
---|
2399 | checkGLcall("GL_TEXTURE_ENV, src2_target, src1");
|
---|
2400 | switch (opr1) {
|
---|
2401 | case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2402 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2403 | }
|
---|
2404 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
---|
2405 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
---|
2406 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2407 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2408 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
---|
2409 | checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
---|
2410 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2411 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2412 | break;
|
---|
2413 | case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
---|
2414 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2415 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2416 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2417 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2418 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2419 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2420 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2421 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2422 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2423 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2424 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2425 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2426 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2427 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2428 | glTexEnvi(GL_TEXTURE_ENV, src3_target, src1);
|
---|
2429 | checkGLcall("GL_TEXTURE_ENV, src3_target, src1");
|
---|
2430 | switch (opr1) {
|
---|
2431 | case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2432 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2433 | case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2434 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2435 | }
|
---|
2436 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
|
---|
2437 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
|
---|
2438 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2439 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2440 | break;
|
---|
2441 | case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
---|
2442 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2443 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2444 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2445 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2446 | switch (opr1) {
|
---|
2447 | case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
2448 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
---|
2449 | case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2450 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2451 | }
|
---|
2452 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
---|
2453 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
---|
2454 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2455 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2456 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2457 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2458 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
---|
2459 | checkGLcall("GL_TEXTURE_ENV, src2_target, src1");
|
---|
2460 | switch (opr1) {
|
---|
2461 | case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2462 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2463 | }
|
---|
2464 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
|
---|
2465 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
|
---|
2466 | glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
|
---|
2467 | checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
|
---|
2468 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, invopr);
|
---|
2469 | checkGLcall("GL_TEXTURE_ENV, opr3_target, invopr");
|
---|
2470 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2471 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2472 | break;
|
---|
2473 | case WINED3DTOP_MULTIPLYADD:
|
---|
2474 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2475 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2476 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src3);
|
---|
2477 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2478 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr3);
|
---|
2479 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2480 | glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
|
---|
2481 | checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
|
---|
2482 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
|
---|
2483 | checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
|
---|
2484 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src1);
|
---|
2485 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2486 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr1);
|
---|
2487 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2488 | glTexEnvi(GL_TEXTURE_ENV, src3_target, src2);
|
---|
2489 | checkGLcall("GL_TEXTURE_ENV, src3_target, src3");
|
---|
2490 | glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr2);
|
---|
2491 | checkGLcall("GL_TEXTURE_ENV, opr3_target, opr3");
|
---|
2492 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2493 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2494 | break;
|
---|
2495 |
|
---|
2496 | case WINED3DTOP_BUMPENVMAP:
|
---|
2497 | {
|
---|
2498 | }
|
---|
2499 |
|
---|
2500 | case WINED3DTOP_BUMPENVMAPLUMINANCE:
|
---|
2501 | FIXME("Implement bump environment mapping in GL_NV_texture_env_combine4 path\n");
|
---|
2502 |
|
---|
2503 | default:
|
---|
2504 | Handled = FALSE;
|
---|
2505 | }
|
---|
2506 | if (Handled) {
|
---|
2507 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
|
---|
2508 | checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV");
|
---|
2509 |
|
---|
2510 | return;
|
---|
2511 | }
|
---|
2512 | } /* GL_NV_texture_env_combine4 */
|
---|
2513 |
|
---|
2514 | Handled = TRUE; /* Again, assume handled */
|
---|
2515 | switch (op) {
|
---|
2516 | case WINED3DTOP_DISABLE: /* Only for alpha */
|
---|
2517 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
---|
2518 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
---|
2519 | glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
|
---|
2520 | checkGLcall("GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT");
|
---|
2521 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
|
---|
2522 | checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA");
|
---|
2523 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2524 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2525 | break;
|
---|
2526 | case WINED3DTOP_SELECTARG1:
|
---|
2527 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
---|
2528 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
---|
2529 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2530 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2531 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2532 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2533 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2534 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2535 | break;
|
---|
2536 | case WINED3DTOP_SELECTARG2:
|
---|
2537 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
|
---|
2538 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
|
---|
2539 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
|
---|
2540 | checkGLcall("GL_TEXTURE_ENV, src0_target, src2");
|
---|
2541 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
|
---|
2542 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
|
---|
2543 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2544 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2545 | break;
|
---|
2546 | case WINED3DTOP_MODULATE:
|
---|
2547 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
---|
2548 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
---|
2549 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2550 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2551 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2552 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2553 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2554 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2555 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2556 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2557 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2558 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2559 | break;
|
---|
2560 | case WINED3DTOP_MODULATE2X:
|
---|
2561 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
---|
2562 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
---|
2563 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2564 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2565 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2566 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2567 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2568 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2569 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2570 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2571 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
---|
2572 | checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
---|
2573 | break;
|
---|
2574 | case WINED3DTOP_MODULATE4X:
|
---|
2575 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
|
---|
2576 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
|
---|
2577 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2578 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2579 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2580 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2581 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2582 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2583 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2584 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2585 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 4);
|
---|
2586 | checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
|
---|
2587 | break;
|
---|
2588 | case WINED3DTOP_ADD:
|
---|
2589 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
|
---|
2590 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
|
---|
2591 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2592 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2593 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2594 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2595 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2596 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2597 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2598 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2599 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2600 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2601 | break;
|
---|
2602 | case WINED3DTOP_ADDSIGNED:
|
---|
2603 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
---|
2604 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext((GL_ADD_SIGNED)");
|
---|
2605 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2606 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2607 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2608 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2609 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2610 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2611 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2612 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2613 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2614 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2615 | break;
|
---|
2616 | case WINED3DTOP_ADDSIGNED2X:
|
---|
2617 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED));
|
---|
2618 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_ADD_SIGNED)");
|
---|
2619 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2620 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2621 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2622 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2623 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2624 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2625 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2626 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2627 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
|
---|
2628 | checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
|
---|
2629 | break;
|
---|
2630 | case WINED3DTOP_SUBTRACT:
|
---|
2631 | if (gl_info->supported[ARB_TEXTURE_ENV_COMBINE])
|
---|
2632 | {
|
---|
2633 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_SUBTRACT);
|
---|
2634 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_SUBTRACT)");
|
---|
2635 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2636 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2637 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2638 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2639 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2640 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2641 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2642 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2643 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2644 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2645 | } else {
|
---|
2646 | FIXME("This version of opengl does not support GL_SUBTRACT\n");
|
---|
2647 | }
|
---|
2648 | break;
|
---|
2649 |
|
---|
2650 | case WINED3DTOP_BLENDDIFFUSEALPHA:
|
---|
2651 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
---|
2652 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
---|
2653 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2654 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2655 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2656 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2657 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2658 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2659 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2660 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2661 | glTexEnvi(GL_TEXTURE_ENV, src2_target, useext(GL_PRIMARY_COLOR));
|
---|
2662 | checkGLcall("GL_TEXTURE_ENV, src2_target, GL_PRIMARY_COLOR");
|
---|
2663 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
---|
2664 | checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
---|
2665 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2666 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2667 | break;
|
---|
2668 | case WINED3DTOP_BLENDTEXTUREALPHA:
|
---|
2669 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
---|
2670 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
---|
2671 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2672 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2673 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2674 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2675 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2676 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2677 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2678 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2679 | glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_TEXTURE);
|
---|
2680 | checkGLcall("GL_TEXTURE_ENV, src2_target, GL_TEXTURE");
|
---|
2681 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
---|
2682 | checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
---|
2683 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2684 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2685 | break;
|
---|
2686 | case WINED3DTOP_BLENDFACTORALPHA:
|
---|
2687 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
---|
2688 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
---|
2689 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2690 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2691 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2692 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2693 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2694 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2695 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2696 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2697 | glTexEnvi(GL_TEXTURE_ENV, src2_target, useext(GL_CONSTANT));
|
---|
2698 | checkGLcall("GL_TEXTURE_ENV, src2_target, GL_CONSTANT");
|
---|
2699 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
---|
2700 | checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
---|
2701 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2702 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2703 | break;
|
---|
2704 | case WINED3DTOP_BLENDCURRENTALPHA:
|
---|
2705 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
---|
2706 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
---|
2707 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2708 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2709 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2710 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2711 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2712 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2713 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2714 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2715 | glTexEnvi(GL_TEXTURE_ENV, src2_target, useext(GL_PREVIOUS));
|
---|
2716 | checkGLcall("GL_TEXTURE_ENV, src2_target, GL_PREVIOUS");
|
---|
2717 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA);
|
---|
2718 | checkGLcall("GL_TEXTURE_ENV, opr2_target, GL_SRC_ALPHA");
|
---|
2719 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2720 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2721 | break;
|
---|
2722 | case WINED3DTOP_DOTPRODUCT3:
|
---|
2723 | if (gl_info->supported[ARB_TEXTURE_ENV_DOT3])
|
---|
2724 | {
|
---|
2725 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB);
|
---|
2726 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB");
|
---|
2727 | }
|
---|
2728 | else if (gl_info->supported[EXT_TEXTURE_ENV_DOT3])
|
---|
2729 | {
|
---|
2730 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT);
|
---|
2731 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_EXT");
|
---|
2732 | } else {
|
---|
2733 | FIXME("This version of opengl does not support GL_DOT3\n");
|
---|
2734 | }
|
---|
2735 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2736 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2737 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2738 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2739 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2740 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2741 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2742 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2743 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2744 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2745 | break;
|
---|
2746 | case WINED3DTOP_LERP:
|
---|
2747 | glTexEnvi(GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE));
|
---|
2748 | checkGLcall("GL_TEXTURE_ENV, comb_target, useext(GL_INTERPOLATE)");
|
---|
2749 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2750 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2751 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2752 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2753 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
|
---|
2754 | checkGLcall("GL_TEXTURE_ENV, src1_target, src2");
|
---|
2755 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
|
---|
2756 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr2");
|
---|
2757 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src3);
|
---|
2758 | checkGLcall("GL_TEXTURE_ENV, src2_target, src3");
|
---|
2759 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr3);
|
---|
2760 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr3");
|
---|
2761 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2762 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2763 | break;
|
---|
2764 | case WINED3DTOP_ADDSMOOTH:
|
---|
2765 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
---|
2766 | {
|
---|
2767 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
---|
2768 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
---|
2769 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2770 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2771 | switch (opr1) {
|
---|
2772 | case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
2773 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
---|
2774 | case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2775 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2776 | }
|
---|
2777 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
---|
2778 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
---|
2779 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
---|
2780 | checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
---|
2781 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
---|
2782 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
---|
2783 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2784 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2785 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2786 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2787 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2788 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2789 | } else
|
---|
2790 | Handled = FALSE;
|
---|
2791 | break;
|
---|
2792 | case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
---|
2793 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
---|
2794 | {
|
---|
2795 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
---|
2796 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
---|
2797 | glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_TEXTURE);
|
---|
2798 | checkGLcall("GL_TEXTURE_ENV, src0_target, GL_TEXTURE");
|
---|
2799 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_ALPHA);
|
---|
2800 | checkGLcall("GL_TEXTURE_ENV, opr0_target, GL_ONE_MINUS_SRC_APHA");
|
---|
2801 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
---|
2802 | checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
---|
2803 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
---|
2804 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
---|
2805 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2806 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2807 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2808 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2809 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2810 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2811 | } else
|
---|
2812 | Handled = FALSE;
|
---|
2813 | break;
|
---|
2814 | case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
---|
2815 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
---|
2816 | {
|
---|
2817 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
---|
2818 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
---|
2819 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2820 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2821 | switch (opr1) {
|
---|
2822 | case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2823 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2824 | case GL_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2825 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2826 | }
|
---|
2827 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
---|
2828 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
---|
2829 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
---|
2830 | checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
---|
2831 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
---|
2832 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
---|
2833 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2834 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2835 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2836 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2837 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2838 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2839 | } else
|
---|
2840 | Handled = FALSE;
|
---|
2841 | break;
|
---|
2842 | case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
---|
2843 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
---|
2844 | {
|
---|
2845 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
---|
2846 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
---|
2847 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2848 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2849 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2850 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2851 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
---|
2852 | checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
---|
2853 | switch (opr1) {
|
---|
2854 | case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2855 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2856 | case GL_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2857 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2858 | }
|
---|
2859 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr);
|
---|
2860 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr");
|
---|
2861 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2862 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2863 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2864 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2865 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2866 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2867 | } else
|
---|
2868 | Handled = FALSE;
|
---|
2869 | break;
|
---|
2870 | case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
---|
2871 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
---|
2872 | {
|
---|
2873 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
---|
2874 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
---|
2875 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2876 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2877 | switch (opr1) {
|
---|
2878 | case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2879 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2880 | case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2881 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2882 | }
|
---|
2883 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
---|
2884 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
---|
2885 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
---|
2886 | checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
---|
2887 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr1);
|
---|
2888 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr1");
|
---|
2889 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2890 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2891 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2892 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2893 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2894 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2895 | } else
|
---|
2896 | Handled = FALSE;
|
---|
2897 | break;
|
---|
2898 | case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
---|
2899 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
---|
2900 | {
|
---|
2901 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
---|
2902 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
---|
2903 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2904 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2905 | switch (opr1) {
|
---|
2906 | case GL_SRC_COLOR: opr = GL_ONE_MINUS_SRC_COLOR; break;
|
---|
2907 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_SRC_COLOR; break;
|
---|
2908 | case GL_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2909 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2910 | }
|
---|
2911 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr);
|
---|
2912 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr");
|
---|
2913 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src1);
|
---|
2914 | checkGLcall("GL_TEXTURE_ENV, src1_target, src1");
|
---|
2915 | switch (opr1) {
|
---|
2916 | case GL_SRC_COLOR: opr = GL_SRC_ALPHA; break;
|
---|
2917 | case GL_ONE_MINUS_SRC_COLOR: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2918 | case GL_SRC_ALPHA: opr = GL_SRC_ALPHA; break;
|
---|
2919 | case GL_ONE_MINUS_SRC_ALPHA: opr = GL_ONE_MINUS_SRC_ALPHA; break;
|
---|
2920 | }
|
---|
2921 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr);
|
---|
2922 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr");
|
---|
2923 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2924 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2925 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2926 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2927 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2928 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2929 | } else
|
---|
2930 | Handled = FALSE;
|
---|
2931 | break;
|
---|
2932 | case WINED3DTOP_MULTIPLYADD:
|
---|
2933 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
|
---|
2934 | {
|
---|
2935 | glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
|
---|
2936 | checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI");
|
---|
2937 | glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
|
---|
2938 | checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
|
---|
2939 | glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
|
---|
2940 | checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
|
---|
2941 | glTexEnvi(GL_TEXTURE_ENV, src1_target, src3);
|
---|
2942 | checkGLcall("GL_TEXTURE_ENV, src1_target, src3");
|
---|
2943 | glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr3);
|
---|
2944 | checkGLcall("GL_TEXTURE_ENV, opr1_target, opr3");
|
---|
2945 | glTexEnvi(GL_TEXTURE_ENV, src2_target, src2);
|
---|
2946 | checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
|
---|
2947 | glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
|
---|
2948 | checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
|
---|
2949 | glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
|
---|
2950 | checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
|
---|
2951 | } else
|
---|
2952 | Handled = FALSE;
|
---|
2953 | break;
|
---|
2954 | case WINED3DTOP_BUMPENVMAPLUMINANCE:
|
---|
2955 | case WINED3DTOP_BUMPENVMAP:
|
---|
2956 | if (gl_info->supported[NV_TEXTURE_SHADER2])
|
---|
2957 | {
|
---|
2958 | /* Technically texture shader support without register combiners is possible, but not expected to occur
|
---|
2959 | * on real world cards, so for now a fixme should be enough
|
---|
2960 | */
|
---|
2961 | FIXME("Implement bump mapping with GL_NV_texture_shader in non register combiner path\n");
|
---|
2962 | }
|
---|
2963 | default:
|
---|
2964 | Handled = FALSE;
|
---|
2965 | }
|
---|
2966 |
|
---|
2967 | if (Handled) {
|
---|
2968 | BOOL combineOK = TRUE;
|
---|
2969 | if (gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
---|
2970 | {
|
---|
2971 | DWORD op2;
|
---|
2972 |
|
---|
2973 | if (isAlpha) {
|
---|
2974 | op2 = This->stateBlock->textureState[Stage][WINED3DTSS_COLOROP];
|
---|
2975 | } else {
|
---|
2976 | op2 = This->stateBlock->textureState[Stage][WINED3DTSS_ALPHAOP];
|
---|
2977 | }
|
---|
2978 |
|
---|
2979 | /* Note: If COMBINE4 in effect can't go back to combine! */
|
---|
2980 | switch (op2) {
|
---|
2981 | case WINED3DTOP_ADDSMOOTH:
|
---|
2982 | case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
---|
2983 | case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
---|
2984 | case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
---|
2985 | case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
---|
2986 | case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
---|
2987 | case WINED3DTOP_MULTIPLYADD:
|
---|
2988 | /* Ignore those implemented in both cases */
|
---|
2989 | switch (op) {
|
---|
2990 | case WINED3DTOP_SELECTARG1:
|
---|
2991 | case WINED3DTOP_SELECTARG2:
|
---|
2992 | combineOK = FALSE;
|
---|
2993 | Handled = FALSE;
|
---|
2994 | break;
|
---|
2995 | default:
|
---|
2996 | FIXME("Can't use COMBINE4 and COMBINE together, thisop=%s, otherop=%s, isAlpha(%d)\n", debug_d3dtop(op), debug_d3dtop(op2), isAlpha);
|
---|
2997 | return;
|
---|
2998 | }
|
---|
2999 | }
|
---|
3000 | }
|
---|
3001 |
|
---|
3002 | if (combineOK) {
|
---|
3003 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE));
|
---|
3004 | checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE)");
|
---|
3005 |
|
---|
3006 | return;
|
---|
3007 | }
|
---|
3008 | }
|
---|
3009 |
|
---|
3010 | /* After all the extensions, if still unhandled, report fixme */
|
---|
3011 | FIXME("Unhandled texture operation %s\n", debug_d3dtop(op));
|
---|
3012 | }
|
---|
3013 |
|
---|
3014 |
|
---|
3015 | static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3016 | {
|
---|
3017 | DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
---|
3018 | BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
|
---|
3019 | DWORD mapped_stage = stateblock->device->texUnitMap[stage];
|
---|
3020 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
3021 |
|
---|
3022 | TRACE("Setting color op for stage %d\n", stage);
|
---|
3023 |
|
---|
3024 | /* Using a pixel shader? Don't care for anything here, the shader applying does it */
|
---|
3025 | if (use_ps(stateblock)) return;
|
---|
3026 |
|
---|
3027 | if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
|
---|
3028 |
|
---|
3029 | if (mapped_stage != WINED3D_UNMAPPED_STAGE)
|
---|
3030 | {
|
---|
3031 | if (tex_used && mapped_stage >= gl_info->limits.textures)
|
---|
3032 | {
|
---|
3033 | FIXME("Attempt to enable unsupported stage!\n");
|
---|
3034 | return;
|
---|
3035 | }
|
---|
3036 | GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
---|
3037 | checkGLcall("glActiveTextureARB");
|
---|
3038 | }
|
---|
3039 |
|
---|
3040 | if(stage >= stateblock->lowest_disabled_stage) {
|
---|
3041 | TRACE("Stage disabled\n");
|
---|
3042 | if (mapped_stage != WINED3D_UNMAPPED_STAGE)
|
---|
3043 | {
|
---|
3044 | /* Disable everything here */
|
---|
3045 | glDisable(GL_TEXTURE_2D);
|
---|
3046 | checkGLcall("glDisable(GL_TEXTURE_2D)");
|
---|
3047 | glDisable(GL_TEXTURE_3D);
|
---|
3048 | checkGLcall("glDisable(GL_TEXTURE_3D)");
|
---|
3049 | if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
---|
3050 | {
|
---|
3051 | glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
---|
3052 | checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
|
---|
3053 | }
|
---|
3054 | if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
---|
3055 | {
|
---|
3056 | glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
---|
3057 | checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
|
---|
3058 | }
|
---|
3059 | }
|
---|
3060 | /* All done */
|
---|
3061 | return;
|
---|
3062 | }
|
---|
3063 |
|
---|
3064 | /* The sampler will also activate the correct texture dimensions, so no need to do it here
|
---|
3065 | * if the sampler for this stage is dirty
|
---|
3066 | */
|
---|
3067 | if(!isStateDirty(context, STATE_SAMPLER(stage))) {
|
---|
3068 | if (tex_used) texture_activate_dimensions(stage, stateblock, context);
|
---|
3069 | }
|
---|
3070 |
|
---|
3071 | set_tex_op(context, (IWineD3DDevice *)stateblock->device, FALSE, stage,
|
---|
3072 | stateblock->textureState[stage][WINED3DTSS_COLOROP],
|
---|
3073 | stateblock->textureState[stage][WINED3DTSS_COLORARG1],
|
---|
3074 | stateblock->textureState[stage][WINED3DTSS_COLORARG2],
|
---|
3075 | stateblock->textureState[stage][WINED3DTSS_COLORARG0]);
|
---|
3076 | }
|
---|
3077 |
|
---|
3078 | void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3079 | {
|
---|
3080 | DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
---|
3081 | BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
|
---|
3082 | DWORD mapped_stage = stateblock->device->texUnitMap[stage];
|
---|
3083 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
3084 | DWORD op, arg1, arg2, arg0;
|
---|
3085 |
|
---|
3086 | TRACE("Setting alpha op for stage %d\n", stage);
|
---|
3087 | /* Do not care for enabled / disabled stages, just assign the settings. colorop disables / enables required stuff */
|
---|
3088 | if (mapped_stage != WINED3D_UNMAPPED_STAGE)
|
---|
3089 | {
|
---|
3090 | if (tex_used && mapped_stage >= gl_info->limits.textures)
|
---|
3091 | {
|
---|
3092 | FIXME("Attempt to enable unsupported stage!\n");
|
---|
3093 | return;
|
---|
3094 | }
|
---|
3095 | GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
---|
3096 | checkGLcall("glActiveTextureARB");
|
---|
3097 | }
|
---|
3098 |
|
---|
3099 | op = stateblock->textureState[stage][WINED3DTSS_ALPHAOP];
|
---|
3100 | arg1 = stateblock->textureState[stage][WINED3DTSS_ALPHAARG1];
|
---|
3101 | arg2 = stateblock->textureState[stage][WINED3DTSS_ALPHAARG2];
|
---|
3102 | arg0 = stateblock->textureState[stage][WINED3DTSS_ALPHAARG0];
|
---|
3103 |
|
---|
3104 | if (stateblock->renderState[WINED3DRS_COLORKEYENABLE] && stage == 0 && stateblock->textures[0])
|
---|
3105 | {
|
---|
3106 | UINT texture_dimensions = IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[0]);
|
---|
3107 |
|
---|
3108 | if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
|
---|
3109 | {
|
---|
3110 | IWineD3DSurfaceImpl *surf;
|
---|
3111 |
|
---|
3112 | surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *) stateblock->textures[0])->surfaces[0];
|
---|
3113 |
|
---|
3114 | if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format_desc->alpha_mask)
|
---|
3115 | {
|
---|
3116 | /* Color keying needs to pass alpha values from the texture through to have the alpha test work
|
---|
3117 | * properly. On the other hand applications can still use texture combiners apparently. This code
|
---|
3118 | * takes care that apps cannot remove the texture's alpha channel entirely.
|
---|
3119 | *
|
---|
3120 | * The fixup is required for Prince of Persia 3D(prison bars), while Moto racer 2 requires
|
---|
3121 | * D3DTOP_MODULATE to work on color keyed surfaces. Aliens vs Predator 1 uses color keyed textures
|
---|
3122 | * and alpha component of diffuse color to draw things like translucent text and perform other
|
---|
3123 | * blending effects.
|
---|
3124 | *
|
---|
3125 | * Aliens vs Predator 1 relies on diffuse alpha having an effect, so it cannot be ignored. To
|
---|
3126 | * provide the behavior expected by the game, while emulating the colorkey, diffuse alpha must be
|
---|
3127 | * modulated with texture alpha. OTOH, Moto racer 2 at some points sets alphaop/alphaarg to
|
---|
3128 | * SELECTARG/CURRENT, yet puts garbage in diffuse alpha (zeroes). This works on native, because the
|
---|
3129 | * game disables alpha test and alpha blending. Alpha test is overwritten by wine's for purposes of
|
---|
3130 | * color-keying though, so this will lead to missing geometry if texture alpha is modulated (pixels
|
---|
3131 | * fail alpha test). To get around this, ALPHABLENDENABLE state is checked: if the app enables alpha
|
---|
3132 | * blending, it can be expected to provide meaningful values in diffuse alpha, so it should be
|
---|
3133 | * modulated with texture alpha; otherwise, selecting diffuse alpha is ignored in favour of texture
|
---|
3134 | * alpha.
|
---|
3135 | *
|
---|
3136 | * What to do with multitexturing? So far no app has been found that uses color keying with
|
---|
3137 | * multitexturing */
|
---|
3138 | if (op == WINED3DTOP_DISABLE)
|
---|
3139 | {
|
---|
3140 | arg1 = WINED3DTA_TEXTURE;
|
---|
3141 | op = WINED3DTOP_SELECTARG1;
|
---|
3142 | }
|
---|
3143 | else if(op == WINED3DTOP_SELECTARG1 && arg1 != WINED3DTA_TEXTURE)
|
---|
3144 | {
|
---|
3145 | if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE])
|
---|
3146 | {
|
---|
3147 | arg2 = WINED3DTA_TEXTURE;
|
---|
3148 | op = WINED3DTOP_MODULATE;
|
---|
3149 | }
|
---|
3150 | else arg1 = WINED3DTA_TEXTURE;
|
---|
3151 | }
|
---|
3152 | else if(op == WINED3DTOP_SELECTARG2 && arg2 != WINED3DTA_TEXTURE)
|
---|
3153 | {
|
---|
3154 | if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE])
|
---|
3155 | {
|
---|
3156 | arg1 = WINED3DTA_TEXTURE;
|
---|
3157 | op = WINED3DTOP_MODULATE;
|
---|
3158 | }
|
---|
3159 | else arg2 = WINED3DTA_TEXTURE;
|
---|
3160 | }
|
---|
3161 | }
|
---|
3162 | }
|
---|
3163 | }
|
---|
3164 |
|
---|
3165 | /* tex_alphaop is shared between the ffp and nvrc because the difference only comes down to
|
---|
3166 | * this if block here, and the other code(color keying, texture unit selection) are the same
|
---|
3167 | */
|
---|
3168 | TRACE("Setting alpha op for stage %d\n", stage);
|
---|
3169 | if (gl_info->supported[NV_REGISTER_COMBINERS])
|
---|
3170 | {
|
---|
3171 | set_tex_op_nvrc((IWineD3DDevice *)stateblock->device, TRUE, stage, op, arg1, arg2, arg0,
|
---|
3172 | mapped_stage, stateblock->textureState[stage][WINED3DTSS_RESULTARG]);
|
---|
3173 | }
|
---|
3174 | else
|
---|
3175 | {
|
---|
3176 | set_tex_op(context, (IWineD3DDevice *)stateblock->device, TRUE, stage, op, arg1, arg2, arg0);
|
---|
3177 | }
|
---|
3178 | }
|
---|
3179 |
|
---|
3180 | static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3181 | {
|
---|
3182 | DWORD texUnit = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
---|
3183 | DWORD mapped_stage = stateblock->device->texUnitMap[texUnit];
|
---|
3184 | BOOL generated;
|
---|
3185 | int coordIdx;
|
---|
3186 |
|
---|
3187 | /* Ignore this when a vertex shader is used, or if the streams aren't sorted out yet */
|
---|
3188 | if (use_vs(stateblock) || isStateDirty(context, STATE_VDECL))
|
---|
3189 | {
|
---|
3190 | TRACE("Using a vertex shader, or stream sources not sorted out yet, skipping\n");
|
---|
3191 | return;
|
---|
3192 | }
|
---|
3193 |
|
---|
3194 | if (mapped_stage == WINED3D_UNMAPPED_STAGE) return;
|
---|
3195 | if (mapped_stage >= context->gl_info->limits.textures) return;
|
---|
3196 |
|
---|
3197 | GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
---|
3198 | checkGLcall("glActiveTextureARB");
|
---|
3199 | generated = (stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) != WINED3DTSS_TCI_PASSTHRU;
|
---|
3200 | coordIdx = min(stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX & 0x0000FFFF], MAX_TEXTURES - 1);
|
---|
3201 |
|
---|
3202 | set_texture_matrix(&stateblock->transforms[WINED3DTS_TEXTURE0 + texUnit].u.m[0][0],
|
---|
3203 | stateblock->textureState[texUnit][WINED3DTSS_TEXTURETRANSFORMFLAGS], generated, context->last_was_rhw,
|
---|
3204 | stateblock->device->strided_streams.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))
|
---|
3205 | ? stateblock->device->strided_streams.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format_desc->format
|
---|
3206 | : WINED3DFMT_UNKNOWN,
|
---|
3207 | stateblock->device->frag_pipe->ffp_proj_control);
|
---|
3208 |
|
---|
3209 | /* The sampler applying function calls us if this changes */
|
---|
3210 | if ((context->lastWasPow2Texture & (1 << texUnit)) && stateblock->textures[texUnit])
|
---|
3211 | {
|
---|
3212 | if(generated) {
|
---|
3213 | FIXME("Non-power2 texture being used with generated texture coords\n");
|
---|
3214 | }
|
---|
3215 | /* NP2 texcoord fixup is implemented for pixelshaders so only enable the
|
---|
3216 | fixed-function-pipeline fixup via pow2Matrix when no PS is used. */
|
---|
3217 | if (!use_ps(stateblock)) {
|
---|
3218 | TRACE("Non power two matrix multiply fixup\n");
|
---|
3219 | glMultMatrixf(((IWineD3DTextureImpl *) stateblock->textures[texUnit])->baseTexture.pow2Matrix);
|
---|
3220 | }
|
---|
3221 | }
|
---|
3222 | }
|
---|
3223 |
|
---|
3224 | static void unloadTexCoords(const struct wined3d_context *context)
|
---|
3225 | {
|
---|
3226 | unsigned int texture_idx;
|
---|
3227 |
|
---|
3228 | for (texture_idx = 0; texture_idx < context->gl_info->limits.texture_stages; ++texture_idx)
|
---|
3229 | {
|
---|
3230 | GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + texture_idx));
|
---|
3231 | glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
---|
3232 | }
|
---|
3233 | }
|
---|
3234 |
|
---|
3235 | static void loadTexCoords(const struct wined3d_context *context, IWineD3DStateBlockImpl *stateblock,
|
---|
3236 | const struct wined3d_stream_info *si, GLuint *curVBO)
|
---|
3237 | {
|
---|
3238 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
3239 | const UINT *offset = stateblock->streamOffset;
|
---|
3240 | unsigned int mapped_stage = 0;
|
---|
3241 | unsigned int textureNo = 0;
|
---|
3242 |
|
---|
3243 | for (textureNo = 0; textureNo < gl_info->limits.texture_stages; ++textureNo)
|
---|
3244 | {
|
---|
3245 | int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
|
---|
3246 |
|
---|
3247 | mapped_stage = stateblock->device->texUnitMap[textureNo];
|
---|
3248 | if (mapped_stage == WINED3D_UNMAPPED_STAGE) continue;
|
---|
3249 |
|
---|
3250 | if (coordIdx < MAX_TEXTURES && (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))))
|
---|
3251 | {
|
---|
3252 | const struct wined3d_stream_info_element *e = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx];
|
---|
3253 |
|
---|
3254 | TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
|
---|
3255 | textureNo, mapped_stage, coordIdx, e->data);
|
---|
3256 |
|
---|
3257 | if (*curVBO != e->buffer_object)
|
---|
3258 | {
|
---|
3259 | GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
---|
3260 | checkGLcall("glBindBufferARB");
|
---|
3261 | *curVBO = e->buffer_object;
|
---|
3262 | }
|
---|
3263 |
|
---|
3264 | GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
---|
3265 | checkGLcall("glClientActiveTextureARB");
|
---|
3266 |
|
---|
3267 | /* The coords to supply depend completely on the fvf / vertex shader */
|
---|
3268 | glTexCoordPointer(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
---|
3269 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
3270 | glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
---|
3271 | } else {
|
---|
3272 | GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
---|
3273 | }
|
---|
3274 | }
|
---|
3275 | if (gl_info->supported[NV_REGISTER_COMBINERS])
|
---|
3276 | {
|
---|
3277 | /* The number of the mapped stages increases monotonically, so it's fine to use the last used one. */
|
---|
3278 | for (textureNo = mapped_stage + 1; textureNo < gl_info->limits.textures; ++textureNo)
|
---|
3279 | {
|
---|
3280 | GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1));
|
---|
3281 | }
|
---|
3282 | }
|
---|
3283 |
|
---|
3284 | checkGLcall("loadTexCoords");
|
---|
3285 | }
|
---|
3286 |
|
---|
3287 | static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3288 | {
|
---|
3289 | DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
---|
3290 | DWORD mapped_stage = stateblock->device->texUnitMap[stage];
|
---|
3291 | static const GLfloat s_plane[] = { 1.0f, 0.0f, 0.0f, 0.0f };
|
---|
3292 | static const GLfloat t_plane[] = { 0.0f, 1.0f, 0.0f, 0.0f };
|
---|
3293 | static const GLfloat r_plane[] = { 0.0f, 0.0f, 1.0f, 0.0f };
|
---|
3294 | static const GLfloat q_plane[] = { 0.0f, 0.0f, 0.0f, 1.0f };
|
---|
3295 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
3296 |
|
---|
3297 | if (mapped_stage == WINED3D_UNMAPPED_STAGE)
|
---|
3298 | {
|
---|
3299 | TRACE("No texture unit mapped to stage %d. Skipping texture coordinates.\n", stage);
|
---|
3300 | return;
|
---|
3301 | }
|
---|
3302 |
|
---|
3303 | if (mapped_stage >= gl_info->limits.fragment_samplers)
|
---|
3304 | {
|
---|
3305 | WARN("stage %u not mapped to a valid texture unit (%u)\n", stage, mapped_stage);
|
---|
3306 | return;
|
---|
3307 | }
|
---|
3308 | GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
---|
3309 | checkGLcall("glActiveTextureARB");
|
---|
3310 |
|
---|
3311 | /* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive
|
---|
3312 | *
|
---|
3313 | * FIXME: When using generated texture coordinates, the index value is used to specify the wrapping mode.
|
---|
3314 | * eg. SetTextureStageState( 0, WINED3DTSS_TEXCOORDINDEX, WINED3DTSS_TCI_CAMERASPACEPOSITION | 1 );
|
---|
3315 | * means use the vertex position (camera-space) as the input texture coordinates
|
---|
3316 | * for this texture stage, and the wrap mode set in the WINED3DRS_WRAP1 render
|
---|
3317 | * state. We do not (yet) support the WINED3DRENDERSTATE_WRAPx values, nor tie them up
|
---|
3318 | * to the TEXCOORDINDEX value
|
---|
3319 | */
|
---|
3320 | switch (stateblock->textureState[stage][WINED3DTSS_TEXCOORDINDEX] & 0xffff0000)
|
---|
3321 | {
|
---|
3322 | case WINED3DTSS_TCI_PASSTHRU:
|
---|
3323 | /* Use the specified texture coordinates contained within the
|
---|
3324 | * vertex format. This value resolves to zero. */
|
---|
3325 | glDisable(GL_TEXTURE_GEN_S);
|
---|
3326 | glDisable(GL_TEXTURE_GEN_T);
|
---|
3327 | glDisable(GL_TEXTURE_GEN_R);
|
---|
3328 | glDisable(GL_TEXTURE_GEN_Q);
|
---|
3329 | checkGLcall("WINED3DTSS_TCI_PASSTHRU - Disable texgen.");
|
---|
3330 | break;
|
---|
3331 |
|
---|
3332 | case WINED3DTSS_TCI_CAMERASPACEPOSITION:
|
---|
3333 | /* CameraSpacePosition means use the vertex position, transformed to camera space,
|
---|
3334 | * as the input texture coordinates for this stage's texture transformation. This
|
---|
3335 | * equates roughly to EYE_LINEAR */
|
---|
3336 |
|
---|
3337 | glMatrixMode(GL_MODELVIEW);
|
---|
3338 | glPushMatrix();
|
---|
3339 | glLoadIdentity();
|
---|
3340 | glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
---|
3341 | glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
---|
3342 | glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
---|
3343 | glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
---|
3344 | glPopMatrix();
|
---|
3345 | checkGLcall("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane.");
|
---|
3346 |
|
---|
3347 | glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
---|
3348 | glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
---|
3349 | glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
|
---|
3350 | checkGLcall("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set texgen mode.");
|
---|
3351 |
|
---|
3352 | glEnable(GL_TEXTURE_GEN_S);
|
---|
3353 | glEnable(GL_TEXTURE_GEN_T);
|
---|
3354 | glEnable(GL_TEXTURE_GEN_R);
|
---|
3355 | checkGLcall("WINED3DTSS_TCI_CAMERASPACEPOSITION - Enable texgen.");
|
---|
3356 |
|
---|
3357 | break;
|
---|
3358 |
|
---|
3359 | case WINED3DTSS_TCI_CAMERASPACENORMAL:
|
---|
3360 | /* Note that NV_TEXGEN_REFLECTION support is implied when
|
---|
3361 | * ARB_TEXTURE_CUBE_MAP is supported */
|
---|
3362 | if (!gl_info->supported[NV_TEXGEN_REFLECTION])
|
---|
3363 | {
|
---|
3364 | FIXME("WINED3DTSS_TCI_CAMERASPACENORMAL not supported.\n");
|
---|
3365 | break;
|
---|
3366 | }
|
---|
3367 |
|
---|
3368 | glMatrixMode(GL_MODELVIEW);
|
---|
3369 | glPushMatrix();
|
---|
3370 | glLoadIdentity();
|
---|
3371 | glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
---|
3372 | glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
---|
3373 | glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
---|
3374 | glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
---|
3375 | glPopMatrix();
|
---|
3376 | checkGLcall("WINED3DTSS_TCI_CAMERASPACENORMAL - Set eye plane.");
|
---|
3377 |
|
---|
3378 | glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
---|
3379 | glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
---|
3380 | glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
|
---|
3381 | checkGLcall("WINED3DTSS_TCI_CAMERASPACENORMAL - Set texgen mode.");
|
---|
3382 |
|
---|
3383 | glEnable(GL_TEXTURE_GEN_S);
|
---|
3384 | glEnable(GL_TEXTURE_GEN_T);
|
---|
3385 | glEnable(GL_TEXTURE_GEN_R);
|
---|
3386 | checkGLcall("WINED3DTSS_TCI_CAMERASPACENORMAL - Enable texgen.");
|
---|
3387 |
|
---|
3388 | break;
|
---|
3389 |
|
---|
3390 | case WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR:
|
---|
3391 | /* Note that NV_TEXGEN_REFLECTION support is implied when
|
---|
3392 | * ARB_TEXTURE_CUBE_MAP is supported */
|
---|
3393 | if (!gl_info->supported[NV_TEXGEN_REFLECTION])
|
---|
3394 | {
|
---|
3395 | FIXME("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR not supported.\n");
|
---|
3396 | break;
|
---|
3397 | }
|
---|
3398 |
|
---|
3399 | glMatrixMode(GL_MODELVIEW);
|
---|
3400 | glPushMatrix();
|
---|
3401 | glLoadIdentity();
|
---|
3402 | glTexGenfv(GL_S, GL_EYE_PLANE, s_plane);
|
---|
3403 | glTexGenfv(GL_T, GL_EYE_PLANE, t_plane);
|
---|
3404 | glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
|
---|
3405 | glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
|
---|
3406 | glPopMatrix();
|
---|
3407 | checkGLcall("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Set eye plane.");
|
---|
3408 |
|
---|
3409 | glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
---|
3410 | glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
---|
3411 | glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
|
---|
3412 | checkGLcall("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Set texgen mode.");
|
---|
3413 |
|
---|
3414 | glEnable(GL_TEXTURE_GEN_S);
|
---|
3415 | glEnable(GL_TEXTURE_GEN_T);
|
---|
3416 | glEnable(GL_TEXTURE_GEN_R);
|
---|
3417 | checkGLcall("WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR - Enable texgen.");
|
---|
3418 |
|
---|
3419 | break;
|
---|
3420 |
|
---|
3421 | case WINED3DTSS_TCI_SPHEREMAP:
|
---|
3422 | glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
---|
3423 | glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
---|
3424 | checkGLcall("WINED3DTSS_TCI_SPHEREMAP - Set texgen mode.");
|
---|
3425 |
|
---|
3426 | glEnable(GL_TEXTURE_GEN_S);
|
---|
3427 | glEnable(GL_TEXTURE_GEN_T);
|
---|
3428 | glDisable(GL_TEXTURE_GEN_R);
|
---|
3429 | checkGLcall("WINED3DTSS_TCI_SPHEREMAP - Enable texgen.");
|
---|
3430 |
|
---|
3431 | break;
|
---|
3432 |
|
---|
3433 | default:
|
---|
3434 | FIXME("Unhandled WINED3DTSS_TEXCOORDINDEX %#x\n",
|
---|
3435 | stateblock->textureState[stage][WINED3DTSS_TEXCOORDINDEX]);
|
---|
3436 | glDisable(GL_TEXTURE_GEN_S);
|
---|
3437 | glDisable(GL_TEXTURE_GEN_T);
|
---|
3438 | glDisable(GL_TEXTURE_GEN_R);
|
---|
3439 | glDisable(GL_TEXTURE_GEN_Q);
|
---|
3440 | checkGLcall("Disable texgen.");
|
---|
3441 |
|
---|
3442 | break;
|
---|
3443 | }
|
---|
3444 |
|
---|
3445 | /* Update the texture matrix */
|
---|
3446 | if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_TEXTURE0 + stage))) {
|
---|
3447 | transform_texture(STATE_TEXTURESTAGE(stage, WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
|
---|
3448 | }
|
---|
3449 |
|
---|
3450 | if(!isStateDirty(context, STATE_VDECL) && context->namedArraysLoaded) {
|
---|
3451 | /* Reload the arrays if we are using fixed function arrays to reflect the selected coord input
|
---|
3452 | * source. Call loadTexCoords directly because there is no need to reparse the vertex declaration
|
---|
3453 | * and do all the things linked to it
|
---|
3454 | * TODO: Tidy that up to reload only the arrays of the changed unit
|
---|
3455 | */
|
---|
3456 | GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
---|
3457 |
|
---|
3458 | unloadTexCoords(context);
|
---|
3459 | loadTexCoords(context, stateblock, &stateblock->device->strided_streams, &curVBO);
|
---|
3460 | }
|
---|
3461 | }
|
---|
3462 |
|
---|
3463 | static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3464 | {
|
---|
3465 | IWineD3DDeviceImpl *device = stateblock->device;
|
---|
3466 |
|
---|
3467 | /* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
|
---|
3468 | * has an update pending
|
---|
3469 | */
|
---|
3470 | if(isStateDirty(context, STATE_VDECL) ||
|
---|
3471 | isStateDirty(context, STATE_PIXELSHADER)) {
|
---|
3472 | return;
|
---|
3473 | }
|
---|
3474 |
|
---|
3475 | device->shader_backend->shader_load_constants(context, use_ps(stateblock), use_vs(stateblock));
|
---|
3476 | }
|
---|
3477 |
|
---|
3478 | static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3479 | {
|
---|
3480 | DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
---|
3481 |
|
---|
3482 | if (stateblock->pixelShader && stage != 0
|
---|
3483 | && (((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.reg_maps.luminanceparams & (1 << stage)))
|
---|
3484 | {
|
---|
3485 | /* The pixel shader has to know the luminance scale. Do a constants update if it
|
---|
3486 | * isn't scheduled anyway
|
---|
3487 | */
|
---|
3488 | if(!isStateDirty(context, STATE_PIXELSHADERCONSTANT) &&
|
---|
3489 | !isStateDirty(context, STATE_PIXELSHADER)) {
|
---|
3490 | shaderconstant(STATE_PIXELSHADERCONSTANT, stateblock, context);
|
---|
3491 | }
|
---|
3492 | }
|
---|
3493 | }
|
---|
3494 |
|
---|
3495 | static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3496 | {
|
---|
3497 | const DWORD sampler = state - STATE_SAMPLER(0);
|
---|
3498 | IWineD3DBaseTexture *texture = stateblock->textures[sampler];
|
---|
3499 |
|
---|
3500 | TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
|
---|
3501 |
|
---|
3502 | if(!texture) return;
|
---|
3503 | /* The fixed function np2 texture emulation uses the texture matrix to fix up the coordinates
|
---|
3504 | * basetexture_apply_state_changes() multiplies the set matrix with a fixup matrix. Before the
|
---|
3505 | * scaling is reapplied or removed, the texture matrix has to be reapplied
|
---|
3506 | *
|
---|
3507 | * The mapped stage is already active because the sampler() function below, which is part of the
|
---|
3508 | * misc pipeline
|
---|
3509 | */
|
---|
3510 | if(sampler < MAX_TEXTURES) {
|
---|
3511 | const BOOL texIsPow2 = !((IWineD3DBaseTextureImpl *)texture)->baseTexture.pow2Matrix_identity;
|
---|
3512 |
|
---|
3513 | if (texIsPow2 || (context->lastWasPow2Texture & (1 << sampler)))
|
---|
3514 | {
|
---|
3515 | if (texIsPow2) context->lastWasPow2Texture |= 1 << sampler;
|
---|
3516 | else context->lastWasPow2Texture &= ~(1 << sampler);
|
---|
3517 | transform_texture(STATE_TEXTURESTAGE(stateblock->device->texUnitMap[sampler],
|
---|
3518 | WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
|
---|
3519 | }
|
---|
3520 | }
|
---|
3521 | }
|
---|
3522 |
|
---|
3523 | static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3524 | {
|
---|
3525 | DWORD sampler = state - STATE_SAMPLER(0);
|
---|
3526 | DWORD mapped_stage = stateblock->device->texUnitMap[sampler];
|
---|
3527 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
3528 | union {
|
---|
3529 | float f;
|
---|
3530 | DWORD d;
|
---|
3531 | } tmpvalue;
|
---|
3532 |
|
---|
3533 | TRACE("Sampler: %d\n", sampler);
|
---|
3534 | /* Enabling and disabling texture dimensions is done by texture stage state / pixel shader setup, this function
|
---|
3535 | * only has to bind textures and set the per texture states
|
---|
3536 | */
|
---|
3537 |
|
---|
3538 | if (mapped_stage == WINED3D_UNMAPPED_STAGE)
|
---|
3539 | {
|
---|
3540 | TRACE("No sampler mapped to stage %d. Returning.\n", sampler);
|
---|
3541 | return;
|
---|
3542 | }
|
---|
3543 |
|
---|
3544 | if (mapped_stage >= gl_info->limits.combined_samplers)
|
---|
3545 | {
|
---|
3546 | return;
|
---|
3547 | }
|
---|
3548 | GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
---|
3549 | checkGLcall("glActiveTextureARB");
|
---|
3550 |
|
---|
3551 | if(stateblock->textures[sampler]) {
|
---|
3552 | BOOL srgb = stateblock->samplerState[sampler][WINED3DSAMP_SRGBTEXTURE];
|
---|
3553 | IWineD3DBaseTextureImpl *tex_impl = (IWineD3DBaseTextureImpl *) stateblock->textures[sampler];
|
---|
3554 | IWineD3DBaseTexture_BindTexture(stateblock->textures[sampler], srgb);
|
---|
3555 | basetexture_apply_state_changes(stateblock->textures[sampler],
|
---|
3556 | stateblock->textureState[sampler], stateblock->samplerState[sampler], gl_info);
|
---|
3557 |
|
---|
3558 | if (gl_info->supported[EXT_TEXTURE_LOD_BIAS])
|
---|
3559 | {
|
---|
3560 | tmpvalue.d = stateblock->samplerState[sampler][WINED3DSAMP_MIPMAPLODBIAS];
|
---|
3561 | glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
|
---|
3562 | GL_TEXTURE_LOD_BIAS_EXT,
|
---|
3563 | tmpvalue.f);
|
---|
3564 | checkGLcall("glTexEnvi(GL_TEXTURE_LOD_BIAS_EXT, ...)");
|
---|
3565 | }
|
---|
3566 |
|
---|
3567 | if (!use_ps(stateblock) && sampler < stateblock->lowest_disabled_stage)
|
---|
3568 | {
|
---|
3569 | if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
|
---|
3570 | /* If color keying is enabled update the alpha test, it depends on the existence
|
---|
3571 | * of a color key in stage 0
|
---|
3572 | */
|
---|
3573 | state_alpha(WINED3DRS_COLORKEYENABLE, stateblock, context);
|
---|
3574 | }
|
---|
3575 | }
|
---|
3576 |
|
---|
3577 | /* Trigger shader constant reloading (for NP2 texcoord fixup) */
|
---|
3578 | if (!tex_impl->baseTexture.pow2Matrix_identity)
|
---|
3579 | {
|
---|
3580 | IWineD3DDeviceImpl *d3ddevice = stateblock->device;
|
---|
3581 | d3ddevice->shader_backend->shader_load_np2fixup_constants(
|
---|
3582 | (IWineD3DDevice*)d3ddevice, use_ps(stateblock), use_vs(stateblock));
|
---|
3583 | }
|
---|
3584 | }
|
---|
3585 | else if (mapped_stage < gl_info->limits.textures)
|
---|
3586 | {
|
---|
3587 | if(sampler < stateblock->lowest_disabled_stage) {
|
---|
3588 | /* TODO: What should I do with pixel shaders here ??? */
|
---|
3589 | if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
|
---|
3590 | /* If color keying is enabled update the alpha test, it depends on the existence
|
---|
3591 | * of a color key in stage 0
|
---|
3592 | */
|
---|
3593 | state_alpha(WINED3DRS_COLORKEYENABLE, stateblock, context);
|
---|
3594 | }
|
---|
3595 | } /* Otherwise tex_colorop disables the stage */
|
---|
3596 | glBindTexture(GL_TEXTURE_2D, stateblock->device->dummyTextureName[sampler]);
|
---|
3597 | checkGLcall("glBindTexture(GL_TEXTURE_2D, stateblock->device->dummyTextureName[sampler])");
|
---|
3598 | }
|
---|
3599 | }
|
---|
3600 |
|
---|
3601 | void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3602 | {
|
---|
3603 | IWineD3DDeviceImpl *device = stateblock->device;
|
---|
3604 | BOOL use_pshader = use_ps(stateblock);
|
---|
3605 | BOOL use_vshader = use_vs(stateblock);
|
---|
3606 | int i;
|
---|
3607 |
|
---|
3608 | if (use_pshader) {
|
---|
3609 | if(!context->last_was_pshader) {
|
---|
3610 | /* Former draw without a pixel shader, some samplers
|
---|
3611 | * may be disabled because of WINED3DTSS_COLOROP = WINED3DTOP_DISABLE
|
---|
3612 | * make sure to enable them
|
---|
3613 | */
|
---|
3614 | for(i=0; i < MAX_FRAGMENT_SAMPLERS; i++) {
|
---|
3615 | if(!isStateDirty(context, STATE_SAMPLER(i))) {
|
---|
3616 | sampler(STATE_SAMPLER(i), stateblock, context);
|
---|
3617 | }
|
---|
3618 | }
|
---|
3619 | context->last_was_pshader = TRUE;
|
---|
3620 | } else {
|
---|
3621 | /* Otherwise all samplers were activated by the code above in earlier draws, or by sampler()
|
---|
3622 | * if a different texture was bound. I don't have to do anything.
|
---|
3623 | */
|
---|
3624 | }
|
---|
3625 | } else {
|
---|
3626 | /* Disabled the pixel shader - color ops weren't applied
|
---|
3627 | * while it was enabled, so re-apply them. */
|
---|
3628 | for (i = 0; i < context->gl_info->limits.texture_stages; ++i)
|
---|
3629 | {
|
---|
3630 | if (!isStateDirty(context, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP)))
|
---|
3631 | stateblock_apply_state(STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP), stateblock, context);
|
---|
3632 | }
|
---|
3633 | context->last_was_pshader = FALSE;
|
---|
3634 | }
|
---|
3635 |
|
---|
3636 | if(!isStateDirty(context, device->StateTable[STATE_VSHADER].representative)) {
|
---|
3637 | device->shader_backend->shader_select(context, use_pshader, use_vshader);
|
---|
3638 |
|
---|
3639 | if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (use_vshader || use_pshader)) {
|
---|
3640 | shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
|
---|
3641 | }
|
---|
3642 | }
|
---|
3643 | }
|
---|
3644 |
|
---|
3645 | static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3646 | {
|
---|
3647 | DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
|
---|
3648 | if (stateblock->pixelShader && stage != 0
|
---|
3649 | && (((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.reg_maps.bumpmat & (1 << stage)))
|
---|
3650 | {
|
---|
3651 | /* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled
|
---|
3652 | * anyway
|
---|
3653 | */
|
---|
3654 | if(!isStateDirty(context, STATE_PIXELSHADERCONSTANT) &&
|
---|
3655 | !isStateDirty(context, STATE_PIXELSHADER)) {
|
---|
3656 | shaderconstant(STATE_PIXELSHADERCONSTANT, stateblock, context);
|
---|
3657 | }
|
---|
3658 | }
|
---|
3659 | }
|
---|
3660 |
|
---|
3661 | static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3662 | {
|
---|
3663 | /* This function is called by transform_view below if the view matrix was changed too
|
---|
3664 | *
|
---|
3665 | * Deliberately no check if the vertex declaration is dirty because the vdecl state
|
---|
3666 | * does not always update the world matrix, only on a switch between transformed
|
---|
3667 | * and untransformed draws. It *may* happen that the world matrix is set 2 times during one
|
---|
3668 | * draw, but that should be rather rare and cheaper in total.
|
---|
3669 | */
|
---|
3670 | glMatrixMode(GL_MODELVIEW);
|
---|
3671 | checkGLcall("glMatrixMode");
|
---|
3672 |
|
---|
3673 | if(context->last_was_rhw) {
|
---|
3674 | glLoadIdentity();
|
---|
3675 | checkGLcall("glLoadIdentity()");
|
---|
3676 | } else {
|
---|
3677 | /* In the general case, the view matrix is the identity matrix */
|
---|
3678 | if (stateblock->device->view_ident)
|
---|
3679 | {
|
---|
3680 | glLoadMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
|
---|
3681 | checkGLcall("glLoadMatrixf");
|
---|
3682 | }
|
---|
3683 | else
|
---|
3684 | {
|
---|
3685 | glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
---|
3686 | checkGLcall("glLoadMatrixf");
|
---|
3687 | glMultMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
|
---|
3688 | checkGLcall("glMultMatrixf");
|
---|
3689 | }
|
---|
3690 | }
|
---|
3691 | }
|
---|
3692 |
|
---|
3693 | static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3694 | {
|
---|
3695 | UINT index = state - STATE_CLIPPLANE(0);
|
---|
3696 |
|
---|
3697 | if (isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW)) || index >= context->gl_info->limits.clipplanes)
|
---|
3698 | {
|
---|
3699 | return;
|
---|
3700 | }
|
---|
3701 |
|
---|
3702 | /* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */
|
---|
3703 | if(!use_vs(stateblock)) {
|
---|
3704 | glMatrixMode(GL_MODELVIEW);
|
---|
3705 | glPushMatrix();
|
---|
3706 | glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
---|
3707 | } else {
|
---|
3708 | /* with vertex shaders, clip planes are not transformed in direct3d,
|
---|
3709 | * in OpenGL they are still transformed by the model view.
|
---|
3710 | * Use this to swap the y coordinate if necessary
|
---|
3711 | */
|
---|
3712 | glMatrixMode(GL_MODELVIEW);
|
---|
3713 | glPushMatrix();
|
---|
3714 | glLoadIdentity();
|
---|
3715 | if (context->render_offscreen) glScalef(1.0f, -1.0f, 1.0f);
|
---|
3716 | }
|
---|
3717 |
|
---|
3718 | TRACE("Clipplane [%f,%f,%f,%f]\n",
|
---|
3719 | stateblock->clipplane[index][0],
|
---|
3720 | stateblock->clipplane[index][1],
|
---|
3721 | stateblock->clipplane[index][2],
|
---|
3722 | stateblock->clipplane[index][3]);
|
---|
3723 | glClipPlane(GL_CLIP_PLANE0 + index, stateblock->clipplane[index]);
|
---|
3724 | checkGLcall("glClipPlane");
|
---|
3725 |
|
---|
3726 | glPopMatrix();
|
---|
3727 | }
|
---|
3728 |
|
---|
3729 | static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3730 | {
|
---|
3731 | UINT matrix = state - STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0));
|
---|
3732 | GLenum glMat;
|
---|
3733 | TRACE("Setting world matrix %d\n", matrix);
|
---|
3734 |
|
---|
3735 | if (matrix >= context->gl_info->limits.blends)
|
---|
3736 | {
|
---|
3737 | WARN("Unsupported blend matrix set\n");
|
---|
3738 | return;
|
---|
3739 | } else if(isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW))) {
|
---|
3740 | return;
|
---|
3741 | }
|
---|
3742 |
|
---|
3743 | /* GL_MODELVIEW0_ARB: 0x1700
|
---|
3744 | * GL_MODELVIEW1_ARB: 0x850a
|
---|
3745 | * GL_MODELVIEW2_ARB: 0x8722
|
---|
3746 | * GL_MODELVIEW3_ARB: 0x8723
|
---|
3747 | * etc
|
---|
3748 | * GL_MODELVIEW31_ARB: 0x873F
|
---|
3749 | */
|
---|
3750 | if(matrix == 1) glMat = GL_MODELVIEW1_ARB;
|
---|
3751 | else glMat = GL_MODELVIEW2_ARB - 2 + matrix;
|
---|
3752 |
|
---|
3753 | glMatrixMode(glMat);
|
---|
3754 | checkGLcall("glMatrixMode(glMat)");
|
---|
3755 |
|
---|
3756 | /* World matrix 0 is multiplied with the view matrix because d3d uses 3 matrices while gl uses only 2. To avoid
|
---|
3757 | * weighting the view matrix incorrectly it has to be multiplied into every gl modelview matrix
|
---|
3758 | */
|
---|
3759 | if (stateblock->device->view_ident)
|
---|
3760 | {
|
---|
3761 | glLoadMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(matrix)].u.m[0][0]);
|
---|
3762 | checkGLcall("glLoadMatrixf");
|
---|
3763 | }
|
---|
3764 | else
|
---|
3765 | {
|
---|
3766 | glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
---|
3767 | checkGLcall("glLoadMatrixf");
|
---|
3768 | glMultMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(matrix)].u.m[0][0]);
|
---|
3769 | checkGLcall("glMultMatrixf");
|
---|
3770 | }
|
---|
3771 | }
|
---|
3772 |
|
---|
3773 | static void state_vertexblend_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3774 | {
|
---|
3775 | WINED3DVERTEXBLENDFLAGS f = stateblock->renderState[WINED3DRS_VERTEXBLEND];
|
---|
3776 | static unsigned int once;
|
---|
3777 |
|
---|
3778 | if (f == WINED3DVBF_DISABLE) return;
|
---|
3779 |
|
---|
3780 | if (!once++) FIXME("Vertex blend flags %#x not supported.\n", f);
|
---|
3781 | else WARN("Vertex blend flags %#x not supported.\n", f);
|
---|
3782 | }
|
---|
3783 |
|
---|
3784 | static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3785 | {
|
---|
3786 | WINED3DVERTEXBLENDFLAGS val = stateblock->renderState[WINED3DRS_VERTEXBLEND];
|
---|
3787 | static unsigned int once;
|
---|
3788 |
|
---|
3789 | switch(val) {
|
---|
3790 | case WINED3DVBF_1WEIGHTS:
|
---|
3791 | case WINED3DVBF_2WEIGHTS:
|
---|
3792 | case WINED3DVBF_3WEIGHTS:
|
---|
3793 | glEnable(GL_VERTEX_BLEND_ARB);
|
---|
3794 | checkGLcall("glEnable(GL_VERTEX_BLEND_ARB)");
|
---|
3795 |
|
---|
3796 | /* D3D adds one more matrix which has weight (1 - sum(weights)). This is enabled at context
|
---|
3797 | * creation with enabling GL_WEIGHT_SUM_UNITY_ARB.
|
---|
3798 | */
|
---|
3799 | GL_EXTCALL(glVertexBlendARB(stateblock->renderState[WINED3DRS_VERTEXBLEND] + 1));
|
---|
3800 |
|
---|
3801 | if (!stateblock->device->vertexBlendUsed)
|
---|
3802 | {
|
---|
3803 | unsigned int i;
|
---|
3804 | for (i = 1; i < context->gl_info->limits.blends; ++i)
|
---|
3805 | {
|
---|
3806 | if (!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i))))
|
---|
3807 | {
|
---|
3808 | transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i)), stateblock, context);
|
---|
3809 | }
|
---|
3810 | }
|
---|
3811 | stateblock->device->vertexBlendUsed = TRUE;
|
---|
3812 | }
|
---|
3813 | break;
|
---|
3814 |
|
---|
3815 | case WINED3DVBF_TWEENING:
|
---|
3816 | case WINED3DVBF_0WEIGHTS: /* Indexed vertex blending, not supported. */
|
---|
3817 | if (!once++) FIXME("Vertex blend flags %#x not supported.\n", val);
|
---|
3818 | else WARN("Vertex blend flags %#x not supported.\n", val);
|
---|
3819 | /* Fall through. */
|
---|
3820 | case WINED3DVBF_DISABLE:
|
---|
3821 | glDisable(GL_VERTEX_BLEND_ARB);
|
---|
3822 | checkGLcall("glDisable(GL_VERTEX_BLEND_ARB)");
|
---|
3823 | break;
|
---|
3824 | }
|
---|
3825 | }
|
---|
3826 |
|
---|
3827 | static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3828 | {
|
---|
3829 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
3830 | const struct wined3d_light_info *light = NULL;
|
---|
3831 | unsigned int k;
|
---|
3832 |
|
---|
3833 | /* If we are changing the View matrix, reset the light and clipping planes to the new view
|
---|
3834 | * NOTE: We have to reset the positions even if the light/plane is not currently
|
---|
3835 | * enabled, since the call to enable it will not reset the position.
|
---|
3836 | * NOTE2: Apparently texture transforms do NOT need reapplying
|
---|
3837 | */
|
---|
3838 |
|
---|
3839 | glMatrixMode(GL_MODELVIEW);
|
---|
3840 | checkGLcall("glMatrixMode(GL_MODELVIEW)");
|
---|
3841 | glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
---|
3842 | checkGLcall("glLoadMatrixf(...)");
|
---|
3843 |
|
---|
3844 | /* Reset lights. TODO: Call light apply func */
|
---|
3845 | for (k = 0; k < stateblock->device->maxConcurrentLights; ++k)
|
---|
3846 | {
|
---|
3847 | light = stateblock->activeLights[k];
|
---|
3848 | if(!light) continue;
|
---|
3849 | glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightPosn);
|
---|
3850 | checkGLcall("glLightfv posn");
|
---|
3851 | glLightfv(GL_LIGHT0 + light->glIndex, GL_SPOT_DIRECTION, light->lightDirn);
|
---|
3852 | checkGLcall("glLightfv dirn");
|
---|
3853 | }
|
---|
3854 |
|
---|
3855 | /* Reset Clipping Planes */
|
---|
3856 | for (k = 0; k < gl_info->limits.clipplanes; ++k)
|
---|
3857 | {
|
---|
3858 | if(!isStateDirty(context, STATE_CLIPPLANE(k))) {
|
---|
3859 | clipplane(STATE_CLIPPLANE(k), stateblock, context);
|
---|
3860 | }
|
---|
3861 | }
|
---|
3862 |
|
---|
3863 | if(context->last_was_rhw) {
|
---|
3864 | glLoadIdentity();
|
---|
3865 | checkGLcall("glLoadIdentity()");
|
---|
3866 | /* No need to update the world matrix, the identity is fine */
|
---|
3867 | return;
|
---|
3868 | }
|
---|
3869 |
|
---|
3870 | /* Call the world matrix state, this will apply the combined WORLD + VIEW matrix
|
---|
3871 | * No need to do it here if the state is scheduled for update.
|
---|
3872 | */
|
---|
3873 | if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)))) {
|
---|
3874 | transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock, context);
|
---|
3875 | }
|
---|
3876 |
|
---|
3877 | /* Avoid looping over a number of matrices if the app never used the functionality */
|
---|
3878 | if (stateblock->device->vertexBlendUsed)
|
---|
3879 | {
|
---|
3880 | for (k = 1; k < gl_info->limits.blends; ++k)
|
---|
3881 | {
|
---|
3882 | if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k)))) {
|
---|
3883 | transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k)), stateblock, context);
|
---|
3884 | }
|
---|
3885 | }
|
---|
3886 | }
|
---|
3887 | }
|
---|
3888 |
|
---|
3889 | static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
3890 | {
|
---|
3891 | glMatrixMode(GL_PROJECTION);
|
---|
3892 | checkGLcall("glMatrixMode(GL_PROJECTION)");
|
---|
3893 | glLoadIdentity();
|
---|
3894 | checkGLcall("glLoadIdentity");
|
---|
3895 |
|
---|
3896 | if (context->last_was_rhw)
|
---|
3897 | {
|
---|
3898 | double x = stateblock->viewport.X;
|
---|
3899 | double y = stateblock->viewport.Y;
|
---|
3900 | double w = stateblock->viewport.Width;
|
---|
3901 | double h = stateblock->viewport.Height;
|
---|
3902 |
|
---|
3903 | TRACE("Calling glOrtho with x %.8e, y %.8e, w %.8e, h %.8e.\n", x, y, w, h);
|
---|
3904 | if (context->render_offscreen)
|
---|
3905 | glOrtho(x, x + w, -y, -y - h, 0.0, -1.0);
|
---|
3906 | else
|
---|
3907 | glOrtho(x, x + w, y + h, y, 0.0, -1.0);
|
---|
3908 | checkGLcall("glOrtho");
|
---|
3909 |
|
---|
3910 | /* D3D texture coordinates are flipped compared to OpenGL ones, so
|
---|
3911 | * render everything upside down when rendering offscreen. */
|
---|
3912 | if (context->render_offscreen)
|
---|
3913 | {
|
---|
3914 | /* Window Coord 0 is the middle of the first pixel, so translate by 1/2 pixels */
|
---|
3915 | glTranslatef(63.0f / 128.0f, -63.0f / 128.0f, 0.0f);
|
---|
3916 | checkGLcall("glTranslatef(63.0f / 128.0f, -63.0f / 128.0f, 0.0f)");
|
---|
3917 | glScalef(1.0f, -1.0f, 1.0f);
|
---|
3918 | checkGLcall("glScalef");
|
---|
3919 | }
|
---|
3920 | else
|
---|
3921 | {
|
---|
3922 | /* Window Coord 0 is the middle of the first pixel, so translate by 1/2 pixels */
|
---|
3923 | glTranslatef(63.0f / 128.0f, 63.0f / 128.0f, 0.0f);
|
---|
3924 | checkGLcall("glTranslatef(63.0f / 128.0f, 63.0f / 128.0f, 0.0f)");
|
---|
3925 | }
|
---|
3926 | } else {
|
---|
3927 | /* The rule is that the window coordinate 0 does not correspond to the
|
---|
3928 | beginning of the first pixel, but the center of the first pixel.
|
---|
3929 | As a consequence if you want to correctly draw one line exactly from
|
---|
3930 | the left to the right end of the viewport (with all matrices set to
|
---|
3931 | be identity), the x coords of both ends of the line would be not
|
---|
3932 | -1 and 1 respectively but (-1-1/viewport_widh) and (1-1/viewport_width)
|
---|
3933 | instead.
|
---|
3934 |
|
---|
3935 | 1.0 / Width is used because the coord range goes from -1.0 to 1.0, then we
|
---|
3936 | divide by the Width/Height, so we need the half range(1.0) to translate by
|
---|
3937 | half a pixel.
|
---|
3938 |
|
---|
3939 | The other fun is that d3d's output z range after the transformation is [0;1],
|
---|
3940 | but opengl's is [-1;1]. Since the z buffer is in range [0;1] for both, gl
|
---|
3941 | scales [-1;1] to [0;1]. This would mean that we end up in [0.5;1] and loose a lot
|
---|
3942 | of Z buffer precision and the clear values do not match in the z test. Thus scale
|
---|
3943 | [0;1] to [-1;1], so when gl undoes that we utilize the full z range
|
---|
3944 | */
|
---|
3945 |
|
---|
3946 | /*
|
---|
3947 | * Careful with the order of operations here, we're essentially working backwards:
|
---|
3948 | * x = x + 1/w;
|
---|
3949 | * y = (y - 1/h) * flip;
|
---|
3950 | * z = z * 2 - 1;
|
---|
3951 | *
|
---|
3952 | * Becomes:
|
---|
3953 | * glTranslatef(0.0, 0.0, -1.0);
|
---|
3954 | * glScalef(1.0, 1.0, 2.0);
|
---|
3955 | *
|
---|
3956 | * glScalef(1.0, flip, 1.0);
|
---|
3957 | * glTranslatef(1/w, -1/h, 0.0);
|
---|
3958 | *
|
---|
3959 | * This is equivalent to:
|
---|
3960 | * glTranslatef(1/w, -flip/h, -1.0)
|
---|
3961 | * glScalef(1.0, flip, 2.0);
|
---|
3962 | */
|
---|
3963 |
|
---|
3964 | /* Translate by slightly less than a half pixel to force a top-left
|
---|
3965 | * filling convention. We want the difference to be large enough that
|
---|
3966 | * it doesn't get lost due to rounding inside the driver, but small
|
---|
3967 | * enough to prevent it from interfering with any anti-aliasing. */
|
---|
3968 | GLfloat xoffset = (63.0f / 64.0f) / stateblock->viewport.Width;
|
---|
3969 | GLfloat yoffset = -(63.0f / 64.0f) / stateblock->viewport.Height;
|
---|
3970 |
|
---|
3971 | if (context->render_offscreen)
|
---|
3972 | {
|
---|
3973 | /* D3D texture coordinates are flipped compared to OpenGL ones, so
|
---|
3974 | * render everything upside down when rendering offscreen. */
|
---|
3975 | glTranslatef(xoffset, -yoffset, -1.0f);
|
---|
3976 | checkGLcall("glTranslatef(xoffset, -yoffset, -1.0f)");
|
---|
3977 | glScalef(1.0f, -1.0f, 2.0f);
|
---|
3978 | } else {
|
---|
3979 | glTranslatef(xoffset, yoffset, -1.0f);
|
---|
3980 | checkGLcall("glTranslatef(xoffset, yoffset, -1.0f)");
|
---|
3981 | glScalef(1.0f, 1.0f, 2.0f);
|
---|
3982 | }
|
---|
3983 | checkGLcall("glScalef");
|
---|
3984 |
|
---|
3985 | glMultMatrixf(&stateblock->transforms[WINED3DTS_PROJECTION].u.m[0][0]);
|
---|
3986 | checkGLcall("glLoadMatrixf");
|
---|
3987 | }
|
---|
3988 | }
|
---|
3989 |
|
---|
3990 | /* This should match any arrays loaded in loadVertexData.
|
---|
3991 | * TODO: Only load / unload arrays if we have to.
|
---|
3992 | */
|
---|
3993 | static inline void unloadVertexData(const struct wined3d_context *context)
|
---|
3994 | {
|
---|
3995 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
3996 |
|
---|
3997 | glDisableClientState(GL_VERTEX_ARRAY);
|
---|
3998 | glDisableClientState(GL_NORMAL_ARRAY);
|
---|
3999 | glDisableClientState(GL_COLOR_ARRAY);
|
---|
4000 | if (gl_info->supported[EXT_SECONDARY_COLOR])
|
---|
4001 | {
|
---|
4002 | glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
---|
4003 | }
|
---|
4004 | if (gl_info->supported[ARB_VERTEX_BLEND])
|
---|
4005 | {
|
---|
4006 | glDisableClientState(GL_WEIGHT_ARRAY_ARB);
|
---|
4007 | }
|
---|
4008 | unloadTexCoords(context);
|
---|
4009 | }
|
---|
4010 |
|
---|
4011 | static inline void unload_numbered_array(IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context, int i)
|
---|
4012 | {
|
---|
4013 | GL_EXTCALL(glDisableVertexAttribArrayARB(i));
|
---|
4014 | checkGLcall("glDisableVertexAttribArrayARB(reg)");
|
---|
4015 |
|
---|
4016 | context->numbered_array_mask &= ~(1 << i);
|
---|
4017 | }
|
---|
4018 |
|
---|
4019 | /* This should match any arrays loaded in loadNumberedArrays
|
---|
4020 | * TODO: Only load / unload arrays if we have to.
|
---|
4021 | */
|
---|
4022 | static inline void unloadNumberedArrays(IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4023 | {
|
---|
4024 | /* disable any attribs (this is the same for both GLSL and ARB modes) */
|
---|
4025 | GLint maxAttribs = 16;
|
---|
4026 | int i;
|
---|
4027 |
|
---|
4028 | /* Leave all the attribs disabled */
|
---|
4029 | glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &maxAttribs);
|
---|
4030 | /* MESA does not support it right not */
|
---|
4031 | if (glGetError() != GL_NO_ERROR)
|
---|
4032 | maxAttribs = 16;
|
---|
4033 | for (i = 0; i < maxAttribs; ++i) {
|
---|
4034 | unload_numbered_array(stateblock, context, i);
|
---|
4035 | }
|
---|
4036 | }
|
---|
4037 |
|
---|
4038 | static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
|
---|
4039 | const struct wined3d_stream_info *stream_info, struct wined3d_context *context)
|
---|
4040 | {
|
---|
4041 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
4042 | GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
---|
4043 | int i;
|
---|
4044 | const UINT *offset = stateblock->streamOffset;
|
---|
4045 | struct wined3d_buffer *vb;
|
---|
4046 | DWORD_PTR shift_index;
|
---|
4047 |
|
---|
4048 | /* Default to no instancing */
|
---|
4049 | stateblock->device->instancedDraw = FALSE;
|
---|
4050 |
|
---|
4051 | for (i = 0; i < MAX_ATTRIBS; i++) {
|
---|
4052 | if (!(stream_info->use_map & (1 << i)))
|
---|
4053 | {
|
---|
4054 | if (context->numbered_array_mask & (1 << i)) unload_numbered_array(stateblock, context, i);
|
---|
4055 | continue;
|
---|
4056 | }
|
---|
4057 |
|
---|
4058 | /* Do not load instance data. It will be specified using glTexCoord by drawprim */
|
---|
4059 | if (stateblock->streamFlags[stream_info->elements[i].stream_idx] & WINED3DSTREAMSOURCE_INSTANCEDATA)
|
---|
4060 | {
|
---|
4061 | if (context->numbered_array_mask & (1 << i)) unload_numbered_array(stateblock, context, i);
|
---|
4062 | stateblock->device->instancedDraw = TRUE;
|
---|
4063 | continue;
|
---|
4064 | }
|
---|
4065 |
|
---|
4066 | TRACE_(d3d_shader)("Loading array %u [VBO=%u]\n", i, stream_info->elements[i].buffer_object);
|
---|
4067 |
|
---|
4068 | if (stream_info->elements[i].stride)
|
---|
4069 | {
|
---|
4070 | if (curVBO != stream_info->elements[i].buffer_object)
|
---|
4071 | {
|
---|
4072 | GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, stream_info->elements[i].buffer_object));
|
---|
4073 | checkGLcall("glBindBufferARB");
|
---|
4074 | curVBO = stream_info->elements[i].buffer_object;
|
---|
4075 | }
|
---|
4076 | vb = (struct wined3d_buffer *)stateblock->streamSource[stream_info->elements[i].stream_idx];
|
---|
4077 | /* Use the VBO to find out if a vertex buffer exists, not the vb pointer. vb can point to a
|
---|
4078 | * user pointer data blob. In that case curVBO will be 0. If there is a vertex buffer but no
|
---|
4079 | * vbo we won't be load converted attributes anyway
|
---|
4080 | */
|
---|
4081 | if (curVBO && vb->conversion_shift)
|
---|
4082 | {
|
---|
4083 | TRACE("Loading attribute from shifted buffer\n");
|
---|
4084 | TRACE("Attrib %d has original stride %d, new stride %d\n",
|
---|
4085 | i, stream_info->elements[i].stride, vb->conversion_stride);
|
---|
4086 | TRACE("Original offset %p, additional offset 0x%08x\n",
|
---|
4087 | stream_info->elements[i].data, vb->conversion_shift[(DWORD_PTR)stream_info->elements[i].data]);
|
---|
4088 | TRACE("Opengl type %#x\n", stream_info->elements[i].format_desc->gl_vtx_type);
|
---|
4089 | shift_index = ((DWORD_PTR)stream_info->elements[i].data + offset[stream_info->elements[i].stream_idx]);
|
---|
4090 | shift_index = shift_index % stream_info->elements[i].stride;
|
---|
4091 | GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format_desc->gl_vtx_format,
|
---|
4092 | stream_info->elements[i].format_desc->gl_vtx_type,
|
---|
4093 | stream_info->elements[i].format_desc->gl_normalized,
|
---|
4094 | vb->conversion_stride, stream_info->elements[i].data + vb->conversion_shift[shift_index]
|
---|
4095 | + stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
---|
4096 | + offset[stream_info->elements[i].stream_idx]));
|
---|
4097 |
|
---|
4098 | } else {
|
---|
4099 | GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format_desc->gl_vtx_format,
|
---|
4100 | stream_info->elements[i].format_desc->gl_vtx_type,
|
---|
4101 | stream_info->elements[i].format_desc->gl_normalized,
|
---|
4102 | stream_info->elements[i].stride, stream_info->elements[i].data
|
---|
4103 | + stateblock->loadBaseVertexIndex * stream_info->elements[i].stride
|
---|
4104 | + offset[stream_info->elements[i].stream_idx]));
|
---|
4105 | }
|
---|
4106 |
|
---|
4107 | if (!(context->numbered_array_mask & (1 << i)))
|
---|
4108 | {
|
---|
4109 | GL_EXTCALL(glEnableVertexAttribArrayARB(i));
|
---|
4110 | context->numbered_array_mask |= (1 << i);
|
---|
4111 | }
|
---|
4112 | } else {
|
---|
4113 | /* Stride = 0 means always the same values. glVertexAttribPointerARB doesn't do that. Instead disable the pointer and
|
---|
4114 | * set up the attribute statically. But we have to figure out the system memory address.
|
---|
4115 | */
|
---|
4116 | const BYTE *ptr = stream_info->elements[i].data + offset[stream_info->elements[i].stream_idx];
|
---|
4117 | if (stream_info->elements[i].buffer_object)
|
---|
4118 | {
|
---|
4119 | vb = (struct wined3d_buffer *)stateblock->streamSource[stream_info->elements[i].stream_idx];
|
---|
4120 | ptr += (long) buffer_get_sysmem(vb);
|
---|
4121 | }
|
---|
4122 |
|
---|
4123 | if (context->numbered_array_mask & (1 << i)) unload_numbered_array(stateblock, context, i);
|
---|
4124 |
|
---|
4125 | switch (stream_info->elements[i].format_desc->format)
|
---|
4126 | {
|
---|
4127 | case WINED3DFMT_R32_FLOAT:
|
---|
4128 | GL_EXTCALL(glVertexAttrib1fvARB(i, (const GLfloat *)ptr));
|
---|
4129 | break;
|
---|
4130 | case WINED3DFMT_R32G32_FLOAT:
|
---|
4131 | GL_EXTCALL(glVertexAttrib2fvARB(i, (const GLfloat *)ptr));
|
---|
4132 | break;
|
---|
4133 | case WINED3DFMT_R32G32B32_FLOAT:
|
---|
4134 | GL_EXTCALL(glVertexAttrib3fvARB(i, (const GLfloat *)ptr));
|
---|
4135 | break;
|
---|
4136 | case WINED3DFMT_R32G32B32A32_FLOAT:
|
---|
4137 | GL_EXTCALL(glVertexAttrib4fvARB(i, (const GLfloat *)ptr));
|
---|
4138 | break;
|
---|
4139 |
|
---|
4140 | case WINED3DFMT_R8G8B8A8_UINT:
|
---|
4141 | GL_EXTCALL(glVertexAttrib4NubvARB(i, ptr));
|
---|
4142 | break;
|
---|
4143 | case WINED3DFMT_B8G8R8A8_UNORM:
|
---|
4144 | if (gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
|
---|
4145 | {
|
---|
4146 | const DWORD *src = (const DWORD *)ptr;
|
---|
4147 | DWORD c = *src & 0xff00ff00;
|
---|
4148 | c |= (*src & 0xff0000) >> 16;
|
---|
4149 | c |= (*src & 0xff) << 16;
|
---|
4150 | GL_EXTCALL(glVertexAttrib4NubvARB(i, (GLubyte *)&c));
|
---|
4151 | break;
|
---|
4152 | }
|
---|
4153 | /* else fallthrough */
|
---|
4154 | case WINED3DFMT_R8G8B8A8_UNORM:
|
---|
4155 | GL_EXTCALL(glVertexAttrib4NubvARB(i, ptr));
|
---|
4156 | break;
|
---|
4157 |
|
---|
4158 | case WINED3DFMT_R16G16_SINT:
|
---|
4159 | GL_EXTCALL(glVertexAttrib4svARB(i, (const GLshort *)ptr));
|
---|
4160 | break;
|
---|
4161 | case WINED3DFMT_R16G16B16A16_SINT:
|
---|
4162 | GL_EXTCALL(glVertexAttrib4svARB(i, (const GLshort *)ptr));
|
---|
4163 | break;
|
---|
4164 |
|
---|
4165 | case WINED3DFMT_R16G16_SNORM:
|
---|
4166 | {
|
---|
4167 | const GLshort s[4] = {((const GLshort *)ptr)[0], ((const GLshort *)ptr)[1], 0, 1};
|
---|
4168 | GL_EXTCALL(glVertexAttrib4NsvARB(i, s));
|
---|
4169 | break;
|
---|
4170 | }
|
---|
4171 | case WINED3DFMT_R16G16_UNORM:
|
---|
4172 | {
|
---|
4173 | const GLushort s[4] = {((const GLushort *)ptr)[0], ((const GLushort *)ptr)[1], 0, 1};
|
---|
4174 | GL_EXTCALL(glVertexAttrib4NusvARB(i, s));
|
---|
4175 | break;
|
---|
4176 | }
|
---|
4177 | case WINED3DFMT_R16G16B16A16_SNORM:
|
---|
4178 | GL_EXTCALL(glVertexAttrib4NsvARB(i, (const GLshort *)ptr));
|
---|
4179 | break;
|
---|
4180 | case WINED3DFMT_R16G16B16A16_UNORM:
|
---|
4181 | GL_EXTCALL(glVertexAttrib4NusvARB(i, (const GLushort *)ptr));
|
---|
4182 | break;
|
---|
4183 |
|
---|
4184 | case WINED3DFMT_R10G10B10A2_UINT:
|
---|
4185 | FIXME("Unsure about WINED3DDECLTYPE_UDEC3\n");
|
---|
4186 | /*glVertexAttrib3usvARB(i, (const GLushort *)ptr); Does not exist */
|
---|
4187 | break;
|
---|
4188 | case WINED3DFMT_R10G10B10A2_SNORM:
|
---|
4189 | FIXME("Unsure about WINED3DDECLTYPE_DEC3N\n");
|
---|
4190 | /*glVertexAttrib3NusvARB(i, (const GLushort *)ptr); Does not exist */
|
---|
4191 | break;
|
---|
4192 |
|
---|
4193 | case WINED3DFMT_R16G16_FLOAT:
|
---|
4194 | /* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4
|
---|
4195 | * byte float according to the IEEE standard
|
---|
4196 | */
|
---|
4197 | FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_2\n");
|
---|
4198 | break;
|
---|
4199 | case WINED3DFMT_R16G16B16A16_FLOAT:
|
---|
4200 | FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_4\n");
|
---|
4201 | break;
|
---|
4202 |
|
---|
4203 | default:
|
---|
4204 | ERR("Unexpected declaration in stride 0 attributes\n");
|
---|
4205 | break;
|
---|
4206 |
|
---|
4207 | }
|
---|
4208 | }
|
---|
4209 | }
|
---|
4210 | checkGLcall("Loading numbered arrays");
|
---|
4211 | }
|
---|
4212 |
|
---|
4213 | /* Used from 2 different functions, and too big to justify making it inlined */
|
---|
4214 | static void loadVertexData(const struct wined3d_context *context, IWineD3DStateBlockImpl *stateblock,
|
---|
4215 | const struct wined3d_stream_info *si)
|
---|
4216 | {
|
---|
4217 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
4218 | const UINT *offset = stateblock->streamOffset;
|
---|
4219 | GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
|
---|
4220 | const struct wined3d_stream_info_element *e;
|
---|
4221 |
|
---|
4222 | TRACE("Using fast vertex array code\n");
|
---|
4223 |
|
---|
4224 | /* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */
|
---|
4225 | stateblock->device->instancedDraw = FALSE;
|
---|
4226 |
|
---|
4227 | /* Blend Data ---------------------------------------------- */
|
---|
4228 | if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT))
|
---|
4229 | || si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|
---|
4230 | {
|
---|
4231 | e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
|
---|
4232 |
|
---|
4233 | if (gl_info->supported[ARB_VERTEX_BLEND])
|
---|
4234 | {
|
---|
4235 | TRACE("Blend %d %p %d\n", e->format_desc->component_count,
|
---|
4236 | e->data + stateblock->loadBaseVertexIndex * e->stride, e->stride + offset[e->stream_idx]);
|
---|
4237 |
|
---|
4238 | glEnableClientState(GL_WEIGHT_ARRAY_ARB);
|
---|
4239 | checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)");
|
---|
4240 |
|
---|
4241 | GL_EXTCALL(glVertexBlendARB(e->format_desc->component_count + 1));
|
---|
4242 |
|
---|
4243 | if (curVBO != e->buffer_object)
|
---|
4244 | {
|
---|
4245 | GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
---|
4246 | checkGLcall("glBindBufferARB");
|
---|
4247 | curVBO = e->buffer_object;
|
---|
4248 | }
|
---|
4249 |
|
---|
4250 | TRACE("glWeightPointerARB(%#x, %#x, %#x, %p);\n",
|
---|
4251 | e->format_desc->gl_vtx_format,
|
---|
4252 | e->format_desc->gl_vtx_type,
|
---|
4253 | e->stride,
|
---|
4254 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4255 | GL_EXTCALL(glWeightPointerARB(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
---|
4256 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
---|
4257 |
|
---|
4258 | checkGLcall("glWeightPointerARB");
|
---|
4259 |
|
---|
4260 | if (si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|
---|
4261 | {
|
---|
4262 | static BOOL warned;
|
---|
4263 | if (!warned)
|
---|
4264 | {
|
---|
4265 | FIXME("blendMatrixIndices support\n");
|
---|
4266 | warned = TRUE;
|
---|
4267 | }
|
---|
4268 | }
|
---|
4269 | } else {
|
---|
4270 | /* TODO: support blends in drawStridedSlow
|
---|
4271 | * No need to write a FIXME here, this is done after the general vertex decl decoding
|
---|
4272 | */
|
---|
4273 | WARN("unsupported blending in openGl\n");
|
---|
4274 | }
|
---|
4275 | }
|
---|
4276 | else
|
---|
4277 | {
|
---|
4278 | if (gl_info->supported[ARB_VERTEX_BLEND])
|
---|
4279 | {
|
---|
4280 | static const GLbyte one = 1;
|
---|
4281 | GL_EXTCALL(glWeightbvARB(1, &one));
|
---|
4282 | checkGLcall("glWeightivARB(gl_info->max_blends, weights)");
|
---|
4283 | }
|
---|
4284 | }
|
---|
4285 |
|
---|
4286 | /* Point Size ----------------------------------------------*/
|
---|
4287 | if (si->use_map & (1 << WINED3D_FFP_PSIZE))
|
---|
4288 | {
|
---|
4289 | /* no such functionality in the fixed function GL pipeline */
|
---|
4290 | TRACE("Cannot change ptSize here in openGl\n");
|
---|
4291 | /* TODO: Implement this function in using shaders if they are available */
|
---|
4292 | }
|
---|
4293 |
|
---|
4294 | /* Vertex Pointers -----------------------------------------*/
|
---|
4295 | if (si->use_map & (1 << WINED3D_FFP_POSITION))
|
---|
4296 | {
|
---|
4297 | e = &si->elements[WINED3D_FFP_POSITION];
|
---|
4298 | if (curVBO != e->buffer_object)
|
---|
4299 | {
|
---|
4300 | GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
---|
4301 | checkGLcall("glBindBufferARB");
|
---|
4302 | curVBO = e->buffer_object;
|
---|
4303 | }
|
---|
4304 |
|
---|
4305 | /* min(WINED3D_ATR_FORMAT(position),3) to Disable RHW mode as 'w' coord
|
---|
4306 | handling for rhw mode should not impact screen position whereas in GL it does.
|
---|
4307 | This may result in very slightly distorted textures in rhw mode.
|
---|
4308 | There's always the other option of fixing the view matrix to
|
---|
4309 | prevent w from having any effect.
|
---|
4310 |
|
---|
4311 | This only applies to user pointer sources, in VBOs the vertices are fixed up
|
---|
4312 | */
|
---|
4313 | if (!e->buffer_object)
|
---|
4314 | {
|
---|
4315 | TRACE("glVertexPointer(3, %#x, %#x, %p);\n", e->format_desc->gl_vtx_type, e->stride,
|
---|
4316 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4317 | glVertexPointer(3 /* min(e->format_desc->gl_vtx_format, 3) */, e->format_desc->gl_vtx_type, e->stride,
|
---|
4318 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4319 | }
|
---|
4320 | else
|
---|
4321 | {
|
---|
4322 | TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n",
|
---|
4323 | e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
---|
4324 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4325 | glVertexPointer(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
---|
4326 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4327 | }
|
---|
4328 | checkGLcall("glVertexPointer(...)");
|
---|
4329 | glEnableClientState(GL_VERTEX_ARRAY);
|
---|
4330 | checkGLcall("glEnableClientState(GL_VERTEX_ARRAY)");
|
---|
4331 | }
|
---|
4332 |
|
---|
4333 | /* Normals -------------------------------------------------*/
|
---|
4334 | if (si->use_map & (1 << WINED3D_FFP_NORMAL))
|
---|
4335 | {
|
---|
4336 | e = &si->elements[WINED3D_FFP_NORMAL];
|
---|
4337 | if (curVBO != e->buffer_object)
|
---|
4338 | {
|
---|
4339 | GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
---|
4340 | checkGLcall("glBindBufferARB");
|
---|
4341 | curVBO = e->buffer_object;
|
---|
4342 | }
|
---|
4343 |
|
---|
4344 | TRACE("glNormalPointer(%#x, %#x, %p);\n", e->format_desc->gl_vtx_type, e->stride,
|
---|
4345 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4346 | glNormalPointer(e->format_desc->gl_vtx_type, e->stride,
|
---|
4347 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4348 | checkGLcall("glNormalPointer(...)");
|
---|
4349 | glEnableClientState(GL_NORMAL_ARRAY);
|
---|
4350 | checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
|
---|
4351 |
|
---|
4352 | } else {
|
---|
4353 | glNormal3f(0, 0, 0);
|
---|
4354 | checkGLcall("glNormal3f(0, 0, 0)");
|
---|
4355 | }
|
---|
4356 |
|
---|
4357 | /* Diffuse Colour --------------------------------------------*/
|
---|
4358 | /* WARNING: Data here MUST be in RGBA format, so cannot */
|
---|
4359 | /* go directly into fast mode from app pgm, because */
|
---|
4360 | /* directx requires data in BGRA format. */
|
---|
4361 | /* currently fixupVertices swizzles the format, but this isn't*/
|
---|
4362 | /* very practical when using VBOs */
|
---|
4363 | /* NOTE: Unless we write a vertex shader to swizzle the colour*/
|
---|
4364 | /* , or the user doesn't care and wants the speed advantage */
|
---|
4365 |
|
---|
4366 | if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
|
---|
4367 | {
|
---|
4368 | e = &si->elements[WINED3D_FFP_DIFFUSE];
|
---|
4369 | if (curVBO != e->buffer_object)
|
---|
4370 | {
|
---|
4371 | GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
---|
4372 | checkGLcall("glBindBufferARB");
|
---|
4373 | curVBO = e->buffer_object;
|
---|
4374 | }
|
---|
4375 |
|
---|
4376 | TRACE("glColorPointer(%#x, %#x %#x, %p);\n",
|
---|
4377 | e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
---|
4378 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4379 | glColorPointer(e->format_desc->gl_vtx_format, e->format_desc->gl_vtx_type, e->stride,
|
---|
4380 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4381 | checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
|
---|
4382 | glEnableClientState(GL_COLOR_ARRAY);
|
---|
4383 | checkGLcall("glEnableClientState(GL_COLOR_ARRAY)");
|
---|
4384 |
|
---|
4385 | } else {
|
---|
4386 | glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
---|
4387 | checkGLcall("glColor4f(1, 1, 1, 1)");
|
---|
4388 | }
|
---|
4389 |
|
---|
4390 | /* Specular Colour ------------------------------------------*/
|
---|
4391 | if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
|
---|
4392 | {
|
---|
4393 | TRACE("setting specular colour\n");
|
---|
4394 |
|
---|
4395 | e = &si->elements[WINED3D_FFP_SPECULAR];
|
---|
4396 | if (gl_info->supported[EXT_SECONDARY_COLOR])
|
---|
4397 | {
|
---|
4398 | GLenum type = e->format_desc->gl_vtx_type;
|
---|
4399 | GLint format = e->format_desc->gl_vtx_format;
|
---|
4400 |
|
---|
4401 | if (curVBO != e->buffer_object)
|
---|
4402 | {
|
---|
4403 | GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
|
---|
4404 | checkGLcall("glBindBufferARB");
|
---|
4405 | curVBO = e->buffer_object;
|
---|
4406 | }
|
---|
4407 |
|
---|
4408 | if (format != 4 || (gl_info->quirks & WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA))
|
---|
4409 | {
|
---|
4410 | /* Usually specular colors only allow 3 components, since they have no alpha. In D3D, the specular alpha
|
---|
4411 | * contains the fog coordinate, which is passed to GL with GL_EXT_fog_coord. However, the fixed function
|
---|
4412 | * vertex pipeline can pass the specular alpha through, and pixel shaders can read it. So it GL accepts
|
---|
4413 | * 4 component secondary colors use it
|
---|
4414 | */
|
---|
4415 | TRACE("glSecondaryColorPointer(%#x, %#x, %#x, %p);\n", format, type, e->stride,
|
---|
4416 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4417 | GL_EXTCALL(glSecondaryColorPointerEXT(format, type, e->stride,
|
---|
4418 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
---|
4419 | checkGLcall("glSecondaryColorPointerEXT(format, type, ...)");
|
---|
4420 | }
|
---|
4421 | else
|
---|
4422 | {
|
---|
4423 | switch(type)
|
---|
4424 | {
|
---|
4425 | case GL_UNSIGNED_BYTE:
|
---|
4426 | TRACE("glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, %#x, %p);\n", e->stride,
|
---|
4427 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4428 | GL_EXTCALL(glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, e->stride,
|
---|
4429 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
---|
4430 | checkGLcall("glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, ...)");
|
---|
4431 | break;
|
---|
4432 |
|
---|
4433 | default:
|
---|
4434 | FIXME("Add 4 component specular color pointers for type %x\n", type);
|
---|
4435 | /* Make sure that the right color component is dropped */
|
---|
4436 | TRACE("glSecondaryColorPointer(3, %#x, %#x, %p);\n", type, e->stride,
|
---|
4437 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]);
|
---|
4438 | GL_EXTCALL(glSecondaryColorPointerEXT(3, type, e->stride,
|
---|
4439 | e->data + stateblock->loadBaseVertexIndex * e->stride + offset[e->stream_idx]));
|
---|
4440 | checkGLcall("glSecondaryColorPointerEXT(3, type, ...)");
|
---|
4441 | }
|
---|
4442 | }
|
---|
4443 | glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
---|
4444 | checkGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)");
|
---|
4445 | }
|
---|
4446 | else
|
---|
4447 | {
|
---|
4448 | WARN("Specular colour is not supported in this GL implementation.\n");
|
---|
4449 | }
|
---|
4450 | }
|
---|
4451 | else
|
---|
4452 | {
|
---|
4453 | if (gl_info->supported[EXT_SECONDARY_COLOR])
|
---|
4454 | {
|
---|
4455 | GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
|
---|
4456 | checkGLcall("glSecondaryColor3fEXT(0, 0, 0)");
|
---|
4457 | }
|
---|
4458 | else
|
---|
4459 | {
|
---|
4460 | WARN("Specular colour is not supported in this GL implementation.\n");
|
---|
4461 | }
|
---|
4462 | }
|
---|
4463 |
|
---|
4464 | /* Texture coords -------------------------------------------*/
|
---|
4465 | loadTexCoords(context, stateblock, si, &curVBO);
|
---|
4466 | }
|
---|
4467 |
|
---|
4468 | static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4469 | {
|
---|
4470 | IWineD3DDeviceImpl *device = stateblock->device;
|
---|
4471 | BOOL load_numbered = use_vs(stateblock) && !device->useDrawStridedSlow;
|
---|
4472 | BOOL load_named = !use_vs(stateblock) && !device->useDrawStridedSlow;
|
---|
4473 |
|
---|
4474 | if (context->numberedArraysLoaded && !load_numbered)
|
---|
4475 | {
|
---|
4476 | unloadNumberedArrays(stateblock, context);
|
---|
4477 | context->numberedArraysLoaded = FALSE;
|
---|
4478 | context->numbered_array_mask = 0;
|
---|
4479 | }
|
---|
4480 | else if (context->namedArraysLoaded)
|
---|
4481 | {
|
---|
4482 | unloadVertexData(context);
|
---|
4483 | context->namedArraysLoaded = FALSE;
|
---|
4484 | }
|
---|
4485 |
|
---|
4486 | if (load_numbered)
|
---|
4487 | {
|
---|
4488 | TRACE("Loading numbered arrays\n");
|
---|
4489 | loadNumberedArrays(stateblock, &device->strided_streams, context);
|
---|
4490 | context->numberedArraysLoaded = TRUE;
|
---|
4491 | }
|
---|
4492 | else if (load_named)
|
---|
4493 | {
|
---|
4494 | TRACE("Loading vertex data\n");
|
---|
4495 | loadVertexData(context, stateblock, &device->strided_streams);
|
---|
4496 | context->namedArraysLoaded = TRUE;
|
---|
4497 | }
|
---|
4498 | }
|
---|
4499 |
|
---|
4500 | static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4501 | {
|
---|
4502 | const struct wined3d_gl_info *gl_info = context->gl_info;
|
---|
4503 | BOOL updateFog = FALSE;
|
---|
4504 | BOOL useVertexShaderFunction = use_vs(stateblock);
|
---|
4505 | BOOL usePixelShaderFunction = use_ps(stateblock);
|
---|
4506 | IWineD3DDeviceImpl *device = stateblock->device;
|
---|
4507 | BOOL transformed;
|
---|
4508 | BOOL wasrhw = context->last_was_rhw;
|
---|
4509 | unsigned int i;
|
---|
4510 |
|
---|
4511 | transformed = device->strided_streams.position_transformed;
|
---|
4512 | if(transformed != context->last_was_rhw && !useVertexShaderFunction) {
|
---|
4513 | updateFog = TRUE;
|
---|
4514 | }
|
---|
4515 |
|
---|
4516 | /* Reapply lighting if it is not scheduled for reapplication already */
|
---|
4517 | if(!isStateDirty(context, STATE_RENDER(WINED3DRS_LIGHTING))) {
|
---|
4518 | state_lighting(STATE_RENDER(WINED3DRS_LIGHTING), stateblock, context);
|
---|
4519 | }
|
---|
4520 |
|
---|
4521 | if (transformed) {
|
---|
4522 | context->last_was_rhw = TRUE;
|
---|
4523 | } else {
|
---|
4524 |
|
---|
4525 | /* Untransformed, so relies on the view and projection matrices */
|
---|
4526 | context->last_was_rhw = FALSE;
|
---|
4527 | /* This turns off the Z scale trick to 'disable' viewport frustum clipping in rhw mode*/
|
---|
4528 | device->untransformed = TRUE;
|
---|
4529 |
|
---|
4530 | /* Todo for sw shaders: Vertex Shader output is already transformed, so set up identity matrices
|
---|
4531 | * Not needed as long as only hw shaders are supported
|
---|
4532 | */
|
---|
4533 |
|
---|
4534 | /* This sets the shader output position correction constants.
|
---|
4535 | * TODO: Move to the viewport state
|
---|
4536 | */
|
---|
4537 | if (useVertexShaderFunction)
|
---|
4538 | {
|
---|
4539 | GLfloat yoffset = -(63.0f / 64.0f) / stateblock->viewport.Height;
|
---|
4540 | #if !defined(VBOX_WITH_WDDM) || !defined(DEBUG_leo)
|
---|
4541 | device->posFixup[1] = context->render_offscreen ? -1.0f : 1.0f;
|
---|
4542 | #else
|
---|
4543 | device->posFixup[1] = context->render_offscreen ? -1.0f : 1.0f;
|
---|
4544 | #endif
|
---|
4545 | device->posFixup[3] = device->posFixup[1] * yoffset;
|
---|
4546 | }
|
---|
4547 | }
|
---|
4548 |
|
---|
4549 | /* Don't have to apply the matrices when vertex shaders are used. When vshaders are turned
|
---|
4550 | * off this function will be called again anyway to make sure they're properly set
|
---|
4551 | */
|
---|
4552 | if(!useVertexShaderFunction) {
|
---|
4553 | /* TODO: Move this mainly to the viewport state and only apply when the vp has changed
|
---|
4554 | * or transformed / untransformed was switched
|
---|
4555 | */
|
---|
4556 | if(wasrhw != context->last_was_rhw &&
|
---|
4557 | !isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION)) &&
|
---|
4558 | !isStateDirty(context, STATE_VIEWPORT)) {
|
---|
4559 | transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
|
---|
4560 | }
|
---|
4561 | /* World matrix needs reapplication here only if we're switching between rhw and non-rhw
|
---|
4562 | * mode.
|
---|
4563 | *
|
---|
4564 | * If a vertex shader is used, the world matrix changed and then vertex shader unbound
|
---|
4565 | * this check will fail and the matrix not applied again. This is OK because a simple
|
---|
4566 | * world matrix change reapplies the matrix - These checks here are only to satisfy the
|
---|
4567 | * needs of the vertex declaration.
|
---|
4568 | *
|
---|
4569 | * World and view matrix go into the same gl matrix, so only apply them when neither is
|
---|
4570 | * dirty
|
---|
4571 | */
|
---|
4572 | if(transformed != wasrhw &&
|
---|
4573 | !isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0))) &&
|
---|
4574 | !isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW))) {
|
---|
4575 | transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock, context);
|
---|
4576 | }
|
---|
4577 |
|
---|
4578 | if(!isStateDirty(context, STATE_RENDER(WINED3DRS_COLORVERTEX))) {
|
---|
4579 | state_colormat(STATE_RENDER(WINED3DRS_COLORVERTEX), stateblock, context);
|
---|
4580 | }
|
---|
4581 |
|
---|
4582 | if(context->last_was_vshader) {
|
---|
4583 | updateFog = TRUE;
|
---|
4584 | if(!device->vs_clipping && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) {
|
---|
4585 | state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context);
|
---|
4586 | }
|
---|
4587 | for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
---|
4588 | {
|
---|
4589 | clipplane(STATE_CLIPPLANE(i), stateblock, context);
|
---|
4590 | }
|
---|
4591 | }
|
---|
4592 | if(!isStateDirty(context, STATE_RENDER(WINED3DRS_NORMALIZENORMALS))) {
|
---|
4593 | state_normalize(STATE_RENDER(WINED3DRS_NORMALIZENORMALS), stateblock, context);
|
---|
4594 | }
|
---|
4595 | } else {
|
---|
4596 | if(!context->last_was_vshader) {
|
---|
4597 | static BOOL warned = FALSE;
|
---|
4598 | if(!device->vs_clipping) {
|
---|
4599 | /* Disable all clip planes to get defined results on all drivers. See comment in the
|
---|
4600 | * state_clipping state handler
|
---|
4601 | */
|
---|
4602 | for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
---|
4603 | {
|
---|
4604 | glDisable(GL_CLIP_PLANE0 + i);
|
---|
4605 | checkGLcall("glDisable(GL_CLIP_PLANE0 + i)");
|
---|
4606 | }
|
---|
4607 |
|
---|
4608 | if(!warned && stateblock->renderState[WINED3DRS_CLIPPLANEENABLE]) {
|
---|
4609 | FIXME("Clipping not supported with vertex shaders\n");
|
---|
4610 | warned = TRUE;
|
---|
4611 | }
|
---|
4612 | }
|
---|
4613 | if(wasrhw) {
|
---|
4614 | /* Apply the transform matrices when switching from rhw drawing to vertex shaders. Vertex
|
---|
4615 | * shaders themselves do not need it, but the matrices are not reapplied automatically when
|
---|
4616 | * switching back from vertex shaders to fixed function processing. So make sure we leave the
|
---|
4617 | * fixed function vertex processing states back in a sane state before switching to shaders
|
---|
4618 | */
|
---|
4619 | if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
|
---|
4620 | transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
|
---|
4621 | }
|
---|
4622 | if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)))) {
|
---|
4623 | transform_world(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)), stateblock, context);
|
---|
4624 | }
|
---|
4625 | }
|
---|
4626 | updateFog = TRUE;
|
---|
4627 |
|
---|
4628 | /* Vertex shader clipping ignores the view matrix. Update all clipplanes
|
---|
4629 | * (Note: ARB shaders can read the clip planes for clipping emulation even if
|
---|
4630 | * device->vs_clipping is false.
|
---|
4631 | */
|
---|
4632 | for (i = 0; i < gl_info->limits.clipplanes; ++i)
|
---|
4633 | {
|
---|
4634 | clipplane(STATE_CLIPPLANE(i), stateblock, context);
|
---|
4635 | }
|
---|
4636 | }
|
---|
4637 | }
|
---|
4638 |
|
---|
4639 | /* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
|
---|
4640 | * application
|
---|
4641 | */
|
---|
4642 | if (!isStateDirty(context, STATE_PIXELSHADER)) {
|
---|
4643 | device->shader_backend->shader_select(context, usePixelShaderFunction, useVertexShaderFunction);
|
---|
4644 |
|
---|
4645 | if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (useVertexShaderFunction || usePixelShaderFunction)) {
|
---|
4646 | shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
|
---|
4647 | }
|
---|
4648 | }
|
---|
4649 |
|
---|
4650 | context->last_was_vshader = useVertexShaderFunction;
|
---|
4651 |
|
---|
4652 | if (updateFog) stateblock_apply_state(STATE_RENDER(WINED3DRS_FOGVERTEXMODE), stateblock, context);
|
---|
4653 |
|
---|
4654 | if(!useVertexShaderFunction) {
|
---|
4655 | int i;
|
---|
4656 | for(i = 0; i < MAX_TEXTURES; i++) {
|
---|
4657 | if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_TEXTURE0 + i))) {
|
---|
4658 | transform_texture(STATE_TEXTURESTAGE(i, WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
|
---|
4659 | }
|
---|
4660 | }
|
---|
4661 | }
|
---|
4662 | }
|
---|
4663 |
|
---|
4664 | static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4665 | {
|
---|
4666 | IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *)stateblock->device->render_targets[0];
|
---|
4667 | UINT width, height;
|
---|
4668 | WINED3DVIEWPORT vp = stateblock->viewport;
|
---|
4669 |
|
---|
4670 | if(vp.Width > target->currentDesc.Width) vp.Width = target->currentDesc.Width;
|
---|
4671 | if(vp.Height > target->currentDesc.Height) vp.Height = target->currentDesc.Height;
|
---|
4672 |
|
---|
4673 | glDepthRange(vp.MinZ, vp.MaxZ);
|
---|
4674 | checkGLcall("glDepthRange");
|
---|
4675 | /* Note: GL requires lower left, DirectX supplies upper left. This is reversed when using offscreen rendering
|
---|
4676 | */
|
---|
4677 | if (context->render_offscreen)
|
---|
4678 | {
|
---|
4679 | glViewport(vp.X, vp.Y, vp.Width, vp.Height);
|
---|
4680 | } else {
|
---|
4681 | target->get_drawable_size(context, &width, &height);
|
---|
4682 |
|
---|
4683 | glViewport(vp.X,
|
---|
4684 | (height - (vp.Y + vp.Height)),
|
---|
4685 | vp.Width, vp.Height);
|
---|
4686 | }
|
---|
4687 |
|
---|
4688 | checkGLcall("glViewport");
|
---|
4689 | }
|
---|
4690 |
|
---|
4691 | static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4692 | {
|
---|
4693 | GLfloat yoffset = -(63.0f / 64.0f) / stateblock->viewport.Height;
|
---|
4694 |
|
---|
4695 | stateblock->device->posFixup[2] = (63.0f / 64.0f) / stateblock->viewport.Width;
|
---|
4696 | stateblock->device->posFixup[3] = stateblock->device->posFixup[1] * yoffset;
|
---|
4697 |
|
---|
4698 | if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
|
---|
4699 | transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
|
---|
4700 | }
|
---|
4701 | if(!isStateDirty(context, STATE_RENDER(WINED3DRS_POINTSCALEENABLE))) {
|
---|
4702 | state_pscale(STATE_RENDER(WINED3DRS_POINTSCALEENABLE), stateblock, context);
|
---|
4703 | }
|
---|
4704 | if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT))
|
---|
4705 | shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context);
|
---|
4706 | }
|
---|
4707 |
|
---|
4708 | static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4709 | {
|
---|
4710 | UINT Index = state - STATE_ACTIVELIGHT(0);
|
---|
4711 | const struct wined3d_light_info *lightInfo = stateblock->activeLights[Index];
|
---|
4712 |
|
---|
4713 | if(!lightInfo) {
|
---|
4714 | glDisable(GL_LIGHT0 + Index);
|
---|
4715 | checkGLcall("glDisable(GL_LIGHT0 + Index)");
|
---|
4716 | } else {
|
---|
4717 | float quad_att;
|
---|
4718 | float colRGBA[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
---|
4719 |
|
---|
4720 | /* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
|
---|
4721 | glMatrixMode(GL_MODELVIEW);
|
---|
4722 | glPushMatrix();
|
---|
4723 | glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
|
---|
4724 |
|
---|
4725 | /* Diffuse: */
|
---|
4726 | colRGBA[0] = lightInfo->OriginalParms.Diffuse.r;
|
---|
4727 | colRGBA[1] = lightInfo->OriginalParms.Diffuse.g;
|
---|
4728 | colRGBA[2] = lightInfo->OriginalParms.Diffuse.b;
|
---|
4729 | colRGBA[3] = lightInfo->OriginalParms.Diffuse.a;
|
---|
4730 | glLightfv(GL_LIGHT0 + Index, GL_DIFFUSE, colRGBA);
|
---|
4731 | checkGLcall("glLightfv");
|
---|
4732 |
|
---|
4733 | /* Specular */
|
---|
4734 | colRGBA[0] = lightInfo->OriginalParms.Specular.r;
|
---|
4735 | colRGBA[1] = lightInfo->OriginalParms.Specular.g;
|
---|
4736 | colRGBA[2] = lightInfo->OriginalParms.Specular.b;
|
---|
4737 | colRGBA[3] = lightInfo->OriginalParms.Specular.a;
|
---|
4738 | glLightfv(GL_LIGHT0 + Index, GL_SPECULAR, colRGBA);
|
---|
4739 | checkGLcall("glLightfv");
|
---|
4740 |
|
---|
4741 | /* Ambient */
|
---|
4742 | colRGBA[0] = lightInfo->OriginalParms.Ambient.r;
|
---|
4743 | colRGBA[1] = lightInfo->OriginalParms.Ambient.g;
|
---|
4744 | colRGBA[2] = lightInfo->OriginalParms.Ambient.b;
|
---|
4745 | colRGBA[3] = lightInfo->OriginalParms.Ambient.a;
|
---|
4746 | glLightfv(GL_LIGHT0 + Index, GL_AMBIENT, colRGBA);
|
---|
4747 | checkGLcall("glLightfv");
|
---|
4748 |
|
---|
4749 | if ((lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range) >= FLT_MIN) {
|
---|
4750 | quad_att = 1.4f/(lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range);
|
---|
4751 | } else {
|
---|
4752 | quad_att = 0.0f; /* 0 or MAX? (0 seems to be ok) */
|
---|
4753 | }
|
---|
4754 |
|
---|
4755 | /* Do not assign attenuation values for lights that do not use them. D3D apps are free to pass any junk,
|
---|
4756 | * but gl drivers use them and may crash due to bad Attenuation values. Need for Speed most wanted sets
|
---|
4757 | * Attenuation0 to NaN and crashes in the gl lib
|
---|
4758 | */
|
---|
4759 |
|
---|
4760 | switch (lightInfo->OriginalParms.Type) {
|
---|
4761 | case WINED3DLIGHT_POINT:
|
---|
4762 | /* Position */
|
---|
4763 | glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]);
|
---|
4764 | checkGLcall("glLightfv");
|
---|
4765 | glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
---|
4766 | checkGLcall("glLightf");
|
---|
4767 | /* Attenuation - Are these right? guessing... */
|
---|
4768 | glLightf(GL_LIGHT0 + Index, GL_CONSTANT_ATTENUATION, lightInfo->OriginalParms.Attenuation0);
|
---|
4769 | checkGLcall("glLightf");
|
---|
4770 | glLightf(GL_LIGHT0 + Index, GL_LINEAR_ATTENUATION, lightInfo->OriginalParms.Attenuation1);
|
---|
4771 | checkGLcall("glLightf");
|
---|
4772 | if (quad_att < lightInfo->OriginalParms.Attenuation2) quad_att = lightInfo->OriginalParms.Attenuation2;
|
---|
4773 | glLightf(GL_LIGHT0 + Index, GL_QUADRATIC_ATTENUATION, quad_att);
|
---|
4774 | checkGLcall("glLightf");
|
---|
4775 | /* FIXME: Range */
|
---|
4776 | break;
|
---|
4777 |
|
---|
4778 | case WINED3DLIGHT_SPOT:
|
---|
4779 | /* Position */
|
---|
4780 | glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]);
|
---|
4781 | checkGLcall("glLightfv");
|
---|
4782 | /* Direction */
|
---|
4783 | glLightfv(GL_LIGHT0 + Index, GL_SPOT_DIRECTION, &lightInfo->lightDirn[0]);
|
---|
4784 | checkGLcall("glLightfv");
|
---|
4785 | glLightf(GL_LIGHT0 + Index, GL_SPOT_EXPONENT, lightInfo->exponent);
|
---|
4786 | checkGLcall("glLightf");
|
---|
4787 | glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
---|
4788 | checkGLcall("glLightf");
|
---|
4789 | /* Attenuation - Are these right? guessing... */
|
---|
4790 | glLightf(GL_LIGHT0 + Index, GL_CONSTANT_ATTENUATION, lightInfo->OriginalParms.Attenuation0);
|
---|
4791 | checkGLcall("glLightf");
|
---|
4792 | glLightf(GL_LIGHT0 + Index, GL_LINEAR_ATTENUATION, lightInfo->OriginalParms.Attenuation1);
|
---|
4793 | checkGLcall("glLightf");
|
---|
4794 | if (quad_att < lightInfo->OriginalParms.Attenuation2) quad_att = lightInfo->OriginalParms.Attenuation2;
|
---|
4795 | glLightf(GL_LIGHT0 + Index, GL_QUADRATIC_ATTENUATION, quad_att);
|
---|
4796 | checkGLcall("glLightf");
|
---|
4797 | /* FIXME: Range */
|
---|
4798 | break;
|
---|
4799 |
|
---|
4800 | case WINED3DLIGHT_DIRECTIONAL:
|
---|
4801 | /* Direction */
|
---|
4802 | glLightfv(GL_LIGHT0 + Index, GL_POSITION, &lightInfo->lightPosn[0]); /* Note gl uses w position of 0 for direction! */
|
---|
4803 | checkGLcall("glLightfv");
|
---|
4804 | glLightf(GL_LIGHT0 + Index, GL_SPOT_CUTOFF, lightInfo->cutoff);
|
---|
4805 | checkGLcall("glLightf");
|
---|
4806 | glLightf(GL_LIGHT0 + Index, GL_SPOT_EXPONENT, 0.0f);
|
---|
4807 | checkGLcall("glLightf");
|
---|
4808 | break;
|
---|
4809 |
|
---|
4810 | default:
|
---|
4811 | FIXME("Unrecognized light type %d\n", lightInfo->OriginalParms.Type);
|
---|
4812 | }
|
---|
4813 |
|
---|
4814 | /* Restore the modelview matrix */
|
---|
4815 | glPopMatrix();
|
---|
4816 |
|
---|
4817 | glEnable(GL_LIGHT0 + Index);
|
---|
4818 | checkGLcall("glEnable(GL_LIGHT0 + Index)");
|
---|
4819 | }
|
---|
4820 | }
|
---|
4821 |
|
---|
4822 | static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4823 | {
|
---|
4824 | IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *)stateblock->device->render_targets[0];
|
---|
4825 | RECT *pRect = &stateblock->scissorRect;
|
---|
4826 | UINT height;
|
---|
4827 | UINT width;
|
---|
4828 |
|
---|
4829 | target->get_drawable_size(context, &width, &height);
|
---|
4830 | /* Warning: glScissor uses window coordinates, not viewport coordinates, so our viewport correction does not apply
|
---|
4831 | * Warning2: Even in windowed mode the coords are relative to the window, not the screen
|
---|
4832 | */
|
---|
4833 | TRACE("(%p) Setting new Scissor Rect to %d:%d-%d:%d\n", stateblock->device, pRect->left, pRect->bottom - height,
|
---|
4834 | pRect->right - pRect->left, pRect->bottom - pRect->top);
|
---|
4835 |
|
---|
4836 | if (context->render_offscreen)
|
---|
4837 | {
|
---|
4838 | glScissor(pRect->left, pRect->top, pRect->right - pRect->left, pRect->bottom - pRect->top);
|
---|
4839 | } else {
|
---|
4840 | glScissor(pRect->left, height - pRect->bottom, pRect->right - pRect->left, pRect->bottom - pRect->top);
|
---|
4841 | }
|
---|
4842 | checkGLcall("glScissor");
|
---|
4843 | }
|
---|
4844 |
|
---|
4845 | static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4846 | {
|
---|
4847 | if(stateblock->streamIsUP || stateblock->pIndexData == NULL ) {
|
---|
4848 | GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
|
---|
4849 | } else {
|
---|
4850 | struct wined3d_buffer *ib = (struct wined3d_buffer *) stateblock->pIndexData;
|
---|
4851 | GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, ib->buffer_object));
|
---|
4852 | }
|
---|
4853 | }
|
---|
4854 |
|
---|
4855 | static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
4856 | {
|
---|
4857 | if (context->render_offscreen)
|
---|
4858 | {
|
---|
4859 | glFrontFace(GL_CCW);
|
---|
4860 | checkGLcall("glFrontFace(GL_CCW)");
|
---|
4861 | } else {
|
---|
4862 | glFrontFace(GL_CW);
|
---|
4863 | checkGLcall("glFrontFace(GL_CW)");
|
---|
4864 | }
|
---|
4865 | }
|
---|
4866 |
|
---|
4867 | const struct StateEntryTemplate misc_state_template[] = {
|
---|
4868 | { STATE_RENDER(WINED3DRS_SRCBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4869 | { STATE_RENDER(WINED3DRS_DESTBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4870 | { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend }, WINED3D_GL_EXT_NONE },
|
---|
4871 | { STATE_RENDER(WINED3DRS_EDGEANTIALIAS), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4872 | { STATE_RENDER(WINED3DRS_ANTIALIASEDLINEENABLE), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4873 | { STATE_RENDER(WINED3DRS_SEPARATEALPHABLENDENABLE), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4874 | { STATE_RENDER(WINED3DRS_SRCBLENDALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4875 | { STATE_RENDER(WINED3DRS_DESTBLENDALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4876 | { STATE_RENDER(WINED3DRS_DESTBLENDALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4877 | { STATE_RENDER(WINED3DRS_BLENDOPALPHA), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4878 | { STATE_STREAMSRC, { STATE_VDECL, NULL }, WINED3D_GL_EXT_NONE },
|
---|
4879 | { STATE_VDECL, { STATE_VDECL, streamsrc }, WINED3D_GL_EXT_NONE },
|
---|
4880 | { STATE_FRONTFACE, { STATE_FRONTFACE, frontface }, WINED3D_GL_EXT_NONE },
|
---|
4881 | { STATE_SCISSORRECT, { STATE_SCISSORRECT, scissorrect }, WINED3D_GL_EXT_NONE },
|
---|
4882 | /* TODO: Move shader constant loading to vertex and fragment pipeline repectively, as soon as the pshader and
|
---|
4883 | * vshader loadings are untied from each other
|
---|
4884 | */
|
---|
4885 | { STATE_VERTEXSHADERCONSTANT, { STATE_VERTEXSHADERCONSTANT, shaderconstant }, WINED3D_GL_EXT_NONE },
|
---|
4886 | { STATE_PIXELSHADERCONSTANT, { STATE_VERTEXSHADERCONSTANT, NULL }, WINED3D_GL_EXT_NONE },
|
---|
4887 | { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4888 | { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4889 | { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4890 | { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4891 | { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4892 | { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4893 | { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4894 | { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4895 | { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4896 | { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4897 | { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4898 | { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4899 | { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4900 | { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4901 | { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4902 | { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4903 | { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4904 | { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4905 | { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4906 | { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4907 | { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4908 | { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4909 | { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4910 | { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4911 | { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4912 | { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4913 | { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4914 | { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4915 | { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
|
---|
4916 | { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4917 | { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4918 | { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4919 | { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4920 | { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4921 | { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4922 | { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4923 | { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4924 | { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4925 | { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4926 | { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4927 | { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4928 | { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4929 | { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4930 | { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4931 | { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4932 | { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4933 | { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE },
|
---|
4934 | { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4935 |
|
---|
4936 | { STATE_VIEWPORT, { STATE_VIEWPORT, viewport_miscpart }, WINED3D_GL_EXT_NONE },
|
---|
4937 | { STATE_INDEXBUFFER, { STATE_INDEXBUFFER, indexbuffer }, ARB_VERTEX_BUFFER_OBJECT },
|
---|
4938 | { STATE_INDEXBUFFER, { STATE_INDEXBUFFER, state_nop }, WINED3D_GL_EXT_NONE },
|
---|
4939 | { STATE_RENDER(WINED3DRS_ANTIALIAS), { STATE_RENDER(WINED3DRS_ANTIALIAS), state_antialias }, WINED3D_GL_EXT_NONE },
|
---|
4940 | { STATE_RENDER(WINED3DRS_TEXTUREPERSPECTIVE), { STATE_RENDER(WINED3DRS_TEXTUREPERSPECTIVE), state_perspective }, WINED3D_GL_EXT_NONE },
|
---|
4941 | { STATE_RENDER(WINED3DRS_ZENABLE), { STATE_RENDER(WINED3DRS_ZENABLE), state_zenable }, WINED3D_GL_EXT_NONE },
|
---|
4942 | { STATE_RENDER(WINED3DRS_WRAPU), { STATE_RENDER(WINED3DRS_WRAPU), state_wrapu }, WINED3D_GL_EXT_NONE },
|
---|
4943 | { STATE_RENDER(WINED3DRS_WRAPV), { STATE_RENDER(WINED3DRS_WRAPV), state_wrapv }, WINED3D_GL_EXT_NONE },
|
---|
4944 | { STATE_RENDER(WINED3DRS_FILLMODE), { STATE_RENDER(WINED3DRS_FILLMODE), state_fillmode }, WINED3D_GL_EXT_NONE },
|
---|
4945 | { STATE_RENDER(WINED3DRS_SHADEMODE), { STATE_RENDER(WINED3DRS_SHADEMODE), state_shademode }, WINED3D_GL_EXT_NONE },
|
---|
4946 | { STATE_RENDER(WINED3DRS_LINEPATTERN), { STATE_RENDER(WINED3DRS_LINEPATTERN), state_linepattern }, WINED3D_GL_EXT_NONE },
|
---|
4947 | { STATE_RENDER(WINED3DRS_MONOENABLE), { STATE_RENDER(WINED3DRS_MONOENABLE), state_monoenable }, WINED3D_GL_EXT_NONE },
|
---|
4948 | { STATE_RENDER(WINED3DRS_ROP2), { STATE_RENDER(WINED3DRS_ROP2), state_rop2 }, WINED3D_GL_EXT_NONE },
|
---|
4949 | { STATE_RENDER(WINED3DRS_PLANEMASK), { STATE_RENDER(WINED3DRS_PLANEMASK), state_planemask }, WINED3D_GL_EXT_NONE },
|
---|
4950 | { STATE_RENDER(WINED3DRS_ZWRITEENABLE), { STATE_RENDER(WINED3DRS_ZWRITEENABLE), state_zwritenable }, WINED3D_GL_EXT_NONE },
|
---|
4951 | { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), state_alpha }, WINED3D_GL_EXT_NONE },
|
---|
4952 | { STATE_RENDER(WINED3DRS_ALPHAREF), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4953 | { STATE_RENDER(WINED3DRS_ALPHAFUNC), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4954 | { STATE_RENDER(WINED3DRS_COLORKEYENABLE), { STATE_RENDER(WINED3DRS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4955 | { STATE_RENDER(WINED3DRS_LASTPIXEL), { STATE_RENDER(WINED3DRS_LASTPIXEL), state_lastpixel }, WINED3D_GL_EXT_NONE },
|
---|
4956 | { STATE_RENDER(WINED3DRS_CULLMODE), { STATE_RENDER(WINED3DRS_CULLMODE), state_cullmode }, WINED3D_GL_EXT_NONE },
|
---|
4957 | { STATE_RENDER(WINED3DRS_ZFUNC), { STATE_RENDER(WINED3DRS_ZFUNC), state_zfunc }, WINED3D_GL_EXT_NONE },
|
---|
4958 | { STATE_RENDER(WINED3DRS_DITHERENABLE), { STATE_RENDER(WINED3DRS_DITHERENABLE), state_ditherenable }, WINED3D_GL_EXT_NONE },
|
---|
4959 | { STATE_RENDER(WINED3DRS_SUBPIXEL), { STATE_RENDER(WINED3DRS_SUBPIXEL), state_subpixel }, WINED3D_GL_EXT_NONE },
|
---|
4960 | { STATE_RENDER(WINED3DRS_SUBPIXELX), { STATE_RENDER(WINED3DRS_SUBPIXELX), state_subpixelx }, WINED3D_GL_EXT_NONE },
|
---|
4961 | { STATE_RENDER(WINED3DRS_STIPPLEDALPHA), { STATE_RENDER(WINED3DRS_STIPPLEDALPHA), state_stippledalpha }, WINED3D_GL_EXT_NONE },
|
---|
4962 | { STATE_RENDER(WINED3DRS_ZBIAS), { STATE_RENDER(WINED3DRS_ZBIAS), state_zbias }, WINED3D_GL_EXT_NONE },
|
---|
4963 | { STATE_RENDER(WINED3DRS_STIPPLEENABLE), { STATE_RENDER(WINED3DRS_STIPPLEENABLE), state_stippleenable }, WINED3D_GL_EXT_NONE },
|
---|
4964 | { STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), { STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), state_mipmaplodbias }, WINED3D_GL_EXT_NONE },
|
---|
4965 | { STATE_RENDER(WINED3DRS_ANISOTROPY), { STATE_RENDER(WINED3DRS_ANISOTROPY), state_anisotropy }, WINED3D_GL_EXT_NONE },
|
---|
4966 | { STATE_RENDER(WINED3DRS_FLUSHBATCH), { STATE_RENDER(WINED3DRS_FLUSHBATCH), state_flushbatch }, WINED3D_GL_EXT_NONE },
|
---|
4967 | { STATE_RENDER(WINED3DRS_TRANSLUCENTSORTINDEPENDENT), { STATE_RENDER(WINED3DRS_TRANSLUCENTSORTINDEPENDENT), state_translucentsi }, WINED3D_GL_EXT_NONE },
|
---|
4968 | { STATE_RENDER(WINED3DRS_STENCILENABLE), { STATE_RENDER(WINED3DRS_STENCILENABLE), state_stencil }, WINED3D_GL_EXT_NONE },
|
---|
4969 | { STATE_RENDER(WINED3DRS_STENCILFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4970 | { STATE_RENDER(WINED3DRS_STENCILZFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4971 | { STATE_RENDER(WINED3DRS_STENCILPASS), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4972 | { STATE_RENDER(WINED3DRS_STENCILFUNC), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4973 | { STATE_RENDER(WINED3DRS_STENCILREF), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4974 | { STATE_RENDER(WINED3DRS_STENCILMASK), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4975 | { STATE_RENDER(WINED3DRS_STENCILWRITEMASK), { STATE_RENDER(WINED3DRS_STENCILWRITEMASK), state_stencilwrite2s}, EXT_STENCIL_TWO_SIDE },
|
---|
4976 | { STATE_RENDER(WINED3DRS_STENCILWRITEMASK), { STATE_RENDER(WINED3DRS_STENCILWRITEMASK), state_stencilwrite }, WINED3D_GL_EXT_NONE },
|
---|
4977 | { STATE_RENDER(WINED3DRS_TWOSIDEDSTENCILMODE), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4978 | { STATE_RENDER(WINED3DRS_CCW_STENCILFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4979 | { STATE_RENDER(WINED3DRS_CCW_STENCILZFAIL), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4980 | { STATE_RENDER(WINED3DRS_CCW_STENCILPASS), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4981 | { STATE_RENDER(WINED3DRS_CCW_STENCILFUNC), { STATE_RENDER(WINED3DRS_STENCILENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4982 | { STATE_RENDER(WINED3DRS_WRAP0), { STATE_RENDER(WINED3DRS_WRAP0), state_wrap }, WINED3D_GL_EXT_NONE },
|
---|
4983 | { STATE_RENDER(WINED3DRS_WRAP1), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4984 | { STATE_RENDER(WINED3DRS_WRAP2), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4985 | { STATE_RENDER(WINED3DRS_WRAP3), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4986 | { STATE_RENDER(WINED3DRS_WRAP4), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4987 | { STATE_RENDER(WINED3DRS_WRAP5), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4988 | { STATE_RENDER(WINED3DRS_WRAP6), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4989 | { STATE_RENDER(WINED3DRS_WRAP7), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4990 | { STATE_RENDER(WINED3DRS_WRAP8), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4991 | { STATE_RENDER(WINED3DRS_WRAP9), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4992 | { STATE_RENDER(WINED3DRS_WRAP10), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4993 | { STATE_RENDER(WINED3DRS_WRAP11), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4994 | { STATE_RENDER(WINED3DRS_WRAP12), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4995 | { STATE_RENDER(WINED3DRS_WRAP13), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4996 | { STATE_RENDER(WINED3DRS_WRAP14), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4997 | { STATE_RENDER(WINED3DRS_WRAP15), { STATE_RENDER(WINED3DRS_WRAP0), NULL }, WINED3D_GL_EXT_NONE },
|
---|
4998 | { STATE_RENDER(WINED3DRS_EXTENTS), { STATE_RENDER(WINED3DRS_EXTENTS), state_extents }, WINED3D_GL_EXT_NONE },
|
---|
4999 | { STATE_RENDER(WINED3DRS_COLORKEYBLENDENABLE), { STATE_RENDER(WINED3DRS_COLORKEYBLENDENABLE), state_ckeyblend }, WINED3D_GL_EXT_NONE },
|
---|
5000 | { STATE_RENDER(WINED3DRS_SOFTWAREVERTEXPROCESSING), { STATE_RENDER(WINED3DRS_SOFTWAREVERTEXPROCESSING), state_swvp }, WINED3D_GL_EXT_NONE },
|
---|
5001 | { STATE_RENDER(WINED3DRS_PATCHEDGESTYLE), { STATE_RENDER(WINED3DRS_PATCHEDGESTYLE), state_patchedgestyle}, WINED3D_GL_EXT_NONE },
|
---|
5002 | { STATE_RENDER(WINED3DRS_PATCHSEGMENTS), { STATE_RENDER(WINED3DRS_PATCHSEGMENTS), state_patchsegments }, WINED3D_GL_EXT_NONE },
|
---|
5003 | { STATE_RENDER(WINED3DRS_POSITIONDEGREE), { STATE_RENDER(WINED3DRS_POSITIONDEGREE), state_positiondegree}, WINED3D_GL_EXT_NONE },
|
---|
5004 | { STATE_RENDER(WINED3DRS_NORMALDEGREE), { STATE_RENDER(WINED3DRS_NORMALDEGREE), state_normaldegree }, WINED3D_GL_EXT_NONE },
|
---|
5005 | { STATE_RENDER(WINED3DRS_MINTESSELLATIONLEVEL), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5006 | { STATE_RENDER(WINED3DRS_MAXTESSELLATIONLEVEL), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5007 | { STATE_RENDER(WINED3DRS_ADAPTIVETESS_X), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5008 | { STATE_RENDER(WINED3DRS_ADAPTIVETESS_Y), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5009 | { STATE_RENDER(WINED3DRS_ADAPTIVETESS_Z), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5010 | { STATE_RENDER(WINED3DRS_ADAPTIVETESS_W), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5011 | { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), { STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_tessellation }, WINED3D_GL_EXT_NONE },
|
---|
5012 | { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa }, ARB_MULTISAMPLE },
|
---|
5013 | { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), { STATE_RENDER(WINED3DRS_MULTISAMPLEANTIALIAS), state_msaa_w }, WINED3D_GL_EXT_NONE },
|
---|
5014 | { STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), { STATE_RENDER(WINED3DRS_MULTISAMPLEMASK), state_multisampmask }, WINED3D_GL_EXT_NONE },
|
---|
5015 | { STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN), { STATE_RENDER(WINED3DRS_DEBUGMONITORTOKEN), state_debug_monitor }, WINED3D_GL_EXT_NONE },
|
---|
5016 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite0 }, EXT_DRAW_BUFFERS2 },
|
---|
5017 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
---|
5018 | { STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop }, EXT_BLEND_MINMAX },
|
---|
5019 | { STATE_RENDER(WINED3DRS_BLENDOP), { STATE_RENDER(WINED3DRS_BLENDOP), state_blendop_w }, WINED3D_GL_EXT_NONE },
|
---|
5020 | { STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), { STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), state_scissor }, WINED3D_GL_EXT_NONE },
|
---|
5021 | { STATE_RENDER(WINED3DRS_SLOPESCALEDEPTHBIAS), { STATE_RENDER(WINED3DRS_DEPTHBIAS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5022 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), state_colorwrite1 }, EXT_DRAW_BUFFERS2 },
|
---|
5023 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE1), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5024 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), state_colorwrite2 }, EXT_DRAW_BUFFERS2 },
|
---|
5025 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE2), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5026 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), state_colorwrite3 }, EXT_DRAW_BUFFERS2 },
|
---|
5027 | { STATE_RENDER(WINED3DRS_COLORWRITEENABLE3), { STATE_RENDER(WINED3DRS_COLORWRITEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5028 | { STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor }, EXT_BLEND_COLOR },
|
---|
5029 | { STATE_RENDER(WINED3DRS_BLENDFACTOR), { STATE_RENDER(WINED3DRS_BLENDFACTOR), state_blendfactor_w }, WINED3D_GL_EXT_NONE },
|
---|
5030 | { STATE_RENDER(WINED3DRS_DEPTHBIAS), { STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias }, WINED3D_GL_EXT_NONE },
|
---|
5031 | { STATE_RENDER(WINED3DRS_ZVISIBLE), { STATE_RENDER(WINED3DRS_ZVISIBLE), state_zvisible }, WINED3D_GL_EXT_NONE },
|
---|
5032 | /* Samplers */
|
---|
5033 | { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5034 | { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5035 | { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5036 | { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5037 | { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5038 | { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5039 | { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5040 | { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5041 | { STATE_SAMPLER(8), { STATE_SAMPLER(8), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5042 | { STATE_SAMPLER(9), { STATE_SAMPLER(9), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5043 | { STATE_SAMPLER(10), { STATE_SAMPLER(10), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5044 | { STATE_SAMPLER(11), { STATE_SAMPLER(11), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5045 | { STATE_SAMPLER(12), { STATE_SAMPLER(12), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5046 | { STATE_SAMPLER(13), { STATE_SAMPLER(13), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5047 | { STATE_SAMPLER(14), { STATE_SAMPLER(14), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5048 | { STATE_SAMPLER(15), { STATE_SAMPLER(15), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5049 | { STATE_SAMPLER(16), /* Vertex sampler 0 */ { STATE_SAMPLER(16), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5050 | { STATE_SAMPLER(17), /* Vertex sampler 1 */ { STATE_SAMPLER(17), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5051 | { STATE_SAMPLER(18), /* Vertex sampler 2 */ { STATE_SAMPLER(18), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5052 | { STATE_SAMPLER(19), /* Vertex sampler 3 */ { STATE_SAMPLER(19), sampler }, WINED3D_GL_EXT_NONE },
|
---|
5053 | {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
|
---|
5054 | };
|
---|
5055 |
|
---|
5056 | const struct StateEntryTemplate ffp_vertexstate_template[] = {
|
---|
5057 | { STATE_VDECL, { STATE_VDECL, vertexdeclaration }, WINED3D_GL_EXT_NONE },
|
---|
5058 | { STATE_VSHADER, { STATE_VDECL, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5059 | { STATE_MATERIAL, { STATE_RENDER(WINED3DRS_SPECULARENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5060 | { STATE_RENDER(WINED3DRS_SPECULARENABLE), { STATE_RENDER(WINED3DRS_SPECULARENABLE), state_specularenable}, WINED3D_GL_EXT_NONE },
|
---|
5061 | /* Clip planes */
|
---|
5062 | { STATE_CLIPPLANE(0), { STATE_CLIPPLANE(0), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5063 | { STATE_CLIPPLANE(1), { STATE_CLIPPLANE(1), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5064 | { STATE_CLIPPLANE(2), { STATE_CLIPPLANE(2), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5065 | { STATE_CLIPPLANE(3), { STATE_CLIPPLANE(3), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5066 | { STATE_CLIPPLANE(4), { STATE_CLIPPLANE(4), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5067 | { STATE_CLIPPLANE(5), { STATE_CLIPPLANE(5), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5068 | { STATE_CLIPPLANE(6), { STATE_CLIPPLANE(6), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5069 | { STATE_CLIPPLANE(7), { STATE_CLIPPLANE(7), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5070 | { STATE_CLIPPLANE(8), { STATE_CLIPPLANE(8), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5071 | { STATE_CLIPPLANE(9), { STATE_CLIPPLANE(9), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5072 | { STATE_CLIPPLANE(10), { STATE_CLIPPLANE(10), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5073 | { STATE_CLIPPLANE(11), { STATE_CLIPPLANE(11), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5074 | { STATE_CLIPPLANE(12), { STATE_CLIPPLANE(12), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5075 | { STATE_CLIPPLANE(13), { STATE_CLIPPLANE(13), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5076 | { STATE_CLIPPLANE(14), { STATE_CLIPPLANE(14), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5077 | { STATE_CLIPPLANE(15), { STATE_CLIPPLANE(15), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5078 | { STATE_CLIPPLANE(16), { STATE_CLIPPLANE(16), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5079 | { STATE_CLIPPLANE(17), { STATE_CLIPPLANE(17), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5080 | { STATE_CLIPPLANE(18), { STATE_CLIPPLANE(18), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5081 | { STATE_CLIPPLANE(19), { STATE_CLIPPLANE(19), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5082 | { STATE_CLIPPLANE(20), { STATE_CLIPPLANE(20), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5083 | { STATE_CLIPPLANE(21), { STATE_CLIPPLANE(21), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5084 | { STATE_CLIPPLANE(22), { STATE_CLIPPLANE(22), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5085 | { STATE_CLIPPLANE(23), { STATE_CLIPPLANE(23), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5086 | { STATE_CLIPPLANE(24), { STATE_CLIPPLANE(24), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5087 | { STATE_CLIPPLANE(25), { STATE_CLIPPLANE(25), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5088 | { STATE_CLIPPLANE(26), { STATE_CLIPPLANE(26), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5089 | { STATE_CLIPPLANE(27), { STATE_CLIPPLANE(27), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5090 | { STATE_CLIPPLANE(28), { STATE_CLIPPLANE(28), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5091 | { STATE_CLIPPLANE(29), { STATE_CLIPPLANE(29), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5092 | { STATE_CLIPPLANE(30), { STATE_CLIPPLANE(30), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5093 | { STATE_CLIPPLANE(31), { STATE_CLIPPLANE(31), clipplane }, WINED3D_GL_EXT_NONE },
|
---|
5094 | /* Lights */
|
---|
5095 | { STATE_ACTIVELIGHT(0), { STATE_ACTIVELIGHT(0), light }, WINED3D_GL_EXT_NONE },
|
---|
5096 | { STATE_ACTIVELIGHT(1), { STATE_ACTIVELIGHT(1), light }, WINED3D_GL_EXT_NONE },
|
---|
5097 | { STATE_ACTIVELIGHT(2), { STATE_ACTIVELIGHT(2), light }, WINED3D_GL_EXT_NONE },
|
---|
5098 | { STATE_ACTIVELIGHT(3), { STATE_ACTIVELIGHT(3), light }, WINED3D_GL_EXT_NONE },
|
---|
5099 | { STATE_ACTIVELIGHT(4), { STATE_ACTIVELIGHT(4), light }, WINED3D_GL_EXT_NONE },
|
---|
5100 | { STATE_ACTIVELIGHT(5), { STATE_ACTIVELIGHT(5), light }, WINED3D_GL_EXT_NONE },
|
---|
5101 | { STATE_ACTIVELIGHT(6), { STATE_ACTIVELIGHT(6), light }, WINED3D_GL_EXT_NONE },
|
---|
5102 | { STATE_ACTIVELIGHT(7), { STATE_ACTIVELIGHT(7), light }, WINED3D_GL_EXT_NONE },
|
---|
5103 | /* Viewport */
|
---|
5104 | { STATE_VIEWPORT, { STATE_VIEWPORT, viewport_vertexpart }, WINED3D_GL_EXT_NONE },
|
---|
5105 | /* Transform states follow */
|
---|
5106 | { STATE_TRANSFORM(WINED3DTS_VIEW), { STATE_TRANSFORM(WINED3DTS_VIEW), transform_view }, WINED3D_GL_EXT_NONE },
|
---|
5107 | { STATE_TRANSFORM(WINED3DTS_PROJECTION), { STATE_TRANSFORM(WINED3DTS_PROJECTION), transform_projection}, WINED3D_GL_EXT_NONE },
|
---|
5108 | { STATE_TRANSFORM(WINED3DTS_TEXTURE0), { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5109 | { STATE_TRANSFORM(WINED3DTS_TEXTURE1), { STATE_TEXTURESTAGE(1,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5110 | { STATE_TRANSFORM(WINED3DTS_TEXTURE2), { STATE_TEXTURESTAGE(2,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5111 | { STATE_TRANSFORM(WINED3DTS_TEXTURE3), { STATE_TEXTURESTAGE(3,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5112 | { STATE_TRANSFORM(WINED3DTS_TEXTURE4), { STATE_TEXTURESTAGE(4,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5113 | { STATE_TRANSFORM(WINED3DTS_TEXTURE5), { STATE_TEXTURESTAGE(5,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5114 | { STATE_TRANSFORM(WINED3DTS_TEXTURE6), { STATE_TEXTURESTAGE(6,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5115 | { STATE_TRANSFORM(WINED3DTS_TEXTURE7), { STATE_TEXTURESTAGE(7,WINED3DTSS_TEXTURETRANSFORMFLAGS), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5116 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 0)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 0)), transform_world }, WINED3D_GL_EXT_NONE },
|
---|
5117 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 1)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 1)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5118 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 2)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 2)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5119 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 3)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 3)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5120 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 4)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 4)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5121 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 5)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 5)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5122 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 6)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 6)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5123 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 7)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 7)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5124 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 8)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 8)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5125 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 9)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 9)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5126 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 10)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 10)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5127 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 11)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 11)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5128 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 12)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 12)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5129 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 13)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 13)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5130 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 14)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 14)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5131 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 15)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 15)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5132 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 16)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 16)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5133 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 17)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 17)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5134 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 18)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 18)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5135 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 19)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 19)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5136 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 20)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 20)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5137 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 21)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 21)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5138 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 22)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 22)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5139 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 23)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 23)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5140 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 24)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 24)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5141 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 25)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 25)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5142 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 26)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 26)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5143 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 27)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 27)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5144 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 28)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 28)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5145 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 29)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 29)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5146 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 30)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 30)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5147 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 31)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 31)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5148 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 32)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 32)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5149 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 33)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 33)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5150 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 34)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 34)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5151 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 35)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 35)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5152 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 36)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 36)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5153 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 37)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 37)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5154 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 38)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 38)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5155 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 39)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 39)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5156 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 40)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 40)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5157 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 41)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 41)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5158 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 42)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 42)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5159 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 43)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 43)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5160 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 44)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 44)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5161 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 45)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 45)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5162 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 46)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 46)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5163 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 47)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 47)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5164 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 48)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 48)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5165 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 49)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 49)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5166 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 50)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 50)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5167 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 51)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 51)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5168 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 52)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 52)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5169 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 53)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 53)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5170 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 54)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 54)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5171 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 55)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 55)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5172 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 56)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 56)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5173 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 57)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 57)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5174 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 58)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 58)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5175 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 59)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 59)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5176 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 60)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 60)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5177 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 61)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 61)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5178 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 62)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 62)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5179 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 63)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 63)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5180 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 64)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 64)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5181 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 65)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 65)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5182 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 66)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 66)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5183 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 67)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 67)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5184 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 68)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 68)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5185 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 69)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 69)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5186 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 70)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 70)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5187 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 71)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 71)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5188 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 72)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 72)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5189 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 73)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 73)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5190 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 74)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 74)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5191 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 75)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 75)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5192 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 76)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 76)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5193 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 77)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 77)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5194 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 78)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 78)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5195 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 79)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 79)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5196 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 80)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 80)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5197 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 81)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 81)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5198 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 82)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 82)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5199 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 83)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 83)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5200 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 84)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 84)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5201 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 85)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 85)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5202 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 86)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 86)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5203 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 87)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 87)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5204 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 88)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 88)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5205 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 89)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 89)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5206 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 90)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 90)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5207 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 91)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 91)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5208 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 92)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 92)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5209 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 93)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 93)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5210 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 94)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 94)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5211 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 95)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 95)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5212 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 96)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 96)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5213 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 97)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 97)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5214 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 98)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 98)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5215 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 99)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX( 99)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5216 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(100)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5217 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(101)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5218 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(102)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5219 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(103)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5220 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(104)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5221 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(105)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5222 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(106)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5223 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(107)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5224 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(108)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5225 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(109)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5226 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(110)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5227 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(111)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5228 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(112)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5229 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(113)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5230 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(114)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5231 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(115)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5232 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(116)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5233 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(117)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5234 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(118)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5235 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(119)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5236 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(120)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5237 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(121)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5238 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(122)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5239 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(123)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5240 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(124)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5241 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(125)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5242 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(126)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5243 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(127)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5244 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(128)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5245 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(129)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5246 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(130)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5247 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(131)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5248 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(132)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5249 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(133)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5250 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(134)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5251 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(135)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5252 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(136)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5253 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(137)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5254 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(138)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5255 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(139)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5256 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(140)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5257 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(141)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5258 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(142)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5259 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(143)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5260 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(144)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5261 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(145)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5262 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(146)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5263 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(147)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5264 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(148)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5265 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(149)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5266 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(150)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5267 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(151)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5268 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(152)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5269 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(153)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5270 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(154)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5271 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(155)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5272 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(156)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5273 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(157)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5274 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(158)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5275 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(159)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5276 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(160)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5277 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(161)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5278 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(162)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5279 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(163)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5280 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(164)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5281 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(165)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5282 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(166)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5283 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(167)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5284 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(168)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5285 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(169)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5286 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(170)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5287 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(171)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5288 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(172)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5289 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(173)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5290 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(174)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5291 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(175)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5292 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(176)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5293 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(177)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5294 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(178)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5295 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(179)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5296 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(180)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5297 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(181)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5298 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(182)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5299 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(183)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5300 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(184)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5301 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(185)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5302 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(186)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5303 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(187)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5304 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(188)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5305 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(189)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5306 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(190)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5307 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(191)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5308 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(192)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5309 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(193)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5310 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(194)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5311 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(195)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5312 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(196)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5313 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(197)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5314 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(198)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5315 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(199)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5316 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(200)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5317 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(201)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5318 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(202)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5319 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(203)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5320 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(204)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5321 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(205)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5322 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(206)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5323 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(207)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5324 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(208)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5325 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(209)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5326 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(210)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5327 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(211)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5328 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(212)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5329 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(213)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5330 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(214)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5331 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(215)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5332 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(216)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5333 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(217)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5334 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(218)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5335 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(219)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5336 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(220)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5337 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(221)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5338 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(222)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5339 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(223)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5340 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(224)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5341 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(225)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5342 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(226)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5343 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(227)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5344 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(228)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5345 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(229)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5346 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(230)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5347 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(231)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5348 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(232)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5349 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(233)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5350 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(234)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5351 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(235)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5352 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(236)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5353 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(237)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5354 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(238)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5355 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(239)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5356 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(240)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5357 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(241)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5358 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(242)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5359 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(243)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5360 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(244)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5361 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(245)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5362 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(246)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5363 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(247)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5364 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(248)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5365 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(249)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5366 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(250)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5367 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(251)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5368 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(252)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5369 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(253)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5370 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(254)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5371 | { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), { STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255)), transform_worldex }, WINED3D_GL_EXT_NONE },
|
---|
5372 | { STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(0,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5373 | { STATE_TEXTURESTAGE(1,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(1,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5374 | { STATE_TEXTURESTAGE(2,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(2,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5375 | { STATE_TEXTURESTAGE(3,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(3,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5376 | { STATE_TEXTURESTAGE(4,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(4,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5377 | { STATE_TEXTURESTAGE(5,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(5,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5378 | { STATE_TEXTURESTAGE(6,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(6,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5379 | { STATE_TEXTURESTAGE(7,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(7,WINED3DTSS_TEXTURETRANSFORMFLAGS),transform_texture }, WINED3D_GL_EXT_NONE },
|
---|
5380 | { STATE_TEXTURESTAGE(0, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(0, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5381 | { STATE_TEXTURESTAGE(1, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(1, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5382 | { STATE_TEXTURESTAGE(2, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(2, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5383 | { STATE_TEXTURESTAGE(3, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(3, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5384 | { STATE_TEXTURESTAGE(4, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(4, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5385 | { STATE_TEXTURESTAGE(5, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(5, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5386 | { STATE_TEXTURESTAGE(6, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(6, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5387 | { STATE_TEXTURESTAGE(7, WINED3DTSS_TEXCOORDINDEX), { STATE_TEXTURESTAGE(7, WINED3DTSS_TEXCOORDINDEX), tex_coordindex }, WINED3D_GL_EXT_NONE },
|
---|
5388 | /* Fog */
|
---|
5389 | { STATE_RENDER(WINED3DRS_FOGENABLE), { STATE_RENDER(WINED3DRS_FOGENABLE), state_fog_vertexpart}, WINED3D_GL_EXT_NONE },
|
---|
5390 | { STATE_RENDER(WINED3DRS_FOGTABLEMODE), { STATE_RENDER(WINED3DRS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5391 | { STATE_RENDER(WINED3DRS_FOGVERTEXMODE), { STATE_RENDER(WINED3DRS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5392 | { STATE_RENDER(WINED3DRS_RANGEFOGENABLE), { STATE_RENDER(WINED3DRS_RANGEFOGENABLE), state_rangefog }, NV_FOG_DISTANCE },
|
---|
5393 | { STATE_RENDER(WINED3DRS_RANGEFOGENABLE), { STATE_RENDER(WINED3DRS_RANGEFOGENABLE), state_rangefog_w }, WINED3D_GL_EXT_NONE },
|
---|
5394 | { STATE_RENDER(WINED3DRS_CLIPPING), { STATE_RENDER(WINED3DRS_CLIPPING), state_clipping }, WINED3D_GL_EXT_NONE },
|
---|
5395 | { STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), { STATE_RENDER(WINED3DRS_CLIPPING), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5396 | { STATE_RENDER(WINED3DRS_LIGHTING), { STATE_RENDER(WINED3DRS_LIGHTING), state_lighting }, WINED3D_GL_EXT_NONE },
|
---|
5397 | { STATE_RENDER(WINED3DRS_AMBIENT), { STATE_RENDER(WINED3DRS_AMBIENT), state_ambient }, WINED3D_GL_EXT_NONE },
|
---|
5398 | { STATE_RENDER(WINED3DRS_COLORVERTEX), { STATE_RENDER(WINED3DRS_COLORVERTEX), state_colormat }, WINED3D_GL_EXT_NONE },
|
---|
5399 | { STATE_RENDER(WINED3DRS_LOCALVIEWER), { STATE_RENDER(WINED3DRS_LOCALVIEWER), state_localviewer }, WINED3D_GL_EXT_NONE },
|
---|
5400 | { STATE_RENDER(WINED3DRS_NORMALIZENORMALS), { STATE_RENDER(WINED3DRS_NORMALIZENORMALS), state_normalize }, WINED3D_GL_EXT_NONE },
|
---|
5401 | { STATE_RENDER(WINED3DRS_DIFFUSEMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5402 | { STATE_RENDER(WINED3DRS_SPECULARMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5403 | { STATE_RENDER(WINED3DRS_AMBIENTMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5404 | { STATE_RENDER(WINED3DRS_EMISSIVEMATERIALSOURCE), { STATE_RENDER(WINED3DRS_COLORVERTEX), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5405 | { STATE_RENDER(WINED3DRS_VERTEXBLEND), { STATE_RENDER(WINED3DRS_VERTEXBLEND), state_vertexblend }, ARB_VERTEX_BLEND },
|
---|
5406 | { STATE_RENDER(WINED3DRS_VERTEXBLEND), { STATE_RENDER(WINED3DRS_VERTEXBLEND), state_vertexblend_w }, WINED3D_GL_EXT_NONE },
|
---|
5407 | { STATE_RENDER(WINED3DRS_POINTSIZE), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5408 | { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), state_psizemin_arb }, ARB_POINT_PARAMETERS },
|
---|
5409 | { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), state_psizemin_ext }, EXT_POINT_PARAMETERS },
|
---|
5410 | { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), state_psizemin_w }, WINED3D_GL_EXT_NONE },
|
---|
5411 | { STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), { STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), state_pointsprite }, ARB_POINT_SPRITE },
|
---|
5412 | { STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), { STATE_RENDER(WINED3DRS_POINTSPRITEENABLE), state_pointsprite_w }, WINED3D_GL_EXT_NONE },
|
---|
5413 | { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), state_pscale }, WINED3D_GL_EXT_NONE },
|
---|
5414 | { STATE_RENDER(WINED3DRS_POINTSCALE_A), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5415 | { STATE_RENDER(WINED3DRS_POINTSCALE_B), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5416 | { STATE_RENDER(WINED3DRS_POINTSCALE_C), { STATE_RENDER(WINED3DRS_POINTSCALEENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5417 | { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), NULL }, ARB_POINT_PARAMETERS },
|
---|
5418 | { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), NULL }, EXT_POINT_PARAMETERS },
|
---|
5419 | { STATE_RENDER(WINED3DRS_POINTSIZE_MAX), { STATE_RENDER(WINED3DRS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5420 | { STATE_RENDER(WINED3DRS_TWEENFACTOR), { STATE_RENDER(WINED3DRS_VERTEXBLEND), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5421 | { STATE_RENDER(WINED3DRS_INDEXEDVERTEXBLENDENABLE), { STATE_RENDER(WINED3DRS_VERTEXBLEND), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5422 |
|
---|
5423 | /* Samplers for NP2 texture matrix adjustions. They are not needed if GL_ARB_texture_non_power_of_two is supported,
|
---|
5424 | * so register a NULL state handler in that case to get the vertex part of sampler() skipped(VTF is handled in the misc states.
|
---|
5425 | * otherwise, register sampler_texmatrix, which takes care of updating the texture matrix
|
---|
5426 | */
|
---|
5427 | { STATE_SAMPLER(0), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5428 | { STATE_SAMPLER(0), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5429 | { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5430 | { STATE_SAMPLER(1), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5431 | { STATE_SAMPLER(1), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5432 | { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5433 | { STATE_SAMPLER(2), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5434 | { STATE_SAMPLER(2), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5435 | { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5436 | { STATE_SAMPLER(3), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5437 | { STATE_SAMPLER(3), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5438 | { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5439 | { STATE_SAMPLER(4), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5440 | { STATE_SAMPLER(4), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5441 | { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5442 | { STATE_SAMPLER(5), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5443 | { STATE_SAMPLER(5), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5444 | { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5445 | { STATE_SAMPLER(6), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5446 | { STATE_SAMPLER(6), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5447 | { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5448 | { STATE_SAMPLER(7), { 0, NULL }, ARB_TEXTURE_NON_POWER_OF_TWO },
|
---|
5449 | { STATE_SAMPLER(7), { 0, NULL }, WINE_NORMALIZED_TEXRECT },
|
---|
5450 | { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texmatrix }, WINED3D_GL_EXT_NONE },
|
---|
5451 | {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
|
---|
5452 | };
|
---|
5453 |
|
---|
5454 | static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
|
---|
5455 | { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5456 | { STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5457 | { STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5458 | { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5459 | { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5460 | { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5461 | { STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5462 | { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5463 | { STATE_TEXTURESTAGE(0, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5464 | { STATE_TEXTURESTAGE(0, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5465 | { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5466 | { STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5467 | { STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5468 | { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5469 | { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5470 | { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5471 | { STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5472 | { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5473 | { STATE_TEXTURESTAGE(1, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5474 | { STATE_TEXTURESTAGE(1, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5475 | { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5476 | { STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5477 | { STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5478 | { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5479 | { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5480 | { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5481 | { STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5482 | { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5483 | { STATE_TEXTURESTAGE(2, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5484 | { STATE_TEXTURESTAGE(2, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5485 | { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5486 | { STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5487 | { STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5488 | { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5489 | { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5490 | { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5491 | { STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5492 | { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5493 | { STATE_TEXTURESTAGE(3, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5494 | { STATE_TEXTURESTAGE(3, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5495 | { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5496 | { STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5497 | { STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5498 | { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5499 | { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5500 | { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5501 | { STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5502 | { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5503 | { STATE_TEXTURESTAGE(4, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5504 | { STATE_TEXTURESTAGE(4, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5505 | { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5506 | { STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5507 | { STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5508 | { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5509 | { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5510 | { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5511 | { STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5512 | { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5513 | { STATE_TEXTURESTAGE(5, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5514 | { STATE_TEXTURESTAGE(5, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5515 | { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5516 | { STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5517 | { STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5518 | { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5519 | { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5520 | { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5521 | { STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5522 | { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5523 | { STATE_TEXTURESTAGE(6, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5524 | { STATE_TEXTURESTAGE(6, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5525 | { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), tex_colorop }, WINED3D_GL_EXT_NONE },
|
---|
5526 | { STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5527 | { STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5528 | { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, WINED3D_GL_EXT_NONE },
|
---|
5529 | { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5530 | { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5531 | { STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5532 | { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5533 | { STATE_TEXTURESTAGE(7, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5534 | { STATE_TEXTURESTAGE(7, WINED3DTSS_CONSTANT), { 0 /* As long as we don't support D3DTA_CONSTANT */, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5535 | { STATE_PIXELSHADER, { STATE_PIXELSHADER, apply_pixelshader }, WINED3D_GL_EXT_NONE },
|
---|
5536 | { STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), { STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
|
---|
5537 | { STATE_RENDER(WINED3DRS_TEXTUREFACTOR), { STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_texfactor }, WINED3D_GL_EXT_NONE },
|
---|
5538 | { STATE_RENDER(WINED3DRS_FOGCOLOR), { STATE_RENDER(WINED3DRS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE },
|
---|
5539 | { STATE_RENDER(WINED3DRS_FOGDENSITY), { STATE_RENDER(WINED3DRS_FOGDENSITY), state_fogdensity }, WINED3D_GL_EXT_NONE },
|
---|
5540 | { STATE_RENDER(WINED3DRS_FOGENABLE), { STATE_RENDER(WINED3DRS_FOGENABLE), state_fog_fragpart }, WINED3D_GL_EXT_NONE },
|
---|
5541 | { STATE_RENDER(WINED3DRS_FOGTABLEMODE), { STATE_RENDER(WINED3DRS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5542 | { STATE_RENDER(WINED3DRS_FOGVERTEXMODE), { STATE_RENDER(WINED3DRS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5543 | { STATE_RENDER(WINED3DRS_FOGSTART), { STATE_RENDER(WINED3DRS_FOGSTART), state_fogstartend }, WINED3D_GL_EXT_NONE },
|
---|
5544 | { STATE_RENDER(WINED3DRS_FOGEND), { STATE_RENDER(WINED3DRS_FOGSTART), NULL }, WINED3D_GL_EXT_NONE },
|
---|
5545 | { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5546 | { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5547 | { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5548 | { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5549 | { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5550 | { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5551 | { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5552 | { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, WINED3D_GL_EXT_NONE },
|
---|
5553 | {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
|
---|
5554 | };
|
---|
5555 | #undef GLINFO_LOCATION
|
---|
5556 |
|
---|
5557 | /* Context activation is done by the caller. */
|
---|
5558 | static void ffp_enable(IWineD3DDevice *iface, BOOL enable) { }
|
---|
5559 |
|
---|
5560 | static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *pCaps)
|
---|
5561 | {
|
---|
5562 | pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD |
|
---|
5563 | WINED3DTEXOPCAPS_ADDSIGNED |
|
---|
5564 | WINED3DTEXOPCAPS_ADDSIGNED2X |
|
---|
5565 | WINED3DTEXOPCAPS_MODULATE |
|
---|
5566 | WINED3DTEXOPCAPS_MODULATE2X |
|
---|
5567 | WINED3DTEXOPCAPS_MODULATE4X |
|
---|
5568 | WINED3DTEXOPCAPS_SELECTARG1 |
|
---|
5569 | WINED3DTEXOPCAPS_SELECTARG2 |
|
---|
5570 | WINED3DTEXOPCAPS_DISABLE;
|
---|
5571 |
|
---|
5572 | if (gl_info->supported[ARB_TEXTURE_ENV_COMBINE]
|
---|
5573 | || gl_info->supported[EXT_TEXTURE_ENV_COMBINE]
|
---|
5574 | || gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
---|
5575 | {
|
---|
5576 | pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA |
|
---|
5577 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA |
|
---|
5578 | WINED3DTEXOPCAPS_BLENDFACTORALPHA |
|
---|
5579 | WINED3DTEXOPCAPS_BLENDCURRENTALPHA |
|
---|
5580 | WINED3DTEXOPCAPS_LERP |
|
---|
5581 | WINED3DTEXOPCAPS_SUBTRACT;
|
---|
5582 | }
|
---|
5583 | if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]
|
---|
5584 | || gl_info->supported[NV_TEXTURE_ENV_COMBINE4])
|
---|
5585 | {
|
---|
5586 | pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_ADDSMOOTH |
|
---|
5587 | WINED3DTEXOPCAPS_MULTIPLYADD |
|
---|
5588 | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR |
|
---|
5589 | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
|
---|
5590 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
|
---|
5591 | }
|
---|
5592 | if (gl_info->supported[ARB_TEXTURE_ENV_DOT3])
|
---|
5593 | pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_DOTPRODUCT3;
|
---|
5594 |
|
---|
5595 | pCaps->MaxTextureBlendStages = gl_info->limits.textures;
|
---|
5596 | pCaps->MaxSimultaneousTextures = gl_info->limits.textures;
|
---|
5597 | }
|
---|
5598 |
|
---|
5599 | static HRESULT ffp_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
|
---|
5600 | static void ffp_fragment_free(IWineD3DDevice *iface) {}
|
---|
5601 | static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup)
|
---|
5602 | {
|
---|
5603 | if (TRACE_ON(d3d))
|
---|
5604 | {
|
---|
5605 | TRACE("Checking support for fixup:\n");
|
---|
5606 | dump_color_fixup_desc(fixup);
|
---|
5607 | }
|
---|
5608 |
|
---|
5609 | /* We only support identity conversions. */
|
---|
5610 | if (is_identity_fixup(fixup))
|
---|
5611 | {
|
---|
5612 | TRACE("[OK]\n");
|
---|
5613 | return TRUE;
|
---|
5614 | }
|
---|
5615 |
|
---|
5616 | TRACE("[FAILED]\n");
|
---|
5617 | return FALSE;
|
---|
5618 | }
|
---|
5619 |
|
---|
5620 | const struct fragment_pipeline ffp_fragment_pipeline = {
|
---|
5621 | ffp_enable,
|
---|
5622 | ffp_fragment_get_caps,
|
---|
5623 | ffp_fragment_alloc,
|
---|
5624 | ffp_fragment_free,
|
---|
5625 | ffp_color_fixup_supported,
|
---|
5626 | ffp_fragmentstate_template,
|
---|
5627 | FALSE /* we cannot disable projected textures. The vertex pipe has to do it */
|
---|
5628 | };
|
---|
5629 |
|
---|
5630 | static unsigned int num_handlers(const APPLYSTATEFUNC *funcs)
|
---|
5631 | {
|
---|
5632 | unsigned int i;
|
---|
5633 | for(i = 0; funcs[i]; i++);
|
---|
5634 | return i;
|
---|
5635 | }
|
---|
5636 |
|
---|
5637 | static void multistate_apply_2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
5638 | {
|
---|
5639 | stateblock->device->multistate_funcs[state][0](state, stateblock, context);
|
---|
5640 | stateblock->device->multistate_funcs[state][1](state, stateblock, context);
|
---|
5641 | }
|
---|
5642 |
|
---|
5643 | static void multistate_apply_3(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
|
---|
5644 | {
|
---|
5645 | stateblock->device->multistate_funcs[state][0](state, stateblock, context);
|
---|
5646 | stateblock->device->multistate_funcs[state][1](state, stateblock, context);
|
---|
5647 | stateblock->device->multistate_funcs[state][2](state, stateblock, context);
|
---|
5648 | }
|
---|
5649 |
|
---|
5650 | static void prune_invalid_states(struct StateEntry *state_table, const struct wined3d_gl_info *gl_info)
|
---|
5651 | {
|
---|
5652 | unsigned int start, last, i;
|
---|
5653 |
|
---|
5654 | start = STATE_TEXTURESTAGE(gl_info->limits.texture_stages, 0);
|
---|
5655 | last = STATE_TEXTURESTAGE(MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE);
|
---|
5656 | for (i = start; i <= last; ++i)
|
---|
5657 | {
|
---|
5658 | state_table[i].representative = 0;
|
---|
5659 | state_table[i].apply = state_undefined;
|
---|
5660 | }
|
---|
5661 |
|
---|
5662 | start = STATE_TRANSFORM(WINED3DTS_TEXTURE0 + gl_info->limits.texture_stages);
|
---|
5663 | last = STATE_TRANSFORM(WINED3DTS_TEXTURE0 + MAX_TEXTURES - 1);
|
---|
5664 | for (i = start; i <= last; ++i)
|
---|
5665 | {
|
---|
5666 | state_table[i].representative = 0;
|
---|
5667 | state_table[i].apply = state_undefined;
|
---|
5668 | }
|
---|
5669 |
|
---|
5670 | start = STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(gl_info->limits.blends));
|
---|
5671 | last = STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(255));
|
---|
5672 | for (i = start; i <= last; ++i)
|
---|
5673 | {
|
---|
5674 | state_table[i].representative = 0;
|
---|
5675 | state_table[i].apply = state_undefined;
|
---|
5676 | }
|
---|
5677 | }
|
---|
5678 |
|
---|
5679 | static void validate_state_table(struct StateEntry *state_table)
|
---|
5680 | {
|
---|
5681 | static const struct
|
---|
5682 | {
|
---|
5683 | DWORD first;
|
---|
5684 | DWORD last;
|
---|
5685 | }
|
---|
5686 | rs_holes[] =
|
---|
5687 | {
|
---|
5688 | { 1, 1},
|
---|
5689 | { 3, 3},
|
---|
5690 | { 17, 18},
|
---|
5691 | { 21, 21},
|
---|
5692 | { 42, 45},
|
---|
5693 | { 61, 127},
|
---|
5694 | {149, 150},
|
---|
5695 | {169, 169},
|
---|
5696 | {177, 177},
|
---|
5697 | {196, 197},
|
---|
5698 | { 0, 0},
|
---|
5699 | };
|
---|
5700 | static const DWORD simple_states[] =
|
---|
5701 | {
|
---|
5702 | STATE_MATERIAL,
|
---|
5703 | STATE_VDECL,
|
---|
5704 | STATE_STREAMSRC,
|
---|
5705 | STATE_INDEXBUFFER,
|
---|
5706 | STATE_VERTEXSHADERCONSTANT,
|
---|
5707 | STATE_PIXELSHADERCONSTANT,
|
---|
5708 | STATE_VSHADER,
|
---|
5709 | STATE_PIXELSHADER,
|
---|
5710 | STATE_VIEWPORT,
|
---|
5711 | STATE_SCISSORRECT,
|
---|
5712 | STATE_FRONTFACE,
|
---|
5713 | };
|
---|
5714 | unsigned int i, current;
|
---|
5715 |
|
---|
5716 | for (i = STATE_RENDER(1), current = 0; i <= STATE_RENDER(WINEHIGHEST_RENDER_STATE); ++i)
|
---|
5717 | {
|
---|
5718 | if (!rs_holes[current].first || i < STATE_RENDER(rs_holes[current].first))
|
---|
5719 | {
|
---|
5720 | if (!state_table[i].representative)
|
---|
5721 | ERR("State %s (%#x) should have a representative.\n", debug_d3dstate(i), i);
|
---|
5722 | }
|
---|
5723 | else if (state_table[i].representative)
|
---|
5724 | ERR("State %s (%#x) shouldn't have a representative.\n", debug_d3dstate(i), i);
|
---|
5725 |
|
---|
5726 | if (i == STATE_RENDER(rs_holes[current].last)) ++current;
|
---|
5727 | }
|
---|
5728 |
|
---|
5729 | for (i = 0; i < sizeof(simple_states) / sizeof(*simple_states); ++i)
|
---|
5730 | {
|
---|
5731 | if (!state_table[simple_states[i]].representative)
|
---|
5732 | ERR("State %s (%#x) should have a representative.\n",
|
---|
5733 | debug_d3dstate(simple_states[i]), simple_states[i]);
|
---|
5734 | }
|
---|
5735 |
|
---|
5736 | for (i = 0; i < STATE_HIGHEST + 1; ++i)
|
---|
5737 | {
|
---|
5738 | DWORD rep = state_table[i].representative;
|
---|
5739 | if (rep)
|
---|
5740 | {
|
---|
5741 | if (state_table[rep].representative != rep)
|
---|
5742 | {
|
---|
5743 | ERR("State %s (%#x) has invalid representative %s (%#x).\n",
|
---|
5744 | debug_d3dstate(i), i, debug_d3dstate(rep), rep);
|
---|
5745 | state_table[i].representative = 0;
|
---|
5746 | }
|
---|
5747 |
|
---|
5748 | if (rep != i)
|
---|
5749 | {
|
---|
5750 | if (state_table[i].apply)
|
---|
5751 | ERR("State %s (%#x) has both a handler and representative.\n", debug_d3dstate(i), i);
|
---|
5752 | }
|
---|
5753 | else if (!state_table[i].apply)
|
---|
5754 | {
|
---|
5755 | ERR("Self representing state %s (%#x) has no handler.\n", debug_d3dstate(i), i);
|
---|
5756 | }
|
---|
5757 | }
|
---|
5758 | }
|
---|
5759 | }
|
---|
5760 |
|
---|
5761 | HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
|
---|
5762 | const struct wined3d_gl_info *gl_info, const struct StateEntryTemplate *vertex,
|
---|
5763 | const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc)
|
---|
5764 | {
|
---|
5765 | unsigned int i, type, handlers;
|
---|
5766 | APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
|
---|
5767 | const struct StateEntryTemplate *cur;
|
---|
5768 | BOOL set[STATE_HIGHEST + 1];
|
---|
5769 |
|
---|
5770 | memset(multistate_funcs, 0, sizeof(multistate_funcs));
|
---|
5771 |
|
---|
5772 | for(i = 0; i < STATE_HIGHEST + 1; i++) {
|
---|
5773 | StateTable[i].representative = 0;
|
---|
5774 | StateTable[i].apply = state_undefined;
|
---|
5775 | }
|
---|
5776 |
|
---|
5777 | for(type = 0; type < 3; type++) {
|
---|
5778 | /* This switch decides the order in which the states are applied */
|
---|
5779 | switch(type) {
|
---|
5780 | case 0: cur = misc; break;
|
---|
5781 | case 1: cur = fragment->states; break;
|
---|
5782 | case 2: cur = vertex; break;
|
---|
5783 | default: cur = NULL; /* Stupid compiler */
|
---|
5784 | }
|
---|
5785 | if(!cur) continue;
|
---|
5786 |
|
---|
5787 | /* GL extension filtering should not prevent multiple handlers being applied from different
|
---|
5788 | * pipeline parts
|
---|
5789 | */
|
---|
5790 | memset(set, 0, sizeof(set));
|
---|
5791 |
|
---|
5792 | for(i = 0; cur[i].state; i++) {
|
---|
5793 | APPLYSTATEFUNC *funcs_array;
|
---|
5794 |
|
---|
5795 | /* Only use the first matching state with the available extension from one template.
|
---|
5796 | * e.g.
|
---|
5797 | * {D3DRS_FOOBAR, {D3DRS_FOOBAR, func1}, XYZ_FANCY},
|
---|
5798 | * {D3DRS_FOOBAR, {D3DRS_FOOBAR, func2}, 0 }
|
---|
5799 | *
|
---|
5800 | * if GL_XYZ_fancy is supported, ignore the 2nd line
|
---|
5801 | */
|
---|
5802 | if(set[cur[i].state]) continue;
|
---|
5803 | /* Skip state lines depending on unsupported extensions */
|
---|
5804 | if (!gl_info->supported[cur[i].extension]) continue;
|
---|
5805 | set[cur[i].state] = TRUE;
|
---|
5806 | /* In some cases having an extension means that nothing has to be
|
---|
5807 | * done for a state, e.g. if GL_ARB_texture_non_power_of_two is
|
---|
5808 | * supported, the texture coordinate fixup can be ignored. If the
|
---|
5809 | * apply function is used, mark the state set(done above) to prevent
|
---|
5810 | * applying later lines, but do not record anything in the state
|
---|
5811 | * table
|
---|
5812 | */
|
---|
5813 | if (!cur[i].content.representative) continue;
|
---|
5814 |
|
---|
5815 | handlers = num_handlers(multistate_funcs[cur[i].state]);
|
---|
5816 | multistate_funcs[cur[i].state][handlers] = cur[i].content.apply;
|
---|
5817 | switch(handlers) {
|
---|
5818 | case 0:
|
---|
5819 | StateTable[cur[i].state].apply = cur[i].content.apply;
|
---|
5820 | break;
|
---|
5821 | case 1:
|
---|
5822 | StateTable[cur[i].state].apply = multistate_apply_2;
|
---|
5823 | dev_multistate_funcs[cur[i].state] = HeapAlloc(GetProcessHeap(),
|
---|
5824 | 0,
|
---|
5825 | sizeof(**dev_multistate_funcs) * 2);
|
---|
5826 | if (!dev_multistate_funcs[cur[i].state]) {
|
---|
5827 | goto out_of_mem;
|
---|
5828 | }
|
---|
5829 |
|
---|
5830 | dev_multistate_funcs[cur[i].state][0] = multistate_funcs[cur[i].state][0];
|
---|
5831 | dev_multistate_funcs[cur[i].state][1] = multistate_funcs[cur[i].state][1];
|
---|
5832 | break;
|
---|
5833 | case 2:
|
---|
5834 | StateTable[cur[i].state].apply = multistate_apply_3;
|
---|
5835 | funcs_array = HeapReAlloc(GetProcessHeap(),
|
---|
5836 | 0,
|
---|
5837 | dev_multistate_funcs[cur[i].state],
|
---|
5838 | sizeof(**dev_multistate_funcs) * 3);
|
---|
5839 | if (!funcs_array) {
|
---|
5840 | goto out_of_mem;
|
---|
5841 | }
|
---|
5842 |
|
---|
5843 | dev_multistate_funcs[cur[i].state] = funcs_array;
|
---|
5844 | dev_multistate_funcs[cur[i].state][2] = multistate_funcs[cur[i].state][2];
|
---|
5845 | break;
|
---|
5846 | default:
|
---|
5847 | ERR("Unexpected amount of state handlers for state %u: %u\n",
|
---|
5848 | cur[i].state, handlers + 1);
|
---|
5849 | }
|
---|
5850 |
|
---|
5851 | if(StateTable[cur[i].state].representative &&
|
---|
5852 | StateTable[cur[i].state].representative != cur[i].content.representative) {
|
---|
5853 | FIXME("State %u has different representatives in different pipeline parts\n",
|
---|
5854 | cur[i].state);
|
---|
5855 | }
|
---|
5856 | StateTable[cur[i].state].representative = cur[i].content.representative;
|
---|
5857 | }
|
---|
5858 | }
|
---|
5859 |
|
---|
5860 | prune_invalid_states(StateTable, gl_info);
|
---|
5861 | validate_state_table(StateTable);
|
---|
5862 |
|
---|
5863 | return WINED3D_OK;
|
---|
5864 |
|
---|
5865 | out_of_mem:
|
---|
5866 | for (i = 0; i <= STATE_HIGHEST; ++i) {
|
---|
5867 | HeapFree(GetProcessHeap(), 0, dev_multistate_funcs[i]);
|
---|
5868 | }
|
---|
5869 |
|
---|
5870 | memset(dev_multistate_funcs, 0, (STATE_HIGHEST + 1)*sizeof(*dev_multistate_funcs));
|
---|
5871 |
|
---|
5872 | return E_OUTOFMEMORY;
|
---|
5873 | }
|
---|