From: Brian Date: Mon, 5 Nov 2007 16:52:14 +0000 (-0700) Subject: added st_get_framebuffer_surface() and ST_SURFACE_x tokens X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=616bf3556939d94852b1dfe73f92ef94b10782c4;p=mesa.git added st_get_framebuffer_surface() and ST_SURFACE_x tokens --- diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 54ae175e60e..326773c505e 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -112,3 +112,23 @@ void st_unreference_framebuffer( struct st_framebuffer **stfb ) } + +/** + * Return the pipe_surface for the given renderbuffer. + */ +struct pipe_surface * +st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex) +{ + struct st_renderbuffer *strb; + + assert(surfIndex <= ST_SURFACE_BACK_RIGHT); + + /* 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->surface; + return NULL; +} diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 93239e66d63..acbf54d5ab3 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -30,6 +30,13 @@ #include "mtypes.h" + +#define ST_SURFACE_FRONT_LEFT 0 +#define ST_SURFACE_BACK_LEFT 1 +#define ST_SURFACE_FRONT_RIGHT 2 +#define ST_SURFACE_BACK_RIGHT 3 + + struct st_context; struct st_framebuffer; @@ -51,6 +58,9 @@ struct st_framebuffer *st_create_framebuffer( const __GLcontextModes *visual ); void st_resize_framebuffer( struct st_framebuffer *stfb, GLuint width, GLuint height ); +struct pipe_surface *st_get_framebuffer_surface(struct st_framebuffer *stfb, + uint surfIndex); + void st_unreference_framebuffer( struct st_framebuffer **stfb ); void st_make_current(struct st_context *st,