10b0cf73532a003ef8e092df6de13c233f22e056
2 * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
23 #include "r300_debug.h"
25 static char* r500_fs_swiz
[] = {
36 static char* r500_fs_op_rgb
[] = {
52 static char* r500_fs_op_alpha
[] = {
71 static char* r500_fs_mask
[] = {
90 static char* r500_fs_tex
[] = {
100 void r500_fs_dump(struct r500_fragment_shader
* fs
)
105 for (i
= 0; i
< fs
->instruction_count
; i
++) {
106 inst
= fs
->instructions
[i
].inst0
;
107 debug_printf("%d: 0: CMN_INST 0x%08x:", i
, inst
);
108 switch (inst
& 0x3) {
109 case R500_INST_TYPE_ALU
:
110 debug_printf("ALU ");
112 case R500_INST_TYPE_OUT
:
113 debug_printf("OUT ");
115 case R500_INST_TYPE_FC
:
118 case R500_INST_TYPE_TEX
:
119 debug_printf("TEX ");
122 debug_printf("%s %s %s %s ",
123 inst
& R500_INST_TEX_SEM_WAIT
? "TEX_WAIT" : "",
124 inst
& R500_INST_LAST
? "LAST" : "",
125 inst
& R500_INST_NOP
? "NOP" : "",
126 inst
& R500_INST_ALU_WAIT
? "ALU_WAIT" : "");
127 debug_printf("wmask: %s omask: %s\n",
128 r500_fs_mask
[(inst
>> 11) & 0xf],
129 r500_fs_mask
[(inst
>> 15) & 0xf]);
130 switch (inst
& 0x3) {
131 case R500_INST_TYPE_ALU
:
132 case R500_INST_TYPE_OUT
:
133 inst
= fs
->instructions
[i
].inst1
;
134 debug_printf(" 1: RGB_ADDR 0x%08x:", inst
);
135 debug_printf("Addr0: %d%c, Addr1: %d%c, "
136 "Addr2: %d%c, srcp:%d\n",
137 inst
& 0xff, (inst
& (1 << 8)) ? 'c' : 't',
138 (inst
>> 10) & 0xff, (inst
& (1 << 18)) ? 'c' : 't',
139 (inst
>> 20) & 0xff, (inst
& (1 << 28)) ? 'c' : 't',
142 inst
= fs
->instructions
[i
].inst2
;
143 debug_printf(" 2: ALPHA_ADDR 0x%08x:", inst
);
144 debug_printf("Addr0: %d%c, Addr1: %d%c, "
145 "Addr2: %d%c, srcp:%d\n",
146 inst
& 0xff, (inst
& (1 << 8)) ? 'c' : 't',
147 (inst
>> 10) & 0xff, (inst
& (1 << 18)) ? 'c' : 't',
148 (inst
>> 20) & 0xff, (inst
& (1 << 28)) ? 'c' : 't',
151 inst
= fs
->instructions
[i
].inst3
;
152 debug_printf(" 3: RGB_INST 0x%08x:", inst
);
153 debug_printf("rgb_A_src:%d %s/%s/%s %d "
154 "rgb_B_src:%d %s/%s/%s %d\n",
155 inst
& 0x3, r500_fs_swiz
[(inst
>> 2) & 0x7],
156 r500_fs_swiz
[(inst
>> 5) & 0x7],
157 r500_fs_swiz
[(inst
>> 8) & 0x7],
158 (inst
>> 11) & 0x3, (inst
>> 13) & 0x3,
159 r500_fs_swiz
[(inst
>> 15) & 0x7],
160 r500_fs_swiz
[(inst
>> 18) & 0x7],
161 r500_fs_swiz
[(inst
>> 21) & 0x7],
164 inst
= fs
->instructions
[i
].inst4
;
165 debug_printf(" 4: ALPHA_INST 0x%08x:", inst
);
166 debug_printf("%s dest:%d%s alp_A_src:%d %s %d "
167 "alp_B_src:%d %s %d w:%d\n",
168 r500_fs_op_alpha
[inst
& 0xf], (inst
>> 4) & 0x7f,
169 inst
& (1<<11) ? "(rel)":"", (inst
>> 12) & 0x3,
170 r500_fs_swiz
[(inst
>> 14) & 0x7], (inst
>> 17) & 0x3,
171 (inst
>> 19) & 0x3, r500_fs_swiz
[(inst
>> 21) & 0x7],
172 (inst
>> 24) & 0x3, (inst
>> 31) & 0x1);
174 inst
= fs
->instructions
[i
].inst5
;
175 debug_printf(" 5: RGBA_INST 0x%08x:", inst
);
176 debug_printf("%s dest:%d%s rgb_C_src:%d %s/%s/%s %d "
177 "alp_C_src:%d %s %d\n",
178 r500_fs_op_rgb
[inst
& 0xf], (inst
>> 4) & 0x7f,
179 inst
& (1 << 11) ? "(rel)":"", (inst
>> 12) & 0x3,
180 r500_fs_swiz
[(inst
>> 14) & 0x7],
181 r500_fs_swiz
[(inst
>> 17) & 0x7],
182 r500_fs_swiz
[(inst
>> 20) & 0x7],
183 (inst
>> 23) & 0x3, (inst
>> 25) & 0x3,
184 r500_fs_swiz
[(inst
>> 27) & 0x7], (inst
>> 30) & 0x3);
186 case R500_INST_TYPE_FC
:
187 /* XXX don't even bother yet */
189 case R500_INST_TYPE_TEX
:
190 inst
= fs
->instructions
[i
].inst1
;
191 debug_printf(" 1: TEX_INST 0x%08x: id: %d "
192 "op:%s, %s, %s %s\n",
193 inst
, (inst
>> 16) & 0xf,
194 r500_fs_tex
[(inst
>> 22) & 0x7],
195 (inst
& (1 << 25)) ? "ACQ" : "",
196 (inst
& (1 << 26)) ? "IGNUNC" : "",
197 (inst
& (1 << 27)) ? "UNSCALED" : "SCALED");
199 inst
= fs
->instructions
[i
].inst2
;
200 debug_printf(" 2: TEX_ADDR 0x%08x: "
201 "src: %d%s %s/%s/%s/%s dst: %d%s %s/%s/%s/%s\n",
202 inst
, inst
& 0x7f, inst
& (1 << 7) ? "(rel)" : "",
203 r500_fs_swiz
[(inst
>> 8) & 0x3],
204 r500_fs_swiz
[(inst
>> 10) & 0x3],
205 r500_fs_swiz
[(inst
>> 12) & 0x3],
206 r500_fs_swiz
[(inst
>> 14) & 0x3],
207 (inst
>> 16) & 0x7f, inst
& (1 << 23) ? "(rel)" : "",
208 r500_fs_swiz
[(inst
>> 24) & 0x3],
209 r500_fs_swiz
[(inst
>> 26) & 0x3],
210 r500_fs_swiz
[(inst
>> 28) & 0x3],
211 r500_fs_swiz
[(inst
>> 30) & 0x3]);
213 inst
= fs
->instructions
[i
].inst3
;
214 debug_printf(" 3: TEX_DXDY 0x%08x\n", inst
);