[Mesa-dev] [PATCH 2/2] st/mesa: remove unused st_texture_object width0/height0/depth0

Nicolai Hähnle nhaehnle at gmail.com
Tue Jun 7 21:19:48 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

These are no longer needed since the last commit.
---
 src/mesa/state_tracker/st_cb_eglimage.c |  3 --
 src/mesa/state_tracker/st_cb_texture.c  | 60 +++++++++++----------------------
 src/mesa/state_tracker/st_manager.c     |  3 --
 src/mesa/state_tracker/st_texture.h     |  6 ----
 src/mesa/state_tracker/st_vdpau.c       |  3 --
 5 files changed, 19 insertions(+), 56 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index 8531afb..1782d15 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -128,9 +128,6 @@ st_bind_surface(struct gl_context *ctx, GLenum target,
    st_texture_release_all_sampler_views(st, stObj);
    pipe_resource_reference(&stImage->pt, stObj->pt);
 
-   stObj->width0 = ps->width;
-   stObj->height0 = ps->height;
-   stObj->depth0 = 1;
    stObj->surface_format = ps->format;
 
    _mesa_dirty_texobj(ctx, texObj);
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 1604993..43bd68a 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -492,8 +492,6 @@ guess_and_alloc_texture(struct st_context *st,
                                           &width, &height, &depth);
 
    if (!guessed_box) {
-      /* we can't determine the image size at level=0 */
-      stObj->width0 = stObj->height0 = stObj->depth0 = 0;
       /* this is not an out of memory error */
       return GL_TRUE;
    }
@@ -518,11 +516,6 @@ guess_and_alloc_texture(struct st_context *st,
       lastLevel = 0;
    }
 
-   /* Save the level=0 dimensions */
-   stObj->width0 = width;
-   stObj->height0 = height;
-   stObj->depth0 = depth;
-
    fmt = st_mesa_format_to_pipe_format(st, stImage->base.TexFormat);
 
    bindings = default_bindings(st, fmt);
@@ -2412,6 +2405,7 @@ st_finalize_texture(struct gl_context *ctx,
    GLuint face;
    const struct st_texture_image *firstImage;
    enum pipe_format firstImageFormat;
+   GLuint glWidth, glHeight, glDepth;
    GLuint ptWidth, ptHeight, ptDepth, ptLayers, ptNumSamples;
 
    if (tObj->Immutable)
@@ -2443,9 +2437,6 @@ st_finalize_texture(struct gl_context *ctx,
       if (st_obj->buffer != stObj->pt) {
          pipe_resource_reference(&stObj->pt, st_obj->buffer);
          st_texture_release_all_sampler_views(st, stObj);
-         stObj->width0 = stObj->pt->width0 / _mesa_get_format_bytes(tObj->_BufferObjectFormat);
-         stObj->height0 = 1;
-         stObj->depth0 = 1;
       }
       return GL_TRUE;
 
@@ -2476,28 +2467,21 @@ st_finalize_texture(struct gl_context *ctx,
       st_mesa_format_to_pipe_format(st, firstImage->base.TexFormat);
 
    /* Find size of level=0 Gallium mipmap image, plus number of texture layers */
-   {
-      GLuint width, height, depth;
-
-      width = firstImage->base.Width2;
-      if (width > 1)
-         width <<= firstImage->base.Level;
-      height = firstImage->base.Height2;
-      if (stObj->base.Target != GL_TEXTURE_1D_ARRAY && height > 1)
-         height <<= firstImage->base.Level;
-      depth = firstImage->base.Depth2;
-      if (stObj->base.Target == GL_TEXTURE_3D && depth > 1)
-         depth <<= firstImage->base.Level;
-
-      stObj->width0 = width;
-      stObj->height0 = height;
-      stObj->depth0 = depth;
-
-      /* convert GL dims to Gallium dims */
-      st_gl_texture_dims_to_pipe_dims(stObj->base.Target, width, height, depth,
-                                      &ptWidth, &ptHeight, &ptDepth, &ptLayers);
-      ptNumSamples = firstImage->base.NumSamples;
-   }
+   glWidth = firstImage->base.Width2;
+   if (glWidth > 1)
+      glWidth <<= firstImage->base.Level;
+   glHeight = firstImage->base.Height2;
+   if (stObj->base.Target != GL_TEXTURE_1D_ARRAY && glHeight > 1)
+      glHeight <<= firstImage->base.Level;
+   glDepth = firstImage->base.Depth2;
+   if (stObj->base.Target == GL_TEXTURE_3D && glDepth > 1)
+      glDepth <<= firstImage->base.Level;
+
+   /* convert GL dims to Gallium dims */
+   st_gl_texture_dims_to_pipe_dims(stObj->base.Target,
+                                   glWidth, glHeight, glDepth,
+                                   &ptWidth, &ptHeight, &ptDepth, &ptLayers);
+   ptNumSamples = firstImage->base.NumSamples;
 
    /* If we already have a gallium texture, check that it matches the texture
     * object's format, target, size, num_levels, etc.
@@ -2553,8 +2537,8 @@ st_finalize_texture(struct gl_context *ctx,
          /* Need to import images in main memory or held in other textures.
           */
          if (stImage && stObj->pt != stImage->pt) {
-            GLuint height = stObj->height0;
-            GLuint depth = stObj->depth0;
+            GLuint height = glHeight;
+            GLuint depth = glDepth;
 
             if (stObj->base.Target != GL_TEXTURE_1D_ARRAY)
                height = u_minify(height, level);
@@ -2562,7 +2546,7 @@ st_finalize_texture(struct gl_context *ctx,
                depth = u_minify(depth, level);
 
             if (level == 0 ||
-                (stImage->base.Width == u_minify(stObj->width0, level) &&
+                (stImage->base.Width == u_minify(glWidth, level) &&
                  stImage->base.Height == height &&
                  stImage->base.Depth == depth)) {
                /* src image fits expected dest mipmap level size */
@@ -2599,9 +2583,6 @@ st_AllocTextureStorage(struct gl_context *ctx,
    assert(levels > 0);
 
    /* Save the level=0 dimensions */
-   stObj->width0 = width;
-   stObj->height0 = height;
-   stObj->depth0 = depth;
    stObj->lastLevel = levels - 1;
 
    fmt = st_mesa_format_to_pipe_format(st, texImage->TexFormat);
@@ -2739,9 +2720,6 @@ st_TextureView(struct gl_context *ctx,
    tex->surface_format =
       st_mesa_format_to_pipe_format(st_context(ctx), image->TexFormat);
 
-   tex->width0 = image->Width;
-   tex->height0 = image->Height;
-   tex->depth0 = image->Depth;
    tex->lastLevel = numLevels - 1;
 
    return GL_TRUE;
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index a983d64..33f56ea 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -587,9 +587,6 @@ st_context_teximage(struct st_context_iface *stctxi,
    }
 
    pipe_resource_reference(&stImage->pt, tex);
-   stObj->width0 = width;
-   stObj->height0 = height;
-   stObj->depth0 = depth;
    stObj->surface_format = pipe_format;
 
    _mesa_dirty_texobj(ctx, texObj);
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index d8cd7c7..ae9e2b4 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -79,12 +79,6 @@ struct st_texture_object
     */
    GLuint lastLevel;
 
-   /** The size of the level=0 mipmap image.
-    * Note that the number of 1D array layers will be in height0 and the
-    * number of 2D array layers will be in depth0, as in GL.
-    */
-   GLuint width0, height0, depth0;
-
    /* On validation any active images held in main memory or in other
     * textures will be copied to this texture and the old storage freed.
     */
diff --git a/src/mesa/state_tracker/st_vdpau.c b/src/mesa/state_tracker/st_vdpau.c
index 08f2553..dffa52f 100644
--- a/src/mesa/state_tracker/st_vdpau.c
+++ b/src/mesa/state_tracker/st_vdpau.c
@@ -238,9 +238,6 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
    sampler_view = st_texture_get_sampler_view(st, stObj);
    *sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ);
 
-   stObj->width0 = res->width0;
-   stObj->height0 = res->height0;
-   stObj->depth0 = 1;
    stObj->surface_format = res->format;
 
    _mesa_dirty_texobj(ctx, texObj);
-- 
2.7.4



More information about the mesa-dev mailing list