[Mesa-dev] [PATCH 2/2] st/mesa: fix assertion failure in st_get_texture_sampler_view_from_stobj

Marek Olšák maraeo at gmail.com
Fri Jul 28 00:27:41 UTC 2017


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

Remove the assertion and replace it with a runtime check.
The reason of the failure is unknown.

Only Eric Anholt can reproduce it with Glamor.

Cc: 17.2 <mesa-stable at lists.freedesktop.org>
---
 src/mesa/state_tracker/st_sampler_view.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
index fbf0aae..bc63564 100644
--- a/src/mesa/state_tracker/st_sampler_view.c
+++ b/src/mesa/state_tracker/st_sampler_view.c
@@ -403,42 +403,42 @@ 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;
 
    sv = st_texture_get_sampler_view(st, stObj);
 
-   if (*sv) {
+   if (*sv && stObj->pt == view->texture) {
       /* 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);
       assert(gl_target_to_pipe(stObj->base.Target) == view->target);
       assert(stObj->base.MinLevel + stObj->base.BaseLevel ==
              view->u.tex.first_level);
       assert(last_level(stObj) == view->u.tex.last_level);
       assert(stObj->layer_override || stObj->base.MinLayer == view->u.tex.first_layer);
       assert(stObj->layer_override || last_layer(stObj) == view->u.tex.last_layer);
       assert(!stObj->layer_override ||
              (stObj->layer_override == view->u.tex.first_layer &&
               stObj->layer_override == view->u.tex.last_layer));
    }
    else {
       /* create new sampler view */
       enum pipe_format format = get_sampler_view_format(st, stObj, samp);
 
+      pipe_sampler_view_reference(sv, NULL);
       *sv = st_create_texture_sampler_view_from_stobj(st, stObj,
                                                       format, glsl130_or_later);
 
    }
 
    return *sv;
 }
 
 
 struct pipe_sampler_view *
-- 
2.7.4



More information about the mesa-dev mailing list