2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial
16 portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **********************************************************************/
29 * Keith Whitwell <keith@tungstengraphics.com>
33 #include "brw_context.h"
37 void brw_wm_print_value( struct brw_wm_compile
*c
,
38 struct brw_wm_value
*value
)
41 if (c
->state
>= PASS2_DONE
)
42 brw_print_reg(value
->hw_reg
);
43 else if( value
== &c
->undef_value
)
44 _mesa_printf("undef");
45 else if( value
- c
->vreg
>= 0 &&
46 value
- c
->vreg
< BRW_WM_MAX_VREG
)
47 _mesa_printf("r%d", value
- c
->vreg
);
48 else if (value
- c
->creg
>= 0 &&
49 value
- c
->creg
< BRW_WM_MAX_PARAM
)
50 _mesa_printf("c%d", value
- c
->creg
);
51 else if (value
- c
->payload
.input_interp
>= 0 &&
52 value
- c
->payload
.input_interp
< FRAG_ATTRIB_MAX
)
53 _mesa_printf("i%d", value
- c
->payload
.input_interp
);
54 else if (value
- c
->payload
.depth
>= 0 &&
55 value
- c
->payload
.depth
< FRAG_ATTRIB_MAX
)
56 _mesa_printf("d%d", value
- c
->payload
.depth
);
61 void brw_wm_print_ref( struct brw_wm_compile
*c
,
62 struct brw_wm_ref
*ref
)
64 struct brw_reg hw_reg
= ref
->hw_reg
;
67 _mesa_printf("UNSPILL(%x)/", ref
->value
->spill_slot
);
69 if (c
->state
>= PASS2_DONE
)
70 brw_print_reg(ref
->hw_reg
);
72 _mesa_printf("%s", hw_reg
.negate
? "-" : "");
73 _mesa_printf("%s", hw_reg
.abs
? "abs/" : "");
74 brw_wm_print_value(c
, ref
->value
);
75 if ((hw_reg
.nr
&1) || hw_reg
.subnr
) {
76 _mesa_printf("->%d.%d", (hw_reg
.nr
&1), hw_reg
.subnr
);
81 void brw_wm_print_insn( struct brw_wm_compile
*c
,
82 struct brw_wm_instruction
*inst
)
85 GLuint nr_args
= brw_wm_nr_args(inst
->opcode
);
88 for (i
= 0; i
< 4; i
++) {
90 brw_wm_print_value(c
, inst
->dst
[i
]);
91 if (inst
->dst
[i
]->spill_slot
)
92 _mesa_printf("/SPILL(%x)",inst
->dst
[i
]->spill_slot
);
101 if (inst
->writemask
!= WRITEMASK_XYZW
)
102 _mesa_printf(".%s%s%s%s",
103 GET_BIT(inst
->writemask
, 0) ? "x" : "",
104 GET_BIT(inst
->writemask
, 1) ? "y" : "",
105 GET_BIT(inst
->writemask
, 2) ? "z" : "",
106 GET_BIT(inst
->writemask
, 3) ? "w" : "");
108 switch (inst
->opcode
) {
110 _mesa_printf(" = PIXELXY");
113 _mesa_printf(" = DELTAXY");
116 _mesa_printf(" = PIXELW");
119 _mesa_printf(" = WPOSXY");
122 _mesa_printf(" = PINTERP");
125 _mesa_printf(" = LINTERP");
128 _mesa_printf(" = CINTERP");
131 _mesa_printf(" = FB_WRITE");
134 _mesa_printf(" = FRONTFACING");
137 _mesa_printf(" = %s", _mesa_opcode_string(inst
->opcode
));
142 _mesa_printf("_SAT");
144 for (arg
= 0; arg
< nr_args
; arg
++) {
148 for (i
= 0; i
< 4; i
++) {
149 if (inst
->src
[arg
][i
]) {
150 brw_wm_print_ref(c
, inst
->src
[arg
][i
]);
164 void brw_wm_print_program( struct brw_wm_compile
*c
,
169 _mesa_printf("%s:\n", stage
);
170 for (insn
= 0; insn
< c
->nr_insns
; insn
++)
171 brw_wm_print_insn(c
, &c
->instruction
[insn
]);