intel/isl: Add an aux state for "partial clear"
[mesa.git] / src / mesa / state_tracker / st_atom_texture.c
index b71b73506f82a07e0879f8e2d9e506d738d00da2..81bf62908f11b4fd238b3f2076eb5852db6ab4d5 100644 (file)
 void
 st_update_single_texture(struct st_context *st,
                          struct pipe_sampler_view **sampler_view,
-                         GLuint texUnit, unsigned glsl_version)
+                         GLuint texUnit, bool glsl130_or_later)
 {
    struct gl_context *ctx = st->ctx;
    const struct gl_sampler_object *samp;
    struct gl_texture_object *texObj;
    struct st_texture_object *stObj;
-   GLboolean retval;
 
    samp = _mesa_get_samplerobj(ctx, texUnit);
 
@@ -78,8 +77,8 @@ st_update_single_texture(struct st_context *st,
       return;
    }
 
-   retval = st_finalize_texture(ctx, st->pipe, texObj, 0);
-   if (!retval) {
+   if (!st_finalize_texture(ctx, st->pipe, texObj, 0) ||
+       !stObj->pt) {
       /* out of mem */
       *sampler_view = NULL;
       return;
@@ -88,12 +87,12 @@ st_update_single_texture(struct st_context *st,
    /* Check a few pieces of state outside the texture object to see if we
     * need to force revalidation.
     */
-   if (stObj->prev_glsl_version != glsl_version ||
+   if (stObj->prev_glsl130_or_later != glsl130_or_later ||
        stObj->prev_sRGBDecode != samp->sRGBDecode) {
 
       st_texture_release_all_sampler_views(st, stObj);
 
-      stObj->prev_glsl_version = glsl_version;
+      stObj->prev_glsl130_or_later = glsl130_or_later;
       stObj->prev_sRGBDecode = samp->sRGBDecode;
    }
 
@@ -102,7 +101,8 @@ st_update_single_texture(struct st_context *st,
          stObj->pt->screen->resource_changed(stObj->pt->screen, stObj->pt);
 
    *sampler_view =
-      st_get_texture_sampler_view_from_stobj(st, stObj, samp, glsl_version);
+      st_get_texture_sampler_view_from_stobj(st, stObj, samp,
+                                             glsl130_or_later);
 }
 
 
@@ -125,17 +125,18 @@ update_textures(struct st_context *st,
 
    unsigned num_textures = 0;
 
+   /* prog->sh.data is NULL if it's ARB_fragment_program */
+   bool glsl130 = (prog->sh.data ? prog->sh.data->Version : 0) >= 130;
+
    /* loop over sampler units (aka tex image units) */
    for (unit = 0; samplers_used || unit < old_max;
         unit++, samplers_used >>= 1) {
       struct pipe_sampler_view *sampler_view = NULL;
 
       if (samplers_used & 1) {
-         /* prog->sh.data is NULL if it's ARB_fragment_program */
-         unsigned glsl_version = prog->sh.data ? prog->sh.data->Version : 0;
          const GLuint texUnit = prog->SamplerUnits[unit];
 
-         st_update_single_texture(st, &sampler_view, texUnit, glsl_version);
+         st_update_single_texture(st, &sampler_view, texUnit, glsl130);
          num_textures = unit + 1;
       }