From f76462cb6ffbf70a10ae216c97e85ee195ce1d5b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Nov 2015 10:51:01 -0800 Subject: meta: Save and restore the framebuffer using gl_framebuffer instead of GL API object handle Some meta operations can be called recursively. Future changes (the "Don't pollute the ... namespace" changes) will cause objects with invalid names to be used. If a nested meta operation tries to restore an object named 0xDEADBEEF, it will fail. This also fixes another latent bug in meta. In a multithreaded, multicontext application, one thread can delete an object that is bound in another thread. That object continues to exist until it is unbound (i.e., its refcount drops to zero). Meta unbinds objects all over the place. As a result, the rebind in _mesa_meta_end could fail because the object vanished! See https://bugs.freedesktop.org/show_bug.cgi?id=92363#c8. Using _mesa_reference_ to save and restore the objects prevents the refcount from going to zero. Signed-off-by: Ian Romanick Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363 Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/common/meta.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers/common/meta.h') diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index ee920351c35..03d86c8190d 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -186,7 +186,8 @@ struct save_state GLboolean RasterDiscard; GLboolean TransformFeedbackNeedsResume; - GLuint DrawBufferName, ReadBufferName; + struct gl_framebuffer *DrawBuffer; + struct gl_framebuffer *ReadBuffer; /** MESA_META_DRAW_BUFFERS */ GLenum ColorDrawBuffers[MAX_DRAW_BUFFERS]; -- cgit v1.2.3