From 52501801c7107614387717e7b97e66a667f9e5b8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 23 Jun 2008 15:54:25 +0200 Subject: gallium: Add accessor functions to get textures from a st_framebuffer --- src/mesa/state_tracker/st_framebuffer.c | 16 ++++++++++++++++ src/mesa/state_tracker/st_public.h | 3 +++ 2 files changed, 19 insertions(+) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 7e6db467576..1b6e68c2a11 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -230,6 +230,22 @@ st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex) return NULL; } +struct pipe_texture * +st_get_framebuffer_texture(struct st_framebuffer *stfb, uint surfIndex) +{ + struct st_renderbuffer *strb; + + assert(surfIndex <= ST_SURFACE_DEPTH); + + /* sanity checks, ST tokens should match Mesa tokens */ + assert(ST_SURFACE_FRONT_LEFT == BUFFER_FRONT_LEFT); + assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT); + + strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); + if (strb) + return strb->texture; + return NULL; +} /** * This function is to be called prior to SwapBuffers on the given diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index b99984215f7..ca4e9577b1b 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -74,6 +74,9 @@ void st_set_framebuffer_surface(struct st_framebuffer *stfb, struct pipe_surface *st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex); +struct pipe_texture *st_get_framebuffer_texture(struct st_framebuffer *stfb, + uint surfIndex); + void *st_framebuffer_private( struct st_framebuffer *stfb ); void st_unreference_framebuffer( struct st_framebuffer **stfb ); -- cgit v1.2.3