GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_BUFFERS);
if (target != GL_RENDERBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM,
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (renderbuffer) {
newRb = lookup_renderbuffer(ctx, renderbuffer);
if (newRb == &DummyRenderbuffer) {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
for (i = 0; i < n; i++) {
if (renderbuffers[i] > 0) {
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_BUFFERS);
if (target != GL_RENDERBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM, "glRenderbufferStorageEXT(target)");
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
/* Now allocate the storage */
ASSERT(rb->AllocStorage);
if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
switch (pname) {
case GL_RENDERBUFFER_WIDTH_EXT:
*params = ctx->CurrentRenderbuffer->Width;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_BUFFERS);
if (target != GL_FRAMEBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)");
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (framebuffer) {
/* Binding a user-created framebuffer object */
newFb = lookup_framebuffer(ctx, framebuffer);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
for (i = 0; i < n; i++) {
if (framebuffers[i] > 0) {
return GL_FRAMEBUFFER_COMPLETE_EXT;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
_mesa_test_framebuffer_completeness(ctx, ctx->DrawBuffer);
return ctx->DrawBuffer->_Status;
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_BUFFERS); /* XXX check */
if (error_check_framebuffer_texture(ctx, 1, target, attachment,
textarget, texture, level))
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (texture) {
texObj = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texture);
texObj = NULL;
}
ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0);
-
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_BUFFERS); /* XXX check */
if (error_check_framebuffer_texture(ctx, 2, target, attachment,
textarget, texture, level))
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (texture) {
texObj = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texture);
texObj = NULL;
}
ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0);
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_BUFFERS); /* XXX check */
if (error_check_framebuffer_texture(ctx, 3, target, attachment,
textarget, texture, level))
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (texture) {
const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
texObj = (struct gl_texture_object *)
}
ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget,
level, zoffset);
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, _NEW_BUFFERS);
if (target != GL_FRAMEBUFFER_EXT) {
_mesa_error(ctx, GL_INVALID_ENUM,
rb = NULL;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
assert(ctx->Driver.FramebufferRenderbuffer);
ctx->Driver.FramebufferRenderbuffer(ctx, att, rb);
-
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
switch (pname) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
*params = att->Type;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
switch (target) {
case GL_TEXTURE_1D:
void
_mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
{
+ GLuint i;
+
assert(fb->Name != 0);
_mesa_bzero(&fb->Visual, sizeof(fb->Visual));
- fb->Visual.rgbMode = GL_TRUE;
-
- if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer) {
- fb->Visual.redBits
- = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->RedBits;
- fb->Visual.greenBits
- = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->GreenBits;
- fb->Visual.blueBits
- = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->BlueBits;
- fb->Visual.alphaBits
- = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->AlphaBits;
- fb->Visual.rgbBits
- = fb->Visual.redBits + fb->Visual.greenBits + fb->Visual.blueBits;
- fb->Visual.floatMode = GL_FALSE;
+ fb->Visual.rgbMode = GL_TRUE; /* assume this */
+
+ /* find first RGB or CI renderbuffer */
+ for (i = 0; i < BUFFER_COUNT; i++) {
+ if (fb->Attachment[i].Renderbuffer) {
+ const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
+ if (rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB) {
+ fb->Visual.redBits = rb->RedBits;
+ fb->Visual.greenBits = rb->GreenBits;
+ fb->Visual.blueBits = rb->BlueBits;
+ fb->Visual.alphaBits = rb->AlphaBits;
+ fb->Visual.rgbBits = fb->Visual.redBits
+ + fb->Visual.greenBits + fb->Visual.blueBits;
+ fb->Visual.floatMode = GL_FALSE;
+ break;
+ }
+ else if (rb->_BaseFormat == GL_COLOR_INDEX) {
+ fb->Visual.indexBits = rb->IndexBits;
+ fb->Visual.rgbMode = GL_FALSE;
+ break;
+ }
+ }
}
if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) {
GLuint output;
/* Completeness only matters for user-created framebuffers */
- if (fb->Name != 0)
+ if (fb->Name != 0) {
_mesa_test_framebuffer_completeness(ctx, fb);
+ _mesa_update_framebuffer_visual(fb);
+ }
/*
* Update the list of color drawing renderbuffer pointers.