[Mesa-dev] [PATCH 08/23] mesa/st: factor out st_AllocTextureStorage into a helper

Timothy Arceri tarceri at itsqueeze.com
Fri Aug 4 01:54:11 UTC 2017


From: Andres Rodriguez <andresx7 at gmail.com>

Plumbing for using memory objects as texture storage.

Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
 src/mesa/state_tracker/st_cb_texture.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index db2913ed9e..ab0bc208c2 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2640,32 +2640,30 @@ st_finalize_texture(struct gl_context *ctx,
       }
    }
 
    stObj->validated_first_level = stObj->base.BaseLevel;
    stObj->validated_last_level = stObj->lastLevel;
    stObj->needs_validation = false;
 
    return GL_TRUE;
 }
 
-
 /**
- * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory
- * for a whole mipmap stack.
+ * Allocate texture memory for a whole mipmap stack.
  * Note: for multisample textures if the requested sample count is not
  * supported, we search for the next higher supported sample count.
  */
 static GLboolean
-st_AllocTextureStorage(struct gl_context *ctx,
-                       struct gl_texture_object *texObj,
-                       GLsizei levels, GLsizei width,
-                       GLsizei height, GLsizei depth)
+st_texture_storage(struct gl_context *ctx,
+                   struct gl_texture_object *texObj,
+                   GLsizei levels, GLsizei width,
+                   GLsizei height, GLsizei depth)
 {
    const GLuint numFaces = _mesa_num_tex_faces(texObj->Target);
    struct gl_texture_image *texImage = texObj->Image[0][0];
    struct st_context *st = st_context(ctx);
    struct st_texture_object *stObj = st_texture_object(texObj);
    struct pipe_screen *screen = st->pipe->screen;
    unsigned ptWidth, bindings;
    uint16_t ptHeight, ptDepth, ptLayers;
    enum pipe_format fmt;
    GLint level;
@@ -2729,20 +2727,34 @@ st_AllocTextureStorage(struct gl_context *ctx,
    }
 
    /* The texture is in a validated state, so no need to check later. */
    stObj->needs_validation = false;
    stObj->validated_first_level = 0;
    stObj->validated_last_level = levels - 1;
 
    return GL_TRUE;
 }
 
+/**
+ * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory
+ * for a whole mipmap stack.
+ */
+static GLboolean
+st_AllocTextureStorage(struct gl_context *ctx,
+                       struct gl_texture_object *texObj,
+                       GLsizei levels, GLsizei width,
+                       GLsizei height, GLsizei depth)
+{
+   return st_texture_storage(ctx, texObj, levels,
+                             width, height, depth);
+}
+
 
 static GLboolean
 st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
                      GLuint numLevels, GLint level,
                      mesa_format format, GLuint numSamples,
                      GLint width, GLint height, GLint depth)
 {
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
 
-- 
2.13.3



More information about the mesa-dev mailing list