wined3d: read_from_framebuffer_texture() isn't suitable for readback of onscreen...
[wine/testsucceed.git] / dlls / d3dx9_36 / asmutils.c
blob4fc73a59041fab53fb0d42ccb57892aa120e32ee
1 /*
2 * Direct3D shader library utility routines
4 * Copyright 2008 Stefan Dösinger
5 * Copyright 2009 Matteo Bruni
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "config.h"
24 #include "wine/debug.h"
26 #include "d3dx9_36_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(asmshader);
30 /* bwriter -> d3d9 conversion functions */
31 DWORD d3d9_swizzle(DWORD bwriter_swizzle) {
32 /* Currently a NOP, but this allows changing the internal definitions
33 * without side effects
35 DWORD ret = 0;
37 if((bwriter_swizzle & BWRITERVS_X_X) == BWRITERVS_X_X) ret |= D3DVS_X_X;
38 if((bwriter_swizzle & BWRITERVS_X_Y) == BWRITERVS_X_Y) ret |= D3DVS_X_Y;
39 if((bwriter_swizzle & BWRITERVS_X_Z) == BWRITERVS_X_Z) ret |= D3DVS_X_Z;
40 if((bwriter_swizzle & BWRITERVS_X_W) == BWRITERVS_X_W) ret |= D3DVS_X_W;
42 if((bwriter_swizzle & BWRITERVS_Y_X) == BWRITERVS_Y_X) ret |= D3DVS_Y_X;
43 if((bwriter_swizzle & BWRITERVS_Y_Y) == BWRITERVS_Y_Y) ret |= D3DVS_Y_Y;
44 if((bwriter_swizzle & BWRITERVS_Y_Z) == BWRITERVS_Y_Z) ret |= D3DVS_Y_Z;
45 if((bwriter_swizzle & BWRITERVS_Y_W) == BWRITERVS_Y_W) ret |= D3DVS_Y_W;
47 if((bwriter_swizzle & BWRITERVS_Z_X) == BWRITERVS_Z_X) ret |= D3DVS_Z_X;
48 if((bwriter_swizzle & BWRITERVS_Z_Y) == BWRITERVS_Z_Y) ret |= D3DVS_Z_Y;
49 if((bwriter_swizzle & BWRITERVS_Z_Z) == BWRITERVS_Z_Z) ret |= D3DVS_Z_Z;
50 if((bwriter_swizzle & BWRITERVS_Z_W) == BWRITERVS_Z_W) ret |= D3DVS_Z_W;
52 if((bwriter_swizzle & BWRITERVS_W_X) == BWRITERVS_W_X) ret |= D3DVS_W_X;
53 if((bwriter_swizzle & BWRITERVS_W_Y) == BWRITERVS_W_Y) ret |= D3DVS_W_Y;
54 if((bwriter_swizzle & BWRITERVS_W_Z) == BWRITERVS_W_Z) ret |= D3DVS_W_Z;
55 if((bwriter_swizzle & BWRITERVS_W_W) == BWRITERVS_W_W) ret |= D3DVS_W_W;
57 return ret;
60 DWORD d3d9_writemask(DWORD bwriter_writemask) {
61 DWORD ret = 0;
63 if(bwriter_writemask & BWRITERSP_WRITEMASK_0) ret |= D3DSP_WRITEMASK_0;
64 if(bwriter_writemask & BWRITERSP_WRITEMASK_1) ret |= D3DSP_WRITEMASK_1;
65 if(bwriter_writemask & BWRITERSP_WRITEMASK_2) ret |= D3DSP_WRITEMASK_2;
66 if(bwriter_writemask & BWRITERSP_WRITEMASK_3) ret |= D3DSP_WRITEMASK_3;
68 return ret;
71 DWORD d3d9_srcmod(DWORD bwriter_srcmod) {
72 switch(bwriter_srcmod) {
73 case BWRITERSPSM_NONE: return D3DSPSM_NONE;
74 case BWRITERSPSM_NEG: return D3DSPSM_NEG;
75 case BWRITERSPSM_ABS: return D3DSPSM_ABS;
76 case BWRITERSPSM_ABSNEG: return D3DSPSM_ABSNEG;
77 case BWRITERSPSM_NOT: return D3DSPSM_NOT;
78 default:
79 FIXME("Unhandled BWRITERSPSM token %u\n", bwriter_srcmod);
80 return 0;
84 DWORD d3d9_dstmod(DWORD bwriter_mod) {
85 DWORD ret = 0;
87 if(bwriter_mod & BWRITERSPDM_SATURATE) ret |= D3DSPDM_SATURATE;
88 if(bwriter_mod & BWRITERSPDM_PARTIALPRECISION) ret |= D3DSPDM_PARTIALPRECISION;
89 if(bwriter_mod & BWRITERSPDM_MSAMPCENTROID) ret |= D3DSPDM_MSAMPCENTROID;
91 return ret;
94 DWORD d3d9_comparetype(DWORD asmshader_comparetype) {
95 switch(asmshader_comparetype) {
96 case BWRITER_COMPARISON_GT: return D3DSPC_GT;
97 case BWRITER_COMPARISON_EQ: return D3DSPC_EQ;
98 case BWRITER_COMPARISON_GE: return D3DSPC_GE;
99 case BWRITER_COMPARISON_LT: return D3DSPC_LT;
100 case BWRITER_COMPARISON_NE: return D3DSPC_NE;
101 case BWRITER_COMPARISON_LE: return D3DSPC_LE;
102 default:
103 FIXME("Unexpected BWRITER_COMPARISON type %u\n", asmshader_comparetype);
104 return 0;
108 DWORD d3d9_sampler(DWORD bwriter_sampler) {
109 if(bwriter_sampler == BWRITERSTT_UNKNOWN) return D3DSTT_UNKNOWN;
110 if(bwriter_sampler == BWRITERSTT_1D) return D3DSTT_1D;
111 if(bwriter_sampler == BWRITERSTT_2D) return D3DSTT_2D;
112 if(bwriter_sampler == BWRITERSTT_CUBE) return D3DSTT_CUBE;
113 if(bwriter_sampler == BWRITERSTT_VOLUME) return D3DSTT_VOLUME;
114 FIXME("Unexpected BWRITERSAMPLER_TEXTURE_TYPE type %u\n", bwriter_sampler);
116 return 0;
119 DWORD d3d9_register(DWORD bwriter_register) {
120 if(bwriter_register == BWRITERSPR_TEMP) return D3DSPR_TEMP;
121 if(bwriter_register == BWRITERSPR_INPUT) return D3DSPR_INPUT;
122 if(bwriter_register == BWRITERSPR_CONST) return D3DSPR_CONST;
123 if(bwriter_register == BWRITERSPR_ADDR) return D3DSPR_ADDR;
124 if(bwriter_register == BWRITERSPR_TEXTURE) return D3DSPR_TEXTURE;
125 if(bwriter_register == BWRITERSPR_RASTOUT) return D3DSPR_RASTOUT;
126 if(bwriter_register == BWRITERSPR_ATTROUT) return D3DSPR_ATTROUT;
127 if(bwriter_register == BWRITERSPR_TEXCRDOUT) return D3DSPR_TEXCRDOUT;
128 if(bwriter_register == BWRITERSPR_OUTPUT) return D3DSPR_OUTPUT;
129 if(bwriter_register == BWRITERSPR_CONSTINT) return D3DSPR_CONSTINT;
130 if(bwriter_register == BWRITERSPR_COLOROUT) return D3DSPR_COLOROUT;
131 if(bwriter_register == BWRITERSPR_DEPTHOUT) return D3DSPR_DEPTHOUT;
132 if(bwriter_register == BWRITERSPR_SAMPLER) return D3DSPR_SAMPLER;
133 if(bwriter_register == BWRITERSPR_CONSTBOOL) return D3DSPR_CONSTBOOL;
134 if(bwriter_register == BWRITERSPR_LOOP) return D3DSPR_LOOP;
135 if(bwriter_register == BWRITERSPR_MISCTYPE) return D3DSPR_MISCTYPE;
136 if(bwriter_register == BWRITERSPR_LABEL) return D3DSPR_LABEL;
137 if(bwriter_register == BWRITERSPR_PREDICATE) return D3DSPR_PREDICATE;
139 FIXME("Unexpected BWRITERSPR %u\n", bwriter_register);
140 return -1;
143 DWORD d3d9_opcode(DWORD bwriter_opcode) {
144 switch(bwriter_opcode) {
145 case BWRITERSIO_NOP: return D3DSIO_NOP;
146 case BWRITERSIO_MOV: return D3DSIO_MOV;
147 case BWRITERSIO_ADD: return D3DSIO_ADD;
148 case BWRITERSIO_SUB: return D3DSIO_SUB;
149 case BWRITERSIO_MAD: return D3DSIO_MAD;
150 case BWRITERSIO_MUL: return D3DSIO_MUL;
151 case BWRITERSIO_RCP: return D3DSIO_RCP;
152 case BWRITERSIO_RSQ: return D3DSIO_RSQ;
153 case BWRITERSIO_DP3: return D3DSIO_DP3;
154 case BWRITERSIO_DP4: return D3DSIO_DP4;
155 case BWRITERSIO_MIN: return D3DSIO_MIN;
156 case BWRITERSIO_MAX: return D3DSIO_MAX;
157 case BWRITERSIO_SLT: return D3DSIO_SLT;
158 case BWRITERSIO_SGE: return D3DSIO_SGE;
159 case BWRITERSIO_EXP: return D3DSIO_EXP;
160 case BWRITERSIO_LOG: return D3DSIO_LOG;
161 case BWRITERSIO_LIT: return D3DSIO_LIT;
162 case BWRITERSIO_DST: return D3DSIO_DST;
163 case BWRITERSIO_LRP: return D3DSIO_LRP;
164 case BWRITERSIO_FRC: return D3DSIO_FRC;
165 case BWRITERSIO_M4x4: return D3DSIO_M4x4;
166 case BWRITERSIO_M4x3: return D3DSIO_M4x3;
167 case BWRITERSIO_M3x4: return D3DSIO_M3x4;
168 case BWRITERSIO_M3x3: return D3DSIO_M3x3;
169 case BWRITERSIO_M3x2: return D3DSIO_M3x2;
170 case BWRITERSIO_CALL: return D3DSIO_CALL;
171 case BWRITERSIO_CALLNZ: return D3DSIO_CALLNZ;
172 case BWRITERSIO_LOOP: return D3DSIO_LOOP;
173 case BWRITERSIO_RET: return D3DSIO_RET;
174 case BWRITERSIO_ENDLOOP: return D3DSIO_ENDLOOP;
175 case BWRITERSIO_LABEL: return D3DSIO_LABEL;
176 case BWRITERSIO_DCL: return D3DSIO_DCL;
177 case BWRITERSIO_POW: return D3DSIO_POW;
178 case BWRITERSIO_CRS: return D3DSIO_CRS;
179 case BWRITERSIO_SGN: return D3DSIO_SGN;
180 case BWRITERSIO_ABS: return D3DSIO_ABS;
181 case BWRITERSIO_NRM: return D3DSIO_NRM;
182 case BWRITERSIO_SINCOS: return D3DSIO_SINCOS;
183 case BWRITERSIO_REP: return D3DSIO_REP;
184 case BWRITERSIO_ENDREP: return D3DSIO_ENDREP;
185 case BWRITERSIO_IF: return D3DSIO_IF;
186 case BWRITERSIO_IFC: return D3DSIO_IFC;
187 case BWRITERSIO_ELSE: return D3DSIO_ELSE;
188 case BWRITERSIO_ENDIF: return D3DSIO_ENDIF;
189 case BWRITERSIO_BREAK: return D3DSIO_BREAK;
190 case BWRITERSIO_BREAKC: return D3DSIO_BREAKC;
191 case BWRITERSIO_MOVA: return D3DSIO_MOVA;
192 case BWRITERSIO_DEFB: return D3DSIO_DEFB;
193 case BWRITERSIO_DEFI: return D3DSIO_DEFI;
195 case BWRITERSIO_TEXKILL: return D3DSIO_TEXKILL;
196 case BWRITERSIO_TEX: return D3DSIO_TEX;
197 case BWRITERSIO_EXPP: return D3DSIO_EXPP;
198 case BWRITERSIO_LOGP: return D3DSIO_LOGP;
199 case BWRITERSIO_DEF: return D3DSIO_DEF;
200 case BWRITERSIO_CMP: return D3DSIO_CMP;
201 case BWRITERSIO_DP2ADD: return D3DSIO_DP2ADD;
202 case BWRITERSIO_DSX: return D3DSIO_DSX;
203 case BWRITERSIO_DSY: return D3DSIO_DSY;
204 case BWRITERSIO_TEXLDD: return D3DSIO_TEXLDD;
205 case BWRITERSIO_SETP: return D3DSIO_SETP;
206 case BWRITERSIO_TEXLDL: return D3DSIO_TEXLDL;
207 case BWRITERSIO_BREAKP: return D3DSIO_BREAKP;
209 case BWRITERSIO_COMMENT: return D3DSIO_COMMENT;
210 case BWRITERSIO_END: return D3DSIO_END;
212 case BWRITERSIO_TEXLDP: return D3DSIO_TEX | D3DSI_TEXLD_PROJECT;
213 case BWRITERSIO_TEXLDB: return D3DSIO_TEX | D3DSI_TEXLD_BIAS;
215 default:
216 FIXME("Unhandled BWRITERSIO token %u\n", bwriter_opcode);
217 return -1;
221 /* Debug print functions */
222 const char *debug_print_srcmod(DWORD mod) {
223 switch(mod) {
224 case BWRITERSPSM_NEG: return "D3DSPSM_NEG";
225 case BWRITERSPSM_ABS: return "D3DSPSM_ABS";
226 case BWRITERSPSM_ABSNEG: return "D3DSPSM_ABSNEG";
227 case BWRITERSPSM_NOT: return "D3DSPSM_NOT";
228 default: return "Unknown source modifier\n";
232 const char *debug_print_dstmod(DWORD mod) {
233 switch(mod) {
234 case 0:
235 return "";
237 case BWRITERSPDM_SATURATE:
238 return "_sat";
239 case BWRITERSPDM_PARTIALPRECISION:
240 return "_pp";
241 case BWRITERSPDM_MSAMPCENTROID:
242 return "_centroid";
244 case BWRITERSPDM_SATURATE | BWRITERSPDM_PARTIALPRECISION:
245 return "_sat_pp";
246 case BWRITERSPDM_SATURATE | BWRITERSPDM_MSAMPCENTROID:
247 return "_sat_centroid";
248 case BWRITERSPDM_PARTIALPRECISION | BWRITERSPDM_MSAMPCENTROID:
249 return "_pp_centroid";
251 case BWRITERSPDM_SATURATE | BWRITERSPDM_PARTIALPRECISION | BWRITERSPDM_MSAMPCENTROID:
252 return "_sat_pp_centroid";
254 default:
255 return "Unexpected modifier\n";
259 static const char *get_regname(const struct shader_reg *reg, shader_type st) {
260 switch(reg->type) {
261 case BWRITERSPR_TEMP:
262 return wine_dbg_sprintf("r%u", reg->regnum);
263 case BWRITERSPR_INPUT:
264 return wine_dbg_sprintf("v%u", reg->regnum);
265 case BWRITERSPR_CONST:
266 return wine_dbg_sprintf("c%u", reg->regnum);
267 case BWRITERSPR_ADDR:
268 return wine_dbg_sprintf("a%u", reg->regnum);
269 case BWRITERSPR_TEXTURE:
270 return wine_dbg_sprintf("t%u", reg->regnum);
271 case BWRITERSPR_RASTOUT:
272 switch(reg->regnum) {
273 case BWRITERSRO_POSITION: return "oPos";
274 case BWRITERSRO_FOG: return "oFog";
275 case BWRITERSRO_POINT_SIZE: return "oPts";
276 default: return "Unexpected RASTOUT";
278 case BWRITERSPR_ATTROUT:
279 return wine_dbg_sprintf("oD%u", reg->regnum);
280 case BWRITERSPR_TEXCRDOUT:
281 return wine_dbg_sprintf("oT%u", reg->regnum);
282 case BWRITERSPR_OUTPUT:
283 return wine_dbg_sprintf("o%u", reg->regnum);
284 case BWRITERSPR_CONSTINT:
285 return wine_dbg_sprintf("i%u", reg->regnum);
286 case BWRITERSPR_COLOROUT:
287 return wine_dbg_sprintf("oC%u", reg->regnum);
288 case BWRITERSPR_DEPTHOUT:
289 return "oDepth";
290 case BWRITERSPR_SAMPLER:
291 return wine_dbg_sprintf("s%u", reg->regnum);
292 case BWRITERSPR_CONSTBOOL:
293 return wine_dbg_sprintf("b%u", reg->regnum);
294 case BWRITERSPR_LOOP:
295 return "aL";
296 case BWRITERSPR_MISCTYPE:
297 switch(reg->regnum) {
298 case 0: return "vPos";
299 case 1: return "vFace";
300 case 2: return "unexpected misctype";
302 case BWRITERSPR_LABEL:
303 return wine_dbg_sprintf("l%u", reg->regnum);
304 case BWRITERSPR_PREDICATE:
305 return wine_dbg_sprintf("p%u", reg->regnum);
306 default:
307 return wine_dbg_sprintf("unknown regname %#x", reg->type);
311 const char *debug_print_writemask(DWORD mask) {
312 char ret[6];
313 unsigned char pos = 1;
315 if(mask == BWRITERSP_WRITEMASK_ALL) return "";
316 ret[0] = '.';
317 if(mask & BWRITERSP_WRITEMASK_0) ret[pos++] = 'x';
318 if(mask & BWRITERSP_WRITEMASK_1) ret[pos++] = 'y';
319 if(mask & BWRITERSP_WRITEMASK_2) ret[pos++] = 'z';
320 if(mask & BWRITERSP_WRITEMASK_3) ret[pos++] = 'w';
321 ret[pos] = 0;
322 return wine_dbg_sprintf("%s", ret);
325 const char *debug_print_relarg(const struct shader_reg *reg) {
326 const char *short_swizzle;
327 if(!reg->rel_reg) return "";
329 short_swizzle = debug_print_swizzle(reg->rel_reg->swizzle);
331 if(reg->rel_reg->type == BWRITERSPR_ADDR) {
332 return wine_dbg_sprintf("[a%u%s]", reg->rel_reg->regnum, short_swizzle);
333 } else if(reg->rel_reg->type == BWRITERSPR_LOOP && reg->rel_reg->regnum == 0) {
334 return wine_dbg_sprintf("[aL%s]", short_swizzle);
335 } else {
336 return "Unexpected relative addressing argument";
340 const char *debug_print_dstreg(const struct shader_reg *reg, shader_type st) {
341 return wine_dbg_sprintf("%s%s%s", get_regname(reg, st),
342 debug_print_relarg(reg),
343 debug_print_writemask(reg->writemask));
346 const char *debug_print_swizzle(DWORD arg) {
347 char ret[6];
348 unsigned int i;
349 DWORD swizzle[4];
351 switch(arg) {
352 case BWRITERVS_NOSWIZZLE:
353 return "";
354 case BWRITERVS_SWIZZLE_X:
355 return ".x";
356 case BWRITERVS_SWIZZLE_Y:
357 return ".y";
358 case BWRITERVS_SWIZZLE_Z:
359 return ".z";
360 case BWRITERVS_SWIZZLE_W:
361 return ".w";
364 swizzle[0] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 0)) & 0x03;
365 swizzle[1] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 2)) & 0x03;
366 swizzle[2] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 4)) & 0x03;
367 swizzle[3] = (arg >> (BWRITERVS_SWIZZLE_SHIFT + 6)) & 0x03;
369 ret[0] = '.';
370 for(i = 0; i < 4; i++) {
371 switch(swizzle[i]) {
372 case 0: ret[1 + i] = 'x'; break;
373 case 1: ret[1 + i] = 'y'; break;
374 case 2: ret[1 + i] = 'z'; break;
375 case 3: ret[1 + i] = 'w'; break;
378 ret[5] = '\0';
379 return wine_dbg_sprintf("%s", ret);
382 const char *debug_print_srcreg(const struct shader_reg *reg, shader_type st) {
383 switch(reg->srcmod) {
384 case BWRITERSPSM_NONE:
385 return wine_dbg_sprintf("%s%s%s", get_regname(reg, st),
386 debug_print_relarg(reg),
387 debug_print_swizzle(reg->swizzle));
388 case BWRITERSPSM_NEG:
389 return wine_dbg_sprintf("-%s%s%s", get_regname(reg, st),
390 debug_print_relarg(reg),
391 debug_print_swizzle(reg->swizzle));
392 case BWRITERSPSM_ABS:
393 return wine_dbg_sprintf("%s%s_abs%s", get_regname(reg, st),
394 debug_print_relarg(reg),
395 debug_print_swizzle(reg->swizzle));
396 case BWRITERSPSM_ABSNEG:
397 return wine_dbg_sprintf("-%s%s_abs%s", get_regname(reg, st),
398 debug_print_relarg(reg),
399 debug_print_swizzle(reg->swizzle));
400 case BWRITERSPSM_NOT:
401 return wine_dbg_sprintf("!%s%s%s", get_regname(reg, st),
402 debug_print_relarg(reg),
403 debug_print_swizzle(reg->swizzle));
405 return "Unknown modifier";
408 const char *debug_print_comp(DWORD comp) {
409 switch(comp) {
410 case BWRITER_COMPARISON_NONE: return "";
411 case BWRITER_COMPARISON_GT: return "_gt";
412 case BWRITER_COMPARISON_EQ: return "_eq";
413 case BWRITER_COMPARISON_GE: return "_ge";
414 case BWRITER_COMPARISON_LT: return "_lt";
415 case BWRITER_COMPARISON_NE: return "_ne";
416 case BWRITER_COMPARISON_LE: return "_le";
417 default: return "_unknown";
421 const char *debug_print_opcode(DWORD opcode) {
422 switch(opcode){
423 case BWRITERSIO_NOP: return "nop";
424 case BWRITERSIO_MOV: return "mov";
425 case BWRITERSIO_ADD: return "add";
426 case BWRITERSIO_SUB: return "sub";
427 case BWRITERSIO_MAD: return "mad";
428 case BWRITERSIO_MUL: return "mul";
429 case BWRITERSIO_RCP: return "rcp";
430 case BWRITERSIO_RSQ: return "rsq";
431 case BWRITERSIO_DP3: return "dp3";
432 case BWRITERSIO_DP4: return "dp4";
433 case BWRITERSIO_MIN: return "min";
434 case BWRITERSIO_MAX: return "max";
435 case BWRITERSIO_SLT: return "slt";
436 case BWRITERSIO_SGE: return "sge";
437 case BWRITERSIO_EXP: return "exp";
438 case BWRITERSIO_LOG: return "log";
439 case BWRITERSIO_LIT: return "lit";
440 case BWRITERSIO_DST: return "dst";
441 case BWRITERSIO_LRP: return "lrp";
442 case BWRITERSIO_FRC: return "frc";
443 case BWRITERSIO_M4x4: return "m4x4";
444 case BWRITERSIO_M4x3: return "m4x3";
445 case BWRITERSIO_M3x4: return "m3x4";
446 case BWRITERSIO_M3x3: return "m3x3";
447 case BWRITERSIO_M3x2: return "m3x2";
448 case BWRITERSIO_CALL: return "call";
449 case BWRITERSIO_CALLNZ: return "callnz";
450 case BWRITERSIO_LOOP: return "loop";
451 case BWRITERSIO_RET: return "ret";
452 case BWRITERSIO_ENDLOOP: return "endloop";
453 case BWRITERSIO_LABEL: return "label";
454 case BWRITERSIO_DCL: return "dcl";
455 case BWRITERSIO_POW: return "pow";
456 case BWRITERSIO_CRS: return "crs";
457 case BWRITERSIO_SGN: return "sgn";
458 case BWRITERSIO_ABS: return "abs";
459 case BWRITERSIO_NRM: return "nrm";
460 case BWRITERSIO_SINCOS: return "sincos";
461 case BWRITERSIO_REP: return "rep";
462 case BWRITERSIO_ENDREP: return "endrep";
463 case BWRITERSIO_IF: return "if";
464 case BWRITERSIO_IFC: return "ifc";
465 case BWRITERSIO_ELSE: return "else";
466 case BWRITERSIO_ENDIF: return "endif";
467 case BWRITERSIO_BREAK: return "break";
468 case BWRITERSIO_BREAKC: return "breakc";
469 case BWRITERSIO_MOVA: return "mova";
470 case BWRITERSIO_DEFB: return "defb";
471 case BWRITERSIO_DEFI: return "defi";
472 case BWRITERSIO_TEXKILL: return "texkill";
473 case BWRITERSIO_TEX: return "tex";
474 case BWRITERSIO_EXPP: return "expp";
475 case BWRITERSIO_LOGP: return "logp";
476 case BWRITERSIO_DEF: return "def";
477 case BWRITERSIO_CMP: return "cmp";
478 case BWRITERSIO_DP2ADD: return "dp2add";
479 case BWRITERSIO_DSX: return "dsx";
480 case BWRITERSIO_DSY: return "dsy";
481 case BWRITERSIO_TEXLDD: return "texldd";
482 case BWRITERSIO_SETP: return "setp";
483 case BWRITERSIO_TEXLDL: return "texldl";
484 case BWRITERSIO_BREAKP: return "breakp";
486 case BWRITERSIO_TEXLDP: return "texldp";
487 case BWRITERSIO_TEXLDB: return "texldb";
489 default: return "unknown";