[Mesa-dev] [PATCH] st/mesa: dump TGSI before calling into the driver

Marek Olšák maraeo at gmail.com
Wed Aug 6 06:33:20 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

If the driver crashes in create_xx_shader, you want to see the shader.
---
 src/mesa/state_tracker/st_program.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 9d7b7c4..fbf8930 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -393,13 +393,12 @@ st_translate_vertex_program(struct st_context *st,
                                       &vpv->tgsi.stream_output);
    }
 
-   vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
-
    if (ST_DEBUG & DEBUG_TGSI) {
-      tgsi_dump( vpv->tgsi.tokens, 0 );
+      tgsi_dump(vpv->tgsi.tokens, 0);
       debug_printf("\n");
    }
 
+   vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
    return vpv;
 
 fail:
@@ -804,15 +803,15 @@ st_translate_fragment_program(struct st_context *st,
    variant->tgsi.tokens = ureg_get_tokens( ureg, NULL );
    ureg_destroy( ureg );
 
-   /* fill in variant */
-   variant->driver_shader = pipe->create_fs_state(pipe, &variant->tgsi);
-   variant->key = *key;
-
    if (ST_DEBUG & DEBUG_TGSI) {
-      tgsi_dump( variant->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
+      tgsi_dump(variant->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/);
       debug_printf("\n");
    }
 
+   /* fill in variant */
+   variant->driver_shader = pipe->create_fs_state(pipe, &variant->tgsi);
+   variant->key = *key;
+
    if (deleteFP) {
       /* Free the temporary program made above */
       struct gl_fragment_program *fp = &stfp->Base;
@@ -1173,10 +1172,6 @@ st_translate_geometry_program(struct st_context *st,
                                       &stgp->tgsi.stream_output);
    }
 
-   /* fill in new variant */
-   gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi);
-   gpv->key = *key;
-
    if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
       _mesa_print_program(&stgp->Base.Base);
       debug_printf("\n");
@@ -1187,6 +1182,9 @@ st_translate_geometry_program(struct st_context *st,
       debug_printf("\n");
    }
 
+   /* fill in new variant */
+   gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi);
+   gpv->key = *key;
    return gpv;
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list