wined3d: Pass a wined3d_context_gl structure to nvts_activate_dimensions().
[wine.git] / dlls / wined3d / nvidia_texture_shader.c
blob1cffbe457983568d9251b886c307837594dc6e8f
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
22 #include "config.h"
23 #include "wine/port.h"
25 #include <stdio.h>
27 #include "wined3d_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
31 /* Context activation for state handlers is done by the caller. */
33 static void nvts_activate_dimensions(const struct wined3d_state *state,
34 unsigned int stage, struct wined3d_context_gl *context_gl)
36 const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
37 struct wined3d_texture *texture;
38 BOOL bumpmap = FALSE;
40 if (stage > 0
41 && (state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
42 || state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP))
44 bumpmap = TRUE;
45 context_gl->c.texShaderBumpMap |= (1u << stage);
47 else
49 context_gl->c.texShaderBumpMap &= ~(1u << stage);
52 if ((texture = state->textures[stage]))
54 switch (wined3d_texture_gl(texture)->target)
56 case GL_TEXTURE_2D:
57 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
58 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
59 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
60 break;
61 case GL_TEXTURE_RECTANGLE_ARB:
62 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
63 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_RECTANGLE_ARB);
64 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
65 break;
66 case GL_TEXTURE_3D:
67 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);
68 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D)");
69 break;
70 case GL_TEXTURE_CUBE_MAP_ARB:
71 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB);
72 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB)");
73 break;
74 default:
75 FIXME("Unhandled target %#x.\n", wined3d_texture_gl(texture)->target);
76 break;
79 else
81 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
82 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE)");
86 struct tex_op_args
88 GLenum input[3];
89 GLenum mapping[3];
90 GLenum component_usage[3];
93 static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx) {
94 switch (d3dta) {
95 case WINED3DTA_DIFFUSE:
96 return GL_PRIMARY_COLOR_NV;
98 case WINED3DTA_CURRENT:
99 if (stage) return GL_SPARE0_NV;
100 else return GL_PRIMARY_COLOR_NV;
102 case WINED3DTA_TEXTURE:
103 if (texture_idx > -1) return GL_TEXTURE0_ARB + texture_idx;
104 else return GL_PRIMARY_COLOR_NV;
106 case WINED3DTA_TFACTOR:
107 return GL_CONSTANT_COLOR0_NV;
109 case WINED3DTA_SPECULAR:
110 return GL_SECONDARY_COLOR_NV;
112 case WINED3DTA_TEMP:
113 return GL_SPARE1_NV;
115 case WINED3DTA_CONSTANT:
116 /* TODO: Support per stage constants (WINED3D_TSS_CONSTANT, NV_register_combiners2) */
117 FIXME("WINED3DTA_CONSTANT, not properly supported.\n");
118 return GL_CONSTANT_COLOR1_NV;
120 default:
121 FIXME("Unrecognized texture arg %#x\n", d3dta);
122 return GL_TEXTURE;
126 static GLenum invert_mapping(GLenum mapping) {
127 if (mapping == GL_UNSIGNED_INVERT_NV) return GL_UNSIGNED_IDENTITY_NV;
128 else if (mapping == GL_UNSIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
130 FIXME("Unhandled mapping %#x\n", mapping);
131 return mapping;
134 static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* input, GLenum* mapping, GLenum *component_usage, INT texture_idx) {
135 /* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
136 * be used. */
137 if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
138 else *mapping = GL_UNSIGNED_IDENTITY_NV; /* Clamp all values to positive ranges */
140 /* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
141 * should be used for all input components. */
142 if (is_alpha || arg & WINED3DTA_ALPHAREPLICATE) *component_usage = GL_ALPHA;
143 else *component_usage = GL_RGB;
145 *input = d3dta_to_combiner_input(arg & WINED3DTA_SELECTMASK, stage, texture_idx);
148 void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, BOOL is_alpha,
149 int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst)
151 struct tex_op_args tex_op_args = {{0}, {0}, {0}};
152 GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
153 GLenum target = GL_COMBINER0_NV + stage;
154 GLenum output;
156 TRACE("stage %d, is_alpha %d, op %s, arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
157 stage, is_alpha, debug_d3dtop(op), arg1, arg2, arg3, texture_idx);
159 /* If a texture stage references an invalid texture unit the stage just
160 * passes through the result from the previous stage */
161 if (is_invalid_op(state, stage, op, arg1, arg2, arg3))
163 arg1 = WINED3DTA_CURRENT;
164 op = WINED3D_TOP_SELECT_ARG1;
167 get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0],
168 &tex_op_args.mapping[0], &tex_op_args.component_usage[0], texture_idx);
169 get_src_and_opr_nvrc(stage, arg2, is_alpha, &tex_op_args.input[1],
170 &tex_op_args.mapping[1], &tex_op_args.component_usage[1], texture_idx);
171 get_src_and_opr_nvrc(stage, arg3, is_alpha, &tex_op_args.input[2],
172 &tex_op_args.mapping[2], &tex_op_args.component_usage[2], texture_idx);
175 if(dst == WINED3DTA_TEMP) {
176 output = GL_SPARE1_NV;
177 } else {
178 output = GL_SPARE0_NV;
181 switch (op)
183 case WINED3D_TOP_DISABLE:
184 /* Only for alpha */
185 if (!is_alpha)
186 ERR("Shouldn't be called for WINED3D_TSS_COLOR_OP (WINED3DTOP_DISABLE).\n");
187 /* Input, prev_alpha*1 */
188 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
189 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
190 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
191 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
193 /* Output */
194 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
195 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
196 break;
198 case WINED3D_TOP_SELECT_ARG1:
199 case WINED3D_TOP_SELECT_ARG2:
200 /* Input, arg*1 */
201 if (op == WINED3D_TOP_SELECT_ARG1)
202 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
203 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
204 else
205 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
206 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
207 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
208 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
210 /* Output */
211 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
212 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
213 break;
215 case WINED3D_TOP_MODULATE:
216 case WINED3D_TOP_MODULATE_2X:
217 case WINED3D_TOP_MODULATE_4X:
218 /* Input, arg1*arg2 */
219 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
220 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
221 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
222 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
224 /* Output */
225 if (op == WINED3D_TOP_MODULATE)
226 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
227 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
228 else if (op == WINED3D_TOP_MODULATE_2X)
229 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
230 GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
231 else if (op == WINED3D_TOP_MODULATE_4X)
232 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
233 GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
234 break;
236 case WINED3D_TOP_ADD:
237 case WINED3D_TOP_ADD_SIGNED:
238 case WINED3D_TOP_ADD_SIGNED_2X:
239 /* Input, arg1*1+arg2*1 */
240 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
241 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
242 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
243 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
244 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
245 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
246 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
247 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
249 /* Output */
250 if (op == WINED3D_TOP_ADD)
251 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
252 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
253 else if (op == WINED3D_TOP_ADD_SIGNED)
254 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
255 output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
256 else if (op == WINED3D_TOP_ADD_SIGNED_2X)
257 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
258 output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
259 break;
261 case WINED3D_TOP_SUBTRACT:
262 /* Input, arg1*1+-arg2*1 */
263 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
264 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
265 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
266 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
267 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
268 tex_op_args.input[1], GL_SIGNED_NEGATE_NV, tex_op_args.component_usage[1]));
269 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
270 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
272 /* Output */
273 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
274 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
275 break;
277 case WINED3D_TOP_ADD_SMOOTH:
278 /* Input, arg1*1+(1-arg1)*arg2 */
279 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
280 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
281 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
282 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
283 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
284 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
285 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
286 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
288 /* Output */
289 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
290 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
291 break;
293 case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
294 case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
295 case WINED3D_TOP_BLEND_FACTOR_ALPHA:
296 case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
297 case WINED3D_TOP_BLEND_CURRENT_ALPHA:
299 GLenum alpha_src = GL_PRIMARY_COLOR_NV;
300 if (op == WINED3D_TOP_BLEND_DIFFUSE_ALPHA)
301 alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx);
302 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA)
303 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
304 else if (op == WINED3D_TOP_BLEND_FACTOR_ALPHA)
305 alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx);
306 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
307 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
308 else if (op == WINED3D_TOP_BLEND_CURRENT_ALPHA)
309 alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx);
310 else
311 FIXME("Unhandled texture op %s, shouldn't happen.\n", debug_d3dtop(op));
313 /* Input, arg1*alpha_src+arg2*(1-alpha_src) */
314 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
315 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
316 if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
318 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
319 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
320 } else {
321 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
322 alpha_src, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
324 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
325 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
326 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
327 alpha_src, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
329 /* Output */
330 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
331 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
332 break;
335 case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
336 /* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */
337 if (is_alpha)
338 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEALPHA_ADDCOLOR).\n");
339 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
340 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
341 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
342 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
343 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
344 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
345 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
346 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
348 /* Output */
349 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
350 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
351 break;
353 case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
354 /* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */
355 if (is_alpha)
356 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATECOLOR_ADDALPHA).\n");
357 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
358 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
359 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
360 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
361 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
362 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
363 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
364 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
366 /* Output */
367 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
368 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
369 break;
371 case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
372 /* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */
373 if (is_alpha)
374 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR).\n");
375 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
376 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), GL_ALPHA));
377 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
378 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
379 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
380 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
381 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
382 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
384 /* Output */
385 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
386 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
387 break;
389 case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
390 /* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */
391 if (is_alpha)
392 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA).\n");
393 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
394 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
395 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
396 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
397 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
398 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
399 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
400 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
402 /* Output */
403 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
404 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
405 break;
407 case WINED3D_TOP_DOTPRODUCT3:
408 /* Input, arg1 . arg2 */
409 /* FIXME: DX7 uses a different calculation? */
410 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
411 tex_op_args.input[0], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[0]));
412 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
413 tex_op_args.input[1], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[1]));
415 /* Output */
416 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
417 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE));
418 break;
420 case WINED3D_TOP_MULTIPLY_ADD:
421 /* Input, arg3*1+arg1*arg2 */
422 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
423 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
424 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
425 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
426 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
427 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
428 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
429 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
431 /* Output */
432 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
433 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
434 break;
436 case WINED3D_TOP_LERP:
437 /* Input, arg3*arg1+(1-arg3)*arg2 */
438 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
439 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
440 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
441 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
442 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
443 tex_op_args.input[2], invert_mapping(tex_op_args.mapping[2]), tex_op_args.component_usage[2]));
444 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
445 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
447 /* Output */
448 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
449 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
450 break;
452 case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
453 case WINED3D_TOP_BUMPENVMAP:
454 if (!gl_info->supported[NV_TEXTURE_SHADER])
456 WARN("BUMPENVMAP requires GL_NV_texture_shader in this codepath\n");
457 break;
460 /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
461 * perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
462 * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
463 * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the
464 * next stage */
465 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
466 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
467 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
468 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
469 /* Always pass through to CURRENT, ignore temp arg */
470 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
471 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
472 break;
474 default:
475 FIXME("Unhandled texture op: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d.\n",
476 stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
479 checkGLcall("set_tex_op_nvrc()");
483 static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
485 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
486 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
487 BOOL tex_used = context->fixed_function_usage_map & (1u << stage);
488 unsigned int mapped_stage = context_gl->tex_unit_map[stage];
489 const struct wined3d_gl_info *gl_info = context->gl_info;
491 TRACE("Setting color op for stage %u.\n", stage);
493 /* Using a pixel shader? Don't care for anything here, the shader applying does it */
494 if (use_ps(state)) return;
496 if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
498 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
500 if (tex_used && mapped_stage >= gl_info->limits.textures)
502 FIXME("Attempt to enable unsupported stage!\n");
503 return;
505 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
508 if (context->lowest_disabled_stage > 0)
510 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
511 GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, context->lowest_disabled_stage));
513 else
515 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
517 if (stage >= context->lowest_disabled_stage)
519 TRACE("Stage disabled\n");
520 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
522 /* Disable everything here */
523 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
524 checkGLcall("glDisable(GL_TEXTURE_2D)");
525 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
526 checkGLcall("glDisable(GL_TEXTURE_3D)");
527 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
529 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
530 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
532 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
534 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
535 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
537 if (gl_info->supported[NV_TEXTURE_SHADER2] && mapped_stage < gl_info->limits.textures)
539 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
542 /* All done */
543 return;
546 /* The sampler will also activate the correct texture dimensions, so no need to do it here
547 * if the sampler for this stage is dirty
549 if (!isStateDirty(context, STATE_SAMPLER(stage)))
551 if (tex_used)
553 if (gl_info->supported[NV_TEXTURE_SHADER2])
554 nvts_activate_dimensions(state, stage, context_gl);
555 else
556 texture_activate_dimensions(state->textures[stage], gl_info);
560 /* Set the texture combiners */
561 set_tex_op_nvrc(gl_info, state, FALSE, stage,
562 state->texture_states[stage][WINED3D_TSS_COLOR_OP],
563 state->texture_states[stage][WINED3D_TSS_COLOR_ARG1],
564 state->texture_states[stage][WINED3D_TSS_COLOR_ARG2],
565 state->texture_states[stage][WINED3D_TSS_COLOR_ARG0],
566 mapped_stage,
567 state->texture_states[stage][WINED3D_TSS_RESULT_ARG]);
569 /* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set,
570 * thus the texture shader may have to be updated
572 if (gl_info->supported[NV_TEXTURE_SHADER2])
574 BOOL usesBump = (state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
575 || state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP);
576 BOOL usedBump = !!(context->texShaderBumpMap & 1u << (stage + 1));
577 if (usesBump != usedBump)
579 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage + 1);
580 nvts_activate_dimensions(state, stage + 1, context_gl);
581 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
586 static void nvrc_resultarg(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
588 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
590 TRACE("Setting result arg for stage %u.\n", stage);
592 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP)))
594 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP));
596 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP)))
598 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP));
602 static void nvts_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
604 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
605 unsigned int sampler, mapped_stage;
607 sampler = state_id - STATE_SAMPLER(0);
608 mapped_stage = context_gl->tex_unit_map[sampler];
610 /* No need to enable / disable anything here for unused samplers. The tex_colorop
611 * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
612 * will take care of this business. */
613 if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->limits.textures)
614 return;
615 if (sampler >= context->lowest_disabled_stage)
616 return;
617 if (isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3D_TSS_COLOR_OP)))
618 return;
620 nvts_activate_dimensions(state, sampler, context_gl);
623 static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
625 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
626 struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
627 unsigned int mapped_stage = context_gl->tex_unit_map[stage + 1];
628 const struct wined3d_gl_info *gl_info = context->gl_info;
629 float mat[2][2];
631 /* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to
632 * offset the destination stage(always stage + 1 in d3d). In GL_NV_texture_shader, the bump
633 * map offsetting is done in the stage reading the bump mapped texture, and the perturbation
634 * map is read from a specified source stage(always stage - 1 for d3d). Thus set the matrix
635 * for stage + 1. Keep the nvrc tex unit mapping in mind too
637 if (mapped_stage < gl_info->limits.textures)
639 wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
641 /* We can't just pass a pointer to the state to GL due to the
642 * different matrix format (column major vs row major). */
643 mat[0][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT00]);
644 mat[1][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT01]);
645 mat[0][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT10]);
646 mat[1][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT11]);
647 gl_info->gl_ops.gl.p_glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float *)mat);
648 checkGLcall("glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)");
652 static void nvrc_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
654 const struct wined3d_gl_info *gl_info = context->gl_info;
655 struct wined3d_color color;
657 wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_TEXTUREFACTOR]);
658 GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &color.r));
661 /* Context activation is done by the caller. */
662 static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
664 if (enable)
666 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
667 checkGLcall("glEnable(GL_REGISTER_COMBINERS_NV)");
669 else
671 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
672 checkGLcall("glDisable(GL_REGISTER_COMBINERS_NV)");
676 /* Context activation is done by the caller. */
677 static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
679 nvrc_enable(gl_info, enable);
680 if (enable)
682 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
683 checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
685 else
687 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_SHADER_NV);
688 checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
692 static void nvrc_fragment_get_caps(const struct wined3d_adapter *adapter, struct fragment_caps *caps)
694 const struct wined3d_gl_info *gl_info = &adapter->gl_info;
696 caps->wined3d_caps = 0;
697 caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
699 /* The caps below can be supported but aren't handled yet in utils.c
700 * 'd3dta_to_combiner_input', disable them until support is fixed */
701 #if 0
702 if (gl_info->supported[NV_REGISTER_COMBINERS2])
703 caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT;
704 #endif
706 caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD
707 | WINED3DTEXOPCAPS_ADDSIGNED
708 | WINED3DTEXOPCAPS_ADDSIGNED2X
709 | WINED3DTEXOPCAPS_MODULATE
710 | WINED3DTEXOPCAPS_MODULATE2X
711 | WINED3DTEXOPCAPS_MODULATE4X
712 | WINED3DTEXOPCAPS_SELECTARG1
713 | WINED3DTEXOPCAPS_SELECTARG2
714 | WINED3DTEXOPCAPS_DISABLE
715 | WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
716 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
717 | WINED3DTEXOPCAPS_BLENDFACTORALPHA
718 | WINED3DTEXOPCAPS_BLENDCURRENTALPHA
719 | WINED3DTEXOPCAPS_LERP
720 | WINED3DTEXOPCAPS_SUBTRACT
721 | WINED3DTEXOPCAPS_ADDSMOOTH
722 | WINED3DTEXOPCAPS_MULTIPLYADD
723 | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
724 | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
725 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM
726 | WINED3DTEXOPCAPS_DOTPRODUCT3
727 | WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
728 | WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA;
730 if (gl_info->supported[NV_TEXTURE_SHADER2])
732 /* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does
733 * not support 3D textures. This asks for trouble if an app uses both bump mapping
734 * and 3D textures. It also allows us to keep the code simpler by having texture
735 * shaders constantly enabled. */
736 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP;
737 /* TODO: Luminance bump map? */
740 #if 0
741 /* FIXME: Add
742 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE
743 WINED3DTEXOPCAPS_PREMODULATE */
744 #endif
746 caps->MaxTextureBlendStages = min(WINED3D_MAX_TEXTURES, gl_info->limits.general_combiners);
747 caps->MaxSimultaneousTextures = gl_info->limits.textures;
750 static DWORD nvrc_fragment_get_emul_mask(const struct wined3d_gl_info *gl_info)
752 return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
755 static void *nvrc_fragment_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
757 return shader_priv;
760 /* Context activation is done by the caller. */
761 static void nvrc_fragment_free(struct wined3d_device *device, struct wined3d_context *context) {}
763 /* Two fixed function pipeline implementations using GL_NV_register_combiners and
764 * GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions
765 * are available(geforce 3 and newer), while nvrc_fragment_pipeline uses only the
766 * register combiners extension(Pre-GF3).
769 static BOOL nvts_color_fixup_supported(struct color_fixup_desc fixup)
771 /* We only support identity conversions. */
772 return is_identity_fixup(fixup);
775 static const struct wined3d_state_entry_template nvrc_fragmentstate_template[] =
777 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
778 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
779 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
780 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
781 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
782 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
783 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
784 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
785 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
786 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
787 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
788 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
789 { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
790 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
791 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
792 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
793 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
794 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
795 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
796 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
797 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
798 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
799 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
800 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
801 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
802 { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
803 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
804 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
805 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
806 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
807 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
808 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
809 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
810 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
811 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
812 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
813 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
814 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
815 { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
816 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
817 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
818 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
819 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
820 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
821 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
822 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
823 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
824 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
825 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
826 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
827 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
828 { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
829 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
830 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
831 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
832 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
833 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
834 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
835 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
836 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
837 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
838 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
839 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
840 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
841 { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
842 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
843 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
844 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
845 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
846 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
847 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
848 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
849 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
850 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
851 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
852 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
853 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
854 { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
855 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
856 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
857 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
858 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
859 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
860 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
861 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
862 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
863 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
864 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
865 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
866 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
867 { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
868 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
869 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
870 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
871 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
872 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
873 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
874 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
875 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
876 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
877 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
878 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
879 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
880 { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
881 { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), apply_pixelshader }, WINED3D_GL_EXT_NONE },
882 { STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), NULL }, WINED3D_GL_EXT_NONE },
883 { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), nvrc_texfactor }, WINED3D_GL_EXT_NONE },
884 { STATE_RENDER(WINED3D_RS_ALPHAFUNC), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
885 { STATE_RENDER(WINED3D_RS_ALPHAREF), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
886 { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), state_alpha_test }, WINED3D_GL_EXT_NONE },
887 { STATE_RENDER(WINED3D_RS_COLORKEYENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
888 { STATE_COLOR_KEY, { STATE_COLOR_KEY, state_nop }, WINED3D_GL_EXT_NONE },
889 { STATE_RENDER(WINED3D_RS_FOGCOLOR), { STATE_RENDER(WINED3D_RS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE },
890 { STATE_RENDER(WINED3D_RS_FOGDENSITY), { STATE_RENDER(WINED3D_RS_FOGDENSITY), state_fogdensity }, WINED3D_GL_EXT_NONE },
891 { STATE_RENDER(WINED3D_RS_FOGENABLE), { STATE_RENDER(WINED3D_RS_FOGENABLE), state_fog_fragpart }, WINED3D_GL_EXT_NONE },
892 { STATE_RENDER(WINED3D_RS_FOGTABLEMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
893 { STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
894 { STATE_RENDER(WINED3D_RS_FOGSTART), { STATE_RENDER(WINED3D_RS_FOGSTART), state_fogstartend }, WINED3D_GL_EXT_NONE },
895 { STATE_RENDER(WINED3D_RS_FOGEND), { STATE_RENDER(WINED3D_RS_FOGSTART), NULL }, WINED3D_GL_EXT_NONE },
896 { STATE_RENDER(WINED3D_RS_SHADEMODE), { STATE_RENDER(WINED3D_RS_SHADEMODE), state_shademode }, WINED3D_GL_EXT_NONE },
897 { STATE_SAMPLER(0), { STATE_SAMPLER(0), nvts_texdim }, NV_TEXTURE_SHADER2 },
898 { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, WINED3D_GL_EXT_NONE },
899 { STATE_SAMPLER(1), { STATE_SAMPLER(1), nvts_texdim }, NV_TEXTURE_SHADER2 },
900 { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, WINED3D_GL_EXT_NONE },
901 { STATE_SAMPLER(2), { STATE_SAMPLER(2), nvts_texdim }, NV_TEXTURE_SHADER2 },
902 { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, WINED3D_GL_EXT_NONE },
903 { STATE_SAMPLER(3), { STATE_SAMPLER(3), nvts_texdim }, NV_TEXTURE_SHADER2 },
904 { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, WINED3D_GL_EXT_NONE },
905 { STATE_SAMPLER(4), { STATE_SAMPLER(4), nvts_texdim }, NV_TEXTURE_SHADER2 },
906 { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, WINED3D_GL_EXT_NONE },
907 { STATE_SAMPLER(5), { STATE_SAMPLER(5), nvts_texdim }, NV_TEXTURE_SHADER2 },
908 { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, WINED3D_GL_EXT_NONE },
909 { STATE_SAMPLER(6), { STATE_SAMPLER(6), nvts_texdim }, NV_TEXTURE_SHADER2 },
910 { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, WINED3D_GL_EXT_NONE },
911 { STATE_SAMPLER(7), { STATE_SAMPLER(7), nvts_texdim }, NV_TEXTURE_SHADER2 },
912 { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, WINED3D_GL_EXT_NONE },
913 {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
916 static BOOL nvrc_context_alloc(struct wined3d_context *context)
918 return TRUE;
921 static void nvrc_context_free(struct wined3d_context *context)
926 const struct fragment_pipeline nvts_fragment_pipeline = {
927 nvts_enable,
928 nvrc_fragment_get_caps,
929 nvrc_fragment_get_emul_mask,
930 nvrc_fragment_alloc,
931 nvrc_fragment_free,
932 nvrc_context_alloc,
933 nvrc_context_free,
934 nvts_color_fixup_supported,
935 nvrc_fragmentstate_template,
938 const struct fragment_pipeline nvrc_fragment_pipeline = {
939 nvrc_enable,
940 nvrc_fragment_get_caps,
941 nvrc_fragment_get_emul_mask,
942 nvrc_fragment_alloc,
943 nvrc_fragment_free,
944 nvrc_context_alloc,
945 nvrc_context_free,
946 nvts_color_fixup_supported,
947 nvrc_fragmentstate_template,