summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/disasm.h
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-07-09 13:17:12 -0400
committerRob Clark <[email protected]>2018-07-18 10:10:45 -0400
commit1f464d53010f61ca2ef10e88e4eeefc067f4c8ce (patch)
treee3f54b84c40f0263b1881065e745165d1b516351 /src/gallium/drivers/freedreno/disasm.h
parente4c225ab6f610a3989e7f7f7c6a2a957b92d4528 (diff)
freedreno/ir3: output ir3 and nir asm for frameretrace
See: https://github.com/janesma/apitrace/commit/298dc8195bf082fe1f47aa474e28411f85dd5393 Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/disasm.h')
-rw-r--r--src/gallium/drivers/freedreno/disasm.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/disasm.h b/src/gallium/drivers/freedreno/disasm.h
index 3266c6a484f..fd8053bf49d 100644
--- a/src/gallium/drivers/freedreno/disasm.h
+++ b/src/gallium/drivers/freedreno/disasm.h
@@ -25,6 +25,17 @@
#define DISASM_H_
#include <stdio.h>
+#include <stdbool.h>
+
+#include "util/u_debug.h"
+
+enum fd_shader_debug {
+ FD_DBG_SHADER_VS = 0x01,
+ FD_DBG_SHADER_FS = 0x02,
+ FD_DBG_SHADER_CS = 0x04,
+};
+
+extern enum fd_shader_debug fd_shader_debug;
enum shader_t {
SHADER_VERTEX,
@@ -36,6 +47,38 @@ enum shader_t {
SHADER_MAX,
};
+static inline bool
+shader_debug_enabled(enum shader_t type)
+{
+ switch (type) {
+ case SHADER_VERTEX: return !!(fd_shader_debug & FD_DBG_SHADER_VS);
+ case SHADER_FRAGMENT: return !!(fd_shader_debug & FD_DBG_SHADER_FS);
+ case SHADER_COMPUTE: return !!(fd_shader_debug & FD_DBG_SHADER_CS);
+ default:
+ debug_assert(0);
+ return false;
+ }
+}
+
+static inline const char *
+shader_stage_name(enum shader_t type)
+{
+ /* NOTE these names are chosen to match the INTEL_DEBUG output
+ * which frameretrace parses. Hurray accidental ABI!
+ */
+ switch (type) {
+ case SHADER_VERTEX: return "vertex";
+ case SHADER_TCS: return "tessellation control";
+ case SHADER_TES: return "tessellation evaluation";
+ case SHADER_GEOM: return "geometry";
+ case SHADER_FRAGMENT: return "fragment";
+ case SHADER_COMPUTE: return "compute";
+ default:
+ debug_assert(0);
+ return NULL;
+ }
+}
+
/* bitmask of debug flags */
enum debug_t {
PRINT_RAW = 0x1, /* dump raw hexdump */