-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Wilson wrote:

> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 52c4995..08633a9 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -37,6 +37,8 @@
>  #include "image.h"
>  #include "context.h"
>  #include "bufferobj.h"
> +#include "fbobject.h"
> +#include "texobj.h"
>  
>  
>  /* Debug flags */
> @@ -1655,3 +1657,351 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr 
> offset, GLsizeiptr length)
>     if (ctx->Driver.FlushMappedBufferRange)
>        ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, 
> bufObj);
>  }
> +
> +#if FEATURE_APPLE_object_purgeable
> +static GLenum
> +_mesa_RenderObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
> +{
> +   struct gl_renderbuffer *bufObj;
> +   GLenum retval;
> +
> +   bufObj = _mesa_lookup_renderbuffer(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectUnpurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   if (bufObj->Purgeable) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "glObjectPurgeable(name = 0x%x) is already purgeable", 
> name);
> +      return GL_VOLATILE_APPLE;
> +   }
> +
> +   bufObj->Purgeable = GL_TRUE;
> +
> +   retval = GL_VOLATILE_APPLE;
> +   if (ctx->Driver.ObjectPurgeable_RenderObject)
> +      retval = ctx->Driver.ObjectPurgeable_RenderObject(ctx, bufObj, option);
> +
> +   return retval;
> +}
> +
> +static GLenum
> +_mesa_TextureObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)

Usually, only functions that are connected directly to the dispatch
table get camel case.  Functions that are only used internally are
usually named _mesa_texture_object_purgeable.

I don't know if it's worth changing these.  Brian may have an opinion
about this.

> +{
> +   struct gl_texture_object *bufObj;
> +   GLenum retval;
> +
> +   bufObj = _mesa_lookup_texture(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectPurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   if (bufObj->Purgeable) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "glObjectPurgeable(name = 0x%x) is already purgeable", 
> name);
> +      return GL_VOLATILE_APPLE;
> +   }
> +
> +   bufObj->Purgeable = GL_TRUE;
> +
> +   retval = GL_VOLATILE_APPLE;
> +   if (ctx->Driver.ObjectPurgeable_TextureObject)
> +      retval = ctx->Driver.ObjectPurgeable_TextureObject(ctx, bufObj, 
> option);
> +
> +   return retval;
> +}
> +
> +static GLenum
> +_mesa_BufferObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
> +{
> +   struct gl_buffer_object *bufObj;
> +   GLenum retval;
> +
> +   bufObj = get_buffer(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectPurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   if (bufObj->Purgeable) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "glObjectPurgeable(name = 0x%x) is already purgeable", 
> name);
> +      return GL_VOLATILE_APPLE;
> +   }
> +
> +   bufObj->Purgeable = GL_TRUE;
> +
> +   retval = GL_VOLATILE_APPLE;
> +   if (ctx->Driver.ObjectPurgeable_BufferObject)
> +      retval = ctx->Driver.ObjectPurgeable_BufferObject(ctx, bufObj, option);
> +
> +   return retval;
> +}
> +
> +GLenum GLAPIENTRY
> +_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   if (name == 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectPurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   switch (option) {
> +   case GL_VOLATILE_APPLE:
> +   case GL_RELEASED_APPLE:
> +      break;
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glObjectPurgeable(name = 0x%x) invalid option: %d", name, 
> option);
> +      return 0;
> +   }
> +
> +   switch (objectType) {
> +   case GL_TEXTURE:
> +      return _mesa_TextureObjectPurgeable (ctx, name, option);
> +   case GL_RENDERBUFFER_EXT:
> +      return _mesa_RenderObjectPurgeable (ctx, name, option);
> +   case GL_BUFFER_OBJECT_APPLE:
> +      return _mesa_BufferObjectPurgeable (ctx, name, option);
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glObjectPurgeable(name = 0x%x) invalid type: %d", name, 
> objectType);
> +      return 0;
> +   }
> +}
> +
> +static GLenum
> +_mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
> +{
> +   struct gl_renderbuffer *bufObj;
> +   GLenum retval;
> +
> +   bufObj = _mesa_lookup_renderbuffer(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectUnpurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   if (! bufObj->Purgeable) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "glObjectUnpurgeable(name = 0x%x) object is already 
> \"unpurged\"", name);
> +      return 0;
> +   }
> +
> +   bufObj->Purgeable = GL_FALSE;
> +
> +   retval = GL_RETAINED_APPLE;
> +   if (ctx->Driver.ObjectUnpurgeable_RenderObject)
> +      retval = ctx->Driver.ObjectUnpurgeable_RenderObject(ctx, bufObj, 
> option);
> +
> +   return retval;
> +}
> +
> +static GLenum
> +_mesa_TextureObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
> +{
> +   struct gl_texture_object *bufObj;
> +   GLenum retval;
> +
> +   bufObj = _mesa_lookup_texture(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectUnpurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   if (! bufObj->Purgeable) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "glObjectUnpurgeable(name = 0x%x) object is already 
> \"unpurged\"", name);
> +      return 0;
> +   }
> +
> +   bufObj->Purgeable = GL_FALSE;
> +
> +   retval = GL_RETAINED_APPLE;
> +   if (ctx->Driver.ObjectUnpurgeable_TextureObject)
> +      retval = ctx->Driver.ObjectUnpurgeable_TextureObject(ctx, bufObj, 
> option);
> +
> +   return retval;
> +}
> +
> +static GLenum
> +_mesa_BufferObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
> +{
> +   struct gl_buffer_object *bufObj;
> +   GLenum retval;
> +
> +   bufObj = get_buffer(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectUnpurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   if (! bufObj->Purgeable) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "glObjectUnpurgeable(name = 0x%x) object is already 
> \"unpurged\"", name);
> +      return 0;
> +   }
> +
> +   bufObj->Purgeable = GL_FALSE;
> +
> +   retval = GL_RETAINED_APPLE;
> +   if (ctx->Driver.ObjectUnpurgeable_BufferObject)
> +      retval = ctx->Driver.ObjectUnpurgeable_BufferObject(ctx, bufObj, 
> option);
> +
> +   return retval;
> +}
> +
> +GLenum GLAPIENTRY
> +_mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   if (name == 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectUnpurgeable(name = 0x%x)", name);
> +      return 0;
> +   }
> +
> +   switch (option) {
> +   case GL_RETAINED_APPLE:
> +   case GL_UNDEFINED_APPLE:
> +      break;
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glObjectUnpurgeable(name = 0x%x) invalid option: %d", 
> name, option);
> +      return 0;
> +   }
> +
> +   switch (objectType) {
> +   case GL_BUFFER_OBJECT_APPLE:
> +      return _mesa_BufferObjectUnpurgeable(ctx, name, option);
> +
> +   case GL_TEXTURE:
> +      return _mesa_TextureObjectUnpurgeable(ctx, name, option);
> +
> +   case GL_RENDERBUFFER_EXT:
> +      return _mesa_RenderObjectUnpurgeable(ctx, name, option);
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glObjectUnpurgeable(name = 0x%x) invalid type: %d", name, 
> objectType);
> +      return 0;
> +   }
> +}
> +
> +static void
> +_mesa_GetBufferObjectParameterivAPPLE(GLcontext *ctx, GLuint name, GLenum 
> pname, GLint* params)
> +{
> +   struct gl_buffer_object *bufObj;
> +
> +   bufObj = get_buffer(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glGetObjectParameteriv(name = 0x%x) invalid object", 
> name);
> +      return;
> +   }
> +
> +   switch (pname) {
> +   case GL_PURGEABLE_APPLE:
> +      *params = bufObj->Purgeable;
> +      break;
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", 
> name, pname);
> +      break;
> +   }
> +}
> +
> +static void
> +_mesa_GetRenderObjectParameterivAPPLE(GLcontext *ctx, GLuint name, GLenum 
> pname, GLint* params)
> +{
> +   struct gl_renderbuffer *bufObj;
> +
> +   bufObj = _mesa_lookup_renderbuffer(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectUnpurgeable(name = 0x%x)", name);
> +      return;
> +   }
> +
> +   switch (pname) {
> +   case GL_PURGEABLE_APPLE:
> +      *params = bufObj->Purgeable;
> +      break;
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", 
> name, pname);
> +      break;
> +   }
> +}
> +
> +static void
> +_mesa_GetTextureObjectParameterivAPPLE(GLcontext *ctx, GLuint name, GLenum 
> pname, GLint* params)
> +{
> +   struct gl_texture_object *bufObj;
> +
> +   bufObj = _mesa_lookup_texture(ctx, name);
> +   if (!bufObj) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glObjectUnpurgeable(name = 0x%x)", name);
> +      return;
> +   }
> +
> +   switch (pname) {
> +   case GL_PURGEABLE_APPLE:
> +      *params = bufObj->Purgeable;
> +      break;
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", 
> name, pname);
> +      break;
> +   }
> +}
> +
> +void GLAPIENTRY
> +_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum 
> pname, GLint* params)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   if (name == 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "glGetObjectParameteriv(name = 0x%x)", name);
> +      return;
> +   }
> +
> +   switch (objectType) {
> +   case GL_TEXTURE:
> +      _mesa_GetTextureObjectParameterivAPPLE (ctx, name, pname, params);
> +      break;
> +
> +   case GL_BUFFER_OBJECT_APPLE:
> +      _mesa_GetBufferObjectParameterivAPPLE (ctx, name, pname, params);
> +      break;
> +
> +   case GL_RENDERBUFFER_EXT:
> +      _mesa_GetRenderObjectParameterivAPPLE (ctx, name, pname, params);
> +      break;
> +
> +   default:
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glGetObjectParameteriv(name = 0x%x) invalid type: %d", 
> name, objectType);
> +   }
> +}
> +#endif
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 2138bfe..d1f3370 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -148,6 +148,7 @@ static const struct {
>     { OFF, "GL_APPLE_client_storage",           F(APPLE_client_storage) },
>     { ON,  "GL_APPLE_packed_pixels",            F(APPLE_packed_pixels) },
>     { OFF, "GL_APPLE_vertex_array_object",      F(APPLE_vertex_array_object) 
> },
> +   { OFF, "GL_APPLE_object_purgeable",         F(APPLE_object_purgeable) },

'o' comes before 'p' or 'v'. :)

>     { OFF, "GL_ATI_blend_equation_separate",    
> F(EXT_blend_equation_separate) },
>     { OFF, "GL_ATI_envmap_bumpmap",             F(ATI_envmap_bumpmap) },
>     { OFF, "GL_ATI_texture_env_combine3",       F(ATI_texture_env_combine3)},
> @@ -254,6 +255,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
>     ctx->Extensions.ARB_sync = GL_TRUE;
>  #endif
>     ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
> +#if FEATURE_APPLE_object_purgeable
> +   ctx->Extensions.APPLE_object_purgeable = GL_TRUE;
> +#endif
>     ctx->Extensions.ATI_envmap_bumpmap = GL_TRUE;
>  #if FEATURE_ATI_fragment_shader
>     ctx->Extensions.ATI_fragment_shader = GL_TRUE;
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 881d233..6e4af60 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1241,6 +1241,7 @@ struct gl_texture_object
>     GLboolean GenerateMipmap;    /**< GL_SGIS_generate_mipmap */
>     GLboolean _Complete;              /**< Is texture object complete? */
>     GLboolean _RenderToTexture;  /**< Any rendering to this texture? */
> +   GLboolean Purgeable;         /**< Is the buffer purgeable under memory 
> pressure? */
>  
>     /** Actual texture images, indexed by [cube face] and [mipmap level] */
>     struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
> @@ -1435,6 +1436,7 @@ struct gl_buffer_object
>     GLsizeiptr Length;   /**< Mapped length */
>     /*...@}*/
>     GLboolean Written;   /**< Ever written to? (for debugging) */
> +   GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? 
> */
>  };
>  
>  
> @@ -2094,6 +2096,7 @@ struct gl_renderbuffer
>     GLuint Name;
>     GLint RefCount;
>     GLuint Width, Height;
> +   GLboolean Purgeable;   /**< Is the buffer purgeable under memory 
> pressure? */
>  
>     GLenum InternalFormat; /**< The user-specified format */
>     GLenum _BaseFormat;    /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or
> @@ -2479,6 +2482,7 @@ struct gl_extensions
>     GLboolean APPLE_client_storage;
>     GLboolean APPLE_packed_pixels;
>     GLboolean APPLE_vertex_array_object;
> +   GLboolean APPLE_object_purgeable;

Same sorting as above.

>     GLboolean ATI_envmap_bumpmap;
>     GLboolean ATI_texture_mirror_once;
>     GLboolean ATI_texture_env_combine3;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksEWNEACgkQX1gOwKyEAw/6IQCdFcsDIweOzskCWqJTKcTe3lTQ
gMsAnj/Dg6EINx6+da1jUCz4YYSMV7JH
=h3sK
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to