[Mesa-dev] [PATCH 4/4] virgl: add debug-switch to output TGSI

Gert Wollny gert.wollny at collabora.com
Mon Aug 27 07:49:51 UTC 2018


Am Montag, den 20.08.2018, 14:10 +0200 schrieb Erik Faye-Lund:
> This is quite useful for debugging shader-transpiling issues in
> virglrenderer.
Isn't this coverted by ST_DEBUG=tgsi? 

Also, virglrenderer has a variable vrend_dump_shaders in
vrend_renderer.c that enables dumping all the TGSI + the created GLSL
shaders. 

Best, 
Gert


> 
> Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
> ---
>  src/gallium/drivers/virgl/virgl_encode.c | 3 +++
>  src/gallium/drivers/virgl/virgl_screen.c | 1 +
>  src/gallium/drivers/virgl/virgl_screen.h | 1 +
>  3 files changed, 5 insertions(+)
> 
> diff --git a/src/gallium/drivers/virgl/virgl_encode.c
> b/src/gallium/drivers/virgl/virgl_encode.c
> index ea544fe5cd..4e99dda0f7 100644
> --- a/src/gallium/drivers/virgl/virgl_encode.c
> +++ b/src/gallium/drivers/virgl/virgl_encode.c
> @@ -274,6 +274,9 @@ int virgl_encode_shader_state(struct
> virgl_context *ctx,
>     if (bret == false)
>        return -1;
>  
> +   if (virgl_debug & VIRGL_DEBUG_TGSI)
> +      debug_printf("TGSI:\n---8<---\n%s\n---8<---\n", str);
> +
>     shader_len = strlen(str) + 1;
>  
>     left_bytes = shader_len;
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c
> b/src/gallium/drivers/virgl/virgl_screen.c
> index 61147c423c..d9b50c9cca 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -39,6 +39,7 @@
>  int virgl_debug = 0;
>  static const struct debug_named_value debug_options[] = {
>     { "verbose", VIRGL_DEBUG_VERBOSE, NULL },
> +   { "tgsi", VIRGL_DEBUG_TGSI, NULL },
>     DEBUG_NAMED_VALUE_END
>  };
>  DEBUG_GET_ONCE_FLAGS_OPTION(virgl_debug, "VIRGL_DEBUG",
> debug_options, 0)
> diff --git a/src/gallium/drivers/virgl/virgl_screen.h
> b/src/gallium/drivers/virgl/virgl_screen.h
> index 8334d16242..719f5166d7 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.h
> +++ b/src/gallium/drivers/virgl/virgl_screen.h
> @@ -28,6 +28,7 @@
>  #include "virgl_winsys.h"
>  
>  #define VIRGL_DEBUG_VERBOSE 1
> +#define VIRGL_DEBUG_TGSI    2
>  extern int virgl_debug;
>  
>  struct virgl_screen {


More information about the mesa-dev mailing list