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 -
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);
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 */
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 -
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);
* \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);
if (!gallivm->context)
goto fail;
- gallivm->module = LLVMModuleCreateWithNameInContext("gallivm",
+ gallivm->module = LLVMModuleCreateWithNameInContext(name,
gallivm->context);
if (!gallivm->module)
goto fail;
/**
* 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;
}
struct gallivm_state *
-gallivm_create(void);
+gallivm_create(const char *name);
void
gallivm_destroy(struct gallivm_state *gallivm);
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;
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 */
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;
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];
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();
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.
*/
in[i] = 1.0;
}
- gallivm = gallivm_create();
+ gallivm = gallivm_create("test_module");
test_func = build_unary_test_func(gallivm, test);
if(verbose >= 1)
dump_blend_type(stdout, blend, type);
- gallivm = gallivm_create();
+ gallivm = gallivm_create("test_module");
func = add_blend_test(gallivm, blend, type);
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);
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());
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());
test_printf_t test_printf_func;
boolean success = TRUE;
- gallivm = gallivm_create();
+ gallivm = gallivm_create("test_module");
test = add_printf_test(gallivm);