aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_private.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-16 16:04:08 -0700
committerJason Ekstrand <[email protected]>2017-12-04 09:21:09 -0800
commit16dfdeefc8469c9bb8770bab763fd943b62f875d (patch)
treec25774a8a13baf150dc0686df1c6c1bf11a8e7e8 /src/compiler/spirv/vtn_private.h
parent11bd753c4ece5eafa6fc7c416d25f60371758e1b (diff)
spirv: Rework logging
This commit reworks the way that logging works in SPIR-V to provide richer and more detailed logging infrastructure. This commit contains several improvements over the old mechanism: 1) Log messages are now more detailed. They contain the SPIR-V byte offset as well as source language information from OpSource and OpLine. 2) There is now a logging callback mechanism so that errors can get propagated to the client through debug callbak extensions. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_private.h')
-rw-r--r--src/compiler/spirv/vtn_private.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index b4380294048..cac4d45864b 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -37,6 +37,18 @@
struct vtn_builder;
struct vtn_decoration;
+void vtn_log(struct vtn_builder *b, enum nir_spirv_debug_level level,
+ size_t spirv_offset, const char *message);
+
+void vtn_logf(struct vtn_builder *b, enum nir_spirv_debug_level level,
+ size_t spirv_offset, const char *fmt, ...) PRINTFLIKE(4, 5);
+
+#define vtn_info(...) vtn_logf(b, NIR_SPIRV_DEBUG_LEVEL_INFO, 0, __VA_ARGS__)
+
+void _vtn_warn(struct vtn_builder *b, const char *file, unsigned line,
+ const char *fmt, ...) PRINTFLIKE(4, 5);
+#define vtn_warn(...) _vtn_warn(b, __FILE__, __LINE__, __VA_ARGS__)
+
enum vtn_value_type {
vtn_value_type_invalid = 0,
vtn_value_type_undef,
@@ -466,13 +478,16 @@ struct vtn_decoration {
struct vtn_builder {
nir_builder nb;
+ const uint32_t *spirv;
+
nir_shader *shader;
const struct spirv_to_nir_options *options;
struct vtn_block *block;
- /* Current file, line, and column. Useful for debugging. Set
+ /* Current offset, file, line, and column. Useful for debugging. Set
* automatically by vtn_foreach_instruction.
*/
+ size_t spirv_offset;
char *file;
int line, col;
@@ -560,9 +575,6 @@ vtn_value(struct vtn_builder *b, uint32_t value_id,
return val;
}
-void _vtn_warn(const char *file, int line, const char *msg, ...);
-#define vtn_warn(...) _vtn_warn(__FILE__, __LINE__, __VA_ARGS__)
-
struct vtn_ssa_value *vtn_ssa_value(struct vtn_builder *b, uint32_t value_id);
struct vtn_ssa_value *vtn_create_ssa_value(struct vtn_builder *b,