[Mesa-dev] [PATCH] st/mesa: use first image's dimensions when finalizing texture

Ilia Mirkin imirkin at alum.mit.edu
Sun Jun 5 06:24:03 UTC 2016


In the case where we can't guess the base level size, just use the first
image's dims. The width0/height0/depth0 on stObj may not have been set
at this point. Observed in a trace that set up levels 2..9 of a 2d texture,
and set the base level to 2, with height 1. This made the guess logic
always bail.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "12.0" <mesa-stable at lists.freedesktop.org>
---
 src/mesa/state_tracker/st_cb_texture.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index d38f24c..1dd1ef6 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2463,9 +2463,9 @@ st_finalize_texture(struct gl_context *ctx,
                                  firstImage->base.Depth2,
                                  firstImage->base.Level,
                                  &width, &height, &depth)) {
-         width = stObj->width0;
-         height = stObj->height0;
-         depth = stObj->depth0;
+         width = stObj->width0 = firstImage->base.Width2;
+         height = stObj->height0 = firstImage->base.Height2;
+         depth = stObj->depth0 = firstImage->base.Depth2;
       } else {
          /* The width/height/depth may have been previously reset in
           * guess_and_alloc_texture. */
-- 
2.7.3



More information about the mesa-dev mailing list