>From f08d6efbc85609d1384006b773ea0a3276eb1e67 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Nicolai=20H=C3=A4hnle?= <nhaeh...@gmail.com> Date: Sat, 12 Sep 2009 16:49:31 +0200 Subject: [PATCH] mesa/st: Create front renderbuffer on the fly when supplied with a surface MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit
Normally, the mesa/st would create a fake front buffer out of a client-allocated surface. In the DRI setting, however, st/dri provides a front buffer surface which is created and maintained by the X server. Prefer to use this surface instead, so that front buffer rendering and reading works correctly. Signed-off-by: Nicolai Hähnle <nhaeh...@gmail.com> --- src/mesa/state_tracker/st_framebuffer.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index ca32b2e..5c0d335 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -66,7 +66,7 @@ st_create_framebuffer( const __GLcontextModes *visual, else { /* Only allocate front buffer right now if we're single buffered. * If double-buffered, allocate front buffer on demand later. - * See check_create_front_buffers(). + * See check_create_front_buffers() and st_set_framebuffer_surface(). */ struct gl_renderbuffer *rb = st_new_renderbuffer_fb(colorFormat, samples, FALSE); @@ -170,8 +170,20 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); - /* fail */ - if (!strb) return; + if (!strb) { + if (surfIndex == ST_SURFACE_FRONT_LEFT) { + /* Delayed creation when the window system supplies a fake front buffer */ + struct st_renderbuffer *strb_back + = st_renderbuffer(stfb- >Base.Attachment[ST_SURFACE_BACK_LEFT].Renderbuffer); + struct gl_renderbuffer *rb + = st_new_renderbuffer_fb(surf->format, strb_back- >Base.NumSamples, FALSE); + _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb); + strb = st_renderbuffer(rb); + } else { + /* fail */ + return; + } + } /* replace the renderbuffer's surface/texture pointers */ pipe_surface_reference( &strb->surface, surf ); -- 1.6.0.4 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel