[Mesa-dev] [PATCH 18/24] st/mesa: don't return an error from update_single_texture

Marek Olšák maraeo at gmail.com
Mon Jun 12 18:18:49 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

It can just return a NULL sampler view, which is better than not doing
anything at all.
---
 src/mesa/state_tracker/st_atom_texture.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 9c0cb24..ddde445 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -45,63 +45,63 @@
 #include "st_sampler_view.h"
 #include "st_texture.h"
 #include "st_format.h"
 #include "st_cb_texture.h"
 #include "pipe/p_context.h"
 #include "util/u_format.h"
 #include "util/u_inlines.h"
 #include "cso_cache/cso_context.h"
 
 
-static GLboolean
+static void
 update_single_texture(struct st_context *st,
                       struct pipe_sampler_view **sampler_view,
 		      GLuint texUnit, unsigned glsl_version)
 {
    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);
 
    texObj = ctx->Texture.Unit[texUnit]._Current;
    assert(texObj);
 
    stObj = st_texture_object(texObj);
 
    retval = st_finalize_texture(ctx, st->pipe, texObj, 0);
    if (!retval) {
       /* out of mem */
-      return GL_FALSE;
+      *sampler_view = NULL;
+      return;
    }
 
    /* 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 ||
        stObj->prev_sRGBDecode != samp->sRGBDecode) {
 
       st_texture_release_all_sampler_views(st, stObj);
 
       stObj->prev_glsl_version = glsl_version;
       stObj->prev_sRGBDecode = samp->sRGBDecode;
    }
 
    if (texObj->TargetIndex == TEXTURE_EXTERNAL_INDEX &&
        stObj->pt->screen->resource_changed)
          stObj->pt->screen->resource_changed(stObj->pt->screen, stObj->pt);
 
    *sampler_view =
       st_get_texture_sampler_view_from_stobj(st, stObj, samp, glsl_version);
-   return GL_TRUE;
 }
 
 
 
 static void
 update_textures(struct st_context *st,
                 enum pipe_shader_type shader_stage,
                 const struct gl_program *prog,
                 struct pipe_sampler_view **sampler_views,
                 unsigned *out_num_textures)
@@ -119,27 +119,22 @@ update_textures(struct st_context *st,
 
    /* 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];
-         GLboolean retval;
-
-         retval = update_single_texture(st, &sampler_view, texUnit,
-                                        glsl_version);
-         if (retval == GL_FALSE)
-            continue;
 
+         update_single_texture(st, &sampler_view, texUnit, glsl_version);
          num_textures = unit + 1;
       }
 
       pipe_sampler_view_reference(&(sampler_views[unit]), sampler_view);
    }
 
    /* For any external samplers with multiplaner YUV, stuff the additional
     * sampler views we need at the end.
     *
     * Trying to cache the sampler view in the stObj looks painful, so just
-- 
2.7.4



More information about the mesa-dev mailing list