oledb32/tests: Fix incorrect usage of broken() function.
[wine.git] / dlls / wined3d / nvidia_texture_shader.c
blobd329656177bacc15207d9ca820379e6b50a1b41f
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 |= (1u << stage);
46 else
48 context->texShaderBumpMap &= ~(1u << stage);
51 if (state->textures[stage])
53 switch (state->textures[stage]->target)
55 case GL_TEXTURE_2D:
56 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
57 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
58 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
59 break;
60 case GL_TEXTURE_RECTANGLE_ARB:
61 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
62 bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_RECTANGLE_ARB);
63 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
64 break;
65 case GL_TEXTURE_3D:
66 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);
67 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D)");
68 break;
69 case GL_TEXTURE_CUBE_MAP_ARB:
70 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB);
71 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB)");
72 break;
75 else
77 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
78 checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE)");
82 struct tex_op_args
84 GLenum input[3];
85 GLenum mapping[3];
86 GLenum component_usage[3];
89 static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx) {
90 switch (d3dta) {
91 case WINED3DTA_DIFFUSE:
92 return GL_PRIMARY_COLOR_NV;
94 case WINED3DTA_CURRENT:
95 if (stage) return GL_SPARE0_NV;
96 else return GL_PRIMARY_COLOR_NV;
98 case WINED3DTA_TEXTURE:
99 if (texture_idx > -1) return GL_TEXTURE0_ARB + texture_idx;
100 else return GL_PRIMARY_COLOR_NV;
102 case WINED3DTA_TFACTOR:
103 return GL_CONSTANT_COLOR0_NV;
105 case WINED3DTA_SPECULAR:
106 return GL_SECONDARY_COLOR_NV;
108 case WINED3DTA_TEMP:
109 return GL_SPARE1_NV;
111 case WINED3DTA_CONSTANT:
112 /* TODO: Support per stage constants (WINED3D_TSS_CONSTANT, NV_register_combiners2) */
113 FIXME("WINED3DTA_CONSTANT, not properly supported.\n");
114 return GL_CONSTANT_COLOR1_NV;
116 default:
117 FIXME("Unrecognized texture arg %#x\n", d3dta);
118 return GL_TEXTURE;
122 static GLenum invert_mapping(GLenum mapping) {
123 if (mapping == GL_UNSIGNED_INVERT_NV) return GL_UNSIGNED_IDENTITY_NV;
124 else if (mapping == GL_UNSIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
126 FIXME("Unhandled mapping %#x\n", mapping);
127 return mapping;
130 static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* input, GLenum* mapping, GLenum *component_usage, INT texture_idx) {
131 /* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
132 * be used. */
133 if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
134 else *mapping = GL_UNSIGNED_IDENTITY_NV; /* Clamp all values to positive ranges */
136 /* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
137 * should be used for all input components. */
138 if (is_alpha || arg & WINED3DTA_ALPHAREPLICATE) *component_usage = GL_ALPHA;
139 else *component_usage = GL_RGB;
141 *input = d3dta_to_combiner_input(arg & WINED3DTA_SELECTMASK, stage, texture_idx);
144 void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, BOOL is_alpha,
145 int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst)
147 struct tex_op_args tex_op_args = {{0}, {0}, {0}};
148 GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
149 GLenum target = GL_COMBINER0_NV + stage;
150 GLenum output;
152 TRACE("stage %d, is_alpha %d, op %s, arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
153 stage, is_alpha, debug_d3dtop(op), arg1, arg2, arg3, texture_idx);
155 /* If a texture stage references an invalid texture unit the stage just
156 * passes through the result from the previous stage */
157 if (is_invalid_op(state, stage, op, arg1, arg2, arg3))
159 arg1 = WINED3DTA_CURRENT;
160 op = WINED3D_TOP_SELECT_ARG1;
163 get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0],
164 &tex_op_args.mapping[0], &tex_op_args.component_usage[0], texture_idx);
165 get_src_and_opr_nvrc(stage, arg2, is_alpha, &tex_op_args.input[1],
166 &tex_op_args.mapping[1], &tex_op_args.component_usage[1], texture_idx);
167 get_src_and_opr_nvrc(stage, arg3, is_alpha, &tex_op_args.input[2],
168 &tex_op_args.mapping[2], &tex_op_args.component_usage[2], texture_idx);
171 if(dst == WINED3DTA_TEMP) {
172 output = GL_SPARE1_NV;
173 } else {
174 output = GL_SPARE0_NV;
177 switch (op)
179 case WINED3D_TOP_DISABLE:
180 /* Only for alpha */
181 if (!is_alpha)
182 ERR("Shouldn't be called for WINED3D_TSS_COLOR_OP (WINED3DTOP_DISABLE).\n");
183 /* Input, prev_alpha*1 */
184 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
185 GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
186 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
187 GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
189 /* Output */
190 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
191 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
192 break;
194 case WINED3D_TOP_SELECT_ARG1:
195 case WINED3D_TOP_SELECT_ARG2:
196 /* Input, arg*1 */
197 if (op == WINED3D_TOP_SELECT_ARG1)
198 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
199 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
200 else
201 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
202 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
203 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
204 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
206 /* Output */
207 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
208 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
209 break;
211 case WINED3D_TOP_MODULATE:
212 case WINED3D_TOP_MODULATE_2X:
213 case WINED3D_TOP_MODULATE_4X:
214 /* Input, arg1*arg2 */
215 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
216 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
217 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
218 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
220 /* Output */
221 if (op == WINED3D_TOP_MODULATE)
222 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
223 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
224 else if (op == WINED3D_TOP_MODULATE_2X)
225 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
226 GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
227 else if (op == WINED3D_TOP_MODULATE_4X)
228 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
229 GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
230 break;
232 case WINED3D_TOP_ADD:
233 case WINED3D_TOP_ADD_SIGNED:
234 case WINED3D_TOP_ADD_SIGNED_2X:
235 /* Input, arg1*1+arg2*1 */
236 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
237 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
238 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
239 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
240 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
241 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
242 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
243 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
245 /* Output */
246 if (op == WINED3D_TOP_ADD)
247 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
248 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
249 else if (op == WINED3D_TOP_ADD_SIGNED)
250 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
251 output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
252 else if (op == WINED3D_TOP_ADD_SIGNED_2X)
253 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
254 output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
255 break;
257 case WINED3D_TOP_SUBTRACT:
258 /* Input, arg1*1+-arg2*1 */
259 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
260 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
261 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
262 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
263 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
264 tex_op_args.input[1], GL_SIGNED_NEGATE_NV, tex_op_args.component_usage[1]));
265 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
266 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
268 /* Output */
269 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
270 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
271 break;
273 case WINED3D_TOP_ADD_SMOOTH:
274 /* Input, arg1*1+(1-arg1)*arg2 */
275 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
276 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
277 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
278 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
279 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
280 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
281 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
282 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
284 /* Output */
285 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
286 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
287 break;
289 case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
290 case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
291 case WINED3D_TOP_BLEND_FACTOR_ALPHA:
292 case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
293 case WINED3D_TOP_BLEND_CURRENT_ALPHA:
295 GLenum alpha_src = GL_PRIMARY_COLOR_NV;
296 if (op == WINED3D_TOP_BLEND_DIFFUSE_ALPHA)
297 alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx);
298 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA)
299 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
300 else if (op == WINED3D_TOP_BLEND_FACTOR_ALPHA)
301 alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx);
302 else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
303 alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
304 else if (op == WINED3D_TOP_BLEND_CURRENT_ALPHA)
305 alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx);
306 else
307 FIXME("Unhandled texture op %s, shouldn't happen.\n", debug_d3dtop(op));
309 /* Input, arg1*alpha_src+arg2*(1-alpha_src) */
310 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
311 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
312 if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
314 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
315 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
316 } else {
317 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
318 alpha_src, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
320 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
321 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
322 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
323 alpha_src, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
325 /* Output */
326 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
327 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
328 break;
331 case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
332 /* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */
333 if (is_alpha)
334 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEALPHA_ADDCOLOR).\n");
335 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
336 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
337 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
338 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
339 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
340 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
341 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
342 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
344 /* Output */
345 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
346 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
347 break;
349 case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
350 /* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */
351 if (is_alpha)
352 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATECOLOR_ADDALPHA).\n");
353 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
354 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
355 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
356 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
357 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
358 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
359 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
360 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
362 /* Output */
363 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
364 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
365 break;
367 case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
368 /* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */
369 if (is_alpha)
370 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR).\n");
371 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
372 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), GL_ALPHA));
373 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
374 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
375 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
376 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
377 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
378 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
380 /* Output */
381 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
382 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
383 break;
385 case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
386 /* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */
387 if (is_alpha)
388 ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA).\n");
389 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
390 tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
391 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
392 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
393 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
394 tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
395 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
396 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
398 /* Output */
399 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
400 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
401 break;
403 case WINED3D_TOP_DOTPRODUCT3:
404 /* Input, arg1 . arg2 */
405 /* FIXME: DX7 uses a different calculation? */
406 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
407 tex_op_args.input[0], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[0]));
408 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
409 tex_op_args.input[1], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[1]));
411 /* Output */
412 GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
413 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE));
414 break;
416 case WINED3D_TOP_MULTIPLY_ADD:
417 /* Input, arg3*1+arg1*arg2 */
418 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
419 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
420 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
421 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
422 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
423 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
424 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
425 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
427 /* Output */
428 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
429 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
430 break;
432 case WINED3D_TOP_LERP:
433 /* Input, arg3*arg1+(1-arg3)*arg2 */
434 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
435 tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
436 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
437 tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
438 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
439 tex_op_args.input[2], invert_mapping(tex_op_args.mapping[2]), tex_op_args.component_usage[2]));
440 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
441 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
443 /* Output */
444 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
445 output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
446 break;
448 case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
449 case WINED3D_TOP_BUMPENVMAP:
450 if (!gl_info->supported[NV_TEXTURE_SHADER])
452 WARN("BUMPENVMAP requires GL_NV_texture_shader in this codepath\n");
453 break;
456 /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
457 * perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
458 * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
459 * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the
460 * next stage */
461 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
462 tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
463 GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
464 GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
465 /* Always pass through to CURRENT, ignore temp arg */
466 GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
467 GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
468 break;
470 default:
471 FIXME("Unhandled texture op: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d.\n",
472 stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
475 checkGLcall("set_tex_op_nvrc()");
479 static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
481 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
482 BOOL tex_used = context->fixed_function_usage_map & (1u << stage);
483 DWORD mapped_stage = context->tex_unit_map[stage];
484 const struct wined3d_gl_info *gl_info = context->gl_info;
486 TRACE("Setting color op for stage %u.\n", stage);
488 /* Using a pixel shader? Don't care for anything here, the shader applying does it */
489 if (use_ps(state)) return;
491 if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
493 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
495 if (tex_used && mapped_stage >= gl_info->limits.textures)
497 FIXME("Attempt to enable unsupported stage!\n");
498 return;
500 context_active_texture(context, gl_info, mapped_stage);
503 if (context->lowest_disabled_stage > 0)
505 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
506 GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, context->lowest_disabled_stage));
508 else
510 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
512 if (stage >= context->lowest_disabled_stage)
514 TRACE("Stage disabled\n");
515 if (mapped_stage != WINED3D_UNMAPPED_STAGE)
517 /* Disable everything here */
518 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D);
519 checkGLcall("glDisable(GL_TEXTURE_2D)");
520 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
521 checkGLcall("glDisable(GL_TEXTURE_3D)");
522 if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
524 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
525 checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
527 if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
529 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB);
530 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
532 if (gl_info->supported[NV_TEXTURE_SHADER2] && mapped_stage < gl_info->limits.textures)
534 gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
537 /* All done */
538 return;
541 /* The sampler will also activate the correct texture dimensions, so no need to do it here
542 * if the sampler for this stage is dirty
544 if (!isStateDirty(context, STATE_SAMPLER(stage)))
546 if (tex_used)
548 if (gl_info->supported[NV_TEXTURE_SHADER2])
550 nvts_activate_dimensions(state, stage, context);
552 else
554 texture_activate_dimensions(state->textures[stage], gl_info);
559 /* Set the texture combiners */
560 set_tex_op_nvrc(gl_info, state, FALSE, stage,
561 state->texture_states[stage][WINED3D_TSS_COLOR_OP],
562 state->texture_states[stage][WINED3D_TSS_COLOR_ARG1],
563 state->texture_states[stage][WINED3D_TSS_COLOR_ARG2],
564 state->texture_states[stage][WINED3D_TSS_COLOR_ARG0],
565 mapped_stage,
566 state->texture_states[stage][WINED3D_TSS_RESULT_ARG]);
568 /* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set,
569 * thus the texture shader may have to be updated
571 if (gl_info->supported[NV_TEXTURE_SHADER2])
573 BOOL usesBump = (state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
574 || state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP);
575 BOOL usedBump = !!(context->texShaderBumpMap & 1u << (stage + 1));
576 if (usesBump != usedBump)
578 context_active_texture(context, gl_info, mapped_stage + 1);
579 nvts_activate_dimensions(state, stage + 1, context);
580 context_active_texture(context, gl_info, mapped_stage);
585 static void nvrc_resultarg(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
587 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
589 TRACE("Setting result arg for stage %u.\n", stage);
591 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP)))
593 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP));
595 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP)))
597 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP));
601 static void nvts_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
603 DWORD sampler = state_id - STATE_SAMPLER(0);
604 DWORD mapped_stage = context->tex_unit_map[sampler];
606 /* No need to enable / disable anything here for unused samplers. The tex_colorop
607 * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
608 * will take care of this business. */
609 if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->limits.textures)
610 return;
611 if (sampler >= context->lowest_disabled_stage)
612 return;
613 if (isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3D_TSS_COLOR_OP)))
614 return;
616 nvts_activate_dimensions(state, sampler, context);
619 static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
621 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
622 DWORD mapped_stage = context->tex_unit_map[stage + 1];
623 const struct wined3d_gl_info *gl_info = context->gl_info;
624 float mat[2][2];
626 /* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to
627 * offset the destination stage(always stage + 1 in d3d). In GL_NV_texture_shader, the bump
628 * map offsetting is done in the stage reading the bump mapped texture, and the perturbation
629 * map is read from a specified source stage(always stage - 1 for d3d). Thus set the matrix
630 * for stage + 1. Keep the nvrc tex unit mapping in mind too
632 if (mapped_stage < gl_info->limits.textures)
634 context_active_texture(context, gl_info, mapped_stage);
636 /* We can't just pass a pointer to the state to GL due to the
637 * different matrix format (column major vs row major). */
638 mat[0][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT00]);
639 mat[1][0] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT01]);
640 mat[0][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT10]);
641 mat[1][1] = *((float *)&state->texture_states[stage][WINED3D_TSS_BUMPENV_MAT11]);
642 gl_info->gl_ops.gl.p_glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float *)mat);
643 checkGLcall("glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)");
647 static void nvrc_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
649 const struct wined3d_gl_info *gl_info = context->gl_info;
650 struct wined3d_color color;
652 wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_TEXTUREFACTOR]);
653 GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &color.r));
656 /* Context activation is done by the caller. */
657 static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
659 if (enable)
661 gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
662 checkGLcall("glEnable(GL_REGISTER_COMBINERS_NV)");
664 else
666 gl_info->gl_ops.gl.p_glDisable(GL_REGISTER_COMBINERS_NV);
667 checkGLcall("glDisable(GL_REGISTER_COMBINERS_NV)");
671 /* Context activation is done by the caller. */
672 static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
674 nvrc_enable(gl_info, enable);
675 if (enable)
677 gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
678 checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
680 else
682 gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_SHADER_NV);
683 checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
687 static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
689 caps->wined3d_caps = 0;
690 caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
692 /* The caps below can be supported but aren't handled yet in utils.c
693 * 'd3dta_to_combiner_input', disable them until support is fixed */
694 #if 0
695 if (gl_info->supported[NV_REGISTER_COMBINERS2])
696 caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT;
697 #endif
699 caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD
700 | WINED3DTEXOPCAPS_ADDSIGNED
701 | WINED3DTEXOPCAPS_ADDSIGNED2X
702 | WINED3DTEXOPCAPS_MODULATE
703 | WINED3DTEXOPCAPS_MODULATE2X
704 | WINED3DTEXOPCAPS_MODULATE4X
705 | WINED3DTEXOPCAPS_SELECTARG1
706 | WINED3DTEXOPCAPS_SELECTARG2
707 | WINED3DTEXOPCAPS_DISABLE
708 | WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
709 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
710 | WINED3DTEXOPCAPS_BLENDFACTORALPHA
711 | WINED3DTEXOPCAPS_BLENDCURRENTALPHA
712 | WINED3DTEXOPCAPS_LERP
713 | WINED3DTEXOPCAPS_SUBTRACT
714 | WINED3DTEXOPCAPS_ADDSMOOTH
715 | WINED3DTEXOPCAPS_MULTIPLYADD
716 | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
717 | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
718 | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM
719 | WINED3DTEXOPCAPS_DOTPRODUCT3
720 | WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
721 | WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA;
723 if (gl_info->supported[NV_TEXTURE_SHADER2])
725 /* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does
726 * not support 3D textures. This asks for trouble if an app uses both bump mapping
727 * and 3D textures. It also allows us to keep the code simpler by having texture
728 * shaders constantly enabled. */
729 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP;
730 /* TODO: Luminance bump map? */
733 #if 0
734 /* FIXME: Add
735 caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE
736 WINED3DTEXOPCAPS_PREMODULATE */
737 #endif
739 caps->MaxTextureBlendStages = min(MAX_TEXTURES, gl_info->limits.general_combiners);
740 caps->MaxSimultaneousTextures = gl_info->limits.textures;
743 static DWORD nvrc_fragment_get_emul_mask(const struct wined3d_gl_info *gl_info)
745 return GL_EXT_EMUL_ARB_MULTITEXTURE | GL_EXT_EMUL_EXT_FOG_COORD;
748 static void *nvrc_fragment_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
750 return shader_priv;
753 /* Context activation is done by the caller. */
754 static void nvrc_fragment_free(struct wined3d_device *device) {}
756 /* Two fixed function pipeline implementations using GL_NV_register_combiners and
757 * GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions
758 * are available(geforce 3 and newer), while nvrc_fragment_pipeline uses only the
759 * register combiners extension(Pre-GF3).
762 static BOOL nvts_color_fixup_supported(struct color_fixup_desc fixup)
764 if (TRACE_ON(d3d))
766 TRACE("Checking support for fixup:\n");
767 dump_color_fixup_desc(fixup);
770 /* We only support identity conversions. */
771 if (is_identity_fixup(fixup))
773 TRACE("[OK]\n");
774 return TRUE;
777 TRACE("[FAILED]\n");
778 return FALSE;
781 static const struct StateEntryTemplate nvrc_fragmentstate_template[] =
783 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
784 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
785 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
786 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
787 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
788 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
789 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
790 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
791 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
792 { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
793 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
794 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
795 { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
796 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
797 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
798 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
799 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
800 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
801 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
802 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
803 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
804 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
805 { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
806 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
807 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
808 { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
809 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
810 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
811 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
812 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
813 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
814 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
815 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
816 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
817 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
818 { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
819 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
820 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
821 { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
822 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
823 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
824 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
825 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
826 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
827 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
828 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
829 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
830 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
831 { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
832 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
833 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
834 { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
835 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
836 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
837 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
838 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
839 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
840 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
841 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
842 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
843 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
844 { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
845 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
846 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
847 { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
848 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
849 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
850 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
851 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
852 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
853 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
854 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
855 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
856 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
857 { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
858 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
859 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
860 { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
861 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
862 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
863 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
864 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
865 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
866 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
867 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
868 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
869 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
870 { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
871 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
872 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
873 { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
874 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE },
875 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
876 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
877 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), tex_alphaop }, WINED3D_GL_EXT_NONE },
878 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
879 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
880 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
881 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
882 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
883 { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, NV_TEXTURE_SHADER2 },
884 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE },
885 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE },
886 { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE },
887 { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), apply_pixelshader }, WINED3D_GL_EXT_NONE },
888 { STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), { STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), NULL }, WINED3D_GL_EXT_NONE },
889 { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), nvrc_texfactor }, WINED3D_GL_EXT_NONE },
890 { STATE_RENDER(WINED3D_RS_ALPHAFUNC), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
891 { STATE_RENDER(WINED3D_RS_ALPHAREF), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
892 { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), state_alpha_test }, WINED3D_GL_EXT_NONE },
893 { STATE_RENDER(WINED3D_RS_COLORKEYENABLE), { STATE_RENDER(WINED3D_RS_ALPHATESTENABLE), NULL }, WINED3D_GL_EXT_NONE },
894 { STATE_COLOR_KEY, { STATE_COLOR_KEY, state_nop }, WINED3D_GL_EXT_NONE },
895 { STATE_RENDER(WINED3D_RS_FOGCOLOR), { STATE_RENDER(WINED3D_RS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE },
896 { STATE_RENDER(WINED3D_RS_FOGDENSITY), { STATE_RENDER(WINED3D_RS_FOGDENSITY), state_fogdensity }, WINED3D_GL_EXT_NONE },
897 { STATE_RENDER(WINED3D_RS_FOGENABLE), { STATE_RENDER(WINED3D_RS_FOGENABLE), state_fog_fragpart }, WINED3D_GL_EXT_NONE },
898 { STATE_RENDER(WINED3D_RS_FOGTABLEMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
899 { STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), { STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
900 { STATE_RENDER(WINED3D_RS_FOGSTART), { STATE_RENDER(WINED3D_RS_FOGSTART), state_fogstartend }, WINED3D_GL_EXT_NONE },
901 { STATE_RENDER(WINED3D_RS_FOGEND), { STATE_RENDER(WINED3D_RS_FOGSTART), NULL }, WINED3D_GL_EXT_NONE },
902 { STATE_RENDER(WINED3D_RS_SHADEMODE), { STATE_RENDER(WINED3D_RS_SHADEMODE), state_shademode }, WINED3D_GL_EXT_NONE },
903 { STATE_SAMPLER(0), { STATE_SAMPLER(0), nvts_texdim }, NV_TEXTURE_SHADER2 },
904 { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, WINED3D_GL_EXT_NONE },
905 { STATE_SAMPLER(1), { STATE_SAMPLER(1), nvts_texdim }, NV_TEXTURE_SHADER2 },
906 { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, WINED3D_GL_EXT_NONE },
907 { STATE_SAMPLER(2), { STATE_SAMPLER(2), nvts_texdim }, NV_TEXTURE_SHADER2 },
908 { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, WINED3D_GL_EXT_NONE },
909 { STATE_SAMPLER(3), { STATE_SAMPLER(3), nvts_texdim }, NV_TEXTURE_SHADER2 },
910 { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, WINED3D_GL_EXT_NONE },
911 { STATE_SAMPLER(4), { STATE_SAMPLER(4), nvts_texdim }, NV_TEXTURE_SHADER2 },
912 { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, WINED3D_GL_EXT_NONE },
913 { STATE_SAMPLER(5), { STATE_SAMPLER(5), nvts_texdim }, NV_TEXTURE_SHADER2 },
914 { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, WINED3D_GL_EXT_NONE },
915 { STATE_SAMPLER(6), { STATE_SAMPLER(6), nvts_texdim }, NV_TEXTURE_SHADER2 },
916 { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, WINED3D_GL_EXT_NONE },
917 { STATE_SAMPLER(7), { STATE_SAMPLER(7), nvts_texdim }, NV_TEXTURE_SHADER2 },
918 { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, WINED3D_GL_EXT_NONE },
919 {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
922 static BOOL nvrc_context_alloc(struct wined3d_context *context)
924 return TRUE;
927 static void nvrc_context_free(struct wined3d_context *context)
932 const struct fragment_pipeline nvts_fragment_pipeline = {
933 nvts_enable,
934 nvrc_fragment_get_caps,
935 nvrc_fragment_get_emul_mask,
936 nvrc_fragment_alloc,
937 nvrc_fragment_free,
938 nvrc_context_alloc,
939 nvrc_context_free,
940 nvts_color_fixup_supported,
941 nvrc_fragmentstate_template,
944 const struct fragment_pipeline nvrc_fragment_pipeline = {
945 nvrc_enable,
946 nvrc_fragment_get_caps,
947 nvrc_fragment_get_emul_mask,
948 nvrc_fragment_alloc,
949 nvrc_fragment_free,
950 nvrc_context_alloc,
951 nvrc_context_free,
952 nvts_color_fixup_supported,
953 nvrc_fragmentstate_template,