Mesa (master): st/mesa: remove st_texture_object::pipe field

Brian Paul brianp at kemper.freedesktop.org
Mon Apr 19 00:03:08 UTC 2010


Module: Mesa
Branch: master
Commit: 5d3d63d45a037fdf603ddcff88da635c3ce8075e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d3d63d45a037fdf603ddcff88da635c3ce8075e

Author: Brian Paul <brianp at vmware.com>
Date:   Sun Apr 18 17:55:23 2010 -0600

st/mesa: remove st_texture_object::pipe field

Just pass the pipe context to st_get_texture_sampler_view()
as is done for st_get_renderbuffer_sampler_view().

---

 src/mesa/state_tracker/st_atom_texture.c |    3 ++-
 src/mesa/state_tracker/st_cb_blit.c      |    2 +-
 src/mesa/state_tracker/st_cb_eglimage.c  |    1 -
 src/mesa/state_tracker/st_cb_fbo.c       |    5 ++++-
 src/mesa/state_tracker/st_cb_texture.c   |    5 ++---
 src/mesa/state_tracker/st_gen_mipmap.c   |    2 +-
 src/mesa/state_tracker/st_manager.c      |    1 -
 src/mesa/state_tracker/st_texture.h      |   10 +++++-----
 8 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index e056487..f4294ac 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -46,6 +46,7 @@
 static void 
 update_textures(struct st_context *st)
 {
+   struct pipe_context *pipe = st->pipe;
    struct gl_vertex_program *vprog = st->ctx->VertexProgram._Current;
    struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
    const GLbitfield samplersUsed = (vprog->Base.SamplersUsed |
@@ -84,7 +85,7 @@ update_textures(struct st_context *st)
 
          st->state.num_textures = su + 1;
 
-         sampler_view = st_get_texture_sampler_view(stObj);
+         sampler_view = st_get_texture_sampler_view(stObj, pipe);
       }
 
       /*
diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c
index 5456fb8..d6fdfac 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -133,7 +133,7 @@ st_BlitFramebuffer(GLcontext *ctx,
             return;
 
          util_blit_pixels(st->blit,
-                          srcSurf, st_get_texture_sampler_view(srcObj),
+                          srcSurf, st_get_texture_sampler_view(srcObj, pipe),
                           srcX0, srcY0, srcX1, srcY1,
                           dstSurf, dstX0, dstY0, dstX1, dstY1,
                           0.0, pFilter);
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index 3c4fe32..a924f87 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -126,7 +126,6 @@ st_bind_surface(GLcontext *ctx, GLenum target,
    texImage->TexFormat = st_pipe_format_to_mesa_format(ps->format);
    _mesa_set_fetch_functions(texImage, 2);
 
-   stObj->pipe = ctx->st->pipe;
    /* FIXME create a non-default sampler view from the pipe_surface? */
    pipe_resource_reference(&stImage->pt, ps->texture);
 
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 67b9322..e13bc19 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -310,6 +310,8 @@ st_render_texture(GLcontext *ctx,
                   struct gl_framebuffer *fb,
                   struct gl_renderbuffer_attachment *att)
 {
+   struct st_context *st = ctx->st;
+   struct pipe_context *pipe = st->pipe;
    struct pipe_screen *screen = ctx->st->pipe->screen;
    struct st_renderbuffer *strb;
    struct gl_renderbuffer *rb;
@@ -360,7 +362,8 @@ st_render_texture(GLcontext *ctx,
 
    pipe_surface_reference(&strb->surface, NULL);
 
-   pipe_sampler_view_reference(&strb->sampler_view, st_get_texture_sampler_view(stObj));
+   pipe_sampler_view_reference(&strb->sampler_view,
+                               st_get_texture_sampler_view(stObj, pipe));
 
    assert(strb->rtt_level <= strb->texture->last_level);
 
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 245489c..89f1028 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -322,8 +322,6 @@ guess_and_alloc_texture(struct st_context *st,
                                  depth,
                                  usage);
 
-   stObj->pipe = st->pipe;
-
    DBG("%s - success\n", __FUNCTION__);
 }
 
@@ -838,7 +836,8 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
    struct pipe_screen *screen = pipe->screen;
    struct st_texture_image *stImage = st_texture_image(texImage);
    struct st_texture_object *stObj = st_texture_object(texObj);
-   struct pipe_sampler_view *src_view = st_get_texture_sampler_view(stObj);
+   struct pipe_sampler_view *src_view =
+      st_get_texture_sampler_view(stObj, pipe);
    const GLuint width = texImage->Width;
    const GLuint height = texImage->Height;
    struct pipe_surface *dst_surface;
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 177a798..f25b5bf 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -84,7 +84,7 @@ st_render_mipmap(struct st_context *st,
 {
    struct pipe_context *pipe = st->pipe;
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_sampler_view *psv = st_get_texture_sampler_view(stObj);
+   struct pipe_sampler_view *psv = st_get_texture_sampler_view(stObj, pipe);
    const uint face = _mesa_tex_target_to_face(target);
 
    assert(target != GL_TEXTURE_3D); /* not done yet */
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 26f9554..5cf17fe 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -556,7 +556,6 @@ st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type target
       _mesa_clear_texture_image(ctx, texImage);
    }
 
-   stObj->pipe = st->pipe;
    pipe_resource_reference(&stImage->pt, tex);
 
    _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index 9fcf868..d1a430b 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -34,7 +34,7 @@
 
 #include "main/mtypes.h"
 
-struct pipe_context;
+
 struct pipe_resource;
 
 
@@ -76,8 +76,6 @@ struct st_texture_object
     */
    struct pipe_sampler_view *sampler_view;
 
-   struct pipe_context *pipe;
-
    GLboolean teximage_realloc;
 
    /* True if there is/was a surface bound to this texture object.  It helps
@@ -130,14 +128,16 @@ st_create_texture_sampler_view(struct pipe_context *pipe,
 
 
 static INLINE struct pipe_sampler_view *
-st_get_texture_sampler_view(struct st_texture_object *stObj)
+st_get_texture_sampler_view(struct st_texture_object *stObj,
+                            struct pipe_context *pipe)
+
 {
    if (!stObj || !stObj->pt) {
       return NULL;
    }
 
    if (!stObj->sampler_view) {
-      stObj->sampler_view = st_create_texture_sampler_view(stObj->pipe, stObj->pt);
+      stObj->sampler_view = st_create_texture_sampler_view(pipe, stObj->pt);
    }
 
    return stObj->sampler_view;




More information about the mesa-commit mailing list