* \param texObj the texture object to delete.
*/
void
-_mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *texObj )
+_mesa_delete_texture_object(struct gl_context *ctx,
+ struct gl_texture_object *texObj)
{
GLuint i, face;
- (void) ctx;
-
/* Set Target to an invalid value. With some assertions elsewhere
* we can try to detect possible use of deleted textures.
*/
/* free the texture images */
for (face = 0; face < 6; face++) {
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
- if (texObj->Image[face][i]) {
- _mesa_delete_texture_image( ctx, texObj->Image[face][i] );
- }
+ if (texObj->Image[face][i]) {
+ _mesa_delete_texture_image( ctx, texObj->Image[face][i] );
+ }
}
}
-
/**
* Copy texture object state from one texture object to another.
* Use for glPush/PopAttrib.
/**
- * Clear all texture images of the given texture object.
+ * Free all texture images of the given texture object.
*
* \param ctx GL context.
* \param t texture object.
* \sa _mesa_clear_texture_image().
*/
void
-_mesa_clear_texture_object(struct gl_context *ctx, struct gl_texture_object *texObj)
+_mesa_clear_texture_object(struct gl_context *ctx,
+ struct gl_texture_object *texObj)
{
GLuint i, j;
maxLevels = ctx->Const.MaxTextureLevels;
}
else if ((t->Target == GL_TEXTURE_2D) ||
- (t->Target == GL_TEXTURE_2D_ARRAY_EXT)) {
+ (t->Target == GL_TEXTURE_2D_ARRAY_EXT)) {
maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
t->Image[0][baseLevel]->HeightLog2);
maxLevels = ctx->Const.MaxTextureLevels;
const GLuint h = t->Image[0][baseLevel]->Height2;
GLuint face;
for (face = 1; face < 6; face++) {
- if (t->Image[face][baseLevel] == NULL ||
- t->Image[face][baseLevel]->Width2 != w ||
- t->Image[face][baseLevel]->Height2 != h) {
- t->_Complete = GL_FALSE;
- incomplete(t, "Cube face missing or mismatched size");
- return;
- }
+ if (t->Image[face][baseLevel] == NULL ||
+ t->Image[face][baseLevel]->Width2 != w ||
+ t->Image[face][baseLevel]->Height2 != h) {
+ t->_Complete = GL_FALSE;
+ incomplete(t, "Cube face missing or mismatched size");
+ return;
+ }
}
}
GLuint width = t->Image[0][baseLevel]->Width2;
GLuint height = t->Image[0][baseLevel]->Height2;
GLuint depth = t->Image[0][baseLevel]->Depth2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
+ for (i = baseLevel + 1; i < maxLevels; i++) {
if (width > 1) {
width /= 2;
}
/* make sure 6 cube faces are consistant */
GLuint width = t->Image[0][baseLevel]->Width2;
GLuint height = t->Image[0][baseLevel]->Height2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
+ for (i = baseLevel + 1; i < maxLevels; i++) {
if (width > 1) {
width /= 2;
}
return;
}
/* check that all six images have same size */
- if (t->Image[face][i]->Width2!=width ||
- t->Image[face][i]->Height2!=height) {
+ if (t->Image[face][i]->Width2 != width ||
+ t->Image[face][i]->Height2 != height) {
t->_Complete = GL_FALSE;
incomplete(t, "CubeMap Image[n][i] bad size");
return;
* read framebuffer. If so, Unbind it.
*/
static void
-unbind_texobj_from_fbo(struct gl_context *ctx, struct gl_texture_object *texObj)
+unbind_texobj_from_fbo(struct gl_context *ctx,
+ struct gl_texture_object *texObj)
{
const GLuint n = (ctx->DrawBuffer == ctx->ReadBuffer) ? 1 : 2;
GLuint i;
* unbind it if so (revert to default textures).
*/
static void
-unbind_texobj_from_texunits(struct gl_context *ctx, struct gl_texture_object *texObj)
+unbind_texobj_from_texunits(struct gl_context *ctx,
+ struct gl_texture_object *texObj)
{
GLuint u, tex;
= _mesa_lookup_texture(ctx, textures[i]);
if (delObj) {
- _mesa_lock_texture(ctx, delObj);
+ _mesa_lock_texture(ctx, delObj);
/* Check if texture is bound to any framebuffer objects.
* If so, unbind.
*/
unbind_texobj_from_texunits(ctx, delObj);
- _mesa_unlock_texture(ctx, delObj);
+ _mesa_unlock_texture(ctx, delObj);
ctx->NewState |= _NEW_TEXTURE;
}
else {
/* if this is a new texture id, allocate a texture object now */
- newTexObj = (*ctx->Driver.NewTextureObject)(ctx, texName, target);
+ newTexObj = (*ctx->Driver.NewTextureObject)(ctx, texName, target);
if (!newTexObj) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
return;
ctx->NewState |= _NEW_TEXTURE;
}
+
+
/**
* See if textures are loaded in texture memory.
*
if (!ctx->Driver.IsTextureResident ||
ctx->Driver.IsTextureResident(ctx, t)) {
/* The texture is resident */
- if (!allResident)
- residences[i] = GL_TRUE;
+ 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;
+ allResident = GL_FALSE;
+ for (j = 0; j < i; j++)
+ residences[j] = GL_TRUE;
+ }
+ residences[i] = GL_FALSE;
}
}
return allResident;
}
+
/**
* See if a name corresponds to a texture.
*
}
/*@}*/
-
-