mesa: check FEATURE_ARB_occlusion_query
[mesa.git] / src / mesa / main / fbobject.c
index 8e9948cb45d330cd7f90de38c68008a2d0197e46..680dc8eed0e4d2d8cdd6e2b800d281313f4c1617 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.1
+ * Version:  7.1
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -66,6 +66,27 @@ static struct gl_renderbuffer DummyRenderbuffer;
     (TARGET) <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)
 
 
+static void
+delete_dummy_renderbuffer(struct gl_renderbuffer *rb)
+{
+   /* no op */
+}
+
+static void
+delete_dummy_framebuffer(struct gl_framebuffer *fb)
+{
+   /* no op */
+}
+
+
+void
+_mesa_init_fbobjects(GLcontext *ctx)
+{
+   DummyFramebuffer.Delete = delete_dummy_framebuffer;
+   DummyRenderbuffer.Delete = delete_dummy_renderbuffer;
+}
+
+
 /**
  * Helper routine for getting a gl_renderbuffer.
  */
@@ -159,7 +180,6 @@ _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
       ASSERT(!att->Texture);
    }
    if (att->Type == GL_TEXTURE || att->Type == GL_RENDERBUFFER_EXT) {
-      ASSERT(att->Renderbuffer);
       ASSERT(!att->Texture);
       _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); /* unbind */
       ASSERT(!att->Renderbuffer);
@@ -1493,7 +1513,12 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
       return;
    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT:
       if (att->Type == GL_TEXTURE) {
-        *params = GL_TEXTURE_CUBE_MAP_POSITIVE_X + att->CubeMapFace;
+         if (att->Texture && att->Texture->Target == GL_TEXTURE_CUBE_MAP) {
+            *params = GL_TEXTURE_CUBE_MAP_POSITIVE_X + att->CubeMapFace;
+         }
+         else {
+            *params = 0;
+         }
       }
       else {
         _mesa_error(ctx, GL_INVALID_ENUM,
@@ -1502,7 +1527,12 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
       return;
    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT:
       if (att->Type == GL_TEXTURE) {
-        *params = att->Zoffset;
+         if (att->Texture && att->Texture->Target == GL_TEXTURE_3D) {
+            *params = att->Zoffset;
+         }
+         else {
+            *params = 0;
+         }
       }
       else {
         _mesa_error(ctx, GL_INVALID_ENUM,