fixed return val bug in glAreTexturesResident()

This commit is contained in:
Brian Paul
2000-08-02 20:16:03 +00:00
parent 6f173cafbd
commit bd0f7f42d6

View File

@@ -1,3 +1,4 @@
/* $Id: texobj.c,v 1.25 2000/08/02 20:16:03 brianp Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -635,41 +636,44 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
* Execute glAreTexturesResident * Execute glAreTexturesResident
*/ */
GLboolean GLboolean
_mesa_AreTexturesResident( GLsizei n, const GLuint *texName, _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
GLboolean *residences ) GLboolean *residences)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLboolean resident = GL_TRUE; GLboolean allResident = GL_TRUE;
GLint i; GLint i;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx,
"glAreTexturesResident", "glAreTexturesResident", GL_FALSE);
GL_FALSE); if (n < 0) {
if (n<0) { gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)" );
return GL_FALSE; return GL_FALSE;
} }
for (i=0;i<n;i++) { for (i = 0; i < n; i++) {
struct gl_texture_object *t; struct gl_texture_object *t;
if (texName[i]==0) { if (texName[i] == 0) {
gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)" ); gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
return GL_FALSE; return GL_FALSE;
} }
t = (struct gl_texture_object *) t = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
if (t) { if (t) {
if (ctx->Driver.IsTextureResident) if (ctx->Driver.IsTextureResident) {
residences[i] = ctx->Driver.IsTextureResident( ctx, t ); residences[i] = ctx->Driver.IsTextureResident(ctx, t);
else if (!residences[i])
allResident = GL_FALSE;
}
else {
residences[i] = GL_TRUE; residences[i] = GL_TRUE;
}
} }
else { else {
gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)" ); gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
return GL_FALSE; return GL_FALSE;
} }
} }
return resident; return allResident;
} }
@@ -683,7 +687,7 @@ _mesa_IsTexture( GLuint texture )
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures", ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
GL_FALSE); GL_FALSE);
if (texture>0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) { if (texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) {
return GL_TRUE; return GL_TRUE;
} }
else { else {