Module: Mesa
Branch: main
Commit: 1c172cdbccd6aeae6a0660514b8fef5e550f1ca4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c172cdbccd6aeae6a0660514b8fef5e550f1ca4

Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Jul 21 09:55:44 2022 -0400

mesa/st: plumb glsl130_or_later through sampler creation

no functional changes

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17687>

---

 src/mesa/main/texturebindless.c          |  2 +-
 src/mesa/state_tracker/st_atom_sampler.c | 11 +++++++----
 src/mesa/state_tracker/st_texture.c      |  3 ++-
 src/mesa/state_tracker/st_texture.h      |  6 ++++--
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c
index 8cc2b35f232..38ff0af9d0b 100644
--- a/src/mesa/main/texturebindless.c
+++ b/src/mesa/main/texturebindless.c
@@ -233,7 +233,7 @@ new_texture_handle(struct gl_context *ctx, struct 
gl_texture_object *texObj,
       if (!st_finalize_texture(ctx, pipe, texObj, 0))
          return 0;
 
-      st_convert_sampler(st, texObj, sampObj, 0, &sampler, false, false);
+      st_convert_sampler(st, texObj, sampObj, 0, &sampler, false, false, true);
 
       /* TODO: Clarify the interaction of ARB_bindless_texture and 
EXT_texture_sRGB_decode */
       view = st_get_texture_sampler_view_from_stobj(st, texObj, sampObj, 0,
diff --git a/src/mesa/state_tracker/st_atom_sampler.c 
b/src/mesa/state_tracker/st_atom_sampler.c
index ad8d2730fcc..97c370c5d51 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -62,7 +62,8 @@ st_convert_sampler(const struct st_context *st,
                    float tex_unit_lod_bias,
                    struct pipe_sampler_state *sampler,
                    bool seamless_cube_map,
-                   bool ignore_srgb_decode)
+                   bool ignore_srgb_decode,
+                   bool glsl130_or_later)
 {
    memcpy(sampler, &msamp->Attrib.state, sizeof(*sampler));
 
@@ -152,7 +153,8 @@ st_convert_sampler(const struct st_context *st,
 void
 st_convert_sampler_from_unit(const struct st_context *st,
                              struct pipe_sampler_state *sampler,
-                             GLuint texUnit)
+                             GLuint texUnit,
+                             bool glsl130_or_later)
 {
    const struct gl_texture_object *texobj;
    struct gl_context *ctx = st->ctx;
@@ -164,7 +166,7 @@ st_convert_sampler_from_unit(const struct st_context *st,
    msamp = _mesa_get_samplerobj(ctx, texUnit);
 
    st_convert_sampler(st, texobj, msamp, 
ctx->Texture.Unit[texUnit].LodBiasQuantized,
-                      sampler, ctx->Texture.CubeMapSeamless, true);
+                      sampler, ctx->Texture.CubeMapSeamless, true, 
glsl130_or_later);
 }
 
 
@@ -209,7 +211,8 @@ update_shader_samplers(struct st_context *st,
       if (samplers_used & 1 &&
           (ctx->Texture.Unit[tex_unit]._Current->Target != GL_TEXTURE_BUFFER ||
            st->texture_buffer_sampler)) {
-         st_convert_sampler_from_unit(st, sampler, tex_unit);
+         st_convert_sampler_from_unit(st, sampler, tex_unit,
+                                      prog->sh.data && prog->sh.data->Version 
>= 130);
          states[unit] = sampler;
       } else {
          states[unit] = NULL;
diff --git a/src/mesa/state_tracker/st_texture.c 
b/src/mesa/state_tracker/st_texture.c
index 07ccac68800..dc96f6cc41f 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -523,7 +523,8 @@ st_create_texture_handle_from_unit(struct st_context *st,
       return 0;
 
    if (view->target != PIPE_BUFFER)
-      st_convert_sampler_from_unit(st, &sampler, texUnit);
+      st_convert_sampler_from_unit(st, &sampler, texUnit,
+                                   prog->sh.data && prog->sh.data->Version >= 
130);
 
    assert(st->ctx->Texture.Unit[texUnit]._Current);
 
diff --git a/src/mesa/state_tracker/st_texture.h 
b/src/mesa/state_tracker/st_texture.h
index efdfbcea909..10ac6fb892f 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -240,12 +240,14 @@ st_convert_sampler(const struct st_context *st,
                    float tex_unit_lod_bias,
                    struct pipe_sampler_state *sampler,
                    bool seamless_cube_map,
-                   bool ignore_srgb_decode);
+                   bool ignore_srgb_decode,
+                   bool glsl130_or_later);
 
 void
 st_convert_sampler_from_unit(const struct st_context *st,
                              struct pipe_sampler_state *sampler,
-                             GLuint texUnit);
+                             GLuint texUnit,
+                             bool glsl130_or_later);
 
 struct pipe_sampler_view *
 st_update_single_texture(struct st_context *st,

Reply via email to