From d815d74f75aa3a70e4c2d3859cf0cd76d0f2f9d8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 15 May 2020 09:59:34 +1000 Subject: [PATCH] llvmpipe/draw: drop variant number from function names. When we use an object cache for the MCJIT we can have identical cache entries from the same shader variant in different shaders, but the JIT objcache uses the function name to relink things, so it has to be consistent. Just drop the variants from the function names. Note the modules still have the variant info. Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/draw/draw_llvm.c | 15 +++++---------- src/gallium/drivers/llvmpipe/lp_state_cs.c | 6 ++---- src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 ++-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 06bb4456521..79322e4485b 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1891,8 +1891,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant) memset(&system_values, 0, sizeof(system_values)); memset(&outputs, 0, sizeof(outputs)); - snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant%u", - variant->shader->variants_cached); + snprintf(func_name, sizeof(func_name), "draw_llvm_vs_variant"); i = 0; arg_types[i++] = get_context_ptr_type(variant); /* context */ @@ -2693,8 +2692,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, memset(&system_values, 0, sizeof(system_values)); memset(&outputs, 0, sizeof(outputs)); - snprintf(func_name, sizeof(func_name), "draw_llvm_gs_variant%u", - variant->shader->variants_cached); + snprintf(func_name, sizeof(func_name), "draw_llvm_gs_variant"); assert(variant->vertex_header_ptr_type); @@ -3230,11 +3228,9 @@ draw_tcs_llvm_generate(struct draw_llvm *llvm, memset(&system_values, 0, sizeof(system_values)); - snprintf(func_name, sizeof(func_name), "draw_llvm_tcs_variant%u", - variant->shader->variants_cached); + snprintf(func_name, sizeof(func_name), "draw_llvm_tcs_variant"); - snprintf(func_name_coro, sizeof(func_name_coro), "draw_llvm_tcs_coro_variant%u", - variant->shader->variants_cached); + snprintf(func_name_coro, sizeof(func_name_coro), "draw_llvm_tcs_coro_variant"); arg_types[0] = get_tcs_context_ptr_type(variant); /* context */ arg_types[1] = variant->input_array_type; /* input */ @@ -3762,8 +3758,7 @@ draw_tes_llvm_generate(struct draw_llvm *llvm, memset(&system_values, 0, sizeof(system_values)); memset(&outputs, 0, sizeof(outputs)); - snprintf(func_name, sizeof(func_name), "draw_llvm_tes_variant%u", - variant->shader->variants_cached); + snprintf(func_name, sizeof(func_name), "draw_llvm_tes_variant"); arg_types[0] = get_tes_context_ptr_type(variant); /* context */ arg_types[1] = variant->input_array_type; /* input */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c index c9c03b6db20..9c4699331a0 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_cs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c @@ -96,11 +96,9 @@ generate_compute(struct llvmpipe_context *lp, cs_type.norm = FALSE; /* values are not limited to [0,1] or [-1,1] */ cs_type.width = 32; /* 32-bit float */ cs_type.length = MIN2(lp_native_vector_width / 32, 16); /* n*4 elements per vector */ - snprintf(func_name, sizeof(func_name), "cs%u_variant%u", - shader->no, variant->no); + snprintf(func_name, sizeof(func_name), "cs_variant"); - snprintf(func_name_coro, sizeof(func_name), "cs_co_%u_variant%u", - shader->no, variant->no); + snprintf(func_name_coro, sizeof(func_name), "cs_co_variant"); arg_types[0] = variant->jit_cs_context_ptr_type; /* context */ arg_types[1] = int32_type; /* block_x_size */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 207eefb8c73..d7b77d51eb1 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -2816,8 +2816,8 @@ generate_fragment(struct llvmpipe_context *lp, blend_vec_type = lp_build_vec_type(gallivm, blend_type); - snprintf(func_name, sizeof(func_name), "fs%u_variant%u_%s", - shader->no, variant->no, partial_mask ? "partial" : "whole"); + snprintf(func_name, sizeof(func_name), "fs_variant_%s", + partial_mask ? "partial" : "whole"); arg_types[0] = variant->jit_context_ptr_type; /* context */ arg_types[1] = int32_type; /* x */ -- 2.30.2