diff options
author | Brian Paul <[email protected]> | 2009-01-21 08:18:07 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-01-21 08:18:07 -0700 |
commit | 4683cab29a74d6b3cefdd915aaf91e6b4f667d27 (patch) | |
tree | 51f2a2276061f081f1e893ed83101c75a1d246eb /src/mesa/main/texobj.c | |
parent | 787a001a6774e6fe80623159f32155ce12002a9f (diff) |
mesa: add some debug assertions to detect null current texture object pointers
See bug #17895. These assertions could be removed when this is resolved.
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d8e8b559f53..7848f0be354 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -762,24 +762,31 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; if (texObj == unit->Current1D) { _mesa_reference_texobj(&unit->Current1D, ctx->Shared->Default1D); + ASSERT(unit->Current1D); } else if (texObj == unit->Current2D) { _mesa_reference_texobj(&unit->Current2D, ctx->Shared->Default2D); + ASSERT(unit->Current2D); } else if (texObj == unit->Current3D) { _mesa_reference_texobj(&unit->Current3D, ctx->Shared->Default3D); + ASSERT(unit->Current3D); } else if (texObj == unit->CurrentCubeMap) { _mesa_reference_texobj(&unit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); + ASSERT(unit->CurrentCubeMap); } else if (texObj == unit->CurrentRect) { _mesa_reference_texobj(&unit->CurrentRect, ctx->Shared->DefaultRect); + ASSERT(unit->CurrentRect); } else if (texObj == unit->Current1DArray) { _mesa_reference_texobj(&unit->Current1DArray, ctx->Shared->Default1DArray); + ASSERT(unit->Current1DArray); } else if (texObj == unit->Current2DArray) { _mesa_reference_texobj(&unit->Current2DArray, ctx->Shared->Default2DArray); + ASSERT(unit->Current2DArray); } } } @@ -953,24 +960,31 @@ _mesa_BindTexture( GLenum target, GLuint texName ) switch (target) { case GL_TEXTURE_1D: _mesa_reference_texobj(&texUnit->Current1D, newTexObj); + ASSERT(texUnit->Current1D); break; case GL_TEXTURE_2D: _mesa_reference_texobj(&texUnit->Current2D, newTexObj); + ASSERT(texUnit->Current2D); break; case GL_TEXTURE_3D: _mesa_reference_texobj(&texUnit->Current3D, newTexObj); + ASSERT(texUnit->Current3D); break; case GL_TEXTURE_CUBE_MAP_ARB: _mesa_reference_texobj(&texUnit->CurrentCubeMap, newTexObj); + ASSERT(texUnit->CurrentCubeMap); break; case GL_TEXTURE_RECTANGLE_NV: _mesa_reference_texobj(&texUnit->CurrentRect, newTexObj); + ASSERT(texUnit->CurrentRect); break; case GL_TEXTURE_1D_ARRAY_EXT: texUnit->Current1DArray = newTexObj; + ASSERT(texUnit->Current1DArray); break; case GL_TEXTURE_2D_ARRAY_EXT: texUnit->Current2DArray = newTexObj; + ASSERT(texUnit->Current2DArray); break; default: /* Bad target should be caught above */ |