[Mesa-dev] [PATCH 24/24] st/mesa: unify fail paths for update_single_texture

Nicolai Hähnle nhaehnle at gmail.com
Wed Jun 14 07:32:35 UTC 2017


I've sent a comment on patch #12, but it's your call. Either way, 11-24 are

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


On 12.06.2017 20:18, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>   src/mesa/state_tracker/st_atom_texture.c | 5 ++---
>   src/mesa/state_tracker/st_sampler_view.c | 4 ----
>   2 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
> index 9d2564f..e38bd51 100644
> --- a/src/mesa/state_tracker/st_atom_texture.c
> +++ b/src/mesa/state_tracker/st_atom_texture.c
> @@ -54,36 +54,35 @@
>   
>   static void
>   update_single_texture(struct st_context *st,
>                         struct pipe_sampler_view **sampler_view,
>   		      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);
>   
>      texObj = ctx->Texture.Unit[texUnit]._Current;
>      assert(texObj);
>   
>      stObj = st_texture_object(texObj);
>   
>      if (unlikely(texObj->Target == GL_TEXTURE_BUFFER)) {
>         *sampler_view = st_get_buffer_sampler_view_from_stobj(st, stObj);
>         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;
>      }
>   
>      /* Check a few pieces of state outside the texture object to see if we
>       * need to force revalidation.
>       */
>      if (stObj->prev_glsl130_or_later != glsl130_or_later ||
>          stObj->prev_sRGBDecode != samp->sRGBDecode) {
> diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
> index 7a8d05d..fbf0aae 100644
> --- a/src/mesa/state_tracker/st_sampler_view.c
> +++ b/src/mesa/state_tracker/st_sampler_view.c
> @@ -401,24 +401,20 @@ st_create_texture_sampler_view_from_stobj(struct st_context *st,
>   
>   
>   struct pipe_sampler_view *
>   st_get_texture_sampler_view_from_stobj(struct st_context *st,
>                                          struct st_texture_object *stObj,
>                                          const struct gl_sampler_object *samp,
>                                          bool glsl130_or_later)
>   {
>      struct pipe_sampler_view **sv;
>   
> -   if (!stObj || !stObj->pt) {
> -      return NULL;
> -   }
> -
>      sv = st_texture_get_sampler_view(st, stObj);
>   
>      if (*sv) {
>         /* Debug check: make sure that the sampler view's parameters are
>          * what they're supposed to be.
>          */
>         MAYBE_UNUSED struct pipe_sampler_view *view = *sv;
>         assert(stObj->pt == view->texture);
>         assert(!check_sampler_swizzle(st, stObj, view, glsl130_or_later));
>         assert(get_sampler_view_format(st, stObj, samp) == view->format);
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list