diff options
author | José Fonseca <[email protected]> | 2010-06-03 14:22:41 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2010-06-03 14:32:56 +0100 |
commit | 81862bbbc82341b1271fc4bc7b803d409826aeba (patch) | |
tree | bb0f844edf62a234d418aeae6492c7f9896e9ae1 /src/gallium/drivers/llvmpipe | |
parent | 55948247ebd6b37b9ac1869992eb2f765dd62912 (diff) |
llvmpipe: Number shaders/variants for more reproducible function names in the IR.
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.h | 7 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index c8ef1281f4e..6896bedf189 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -67,6 +67,7 @@ #include "util/u_pointer.h" #include "util/u_format.h" #include "util/u_dump.h" +#include "util/u_string.h" #include "os/os_time.h" #include "pipe/p_shader_tokens.h" #include "draw/draw_context.h" @@ -99,6 +100,9 @@ #include <llvm-c/Analysis.h> +static unsigned fs_no = 0; + + /** * Generate the depth /stencil test code. */ @@ -577,6 +581,7 @@ generate_fragment(struct llvmpipe_context *lp, { struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen); const struct lp_fragment_shader_variant_key *key = &variant->key; + char func_name[256]; struct lp_type fs_type; struct lp_type blend_type; LLVMTypeRef fs_elem_type; @@ -637,6 +642,9 @@ generate_fragment(struct llvmpipe_context *lp, blend_vec_type = lp_build_vec_type(blend_type); + util_snprintf(func_name, sizeof(func_name), "fs%u_variant%u_%s", + shader->no, variant->no, do_tri_test ? "edge" : "whole"); + arg_types[0] = screen->context_ptr_type; /* context */ arg_types[1] = LLVMInt32Type(); /* x */ arg_types[2] = LLVMInt32Type(); /* y */ @@ -659,7 +667,7 @@ generate_fragment(struct llvmpipe_context *lp, func_type = LLVMFunctionType(LLVMVoidType(), arg_types, Elements(arg_types), 0); - function = LLVMAddFunction(screen->module, "shader", func_type); + function = LLVMAddFunction(screen->module, func_name, func_type); LLVMSetFunctionCallConv(function, LLVMCCallConv); variant->function[do_tri_test] = function; @@ -924,17 +932,21 @@ generate_variant(struct llvmpipe_context *lp, { struct lp_fragment_shader_variant *variant; - if (gallivm_debug & GALLIVM_DEBUG_IR) { - tgsi_dump(shader->base.tokens, 0); - dump_fs_variant_key(key); - } - variant = CALLOC_STRUCT(lp_fragment_shader_variant); if(!variant) return NULL; + variant->no = shader->variant_no++; + memcpy(&variant->key, key, sizeof *key); + if (gallivm_debug & GALLIVM_DEBUG_IR) { + debug_printf("llvmpipe: Creating fragment shader #%u variant #%u:\n", + shader->no, variant->no); + tgsi_dump(shader->base.tokens, 0); + dump_fs_variant_key(key); + } + generate_fragment(lp, shader, variant, RAST_WHOLE); generate_fragment(lp, shader, variant, RAST_EDGE_TEST); @@ -968,6 +980,8 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, if (!shader) return NULL; + shader->no = fs_no++; + /* get/save the summary info for this shader */ tgsi_scan_shader(templ->tokens, &shader->info); @@ -976,7 +990,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe, if (LP_DEBUG & DEBUG_TGSI) { unsigned attrib; - debug_printf("llvmpipe: Create fragment shader %p:\n", (void *) shader); + debug_printf("llvmpipe: Create fragment shader #%u %p:\n", shader->no, (void *) shader); tgsi_dump(templ->tokens, 0); debug_printf("usage masks:\n"); for (attrib = 0; attrib < shader->info.num_inputs; ++attrib) { diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h index 1d9279e58ad..64ead2a9973 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h @@ -76,6 +76,9 @@ struct lp_fragment_shader_variant lp_jit_frag_func jit_function[2]; struct lp_fragment_shader_variant *next; + + /* For debugging/profiling purposes */ + unsigned no; }; @@ -87,6 +90,10 @@ struct lp_fragment_shader struct tgsi_shader_info info; struct lp_fragment_shader_variant *variants; + + /* For debugging/profiling purposes */ + unsigned no; + unsigned variant_no; }; |