[Mesa-dev] [PATCH 2/2] mesa: remove the ctx->Driver.IsTextureResident() hook
Ian Romanick
idr at freedesktop.org
Mon Dec 5 10:34:16 PST 2011
On 12/03/2011 09:07 AM, Brian Paul wrote:
> No driver implemented this and we always returned "True" for residence
> queries.
Most useless query evar.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Is there's some similar infrastructure for querying residence of ARB
vertex shaders? I think that can also die.
> ---
> src/mesa/drivers/common/driverfuncs.c | 1 -
> src/mesa/main/dd.h | 5 -----
> src/mesa/main/texobj.c | 23 +++--------------------
> src/mesa/main/texparam.c | 6 ++----
> 4 files changed, 5 insertions(+), 30 deletions(-)
>
> diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
> index 17281de..50fcede 100644
> --- a/src/mesa/drivers/common/driverfuncs.c
> +++ b/src/mesa/drivers/common/driverfuncs.c
> @@ -119,7 +119,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
> driver->UnmapTextureImage = _swrast_unmap_teximage;
> driver->MapTexture = NULL;
> driver->UnmapTexture = NULL;
> - driver->IsTextureResident = NULL;
> driver->DrawTex = _mesa_meta_DrawTex;
>
> /* Vertex/fragment programs */
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index a068397..d6f70d1 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -532,11 +532,6 @@ struct dd_function_table {
> void (*UnmapRenderbuffer)(struct gl_context *ctx,
> struct gl_renderbuffer *rb);
>
> - /**
> - * Called by glAreTextureResident().
> - */
> - GLboolean (*IsTextureResident)( struct gl_context *ctx,
> - struct gl_texture_object *t );
> /*@}*/
>
>
> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
> index 17c78ce..8e447ca 100644
> --- a/src/mesa/main/texobj.c
> +++ b/src/mesa/main/texobj.c
> @@ -1184,10 +1184,7 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
> *
> * \return GL_TRUE if all textures are resident and \p residences is left unchanged,
> *
> - * \sa glAreTexturesResident().
> - *
> - * Looks up each texture in the hash and calls
> - * dd_function_table::IsTextureResident.
> + * Note: we assume all textures are always resident
> */
> GLboolean GLAPIENTRY
> _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
> @@ -1195,7 +1192,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
> {
> GET_CURRENT_CONTEXT(ctx);
> GLboolean allResident = GL_TRUE;
> - GLint i, j;
> + GLint i;
> ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
>
> if (n< 0) {
> @@ -1206,6 +1203,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
> if (!texName || !residences)
> return GL_FALSE;
>
> + /* We only do error checking on the texture names */
> for (i = 0; i< n; i++) {
> struct gl_texture_object *t;
> if (texName[i] == 0) {
> @@ -1217,21 +1215,6 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
> _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident");
> return GL_FALSE;
> }
> - if (!ctx->Driver.IsTextureResident ||
> - ctx->Driver.IsTextureResident(ctx, t)) {
> - /* The texture is resident */
> - if (!allResident)
> - residences[i] = GL_TRUE;
> - }
> - else {
> - /* The texture is not resident */
> - if (allResident) {
> - allResident = GL_FALSE;
> - for (j = 0; j< i; j++)
> - residences[j] = GL_TRUE;
> - }
> - residences[i] = GL_FALSE;
> - }
> }
>
> return allResident;
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index f4ec633..0f92a5b 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
> @@ -1114,8 +1114,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
> }
> break;
> case GL_TEXTURE_RESIDENT:
> - *params = ctx->Driver.IsTextureResident ?
> - ctx->Driver.IsTextureResident(ctx, obj) : 1.0F;
> + *params = 1.0F;
> break;
> case GL_TEXTURE_PRIORITY:
> *params = obj->Priority;
> @@ -1261,8 +1260,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
> }
> break;;
> case GL_TEXTURE_RESIDENT:
> - *params = ctx->Driver.IsTextureResident ?
> - ctx->Driver.IsTextureResident(ctx, obj) : 1;
> + *params = 1;
> break;;
> case GL_TEXTURE_PRIORITY:
> *params = FLOAT_TO_INT(obj->Priority);
More information about the mesa-dev
mailing list