winepulse: Remove AudioSessionManager.
[wine.git] / dlls / wined3d / nvidia_texture_shader.c
blobd25a314e2cb560ba937e18e24246e58fbd76ffbd
1 /*
2 * Fixed function pipeline replacement using GL_NV_register_combiners
3 * and GL_NV_texture_shader
5 * Copyright 2006 Henri Verbeet
6 * Copyright 2008 Stefan Dösinger(for CodeWeavers)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <stdio.h>
25 #include "wined3d_private.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
29 /* Context activation for state handlers is done by the caller. */
31 static void nvts_activate_dimensions(const struct wined3d_state *state,
32 unsigned int stage, struct wined3d_context_gl *context_gl)
34 const struct wined3d_gl_info *gl_info = context_gl->gl_info;
35 struct wined3d_texture *texture;
36 BOOL bumpmap = FALSE;
38 if (stage > 0
39 && (state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
40 || state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP))
42 bumpmap = TRUE;
43 context_gl->c.texShaderBumpMap |= (1u << stage);
45 else
47 context_gl->c.texShaderBumpMap &= ~(1u << stage);
50 if ((texture = state->textures[stage]))
52 switch (wined3d_texture_gl(texture)->target)
54 case GL_TEXTURE_2D:
55 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
56 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
57 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
58 break;
59 case GL_TEXTURE_RECTANGLE_ARB:
60 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
61 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_RECTANGLE_ARB);
62 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
63 break;
64 case GL_TEXTURE_3D:
65 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);
66 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D)");
67 break;
68 case GL_TEXTURE_CUBE_MAP_ARB:
69 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB);
70 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB)");
71 break;
72 default:
73 FIXME("Unhandled target %#x.\n", wined3d_texture_gl(texture)->target);
74 break;
77 else
79 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
80 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE)");
84 struct tex_op_args
86 GLenum input[3];
87 GLenum mapping[3];
88 GLenum component_usage[3];
91 static GLenum d3dta_to_combiner_input(unsigned int d3dta, DWORD stage, INT texture_idx) {
92 switch (d3dta) {
93 case WINED3DTA_DIFFUSE:
94 return GL_PRIMARY_COLOR_NV;
96 case WINED3DTA_CURRENT:
97 if (stage) return GL_SPARE0_NV;
98 else return GL_PRIMARY_COLOR_NV;
100 case WINED3DTA_TEXTURE:
101 if (texture_idx > -1) return GL_TEXTURE0_ARB + texture_idx;
102 else return GL_PRIMARY_COLOR_NV;
104 case WINED3DTA_TFACTOR:
105 return GL_CONSTANT_COLOR0_NV;
107 case WINED3DTA_SPECULAR:
108 return GL_SECONDARY_COLOR_NV;
110 case WINED3DTA_TEMP:
111 return GL_SPARE1_NV;
113 case WINED3DTA_CONSTANT:
114 /* TODO: Support per stage constants (WINED3D_TSS_CONSTANT, NV_register_combiners2) */
115 FIXME("WINED3DTA_CONSTANT, not properly supported.\n");
116 return GL_CONSTANT_COLOR1_NV;
118 default:
119 FIXME("Unrecognized texture arg %#x\n", d3dta);
120 return GL_TEXTURE;
124 static GLenum invert_mapping(GLenum mapping) {
125 if (mapping == GL_UNSIGNED_INVERT_NV) return GL_UNSIGNED_IDENTITY_NV;
126 else if (mapping == GL_UNSIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
128 FIXME("Unhandled mapping %#x\n", mapping);
129 return mapping;
132 static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* input, GLenum* mapping, GLenum *component_usage, INT texture_idx) {
133 /* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
134 * be used. */
135 if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
136 else *mapping = GL_UNSIGNED_IDENTITY_NV; /* Clamp all values to positive ranges */
138 /* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
139 * should be used for all input components. */
140 if (is_alpha || arg & WINED3DTA_ALPHAREPLICATE) *component_usage = GL_ALPHA;
141 else *component_usage = GL_RGB;
143 *input = d3dta_to_combiner_input(arg & WINED3DTA_SELECTMASK, stage, texture_idx);
146 void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, BOOL is_alpha,
147 int stage, enum wined3d_texture_op op, uint32_t arg1, uint32_t arg2, uint32_t arg3, INT texture_idx, DWORD dst)
149 struct tex_op_args tex_op_args = {{0}, {0}, {0}};
150 GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
151 GLenum target = GL_COMBINER0_NV + stage;
152 GLenum output;
154 TRACE("stage %d, is_alpha %d, op %s, arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
155 stage, is_alpha, debug_d3dtop(op), arg1, arg2, arg3, texture_idx);
157 /* If a texture stage references an invalid texture unit the stage just
158 * passes through the result from the previous stage */
159 if (is_invalid_op(state, stage, op, arg1, arg2, arg3))
161 arg1 = WINED3DTA_CURRENT;
162 op = WINED3D_TOP_SELECT_ARG1;
165 get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0],
166 &tex_op_args.mapping[0], &tex_op_args.component_usage[0], texture_idx);
167 get_src_and_opr_nvrc(stage, arg2, is_alpha, &tex_op_args.input[1],
168 &tex_op_args.mapping[1], &tex_op_args.component_usage[1], texture_idx);
169 get_src_and_opr_nvrc(stage, arg3, is_alpha, &tex_op_args.input[2],
170 &tex_op_args.mapping[2], &tex_op_args.component_usage[2], texture_idx);
173 if(dst == WINED3DTA_TEMP) {
174 output = GL_SPARE1_NV;
175 } else {
176 output = GL_SPARE0_NV;
179 switch (op)
181 case WINED3D_TOP_DISABLE:
182 /* Only for alpha */
183 if (!is_alpha)
184 ERR("Shouldn't be called for WINED3D_TSS_COLOR_OP (WINED3DTOP_DISABLE).\n");
185 /* Input, prev_alpha*1 */
186 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
187 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
188 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
189 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
191 /* Output */
192 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
193 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
194 break;
196 case WINED3D_TOP_SELECT_ARG1:
197 case WINED3D_TOP_SELECT_ARG2:
198 /* Input, arg*1 */
199 if (op == WINED3D_TOP_SELECT_ARG1)
200 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
201 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
202 else
203 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
204 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
205 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
206 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
208 /* Output */
209 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
210 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
211 break;
213 case WINED3D_TOP_MODULATE:
214 case WINED3D_TOP_MODULATE_2X:
215 case WINED3D_TOP_MODULATE_4X:
216 /* Input, arg1*arg2 */
217 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
218 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
219 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
220 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
222 /* Output */
223 if (op == WINED3D_TOP_MODULATE)
224 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
225 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
226 else if (op == WINED3D_TOP_MODULATE_2X)
227 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
228 GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
229 else if (op == WINED3D_TOP_MODULATE_4X)
230 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
231 GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
232 break;
234 case WINED3D_TOP_ADD:
235 case WINED3D_TOP_ADD_SIGNED:
236 case WINED3D_TOP_ADD_SIGNED_2X:
237 /* Input, arg1*1+arg2*1 */
238 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
239 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
240 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
241 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
242 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
243 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
244 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
245 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
247 /* Output */
248 if (op == WINED3D_TOP_ADD)
249 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
250 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
251 else if (op == WINED3D_TOP_ADD_SIGNED)
252 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
253 output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
254 else if (op == WINED3D_TOP_ADD_SIGNED_2X)
255 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
256 output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
257 break;
259 case WINED3D_TOP_SUBTRACT:
260 /* Input, arg1*1+-arg2*1 */
261 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
262 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
263 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
264 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
265 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
266 tex_op_args.input[1], GL_SIGNED_NEGATE_NV, tex_op_args.component_usage[1]));
267 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
268 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
270 /* Output */
271 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
272 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
273 break;
275 case WINED3D_TOP_ADD_SMOOTH:
276 /* Input, arg1*1+(1-arg1)*arg2 */
277 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
278 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
279 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
280 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
281 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
282 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
283 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
284 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
286 /* Output */
287 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
288 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
289 break;
291 case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
292 case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
293 case WINED3D_TOP_BLEND_FACTOR_ALPHA:
294 case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
295 case WINED3D_TOP_BLEND_CURRENT_ALPHA:
297 GLenum alpha_src = GL_PRIMARY_COLOR_NV;
298 if (op == WINED3D_TOP_BLEND_DIFFUSE_ALPHA)
299 alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx);
300 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA)
301 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
302 else if (op == WINED3D_TOP_BLEND_FACTOR_ALPHA)
303 alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx);
304 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
305 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
306 else if (op == WINED3D_TOP_BLEND_CURRENT_ALPHA)
307 alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx);
308 else
309 FIXME("Unhandled texture op %s, shouldn't happen.\n", debug_d3dtop(op));
311 /* Input, arg1*alpha_src+arg2*(1-alpha_src) */
312 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
313 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
314 if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
316 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
317 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
318 } else {
319 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
320 alpha_src, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
322 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
323 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
324 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
325 alpha_src, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
327 /* Output */
328 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
329 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
330 break;
333 case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
334 /* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */
335 if (is_alpha)
336 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEALPHA_ADDCOLOR).\n");
337 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
338 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
339 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
340 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
341 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
342 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
343 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
344 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
346 /* Output */
347 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
348 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
349 break;
351 case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
352 /* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */
353 if (is_alpha)
354 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATECOLOR_ADDALPHA).\n");
355 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
356 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
357 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
358 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
359 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
360 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
361 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
362 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
364 /* Output */
365 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
366 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
367 break;
369 case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
370 /* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */
371 if (is_alpha)
372 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR).\n");
373 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
374 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), GL_ALPHA));
375 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
376 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
377 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
378 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
379 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
380 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
382 /* Output */
383 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
384 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
385 break;
387 case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
388 /* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */
389 if (is_alpha)
390 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA).\n");
391 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
392 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
393 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
394 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
395 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
396 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
397 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
398 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
400 /* Output */
401 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
402 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
403 break;
405 case WINED3D_TOP_DOTPRODUCT3:
406 /* Input, arg1 . arg2 */
407 /* FIXME: DX7 uses a different calculation? */
408 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
409 tex_op_args.input[0], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[0]));
410 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
411 tex_op_args.input[1], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[1]));
413 /* Output */
414 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
415 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE));
416 break;
418 case WINED3D_TOP_MULTIPLY_ADD:
419 /* Input, arg3*1+arg1*arg2 */
420 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
421 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
422 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
423 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
424 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
425 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
426 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
427 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
429 /* Output */
430 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
431 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
432 break;
434 case WINED3D_TOP_LERP:
435 /* Input, arg3*arg1+(1-arg3)*arg2 */
436 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
437 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
438 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
439 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
440 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
441 tex_op_args.input[2], invert_mapping(tex_op_args.mapping[2]), tex_op_args.component_usage[2]));
442 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
443 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
445 /* Output */
446 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
447 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
448 break;
450 case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
451 case WINED3D_TOP_BUMPENVMAP:
452 if (!gl_info->supported[NV_TEXTURE_SHADER])
454 WARN("BUMPENVMAP requires GL_NV_texture_shader in this codepath\n");
455 break;
458 /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
459 * perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
460 * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
461 * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the
462 * next stage */
463 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
464 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
465 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
466 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
467 /* Always pass through to CURRENT, ignore temp arg */
468 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
469 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
470 break;
472 default:
473 FIXME("Unhandled texture op: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d.\n",
474 stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
477 checkGLcall("set_tex_op_nvrc()");
481 static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
483 unsigned int stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
484 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
485 BOOL tex_used = context->fixed_function_usage_map & (1u << stage);
486 const struct wined3d_gl_info *gl_info = context_gl->gl_info;
487 unsigned int mapped_stage = context_gl->tex_unit_map[stage];
489 TRACE("Setting color op for stage %u.\n", stage);
491 /* Using a pixel shader? Don't care for anything here, the shader applying does it */
492 if (use_ps(state)) return;
494 if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
496 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
498 if (tex_used && mapped_stage >= gl_info->limits.textures)
500 FIXME("Attempt to enable unsupported stage!\n");
501 return;
503 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
506 if (context->lowest_disabled_stage > 0)
508 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
509 GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, context->lowest_disabled_stage));
511 else
513 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
515 if (stage >= context->lowest_disabled_stage)
517 TRACE("Stage disabled\n");
518 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
520 /* Disable everything here */
521 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
522 checkGLcall("glDisable(GL_TEXTURE_2D)");
523 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
524 checkGLcall("glDisable(GL_TEXTURE_3D)");
525 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
527 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
528 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
530 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
532 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
533 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
535 if (gl_info->supported[NV_TEXTURE_SHADER2] && mapped_stage < gl_info->limits.textures)
537 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
540 /* All done */
541 return;
544 /* The sampler will also activate the correct texture dimensions, so no need to do it here
545 * if the sampler for this stage is dirty
547 if (!isStateDirty(context, STATE_SAMPLER(stage)))
549 if (tex_used)
551 if (gl_info->supported[NV_TEXTURE_SHADER2])
552 nvts_activate_dimensions(state, stage, context_gl);
553 else
554 texture_activate_dimensions(state->textures[stage], gl_info);
558 /* Set the texture combiners */
559 set_tex_op_nvrc(gl_info, state, FALSE, stage,
560 state->texture_states[stage][WINED3D_TSS_COLOR_OP],
561 state->texture_states[stage][WINED3D_TSS_COLOR_ARG1],
562 state->texture_states[stage][WINED3D_TSS_COLOR_ARG2],
563 state->texture_states[stage][WINED3D_TSS_COLOR_ARG0],
564 mapped_stage,
565 state->texture_states[stage][WINED3D_TSS_RESULT_ARG]);
567 /* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set,
568 * thus the texture shader may have to be updated
570 if (gl_info->supported[NV_TEXTURE_SHADER2])
572 BOOL usesBump = (state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
573 || state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP);
574 BOOL usedBump = !!(context->texShaderBumpMap & 1u << (stage + 1));
575 if (usesBump != usedBump)
577 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage + 1);
578 nvts_activate_dimensions(state, stage + 1, context_gl);
579 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
584 static void nvrc_resultarg(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
586 unsigned int stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
588 TRACE("Setting result arg for stage %u.\n", stage);
590 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP)))
592 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP));
594 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP)))
596 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP));
600 static void nvts_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
602 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
603 unsigned int sampler, mapped_stage;
605 sampler = state_id - STATE_SAMPLER(0);
606 mapped_stage = context_gl->tex_unit_map[sampler];
608 /* No need to enable / disable anything here for unused samplers. The tex_colorop
609 * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
610 * will take care of this business. */
611 if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context_gl->gl_info->limits.textures)
612 return;
613 if (sampler >= context->lowest_disabled_stage)
614 return;
615 if (isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3D_TSS_COLOR_OP)))
616 return;
618 nvts_activate_dimensions(state, sampler, context_gl);
621 static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
623 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
624 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
625 unsigned int mapped_stage = context_gl->tex_unit_map[stage + 1];
626 const struct wined3d_gl_info *gl_info = context_gl->gl_info;
627 float mat[2][2];
629 /* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to
630 * offset the destination stage(always stage + 1 in d3d). In GL_NV_texture_shader, the bump
631 * map offsetting is done in the stage reading the bump mapped texture, and the perturbation
632 * map is read from a specified source stage(always stage - 1 for d3d). Thus set the matrix
633 * for stage + 1. Keep the nvrc tex unit mapping in mind too
635 if (mapped_stage < gl_info->limits.textures)
637 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
639 /* We can't just pass a pointer to the state to GL due to the
640 * different matrix format (column major vs row major). */
641 mat[0][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT00]);
642 mat[1][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT01]);
643 mat[0][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT10]);
644 mat[1][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT11]);
645 gl_info->gl_ops.gl.p_glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float *)mat);
646 checkGLcall("glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)");
650 static void nvrc_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
652 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
653 const struct wined3d_gl_info *gl_info = context_gl->gl_info;
654 struct wined3d_color color;
656 wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_TEXTUREFACTOR]);
657 GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &color.r));
660 /* Context activation is done by the caller. */
661 static void nvrc_enable(const struct wined3d_context *context, BOOL enable)
663 const struct wined3d_gl_info *gl_info = wined3d_context_gl_const(context)->gl_info;
665 if (enable)
667 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
668 checkGLcall("glEnable(GL_REGISTER_COMBINERS_NV)");
670 else
672 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
673 checkGLcall("glDisable(GL_REGISTER_COMBINERS_NV)");
677 /* Context activation is done by the caller. */
678 static void nvts_enable(const struct wined3d_context *context, BOOL enable)
680 const struct wined3d_gl_info *gl_info = wined3d_context_gl_const(context)->gl_info;
682 nvrc_enable(context, enable);
683 if (enable)
685 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
686 checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
688 else
690 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_SHADER_NV);
691 checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
695 static void nvrc_fragment_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps)
697 const struct wined3d_gl_info *gl_info = &adapter->gl_info;
699 caps->wined3d_caps = 0;
700 caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
702 /* The caps below can be supported but aren't handled yet in utils.c
703 * 'd3dta_to_combiner_input', disable them until support is fixed */
704 #if 0
705 if (gl_info->supported[NV_REGISTER_COMBINERS2])
706 caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT;
707 #endif
709 caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD
710 | WINED3DTEXOPCAPS_ADDSIGNED
711 | WINED3DTEXOPCAPS_ADDSIGNED2X
712 | WINED3DTEXOPCAPS_MODULATE
713 | WINED3DTEXOPCAPS_MODULATE2X
714 | WINED3DTEXOPCAPS_MODULATE4X
715 | WINED3DTEXOPCAPS_SELECTARG1
716 | WINED3DTEXOPCAPS_SELECTARG2
717 | WINED3DTEXOPCAPS_DISABLE
718 | WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
719 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
720 | WINED3DTEXOPCAPS_BLENDFACTORALPHA
721 | WINED3DTEXOPCAPS_BLENDCURRENTALPHA
722 | WINED3DTEXOPCAPS_LERP
723 | WINED3DTEXOPCAPS_SUBTRACT
724 | WINED3DTEXOPCAPS_ADDSMOOTH
725 | WINED3DTEXOPCAPS_MULTIPLYADD
726 | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
727 | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
728 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM
729 | WINED3DTEXOPCAPS_DOTPRODUCT3
730 | WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
731 | WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA;
733 if (gl_info->supported[NV_TEXTURE_SHADER2])
735 /* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does
736 * not support 3D textures. This asks for trouble if an app uses both bump mapping
737 * and 3D textures. It also allows us to keep the code simpler by having texture
738 * shaders constantly enabled. */
739 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP;
740 /* TODO: Luminance bump map? */
743 #if 0
744 /* FIXME: Add
745 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE
746 WINED3DTEXOPCAPS_PREMODULATE */
747 #endif
749 caps->MaxTextureBlendStages = min(WINED3D_MAX_TEXTURES, gl_info->limits.general_combiners);
750 caps->MaxSimultaneousTextures = gl_info->limits.textures;
753 static unsigned int nvrc_fragment_get_emul_mask(const struct wined3d_gl_info *gl_info)
755 return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
758 static void *nvrc_fragment_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
760 return shader_priv;
763 /* Context activation is done by the caller. */
764 static void nvrc_fragment_free(struct wined3d_device *device, struct wined3d_context *context) {}
766 /* Two fixed function pipeline implementations using GL_NV_register_combiners and
767 * GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions
768 * are available(geforce 3 and newer), while nvrc_fragment_pipeline uses only the
769 * register combiners extension(Pre-GF3).
772 static BOOL nvts_color_fixup_supported(struct color_fixup_desc fixup)
774 /* We only support identity conversions. */
775 return is_identity_fixup(fixup);
778 static const struct wined3d_state_entry_template nvrc_fragmentstate_template[] =
780 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
781 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
782 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
783 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
784 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
785 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
786 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
787 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
788 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
789 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
790 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
791 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
792 { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
793 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
794 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
795 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
796 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
797 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
798 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
799 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
800 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
801 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
802 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
803 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
804 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
805 { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
806 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
807 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
808 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
809 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
810 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
811 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
812 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
813 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
814 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
815 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
816 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
817 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
818 { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
819 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
820 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
821 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
822 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
823 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
824 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
825 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
826 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
827 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
828 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
829 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
830 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
831 { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
832 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
833 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
834 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
835 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
836 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
837 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
838 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
839 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
840 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
841 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
842 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
843 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
844 { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
845 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
846 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
847 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
848 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
849 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
850 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
851 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
852 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
853 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
854 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
855 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
856 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
857 { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
858 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
859 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
860 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
861 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
862 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
863 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
864 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
865 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
866 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
867 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
868 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
869 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
870 { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
871 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
872 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
873 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
874 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
875 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
876 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
877 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
878 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
879 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
880 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
881 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
882 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
883 { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
884 { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), apply_pixelshader }, WINED3D_GL_EXT_NONE },
885 { STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), NULL }, WINED3D_GL_EXT_NONE },
886 { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), nvrc_texfactor }, WINED3D_GL_EXT_NONE },
887 { STATE_RENDER(WINED3D_RS_ALPHAFUNC), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
888 { STATE_RENDER(WINED3D_RS_ALPHAREF), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
889 { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), state_alpha_test }, WINED3D_GL_EXT_NONE },
890 { STATE_RENDER(WINED3D_RS_COLORKEYENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
891 { STATE_COLOR_KEY, { STATE_COLOR_KEY, state_nop }, WINED3D_GL_EXT_NONE },
892 { STATE_RENDER(WINED3D_RS_FOGCOLOR), { STATE_RENDER(WINED3D_RS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE },
893 { STATE_RENDER(WINED3D_RS_FOGDENSITY), { STATE_RENDER(WINED3D_RS_FOGDENSITY), state_fogdensity }, WINED3D_GL_EXT_NONE },
894 { STATE_RENDER(WINED3D_RS_FOGENABLE), { STATE_RENDER(WINED3D_RS_FOGENABLE), state_fog_fragpart }, WINED3D_GL_EXT_NONE },
895 { STATE_RENDER(WINED3D_RS_FOGTABLEMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
896 { STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
897 { STATE_RENDER(WINED3D_RS_FOGSTART), { STATE_RENDER(WINED3D_RS_FOGSTART), state_fogstartend }, WINED3D_GL_EXT_NONE },
898 { STATE_RENDER(WINED3D_RS_FOGEND), { STATE_RENDER(WINED3D_RS_FOGSTART), NULL }, WINED3D_GL_EXT_NONE },
899 { STATE_RENDER(WINED3D_RS_SHADEMODE), { STATE_RENDER(WINED3D_RS_SHADEMODE), state_shademode }, WINED3D_GL_EXT_NONE },
900 { STATE_SAMPLER(0), { STATE_SAMPLER(0), nvts_texdim }, NV_TEXTURE_SHADER2 },
901 { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, WINED3D_GL_EXT_NONE },
902 { STATE_SAMPLER(1), { STATE_SAMPLER(1), nvts_texdim }, NV_TEXTURE_SHADER2 },
903 { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, WINED3D_GL_EXT_NONE },
904 { STATE_SAMPLER(2), { STATE_SAMPLER(2), nvts_texdim }, NV_TEXTURE_SHADER2 },
905 { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, WINED3D_GL_EXT_NONE },
906 { STATE_SAMPLER(3), { STATE_SAMPLER(3), nvts_texdim }, NV_TEXTURE_SHADER2 },
907 { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, WINED3D_GL_EXT_NONE },
908 { STATE_SAMPLER(4), { STATE_SAMPLER(4), nvts_texdim }, NV_TEXTURE_SHADER2 },
909 { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, WINED3D_GL_EXT_NONE },
910 { STATE_SAMPLER(5), { STATE_SAMPLER(5), nvts_texdim }, NV_TEXTURE_SHADER2 },
911 { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, WINED3D_GL_EXT_NONE },
912 { STATE_SAMPLER(6), { STATE_SAMPLER(6), nvts_texdim }, NV_TEXTURE_SHADER2 },
913 { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, WINED3D_GL_EXT_NONE },
914 { STATE_SAMPLER(7), { STATE_SAMPLER(7), nvts_texdim }, NV_TEXTURE_SHADER2 },
915 { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, WINED3D_GL_EXT_NONE },
916 {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
919 static BOOL nvrc_context_alloc(struct wined3d_context *context)
921 return TRUE;
924 static void nvrc_context_free(struct wined3d_context *context)
929 const struct wined3d_fragment_pipe_ops nvts_fragment_pipeline =
931 nvts_enable,
932 nvrc_fragment_get_caps,
933 nvrc_fragment_get_emul_mask,
934 nvrc_fragment_alloc,
935 nvrc_fragment_free,
936 nvrc_context_alloc,
937 nvrc_context_free,
938 nvts_color_fixup_supported,
939 nvrc_fragmentstate_template,
942 const struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline =
944 nvrc_enable,
945 nvrc_fragment_get_caps,
946 nvrc_fragment_get_emul_mask,
947 nvrc_fragment_alloc,
948 nvrc_fragment_free,
949 nvrc_context_alloc,
950 nvrc_context_free,
951 nvts_color_fixup_supported,
952 nvrc_fragmentstate_template,