2 * shaders implementation
4 * Copyright 2002-2003 Jason Edmeades
5 * Copyright 2002-2003 Raphael Junqueira
6 * Copyright 2004 Christian Costa
7 * Copyright 2005 Oliver Stieber
8 * Copyright 2006 Ivan Gyurdiev
9 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
10 * Copyright 2009 Henri Verbeet for CodeWeavers
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wined3d_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
33 WINE_DECLARE_DEBUG_CHANNEL(d3d);
35 static const char *shader_opcode_names[] =
37 /* WINED3DSIH_ABS */ "abs",
38 /* WINED3DSIH_ADD */ "add",
39 /* WINED3DSIH_BEM */ "bem",
40 /* WINED3DSIH_BREAK */ "break",
41 /* WINED3DSIH_BREAKC */ "breakc",
42 /* WINED3DSIH_BREAKP */ "breakp",
43 /* WINED3DSIH_CALL */ "call",
44 /* WINED3DSIH_CALLNZ */ "callnz",
45 /* WINED3DSIH_CMP */ "cmp",
46 /* WINED3DSIH_CND */ "cnd",
47 /* WINED3DSIH_CRS */ "crs",
48 /* WINED3DSIH_DCL */ "dcl",
49 /* WINED3DSIH_DEF */ "def",
50 /* WINED3DSIH_DEFB */ "defb",
51 /* WINED3DSIH_DEFI */ "defi",
52 /* WINED3DSIH_DP2ADD */ "dp2add",
53 /* WINED3DSIH_DP3 */ "dp3",
54 /* WINED3DSIH_DP4 */ "dp4",
55 /* WINED3DSIH_DST */ "dst",
56 /* WINED3DSIH_DSX */ "dsx",
57 /* WINED3DSIH_DSY */ "dsy",
58 /* WINED3DSIH_ELSE */ "else",
59 /* WINED3DSIH_ENDIF */ "endif",
60 /* WINED3DSIH_ENDLOOP */ "endloop",
61 /* WINED3DSIH_ENDREP */ "endrep",
62 /* WINED3DSIH_EXP */ "exp",
63 /* WINED3DSIH_EXPP */ "expp",
64 /* WINED3DSIH_FRC */ "frc",
65 /* WINED3DSIH_IF */ "if",
66 /* WINED3DSIH_IFC */ "ifc",
67 /* WINED3DSIH_LABEL */ "label",
68 /* WINED3DSIH_LIT */ "lit",
69 /* WINED3DSIH_LOG */ "log",
70 /* WINED3DSIH_LOGP */ "logp",
71 /* WINED3DSIH_LOOP */ "loop",
72 /* WINED3DSIH_LRP */ "lrp",
73 /* WINED3DSIH_M3x2 */ "m3x2",
74 /* WINED3DSIH_M3x3 */ "m3x3",
75 /* WINED3DSIH_M3x4 */ "m3x4",
76 /* WINED3DSIH_M4x3 */ "m4x3",
77 /* WINED3DSIH_M4x4 */ "m4x4",
78 /* WINED3DSIH_MAD */ "mad",
79 /* WINED3DSIH_MAX */ "max",
80 /* WINED3DSIH_MIN */ "min",
81 /* WINED3DSIH_MOV */ "mov",
82 /* WINED3DSIH_MOVA */ "mova",
83 /* WINED3DSIH_MUL */ "mul",
84 /* WINED3DSIH_NOP */ "nop",
85 /* WINED3DSIH_NRM */ "nrm",
86 /* WINED3DSIH_PHASE */ "phase",
87 /* WINED3DSIH_POW */ "pow",
88 /* WINED3DSIH_RCP */ "rcp",
89 /* WINED3DSIH_REP */ "rep",
90 /* WINED3DSIH_RET */ "ret",
91 /* WINED3DSIH_RSQ */ "rsq",
92 /* WINED3DSIH_SETP */ "setp",
93 /* WINED3DSIH_SGE */ "sge",
94 /* WINED3DSIH_SGN */ "sgn",
95 /* WINED3DSIH_SINCOS */ "sincos",
96 /* WINED3DSIH_SLT */ "slt",
97 /* WINED3DSIH_SUB */ "sub",
98 /* WINED3DSIH_TEX */ "texld",
99 /* WINED3DSIH_TEXBEM */ "texbem",
100 /* WINED3DSIH_TEXBEML */ "texbeml",
101 /* WINED3DSIH_TEXCOORD */ "texcrd",
102 /* WINED3DSIH_TEXDEPTH */ "texdepth",
103 /* WINED3DSIH_TEXDP3 */ "texdp3",
104 /* WINED3DSIH_TEXDP3TEX */ "texdp3tex",
105 /* WINED3DSIH_TEXKILL */ "texkill",
106 /* WINED3DSIH_TEXLDD */ "texldd",
107 /* WINED3DSIH_TEXLDL */ "texldl",
108 /* WINED3DSIH_TEXM3x2DEPTH */ "texm3x2depth",
109 /* WINED3DSIH_TEXM3x2PAD */ "texm3x2pad",
110 /* WINED3DSIH_TEXM3x2TEX */ "texm3x2tex",
111 /* WINED3DSIH_TEXM3x3 */ "texm3x3",
112 /* WINED3DSIH_TEXM3x3DIFF */ "texm3x3diff",
113 /* WINED3DSIH_TEXM3x3PAD */ "texm3x3pad",
114 /* WINED3DSIH_TEXM3x3SPEC */ "texm3x3spec",
115 /* WINED3DSIH_TEXM3x3TEX */ "texm3x3tex",
116 /* WINED3DSIH_TEXM3x3VSPEC */ "texm3x3vspec",
117 /* WINED3DSIH_TEXREG2AR */ "texreg2ar",
118 /* WINED3DSIH_TEXREG2GB */ "texreg2gb",
119 /* WINED3DSIH_TEXREG2RGB */ "texreg2rgb",
122 const struct wined3d_shader_frontend *shader_select_frontend(DWORD version_token)
124 switch (version_token >> 16)
128 return &sm1_shader_frontend;
133 return &sm4_shader_frontend;
136 FIXME("Unrecognised version token %#x\n", version_token);
141 void shader_buffer_clear(struct wined3d_shader_buffer *buffer)
143 buffer->buffer[0] = '\0';
146 buffer->newline = TRUE;
149 BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer)
151 buffer->buffer = HeapAlloc(GetProcessHeap(), 0, SHADER_PGMSIZE);
154 ERR("Failed to allocate shader buffer memory.\n");
158 shader_buffer_clear(buffer);
162 void shader_buffer_free(struct wined3d_shader_buffer *buffer)
164 HeapFree(GetProcessHeap(), 0, buffer->buffer);
167 int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *format, va_list args)
169 char* base = buffer->buffer + buffer->bsize;
172 rc = vsnprintf(base, SHADER_PGMSIZE - 1 - buffer->bsize, format, args);
174 if (rc < 0 /* C89 */ || (unsigned int)rc > SHADER_PGMSIZE - 1 - buffer->bsize /* C99 */)
176 ERR("The buffer allocated for the shader program string "
177 "is too small at %d bytes.\n", SHADER_PGMSIZE);
178 buffer->bsize = SHADER_PGMSIZE - 1;
182 if (buffer->newline) {
183 TRACE("GL HW (%u, %u) : %s", buffer->lineNo + 1, buffer->bsize, base);
184 buffer->newline = FALSE;
190 if (buffer->buffer[buffer->bsize-1] == '\n') {
192 buffer->newline = TRUE;
197 int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ...)
202 va_start(args, format);
203 ret = shader_vaddline(buffer, format, args);
209 void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceImpl *device,
210 IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
213 shader->device = (IWineD3DDevice *)device;
214 shader->parent = parent;
215 shader->parent_ops = parent_ops;
216 list_init(&shader->linked_programs);
217 list_add_head(&device->shaders, &shader->shader_list_entry);
220 /* Convert floating point offset relative
221 * to a register file to an absolute offset for float constants */
222 static unsigned int shader_get_float_offset(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx)
224 switch (register_type)
226 case WINED3DSPR_CONST: return register_idx;
227 case WINED3DSPR_CONST2: return 2048 + register_idx;
228 case WINED3DSPR_CONST3: return 4096 + register_idx;
229 case WINED3DSPR_CONST4: return 6144 + register_idx;
231 FIXME("Unsupported register type: %d\n", register_type);
236 static void shader_delete_constant_list(struct list* clist) {
239 struct local_constant* constant;
241 ptr = list_head(clist);
243 constant = LIST_ENTRY(ptr, struct local_constant, entry);
244 ptr = list_next(clist, ptr);
245 HeapFree(GetProcessHeap(), 0, constant);
250 static inline void set_bitmap_bit(DWORD *bitmap, DWORD bit)
255 bitmap[idx] |= (1 << shift);
258 static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct shader_reg_maps *reg_maps,
259 const struct wined3d_shader_register *reg, enum wined3d_shader_type shader_type)
263 case WINED3DSPR_TEXTURE: /* WINED3DSPR_ADDR */
264 if (shader_type == WINED3D_SHADER_TYPE_PIXEL) reg_maps->texcoord |= 1 << reg->idx;
265 else reg_maps->address |= 1 << reg->idx;
268 case WINED3DSPR_TEMP:
269 reg_maps->temporary |= 1 << reg->idx;
272 case WINED3DSPR_INPUT:
273 if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
277 /* If relative addressing is used, we must assume that all registers
278 * are used. Even if it is a construct like v3[aL], we can't assume
279 * that v0, v1 and v2 aren't read because aL can be negative */
281 for (i = 0; i < MAX_REG_INPUT; ++i)
283 ((IWineD3DPixelShaderImpl *)This)->input_reg_used[i] = TRUE;
288 ((IWineD3DPixelShaderImpl *)This)->input_reg_used[reg->idx] = TRUE;
291 else reg_maps->input_registers |= 1 << reg->idx;
294 case WINED3DSPR_RASTOUT:
295 if (reg->idx == 1) reg_maps->fog = 1;
298 case WINED3DSPR_MISCTYPE:
299 if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
301 if (reg->idx == 0) reg_maps->vpos = 1;
302 else if (reg->idx == 1) reg_maps->usesfacing = 1;
306 case WINED3DSPR_CONST:
309 if (shader_type != WINED3D_SHADER_TYPE_PIXEL)
311 if (reg->idx < ((IWineD3DVertexShaderImpl *)This)->min_rel_offset)
313 ((IWineD3DVertexShaderImpl *)This)->min_rel_offset = reg->idx;
315 if (reg->idx > ((IWineD3DVertexShaderImpl *)This)->max_rel_offset)
317 ((IWineD3DVertexShaderImpl *)This)->max_rel_offset = reg->idx;
320 reg_maps->usesrelconstF = TRUE;
324 set_bitmap_bit(reg_maps->constf, reg->idx);
328 case WINED3DSPR_CONSTINT:
329 reg_maps->integer_constants |= (1 << reg->idx);
332 case WINED3DSPR_CONSTBOOL:
333 reg_maps->boolean_constants |= (1 << reg->idx);
336 case WINED3DSPR_COLOROUT:
337 reg_maps->highest_render_target = max(reg_maps->highest_render_target, reg->idx);
341 TRACE("Not recording register of type %#x and idx %u\n", reg->type, reg->idx);
346 static unsigned int get_instr_extra_regcount(enum WINED3D_SHADER_INSTRUCTION_HANDLER instr, unsigned int param)
350 case WINED3DSIH_M4x4:
351 case WINED3DSIH_M3x4:
352 return param == 1 ? 3 : 0;
354 case WINED3DSIH_M4x3:
355 case WINED3DSIH_M3x3:
356 return param == 1 ? 2 : 0;
358 case WINED3DSIH_M3x2:
359 return param == 1 ? 1 : 0;
366 static const char *shader_semantic_name_from_usage(WINED3DDECLUSAGE usage)
368 static const char *semantic_names[] =
370 /* WINED3DDECLUSAGE_POSITION */ "SV_POSITION",
371 /* WINED3DDECLUSAGE_BLENDWEIGHT */ "BLENDWEIGHT",
372 /* WINED3DDECLUSAGE_BLENDINDICES */ "BLENDINDICES",
373 /* WINED3DDECLUSAGE_NORMAL */ "NORMAL",
374 /* WINED3DDECLUSAGE_PSIZE */ "PSIZE",
375 /* WINED3DDECLUSAGE_TEXCOORD */ "TEXCOORD",
376 /* WINED3DDECLUSAGE_TANGENT */ "TANGENT",
377 /* WINED3DDECLUSAGE_BINORMAL */ "BINORMAL",
378 /* WINED3DDECLUSAGE_TESSFACTOR */ "TESSFACTOR",
379 /* WINED3DDECLUSAGE_POSITIONT */ "POSITIONT",
380 /* WINED3DDECLUSAGE_COLOR */ "COLOR",
381 /* WINED3DDECLUSAGE_FOG */ "FOG",
382 /* WINED3DDECLUSAGE_DEPTH */ "DEPTH",
383 /* WINED3DDECLUSAGE_SAMPLE */ "SAMPLE",
386 if (usage >= sizeof(semantic_names) / sizeof(*semantic_names))
388 FIXME("Unrecognized usage %#x\n", usage);
389 return "UNRECOGNIZED";
392 return semantic_names[usage];
395 BOOL shader_match_semantic(const char *semantic_name, WINED3DDECLUSAGE usage)
397 return !strcmp(semantic_name, shader_semantic_name_from_usage(usage));
400 static void shader_signature_from_semantic(struct wined3d_shader_signature_element *e,
401 const struct wined3d_shader_semantic *s)
403 e->semantic_name = shader_semantic_name_from_usage(s->usage);
404 e->semantic_idx = s->usage_idx;
405 e->sysval_semantic = 0;
406 e->component_type = 0;
407 e->register_idx = s->reg.reg.idx;
408 e->mask = s->reg.write_mask;
411 /* Note that this does not count the loop register
412 * as an address register. */
414 HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3d_shader_frontend *fe,
415 struct shader_reg_maps *reg_maps, struct wined3d_shader_attribute *attributes,
416 struct wined3d_shader_signature_element *input_signature,
417 struct wined3d_shader_signature_element *output_signature, const DWORD *byte_code, DWORD constf_size)
419 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
420 void *fe_data = This->baseShader.frontend_data;
421 struct wined3d_shader_version shader_version;
422 unsigned int cur_loop_depth = 0, max_loop_depth = 0;
423 const DWORD* pToken = byte_code;
425 /* There are some minor differences between pixel and vertex shaders */
427 memset(reg_maps, 0, sizeof(*reg_maps));
429 /* get_registers_used is called on every compile on some 1.x shaders, which can result
430 * in stacking up a collection of local constants. Delete the old constants if existing
432 shader_delete_constant_list(&This->baseShader.constantsF);
433 shader_delete_constant_list(&This->baseShader.constantsB);
434 shader_delete_constant_list(&This->baseShader.constantsI);
436 fe->shader_read_header(fe_data, &pToken, &shader_version);
437 reg_maps->shader_version = shader_version;
439 reg_maps->constf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
440 sizeof(*reg_maps->constf) * ((constf_size + 31) / 32));
441 if(!reg_maps->constf) {
442 ERR("Out of memory\n");
443 return E_OUTOFMEMORY;
446 while (!fe->shader_is_end(fe_data, &pToken))
448 struct wined3d_shader_instruction ins;
453 fe->shader_read_comment(&pToken, &comment);
454 if (comment) continue;
457 fe->shader_read_opcode(fe_data, &pToken, &ins, ¶m_size);
459 /* Unhandled opcode, and its parameters */
460 if (ins.handler_idx == WINED3DSIH_TABLE_SIZE)
462 TRACE("Skipping unrecognized instruction.\n");
463 pToken += param_size;
467 /* Handle declarations */
468 if (ins.handler_idx == WINED3DSIH_DCL)
470 struct wined3d_shader_semantic semantic;
472 fe->shader_read_semantic(&pToken, &semantic);
474 switch (semantic.reg.reg.type)
476 /* Vshader: mark attributes used
477 * Pshader: mark 3.0 input registers used, save token */
478 case WINED3DSPR_INPUT:
479 reg_maps->input_registers |= 1 << semantic.reg.reg.idx;
480 if (shader_version.type == WINED3D_SHADER_TYPE_VERTEX)
482 attributes[semantic.reg.reg.idx].usage = semantic.usage;
483 attributes[semantic.reg.reg.idx].usage_idx = semantic.usage_idx;
487 shader_signature_from_semantic(&input_signature[semantic.reg.reg.idx], &semantic);
491 /* Vshader: mark 3.0 output registers used, save token */
492 case WINED3DSPR_OUTPUT:
493 reg_maps->output_registers |= 1 << semantic.reg.reg.idx;
494 shader_signature_from_semantic(&output_signature[semantic.reg.reg.idx], &semantic);
495 if (semantic.usage == WINED3DDECLUSAGE_FOG) reg_maps->fog = 1;
498 /* Save sampler usage token */
499 case WINED3DSPR_SAMPLER:
500 reg_maps->sampler_type[semantic.reg.reg.idx] = semantic.sampler_type;
504 TRACE("Not recording DCL register type %#x.\n", semantic.reg.reg.type);
508 else if (ins.handler_idx == WINED3DSIH_DEF)
510 struct wined3d_shader_dst_param dst;
511 struct wined3d_shader_src_param rel_addr;
513 local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
514 if (!lconst) return E_OUTOFMEMORY;
516 fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
517 lconst->idx = dst.reg.idx;
519 memcpy(lconst->value, pToken, 4 * sizeof(DWORD));
522 /* In pixel shader 1.X shaders, the constants are clamped between [-1;1] */
523 if (shader_version.major == 1 && shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
525 float *value = (float *) lconst->value;
526 if (value[0] < -1.0f) value[0] = -1.0f;
527 else if (value[0] > 1.0f) value[0] = 1.0f;
528 if (value[1] < -1.0f) value[1] = -1.0f;
529 else if (value[1] > 1.0f) value[1] = 1.0f;
530 if (value[2] < -1.0f) value[2] = -1.0f;
531 else if (value[2] > 1.0f) value[2] = 1.0f;
532 if (value[3] < -1.0f) value[3] = -1.0f;
533 else if (value[3] > 1.0f) value[3] = 1.0f;
536 list_add_head(&This->baseShader.constantsF, &lconst->entry);
538 else if (ins.handler_idx == WINED3DSIH_DEFI)
540 struct wined3d_shader_dst_param dst;
541 struct wined3d_shader_src_param rel_addr;
543 local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
544 if (!lconst) return E_OUTOFMEMORY;
546 fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
547 lconst->idx = dst.reg.idx;
549 memcpy(lconst->value, pToken, 4 * sizeof(DWORD));
552 list_add_head(&This->baseShader.constantsI, &lconst->entry);
553 reg_maps->local_int_consts |= (1 << dst.reg.idx);
555 else if (ins.handler_idx == WINED3DSIH_DEFB)
557 struct wined3d_shader_dst_param dst;
558 struct wined3d_shader_src_param rel_addr;
560 local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
561 if (!lconst) return E_OUTOFMEMORY;
563 fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
564 lconst->idx = dst.reg.idx;
566 memcpy(lconst->value, pToken, sizeof(DWORD));
569 list_add_head(&This->baseShader.constantsB, &lconst->entry);
570 reg_maps->local_bool_consts |= (1 << dst.reg.idx);
572 /* If there's a loop in the shader */
573 else if (ins.handler_idx == WINED3DSIH_LOOP
574 || ins.handler_idx == WINED3DSIH_REP)
576 struct wined3d_shader_src_param src, rel_addr;
578 fe->shader_read_src_param(fe_data, &pToken, &src, &rel_addr);
580 /* Rep and Loop always use an integer constant for the control parameters */
581 if (ins.handler_idx == WINED3DSIH_REP)
583 reg_maps->integer_constants |= 1 << src.reg.idx;
587 fe->shader_read_src_param(fe_data, &pToken, &src, &rel_addr);
588 reg_maps->integer_constants |= 1 << src.reg.idx;
592 if(cur_loop_depth > max_loop_depth)
593 max_loop_depth = cur_loop_depth;
595 else if (ins.handler_idx == WINED3DSIH_ENDLOOP
596 || ins.handler_idx == WINED3DSIH_ENDREP)
600 /* For subroutine prototypes */
601 else if (ins.handler_idx == WINED3DSIH_LABEL)
603 struct wined3d_shader_src_param src, rel_addr;
605 fe->shader_read_src_param(fe_data, &pToken, &src, &rel_addr);
606 reg_maps->labels |= 1 << src.reg.idx;
608 /* Set texture, address, temporary registers */
612 BOOL color0_mov = FALSE;
614 /* This will loop over all the registers and try to
615 * make a bitmask of the ones we're interested in.
617 * Relative addressing tokens are ignored, but that's
618 * okay, since we'll catch any address registers when
619 * they are initialized (required by spec) */
623 struct wined3d_shader_dst_param dst_param;
624 struct wined3d_shader_src_param dst_rel_addr;
626 fe->shader_read_dst_param(fe_data, &pToken, &dst_param, &dst_rel_addr);
628 shader_record_register_usage(This, reg_maps, &dst_param.reg, shader_version.type);
630 /* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
631 * is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
632 * shaders because TECRDOUT isn't used in them, but future register types might cause issues */
633 if (shader_version.type == WINED3D_SHADER_TYPE_VERTEX && shader_version.major < 3
634 && dst_param.reg.type == WINED3DSPR_TEXCRDOUT)
636 reg_maps->texcoord_mask[dst_param.reg.idx] |= dst_param.write_mask;
639 if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
641 IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)This;
643 if(dst_param.reg.type == WINED3DSPR_COLOROUT && dst_param.reg.idx == 0)
645 /* Many 2.0 and 3.0 pixel shaders end with a MOV from a temp register to
646 * COLOROUT 0. If we know this in advance, the ARB shader backend can skip
647 * the mov and perform the sRGB write correction from the source register.
649 * However, if the mov is only partial, we can't do this, and if the write
650 * comes from an instruction other than MOV it is hard to do as well. If
651 * COLOROUT 0 is overwritten partially later, the marker is dropped again. */
653 ps->color0_mov = FALSE;
654 if (ins.handler_idx == WINED3DSIH_MOV)
656 /* Used later when the source register is read. */
660 /* Also drop the MOV marker if the source register is overwritten prior to the shader
663 else if(dst_param.reg.type == WINED3DSPR_TEMP && dst_param.reg.idx == ps->color0_reg)
665 ps->color0_mov = FALSE;
669 /* Declare 1.X samplers implicitly, based on the destination reg. number */
670 if (shader_version.major == 1
671 && (ins.handler_idx == WINED3DSIH_TEX
672 || ins.handler_idx == WINED3DSIH_TEXBEM
673 || ins.handler_idx == WINED3DSIH_TEXBEML
674 || ins.handler_idx == WINED3DSIH_TEXDP3TEX
675 || ins.handler_idx == WINED3DSIH_TEXM3x2TEX
676 || ins.handler_idx == WINED3DSIH_TEXM3x3SPEC
677 || ins.handler_idx == WINED3DSIH_TEXM3x3TEX
678 || ins.handler_idx == WINED3DSIH_TEXM3x3VSPEC
679 || ins.handler_idx == WINED3DSIH_TEXREG2AR
680 || ins.handler_idx == WINED3DSIH_TEXREG2GB
681 || ins.handler_idx == WINED3DSIH_TEXREG2RGB))
683 /* Fake sampler usage, only set reserved bit and ttype */
684 DWORD sampler_code = dst_param.reg.idx;
686 TRACE("Setting fake 2D sampler for 1.x pixelshader\n");
687 reg_maps->sampler_type[sampler_code] = WINED3DSTT_2D;
689 /* texbem is only valid with < 1.4 pixel shaders */
690 if (ins.handler_idx == WINED3DSIH_TEXBEM
691 || ins.handler_idx == WINED3DSIH_TEXBEML)
693 reg_maps->bumpmat |= 1 << dst_param.reg.idx;
694 if (ins.handler_idx == WINED3DSIH_TEXBEML)
696 reg_maps->luminanceparams |= 1 << dst_param.reg.idx;
700 else if (ins.handler_idx == WINED3DSIH_BEM)
702 reg_maps->bumpmat |= 1 << dst_param.reg.idx;
706 if (ins.handler_idx == WINED3DSIH_NRM)
708 reg_maps->usesnrm = 1;
710 else if (ins.handler_idx == WINED3DSIH_DSY)
712 reg_maps->usesdsy = 1;
714 else if (ins.handler_idx == WINED3DSIH_DSX)
716 reg_maps->usesdsx = 1;
718 else if(ins.handler_idx == WINED3DSIH_TEXLDD)
720 reg_maps->usestexldd = 1;
722 else if(ins.handler_idx == WINED3DSIH_TEXLDL)
724 reg_maps->usestexldl = 1;
726 else if(ins.handler_idx == WINED3DSIH_MOVA)
728 reg_maps->usesmova = 1;
730 else if(ins.handler_idx == WINED3DSIH_IFC)
732 reg_maps->usesifc = 1;
734 else if(ins.handler_idx == WINED3DSIH_CALL)
736 reg_maps->usescall = 1;
739 limit = ins.src_count + (ins.predicate ? 1 : 0);
740 for (i = 0; i < limit; ++i)
742 struct wined3d_shader_src_param src_param, src_rel_addr;
745 fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr);
746 count = get_instr_extra_regcount(ins.handler_idx, i);
748 shader_record_register_usage(This, reg_maps, &src_param.reg, shader_version.type);
752 shader_record_register_usage(This, reg_maps, &src_param.reg, shader_version.type);
758 IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) This;
759 if(src_param.reg.type == WINED3DSPR_TEMP &&
760 src_param.swizzle == WINED3DSP_NOSWIZZLE)
762 ps->color0_mov = TRUE;
763 ps->color0_reg = src_param.reg.idx;
769 reg_maps->loop_depth = max_loop_depth;
771 This->baseShader.functionLength = ((const char *)pToken - (const char *)byte_code);
776 unsigned int shader_find_free_input_register(const struct shader_reg_maps *reg_maps, unsigned int max)
778 DWORD map = 1 << max;
780 map &= reg_maps->shader_version.major < 3 ? ~reg_maps->texcoord : ~reg_maps->input_registers;
782 return wined3d_log2i(map);
785 static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semantic,
786 const struct wined3d_shader_version *shader_version)
790 if (semantic->reg.reg.type == WINED3DSPR_SAMPLER)
792 switch (semantic->sampler_type)
794 case WINED3DSTT_2D: TRACE("_2d"); break;
795 case WINED3DSTT_CUBE: TRACE("_cube"); break;
796 case WINED3DSTT_VOLUME: TRACE("_volume"); break;
797 default: TRACE("_unknown_ttype(0x%08x)", semantic->sampler_type);
802 /* Pixel shaders 3.0 don't have usage semantics */
803 if (shader_version->major < 3 && shader_version->type == WINED3D_SHADER_TYPE_PIXEL)
808 switch (semantic->usage)
810 case WINED3DDECLUSAGE_POSITION:
811 TRACE("position%d", semantic->usage_idx);
813 case WINED3DDECLUSAGE_BLENDINDICES:
816 case WINED3DDECLUSAGE_BLENDWEIGHT:
819 case WINED3DDECLUSAGE_NORMAL:
820 TRACE("normal%d", semantic->usage_idx);
822 case WINED3DDECLUSAGE_PSIZE:
825 case WINED3DDECLUSAGE_COLOR:
826 if (semantic->usage_idx == 0) TRACE("color");
827 else TRACE("specular%d", (semantic->usage_idx - 1));
829 case WINED3DDECLUSAGE_TEXCOORD:
830 TRACE("texture%d", semantic->usage_idx);
832 case WINED3DDECLUSAGE_TANGENT:
835 case WINED3DDECLUSAGE_BINORMAL:
838 case WINED3DDECLUSAGE_TESSFACTOR:
841 case WINED3DDECLUSAGE_POSITIONT:
842 TRACE("positionT%d", semantic->usage_idx);
844 case WINED3DDECLUSAGE_FOG:
847 case WINED3DDECLUSAGE_DEPTH:
850 case WINED3DDECLUSAGE_SAMPLE:
854 FIXME("unknown_semantics(0x%08x)", semantic->usage);
859 static void shader_dump_register(const struct wined3d_shader_register *reg,
860 const struct wined3d_shader_version *shader_version)
862 static const char * const rastout_reg_names[] = {"oPos", "oFog", "oPts"};
863 static const char * const misctype_reg_names[] = {"vPos", "vFace"};
864 UINT offset = reg->idx;
868 case WINED3DSPR_TEMP:
872 case WINED3DSPR_INPUT:
876 case WINED3DSPR_CONST:
877 case WINED3DSPR_CONST2:
878 case WINED3DSPR_CONST3:
879 case WINED3DSPR_CONST4:
881 offset = shader_get_float_offset(reg->type, reg->idx);
884 case WINED3DSPR_TEXTURE: /* vs: case WINED3DSPR_ADDR */
885 TRACE("%c", shader_version->type == WINED3D_SHADER_TYPE_PIXEL ? 't' : 'a');
888 case WINED3DSPR_RASTOUT:
889 TRACE("%s", rastout_reg_names[reg->idx]);
892 case WINED3DSPR_COLOROUT:
896 case WINED3DSPR_DEPTHOUT:
900 case WINED3DSPR_ATTROUT:
904 case WINED3DSPR_TEXCRDOUT:
905 /* Vertex shaders >= 3.0 use general purpose output registers
906 * (WINED3DSPR_OUTPUT), which can include an address token */
907 if (shader_version->major >= 3) TRACE("o");
911 case WINED3DSPR_CONSTINT:
915 case WINED3DSPR_CONSTBOOL:
919 case WINED3DSPR_LABEL:
923 case WINED3DSPR_LOOP:
927 case WINED3DSPR_SAMPLER:
931 case WINED3DSPR_MISCTYPE:
932 if (reg->idx > 1) FIXME("Unhandled misctype register %d\n", reg->idx);
933 else TRACE("%s", misctype_reg_names[reg->idx]);
936 case WINED3DSPR_PREDICATE:
940 case WINED3DSPR_IMMCONST:
944 case WINED3DSPR_CONSTBUFFER:
949 TRACE("unhandled_rtype(%#x)", reg->type);
953 if (reg->type == WINED3DSPR_IMMCONST)
956 switch (reg->immconst_type)
958 case WINED3D_IMMCONST_FLOAT:
959 TRACE("%.8e", *(const float *)reg->immconst_data);
962 case WINED3D_IMMCONST_FLOAT4:
963 TRACE("%.8e, %.8e, %.8e, %.8e",
964 *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1],
965 *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]);
969 TRACE("<unhandled immconst_type %#x>", reg->immconst_type);
974 else if (reg->type != WINED3DSPR_RASTOUT && reg->type != WINED3DSPR_MISCTYPE)
976 if (reg->array_idx != ~0U)
978 TRACE("%u[%u", offset, reg->array_idx);
982 shader_dump_src_param(reg->rel_addr, shader_version);
991 shader_dump_src_param(reg->rel_addr, shader_version);
995 if (reg->rel_addr) TRACE("]");
1000 void shader_dump_dst_param(const struct wined3d_shader_dst_param *param,
1001 const struct wined3d_shader_version *shader_version)
1003 DWORD write_mask = param->write_mask;
1005 shader_dump_register(¶m->reg, shader_version);
1007 if (write_mask != WINED3DSP_WRITEMASK_ALL)
1009 static const char *write_mask_chars = "xyzw";
1012 if (write_mask & WINED3DSP_WRITEMASK_0) TRACE("%c", write_mask_chars[0]);
1013 if (write_mask & WINED3DSP_WRITEMASK_1) TRACE("%c", write_mask_chars[1]);
1014 if (write_mask & WINED3DSP_WRITEMASK_2) TRACE("%c", write_mask_chars[2]);
1015 if (write_mask & WINED3DSP_WRITEMASK_3) TRACE("%c", write_mask_chars[3]);
1019 void shader_dump_src_param(const struct wined3d_shader_src_param *param,
1020 const struct wined3d_shader_version *shader_version)
1022 DWORD src_modifier = param->modifiers;
1023 DWORD swizzle = param->swizzle;
1025 if (src_modifier == WINED3DSPSM_NEG
1026 || src_modifier == WINED3DSPSM_BIASNEG
1027 || src_modifier == WINED3DSPSM_SIGNNEG
1028 || src_modifier == WINED3DSPSM_X2NEG
1029 || src_modifier == WINED3DSPSM_ABSNEG)
1031 else if (src_modifier == WINED3DSPSM_COMP)
1033 else if (src_modifier == WINED3DSPSM_NOT)
1036 if (src_modifier == WINED3DSPSM_ABS || src_modifier == WINED3DSPSM_ABSNEG)
1039 shader_dump_register(¶m->reg, shader_version);
1043 switch (src_modifier)
1045 case WINED3DSPSM_NONE: break;
1046 case WINED3DSPSM_NEG: break;
1047 case WINED3DSPSM_NOT: break;
1048 case WINED3DSPSM_BIAS: TRACE("_bias"); break;
1049 case WINED3DSPSM_BIASNEG: TRACE("_bias"); break;
1050 case WINED3DSPSM_SIGN: TRACE("_bx2"); break;
1051 case WINED3DSPSM_SIGNNEG: TRACE("_bx2"); break;
1052 case WINED3DSPSM_COMP: break;
1053 case WINED3DSPSM_X2: TRACE("_x2"); break;
1054 case WINED3DSPSM_X2NEG: TRACE("_x2"); break;
1055 case WINED3DSPSM_DZ: TRACE("_dz"); break;
1056 case WINED3DSPSM_DW: TRACE("_dw"); break;
1057 case WINED3DSPSM_ABSNEG: TRACE(")"); break;
1058 case WINED3DSPSM_ABS: TRACE(")"); break;
1060 TRACE("_unknown_modifier(%#x)", src_modifier);
1064 if (swizzle != WINED3DSP_NOSWIZZLE)
1066 static const char *swizzle_chars = "xyzw";
1067 DWORD swizzle_x = swizzle & 0x03;
1068 DWORD swizzle_y = (swizzle >> 2) & 0x03;
1069 DWORD swizzle_z = (swizzle >> 4) & 0x03;
1070 DWORD swizzle_w = (swizzle >> 6) & 0x03;
1072 if (swizzle_x == swizzle_y
1073 && swizzle_x == swizzle_z
1074 && swizzle_x == swizzle_w)
1076 TRACE(".%c", swizzle_chars[swizzle_x]);
1080 TRACE(".%c%c%c%c", swizzle_chars[swizzle_x], swizzle_chars[swizzle_y],
1081 swizzle_chars[swizzle_z], swizzle_chars[swizzle_w]);
1086 /* Shared code in order to generate the bulk of the shader string.
1087 * NOTE: A description of how to parse tokens can be found on msdn */
1088 void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffer *buffer,
1089 const shader_reg_maps *reg_maps, const DWORD *pFunction, void *backend_ctx)
1091 IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
1092 IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; /* To access shader backend callbacks */
1093 const struct wined3d_shader_frontend *fe = This->baseShader.frontend;
1094 void *fe_data = This->baseShader.frontend_data;
1095 struct wined3d_shader_src_param src_rel_addr[4];
1096 struct wined3d_shader_src_param src_param[4];
1097 struct wined3d_shader_version shader_version;
1098 struct wined3d_shader_src_param dst_rel_addr;
1099 struct wined3d_shader_dst_param dst_param;
1100 struct wined3d_shader_instruction ins;
1101 struct wined3d_shader_context ctx;
1102 const DWORD *pToken = pFunction;
1105 /* Initialize current parsing state */
1107 ctx.reg_maps = reg_maps;
1108 ctx.buffer = buffer;
1109 ctx.backend_data = backend_ctx;
1112 ins.dst = &dst_param;
1113 ins.src = src_param;
1114 This->baseShader.parse_state.current_row = 0;
1116 fe->shader_read_header(fe_data, &pToken, &shader_version);
1118 while (!fe->shader_is_end(fe_data, &pToken))
1120 const char *comment;
1123 /* Skip comment tokens */
1124 fe->shader_read_comment(&pToken, &comment);
1125 if (comment) continue;
1128 fe->shader_read_opcode(fe_data, &pToken, &ins, ¶m_size);
1130 /* Unknown opcode and its parameters */
1131 if (ins.handler_idx == WINED3DSIH_TABLE_SIZE)
1133 TRACE("Skipping unrecognized instruction.\n");
1134 pToken += param_size;
1139 if (ins.handler_idx == WINED3DSIH_DCL
1140 || ins.handler_idx == WINED3DSIH_NOP
1141 || ins.handler_idx == WINED3DSIH_DEF
1142 || ins.handler_idx == WINED3DSIH_DEFI
1143 || ins.handler_idx == WINED3DSIH_DEFB
1144 || ins.handler_idx == WINED3DSIH_PHASE)
1146 pToken += param_size;
1150 /* Destination token */
1151 if (ins.dst_count) fe->shader_read_dst_param(fe_data, &pToken, &dst_param, &dst_rel_addr);
1153 /* Predication token */
1154 if (ins.predicate) ins.predicate = *pToken++;
1156 /* Other source tokens */
1157 for (i = 0; i < ins.src_count; ++i)
1159 fe->shader_read_src_param(fe_data, &pToken, &src_param[i], &src_rel_addr[i]);
1162 /* Call appropriate function for output target */
1163 device->shader_backend->shader_handle_instruction(&ins);
1167 static void shader_dump_ins_modifiers(const struct wined3d_shader_dst_param *dst)
1169 DWORD mmask = dst->modifiers;
1174 case 13: TRACE("_d8"); break;
1175 case 14: TRACE("_d4"); break;
1176 case 15: TRACE("_d2"); break;
1177 case 1: TRACE("_x2"); break;
1178 case 2: TRACE("_x4"); break;
1179 case 3: TRACE("_x8"); break;
1180 default: TRACE("_unhandled_shift(%d)", dst->shift); break;
1183 if (mmask & WINED3DSPDM_SATURATE) TRACE("_sat");
1184 if (mmask & WINED3DSPDM_PARTIALPRECISION) TRACE("_pp");
1185 if (mmask & WINED3DSPDM_MSAMPCENTROID) TRACE("_centroid");
1187 mmask &= ~(WINED3DSPDM_SATURATE | WINED3DSPDM_PARTIALPRECISION | WINED3DSPDM_MSAMPCENTROID);
1189 FIXME("_unrecognized_modifier(%#x)", mmask);
1192 void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data, const DWORD *pFunction)
1194 struct wined3d_shader_version shader_version;
1195 const DWORD* pToken = pFunction;
1196 const char *type_prefix;
1199 TRACE("Parsing %p\n", pFunction);
1201 fe->shader_read_header(fe_data, &pToken, &shader_version);
1203 switch (shader_version.type)
1205 case WINED3D_SHADER_TYPE_VERTEX:
1209 case WINED3D_SHADER_TYPE_GEOMETRY:
1213 case WINED3D_SHADER_TYPE_PIXEL:
1218 FIXME("Unhandled shader type %#x.\n", shader_version.type);
1219 type_prefix = "unknown";
1223 TRACE("%s_%u_%u\n", type_prefix, shader_version.major, shader_version.minor);
1225 while (!fe->shader_is_end(fe_data, &pToken))
1227 struct wined3d_shader_instruction ins;
1228 const char *comment;
1232 fe->shader_read_comment(&pToken, &comment);
1235 TRACE("//%s\n", comment);
1239 fe->shader_read_opcode(fe_data, &pToken, &ins, ¶m_size);
1240 if (ins.handler_idx == WINED3DSIH_TABLE_SIZE)
1242 TRACE("Skipping unrecognized instruction.\n");
1243 pToken += param_size;
1247 if (ins.handler_idx == WINED3DSIH_DCL)
1249 struct wined3d_shader_semantic semantic;
1251 fe->shader_read_semantic(&pToken, &semantic);
1253 shader_dump_decl_usage(&semantic, &shader_version);
1254 shader_dump_ins_modifiers(&semantic.reg);
1256 shader_dump_dst_param(&semantic.reg, &shader_version);
1258 else if (ins.handler_idx == WINED3DSIH_DEF)
1260 struct wined3d_shader_dst_param dst;
1261 struct wined3d_shader_src_param rel_addr;
1263 fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
1265 TRACE("def c%u = %f, %f, %f, %f", shader_get_float_offset(dst.reg.type, dst.reg.idx),
1266 *(const float *)(pToken),
1267 *(const float *)(pToken + 1),
1268 *(const float *)(pToken + 2),
1269 *(const float *)(pToken + 3));
1272 else if (ins.handler_idx == WINED3DSIH_DEFI)
1274 struct wined3d_shader_dst_param dst;
1275 struct wined3d_shader_src_param rel_addr;
1277 fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
1279 TRACE("defi i%u = %d, %d, %d, %d", dst.reg.idx,
1286 else if (ins.handler_idx == WINED3DSIH_DEFB)
1288 struct wined3d_shader_dst_param dst;
1289 struct wined3d_shader_src_param rel_addr;
1291 fe->shader_read_dst_param(fe_data, &pToken, &dst, &rel_addr);
1293 TRACE("defb b%u = %s", dst.reg.idx, *pToken ? "true" : "false");
1298 struct wined3d_shader_src_param dst_rel_addr, src_rel_addr;
1299 struct wined3d_shader_dst_param dst_param;
1300 struct wined3d_shader_src_param src_param;
1304 fe->shader_read_dst_param(fe_data, &pToken, &dst_param, &dst_rel_addr);
1307 /* Print out predication source token first - it follows
1308 * the destination token. */
1311 fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr);
1313 shader_dump_src_param(&src_param, &shader_version);
1317 /* PixWin marks instructions with the coissue flag with a '+' */
1318 if (ins.coissue) TRACE("+");
1320 TRACE("%s", shader_opcode_names[ins.handler_idx]);
1322 if (ins.handler_idx == WINED3DSIH_IFC
1323 || ins.handler_idx == WINED3DSIH_BREAKC)
1327 case COMPARISON_GT: TRACE("_gt"); break;
1328 case COMPARISON_EQ: TRACE("_eq"); break;
1329 case COMPARISON_GE: TRACE("_ge"); break;
1330 case COMPARISON_LT: TRACE("_lt"); break;
1331 case COMPARISON_NE: TRACE("_ne"); break;
1332 case COMPARISON_LE: TRACE("_le"); break;
1333 default: TRACE("_(%u)", ins.flags);
1336 else if (ins.handler_idx == WINED3DSIH_TEX
1337 && shader_version.major >= 2
1338 && (ins.flags & WINED3DSI_TEXLD_PROJECT))
1343 /* We already read the destination token, print it. */
1346 shader_dump_ins_modifiers(&dst_param);
1348 shader_dump_dst_param(&dst_param, &shader_version);
1351 /* Other source tokens */
1352 for (i = ins.dst_count; i < (ins.dst_count + ins.src_count); ++i)
1354 fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr);
1355 TRACE(!i ? " " : ", ");
1356 shader_dump_src_param(&src_param, &shader_version);
1363 void shader_cleanup(IWineD3DBaseShader *iface)
1365 IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
1367 ((IWineD3DDeviceImpl *)This->baseShader.device)->shader_backend->shader_destroy(iface);
1368 HeapFree(GetProcessHeap(), 0, This->baseShader.reg_maps.constf);
1369 HeapFree(GetProcessHeap(), 0, This->baseShader.function);
1370 shader_delete_constant_list(&This->baseShader.constantsF);
1371 shader_delete_constant_list(&This->baseShader.constantsB);
1372 shader_delete_constant_list(&This->baseShader.constantsI);
1373 list_remove(&This->baseShader.shader_list_entry);
1375 if (This->baseShader.frontend && This->baseShader.frontend_data)
1377 This->baseShader.frontend->shader_free(This->baseShader.frontend_data);
1381 static void shader_none_handle_instruction(const struct wined3d_shader_instruction *ins) {}
1382 static void shader_none_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) {}
1383 static void shader_none_select_depth_blt(IWineD3DDevice *iface, enum tex_types tex_type) {}
1384 static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {}
1385 static void shader_none_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) {}
1386 static void shader_none_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) {}
1387 static void shader_none_load_constants(const struct wined3d_context *context, char usePS, char useVS) {}
1388 static void shader_none_load_np2fixup_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
1389 static void shader_none_destroy(IWineD3DBaseShader *iface) {}
1390 static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;}
1391 static void shader_none_free(IWineD3DDevice *iface) {}
1392 static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;}
1394 static void shader_none_get_caps(WINED3DDEVTYPE devtype,
1395 const struct wined3d_gl_info *gl_info, struct shader_caps *pCaps)
1397 /* Set the shader caps to 0 for the none shader backend */
1398 pCaps->VertexShaderVersion = 0;
1399 pCaps->PixelShaderVersion = 0;
1400 pCaps->PixelShader1xMaxValue = 0.0f;
1403 static BOOL shader_none_color_fixup_supported(struct color_fixup_desc fixup)
1405 if (TRACE_ON(d3d_shader) && TRACE_ON(d3d))
1407 TRACE("Checking support for fixup:\n");
1408 dump_color_fixup_desc(fixup);
1411 /* Faked to make some apps happy. */
1412 if (!is_yuv_fixup(fixup))
1418 TRACE("[FAILED]\n");
1422 const shader_backend_t none_shader_backend = {
1423 shader_none_handle_instruction,
1425 shader_none_select_depth_blt,
1426 shader_none_deselect_depth_blt,
1427 shader_none_update_float_vertex_constants,
1428 shader_none_update_float_pixel_constants,
1429 shader_none_load_constants,
1430 shader_none_load_np2fixup_constants,
1431 shader_none_destroy,
1434 shader_none_dirty_const,
1435 shader_none_get_caps,
1436 shader_none_color_fixup_supported,