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/texstate.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/texstate.c')
-rw-r--r-- | src/mesa/main/texstate.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 053097cec0e..b9e1a2a687a 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -763,13 +763,13 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 ); /* initialize current texture object ptrs to the shared default objects */ - _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D); - _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D); - _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D); - _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); - _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect); - _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray); - _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray); + _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); + _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); + _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); + _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); + _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); } @@ -798,7 +798,8 @@ _mesa_init_texture(GLcontext *ctx) /* After we're done initializing the context's texture state the default * texture objects' refcounts should be at least MAX_TEXTURE_UNITS + 1. */ - assert(ctx->Shared->Default1D->RefCount >= MAX_TEXTURE_UNITS + 1); + assert(ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount + >= MAX_TEXTURE_UNITS + 1); /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) @@ -855,12 +856,19 @@ _mesa_update_default_objects_texture(GLcontext *ctx) for (i = 0; i < MAX_TEXTURE_UNITS; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D); - _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D); - _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D); - _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); - _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect); - _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray); - _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray); + _mesa_reference_texobj(&texUnit->Current1D, + ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); + _mesa_reference_texobj(&texUnit->Current2D, + ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); + _mesa_reference_texobj(&texUnit->Current3D, + ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, + ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentRect, + ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); + _mesa_reference_texobj(&texUnit->Current1DArray, + ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); + _mesa_reference_texobj(&texUnit->Current2DArray, + ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); } } |