On Wednesday 05 October 2011, Jose Fonseca wrote: > ----- Original Message ----- > > This is needed for renderbuffer support. > > What state tracker relies on this?
The EGL state tracker relies on it for user-created renderbuffers in the recently added null platform. st_renderbuffer_alloc_storage() always creates color buffer resources with PIPE_BIND_DISPLAY_TARGET, and this causes llvmpipe_resource_create() to call into this code to allocate storage. > I don't object this change, but it sounds like you should be using a proper > sw winsys, instead of null winsys. The null winsys can't really display > anything, so the current implementation is more honest. I agree with what you're saying, and having thought about this some more I believe a better solution is to identify user-created renderbuffers in st_renderbuffer_alloc_storage() instead of specifying PIPE_BIND_DISPLAY_TARGET unconditionally. I have attached a new patch that does that. Regards, Fredrik
From 0a5b92264ac2124eed9694f12020b4ec4272a807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= <fred...@kde.org> Date: Wed, 5 Oct 2011 18:29:31 +0200 Subject: [PATCH] st/mesa: don't create user renderbuffers with PIPE_BIND_DISPLAY_TARGET This fixes user-created renderbuffers with the null winsys. --- src/mesa/state_tracker/st_cb_fbo.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 4d32158..a1ad524 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -56,6 +56,8 @@ #include "util/u_inlines.h" #include "util/u_surface.h" +/* Just a unique value */ +#define ST_DISPLAY_TARGET_RB_CLASS 0x4242 /** * gl_renderbuffer::AllocStorage() @@ -129,8 +131,9 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, template.bind = PIPE_BIND_DEPTH_STENCIL; } else { - template.bind = (PIPE_BIND_DISPLAY_TARGET | - PIPE_BIND_RENDER_TARGET); + template.bind = PIPE_BIND_RENDER_TARGET; + if (strb->Base.ClassID == ST_DISPLAY_TARGET_RB_CLASS) + template.bind |= PIPE_BIND_DISPLAY_TARGET; } strb->texture = screen->resource_create(screen, &template); @@ -233,7 +236,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) } _mesa_init_renderbuffer(&strb->Base, 0); - strb->Base.ClassID = 0x4242; /* just a unique value */ + strb->Base.ClassID = ST_DISPLAY_TARGET_RB_CLASS; strb->Base.NumSamples = samples; strb->Base.Format = st_pipe_format_to_mesa_format(format); strb->Base._BaseFormat = _mesa_get_format_base_format(strb->Base.Format); -- 1.7.6
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev