diff options
author | Roland Scheidegger <[email protected]> | 2014-05-13 03:43:11 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2014-05-15 02:35:35 +0200 |
commit | 8620730f8ae59b952bec516cdd7964574a0e9a18 (patch) | |
tree | 54846c97f2009d764388104998635e97f2a03f6b /src/gallium/auxiliary/draw/draw_llvm.c | |
parent | 65ad90bd1b07313481bfcefa6ff0054cc0fb3173 (diff) |
draw: better llvm names for shaders for debugging.
All shaders had the same name.
We could probably use some identifier per shader too, but for now only use
the variant number.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 7ecc34062b0..3624d930f61 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -533,6 +533,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm, return NULL; variant->llvm = llvm; + variant->shader = shader; variant->gallivm = gallivm_create(); @@ -557,7 +558,6 @@ draw_llvm_create_variant(struct draw_llvm *llvm, gallivm_free_ir(variant->gallivm); - variant->shader = shader; variant->list_item_global.base = variant; variant->list_item_local.base = variant; /*variant->no = */shader->variants_created++; @@ -1476,6 +1476,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, LLVMValueRef context_ptr; LLVMBasicBlockRef block; LLVMBuilderRef builder; + char func_name[64]; struct lp_type vs_type; LLVMValueRef end, start; LLVMValueRef count, fetch_elts, fetch_elt_max, fetch_count; @@ -1512,6 +1513,9 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, memset(&system_values, 0, sizeof(system_values)); + util_snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u%s", + variant->shader->variants_cached, elts ? "_elts" : ""); + i = 0; arg_types[i++] = get_context_ptr_type(variant); /* context */ arg_types[i++] = get_vertex_header_ptr_type(variant); /* vertex_header */ @@ -1529,9 +1533,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant, func_type = LLVMFunctionType(int32_type, arg_types, num_arg_types, 0); - variant_func = LLVMAddFunction(gallivm->module, - elts ? "draw_llvm_shader_elts" : "draw_llvm_shader", - func_type); + variant_func = LLVMAddFunction(gallivm->module, func_name, func_type); if (elts) variant->function_elts = variant_func; @@ -2042,6 +2044,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, struct lp_build_sampler_soa *sampler = 0; struct lp_build_context bld; struct lp_bld_tgsi_system_values system_values; + char func_name[64]; struct lp_type gs_type; unsigned i; struct draw_gs_llvm_iface gs_iface; @@ -2054,6 +2057,9 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, memset(&system_values, 0, sizeof(system_values)); + util_snprintf(func_name, sizeof(func_name), "draw_llvm_gs_variant%u", + variant->shader->variants_cached); + assert(variant->vertex_header_ptr_type); arg_types[0] = get_gs_context_ptr_type(variant); /* context */ @@ -2066,8 +2072,8 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, func_type = LLVMFunctionType(int32_type, arg_types, Elements(arg_types), 0); - variant_func = LLVMAddFunction(gallivm->module, "draw_geometry_shader", - func_type); + variant_func = LLVMAddFunction(gallivm->module, func_name, func_type); + variant->function = variant_func; LLVMSetFunctionCallConv(variant_func, LLVMCCallConv); |