Module: Mesa
Branch: master
Commit: 24f90112761d108a4a131fad11bd7b426d8edfa0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=24f90112761d108a4a131fad11bd7b426d8edfa0

Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Mar  5 23:10:45 2010 +0000

Always return VOLATILE for ObjectPurgeable(VOLATILE)

Fixes fdo bug 26128.

The spec mandates that VOLATILE is returned from
ObjectPurgeable(VOLATILE) irrespective of the actual status of the
object upon completion of marking it purgeable.

Conform to the spec, even though it seems wrong.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

---

 src/mesa/main/bufferobj.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index c532cbe..71d1514 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1809,6 +1809,8 @@ _mesa_TextureObjectPurgeable(GLcontext *ctx, GLuint name, 
GLenum option)
 GLenum GLAPIENTRY
 _mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
 {
+   GLenum retval;
+
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
 
@@ -1832,17 +1834,27 @@ _mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint 
name, GLenum option)
 
    switch (objectType) {
    case GL_TEXTURE:
-      return _mesa_TextureObjectPurgeable (ctx, name, option);
+      retval = _mesa_TextureObjectPurgeable (ctx, name, option);
+      break;
    case GL_RENDERBUFFER_EXT:
-      return _mesa_RenderObjectPurgeable (ctx, name, option);
+      retval = _mesa_RenderObjectPurgeable (ctx, name, option);
+      break;
    case GL_BUFFER_OBJECT_APPLE:
-      return _mesa_BufferObjectPurgeable (ctx, name, option);
+      retval = _mesa_BufferObjectPurgeable (ctx, name, option);
+      break;
    default:
       _mesa_error(ctx, GL_INVALID_ENUM,
                   "glObjectPurgeable(name = 0x%x) invalid type: %d",
                   name, objectType);
       return 0;
    }
+
+   /* In strict conformance to the spec, we must only return VOLATILE when
+    * when passed the VOLATILE option. Madness.
+    *
+    * XXX First fix the spec, then fix me.
+    */
+   return option == GL_VOLATILE_APPLE ? GL_VOLATILE_APPLE : retval;
 }
 
 
@@ -1902,7 +1914,7 @@ _mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint 
name, GLenum option)
    if (ctx->Driver.RenderObjectUnpurgeable)
       retval = ctx->Driver.RenderObjectUnpurgeable(ctx, bufObj, option);
 
-   return retval;
+   return option;
 }
 
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to