aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/disasm.h
diff options
context:
space:
mode:
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 */