Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1029 | serge | 1 | |
2 | |||
3 | |||
4 | |||
5 | { |
||
6 | VS_OUT_POS = 0, |
||
7 | VS_OUT_PSIZE, |
||
8 | VS_OUT_COL0, |
||
9 | VS_OUT_COL1, |
||
10 | VS_OUT_COL2, |
||
11 | VS_OUT_COL3, |
||
12 | VS_OUT_TEX0, |
||
13 | VS_OUT_TEX1, |
||
14 | VS_OUT_TEX2, |
||
15 | VS_OUT_TEX3, |
||
16 | VS_OUT_TEX4, |
||
17 | VS_OUT_TEX5, |
||
18 | VS_OUT_TEX6, |
||
19 | VS_OUT_TEX7, |
||
20 | VS_OUT_FOG, |
||
21 | VS_OUT_MAX = 0xFFFFFFFF |
||
22 | }v_out_t; |
||
23 | |||
24 | |||
25 | |||
26 | vs_1_1 |
||
27 | |||
28 | |||
29 | dcl_color v1 |
||
30 | dcl_color1 v2 |
||
31 | dcl_fog v3 |
||
32 | dcl_psize v4 |
||
33 | dcl_texcoord v5 |
||
34 | dcl_texcoord1 v6 |
||
35 | |||
36 | |||
37 | |||
38 | |||
39 | mov oD1, v2 |
||
40 | |||
41 | |||
42 | mov oPts, v4.x |
||
43 | mov oT0, v5 |
||
44 | mov oT1, v6 |
||
45 | |||
46 | |||
47 | |||
48 | |||
49 | { |
||
50 | 0xfffe0101, 0x0000001f, 0x80000000, 0x900f0000, 0x0000001f, 0x8000000a, |
||
51 | 0x900f0001, 0x0000001f, 0x8001000a, 0x900f0002, 0x0000001f, 0x8000000b, |
||
52 | 0x900f0003, 0x0000001f, 0x80000004, 0x900f0004, 0x0000001f, 0x80000005, |
||
53 | 0x900f0005, 0x0000001f, 0x80010005, 0x900f0006, 0x00000001, 0xc00f0000, |
||
54 | 0x90e40000, 0x00000001, 0xd00f0000, 0x90e40001, 0x00000001, 0xd00f0001, |
||
55 | 0x90e40002, 0x00000001, 0xc00f0001, 0x90000003, 0x00000001, 0xc00f0002, |
||
56 | 0x90000004, 0x00000001, 0xe00f0000, 0x90e40005, 0x00000001, 0xe00f0001, |
||
57 | 0x90e40006, 0x0000ffff |
||
58 | }; |
||
59 | |||
60 | |||
61 | { |
||
62 | "nop", |
||
63 | "mov", |
||
64 | "add", |
||
65 | "sub", |
||
66 | "mad", |
||
67 | "mul", |
||
68 | "rcp", |
||
69 | "rsq", |
||
70 | "dp3", |
||
71 | "dp4", |
||
72 | "min", |
||
73 | "max", |
||
74 | "slt", |
||
75 | "sge", |
||
76 | "exp", |
||
77 | "log", |
||
78 | "lit", |
||
79 | "dst", |
||
80 | "lrp", |
||
81 | "frc", |
||
82 | "m4x4", |
||
83 | "m4x3", |
||
84 | "m3x4", |
||
85 | "m3x3", |
||
86 | "m3x2", |
||
87 | }; |
||
88 | |||
89 | |||
90 | char *sz_ps_command[] = |
||
91 | { |
||
92 | texcoord |
||
93 | texkill |
||
94 | tex |
||
95 | texbem |
||
96 | texbeml |
||
97 | texreg2ar |
||
98 | texreg2gb |
||
99 | texm3x2pad |
||
100 | texm3x3tex |
||
101 | texm3x3pad |
||
102 | texm3x3tex |
||
103 | texm3x3diff |
||
104 | texm3x3spec |
||
105 | texm3x3vspec |
||
106 | expp |
||
107 | logp |
||
108 | cnd |
||
109 | def |
||
110 | texreg2rgb |
||
111 | texdp3tex |
||
112 | texm3x2depth |
||
113 | texdp3 |
||
114 | texm3x3 |
||
115 | texdepth |
||
116 | cmp |
||
117 | bem |
||
118 | } |
||
119 | */ |
||
120 | |||
121 | |||
122 | { |
||
123 | "position", |
||
124 | "blendweight", |
||
125 | "blendindices", |
||
126 | "normal", |
||
127 | "psize", |
||
128 | "texcoord", |
||
129 | "tangent", |
||
130 | "binormal", |
||
131 | "tessfactor", |
||
132 | "positiont", |
||
133 | "color", |
||
134 | "fog", |
||
135 | "depth", |
||
136 | "sample" |
||
137 | }; |
||
138 | char *sztype[]= |
||
139 | { |
||
140 | "r", |
||
141 | "v", |
||
142 | "c" |
||
143 | "a", |
||
144 | "t", |
||
145 | "rasout", |
||
146 | "attrout", |
||
147 | "texcrdout", |
||
148 | "output", |
||
149 | "constint", |
||
150 | "colorout", |
||
151 | "depthout", |
||
152 | "sampler", |
||
153 | "const2", |
||
154 | "const3", |
||
155 | "const4", |
||
156 | "constbool", |
||
157 | "loop", |
||
158 | "tempfloat16", |
||
159 | "misctype", |
||
160 | "label", |
||
161 | "predicate" |
||
162 | }; |
||
163 | |||
164 | |||
165 | |||
166 | { |
||
167 | u32_t minor: 8; |
||
168 | u32_t major: 8; |
||
169 | u32_t type :16; |
||
170 | }version_t; |
||
171 | |||
172 | |||
173 | { |
||
174 | u32_t type:5; |
||
175 | u32_t rsv :11; |
||
176 | u32_t ind :4; |
||
177 | u32_t rsv2:11; |
||
178 | u32_t sign:1; |
||
179 | }usage_t; |
||
180 | |||
181 | |||
182 | { |
||
183 | u32_t ind :11; |
||
184 | u32_t typeh :2; |
||
185 | u32_t rsv :3; |
||
186 | u32_t wr :4; |
||
187 | u32_t mod :4; |
||
188 | u32_t scale :4; |
||
189 | u32_t typel :3; |
||
190 | u32_t sign :1; |
||
191 | }dst_t; |
||
192 | |||
193 | |||
194 | { |
||
195 | u32_t ind :11; |
||
196 | u32_t rsv :5; |
||
197 | u32_t swzl :8; |
||
198 | u32_t mod :4; |
||
199 | u32_t typel :3; |
||
200 | u32_t sign :1; |
||
201 | }src_t; |
||
202 | |||
203 | |||
204 | |||
205 | |||
206 | |||
207 | |||
208 | |||
209 | |||
210 | |||
211 | |||
212 | u32_t inp_mask; |
||
213 | |||
214 | |||
215 | |||
216 | |||
217 | { |
||
218 | version_t *ver; |
||
219 | |||
220 | |||
221 | |||
222 | |||
223 | { |
||
224 | printf("vs_%d_%d\n\n",ver->major,ver->minor); |
||
225 | if( parse_vs(vs11+1) ) |
||
226 | translate_vs(vs11+1); |
||
227 | }; |
||
228 | |||
229 | |||
230 | }; |
||
231 | |||
232 | |||
233 | static char *txt_mod[2] = { "","_sat"}; |
||
234 | |||
235 | |||
236 | { |
||
237 | dst_t *dst; |
||
238 | src_t *src; |
||
239 | |||
240 | |||
241 | u32_t wr; |
||
242 | |||
243 | |||
244 | char szwm[5]; |
||
245 | |||
246 | |||
247 | |||
248 | |||
249 | { |
||
250 | op_type_t instr = *stream++ & 0xFFFF; |
||
251 | |||
252 | |||
253 | { |
||
254 | case D3DSIO_MOV: |
||
255 | dst = (dst_t*)stream++; |
||
256 | src = (src_t*)stream++; |
||
257 | |||
258 | |||
259 | wr = dst->wr; |
||
260 | |||
261 | |||
262 | { |
||
263 | szswzl[i] = txt_swzl[swzl&3]; |
||
264 | swzl>>=2; |
||
265 | if(wr & (1< |
||
266 | szwm[j++] = txt_swzl[i]; |
||
267 | }; |
||
268 | szswzl[4] = 0; |
||
269 | szwm[j] = 0; |
||
270 | |||
271 | |||
272 | { |
||
273 | case 4: // Rasterizer Register File |
||
274 | if(dst->ind == 0) |
||
275 | vs_out_written |= (1 << VS_OUT_POS); |
||
276 | else if (dst->ind == 1) |
||
277 | vs_out_written |= (1 << VS_OUT_FOG); |
||
278 | else if (dst->ind == 2) |
||
279 | vs_out_written |= (1 << VS_OUT_PSIZE); |
||
280 | else |
||
281 | printf("invalid raster register %d",dst->ind); |
||
282 | break; |
||
283 | |||
284 | |||
285 | if(dst->ind == 0) |
||
286 | vs_out_written |= (1 << VS_OUT_COL0); |
||
287 | else if (dst->ind == 1) |
||
288 | vs_out_written |= (1 << VS_OUT_COL1); |
||
289 | else |
||
290 | printf("invalid attribute register %d",dst->ind); |
||
291 | break; |
||
292 | |||
293 | |||
294 | if(dst->ind < 8) |
||
295 | vs_out_written |= (1 << (VS_OUT_TEX0+dst->ind)); |
||
296 | else |
||
297 | printf("invalid texture register %d",dst->ind); |
||
298 | }; |
||
299 | printf("%s%s %s%d.%s,\t %s%d.%s\n",sz_vs_command[instr],txt_mod[dst->mod], |
||
300 | sztype[dst->typel],dst->ind,szwm, |
||
301 | sztype[src->typel],src->ind,szswzl); |
||
302 | break; |
||
303 | |||
304 | |||
305 | parse_dcl(stream); |
||
306 | stream+=2; |
||
307 | break; |
||
308 | case 0xFFFF: |
||
309 | return 1; |
||
310 | |||
311 | |||
312 | return 0; |
||
313 | }; |
||
314 | }; |
||
315 | }; |
||
316 | |||
317 | |||
318 | |||
319 | { |
||
320 | usage_t *usage; |
||
321 | dst_t *dst; |
||
322 | int dsttype; |
||
323 | char szwm[5]; |
||
324 | int i; |
||
325 | u32_t wr; |
||
326 | |||
327 | |||
328 | dst = (dst_t*)stream++; |
||
329 | dsttype = (dst->typeh << 4) | dst->typel; |
||
330 | wr = dst->wr; |
||
331 | |||
332 | |||
333 | { |
||
334 | if(wr & 1) |
||
335 | szwm[i] = txt_swzl[i]; |
||
336 | }; |
||
337 | szwm[i] = 0; |
||
338 | |||
339 | |||
340 | sztype[dsttype],dst->ind, szwm); |
||
341 | |||
342 | |||
343 | } |
||
344 | |||
345 | |||
346 | |||
347 | |||
348 | int translate_mov(const u32_t *stream); |
||
349 | |||
350 | |||
351 | { |
||
352 | assign_outputs(); |
||
353 | |||
354 | |||
355 | { |
||
356 | op_type_t instr = *stream++ & 0xFFFF; |
||
357 | |||
358 | |||
359 | { |
||
360 | case D3DSIO_MOV: |
||
361 | translate_mov(stream); |
||
362 | stream+=2; |
||
363 | break; |
||
364 | case D3DSIO_DCL: |
||
365 | translate_dcl(stream); |
||
366 | stream+=2; |
||
367 | break; |
||
368 | case 0xFFFF: |
||
369 | return 1; |
||
370 | |||
371 | |||
372 | return 0; |
||
373 | }; |
||
374 | }; |
||
375 | }; |
||
376 | |||
377 | |||
378 | |||
379 | { |
||
380 | |||
381 | |||
382 | |||
383 | |||
384 | }; |
||
385 | |||
386 | |||
387 | |||
388 | |||
389 | |||
390 | |||
391 | * Swizzle indexes. |
||
392 | * Do not change! |
||
393 | */ |
||
394 | /*@{*/ |
||
395 | #define SWIZZLE_X 0 |
||
396 | #define SWIZZLE_Y 1 |
||
397 | #define SWIZZLE_Z 2 |
||
398 | #define SWIZZLE_W 3 |
||
399 | #define SWIZZLE_ZERO 4 /**< For SWZ instruction only */ |
||
400 | #define SWIZZLE_ONE 5 /**< For SWZ instruction only */ |
||
401 | #define SWIZZLE_NIL 7 /**< used during shader code gen (undefined value) */ |
||
402 | /*@}*/ |
||
403 | |||
404 | |||
405 | (PVS_SRC_OPERAND(t_src_index(vp, &src[x]), \ |
||
406 | t_swizzle(y), \ |
||
407 | t_swizzle(y), \ |
||
408 | t_swizzle(y), \ |
||
409 | t_swizzle(y), \ |
||
410 | t_src_class(src[x].File), \ |
||
411 | VSF_FLAG_NONE) | (src[x].RelAddr << 4)) |
||
412 | |||
413 | |||
414 | { |
||
415 | /* this is in fact a NOP as the Mesa SWIZZLE_* are all identical to VSF_IN_COMPONENT_* */ |
||
416 | return swizzle; |
||
417 | } |
||
418 | |||
419 | |||
420 | { |
||
421 | /* WRITEMASK_* is equivalent to VSF_FLAG_* */ |
||
422 | return mask & VSF_FLAG_ALL; |
||
423 | } |
||
424 | |||
425 | |||
426 | { |
||
427 | |||
428 | |||
429 | case 0: //D3DSPR_TEMP |
||
430 | return PVS_DST_REG_TEMPORARY; |
||
431 | case 3: //D3DSPR_ADDR |
||
432 | return PVS_DST_REG_A0; |
||
433 | case 4: //D3DSPR_RASTOUT |
||
434 | case 5: |
||
435 | case 6: //D3DSPR_TEXCRDOUT |
||
436 | return PVS_DST_REG_OUT; |
||
437 | |||
438 | |||
439 | case PROGRAM_INPUT: |
||
440 | case PROGRAM_LOCAL_PARAM: |
||
441 | case PROGRAM_ENV_PARAM: |
||
442 | case PROGRAM_NAMED_PARAM: |
||
443 | case PROGRAM_STATE_VAR: |
||
444 | case PROGRAM_WRITE_ONLY: |
||
445 | case PROGRAM_ADDRESS: |
||
446 | */ |
||
447 | default: |
||
448 | printf("problem in %s", __FUNCTION__); |
||
449 | return -1; |
||
450 | } |
||
451 | } |
||
452 | |||
453 | |||
454 | { |
||
455 | switch(dst->typel) |
||
456 | { |
||
457 | case 4: |
||
458 | if(dst->ind == 0) |
||
459 | return vs_outputs[VS_OUT_POS]; |
||
460 | else if (dst->ind == 1) |
||
461 | return vs_outputs[VS_OUT_FOG]; |
||
462 | else if (dst->ind == 2) |
||
463 | return vs_outputs[VS_OUT_PSIZE]; |
||
464 | break; |
||
465 | case 5: |
||
466 | if(dst->ind == 0) |
||
467 | return vs_outputs[VS_OUT_COL0]; |
||
468 | else if (dst->ind == 1) |
||
469 | return vs_outputs[VS_OUT_COL1]; |
||
470 | |||
471 | |||
472 | return vs_outputs[VS_OUT_TEX0+dst->ind]; |
||
473 | |||
474 | |||
475 | return dst->ind; |
||
476 | } |
||
477 | } |
||
478 | |||
479 | |||
480 | |||
481 | { |
||
482 | int i; |
||
483 | int cur_reg = 0; |
||
484 | |||
485 | |||
486 | vs_outputs[i] = -1; |
||
487 | |||
488 | |||
489 | |||
490 | |||
491 | vs_outputs[VS_OUT_POS] = cur_reg++; |
||
492 | } |
||
493 | |||
494 | |||
495 | vs_outputs[VS_OUT_PSIZE] = cur_reg++; |
||
496 | } |
||
497 | |||
498 | |||
499 | vs_outputs[VS_OUT_COL0] = cur_reg++; |
||
500 | } |
||
501 | |||
502 | |||
503 | vs_outputs[VS_OUT_COL1] = vs_outputs[VS_OUT_COL0] + 1; // ??? |
||
504 | cur_reg = vs_outputs[VS_OUT_COL1] + 1; |
||
505 | } |
||
506 | |||
507 | |||
508 | if (vp->key.OutputsWritten & (1 << VERT_RESULT_FOGC)) { //fog must be in |
||
509 | vp->outputs[VERT_RESULT_FOGC] = cur_reg++; //one of the color regs |
||
510 | } |
||
511 | #endif |
||
512 | |||
513 | |||
514 | if (vs_out_written & (1 << i)) { |
||
515 | vs_outputs[i] = cur_reg++; |
||
516 | } |
||
517 | } |
||
518 | } |
||
519 | |||
520 | |||
521 | |||
522 | { |
||
523 | |||
524 | |||
525 | src_t *src = (src_t*)stream++; |
||
526 | |||
527 | |||
528 | int wr = dst->wr; |
||
529 | |||
530 | |||
531 | |||
532 | 0, |
||
533 | 0, |
||
534 | t_dst_index(dst), |
||
535 | (dst->wr), |
||
536 | t_dst_class(dst->typel)); |
||
537 | |||
538 | |||
539 | // inst[2] = __CONST(0, SWIZZLE_ZERO); |
||
540 | //inst[3] = __CONST(0, SWIZZLE_ZERO); |
||
541 | printf("inst_0 %x\n", inst[0]); |
||
542 | return 1; |
||
543 | } |
||
544 | |||
545 | |||
546 | static GLuint *r300TranslateOpcodeMOV(struct r300_vertex_program *vp, |
||
547 | struct prog_instruction *vpi, |
||
548 | GLuint * inst, |
||
549 | struct prog_src_register src[3]) |
||
550 | { |
||
551 | //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO} |
||
552 | |||
553 | |||
554 | GL_FALSE, |
||
555 | GL_FALSE, |
||
556 | t_dst_index(vp, &vpi->DstReg), |
||
557 | t_dst_mask(vpi->DstReg.WriteMask), |
||
558 | t_dst_class(vpi->DstReg.File)); |
||
559 | inst[1] = t_src(vp, &src[0]); |
||
560 | inst[2] = __CONST(0, SWIZZLE_ZERO); |
||
561 | inst[3] = __CONST(0, SWIZZLE_ZERO); |
||
562 | |||
563 | |||
564 | } |
||
565 | */><>=>><>><>><>><>><>><>>><>>>>><>><>>><>><>><>><>><> |
||
566 | > |