diff options
author | Brian Paul <[email protected]> | 2009-02-21 13:59:29 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-02-21 13:59:29 -0700 |
commit | 4d24b639d160fe485a3e8f7395e7654538be29e0 (patch) | |
tree | 189413bbaf62937bdcf8ca65c80bb0fb559d43ed /src/mesa/main/texobj.c | |
parent | 9705cff2033f1771a39ac3bb78eb5fcea522218a (diff) |
mesa: use an array for default texture objects
Replace Default1D/2D/3D/Cube/etc with DefaultTex[TEXTURE_x_INDEX].
The same should be done with the Current1D/2D/3D/etc pointers...
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index b4e30c8bb72..52a651c4b69 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -764,31 +764,38 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; if (texObj == unit->Current1D) { - _mesa_reference_texobj(&unit->Current1D, ctx->Shared->Default1D); + _mesa_reference_texobj(&unit->Current1D, + ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); ASSERT(unit->Current1D); } else if (texObj == unit->Current2D) { - _mesa_reference_texobj(&unit->Current2D, ctx->Shared->Default2D); + _mesa_reference_texobj(&unit->Current2D, + ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); ASSERT(unit->Current2D); } else if (texObj == unit->Current3D) { - _mesa_reference_texobj(&unit->Current3D, ctx->Shared->Default3D); + _mesa_reference_texobj(&unit->Current3D, + ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); ASSERT(unit->Current3D); } else if (texObj == unit->CurrentCubeMap) { - _mesa_reference_texobj(&unit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); + _mesa_reference_texobj(&unit->CurrentCubeMap, + ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); ASSERT(unit->CurrentCubeMap); } else if (texObj == unit->CurrentRect) { - _mesa_reference_texobj(&unit->CurrentRect, ctx->Shared->DefaultRect); + _mesa_reference_texobj(&unit->CurrentRect, + ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); ASSERT(unit->CurrentRect); } else if (texObj == unit->Current1DArray) { - _mesa_reference_texobj(&unit->Current1DArray, ctx->Shared->Default1DArray); + _mesa_reference_texobj(&unit->Current1DArray, + ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); ASSERT(unit->Current1DArray); } else if (texObj == unit->Current2DArray) { - _mesa_reference_texobj(&unit->Current2DArray, ctx->Shared->Default2DArray); + _mesa_reference_texobj(&unit->Current2DArray, + ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); ASSERT(unit->Current2DArray); } } @@ -889,25 +896,25 @@ _mesa_BindTexture( GLenum target, GLuint texName ) switch (target) { case GL_TEXTURE_1D: - defaultTexObj = ctx->Shared->Default1D; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]; break; case GL_TEXTURE_2D: - defaultTexObj = ctx->Shared->Default2D; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]; break; case GL_TEXTURE_3D: - defaultTexObj = ctx->Shared->Default3D; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]; break; case GL_TEXTURE_CUBE_MAP_ARB: - defaultTexObj = ctx->Shared->DefaultCubeMap; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]; break; case GL_TEXTURE_RECTANGLE_NV: - defaultTexObj = ctx->Shared->DefaultRect; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]; break; case GL_TEXTURE_1D_ARRAY_EXT: - defaultTexObj = ctx->Shared->Default1DArray; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]; break; case GL_TEXTURE_2D_ARRAY_EXT: - defaultTexObj = ctx->Shared->Default2DArray; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); |