Mesa (mesa_7_5_branch): st: create renderbuffer' s pipe_surface in st_render_texture()

Brian Paul brianp at kemper.freedesktop.org
Sat May 2 00:20:53 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 0a56a4968786bd93d9117af2a0a3bda13ea71c4d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a56a4968786bd93d9117af2a0a3bda13ea71c4d

Author: Brian Paul <brianp at vmware.com>
Date:   Fri May  1 18:17:34 2009 -0600

st: create renderbuffer's pipe_surface in st_render_texture()

Previously we created the pipe_surface during framebuffer validation.
But if we did a glCopyTex[Sub]Image() before anything else we wouldn't yet
have the surface.  This fixes that.

---

 src/mesa/state_tracker/st_cb_fbo.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 1590f27..e003b6d 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -343,6 +343,7 @@ st_render_texture(GLcontext *ctx,
                   struct gl_framebuffer *fb,
                   struct gl_renderbuffer_attachment *att)
 {
+   struct pipe_screen *screen = ctx->st->pipe->screen;
    struct st_renderbuffer *strb;
    struct gl_renderbuffer *rb;
    struct pipe_texture *pt = st_get_texobj_texture(att->Texture);
@@ -365,6 +366,8 @@ st_render_texture(GLcontext *ctx,
    rb->AllocStorage = NULL; /* should not get called */
    strb = st_renderbuffer(rb);
 
+   assert(strb->Base.RefCount > 0);
+
    /* get the texture for the texture object */
    stObj = st_texture_object(att->Texture);
 
@@ -384,7 +387,14 @@ st_render_texture(GLcontext *ctx,
 
    pipe_surface_reference(&strb->surface, NULL);
 
-   /* the new surface will be created during framebuffer validation */
+   /* new surface for rendering into the texture */
+   strb->surface = screen->get_tex_surface(screen,
+                                           strb->texture,
+                                           strb->rtt_face,
+                                           strb->rtt_level,
+                                           strb->rtt_slice,
+                                           PIPE_BUFFER_USAGE_GPU_READ |
+                                           PIPE_BUFFER_USAGE_GPU_WRITE);
 
    init_renderbuffer_bits(strb, pt->format);
 




More information about the mesa-commit mailing list