rpcrt4: Fix buffer size calculation for arrays with embedded pointers.
[wine/multimedia.git] / dlls / wined3d / nvidia_texture_shader.c
blob136e7f786abaeb6f66a8c18a7add169eb0ae0fc6
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 <math.h>
26 #include <stdio.h>
28 #include "wined3d_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
32 /* Context activation for state handlers is done by the caller. */
34 static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD stage, struct wined3d_context *context)
36 const struct wined3d_gl_info *gl_info = context->gl_info;
37 BOOL bumpmap = FALSE;
39 if (stage > 0
40 && (state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
41 || state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP))
43 bumpmap = TRUE;
44 context->texShaderBumpMap |= (1 << stage);
45 } else {
46 context->texShaderBumpMap &= ~(1 << stage);
49 if (state->textures[stage])
51 switch (state->textures[stage]->target)
53 case GL_TEXTURE_2D:
54 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
55 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
56 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
57 break;
58 case GL_TEXTURE_RECTANGLE_ARB:
59 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
60 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_RECTANGLE_ARB);
61 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
62 break;
63 case GL_TEXTURE_3D:
64 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);
65 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D)");
66 break;
67 case GL_TEXTURE_CUBE_MAP_ARB:
68 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB);
69 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB)");
70 break;
73 else
75 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
76 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE)");
80 struct tex_op_args
82 GLenum input[3];
83 GLenum mapping[3];
84 GLenum component_usage[3];
87 static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx) {
88 switch (d3dta) {
89 case WINED3DTA_DIFFUSE:
90 return GL_PRIMARY_COLOR_NV;
92 case WINED3DTA_CURRENT:
93 if (stage) return GL_SPARE0_NV;
94 else return GL_PRIMARY_COLOR_NV;
96 case WINED3DTA_TEXTURE:
97 if (texture_idx > -1) return GL_TEXTURE0_ARB + texture_idx;
98 else return GL_PRIMARY_COLOR_NV;
100 case WINED3DTA_TFACTOR:
101 return GL_CONSTANT_COLOR0_NV;
103 case WINED3DTA_SPECULAR:
104 return GL_SECONDARY_COLOR_NV;
106 case WINED3DTA_TEMP:
107 return GL_SPARE1_NV;
109 case WINED3DTA_CONSTANT:
110 /* TODO: Support per stage constants (WINED3D_TSS_CONSTANT, NV_register_combiners2) */
111 FIXME("WINED3DTA_CONSTANT, not properly supported.\n");
112 return GL_CONSTANT_COLOR1_NV;
114 default:
115 FIXME("Unrecognized texture arg %#x\n", d3dta);
116 return GL_TEXTURE;
120 static GLenum invert_mapping(GLenum mapping) {
121 if (mapping == GL_UNSIGNED_INVERT_NV) return GL_UNSIGNED_IDENTITY_NV;
122 else if (mapping == GL_UNSIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
124 FIXME("Unhandled mapping %#x\n", mapping);
125 return mapping;
128 static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* input, GLenum* mapping, GLenum *component_usage, INT texture_idx) {
129 /* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
130 * be used. */
131 if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
132 else *mapping = GL_UNSIGNED_IDENTITY_NV; /* Clamp all values to positive ranges */
134 /* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
135 * should be used for all input components. */
136 if (is_alpha || arg & WINED3DTA_ALPHAREPLICATE) *component_usage = GL_ALPHA;
137 else *component_usage = GL_RGB;
139 *input = d3dta_to_combiner_input(arg & WINED3DTA_SELECTMASK, stage, texture_idx);
142 void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, BOOL is_alpha,
143 int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst)
145 struct tex_op_args tex_op_args = {{0}, {0}, {0}};
146 GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
147 GLenum target = GL_COMBINER0_NV + stage;
148 GLenum output;
150 TRACE("stage %d, is_alpha %d, op %s, arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
151 stage, is_alpha, debug_d3dtop(op), arg1, arg2, arg3, texture_idx);
153 /* If a texture stage references an invalid texture unit the stage just
154 * passes through the result from the previous stage */
155 if (is_invalid_op(state, stage, op, arg1, arg2, arg3))
157 arg1 = WINED3DTA_CURRENT;
158 op = WINED3D_TOP_SELECT_ARG1;
161 get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0],
162 &tex_op_args.mapping[0], &tex_op_args.component_usage[0], texture_idx);
163 get_src_and_opr_nvrc(stage, arg2, is_alpha, &tex_op_args.input[1],
164 &tex_op_args.mapping[1], &tex_op_args.component_usage[1], texture_idx);
165 get_src_and_opr_nvrc(stage, arg3, is_alpha, &tex_op_args.input[2],
166 &tex_op_args.mapping[2], &tex_op_args.component_usage[2], texture_idx);
169 if(dst == WINED3DTA_TEMP) {
170 output = GL_SPARE1_NV;
171 } else {
172 output = GL_SPARE0_NV;
175 switch (op)
177 case WINED3D_TOP_DISABLE:
178 /* Only for alpha */
179 if (!is_alpha)
180 ERR("Shouldn't be called for WINED3D_TSS_COLOR_OP (WINED3DTOP_DISABLE).\n");
181 /* Input, prev_alpha*1 */
182 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
183 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
184 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
185 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
187 /* Output */
188 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
189 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
190 break;
192 case WINED3D_TOP_SELECT_ARG1:
193 case WINED3D_TOP_SELECT_ARG2:
194 /* Input, arg*1 */
195 if (op == WINED3D_TOP_SELECT_ARG1)
196 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
197 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
198 else
199 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
200 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
201 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
202 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
204 /* Output */
205 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
206 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
207 break;
209 case WINED3D_TOP_MODULATE:
210 case WINED3D_TOP_MODULATE_2X:
211 case WINED3D_TOP_MODULATE_4X:
212 /* Input, arg1*arg2 */
213 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
214 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
215 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
216 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
218 /* Output */
219 if (op == WINED3D_TOP_MODULATE)
220 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
221 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
222 else if (op == WINED3D_TOP_MODULATE_2X)
223 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
224 GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
225 else if (op == WINED3D_TOP_MODULATE_4X)
226 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
227 GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
228 break;
230 case WINED3D_TOP_ADD:
231 case WINED3D_TOP_ADD_SIGNED:
232 case WINED3D_TOP_ADD_SIGNED_2X:
233 /* Input, arg1*1+arg2*1 */
234 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
235 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
236 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
237 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
238 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
239 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
240 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
241 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
243 /* Output */
244 if (op == WINED3D_TOP_ADD)
245 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
246 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
247 else if (op == WINED3D_TOP_ADD_SIGNED)
248 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
249 output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
250 else if (op == WINED3D_TOP_ADD_SIGNED_2X)
251 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
252 output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
253 break;
255 case WINED3D_TOP_SUBTRACT:
256 /* Input, arg1*1+-arg2*1 */
257 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
258 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
259 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
260 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
261 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
262 tex_op_args.input[1], GL_SIGNED_NEGATE_NV, tex_op_args.component_usage[1]));
263 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
264 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
266 /* Output */
267 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
268 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
269 break;
271 case WINED3D_TOP_ADD_SMOOTH:
272 /* Input, arg1*1+(1-arg1)*arg2 */
273 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
274 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
275 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
276 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
277 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
278 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
279 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
280 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
282 /* Output */
283 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
284 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
285 break;
287 case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
288 case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
289 case WINED3D_TOP_BLEND_FACTOR_ALPHA:
290 case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
291 case WINED3D_TOP_BLEND_CURRENT_ALPHA:
293 GLenum alpha_src = GL_PRIMARY_COLOR_NV;
294 if (op == WINED3D_TOP_BLEND_DIFFUSE_ALPHA)
295 alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx);
296 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA)
297 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
298 else if (op == WINED3D_TOP_BLEND_FACTOR_ALPHA)
299 alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx);
300 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
301 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
302 else if (op == WINED3D_TOP_BLEND_CURRENT_ALPHA)
303 alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx);
304 else
305 FIXME("Unhandled texture op %s, shouldn't happen.\n", debug_d3dtop(op));
307 /* Input, arg1*alpha_src+arg2*(1-alpha_src) */
308 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
309 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
310 if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
312 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
313 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
314 } else {
315 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
316 alpha_src, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
318 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
319 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
320 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
321 alpha_src, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
323 /* Output */
324 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
325 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
326 break;
329 case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
330 /* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */
331 if (is_alpha)
332 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEALPHA_ADDCOLOR).\n");
333 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
334 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
335 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
336 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
337 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
338 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
339 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
340 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
342 /* Output */
343 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
344 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
345 break;
347 case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
348 /* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */
349 if (is_alpha)
350 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATECOLOR_ADDALPHA).\n");
351 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
352 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
353 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
354 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
355 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
356 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
357 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
358 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
360 /* Output */
361 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
362 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
363 break;
365 case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
366 /* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */
367 if (is_alpha)
368 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR).\n");
369 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
370 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), GL_ALPHA));
371 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
372 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
373 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
374 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
375 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
376 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
378 /* Output */
379 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
380 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
381 break;
383 case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
384 /* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */
385 if (is_alpha)
386 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA).\n");
387 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
388 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
389 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
390 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
391 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
392 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
393 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
394 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
396 /* Output */
397 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
398 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
399 break;
401 case WINED3D_TOP_DOTPRODUCT3:
402 /* Input, arg1 . arg2 */
403 /* FIXME: DX7 uses a different calculation? */
404 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
405 tex_op_args.input[0], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[0]));
406 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
407 tex_op_args.input[1], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[1]));
409 /* Output */
410 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
411 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE));
412 break;
414 case WINED3D_TOP_MULTIPLY_ADD:
415 /* Input, arg3*1+arg1*arg2 */
416 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
417 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
418 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
419 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
420 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
421 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
422 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
423 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
425 /* Output */
426 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
427 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
428 break;
430 case WINED3D_TOP_LERP:
431 /* Input, arg3*arg1+(1-arg3)*arg2 */
432 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
433 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
434 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
435 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
436 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
437 tex_op_args.input[2], invert_mapping(tex_op_args.mapping[2]), tex_op_args.component_usage[2]));
438 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
439 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
441 /* Output */
442 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
443 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
444 break;
446 case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
447 case WINED3D_TOP_BUMPENVMAP:
448 if (!gl_info->supported[NV_TEXTURE_SHADER])
450 WARN("BUMPENVMAP requires GL_NV_texture_shader in this codepath\n");
451 break;
454 /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
455 * perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
456 * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
457 * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the
458 * next stage */
459 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
460 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
461 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
462 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
463 /* Always pass through to CURRENT, ignore temp arg */
464 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
465 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
466 break;
468 default:
469 FIXME("Unhandled texture op: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d.\n",
470 stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
473 checkGLcall("set_tex_op_nvrc()");
477 static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
479 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
480 BOOL tex_used = context->fixed_function_usage_map & (1 << stage);
481 DWORD mapped_stage = context->tex_unit_map[stage];
482 const struct wined3d_gl_info *gl_info = context->gl_info;
484 TRACE("Setting color op for stage %u.\n", stage);
486 /* Using a pixel shader? Don't care for anything here, the shader applying does it */
487 if (use_ps(state)) return;
489 if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
491 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
493 if (tex_used && mapped_stage >= gl_info->limits.textures)
495 FIXME("Attempt to enable unsupported stage!\n");
496 return;
498 context_active_texture(context, gl_info, mapped_stage);
501 if (context->lowest_disabled_stage > 0)
503 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
504 GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, context->lowest_disabled_stage));
506 else
508 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
510 if (stage >= context->lowest_disabled_stage)
512 TRACE("Stage disabled\n");
513 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
515 /* Disable everything here */
516 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
517 checkGLcall("glDisable(GL_TEXTURE_2D)");
518 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
519 checkGLcall("glDisable(GL_TEXTURE_3D)");
520 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
522 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
523 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
525 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
527 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
528 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
530 if (gl_info->supported[NV_TEXTURE_SHADER2] && mapped_stage < gl_info->limits.textures)
532 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
535 /* All done */
536 return;
539 /* The sampler will also activate the correct texture dimensions, so no need to do it here
540 * if the sampler for this stage is dirty
542 if (!isStateDirty(context, STATE_SAMPLER(stage)))
544 if (tex_used)
546 if (gl_info->supported[NV_TEXTURE_SHADER2])
548 nvts_activate_dimensions(state, stage, context);
550 else
552 texture_activate_dimensions(state->textures[stage], gl_info);
557 /* Set the texture combiners */
558 set_tex_op_nvrc(gl_info, state, FALSE, stage,
559 state->texture_states[stage][WINED3D_TSS_COLOR_OP],
560 state->texture_states[stage][WINED3D_TSS_COLOR_ARG1],
561 state->texture_states[stage][WINED3D_TSS_COLOR_ARG2],
562 state->texture_states[stage][WINED3D_TSS_COLOR_ARG0],
563 mapped_stage,
564 state->texture_states[stage][WINED3D_TSS_RESULT_ARG]);
566 /* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set,
567 * thus the texture shader may have to be updated
569 if (gl_info->supported[NV_TEXTURE_SHADER2])
571 BOOL usesBump = (state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
572 || state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP);
573 BOOL usedBump = !!(context->texShaderBumpMap & 1 << (stage + 1));
574 if (usesBump != usedBump)
576 context_active_texture(context, gl_info, mapped_stage + 1);
577 nvts_activate_dimensions(state, stage + 1, context);
578 context_active_texture(context, gl_info, mapped_stage);
583 static void nvrc_resultarg(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
585 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
587 TRACE("Setting result arg for stage %u.\n", stage);
589 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP)))
591 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP));
593 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP)))
595 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP));
599 static void nvts_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
601 DWORD sampler = state_id - STATE_SAMPLER(0);
602 DWORD mapped_stage = context->tex_unit_map[sampler];
604 /* No need to enable / disable anything here for unused samplers. The tex_colorop
605 * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
606 * will take care of this business. */
607 if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->limits.textures)
608 return;
609 if (sampler >= context->lowest_disabled_stage)
610 return;
611 if (isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3D_TSS_COLOR_OP)))
612 return;
614 nvts_activate_dimensions(state, sampler, context);
617 static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
619 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
620 DWORD mapped_stage = context->tex_unit_map[stage + 1];
621 const struct wined3d_gl_info *gl_info = context->gl_info;
622 float mat[2][2];
624 /* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to
625 * offset the destination stage(always stage + 1 in d3d). In GL_NV_texture_shader, the bump
626 * map offsetting is done in the stage reading the bump mapped texture, and the perturbation
627 * map is read from a specified source stage(always stage - 1 for d3d). Thus set the matrix
628 * for stage + 1. Keep the nvrc tex unit mapping in mind too
630 if (mapped_stage < gl_info->limits.textures)
632 context_active_texture(context, gl_info, mapped_stage);
634 /* We can't just pass a pointer to the state to GL due to the
635 * different matrix format (column major vs row major). */
636 mat[0][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT00]);
637 mat[1][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT01]);
638 mat[0][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT10]);
639 mat[1][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT11]);
640 gl_info->gl_ops.gl.p_glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float *)mat);
641 checkGLcall("glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)");
645 static void nvrc_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
647 const struct wined3d_gl_info *gl_info = context->gl_info;
648 float col[4];
650 D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col);
651 GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0]));
654 /* Context activation is done by the caller. */
655 static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
657 if (enable)
659 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
660 checkGLcall("glEnable(GL_REGISTER_COMBINERS_NV)");
662 else
664 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
665 checkGLcall("glDisable(GL_REGISTER_COMBINERS_NV)");
669 /* Context activation is done by the caller. */
670 static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
672 nvrc_enable(gl_info, enable);
673 if (enable)
675 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
676 checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
678 else
680 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_SHADER_NV);
681 checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
685 static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
687 caps->wined3d_caps = 0;
688 caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
690 /* The caps below can be supported but aren't handled yet in utils.c
691 * 'd3dta_to_combiner_input', disable them until support is fixed */
692 #if 0
693 if (gl_info->supported[NV_REGISTER_COMBINERS2])
694 caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT;
695 #endif
697 caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD
698 | WINED3DTEXOPCAPS_ADDSIGNED
699 | WINED3DTEXOPCAPS_ADDSIGNED2X
700 | WINED3DTEXOPCAPS_MODULATE
701 | WINED3DTEXOPCAPS_MODULATE2X
702 | WINED3DTEXOPCAPS_MODULATE4X
703 | WINED3DTEXOPCAPS_SELECTARG1
704 | WINED3DTEXOPCAPS_SELECTARG2
705 | WINED3DTEXOPCAPS_DISABLE
706 | WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
707 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
708 | WINED3DTEXOPCAPS_BLENDFACTORALPHA
709 | WINED3DTEXOPCAPS_BLENDCURRENTALPHA
710 | WINED3DTEXOPCAPS_LERP
711 | WINED3DTEXOPCAPS_SUBTRACT
712 | WINED3DTEXOPCAPS_ADDSMOOTH
713 | WINED3DTEXOPCAPS_MULTIPLYADD
714 | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
715 | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
716 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM
717 | WINED3DTEXOPCAPS_DOTPRODUCT3
718 | WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
719 | WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA;
721 if (gl_info->supported[NV_TEXTURE_SHADER2])
723 /* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does
724 * not support 3D textures. This asks for trouble if an app uses both bump mapping
725 * and 3D textures. It also allows us to keep the code simpler by having texture
726 * shaders constantly enabled. */
727 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP;
728 /* TODO: Luminance bump map? */
731 #if 0
732 /* FIXME: Add
733 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE
734 WINED3DTEXOPCAPS_PREMODULATE */
735 #endif
737 caps->MaxTextureBlendStages = min(MAX_TEXTURES, gl_info->limits.general_combiners);
738 caps->MaxSimultaneousTextures = gl_info->limits.textures;
741 static void *nvrc_fragment_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
743 return shader_priv;
746 /* Context activation is done by the caller. */
747 static void nvrc_fragment_free(struct wined3d_device *device) {}
749 /* Two fixed function pipeline implementations using GL_NV_register_combiners and
750 * GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions
751 * are available(geforce 3 and newer), while nvrc_fragment_pipeline uses only the
752 * register combiners extension(Pre-GF3).
755 static BOOL nvts_color_fixup_supported(struct color_fixup_desc fixup)
757 if (TRACE_ON(d3d))
759 TRACE("Checking support for fixup:\n");
760 dump_color_fixup_desc(fixup);
763 /* We only support identity conversions. */
764 if (is_identity_fixup(fixup))
766 TRACE("[OK]\n");
767 return TRUE;
770 TRACE("[FAILED]\n");
771 return FALSE;
774 static const struct StateEntryTemplate nvrc_fragmentstate_template[] =
776 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
777 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
778 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
779 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
780 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
781 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
782 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
783 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
784 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
785 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
786 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
787 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
788 { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
789 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
790 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
791 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
792 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
793 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
794 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
795 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
796 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
797 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
798 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
799 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
800 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
801 { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
802 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
803 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
804 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
805 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
806 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
807 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
808 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
809 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
810 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
811 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
812 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
813 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
814 { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
815 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
816 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
817 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
818 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
819 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
820 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
821 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
822 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
823 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
824 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
825 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
826 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
827 { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
828 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
829 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
830 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
831 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
832 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
833 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
834 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
835 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
836 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
837 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
838 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
839 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
840 { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
841 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
842 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
843 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
844 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
845 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
846 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
847 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
848 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
849 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
850 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
851 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
852 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
853 { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
854 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
855 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
856 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
857 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
858 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
859 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
860 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
861 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
862 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
863 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
864 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
865 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
866 { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
867 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
868 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
869 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
870 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
871 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
872 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
873 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
874 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
875 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
876 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
877 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
878 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
879 { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
880 { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), apply_pixelshader }, WINED3D_GL_EXT_NONE },
881 { STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), NULL }, WINED3D_GL_EXT_NONE },
882 { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), nvrc_texfactor }, WINED3D_GL_EXT_NONE },
883 { STATE_RENDER(WINED3D_RS_FOGCOLOR), { STATE_RENDER(WINED3D_RS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE },
884 { STATE_RENDER(WINED3D_RS_FOGDENSITY), { STATE_RENDER(WINED3D_RS_FOGDENSITY), state_fogdensity }, WINED3D_GL_EXT_NONE },
885 { STATE_RENDER(WINED3D_RS_FOGENABLE), { STATE_RENDER(WINED3D_RS_FOGENABLE), state_fog_fragpart }, WINED3D_GL_EXT_NONE },
886 { STATE_RENDER(WINED3D_RS_FOGTABLEMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
887 { STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
888 { STATE_RENDER(WINED3D_RS_FOGSTART), { STATE_RENDER(WINED3D_RS_FOGSTART), state_fogstartend }, WINED3D_GL_EXT_NONE },
889 { STATE_RENDER(WINED3D_RS_FOGEND), { STATE_RENDER(WINED3D_RS_FOGSTART), NULL }, WINED3D_GL_EXT_NONE },
890 { STATE_SAMPLER(0), { STATE_SAMPLER(0), nvts_texdim }, NV_TEXTURE_SHADER2 },
891 { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, WINED3D_GL_EXT_NONE },
892 { STATE_SAMPLER(1), { STATE_SAMPLER(1), nvts_texdim }, NV_TEXTURE_SHADER2 },
893 { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, WINED3D_GL_EXT_NONE },
894 { STATE_SAMPLER(2), { STATE_SAMPLER(2), nvts_texdim }, NV_TEXTURE_SHADER2 },
895 { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, WINED3D_GL_EXT_NONE },
896 { STATE_SAMPLER(3), { STATE_SAMPLER(3), nvts_texdim }, NV_TEXTURE_SHADER2 },
897 { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, WINED3D_GL_EXT_NONE },
898 { STATE_SAMPLER(4), { STATE_SAMPLER(4), nvts_texdim }, NV_TEXTURE_SHADER2 },
899 { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, WINED3D_GL_EXT_NONE },
900 { STATE_SAMPLER(5), { STATE_SAMPLER(5), nvts_texdim }, NV_TEXTURE_SHADER2 },
901 { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, WINED3D_GL_EXT_NONE },
902 { STATE_SAMPLER(6), { STATE_SAMPLER(6), nvts_texdim }, NV_TEXTURE_SHADER2 },
903 { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, WINED3D_GL_EXT_NONE },
904 { STATE_SAMPLER(7), { STATE_SAMPLER(7), nvts_texdim }, NV_TEXTURE_SHADER2 },
905 { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, WINED3D_GL_EXT_NONE },
906 {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
909 const struct fragment_pipeline nvts_fragment_pipeline = {
910 nvts_enable,
911 nvrc_fragment_get_caps,
912 nvrc_fragment_alloc,
913 nvrc_fragment_free,
914 nvts_color_fixup_supported,
915 nvrc_fragmentstate_template,
918 const struct fragment_pipeline nvrc_fragment_pipeline = {
919 nvrc_enable,
920 nvrc_fragment_get_caps,
921 nvrc_fragment_alloc,
922 nvrc_fragment_free,
923 nvts_color_fixup_supported,
924 nvrc_fragmentstate_template,