summaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_private.h
diff options
context:
space:
mode:
authorMartin Pelikán <[email protected]>2018-06-01 14:27:24 +0200
committerJason Ekstrand <[email protected]>2018-06-01 08:09:35 -0700
commit53719f818cf320add55dc7ed3612725c2f6128ce (patch)
tree527021754c711aaa7618d58201969fc75e78a90f /src/compiler/spirv/vtn_private.h
parent360bfb619f394849213b24f3a62696db3210d1ed (diff)
compiler/spirv: reject invalid shader code properly
After bebe3d626e5, b->fail_jump is prepared after vtn_create_builder which can longjmp(3) to it through its vtx_assert()s. This corrupts the stack and creates confusing core dumps, so we need to avoid it. While there, I decided to print the offending values for debugability. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_private.h')
-rw-r--r--src/compiler/spirv/vtn_private.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index b501bbf9b4a..3146d8eeb56 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -51,6 +51,10 @@ 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__)
+void _vtn_err(struct vtn_builder *b, const char *file, unsigned line,
+ const char *fmt, ...) PRINTFLIKE(4, 5);
+#define vtn_err(...) _vtn_err(b, __FILE__, __LINE__, __VA_ARGS__)
+
/** Fail SPIR-V parsing
*
* This function logs an error and then bails out of the shader compile using