summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-10-08 14:41:17 +0000
committerBrian Paul <[email protected]>2005-10-08 14:41:17 +0000
commit474f28e57ca750ca39d7f684904a3c0e69a03f62 (patch)
treeaa9d5d1c9c37bf9a457ed0e77f89eabda631efda /src/mesa/main/fbobject.c
parent81a22ef53953d950052c7bd5a282e96107a25f24 (diff)
Fix some issues with state updates and renderbuffers. Querying GL_RED_BITS,
etc. after calling glRenderBufferStorageEXT gave undefined results.
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 6fc7c8ab631..f5ae4518beb 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -527,7 +527,6 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
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,
@@ -535,6 +534,8 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (renderbuffer) {
newRb = lookup_renderbuffer(ctx, renderbuffer);
if (newRb == &DummyRenderbuffer) {
@@ -578,6 +579,7 @@ _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
for (i = 0; i < n; i++) {
if (renderbuffers[i] > 0) {
@@ -700,7 +702,6 @@ _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
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)");
@@ -731,6 +732,8 @@ _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
/* Now allocate the storage */
ASSERT(rb->AllocStorage);
if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) {
@@ -776,6 +779,8 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params)
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
switch (pname) {
case GL_RENDERBUFFER_WIDTH_EXT:
*params = ctx->CurrentRenderbuffer->Width;
@@ -870,13 +875,14 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
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);
@@ -927,6 +933,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
for (i = 0; i < n; i++) {
if (framebuffers[i] > 0) {
@@ -1008,6 +1015,8 @@ _mesa_CheckFramebufferStatusEXT(GLenum target)
return GL_FRAMEBUFFER_COMPLETE_EXT;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
_mesa_test_framebuffer_completeness(ctx, ctx->DrawBuffer);
return ctx->DrawBuffer->_Status;
}
@@ -1070,7 +1079,6 @@ _mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
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))
@@ -1085,6 +1093,8 @@ _mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (texture) {
texObj = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texture);
@@ -1104,8 +1114,6 @@ _mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
texObj = NULL;
}
ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0);
-
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
@@ -1118,7 +1126,6 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
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))
@@ -1135,6 +1142,8 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (texture) {
texObj = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texture);
@@ -1158,7 +1167,6 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
texObj = NULL;
}
ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0);
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
@@ -1172,7 +1180,6 @@ _mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment,
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))
@@ -1187,6 +1194,8 @@ _mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment,
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
if (texture) {
const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
texObj = (struct gl_texture_object *)
@@ -1213,7 +1222,6 @@ _mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment,
}
ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget,
level, zoffset);
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
@@ -1227,7 +1235,6 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
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,
@@ -1267,10 +1274,10 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
rb = NULL;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
assert(ctx->Driver.FramebufferRenderbuffer);
ctx->Driver.FramebufferRenderbuffer(ctx, att, rb);
-
- _mesa_update_framebuffer_visual(ctx->DrawBuffer);
}
@@ -1302,6 +1309,8 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
return;
}
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
switch (pname) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
*params = att->Type;
@@ -1361,6 +1370,7 @@ _mesa_GenerateMipmapEXT(GLenum target)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
switch (target) {
case GL_TEXTURE_1D: