llvmpipe: pass number of samplers into llvm sampler code.
authorDave Airlie <airlied@redhat.com>
Tue, 19 May 2020 01:51:13 +0000 (11:51 +1000)
committerMarge Bot <eric+marge@anholt.net>
Thu, 2 Jul 2020 04:12:16 +0000 (04:12 +0000)
This is to be used later for indirect texture access

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3778>

src/gallium/drivers/llvmpipe/lp_state_cs.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_tex_sample.c
src/gallium/drivers/llvmpipe/lp_tex_sample.h

index 31d42e3ad6d7ae3efc6dc366dbcb86056615cc79..a3daf6a503bd620ad22b2d18f1073e66be469d08 100644 (file)
@@ -174,7 +174,7 @@ generate_compute(struct llvmpipe_context *lp,
    builder = gallivm->builder;
    assert(builder);
    LLVMPositionBuilderAtEnd(builder, block);
    builder = gallivm->builder;
    assert(builder);
    LLVMPositionBuilderAtEnd(builder, block);
-   sampler = lp_llvm_sampler_soa_create(key->samplers);
+   sampler = lp_llvm_sampler_soa_create(key->samplers, key->nr_samplers);
    image = lp_llvm_image_soa_create(lp_cs_variant_key_images(key));
 
    struct lp_build_loop_state loop_state[4];
    image = lp_llvm_image_soa_create(lp_cs_variant_key_images(key));
 
    struct lp_build_loop_state loop_state[4];
index 6e48b34622fea13a50b03219ff96deb7df724cd1..1d57f2553d24c49df93f9ac2947fece784828e5e 100644 (file)
@@ -2916,7 +2916,7 @@ generate_fragment(struct llvmpipe_context *lp,
    }
 
    /* code generated texture sampling */
    }
 
    /* code generated texture sampling */
-   sampler = lp_llvm_sampler_soa_create(key->samplers);
+   sampler = lp_llvm_sampler_soa_create(key->samplers, key->nr_samplers);
    image = lp_llvm_image_soa_create(lp_fs_variant_key_images(key));
 
    num_fs = 16 / fs_type.length; /* number of loops per 4x4 stamp */
    image = lp_llvm_image_soa_create(lp_fs_variant_key_images(key));
 
    num_fs = 16 / fs_type.length; /* number of loops per 4x4 stamp */
index e0285c70e5b8d730f9d1843ad702211aab702380..d0e6d99082cd22d0d595fdbc324b8bf4701babeb 100644 (file)
@@ -76,6 +76,7 @@ struct lp_llvm_sampler_soa
    struct lp_build_sampler_soa base;
 
    struct llvmpipe_sampler_dynamic_state dynamic_state;
    struct lp_build_sampler_soa base;
 
    struct llvmpipe_sampler_dynamic_state dynamic_state;
+   unsigned nr_samplers;
 };
 
 struct llvmpipe_image_dynamic_state
 };
 
 struct llvmpipe_image_dynamic_state
@@ -385,7 +386,8 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
 
 
 struct lp_build_sampler_soa *
 
 
 struct lp_build_sampler_soa *
-lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state)
+lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
+                           unsigned nr_samplers)
 {
    struct lp_llvm_sampler_soa *sampler;
 
 {
    struct lp_llvm_sampler_soa *sampler;
 
@@ -418,6 +420,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state)
 
    sampler->dynamic_state.static_state = static_state;
 
 
    sampler->dynamic_state.static_state = static_state;
 
+   sampler->nr_samplers = nr_samplers;
    return &sampler->base;
 }
 
    return &sampler->base;
 }
 
index ce60f21792ef895eab9277f010c68ae463288d55..5deff6314996310ac38768b4b90f9d9162589e80 100644 (file)
@@ -45,7 +45,8 @@ struct lp_image_static_state;
  *
  */
 struct lp_build_sampler_soa *
  *
  */
 struct lp_build_sampler_soa *
-lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *key);
+lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *key,
+                           unsigned nr_samplers);
 
 struct lp_build_image_soa *
 lp_llvm_image_soa_create(const struct lp_image_static_state *key);
 
 struct lp_build_image_soa *
 lp_llvm_image_soa_create(const struct lp_image_static_state *key);