st/mesa: remove st_texture_object::pipe field
authorBrian Paul <brianp@vmware.com>
Sun, 18 Apr 2010 23:55:23 +0000 (17:55 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 19 Apr 2010 00:02:42 +0000 (18:02 -0600)
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
src/mesa/state_tracker/st_cb_blit.c
src/mesa/state_tracker/st_cb_eglimage.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/state_tracker/st_manager.c
src/mesa/state_tracker/st_texture.h

index e056487f1a6601c259639d574d91a2009f3c5561..f4294ac1e6f0d40705d9a636b62dbf3e71d801e5 100644 (file)
@@ -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);
       }
 
       /*
index 5456fb87b057597f082f6081ae65f689e9a0f046..d6fdfaccd63161f6a9098dbb4a663504ae10420d 100644 (file)
@@ -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);
index 3c4fe32090ba65738a0a6d1e7555443a6410995b..a924f8722327921c5867a6b12270cf571235cd3b 100644 (file)
@@ -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);
 
index 67b9322d4a2f1931776cc3e8fc91c5cbae8584f3..e13bc1921a007ed5c76327e164ed42c324721710 100644 (file)
@@ -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);
 
index 245489ca4c4f3d48202991b9bfcd5a7c717ae984..89f10284ce610b3f1e2e9d6cdfd2b9c01774df8c 100644 (file)
@@ -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;
index 177a7982b352eb3e9947a000566c87a268ec224e..f25b5bf028d94fe4d1b47bb7dea682591956940c 100644 (file)
@@ -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 */
index 26f9554c9eca46d82fbb796c20b53155e2bb1d65..5cf17fe530a02fbb366a453c7e9c12f4a7614f90 100644 (file)
@@ -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);
index 9fcf86844da24d2e794f33c07d3c1d56fd9967d6..d1a430bc9756a2fd44e0b5624a200d55a772e151 100644 (file)
@@ -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;