aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/main/bufferobj.c1
-rw-r--r--mesalib/src/mesa/main/drawpix.c2
-rw-r--r--mesalib/src/mesa/main/fbobject.c36
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c5
6 files changed, 41 insertions, 11 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 8b5899918..afb7999de 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -558,6 +558,7 @@ void
_mesa_init_buffer_objects( struct gl_context *ctx )
{
memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
+ _glthread_INIT_MUTEX(DummyBufferObject.Mutex);
DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index b6a6799fd..ab6e61fe3 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -136,8 +136,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- _mesa_finish(ctx);
-
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx,
"glCopyPixels(%d, %d, %d, %d, %s) // from %s to %s at %d, %d\n",
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 7f26e0f97..0bffbcfae 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -384,6 +384,7 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
assert(att);
_mesa_set_renderbuffer_attachment(ctx, att, rb);
}
+ rb->AttachedAnytime = GL_TRUE;
}
else {
_mesa_remove_attachment(ctx, att);
@@ -1115,6 +1116,31 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
}
+/**
+ * Invalidate a renderbuffer attachment. Called from _mesa_HashWalk().
+ */
+static void
+invalidate_rb(GLuint key, void *data, void *userData)
+{
+ struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
+ struct gl_renderbuffer *rb = (struct gl_renderbuffer *) userData;
+
+ /* If this is a user-created FBO */
+ if (fb->Name) {
+ GLuint i;
+ for (i = 0; i < BUFFER_COUNT; i++) {
+ struct gl_renderbuffer_attachment *att = fb->Attachment + i;
+ if (att->Type == GL_RENDERBUFFER &&
+ att->Renderbuffer == rb) {
+ /* Mark fb status as indeterminate to force re-validation */
+ fb->_Status = 0;
+ return;
+ }
+ }
+ }
+}
+
+
/** sentinal value, see below */
#define NO_SAMPLES 1000
@@ -1207,12 +1233,10 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
rb->NumSamples = 0;
}
- /*
- test_framebuffer_completeness(ctx, fb);
- */
- /* XXX if this renderbuffer is attached anywhere, invalidate attachment
- * points???
- */
+ /* Invalidate the framebuffers the renderbuffer is attached in. */
+ if (rb->AttachedAnytime) {
+ _mesa_HashWalk(ctx->Shared->FrameBuffers, invalidate_rb, rb);
+ }
}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index d50f69fdf..2862f88da 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2376,6 +2376,8 @@ struct gl_renderbuffer
GLenum DataType; /**< Type of values passed to the Get/Put functions */
GLvoid *Data; /**< This may not be used by some kinds of RBs */
+ GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */
+
/* Used to wrap one renderbuffer around another: */
struct gl_renderbuffer *Wrapped;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 7e124186c..534fa7041 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -79,7 +79,11 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
else
format = st_choose_renderbuffer_format(screen, internalFormat,
rb->NumSamples);
-
+
+ if (format == PIPE_FORMAT_NONE) {
+ return FALSE;
+ }
+
/* init renderbuffer fields */
strb->Base.Width = width;
strb->Base.Height = height;
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 5684e9768..ed668d248 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -684,8 +684,9 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
if (attribs->major > 1 || attribs->minor > 0) {
_mesa_compute_version(st->ctx);
- if (st->ctx->VersionMajor < attribs->major ||
- st->ctx->VersionMajor < attribs->minor) {
+ /* is the actual version less than the requested version? */
+ if (st->ctx->VersionMajor * 10 + st->ctx->VersionMinor <
+ attribs->major * 10 + attribs->minor) {
st_destroy_context(st);
return NULL;
}