summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c93
1 files changed, 35 insertions, 58 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ed1db0feca6..0040099a69f 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -34,6 +34,7 @@
#include "buffers.h"
#include "context.h"
+#include "enums.h"
#include "fbobject.h"
#include "framebuffer.h"
#include "hash.h"
@@ -44,6 +45,11 @@
#include "teximage.h"
#include "texobj.h"
#include "texstore.h"
+#include "texstate.h"
+
+
+/** Set this to 1 to help debug FBO incompleteness problems */
+#define DEBUG_FBO 0
/**
@@ -234,12 +240,7 @@ _mesa_set_texture_attachment(GLcontext *ctx,
/* always update these fields */
att->TextureLevel = level;
- if (IS_CUBE_FACE(texTarget)) {
- att->CubeMapFace = texTarget - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
- }
- else {
- att->CubeMapFace = 0;
- }
+ att->CubeMapFace = _mesa_tex_target_to_face(texTarget);
att->Zoffset = zoffset;
att->Complete = GL_FALSE;
@@ -308,14 +309,31 @@ _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
static void
att_incomplete(const char *msg)
{
-#if 0
- _mesa_printf("attachment incomplete: %s\n", msg);
+#if DEBUG_FBO
+ _mesa_debug(NULL, "attachment incomplete: %s\n", msg);
+#else
+ (void) msg;
+#endif
+}
+
+
+/**
+ * For debug only.
+ */
+static void
+fbo_incomplete(const char *msg, int index)
+{
+#if DEBUG_FBO
+ _mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
#else
(void) msg;
+ (void) index;
#endif
}
+
+
/**
* Test if an attachment point is complete and update its Complete field.
* \param format if GL_COLOR, this is a color attachment point,
@@ -468,20 +486,6 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
/**
- * Helpful for debugging
- */
-static void
-fbo_incomplete(const char *msg, int index)
-{
- (void) msg;
- (void) index;
- /*
- _mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
- */
-}
-
-
-/**
* Test if the given framebuffer object is complete and update its
* Status field with the results.
* Calls the ctx->Driver.ValidateFramebuffer() function to allow the
@@ -710,12 +714,6 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
}
FLUSH_CURRENT(ctx, _NEW_BUFFERS);
- /* The above doesn't fully flush the drivers in the way that a
- * glFlush does, but that is required here:
- */
- if (ctx->Driver.Flush)
- ctx->Driver.Flush(ctx);
-
if (renderbuffer) {
newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
@@ -1127,7 +1125,7 @@ check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
struct gl_renderbuffer_attachment *att = fb->Attachment + i;
struct gl_texture_object *texObj = att->Texture;
if (texObj
- && att->Texture->Image[att->CubeMapFace][att->TextureLevel]) {
+ && texObj->Image[att->CubeMapFace][att->TextureLevel]) {
ctx->Driver.RenderTexture(ctx, fb, att);
}
}
@@ -1205,9 +1203,6 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
}
FLUSH_CURRENT(ctx, _NEW_BUFFERS);
- if (ctx->Driver.Flush) {
- ctx->Driver.Flush(ctx);
- }
if (framebuffer) {
/* Binding a user-created framebuffer object */
@@ -1286,11 +1281,6 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_CURRENT(ctx, _NEW_BUFFERS);
- /* The above doesn't fully flush the drivers in the way that a
- * glFlush does, but that is required here:
- */
- if (ctx->Driver.Flush)
- ctx->Driver.Flush(ctx);
for (i = 0; i < n; i++) {
if (framebuffers[i] > 0) {
@@ -1512,11 +1502,6 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
}
FLUSH_CURRENT(ctx, _NEW_BUFFERS);
- /* The above doesn't fully flush the drivers in the way that a
- * glFlush does, but that is required here:
- */
- if (ctx->Driver.Flush)
- ctx->Driver.Flush(ctx);
_glthread_LOCK_MUTEX(fb->Mutex);
if (texObj) {
@@ -1664,7 +1649,8 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
att = _mesa_get_attachment(ctx, fb, attachment);
if (att == NULL) {
_mesa_error(ctx, GL_INVALID_ENUM,
- "glFramebufferRenderbufferEXT(attachment)");
+ "glFramebufferRenderbufferEXT(invalid attachment %s)",
+ _mesa_lookup_enum_by_nr(attachment));
return;
}
@@ -1672,7 +1658,8 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
if (!rb) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glFramebufferRenderbufferEXT(renderbuffer)");
+ "glFramebufferRenderbufferEXT(non-existant"
+ " renderbuffer %u)", renderbuffer);
return;
}
}
@@ -1693,11 +1680,6 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
FLUSH_CURRENT(ctx, _NEW_BUFFERS);
- /* The above doesn't fully flush the drivers in the way that a
- * glFlush does, but that is required here:
- */
- if (ctx->Driver.Flush)
- ctx->Driver.Flush(ctx);
assert(ctx->Driver.FramebufferRenderbuffer);
ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb);
@@ -1774,11 +1756,6 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
}
FLUSH_CURRENT(ctx, _NEW_BUFFERS);
- /* The above doesn't fully flush the drivers in the way that a
- * glFlush does, but that is required here:
- */
- if (ctx->Driver.Flush)
- ctx->Driver.Flush(ctx);
switch (pname) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
@@ -1936,18 +1913,18 @@ _mesa_GenerateMipmapEXT(GLenum target)
return;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
if (target == GL_TEXTURE_CUBE_MAP) {
- int face;
-
+ GLuint face;
for (face = 0; face < 6; face++)
ctx->Driver.GenerateMipmap(ctx,
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face,
texObj);
- } else {
+ }
+ else {
ctx->Driver.GenerateMipmap(ctx, target, texObj);
}
_mesa_unlock_texture(ctx, texObj);