gallivm: don't indirect image/sampler destroy.

These are pointless indirections, just call direct the destroy
functions.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17946>
This commit is contained in:
Dave Airlie 2022-08-11 12:57:12 +10:00 committed by Marge Bot
parent 5fdd77c7f2
commit 0c2b824f67
8 changed files with 35 additions and 48 deletions

View file

@ -2318,8 +2318,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
}
lp_build_loop_end_cond(&lp_loop, count, step, LLVMIntUGE);
sampler->destroy(sampler);
image->destroy(image);
draw_llvm_sampler_soa_destroy(sampler);
draw_llvm_image_soa_destroy(image);
/* return clipping boolean value for function */
ret = clipmask_booli8(gallivm, vs_type, clipmask_bool_ptr,
@ -2866,8 +2866,8 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
&params,
outputs);
sampler->destroy(sampler);
image->destroy(image);
draw_llvm_sampler_soa_destroy(sampler);
draw_llvm_image_soa_destroy(image);
lp_build_mask_end(&mask);
@ -3531,8 +3531,8 @@ draw_tcs_llvm_generate(struct draw_llvm *llvm,
LLVMBuildRet(builder, coro_hdl);
}
sampler->destroy(sampler);
image->destroy(image);
draw_llvm_sampler_soa_destroy(sampler);
draw_llvm_image_soa_destroy(image);
gallivm_verify_function(gallivm, variant_func);
gallivm_verify_function(gallivm, variant_coro);
}
@ -4059,8 +4059,8 @@ draw_tes_llvm_generate(struct draw_llvm *llvm,
draw_total_tes_outputs(llvm->draw), tes_type, FALSE);
}
lp_build_loop_end_cond(&lp_loop, num_tess_coord, step, LLVMIntUGE);
sampler->destroy(sampler);
image->destroy(image);
draw_llvm_sampler_soa_destroy(sampler);
draw_llvm_image_soa_destroy(image);
LLVMBuildRet(builder, lp_build_zero(gallivm, lp_type_uint(32)));
gallivm_verify_function(gallivm, variant_func);

View file

@ -915,11 +915,22 @@ draw_tes_llvm_dump_variant_key(struct draw_tes_llvm_variant_key *key);
struct lp_build_sampler_soa *
draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
unsigned nr_samplers);
static inline void
draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
{
FREE(sampler);
}
struct lp_build_image_soa *
draw_llvm_image_soa_create(const struct draw_image_static_state *static_state,
unsigned nr_images);
static inline void
draw_llvm_image_soa_destroy(struct lp_build_image_soa *image)
{
FREE(image);
}
void
draw_llvm_set_sampler_state(struct draw_context *draw,
enum pipe_shader_type shader_stage);

View file

@ -307,12 +307,6 @@ DRAW_LLVM_IMAGE_MEMBER(img_stride, DRAW_JIT_IMAGE_IMG_STRIDE, TRUE)
DRAW_LLVM_IMAGE_MEMBER(num_samples, DRAW_JIT_IMAGE_NUM_SAMPLES, TRUE)
DRAW_LLVM_IMAGE_MEMBER(sample_stride, DRAW_JIT_IMAGE_SAMPLE_STRIDE, TRUE)
static void
draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
{
FREE(sampler);
}
/**
* Fetch filtered values from texture.
@ -382,7 +376,6 @@ draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_stat
if (!sampler)
return NULL;
sampler->base.destroy = draw_llvm_sampler_soa_destroy;
sampler->base.emit_tex_sample = draw_llvm_sampler_soa_emit_fetch_texel;
sampler->base.emit_size_query = draw_llvm_sampler_soa_emit_size_query;
sampler->dynamic_state.base.width = draw_llvm_texture_width;
@ -453,11 +446,6 @@ draw_llvm_image_soa_emit_size_query(const struct lp_build_image_soa *base,
&image->dynamic_state.base,
params);
}
static void
draw_llvm_image_soa_destroy(struct lp_build_image_soa *image)
{
FREE(image);
}
struct lp_build_image_soa *
draw_llvm_image_soa_create(const struct draw_image_static_state *static_state,
@ -469,7 +457,6 @@ draw_llvm_image_soa_create(const struct draw_image_static_state *static_state,
if (!image)
return NULL;
image->base.destroy = draw_llvm_image_soa_destroy;
image->base.emit_op = draw_llvm_image_soa_emit_op;
image->base.emit_size_query = draw_llvm_image_soa_emit_size_query;

View file

@ -201,9 +201,6 @@ struct lp_bld_tgsi_system_values {
*/
struct lp_build_sampler_soa
{
void
(*destroy)(struct lp_build_sampler_soa *sampler);
void
(*emit_tex_sample)(const struct lp_build_sampler_soa *sampler,
struct gallivm_state *gallivm,
@ -232,9 +229,6 @@ struct lp_img_params;
struct lp_build_image_soa
{
void
(*destroy)(struct lp_build_image_soa *image);
void
(*emit_op)(const struct lp_build_image_soa *image,
struct gallivm_state *gallivm,

View file

@ -464,8 +464,8 @@ generate_compute(struct llvmpipe_context *lp,
LLVMBuildRet(builder, coro_hdl);
}
sampler->destroy(sampler);
image->destroy(image);
lp_llvm_sampler_soa_destroy(sampler);
lp_llvm_image_soa_destroy(image);
gallivm_verify_function(gallivm, coro);
gallivm_verify_function(gallivm, function);

View file

@ -3386,8 +3386,8 @@ generate_fragment(struct llvmpipe_context *lp,
}
}
sampler->destroy(sampler);
image->destroy(image);
lp_llvm_sampler_soa_destroy(sampler);
lp_llvm_image_soa_destroy(image);
/* Loop over color outputs / color buffers to do blending */
for (unsigned cbuf = 0; cbuf < key->nr_cbufs; cbuf++) {

View file

@ -339,14 +339,6 @@ lp_llvm_texture_cache_ptr(struct gallivm_state *gallivm,
}
#endif
static void
lp_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
{
FREE(sampler);
}
/**
* Fetch filtered values from texture.
* The 'texel' parameter returns four vectors corresponding to R, G, B, A.
@ -423,7 +415,6 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
if (!sampler)
return NULL;
sampler->base.destroy = lp_llvm_sampler_soa_destroy;
sampler->base.emit_tex_sample = lp_llvm_sampler_soa_emit_fetch_texel;
sampler->base.emit_size_query = lp_llvm_sampler_soa_emit_size_query;
sampler->dynamic_state.base.width = lp_llvm_texture_width;
@ -454,13 +445,6 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
}
static void
lp_llvm_image_soa_destroy(struct lp_build_image_soa *image)
{
FREE(image);
}
static void
lp_llvm_image_soa_emit_op(const struct lp_build_image_soa *base,
struct gallivm_state *gallivm,
@ -522,7 +506,6 @@ lp_llvm_image_soa_create(const struct lp_image_static_state *static_state,
if (!image)
return NULL;
image->base.destroy = lp_llvm_image_soa_destroy;
image->base.emit_op = lp_llvm_image_soa_emit_op;
image->base.emit_size_query = lp_llvm_image_soa_emit_size_query;

View file

@ -48,8 +48,20 @@ struct lp_build_sampler_soa *
lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *key,
unsigned nr_samplers);
static inline void
lp_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
{
FREE(sampler);
}
struct lp_build_image_soa *
lp_llvm_image_soa_create(const struct lp_image_static_state *key,
unsigned nr_images);
static inline void
lp_llvm_image_soa_destroy(struct lp_build_image_soa *image)
{
FREE(image);
}
#endif /* LP_TEX_SAMPLE_H */