2 * shaders implementation
4 * Copyright 2002-2003 Jason Edmeades
5 * Copyright 2002-2003 Raphael Junqueira
6 * Copyright 2005 Oliver Stieber
7 * Copyright 2006 Ivan Gyurdiev
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wined3d_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
31 #define GLNAME_REQUIRE_GLSL ((const char *)1)
33 inline static BOOL shader_is_version_token(DWORD token) {
34 return shader_is_pshader_version(token) ||
35 shader_is_vshader_version(token);
39 SHADER_BUFFER* buffer,
40 const char *format, ...) {
42 char* base = buffer->buffer + buffer->bsize;
46 va_start(args, format);
47 rc = vsnprintf(base, SHADER_PGMSIZE - 1 - buffer->bsize, format, args);
50 if (rc < 0 || /* C89 */
51 rc > SHADER_PGMSIZE - 1 - buffer->bsize) { /* C99 */
53 ERR("The buffer allocated for the shader program string "
54 "is too small at %d bytes.\n", SHADER_PGMSIZE);
55 buffer->bsize = SHADER_PGMSIZE - 1;
61 TRACE("GL HW (%u, %u) : %s", buffer->lineNo, buffer->bsize, base);
65 const SHADER_OPCODE* shader_get_opcode(
66 IWineD3DBaseShader *iface, const DWORD code) {
68 IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl*) iface;
71 DWORD version = This->baseShader.version;
72 DWORD hex_version = This->baseShader.hex_version;
73 const SHADER_OPCODE *shader_ins = This->baseShader.shader_ins;
75 /** TODO: use dichotomic search */
76 while (NULL != shader_ins[i].name) {
77 if (((code & D3DSI_OPCODE_MASK) == shader_ins[i].opcode) &&
78 (((hex_version >= shader_ins[i].min_version) && (hex_version <= shader_ins[i].max_version)) ||
79 ((shader_ins[i].min_version == 0) && (shader_ins[i].max_version == 0)))) {
80 return &shader_ins[i];
84 FIXME("Unsupported opcode %lx(%ld) masked %lx version %ld\n",
85 code, code, code & D3DSI_OPCODE_MASK, version);
89 /* Read a parameter opcode from the input stream,
90 * and possibly a relative addressing token.
91 * Return the number of tokens read */
93 IWineD3DBaseShader* iface,
98 /* PS >= 3.0 have relative addressing (with token)
99 * VS >= 2.0 have relative addressing (with token)
100 * VS >= 1.0 < 2.0 have relative addressing (without token)
101 * The version check below should work in general */
103 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
104 char rel_token = D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2 &&
105 ((*pToken & D3DSHADER_ADDRESSMODE_MASK) == D3DSHADER_ADDRMODE_RELATIVE);
108 *addr_token = rel_token? *(pToken + 1): 0;
109 return rel_token? 2:1;
112 /* Return the number of parameters to skip for an opcode */
113 static inline int shader_skip_opcode(
114 IWineD3DBaseShaderImpl* This,
115 const SHADER_OPCODE* curOpcode,
116 DWORD opcode_token) {
118 /* Shaders >= 2.0 may contain address tokens, but fortunately they
119 * have a useful legnth mask - use it here. Shaders 1.0 contain no such tokens */
121 return (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)?
122 ((opcode_token & D3DSI_INSTLENGTH_MASK) >> D3DSI_INSTLENGTH_SHIFT):
123 curOpcode->num_params;
126 /* Read the parameters of an unrecognized opcode from the input stream
127 * Return the number of tokens read.
129 * Note: This function assumes source or destination token format.
130 * It will not work with specially-formatted tokens like DEF or DCL,
131 * but hopefully those would be recognized */
133 int shader_skip_unrecognized(
134 IWineD3DBaseShader* iface,
135 const DWORD* pToken) {
140 /* TODO: Think of a good name for 0x80000000 and replace it with a constant */
141 while (*pToken & 0x80000000) {
143 DWORD param, addr_token;
144 tokens_read += shader_get_param(iface, pToken, ¶m, &addr_token);
145 pToken += tokens_read;
147 FIXME("Unrecognized opcode param: token=%08lX "
148 "addr_token=%08lX name=", param, addr_token);
149 shader_dump_param(iface, param, addr_token, i);
156 /* Convert floating point offset relative
157 * to a register file to an absolute offset for float constants */
159 unsigned int shader_get_float_offset(const DWORD reg) {
161 unsigned int regnum = reg & D3DSP_REGNUM_MASK;
162 int regtype = shader_get_regtype(reg);
165 case D3DSPR_CONST: return regnum;
166 case D3DSPR_CONST2: return 2048 + regnum;
167 case D3DSPR_CONST3: return 4096 + regnum;
168 case D3DSPR_CONST4: return 6144 + regnum;
170 FIXME("Unsupported register type: %d\n", regtype);
175 /* Note that this does not count the loop register
176 * as an address register. */
178 static void shader_get_registers_used(
179 IWineD3DBaseShader *iface,
180 shader_reg_maps* reg_maps,
181 CONST DWORD* pToken) {
183 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
188 reg_maps->temporary = 0;
189 reg_maps->texcoord = 0;
190 reg_maps->address = 0;
192 while (D3DVS_END() != *pToken) {
193 CONST SHADER_OPCODE* curOpcode;
197 if (shader_is_version_token(*pToken)) {
202 } else if (shader_is_comment(*pToken)) {
203 DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT;
205 pToken += comment_len;
210 opcode_token = *pToken++;
211 curOpcode = shader_get_opcode(iface, opcode_token);
213 /* Unhandled opcode, and its parameters */
214 if (NULL == curOpcode) {
215 while (*pToken & 0x80000000)
219 /* Skip declarations (for now) */
220 } else if (D3DSIO_DCL == curOpcode->opcode) {
221 pToken += curOpcode->num_params;
224 /* Skip definitions (for now) */
225 } else if (D3DSIO_DEF == curOpcode->opcode) {
226 pToken += curOpcode->num_params;
229 /* Set texture registers, and temporary registers */
233 /* This will loop over all the registers and try to
234 * make a bitmask of the ones we're interested in.
236 * Relative addressing tokens are ignored, but that's
237 * okay, since we'll catch any address registers when
238 * they are initialized (required by spec) */
240 limit = (opcode_token & D3DSHADER_INSTRUCTION_PREDICATED)?
241 curOpcode->num_params + 1: curOpcode->num_params;
243 for (i = 0; i < limit; ++i) {
245 DWORD param, addr_token, reg, regtype;
246 pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
248 regtype = (param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT;
249 reg = param & D3DSP_REGNUM_MASK;
251 if (D3DSPR_TEXTURE == regtype) { /* vs: D3DSPR_ADDR */
253 if (shader_is_pshader_version(This->baseShader.hex_version))
254 reg_maps->texcoord |= (1 << reg);
256 reg_maps->address |= (1 << reg);
259 if (D3DSPR_TEMP == regtype)
260 reg_maps->temporary |= (1 << reg);
266 void shader_program_dump_decl_usage(
270 DWORD regtype = shader_get_regtype(param);
273 if (regtype == D3DSPR_SAMPLER) {
274 DWORD ttype = decl & D3DSP_TEXTURETYPE_MASK;
277 case D3DSTT_2D: TRACE("2d"); break;
278 case D3DSTT_CUBE: TRACE("cube"); break;
279 case D3DSTT_VOLUME: TRACE("volume"); break;
280 default: TRACE("unknown_ttype(%08lx)", ttype);
285 DWORD usage = decl & D3DSP_DCL_USAGE_MASK;
286 DWORD idx = (decl & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT;
289 case D3DDECLUSAGE_POSITION:
290 TRACE("%s%ld", "position", idx);
292 case D3DDECLUSAGE_BLENDINDICES:
293 TRACE("%s", "blend");
295 case D3DDECLUSAGE_BLENDWEIGHT:
296 TRACE("%s", "weight");
298 case D3DDECLUSAGE_NORMAL:
299 TRACE("%s%ld", "normal", idx);
301 case D3DDECLUSAGE_PSIZE:
302 TRACE("%s", "psize");
304 case D3DDECLUSAGE_COLOR:
306 TRACE("%s", "color");
308 TRACE("%s%ld", "specular", (idx - 1));
311 case D3DDECLUSAGE_TEXCOORD:
312 TRACE("%s%ld", "texture", idx);
314 case D3DDECLUSAGE_TANGENT:
315 TRACE("%s", "tangent");
317 case D3DDECLUSAGE_BINORMAL:
318 TRACE("%s", "binormal");
320 case D3DDECLUSAGE_TESSFACTOR:
321 TRACE("%s", "tessfactor");
323 case D3DDECLUSAGE_POSITIONT:
324 TRACE("%s%ld", "positionT", idx);
326 case D3DDECLUSAGE_FOG:
329 case D3DDECLUSAGE_DEPTH:
330 TRACE("%s", "depth");
332 case D3DDECLUSAGE_SAMPLE:
333 TRACE("%s", "sample");
336 FIXME("unknown_semantics(%08lx)", usage);
341 static void shader_dump_arr_entry(
342 IWineD3DBaseShader *iface,
344 const DWORD addr_token,
349 ((param & D3DSHADER_ADDRESSMODE_MASK) == D3DSHADER_ADDRMODE_RELATIVE);
354 shader_dump_param(iface, addr_token, 0, input);
364 void shader_dump_param(
365 IWineD3DBaseShader *iface,
367 const DWORD addr_token,
370 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
371 static const char* rastout_reg_names[] = { "oPos", "oFog", "oPts" };
372 char swizzle_reg_chars[4];
374 DWORD reg = param & D3DSP_REGNUM_MASK;
375 DWORD regtype = shader_get_regtype(param);
377 /* There are some minor differences between pixel and vertex shaders */
378 BOOL pshader = shader_is_pshader_version(This->baseShader.hex_version);
380 /* For one, we'd prefer color components to be shown for pshaders.
381 * FIXME: use the swizzle function for this */
383 swizzle_reg_chars[0] = pshader? 'r': 'x';
384 swizzle_reg_chars[1] = pshader? 'g': 'y';
385 swizzle_reg_chars[2] = pshader? 'b': 'z';
386 swizzle_reg_chars[3] = pshader? 'a': 'w';
389 if ( ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) ||
390 ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_BIASNEG) ||
391 ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_SIGNNEG) ||
392 ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_X2NEG) )
394 else if ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_COMP)
396 else if ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_NOT)
406 shader_dump_arr_entry(iface, param, addr_token, reg, input);
413 shader_dump_arr_entry(iface, param, addr_token, shader_get_float_offset(param), input);
415 case D3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
416 TRACE("%c%lu", (pshader? 't':'a'), reg);
419 TRACE("%s", rastout_reg_names[reg]);
421 case D3DSPR_COLOROUT:
424 case D3DSPR_DEPTHOUT:
430 case D3DSPR_TEXCRDOUT:
432 /* Vertex shaders >= 3.0 use general purpose output registers
433 * (D3DSPR_OUTPUT), which can include an address token */
435 if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
437 shader_dump_arr_entry(iface, param, addr_token, reg, input);
442 case D3DSPR_CONSTINT:
444 shader_dump_arr_entry(iface, param, addr_token, reg, input);
446 case D3DSPR_CONSTBOOL:
448 shader_dump_arr_entry(iface, param, addr_token, reg, input);
459 case D3DSPR_PREDICATE:
463 TRACE("unhandled_rtype(%#lx)", regtype);
468 /* operand output (for modifiers and shift, see dump_ins_modifiers) */
470 if ((param & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
472 if (param & D3DSP_WRITEMASK_0) TRACE("%c", swizzle_reg_chars[0]);
473 if (param & D3DSP_WRITEMASK_1) TRACE("%c", swizzle_reg_chars[1]);
474 if (param & D3DSP_WRITEMASK_2) TRACE("%c", swizzle_reg_chars[2]);
475 if (param & D3DSP_WRITEMASK_3) TRACE("%c", swizzle_reg_chars[3]);
480 DWORD swizzle = (param & D3DSP_SWIZZLE_MASK) >> D3DSP_SWIZZLE_SHIFT;
481 DWORD swizzle_r = swizzle & 0x03;
482 DWORD swizzle_g = (swizzle >> 2) & 0x03;
483 DWORD swizzle_b = (swizzle >> 4) & 0x03;
484 DWORD swizzle_a = (swizzle >> 6) & 0x03;
486 if (0 != (param & D3DSP_SRCMOD_MASK)) {
487 DWORD mask = param & D3DSP_SRCMOD_MASK;
489 case D3DSPSM_NONE: break;
490 case D3DSPSM_NEG: break;
491 case D3DSPSM_NOT: break;
492 case D3DSPSM_BIAS: TRACE("_bias"); break;
493 case D3DSPSM_BIASNEG: TRACE("_bias"); break;
494 case D3DSPSM_SIGN: TRACE("_bx2"); break;
495 case D3DSPSM_SIGNNEG: TRACE("_bx2"); break;
496 case D3DSPSM_COMP: break;
497 case D3DSPSM_X2: TRACE("_x2"); break;
498 case D3DSPSM_X2NEG: TRACE("_x2"); break;
499 case D3DSPSM_DZ: TRACE("_dz"); break;
500 case D3DSPSM_DW: TRACE("_dw"); break;
502 TRACE("_unknown_modifier(%#lx)", mask >> D3DSP_SRCMOD_SHIFT);
507 * swizzle bits fields:
510 if ((D3DVS_NOSWIZZLE >> D3DVS_SWIZZLE_SHIFT) != swizzle) { /* ! D3DVS_NOSWIZZLE == 0xE4 << D3DVS_SWIZZLE_SHIFT */
511 if (swizzle_r == swizzle_g &&
512 swizzle_r == swizzle_b &&
513 swizzle_r == swizzle_a) {
514 TRACE(".%c", swizzle_reg_chars[swizzle_r]);
517 swizzle_reg_chars[swizzle_r],
518 swizzle_reg_chars[swizzle_g],
519 swizzle_reg_chars[swizzle_b],
520 swizzle_reg_chars[swizzle_a]);
526 /** Generate the variable & register declarations for the ARB_vertex_program
528 void generate_arb_declarations(
529 IWineD3DBaseShader *iface,
530 shader_reg_maps* reg_maps,
531 SHADER_BUFFER* buffer) {
533 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
536 for(i = 0; i < This->baseShader.limits.temporary; i++) {
537 if (reg_maps->temporary & (1 << i))
538 shader_addline(buffer, "TEMP R%lu;\n", i);
541 for (i = 0; i < This->baseShader.limits.address; i++) {
542 if (reg_maps->address & (1 << i))
543 shader_addline(buffer, "ADDRESS A%ld;\n", i);
546 for(i = 0; i < This->baseShader.limits.texture; i++) {
547 if (reg_maps->texcoord & (1 << i))
548 shader_addline(buffer,"TEMP T%lu;\n", i);
551 /* Texture coordinate registers must be pre-loaded */
552 for (i = 0; i < This->baseShader.limits.texture; i++) {
553 if (reg_maps->texcoord & (1 << i))
554 shader_addline(buffer, "MOV T%lu, fragment.texcoord[%lu];\n", i, i);
557 /* Need to PARAM the environment parameters (constants) so we can use relative addressing */
558 shader_addline(buffer, "PARAM C[%d] = { program.env[0..%d] };\n",
559 This->baseShader.limits.constant_float,
560 This->baseShader.limits.constant_float - 1);
563 /** Generate the variable & register declarations for the GLSL
565 void generate_glsl_declarations(
566 IWineD3DBaseShader *iface,
567 shader_reg_maps* reg_maps,
568 SHADER_BUFFER* buffer) {
570 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
573 FIXME("GLSL not fully implemented yet.\n");
575 /* Declare the constants (aka uniforms) */
576 shader_addline(buffer, "uniform vec4 C[%u];\n", This->baseShader.limits.constant_float);
578 /* Declare texture samplers
579 * TODO: Make this work for textures other than 2D */
580 for (i = 0; i < This->baseShader.limits.texture; i++) {
581 shader_addline(buffer, "uniform sampler2D mytex%lu;\n", i);
584 /* Declare address variables */
585 for (i = 0; i < This->baseShader.limits.address; i++) {
586 if (reg_maps->address & (1 << i))
587 shader_addline(buffer, "ivec4 A%ld;\n", i);
590 /* Declare texture temporaries */
591 for (i = 0; i < This->baseShader.limits.texture; i++) {
592 shader_addline(buffer, "vec4 T%lu = gl_TexCoord[%lu];\n", i, i);
595 /* Declare temporary variables */
596 for(i = 0; i < This->baseShader.limits.temporary; i++) {
597 if (reg_maps->temporary & (1 << i))
598 shader_addline(buffer, "vec4 R%lu;\n", i);
601 /* Declare all named attributes (TODO: Add this to the reg_maps
602 * and only declare those that are needed) */
603 for (i = 0; i < This->baseShader.limits.attributes; i++) {
604 shader_addline(buffer, "attribute vec4 attrib%i;\n", i);
607 /* Temporary variables for matrix operations */
608 shader_addline(buffer, "vec4 tmp0;\n");
609 shader_addline(buffer, "vec4 tmp1;\n");
611 /* Start the main program */
612 shader_addline(buffer, "void main() {\n");
615 /** Shared code in order to generate the bulk of the shader string.
616 Use the shader_header_fct & shader_footer_fct to add strings
617 that are specific to pixel or vertex functions
618 NOTE: A description of how to parse tokens can be found at:
619 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/usermodedisplaydriver_shader_cc8e4e05-f5c3-4ec0-8853-8ce07c1551b2.xml.asp */
620 void generate_base_shader(
621 IWineD3DBaseShader *iface,
622 SHADER_BUFFER* buffer,
623 CONST DWORD* pFunction) {
625 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
626 const DWORD *pToken = pFunction;
627 const SHADER_OPCODE *curOpcode = NULL;
628 SHADER_HANDLER hw_fct = NULL;
631 shader_reg_maps reg_maps;
632 SHADER_OPCODE_ARG hw_arg;
634 memset(®_maps, 0, sizeof(shader_reg_maps));
636 /* Initialize current parsing state */
637 hw_arg.shader = iface;
638 hw_arg.buffer = buffer;
639 hw_arg.reg_maps = ®_maps;
640 This->baseShader.parse_state.current_row = 0;
642 /* First pass: figure out which temporary and texture registers are used */
643 shader_get_registers_used(iface, ®_maps, pToken);
645 /* TODO: check register usage against GL/Directx limits, and fail if they're exceeded
646 nUseAddressRegister < = GL_MAX_PROGRAM_ADDRESS_REGISTERS_AR
647 nUseTempRegister <= GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB
650 /* Pre-declare registers */
651 if (wined3d_settings.shader_mode == SHADER_GLSL) {
652 generate_glsl_declarations(iface, ®_maps, buffer);
654 generate_arb_declarations(iface, ®_maps, buffer);
657 /* Second pass, process opcodes */
658 if (NULL != pToken) {
659 while (D3DPS_END() != *pToken) {
661 /* Skip version token */
662 if (shader_is_version_token(*pToken)) {
667 /* Skip comment tokens */
668 if (shader_is_comment(*pToken)) {
669 DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT;
671 TRACE("#%s\n", (char*)pToken);
672 pToken += comment_len;
677 opcode_token = *pToken++;
678 curOpcode = shader_get_opcode(iface, opcode_token);
679 hw_fct = (curOpcode == NULL)? NULL:
680 (wined3d_settings.shader_mode == SHADER_GLSL)?
681 curOpcode->hw_glsl_fct : curOpcode->hw_fct;
683 /* Unknown opcode and its parameters */
684 if (NULL == curOpcode) {
685 FIXME("Unrecognized opcode: token=%08lX\n", opcode_token);
686 pToken += shader_skip_unrecognized(iface, pToken);
688 /* If a generator function is set for current shader target, use it */
689 } else if (hw_fct != NULL) {
691 hw_arg.opcode = curOpcode;
693 if (curOpcode->num_params > 0) {
695 DWORD param, addr_token = 0;
697 /* DCL instruction has usage dst parameter, not register */
698 if (curOpcode->opcode == D3DSIO_DCL)
701 pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
704 hw_arg.dst_addr = addr_token;
706 if (opcode_token & D3DSHADER_INSTRUCTION_PREDICATED)
707 hw_arg.predicate = *pToken++;
709 for (i = 1; i < curOpcode->num_params; i++) {
710 /* DEF* instructions have constant src parameters, not registers */
711 if (curOpcode->opcode == D3DSIO_DEF ||
712 curOpcode->opcode == D3DSIO_DEFI ||
713 curOpcode->opcode == D3DSIO_DEFB) {
717 pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
719 hw_arg.src[i-1] = param;
720 hw_arg.src_addr[i-1] = addr_token;
724 /* Call appropriate function for output target */
729 /* Unless we encounter a no-op command, this opcode is unrecognized */
730 if (curOpcode->opcode != D3DSIO_NOP) {
731 FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name);
732 pToken += shader_skip_opcode(This, curOpcode, opcode_token);
736 /* TODO: What about result.depth? */
741 void shader_dump_ins_modifiers(const DWORD output) {
743 DWORD shift = (output & D3DSP_DSTSHIFT_MASK) >> D3DSP_DSTSHIFT_SHIFT;
744 DWORD mmask = output & D3DSP_DSTMOD_MASK;
748 case 13: TRACE("_d8"); break;
749 case 14: TRACE("_d4"); break;
750 case 15: TRACE("_d2"); break;
751 case 1: TRACE("_x2"); break;
752 case 2: TRACE("_x4"); break;
753 case 3: TRACE("_x8"); break;
754 default: TRACE("_unhandled_shift(%ld)", shift); break;
757 if (mmask & D3DSPDM_SATURATE) TRACE("_sat");
758 if (mmask & D3DSPDM_PARTIALPRECISION) TRACE("_pp");
759 if (mmask & D3DSPDM_MSAMPCENTROID) TRACE("_centroid");
761 mmask &= ~(D3DSPDM_SATURATE | D3DSPDM_PARTIALPRECISION | D3DSPDM_MSAMPCENTROID);
763 FIXME("_unrecognized_modifier(%#lx)", mmask >> D3DSP_DSTMOD_SHIFT);
766 /** Process the D3DSIO_DCL opcode into an ARB string - creates a local vec4
767 * float constant, and stores it's usage on the regmaps. */
768 void shader_hw_def(SHADER_OPCODE_ARG* arg) {
770 DWORD reg = arg->dst & D3DSP_REGNUM_MASK;
772 shader_addline(arg->buffer,
773 "PARAM C%lu = { %f, %f, %f, %f };\n", reg,
774 *((const float *)(arg->src + 0)),
775 *((const float *)(arg->src + 1)),
776 *((const float *)(arg->src + 2)),
777 *((const float *)(arg->src + 3)) );
779 arg->reg_maps->constantsF[reg] = 1;
782 /* TODO: Move other shared code here */