<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 8, 2018 at 8:40 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_5416924624667880593moz-cite-prefix">Hmm... The email subject says it's the
v3.<br>
Am I missing something? (it's at the top of the list in my client,
so it's probably the last you sent).<br><div><div class="h5"></div></div></div></div></blockquote><div><br></div><div>Nope, it's my e-mail client that's failing me... Sorry for the noise.</div><div><br></div><div>--Jason</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><div class="m_5416924624667880593moz-cite-prefix"><div><div class="h5">
<br>
On 08/01/18 16:38, Jason Ekstrand wrote:<br>
</div></div></div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">There's a v3 of this<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jan 8, 2018 at 8:36 AM, Lionel
Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This
series is :<br>
<br>
Reviewed-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>>
<div class="m_5416924624667880593HOEnZb">
<div class="m_5416924624667880593h5"><br>
<br>
On 04/01/18 01:34, Jason Ekstrand wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/compiler/spirv/spirv_to_ni<wbr>r.c | 28
++++++++++++++++++++++++++++<br>
src/compiler/spirv/vtn_private<wbr>.h | 1 +<br>
2 files changed, 29 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/spirv_to_<wbr>nir.c
b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
index dcff56f..66ea267 100644<br>
--- a/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
+++ b/src/compiler/spirv/spirv_to_<wbr>nir.c<br>
@@ -31,6 +31,8 @@<br>
#include "nir/nir_constant_expressions.<wbr>h"<br>
#include "spirv_info.h"<br>
+#include <stdio.h><br>
+<br>
void<br>
vtn_log(struct vtn_builder *b, enum
nir_spirv_debug_level level,<br>
size_t spirv_offset, const char *message)<br>
@@ -94,6 +96,27 @@ vtn_log_err(struct vtn_builder *b,<br>
ralloc_free(msg);<br>
}<br>
+static void<br>
+vtn_dump_shader(struct vtn_builder *b, const char
*path, const char *prefix)<br>
+{<br>
+ static int idx = 0;<br>
+<br>
+ char filename[1024];<br>
+ int len = snprintf(filename, sizeof(filename),
"%s/%s-%d.spirv",<br>
+ path, prefix, idx++);<br>
+ if (len < 0 || len >= sizeof(filename))<br>
+ return;<br>
+<br>
+ FILE *f = fopen(filename, "w");<br>
+ if (f == NULL)<br>
+ return;<br>
+<br>
+ fwrite(b->spirv, sizeof(*b->spirv),
b->spirv_word_count, f);<br>
+ fclose(f);<br>
+<br>
+ vtn_info("SPIR-V shader dumped to %s", filename);<br>
+}<br>
+<br>
void<br>
_vtn_warn(struct vtn_builder *b, const char *file,
unsigned line,<br>
const char *fmt, ...)<br>
@@ -117,6 +140,10 @@ _vtn_fail(struct vtn_builder *b,
const char *file, unsigned line,<br>
file, line, fmt, args);<br>
va_end(args);<br>
+ const char *dump_path =
getenv("MESA_SPIRV_FAIL_DUMP_P<wbr>ATH");<br>
+ if (dump_path)<br>
+ vtn_dump_shader(b, dump_path, "fail");<br>
+<br>
longjmp(b->fail_jump, 1);<br>
}<br>
@@ -3690,6 +3717,7 @@ spirv_to_nir(const uint32_t
*words, size_t word_count,<br>
/* Initialize the stn_builder object */<br>
struct vtn_builder *b = rzalloc(NULL, struct
vtn_builder);<br>
b->spirv = words;<br>
+ b->spirv_word_count = word_count;<br>
b->file = NULL;<br>
b->line = -1;<br>
b->col = -1;<br>
diff --git a/src/compiler/spirv/vtn_priva<wbr>te.h
b/src/compiler/spirv/vtn_priva<wbr>te.h<br>
index f7d8f49..374643a 100644<br>
--- a/src/compiler/spirv/vtn_priva<wbr>te.h<br>
+++ b/src/compiler/spirv/vtn_priva<wbr>te.h<br>
@@ -531,6 +531,7 @@ struct vtn_builder {<br>
jmp_buf fail_jump;<br>
const uint32_t *spirv;<br>
+ size_t spirv_word_count;<br>
nir_shader *shader;<br>
const struct spirv_to_nir_options *options;<br>
</blockquote>
<br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<p><br>
</p>
</div></div></div>
</blockquote></div><br></div></div>