summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2023-05-05 06:44:55 +1000
committerMarge Bot <emma+marge@anholt.net>2023-05-17 01:19:24 +0000
commit58e7867c67e65e597acbe8366be0acc7288d15d4 (patch)
tree9242ee4e87baf7616537cdb6b185209ce662b8f6
parent36eb75d281bd0898b4b669969993f38b5fa9515b (diff)
downloadmesa-58e7867c67e65e597acbe8366be0acc7288d15d4.tar.gz
draw: move to use common sampler/image binding code
Reviewed-by: Brian Paul <brianp@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22788>
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c65
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.h96
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm_sample.c237
-rw-r--r--src/gallium/auxiliary/meson.build1
4 files changed, 64 insertions, 335 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 00becb86e10..e754f407cd9 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -52,6 +52,7 @@
#include "gallivm/lp_bld_pack.h"
#include "gallivm/lp_bld_format.h"
#include "gallivm/lp_bld_misc.h"
+#include "gallivm/lp_bld_jit_sample.h"
#include "tgsi/tgsi_exec.h"
#include "tgsi/tgsi_dump.h"
@@ -1735,10 +1736,10 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
fake_buf_ptr = LLVMBuildGEP2(builder, LLVMInt8TypeInContext(context), fake_buf, &bld.zero, 1, "");
/* code generated texture sampling */
- sampler = draw_llvm_sampler_soa_create(draw_llvm_variant_key_samplers(key),
+ sampler = lp_bld_llvm_sampler_soa_create(draw_llvm_variant_key_samplers(key),
MAX2(key->nr_samplers,
key->nr_sampler_views));
- image = draw_llvm_image_soa_create(draw_llvm_variant_key_images(key),
+ image = lp_bld_llvm_image_soa_create(draw_llvm_variant_key_images(key),
key->nr_images);
step = lp_build_const_int32(gallivm, vector_length);
@@ -2037,8 +2038,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
}
lp_build_loop_end_cond(&lp_loop, count, step, LLVMIntUGE);
- draw_llvm_sampler_soa_destroy(sampler);
- draw_llvm_image_soa_destroy(image);
+ lp_bld_llvm_sampler_soa_destroy(sampler);
+ lp_bld_llvm_image_soa_destroy(image);
/* return clipping boolean value for function */
ret = clipmask_booli8(gallivm, vs_type, blduivec.vec_type, clipmask_bool_ptr,
@@ -2054,8 +2055,8 @@ struct draw_llvm_variant_key *
draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
{
struct draw_llvm_variant_key *key;
- struct draw_sampler_static_state *draw_sampler;
- struct draw_image_static_state *draw_image;
+ struct lp_sampler_static_state *draw_sampler;
+ struct lp_image_static_state *draw_image;
key = (struct draw_llvm_variant_key *)store;
@@ -2143,8 +2144,8 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
void
draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key)
{
- struct draw_sampler_static_state *sampler = draw_llvm_variant_key_samplers(key);
- struct draw_image_static_state *image = draw_llvm_variant_key_images(key);
+ struct lp_sampler_static_state *sampler = draw_llvm_variant_key_samplers(key);
+ struct lp_image_static_state *image = draw_llvm_variant_key_images(key);
debug_printf("clamp_vertex_color = %u\n", key->clamp_vertex_color);
debug_printf("clip_xy = %u\n", key->clip_xy);
debug_printf("clip_z = %u\n", key->clip_z);
@@ -2531,10 +2532,10 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
ssbos_ptr = lp_jit_resources_ssbos(gallivm, variant->resources_type, resources_ptr);
/* code generated texture sampling */
- sampler = draw_llvm_sampler_soa_create(variant->key.samplers,
+ sampler = lp_bld_llvm_sampler_soa_create(variant->key.samplers,
MAX2(variant->key.nr_samplers,
variant->key.nr_sampler_views));
- image = draw_llvm_image_soa_create(draw_gs_llvm_variant_key_images(&variant->key),
+ image = lp_bld_llvm_image_soa_create(draw_gs_llvm_variant_key_images(&variant->key),
variant->key.nr_images);
mask_val = generate_mask_value(variant, gs_type);
lp_build_mask_begin(&mask, gallivm, gs_type, mask_val);
@@ -2583,8 +2584,8 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
&params,
outputs);
- draw_llvm_sampler_soa_destroy(sampler);
- draw_llvm_image_soa_destroy(image);
+ lp_bld_llvm_sampler_soa_destroy(sampler);
+ lp_bld_llvm_image_soa_destroy(image);
lp_build_mask_end(&mask);
@@ -2687,8 +2688,8 @@ struct draw_gs_llvm_variant_key *
draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
{
struct draw_gs_llvm_variant_key *key;
- struct draw_sampler_static_state *draw_sampler;
- struct draw_image_static_state *draw_image;
+ struct lp_sampler_static_state *draw_sampler;
+ struct lp_image_static_state *draw_image;
key = (struct draw_gs_llvm_variant_key *)store;
@@ -2739,8 +2740,8 @@ draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
void
draw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key)
{
- struct draw_sampler_static_state *sampler = key->samplers;
- struct draw_image_static_state *image = draw_gs_llvm_variant_key_images(key);
+ struct lp_sampler_static_state *sampler = key->samplers;
+ struct lp_image_static_state *image = draw_gs_llvm_variant_key_images(key);
debug_printf("clamp_vertex_color = %u\n", key->clamp_vertex_color);
for (unsigned i = 0 ; i < key->nr_sampler_views; i++) {
@@ -3165,10 +3166,10 @@ draw_tcs_llvm_generate(struct draw_llvm *llvm,
consts_ptr = lp_jit_resources_constants(gallivm, variant->resources_type, resources_ptr);
ssbos_ptr = lp_jit_resources_ssbos(gallivm, variant->resources_type, resources_ptr);
- sampler = draw_llvm_sampler_soa_create(variant->key.samplers,
+ sampler = lp_bld_llvm_sampler_soa_create(variant->key.samplers,
MAX2(variant->key.nr_samplers,
variant->key.nr_sampler_views));
- image = draw_llvm_image_soa_create(draw_tcs_llvm_variant_key_images(&variant->key),
+ image = lp_bld_llvm_image_soa_create(draw_tcs_llvm_variant_key_images(&variant->key),
variant->key.nr_images);
LLVMValueRef counter = LLVMGetParam(variant_coro, 6);
@@ -3242,8 +3243,8 @@ draw_tcs_llvm_generate(struct draw_llvm *llvm,
LLVMBuildRet(builder, coro_hdl);
}
- draw_llvm_sampler_soa_destroy(sampler);
- draw_llvm_image_soa_destroy(image);
+ lp_bld_llvm_sampler_soa_destroy(sampler);
+ lp_bld_llvm_image_soa_destroy(image);
gallivm_verify_function(gallivm, variant_func);
gallivm_verify_function(gallivm, variant_coro);
}
@@ -3344,8 +3345,8 @@ draw_tcs_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
{
unsigned i;
struct draw_tcs_llvm_variant_key *key;
- struct draw_sampler_static_state *draw_sampler;
- struct draw_image_static_state *draw_image;
+ struct lp_sampler_static_state *draw_sampler;
+ struct lp_image_static_state *draw_image;
key = (struct draw_tcs_llvm_variant_key *)store;
@@ -3392,8 +3393,8 @@ draw_tcs_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
void
draw_tcs_llvm_dump_variant_key(struct draw_tcs_llvm_variant_key *key)
{
- struct draw_sampler_static_state *sampler = key->samplers;
- struct draw_image_static_state *image = draw_tcs_llvm_variant_key_images(key);
+ struct lp_sampler_static_state *sampler = key->samplers;
+ struct lp_image_static_state *image = draw_tcs_llvm_variant_key_images(key);
for (unsigned i = 0 ; i < key->nr_sampler_views; i++) {
debug_printf("sampler[%i].src_format = %s\n", i,
util_format_name(sampler[i].texture_state.format));
@@ -3672,10 +3673,10 @@ draw_tes_llvm_generate(struct draw_llvm *llvm,
ssbos_ptr = lp_jit_resources_ssbos(gallivm, variant->resources_type, resources_ptr);
- sampler = draw_llvm_sampler_soa_create(variant->key.samplers,
+ sampler = lp_bld_llvm_sampler_soa_create(variant->key.samplers,
MAX2(variant->key.nr_samplers,
variant->key.nr_sampler_views));
- image = draw_llvm_image_soa_create(draw_tes_llvm_variant_key_images(&variant->key),
+ image = lp_bld_llvm_image_soa_create(draw_tes_llvm_variant_key_images(&variant->key),
variant->key.nr_images);
step = lp_build_const_int32(gallivm, vector_length);
@@ -3762,8 +3763,8 @@ draw_tes_llvm_generate(struct draw_llvm *llvm,
draw_total_tes_outputs(llvm->draw), tes_type, primid_slot, FALSE);
}
lp_build_loop_end_cond(&lp_loop, num_tess_coord, step, LLVMIntUGE);
- draw_llvm_sampler_soa_destroy(sampler);
- draw_llvm_image_soa_destroy(image);
+ lp_bld_llvm_sampler_soa_destroy(sampler);
+ lp_bld_llvm_image_soa_destroy(image);
LLVMBuildRet(builder, lp_build_zero(gallivm, lp_type_uint(32)));
gallivm_verify_function(gallivm, variant_func);
@@ -3865,8 +3866,8 @@ struct draw_tes_llvm_variant_key *
draw_tes_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
{
struct draw_tes_llvm_variant_key *key;
- struct draw_sampler_static_state *draw_sampler;
- struct draw_image_static_state *draw_image;
+ struct lp_sampler_static_state *draw_sampler;
+ struct lp_image_static_state *draw_image;
key = (struct draw_tes_llvm_variant_key *)store;
@@ -3922,8 +3923,8 @@ draw_tes_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
void
draw_tes_llvm_dump_variant_key(struct draw_tes_llvm_variant_key *key)
{
- struct draw_sampler_static_state *sampler = key->samplers;
- struct draw_image_static_state *image = draw_tes_llvm_variant_key_images(key);
+ struct lp_sampler_static_state *sampler = key->samplers;
+ struct lp_image_static_state *image = draw_tes_llvm_variant_key_images(key);
if (key->primid_needed)
debug_printf("prim id output %d\n", key->primid_output);
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index 10594eedbc8..05d383c484d 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -37,6 +37,7 @@
#include "gallivm/lp_bld_sample.h"
#include "gallivm/lp_bld_limits.h"
#include "gallivm/lp_bld_jit_types.h"
+#include "gallivm/lp_bld_jit_sample.h"
#include "pipe/p_context.h"
#include "util/list.h"
@@ -48,22 +49,6 @@ struct llvm_geometry_shader;
struct llvm_tess_ctrl_shader;
struct llvm_tess_eval_shader;
-struct draw_sampler_static_state
-{
- /*
- * These attributes are effectively interleaved for more sane key handling.
- * However, there might be lots of null space if the amount of samplers and
- * textures isn't the same.
- */
- struct lp_static_sampler_state sampler_state;
- struct lp_static_texture_state texture_state;
-};
-
-struct draw_image_static_state
-{
- struct lp_static_texture_state image_state;
-};
-
enum {
DRAW_JIT_VERTEX_VERTEX_ID = 0,
DRAW_JIT_VERTEX_CLIP_POS,
@@ -256,7 +241,7 @@ struct draw_gs_llvm_variant_key
unsigned num_outputs:8;
/* note padding here - must use memset */
unsigned clamp_vertex_color:1;
- struct draw_sampler_static_state samplers[1];
+ struct lp_sampler_static_state samplers[1];
/* Followed by variable number of images.*/
};
@@ -265,7 +250,7 @@ struct draw_tcs_llvm_variant_key
unsigned nr_samplers:8;
unsigned nr_sampler_views:8;
unsigned nr_images:8;
- struct draw_sampler_static_state samplers[1];
+ struct lp_sampler_static_state samplers[1];
/* Followed by variable number of images.*/
};
@@ -277,30 +262,30 @@ struct draw_tes_llvm_variant_key
unsigned primid_output:7;
unsigned primid_needed:1;
unsigned clamp_vertex_color:1;
- struct draw_sampler_static_state samplers[1];
+ struct lp_sampler_static_state samplers[1];
/* Followed by variable number of images.*/
};
#define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(struct draw_llvm_variant_key) + \
- PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state) + \
- PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
+ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state) + \
+ PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
(PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))
#define DRAW_GS_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(struct draw_gs_llvm_variant_key) + \
- PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
- PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
+ PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
+ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state))
#define DRAW_TCS_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(struct draw_tcs_llvm_variant_key) + \
- PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
- PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
+ PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
+ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state))
#define DRAW_TES_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(struct draw_tes_llvm_variant_key) + \
- PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
- PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
+ PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
+ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state))
static inline size_t
@@ -312,8 +297,8 @@ draw_llvm_variant_key_size(unsigned nr_vertex_elements,
return (sizeof(struct draw_llvm_variant_key) +
(nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element) +
MAX2(nr_samplers, nr_sampler_views) *
- sizeof(struct draw_sampler_static_state) +
- nr_images * sizeof(struct draw_image_static_state));
+ sizeof(struct lp_sampler_static_state) +
+ nr_images * sizeof(struct lp_image_static_state));
}
@@ -324,8 +309,8 @@ draw_gs_llvm_variant_key_size(unsigned nr_samplers,
{
return (sizeof(struct draw_gs_llvm_variant_key) +
(MAX2(nr_samplers, nr_sampler_views) - 1) *
- sizeof(struct draw_sampler_static_state) +
- nr_images * sizeof(struct draw_sampler_static_state));
+ sizeof(struct lp_sampler_static_state) +
+ nr_images * sizeof(struct lp_sampler_static_state));
}
static inline size_t
@@ -335,8 +320,8 @@ draw_tcs_llvm_variant_key_size(unsigned nr_samplers,
{
return (sizeof(struct draw_tcs_llvm_variant_key) +
(MAX2(nr_samplers, nr_sampler_views) - 1) *
- sizeof(struct draw_sampler_static_state) +
- nr_images * sizeof(struct draw_sampler_static_state));
+ sizeof(struct lp_sampler_static_state) +
+ nr_images * sizeof(struct lp_sampler_static_state));
}
static inline size_t
@@ -346,44 +331,44 @@ draw_tes_llvm_variant_key_size(unsigned nr_samplers,
{
return (sizeof(struct draw_tes_llvm_variant_key) +
(MAX2(nr_samplers, nr_sampler_views) - 1) *
- sizeof(struct draw_sampler_static_state) +
- nr_images * sizeof(struct draw_sampler_static_state));
+ sizeof(struct lp_sampler_static_state) +
+ nr_images * sizeof(struct lp_sampler_static_state));
}
-static inline struct draw_sampler_static_state *
+static inline struct lp_sampler_static_state *
draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key)
{
- return (struct draw_sampler_static_state *)
+ return (struct lp_sampler_static_state *)
&key->vertex_element[key->nr_vertex_elements];
}
-static inline struct draw_image_static_state *
+static inline struct lp_image_static_state *
draw_llvm_variant_key_images(struct draw_llvm_variant_key *key)
{
- struct draw_sampler_static_state *samplers = (struct draw_sampler_static_state *)
+ struct lp_sampler_static_state *samplers = (struct lp_sampler_static_state *)
(&key->vertex_element[key->nr_vertex_elements]);
- return (struct draw_image_static_state *)
+ return (struct lp_image_static_state *)
&samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
}
-static inline struct draw_image_static_state *
+static inline struct lp_image_static_state *
draw_gs_llvm_variant_key_images(struct draw_gs_llvm_variant_key *key)
{
- return (struct draw_image_static_state *)
+ return (struct lp_image_static_state *)
&key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
}
-static inline struct draw_image_static_state *
+static inline struct lp_image_static_state *
draw_tcs_llvm_variant_key_images(struct draw_tcs_llvm_variant_key *key)
{
- return (struct draw_image_static_state *)
+ return (struct lp_image_static_state *)
&key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
}
-static inline struct draw_image_static_state *
+static inline struct lp_image_static_state *
draw_tes_llvm_variant_key_images(struct draw_tes_llvm_variant_key *key)
{
- return (struct draw_image_static_state *)
+ return (struct lp_image_static_state *)
&key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
}
@@ -684,25 +669,6 @@ draw_tes_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
void
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);
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c
deleted file mode 100644
index 8e859ea99cf..00000000000
--- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * Texture sampling code generation
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-
-#include "pipe/p_defines.h"
-#include "pipe/p_shader_tokens.h"
-#include "gallivm/lp_bld_const.h"
-#include "gallivm/lp_bld_debug.h"
-#include "gallivm/lp_bld_type.h"
-#include "gallivm/lp_bld_sample.h"
-#include "gallivm/lp_bld_tgsi.h"
-
-
-#include "util/u_debug.h"
-#include "util/u_memory.h"
-#include "util/u_pointer.h"
-#include "util/u_string.h"
-
-#include "draw_llvm.h"
-
-
-/**
- * This provides the bridge between the sampler state store in
- * lp_jit_context and lp_jit_texture and the sampler code
- * generator. It provides the texture layout information required by
- * the texture sampler code generator in terms of the state stored in
- * lp_jit_context and lp_jit_texture in runtime.
- */
-struct draw_llvm_sampler_dynamic_state
-{
- struct lp_sampler_dynamic_state base;
-
- const struct draw_sampler_static_state *static_state;
-};
-
-
-/**
- * This is the bridge between our sampler and the TGSI translator.
- */
-struct draw_llvm_sampler_soa
-{
- struct lp_build_sampler_soa base;
-
- struct draw_llvm_sampler_dynamic_state dynamic_state;
-
- unsigned nr_samplers;
-};
-
-struct draw_llvm_image_dynamic_state
-{
- struct lp_sampler_dynamic_state base;
-
- const struct draw_image_static_state *static_state;
-};
-
-struct draw_llvm_image_soa
-{
- struct lp_build_image_soa base;
-
- struct draw_llvm_image_dynamic_state dynamic_state;
-
- unsigned nr_images;
-};
-
-/**
- * Fetch filtered values from texture.
- * The 'texel' parameter returns four vectors corresponding to R, G, B, A.
- */
-static void
-draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
- struct gallivm_state *gallivm,
- const struct lp_sampler_params *params)
-{
- struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
- unsigned texture_index = params->texture_index;
- unsigned sampler_index = params->sampler_index;
-
- assert(texture_index < PIPE_MAX_SHADER_SAMPLER_VIEWS);
- assert(sampler_index < PIPE_MAX_SAMPLERS);
-
- if (params->texture_index_offset) {
- struct lp_build_sample_array_switch switch_info;
- memset(&switch_info, 0, sizeof(switch_info));
- LLVMValueRef unit = LLVMBuildAdd(gallivm->builder, params->texture_index_offset,
- lp_build_const_int32(gallivm, texture_index), "");
- lp_build_sample_array_init_soa(&switch_info, gallivm, params, unit,
- 0, sampler->nr_samplers);
-
- for (unsigned i = 0; i < sampler->nr_samplers; i++) {
- lp_build_sample_array_case_soa(&switch_info, i,
- &sampler->dynamic_state.static_state[i].texture_state,
- &sampler->dynamic_state.static_state[i].sampler_state,
- &sampler->dynamic_state.base);
- }
- lp_build_sample_array_fini_soa(&switch_info);
- } else {
- lp_build_sample_soa(&sampler->dynamic_state.static_state[texture_index].texture_state,
- &sampler->dynamic_state.static_state[sampler_index].sampler_state,
- &sampler->dynamic_state.base,
- gallivm, params);
- }
-}
-
-
-/**
- * Fetch the texture size.
- */
-static void
-draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
- struct gallivm_state *gallivm,
- const struct lp_sampler_size_query_params *params)
-{
- struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
-
- assert(params->texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
-
- lp_build_size_query_soa(gallivm,
- &sampler->dynamic_state.static_state[params->texture_unit].texture_state,
- &sampler->dynamic_state.base,
- params);
-}
-
-struct lp_build_sampler_soa *
-draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state,
- unsigned nr_samplers)
-{
- struct draw_llvm_sampler_soa *sampler;
-
- sampler = CALLOC_STRUCT(draw_llvm_sampler_soa);
- if (!sampler)
- return NULL;
-
- sampler->base.emit_tex_sample = draw_llvm_sampler_soa_emit_fetch_texel;
- sampler->base.emit_size_query = draw_llvm_sampler_soa_emit_size_query;
-
- lp_build_jit_fill_sampler_dynamic_state(&sampler->dynamic_state.base);
- sampler->dynamic_state.static_state = static_state;
-
- sampler->nr_samplers = nr_samplers;
- return &sampler->base;
-}
-
-static void
-draw_llvm_image_soa_emit_op(const struct lp_build_image_soa *base,
- struct gallivm_state *gallivm,
- const struct lp_img_params *params)
-{
- struct draw_llvm_image_soa *image = (struct draw_llvm_image_soa *)base;
- unsigned image_index = params->image_index;
- assert(image_index < PIPE_MAX_SHADER_IMAGES);
-
- if (params->image_index_offset) {
- struct lp_build_img_op_array_switch switch_info;
- memset(&switch_info, 0, sizeof(switch_info));
- LLVMValueRef unit = LLVMBuildAdd(gallivm->builder, params->image_index_offset,
- lp_build_const_int32(gallivm, image_index), "");
- lp_build_image_op_switch_soa(&switch_info, gallivm, params,
- unit, 0, image->nr_images);
-
- for (unsigned i = 0; i < image->nr_images; i++) {
- lp_build_image_op_array_case(&switch_info, i,
- &image->dynamic_state.static_state[i].image_state,
- &image->dynamic_state.base);
- }
- lp_build_image_op_array_fini_soa(&switch_info);
- return;
- }
- lp_build_img_op_soa(&image->dynamic_state.static_state[image_index].image_state,
- &image->dynamic_state.base,
- gallivm, params, params->outdata);
-}
-/**
- * Fetch the texture size.
- */
-static void
-draw_llvm_image_soa_emit_size_query(const struct lp_build_image_soa *base,
- struct gallivm_state *gallivm,
- const struct lp_sampler_size_query_params *params)
-{
- struct draw_llvm_image_soa *image = (struct draw_llvm_image_soa *)base;
-
- assert(params->texture_unit < PIPE_MAX_SHADER_IMAGES);
-
- lp_build_size_query_soa(gallivm,
- &image->dynamic_state.static_state[params->texture_unit].image_state,
- &image->dynamic_state.base,
- params);
-}
-
-struct lp_build_image_soa *
-draw_llvm_image_soa_create(const struct draw_image_static_state *static_state,
- unsigned nr_images)
-{
- struct draw_llvm_image_soa *image;
-
- image = CALLOC_STRUCT(draw_llvm_image_soa);
- if (!image)
- return NULL;
-
- image->base.emit_op = draw_llvm_image_soa_emit_op;
- image->base.emit_size_query = draw_llvm_image_soa_emit_size_query;
-
- lp_build_jit_fill_image_dynamic_state(&image->dynamic_state.base);
-
- image->dynamic_state.static_state = static_state;
-
- image->nr_images = nr_images;
- return &image->base;
-}
diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build
index d2421af925c..1ee7f1e4671 100644
--- a/src/gallium/auxiliary/meson.build
+++ b/src/gallium/auxiliary/meson.build
@@ -381,7 +381,6 @@ if draw_with_llvm
'gallivm/lp_bld_type.h',
'draw/draw_llvm.c',
'draw/draw_llvm.h',
- 'draw/draw_llvm_sample.c',
'draw/draw_pt_fetch_shade_pipeline_llvm.c',
'draw/draw_vs_llvm.c',
'tessellator/tessellator.cpp',