Module: Mesa Branch: master Commit: a624faeef98cf06e6effb67f95dc92e70e33f165 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a624faeef98cf06e6effb67f95dc92e70e33f165
Author: Pierre Moreau <[email protected]> Date: Sun May 10 23:21:56 2020 +0200 clover/nir: Register callback for translation messages (v2) This allows us to add SPIR-V to NIR translation failure messages to the program’s compilation log, which can then be queried by the user. v2: Replace the if-statement in `debug_function()` with an assert. Signed-off-by: Pierre Moreau <[email protected]> Reviewed-by: Serge Martin <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5038> --- src/gallium/frontends/clover/nir/invocation.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gallium/frontends/clover/nir/invocation.cpp b/src/gallium/frontends/clover/nir/invocation.cpp index 3d7fda8119b..032fb03cfd8 100644 --- a/src/gallium/frontends/clover/nir/invocation.cpp +++ b/src/gallium/frontends/clover/nir/invocation.cpp @@ -58,6 +58,15 @@ dev_get_nir_compiler_options(const device &dev) return static_cast<const nir_shader_compiler_options*>(co); } +static void debug_function(void *private_data, + enum nir_spirv_debug_level level, size_t spirv_offset, + const char *message) +{ + assert(private_data); + auto r_log = reinterpret_cast<std::string *>(private_data); + *r_log += message; +} + module clover::nir::spirv_to_nir(const module &mod, const device &dev, std::string &r_log) { @@ -80,6 +89,8 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev, spirv_options.caps.kernel = true; spirv_options.caps.int64_atomics = dev.has_int64_atomics(); spirv_options.constant_as_global = true; + spirv_options.debug.func = &debug_function; + spirv_options.debug.private_data = &r_log; module m; // We only insert one section. _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
