[Mesa-dev] [PATCH 36/88] glsl: don't crash when dumping shaders if some come from cache

Kenneth Graunke kenneth at whitecape.org
Mon Sep 26 02:05:16 UTC 2016


On Saturday, September 24, 2016 3:25:17 PM PDT Timothy Arceri wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_link.cpp | 6 +++++-
>  src/mesa/main/shaderapi.c              | 6 +++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
> index f5dbfcf..e7d2106 100644
> --- a/src/mesa/drivers/dri/i965/brw_link.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_link.cpp
> @@ -188,7 +188,11 @@ process_glsl_ir(gl_shader_stage stage,
>        fprintf(stderr, "GLSL IR for linked %s program %d:\n",
>                _mesa_shader_stage_to_string(shader->Stage),
>                shader_prog->Name);
> -      _mesa_print_ir(stderr, shader->ir, NULL);
> +      if (shader->ir) {
> +         _mesa_print_ir(stderr, shader->ir, NULL);
> +      } else {
> +         fprintf(stderr, "No IR to print shader may be from cache\n");

How about:

"No GLSL IR for linked %s program %d (shader may be from cache)\n",

(assuming you have those fields available...)

> +      }
>        fprintf(stderr, "\n");
>     }
>  }
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index 1aaa366..122bd27 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -1042,7 +1042,11 @@ _mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh)
>        if (ctx->_Shader->Flags & GLSL_DUMP) {
>           if (sh->CompileStatus) {
>              _mesa_log("GLSL IR for shader %d:\n", sh->Name);
> -            _mesa_print_ir(_mesa_get_log_file(), sh->ir, NULL);
> +            if (sh->ir) {
> +               _mesa_print_ir(_mesa_get_log_file(), sh->ir, NULL);
> +            } else {
> +               _mesa_log("No IR to print shader may be from cache\n");
> +            }
>              _mesa_log("\n\n");
>           } else {
>              _mesa_log("GLSL shader %d failed to compile.\n", sh->Name);
> 

Ditto.

With that,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160925/a85b8864/attachment-0001.sig>


More information about the mesa-dev mailing list