radeonsi/compute: Fix segfault caused by recent refactoring
authorTom Stellard <thomas.stellard@amd.com>
Thu, 3 Oct 2013 21:39:59 +0000 (17:39 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 4 Oct 2013 00:29:54 +0000 (17:29 -0700)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/radeonsi/radeonsi_shader.c

index dd4856f3b4edc25c026579da54c2adf2871cf4a5..f83c7e42a9ee3b9fd17284f3b3fb6cfcdc2655a3 100644 (file)
@@ -247,6 +247,10 @@ static unsigned tgsi_get_processor_type(const struct tgsi_token *tokens)
 bool r600_can_dump_shader(struct r600_common_screen *rscreen,
                          const struct tgsi_token *tokens)
 {
+       /* Compute shader don't have tgsi_tokens */
+       if (!tokens)
+               return (rscreen->debug_flags & DBG_CS) != 0;
+
        switch (tgsi_get_processor_type(tokens)) {
        case TGSI_PROCESSOR_VERTEX:
                return (rscreen->debug_flags & DBG_VS) != 0;
index 7ed3d2634c90b78641e2888a386030bbbef793d9..97ed4e38125a9c4f61951e177423f9eb9485a15a 100644 (file)
@@ -1759,8 +1759,8 @@ int si_compile_llvm(struct r600_context *rctx, struct si_pipe_shader *shader,
        unsigned i;
        uint32_t *ptr;
        struct radeon_llvm_binary binary;
-       bool dump = r600_can_dump_shader(&rctx->screen->b, shader->selector->tokens);
-
+       bool dump = r600_can_dump_shader(&rctx->screen->b,
+                       shader->selector ? shader->selector->tokens : NULL);
        memset(&binary, 0, sizeof(binary));
        radeon_llvm_compile(mod, &binary,
                r600_get_llvm_processor_name(rctx->screen->b.family), dump);