2 * Copyright 2009 Nicolai Haehnle <nhaehnle@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_context.h"
25 #include "util/u_debug.h"
29 static const struct debug_named_value debug_options
[] = {
30 { "fp", DBG_FP
, "Log fragment program compilation" },
31 { "vp", DBG_VP
, "Log vertex program compilation" },
32 { "pstat", DBG_P_STAT
, "Log vertex/fragment program stats" },
33 { "draw", DBG_DRAW
, "Log draw calls" },
34 { "swtcl", DBG_SWTCL
, "Log SWTCL-specific info" },
35 { "rsblock", DBG_RS_BLOCK
, "Log rasterizer registers" },
36 { "psc", DBG_PSC
, "Log vertex stream registers" },
37 { "tex", DBG_TEX
, "Log basic info about textures" },
38 { "texalloc", DBG_TEXALLOC
, "Log texture mipmap tree info" },
39 { "fall", DBG_FALL
, "Log fallbacks" },
40 { "rs", DBG_RS
, "Log rasterizer" },
41 { "fb", DBG_FB
, "Log framebuffer" },
42 { "cbzb", DBG_CBZB
, "Log fast color clear info" },
43 { "stats", DBG_STATS
, "Log emission statistics" },
44 { "hyperz", DBG_HYPERZ
, "Log HyperZ info" },
45 { "scissor", DBG_SCISSOR
, "Log scissor info" },
46 { "fakeocc", DBG_FAKE_OCC
, "Use fake occlusion queries" },
47 { "anisohq", DBG_ANISOHQ
, "Use high quality anisotropic filtering" },
48 { "notiling", DBG_NO_TILING
, "Disable tiling" },
49 { "noimmd", DBG_NO_IMMD
, "Disable immediate mode" },
50 { "noopt", DBG_NO_OPT
, "Disable shader optimizations" },
51 { "nocbzb", DBG_NO_CBZB
, "Disable fast color clear" },
57 void r300_init_debug(struct r300_screen
* screen
)
59 screen
->debug
= debug_get_flags_option("RADEON_DEBUG", debug_options
, 0);
62 void r500_dump_rs_block(struct r300_rs_block
*rs
)
64 unsigned count
, ip
, it_count
, ic_count
, i
, j
;
66 unsigned col_ptr
, col_fmt
;
68 count
= rs
->inst_count
& 0xf;
71 it_count
= rs
->count
& 0x7f;
72 ic_count
= (rs
->count
>> 7) & 0xf;
74 fprintf(stderr
, "RS Block: %d texcoords (linear), %d colors (perspective)\n",
76 fprintf(stderr
, "%d instructions\n", count
);
78 for (i
= 0; i
< count
; i
++) {
79 if (rs
->inst
[i
] & 0x10) {
80 ip
= rs
->inst
[i
] & 0xf;
81 fprintf(stderr
, "texture: ip %d to psf %d\n",
82 ip
, (rs
->inst
[i
] >> 5) & 0x7f);
84 tex_ptr
= rs
->ip
[ip
] & 0xffffff;
85 fprintf(stderr
, " : ");
89 if ((tex_ptr
& 0x3f) == 63) {
90 fprintf(stderr
, "1.0");
91 } else if ((tex_ptr
& 0x3f) == 62) {
92 fprintf(stderr
, "0.0");
94 fprintf(stderr
, "[%d]", tex_ptr
& 0x3f);
96 } while (j
-- && fprintf(stderr
, "/"));
97 fprintf(stderr
, "\n");
100 if (rs
->inst
[i
] & 0x10000) {
101 ip
= (rs
->inst
[i
] >> 12) & 0xf;
102 fprintf(stderr
, "color: ip %d to psf %d\n",
103 ip
, (rs
->inst
[i
] >> 18) & 0x7f);
105 col_ptr
= (rs
->ip
[ip
] >> 24) & 0x7;
106 col_fmt
= (rs
->ip
[ip
] >> 27) & 0xf;
107 fprintf(stderr
, " : offset %d ", col_ptr
);
111 fprintf(stderr
, "(R/G/B/A)");
114 fprintf(stderr
, "(R/G/B/0)");
117 fprintf(stderr
, "(R/G/B/1)");
120 fprintf(stderr
, "(0/0/0/A)");
123 fprintf(stderr
, "(0/0/0/0)");
126 fprintf(stderr
, "(0/0/0/1)");
129 fprintf(stderr
, "(1/1/1/A)");
132 fprintf(stderr
, "(1/1/1/0)");
135 fprintf(stderr
, "(1/1/1/1)");
138 fprintf(stderr
, "\n");