gallivm: give more verbose names to modules
When we had just one module "gallivm" was an appropriate name. But now we have modules containing all functions for a particular variant, so give it a corresponding name (this is really just for helping debugging). Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
@@ -525,6 +525,7 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
|
||||
struct llvm_vertex_shader *shader =
|
||||
llvm_vertex_shader(llvm->draw->vs.vertex_shader);
|
||||
LLVMTypeRef vertex_header;
|
||||
char module_name[64];
|
||||
|
||||
variant = MALLOC(sizeof *variant +
|
||||
shader->variant_key_size -
|
||||
@@ -535,7 +536,10 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
|
||||
variant->llvm = llvm;
|
||||
variant->shader = shader;
|
||||
|
||||
variant->gallivm = gallivm_create();
|
||||
util_snprintf(module_name, sizeof(module_name), "draw_llvm_vs_variant%u",
|
||||
variant->shader->variants_cached);
|
||||
|
||||
variant->gallivm = gallivm_create(module_name);
|
||||
|
||||
create_jit_types(variant);
|
||||
|
||||
@@ -1513,8 +1517,8 @@ 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" : "");
|
||||
util_snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u_%s",
|
||||
variant->shader->variants_cached, elts ? "elts" : "linear");
|
||||
|
||||
i = 0;
|
||||
arg_types[i++] = get_context_ptr_type(variant); /* context */
|
||||
@@ -2177,6 +2181,7 @@ draw_gs_llvm_create_variant(struct draw_llvm *llvm,
|
||||
struct llvm_geometry_shader *shader =
|
||||
llvm_geometry_shader(llvm->draw->gs.geometry_shader);
|
||||
LLVMTypeRef vertex_header;
|
||||
char module_name[64];
|
||||
|
||||
variant = MALLOC(sizeof *variant +
|
||||
shader->variant_key_size -
|
||||
@@ -2187,7 +2192,10 @@ draw_gs_llvm_create_variant(struct draw_llvm *llvm,
|
||||
variant->llvm = llvm;
|
||||
variant->shader = shader;
|
||||
|
||||
variant->gallivm = gallivm_create();
|
||||
util_snprintf(module_name, sizeof(module_name), "draw_llvm_gs_variant%u",
|
||||
variant->shader->variants_cached);
|
||||
|
||||
variant->gallivm = gallivm_create(module_name);
|
||||
|
||||
create_gs_jit_types(variant);
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ fail:
|
||||
* \return TRUE for success, FALSE for failure
|
||||
*/
|
||||
static boolean
|
||||
init_gallivm_state(struct gallivm_state *gallivm)
|
||||
init_gallivm_state(struct gallivm_state *gallivm, const char *name)
|
||||
{
|
||||
assert(!gallivm->context);
|
||||
assert(!gallivm->module);
|
||||
@@ -299,7 +299,7 @@ init_gallivm_state(struct gallivm_state *gallivm)
|
||||
if (!gallivm->context)
|
||||
goto fail;
|
||||
|
||||
gallivm->module = LLVMModuleCreateWithNameInContext("gallivm",
|
||||
gallivm->module = LLVMModuleCreateWithNameInContext(name,
|
||||
gallivm->context);
|
||||
if (!gallivm->module)
|
||||
goto fail;
|
||||
@@ -466,16 +466,15 @@ lp_build_init(void)
|
||||
|
||||
/**
|
||||
* Create a new gallivm_state object.
|
||||
* Note that we return a singleton.
|
||||
*/
|
||||
struct gallivm_state *
|
||||
gallivm_create(void)
|
||||
gallivm_create(const char *name)
|
||||
{
|
||||
struct gallivm_state *gallivm;
|
||||
|
||||
gallivm = CALLOC_STRUCT(gallivm_state);
|
||||
if (gallivm) {
|
||||
if (!init_gallivm_state(gallivm)) {
|
||||
if (!init_gallivm_state(gallivm, name)) {
|
||||
FREE(gallivm);
|
||||
gallivm = NULL;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ lp_build_init(void);
|
||||
|
||||
|
||||
struct gallivm_state *
|
||||
gallivm_create(void);
|
||||
gallivm_create(const char *name);
|
||||
|
||||
void
|
||||
gallivm_destroy(struct gallivm_state *gallivm);
|
||||
|
||||
@@ -2160,7 +2160,7 @@ generate_fragment(struct llvmpipe_context *lp,
|
||||
struct gallivm_state *gallivm = variant->gallivm;
|
||||
const struct lp_fragment_shader_variant_key *key = &variant->key;
|
||||
struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
|
||||
char func_name[256];
|
||||
char func_name[64];
|
||||
struct lp_type fs_type;
|
||||
struct lp_type blend_type;
|
||||
LLVMTypeRef fs_elem_type;
|
||||
@@ -2247,8 +2247,8 @@ generate_fragment(struct llvmpipe_context *lp,
|
||||
|
||||
blend_vec_type = lp_build_vec_type(gallivm, blend_type);
|
||||
|
||||
util_snprintf(func_name, sizeof(func_name), "fs%u_variant%u_%s",
|
||||
shader->no, variant->no, partial_mask ? "partial" : "whole");
|
||||
util_snprintf(func_name, sizeof(func_name), "fs%u_variant%u_%s",
|
||||
shader->no, variant->no, partial_mask ? "partial" : "whole");
|
||||
|
||||
arg_types[0] = variant->jit_context_ptr_type; /* context */
|
||||
arg_types[1] = int32_type; /* x */
|
||||
@@ -2558,12 +2558,16 @@ generate_variant(struct llvmpipe_context *lp,
|
||||
struct lp_fragment_shader_variant *variant;
|
||||
const struct util_format_description *cbuf0_format_desc;
|
||||
boolean fullcolormask;
|
||||
char module_name[64];
|
||||
|
||||
variant = CALLOC_STRUCT(lp_fragment_shader_variant);
|
||||
if(!variant)
|
||||
return NULL;
|
||||
|
||||
variant->gallivm = gallivm_create();
|
||||
util_snprintf(module_name, sizeof(module_name), "fs%u_variant%u",
|
||||
shader->no, shader->variants_created);
|
||||
|
||||
variant->gallivm = gallivm_create(module_name);
|
||||
if (!variant->gallivm) {
|
||||
FREE(variant);
|
||||
return NULL;
|
||||
|
||||
@@ -711,7 +711,7 @@ generate_setup_variant(struct lp_setup_variant_key *key,
|
||||
struct lp_setup_variant *variant = NULL;
|
||||
struct gallivm_state *gallivm;
|
||||
struct lp_setup_args args;
|
||||
char func_name[256];
|
||||
char func_name[64];
|
||||
LLVMTypeRef vec4f_type;
|
||||
LLVMTypeRef func_type;
|
||||
LLVMTypeRef arg_types[7];
|
||||
@@ -726,13 +726,17 @@ generate_setup_variant(struct lp_setup_variant_key *key,
|
||||
if (variant == NULL)
|
||||
goto fail;
|
||||
|
||||
variant->gallivm = gallivm = gallivm_create();
|
||||
variant->no = setup_no++;
|
||||
|
||||
util_snprintf(func_name, sizeof(func_name), "setup_variant_%u",
|
||||
variant->no);
|
||||
|
||||
variant->gallivm = gallivm = gallivm_create(func_name);
|
||||
if (!variant->gallivm) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
builder = gallivm->builder;
|
||||
variant->no = setup_no++;
|
||||
|
||||
if (LP_DEBUG & DEBUG_COUNTERS) {
|
||||
t0 = os_time_get();
|
||||
@@ -741,9 +745,6 @@ generate_setup_variant(struct lp_setup_variant_key *key,
|
||||
memcpy(&variant->key, key, key->size);
|
||||
variant->list_item_global.base = variant;
|
||||
|
||||
util_snprintf(func_name, sizeof(func_name), "setup_variant_%u",
|
||||
variant->no);
|
||||
|
||||
/* Currently always deal with full 4-wide vertex attributes from
|
||||
* the vertices.
|
||||
*/
|
||||
|
||||
@@ -354,7 +354,7 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test)
|
||||
in[i] = 1.0;
|
||||
}
|
||||
|
||||
gallivm = gallivm_create();
|
||||
gallivm = gallivm_create("test_module");
|
||||
|
||||
test_func = build_unary_test_func(gallivm, test);
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ test_one(unsigned verbose,
|
||||
if(verbose >= 1)
|
||||
dump_blend_type(stdout, blend, type);
|
||||
|
||||
gallivm = gallivm_create();
|
||||
gallivm = gallivm_create("test_module");
|
||||
|
||||
func = add_blend_test(gallivm, blend, type);
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ test_one(unsigned verbose,
|
||||
|
||||
eps = MAX2(lp_const_eps(src_type), lp_const_eps(dst_type));
|
||||
|
||||
gallivm = gallivm_create();
|
||||
gallivm = gallivm_create("test_module");
|
||||
|
||||
func = add_conv_test(gallivm, src_type, num_srcs, dst_type, num_dsts);
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ test_format_float(unsigned verbose, FILE *fp,
|
||||
boolean success = TRUE;
|
||||
unsigned i, j, k, l;
|
||||
|
||||
gallivm = gallivm_create();
|
||||
gallivm = gallivm_create("test_module_float");
|
||||
|
||||
fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_float32_vec4_type());
|
||||
|
||||
@@ -223,7 +223,7 @@ test_format_unorm8(unsigned verbose, FILE *fp,
|
||||
boolean success = TRUE;
|
||||
unsigned i, j, k, l;
|
||||
|
||||
gallivm = gallivm_create();
|
||||
gallivm = gallivm_create("test_module_unorm8");
|
||||
|
||||
fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_unorm8_vec4_type());
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ test_printf(unsigned verbose, FILE *fp,
|
||||
test_printf_t test_printf_func;
|
||||
boolean success = TRUE;
|
||||
|
||||
gallivm = gallivm_create();
|
||||
gallivm = gallivm_create("test_module");
|
||||
|
||||
test = add_printf_test(gallivm);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user