fix/improve glAreTextures/ProgramsResident (Jose Fonseca)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: nvprogram.c,v 1.6 2003/02/27 19:00:00 kschultz Exp $ */
|
/* $Id: nvprogram.c,v 1.7 2003/03/10 00:26:24 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -437,8 +437,8 @@ _mesa_GenProgramsNV(GLsizei n, GLuint *ids)
|
|||||||
GLboolean _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
|
GLboolean _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
|
||||||
GLboolean *residences)
|
GLboolean *residences)
|
||||||
{
|
{
|
||||||
GLint i;
|
GLint i, j;
|
||||||
GLboolean retVal = GL_TRUE;
|
GLboolean allResident = GL_TRUE;
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||||
|
|
||||||
@@ -448,36 +448,32 @@ GLboolean _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
struct program *prog;
|
const struct program *prog;
|
||||||
|
|
||||||
if (ids[i] == 0) {
|
if (ids[i] == 0) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(id=0)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
prog = (const struct program *)
|
||||||
prog = (struct program *)
|
|
||||||
_mesa_HashLookup(ctx->Shared->Programs, ids[i]);
|
_mesa_HashLookup(ctx->Shared->Programs, ids[i]);
|
||||||
if (!prog) {
|
if (!prog) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(id)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
if (prog->Resident) {
|
||||||
if (!prog->Resident) {
|
if (!allResident)
|
||||||
retVal = GL_FALSE;
|
residences[i] = GL_TRUE;
|
||||||
break;
|
}
|
||||||
|
else {
|
||||||
|
if (allResident) {
|
||||||
|
allResident = GL_FALSE;
|
||||||
|
for (j = 0; j < i; j++)
|
||||||
|
residences[j] = GL_TRUE;
|
||||||
|
}
|
||||||
|
residences[i] = GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only write to residences if returning false! */
|
return allResident;
|
||||||
if (retVal == GL_FALSE) {
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
const struct program *prog = (const struct program *)
|
|
||||||
_mesa_HashLookup(ctx->Shared->Programs, ids[i]);
|
|
||||||
residences[i] = prog->Resident;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: texobj.c,v 1.65 2003/01/14 04:55:46 brianp Exp $ */
|
/* $Id: texobj.c,v 1.66 2003/03/10 00:26:24 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -816,7 +816,7 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
|
|||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
GLboolean allResident = GL_TRUE;
|
GLboolean allResident = GL_TRUE;
|
||||||
GLint i;
|
GLint i, j;
|
||||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||||
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
@@ -830,26 +830,32 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
|
|||||||
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) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
|
_mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident");
|
||||||
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) {
|
_mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident");
|
||||||
residences[i] = ctx->Driver.IsTextureResident(ctx, t);
|
|
||||||
if (!residences[i])
|
|
||||||
allResident = GL_FALSE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
residences[i] = GL_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
|
|
||||||
return GL_FALSE;
|
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;
|
return allResident;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user