head 3.17; access; symbols merge-1:3.13.2.3 autoconf:3.13.0.4 experimental-1:3.13.0.2 mesa-3-1-with-kw3:3.10 mesa-3-1-prior-to-kw3:3.9; locks; strict; comment @ * @; 3.17 date 99.07.12.14.58.58; author brianp; state Exp; branches; next 3.16; 3.16 date 99.07.12.12.05.25; author keithw; state Exp; branches; next 3.15; 3.15 date 99.06.25.14.09.21; author joukj; state Exp; branches; next 3.14; 3.14 date 99.06.25.01.51.24; author brianp; state Exp; branches; next 3.13; 3.13 date 99.05.16.17.09.59; author keithw; state Exp; branches 3.13.2.1; next 3.12; 3.12 date 99.04.30.13.49.23; author keithw; state Exp; branches; next 3.11; 3.11 date 99.02.26.03.21.54; author brianp; state Exp; branches; next 3.10; 3.10 date 99.02.25.14.12.32; author keithw; state Exp; branches; next 3.9; 3.9 date 99.02.24.22.48.07; author jens; state Exp; branches; next 3.8; 3.8 date 99.02.17.02.36.21; author brianp; state Exp; branches; next 3.7; 3.7 date 98.11.08.22.34.07; author brianp; state Exp; branches; next 3.6; 3.6 date 98.10.31.17.06.15; author brianp; state Exp; branches; next 3.5; 3.5 date 98.04.20.23.55.13; author brianp; state Exp; branches; next 3.4; 3.4 date 98.03.27.04.17.31; author brianp; state Exp; branches; next 3.3; 3.3 date 98.02.27.00.53.52; author brianp; state Exp; branches; next 3.2; 3.2 date 98.02.20.04.53.37; author brianp; state Exp; branches; next 3.1; 3.1 date 98.02.03.04.27.54; author brianp; state Exp; branches; next 3.0; 3.0 date 98.01.31.21.04.38; author brianp; state Exp; branches; next ; 3.13.2.1 date 99.05.21.21.29.27; author keithw; state Exp; branches; next 3.13.2.2; 3.13.2.2 date 99.05.22.19.14.39; author keithw; state Exp; branches; next 3.13.2.3; 3.13.2.3 date 99.06.06.22.35.55; author keithw; state Exp; branches; next ; desc @texture object functions @ 3.17 log @silenced IRIX compiler warnings @ text @/* $Id: texobj.c,v 3.16 1999/07/12 12:05:25 keithw Exp $ */ /* * Mesa 3-D graphics library * Version: 3.1 * * Copyright (C) 1999 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifdef PC_HEADER #include "all.h" #else #include #include #include #include "context.h" #include "enums.h" #include "hash.h" #include "macros.h" #include "teximage.h" #include "texstate.h" #include "texobj.h" #include "types.h" #ifdef XFree86Server #include "GL/xf86glx.h" #endif #endif /* * Allocate a new texture object and add it to the linked list of texture * objects. If name>0 then also insert the new texture object into the hash * table. * Input: shared - the shared GL state structure to contain the texture object * name - integer name for the texture object * dimensions - either 1, 2 or 3 * Return: pointer to new texture object */ struct gl_texture_object * gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, GLuint dimensions) { struct gl_texture_object *obj; assert(dimensions <= 3); obj = (struct gl_texture_object *) calloc(1,sizeof(struct gl_texture_object)); if (obj) { /* init the non-zero fields */ obj->Name = name; obj->Dimensions = dimensions; obj->WrapS = GL_REPEAT; obj->WrapT = GL_REPEAT; obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; obj->MagFilter = GL_LINEAR; obj->MinLod = -1000.0; obj->MaxLod = 1000.0; obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MinMagThresh = 0.0F; obj->Palette[0] = 255; obj->Palette[1] = 255; obj->Palette[2] = 255; obj->Palette[3] = 255; obj->PaletteSize = 1; obj->PaletteIntFormat = GL_RGBA; obj->PaletteFormat = GL_RGBA; /* insert into linked list */ if (shared) { obj->Next = shared->TexObjectList; shared->TexObjectList = obj; } if (name > 0) { /* insert into hash table */ HashInsert(shared->TexObjects, name, obj); } } return obj; } /* * Deallocate a texture object struct and remove it from the given * shared GL state. * Input: shared - the shared GL state to which the object belongs * t - the texture object to delete */ void gl_free_texture_object( struct gl_shared_state *shared, struct gl_texture_object *t ) { struct gl_texture_object *tprev, *tcurr; assert(t); /* Remove t from dirty list so we don't touch free'd memory later. * Test for shared since Proxy texture aren't in global linked list. */ if (shared) gl_remove_texobj_from_dirty_list( shared, t ); /* unlink t from the linked list */ if (shared) { tprev = NULL; tcurr = shared->TexObjectList; while (tcurr) { if (tcurr==t) { if (tprev) { tprev->Next = t->Next; } else { shared->TexObjectList = t->Next; } break; } tprev = tcurr; tcurr = tcurr->Next; } } if (t->Name) { /* remove from hash table */ HashRemove(shared->TexObjects, t->Name); } /* free texture image */ { GLuint i; for (i=0;iImage[i]) { gl_free_texture_image( t->Image[i] ); } } } /* free this object */ free( t ); } /* * Examine a texture object to determine if it is complete or not. * The t->Complete flag will be set to GL_TRUE or GL_FALSE accordingly. */ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_texture_object *t ) { t->Complete = GL_TRUE; /* be optimistic */ /* Always need level zero image */ if (!t->Image[0] || !t->Image[0]->Data) { t->Complete = GL_FALSE; return; } /* Compute number of mipmap levels */ if (t->Dimensions==1) { t->P = t->Image[0]->WidthLog2; } else if (t->Dimensions==2) { t->P = MAX2(t->Image[0]->WidthLog2, t->Image[0]->HeightLog2); } else if (t->Dimensions==3) { GLint max = MAX2(t->Image[0]->WidthLog2, t->Image[0]->HeightLog2); max = MAX2(max, (GLint)(t->Image[0]->DepthLog2)); t->P = max; } /* Compute M (see the 1.2 spec) used during mipmapping */ t->M = (GLfloat) (MIN2(t->MaxLevel, t->P) - t->BaseLevel); if (t->MinFilter!=GL_NEAREST && t->MinFilter!=GL_LINEAR) { /* * Mipmapping: determine if we have a complete set of mipmaps */ GLint i; GLint minLevel = t->BaseLevel; GLint maxLevel = MIN2(t->P, ctx->Const.MaxTextureLevels-1); maxLevel = MIN2(maxLevel, t->MaxLevel); if (minLevel > maxLevel) { t->Complete = GL_FALSE; return; } /* Test dimension-independent attributes */ for (i = minLevel; i <= maxLevel; i++) { if (t->Image[i]) { if (!t->Image[i]->Data) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Format != t->Image[0]->Format) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Border != t->Image[0]->Border) { t->Complete = GL_FALSE; return; } } } /* Test things which depend on number of texture image dimensions */ if (t->Dimensions==1) { /* Test 1-D mipmaps */ GLuint width = t->Image[0]->Width2; for (i=1; iConst.MaxTextureLevels; i++) { if (width>1) { width /= 2; } if (i >= minLevel && i <= maxLevel) { if (!t->Image[i]) { t->Complete = GL_FALSE; return; } if (!t->Image[i]->Data) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Width2 != width ) { t->Complete = GL_FALSE; return; } } if (width==1) { return; /* found smallest needed mipmap, all done! */ } } } else if (t->Dimensions==2) { /* Test 2-D mipmaps */ GLuint width = t->Image[0]->Width2; GLuint height = t->Image[0]->Height2; for (i=1; iConst.MaxTextureLevels; i++) { if (width>1) { width /= 2; } if (height>1) { height /= 2; } if (i >= minLevel && i <= maxLevel) { if (!t->Image[i]) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Width2 != width) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Height2 != height) { t->Complete = GL_FALSE; return; } if (width==1 && height==1) { return; /* found smallest needed mipmap, all done! */ } } } } else if (t->Dimensions==3) { /* Test 3-D mipmaps */ GLuint width = t->Image[0]->Width2; GLuint height = t->Image[0]->Height2; GLuint depth = t->Image[0]->Depth2; for (i=1; iConst.MaxTextureLevels; i++) { if (width>1) { width /= 2; } if (height>1) { height /= 2; } if (depth>1) { depth /= 2; } if (i >= minLevel && i <= maxLevel) { if (!t->Image[i]) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Width2 != width) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Height2 != height) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Depth2 != depth) { t->Complete = GL_FALSE; return; } } if (width==1 && height==1 && depth==1) { return; /* found smallest needed mipmap, all done! */ } } } else { /* Dimensions = ??? */ gl_problem(NULL, "Bug in gl_test_texture_object_completeness\n"); } } } /* * Execute glGenTextures */ void gl_GenTextures( GLcontext *ctx, GLsizei n, GLuint *texName ) { GLuint first; GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGenTextures"); if (n<0) { gl_error( ctx, GL_INVALID_VALUE, "glGenTextures" ); return; } first = HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); /* Return the texture names */ for (i=0;iShared, name, dims); } } /* * Execute glDeleteTextures */ void gl_DeleteTextures( GLcontext *ctx, GLsizei n, const GLuint *texName) { GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures"); for (i=0;i0) { t = (struct gl_texture_object *) HashLookup(ctx->Shared->TexObjects, texName[i]); if (t) { GLuint u; for (u=0; uTexture.Unit[u]; GLuint d; for (d = 1 ; d <= 3 ; d++) { if (unit->CurrentD[d]==t) { unit->CurrentD[d] = ctx->Shared->DefaultD[d][u]; ctx->Shared->DefaultD[d][u]->RefCount++; t->RefCount--; assert( t->RefCount >= 0 ); } } } /* tell device driver to delete texture */ if (ctx->Driver.DeleteTexture) { (*ctx->Driver.DeleteTexture)( ctx, t ); } if (t->RefCount==0) { gl_free_texture_object(ctx->Shared, t); } } } } } /* * Execute glBindTexture */ void gl_BindTexture( GLcontext *ctx, GLenum target, GLuint texName ) { GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *oldTexObj; struct gl_texture_object *newTexObj; GLint dim; if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glBindTexture %s %d\n", gl_lookup_enum_by_nr(target), (GLint) texName); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture"); dim = target - GL_TEXTURE_1D; if (dim < 0 || dim > 2) { gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" ); return; } dim++; oldTexObj = texUnit->CurrentD[dim]; if (oldTexObj->Name == texName) return; if (texName == 0) newTexObj = ctx->Shared->DefaultD[unit][dim]; else { struct HashTable *hash = ctx->Shared->TexObjects; newTexObj = (struct gl_texture_object *) HashLookup(hash, texName); if (!newTexObj) newTexObj = gl_alloc_texture_object(ctx->Shared, texName, dim); if (newTexObj->Dimensions != dim) { if (newTexObj->Dimensions) { gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" ); return; } newTexObj->Dimensions = dim; } } oldTexObj->RefCount--; newTexObj->RefCount++; texUnit->CurrentD[dim] = newTexObj; /* If we've changed the CurrentD[123] texture object then update the * ctx->Texture.Current pointer to point to the new texture object. */ texUnit->Current = texUnit->CurrentD[texUnit->CurrentDimension]; /* Check if we may have to use a new triangle rasterizer */ if ((ctx->IndirectTriangles & DD_SW_RASTERIZE) && ( oldTexObj->WrapS != newTexObj->WrapS || oldTexObj->WrapT != newTexObj->WrapT || oldTexObj->WrapR != newTexObj->WrapR || oldTexObj->MinFilter != newTexObj->MinFilter || oldTexObj->MagFilter != newTexObj->MagFilter || (oldTexObj->Image[0] && newTexObj->Image[0] && (oldTexObj->Image[0]->Format!=newTexObj->Image[0]->Format)))) { ctx->NewState |= (NEW_RASTER_OPS | NEW_TEXTURING); } if (oldTexObj->Complete != newTexObj->Complete) ctx->NewState |= NEW_TEXTURING; /* Pass BindTexture call to device driver */ if (ctx->Driver.BindTexture) { (*ctx->Driver.BindTexture)( ctx, target, newTexObj ); } } /* * Execute glPrioritizeTextures */ void gl_PrioritizeTextures( GLcontext *ctx, GLsizei n, const GLuint *texName, const GLclampf *priorities ) { GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures"); if (n<0) { gl_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" ); return; } for (i=0;i0) { t = (struct gl_texture_object *) HashLookup(ctx->Shared->TexObjects, texName[i]); if (t) { t->Priority = CLAMP( priorities[i], 0.0F, 1.0F ); } } } } /* * Execute glAreTexturesResident */ GLboolean gl_AreTexturesResident( GLcontext *ctx, GLsizei n, const GLuint *texName, GLboolean *residences ) { GLboolean resident = GL_TRUE; GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glAreTexturesResident", GL_FALSE); if (n<0) { gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)" ); return GL_FALSE; } for (i=0;iShared->TexObjects, texName[i]); if (t) { /* we consider all valid texture objects to be resident */ residences[i] = GL_TRUE; } else { gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)" ); return GL_FALSE; } } return resident; } /* * Execute glIsTexture */ GLboolean gl_IsTexture( GLcontext *ctx, GLuint texture ) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures", GL_FALSE); if (texture>0 && HashLookup(ctx->Shared->TexObjects, texture)) { return GL_TRUE; } else { return GL_FALSE; } } @ 3.16 log @merge from experimental branch upto merge-1 tag @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.15 1999/06/25 14:09:21 joukj Exp $ */ d420 1 a420 1 gl_lookup_enum_by_nr(target), texName); @ 3.15 log @ texstate.h included @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.14 1999/06/25 01:51:24 brianp Exp $ */ d381 9 a389 18 if (unit->Current1D==t) { /* revert to default 1-D texture */ unit->Current1D = ctx->Shared->Default1D[u]; t->RefCount--; assert( t->RefCount >= 0 ); } else if (unit->Current2D==t) { /* revert to default 2-D texture */ unit->Current2D = ctx->Shared->Default2D[u]; t->RefCount--; assert( t->RefCount >= 0 ); } else if (unit->Current3D==t) { /* revert to default 3-D texture */ unit->Current3D = ctx->Shared->Default3D[u]; t->RefCount--; assert( t->RefCount >= 0 ); } d412 2 a413 1 struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; d416 1 a416 2 struct gl_texture_object **targetPointer; GLuint targetDimensions; d418 1 a418 1 if (MESA_VERBOSE & VERBOSE_TEXTURE) d423 6 a428 19 switch (target) { case GL_TEXTURE_1D: oldTexObj = texUnit->Current1D; targetPointer = &texUnit->Current1D; targetDimensions = 1; break; case GL_TEXTURE_2D: oldTexObj = texUnit->Current2D; targetPointer = &texUnit->Current2D; targetDimensions = 2; break; case GL_TEXTURE_3D_EXT: oldTexObj = texUnit->Current3D; targetPointer = &texUnit->Current3D; targetDimensions = 3; break; default: gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" ); return; d431 8 a438 17 if (texName==0) { /* use default n-D texture */ switch (target) { case GL_TEXTURE_1D: newTexObj = ctx->Shared->Default1D[ctx->Texture.CurrentUnit]; break; case GL_TEXTURE_2D: newTexObj = ctx->Shared->Default2D[ctx->Texture.CurrentUnit]; break; case GL_TEXTURE_3D_EXT: newTexObj = ctx->Shared->Default3D[ctx->Texture.CurrentUnit]; break; default: gl_problem(ctx, "Bad target in gl_BindTexture"); return; } } d440 12 a451 23 newTexObj = (struct gl_texture_object *) HashLookup(ctx->Shared->TexObjects, texName); if (newTexObj) { if (newTexObj->Dimensions == 0) { /* first time bound */ newTexObj->Dimensions = targetDimensions; } else { /* A small optimization */ if (newTexObj == oldTexObj) return; if (newTexObj->Dimensions != targetDimensions) { /* wrong dimensionality */ gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" ); return; } } } else { /* create new texture object */ newTexObj = gl_alloc_texture_object(ctx->Shared, texName, targetDimensions); d455 3 a457 2 /* Update the Texture.Current[123]D pointer */ *targetPointer = newTexObj; d459 4 a462 10 /* Tidy up reference counting */ if (*targetPointer != oldTexObj && oldTexObj->Name>0) { /* decrement reference count of the prev texture object */ oldTexObj->RefCount--; assert( oldTexObj->RefCount >= 0 ); } if (newTexObj->Name>0) { newTexObj->RefCount++; } d465 9 a473 8 if ( oldTexObj->WrapS != newTexObj->WrapS || oldTexObj->WrapT != newTexObj->WrapT || oldTexObj->WrapR != newTexObj->WrapR || oldTexObj->MinFilter != newTexObj->MinFilter || oldTexObj->MagFilter != newTexObj->MagFilter || (oldTexObj->Image[0] && newTexObj->Image[0] && (oldTexObj->Image[0]->Format!=newTexObj->Image[0]->Format)) || !newTexObj->Complete) { d477 2 a478 6 /* If we've changed the Current[123]D texture object then update the * ctx->Texture.Current pointer to point to the new texture object. */ if (oldTexObj == texUnit->Current) { texUnit->Current = newTexObj; } a479 3 /* The current n-D texture object can never be NULL! */ assert(*targetPointer); @ 3.14 log @implemented linked list for dirty texture objects @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.13 1999/05/16 17:09:59 keithw Exp $ */ d42 1 @ 3.13 log @misc. bug fixes @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.12 1999/04/30 13:49:23 keithw Exp $ */ d119 6 d202 1 a202 1 @ 3.13.2.1 log @Quake3 inspired optimizations @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.13 1999/05/16 17:09:59 keithw Exp $ */ a512 4 if (MESA_VERBOSE & VERBOSE_TEXTURE) fprintf(stderr, "new texture type\n"); @ 3.13.2.2 log @q2, q3 bugfixes @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.13.2.1 1999/05/21 21:29:27 keithw Exp $ */ d420 1 a420 1 if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) @ 3.13.2.3 log @some trial assembly, made newer code active by default @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.13.2.2 1999/05/22 19:14:39 keithw Exp $ */ d374 18 a391 9 GLuint d; for (d = 1 ; d <= 3 ; d++) { if (unit->CurrentD[d]==t) { unit->CurrentD[d] = ctx->Shared->DefaultD[d][u]; ctx->Shared->DefaultD[d][u]->RefCount++; t->RefCount--; assert( t->RefCount >= 0 ); } } d414 1 a414 2 GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; d417 2 a418 1 GLint dim; d425 64 d490 2 a491 1 dim = target - GL_TEXTURE_1D; d493 5 a497 3 if (dim < 0 || dim > 2) { gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" ); return; d500 3 a502 2 dim++; oldTexObj = texUnit->CurrentD[dim]; d504 9 a512 2 if (oldTexObj->Name == texName) return; d514 2 a515 5 if (texName == 0) newTexObj = ctx->Shared->DefaultD[unit][dim]; else { struct HashTable *hash = ctx->Shared->TexObjects; newTexObj = (struct gl_texture_object *) HashLookup(hash, texName); d517 1 a517 10 if (!newTexObj) newTexObj = gl_alloc_texture_object(ctx->Shared, texName, dim); if (newTexObj->Dimensions != dim) { if (newTexObj->Dimensions) { gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" ); return; } newTexObj->Dimensions = dim; } d520 1 a520 5 oldTexObj->RefCount--; newTexObj->RefCount++; texUnit->CurrentD[dim] = newTexObj; /* If we've changed the CurrentD[123] texture object then update the d523 2 a524 13 texUnit->Current = texUnit->CurrentD[texUnit->CurrentDimension]; /* Check if we may have to use a new triangle rasterizer */ if ((ctx->IndirectTriangles & DD_SW_RASTERIZE) && ( oldTexObj->WrapS != newTexObj->WrapS || oldTexObj->WrapT != newTexObj->WrapT || oldTexObj->WrapR != newTexObj->WrapR || oldTexObj->MinFilter != newTexObj->MinFilter || oldTexObj->MagFilter != newTexObj->MagFilter || (oldTexObj->Image[0] && newTexObj->Image[0] && (oldTexObj->Image[0]->Format!=newTexObj->Image[0]->Format)))) { ctx->NewState |= (NEW_RASTER_OPS | NEW_TEXTURING); d527 3 a529 3 if (oldTexObj->Complete != newTexObj->Complete) ctx->NewState |= NEW_TEXTURING; @ 3.12 log @texture completeness problem seen at low lod in q3test @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.11 1999/02/26 03:21:54 brianp Exp $ */ d38 1 d419 4 @ 3.11 log @fixed copyright @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.10 1999/02/25 14:12:32 keithw Exp $ */ d194 2 a195 1 GLint maxLevel = MIN2(t->MaxLevel, ctx->Const.MaxTextureLevels-1); d282 1 a282 1 for (i=1; iConst.MaxTextureLevels; i++) { @ 3.10 log @Merged in kw3 patch @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.9 1999/02/24 22:48:07 jens Exp $ */ d6 19 a24 15 * Copyright (C) 1995-1998 Brian Paul * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @ 3.9 log @Added header file to get XMesa to compile standalone and inside XFree86 @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.8 1999/02/17 02:36:21 brianp Exp $ */ d24 1 a24 30 /* * $Log: texobj.c,v $ * Revision 3.8 1999/02/17 02:36:21 brianp * fixed texture crash bug found in Lament screen saver * * Revision 3.7 1998/11/08 22:34:07 brianp * renamed texture sets to texture units * * Revision 3.6 1998/10/31 17:06:15 brianp * variety of multi-texture changes * * Revision 3.5 1998/04/20 23:55:13 brianp * applied DavidB's changes for v0.25 of 3Dfx driver * * Revision 3.4 1998/03/27 04:17:31 brianp * fixed G++ warnings * * Revision 3.3 1998/02/27 00:53:52 brianp * fixed a few incorrect error messages * * Revision 3.2 1998/02/20 04:53:37 brianp * implemented GL_SGIS_multitexture * * Revision 3.1 1998/02/03 04:27:54 brianp * added texture lod clamping * * Revision 3.0 1998/01/31 21:04:38 brianp * initial rev * */ d327 1 a327 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glGenTextures" ); return; } d357 1 a357 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glDeleteTextures" ); return; } d414 1 a414 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" ); return; } d533 1 a533 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glPrioritizeTextures" ); return; } d563 3 a565 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glAreTexturesResident" ); return GL_FALSE; } d598 2 a599 4 if (INSIDE_BEGIN_END(ctx)) { gl_error( ctx, GL_INVALID_OPERATION, "glIsTextures" ); return GL_FALSE; } @ 3.8 log @fixed texture crash bug found in Lament screen saver @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.7 1998/11/08 22:34:07 brianp Exp brianp $ */ d26 3 d68 3 @ 3.7 log @renamed texture sets to texture units @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.6 1998/10/31 17:06:15 brianp Exp brianp $ */ d26 3 d535 1 a535 1 ctx->NewState |= NEW_RASTER_OPS; @ 3.6 log @variety of multi-texture changes @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.5 1998/04/20 23:55:13 brianp Exp brianp $ */ d26 3 d391 4 a394 4 GLuint texSet; for (texSet=0; texSetTexture.Set[texSet]; if (set->Current1D==t) { d396 1 a396 1 set->Current1D = ctx->Shared->Default1D[texSet]; d400 1 a400 1 else if (set->Current2D==t) { d402 1 a402 1 set->Current2D = ctx->Shared->Default2D[texSet]; d406 1 a406 1 else if (set->Current3D==t) { d408 1 a408 1 set->Current3D = ctx->Shared->Default3D[texSet]; d434 1 a434 1 struct gl_texture_set *texSet = &ctx->Texture.Set[ctx->Texture.CurrentSet]; d446 2 a447 2 oldTexObj = texSet->Current1D; targetPointer = &texSet->Current1D; d451 2 a452 2 oldTexObj = texSet->Current2D; targetPointer = &texSet->Current2D; d456 2 a457 2 oldTexObj = texSet->Current3D; targetPointer = &texSet->Current3D; d469 1 a469 1 newTexObj = ctx->Shared->Default1D[ctx->Texture.CurrentSet]; d472 1 a472 1 newTexObj = ctx->Shared->Default2D[ctx->Texture.CurrentSet]; d475 1 a475 1 newTexObj = ctx->Shared->Default3D[ctx->Texture.CurrentSet]; d538 2 a539 2 if (oldTexObj == texSet->Current) { texSet->Current = newTexObj; @ 3.5 log @applied DavidB's changes for v0.25 of 3Dfx driver @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.4 1998/03/27 04:17:31 brianp Exp brianp $ */ d5 1 a5 1 * Version: 2.8 d26 3 d174 1 a174 1 void gl_test_texture_object_completeness( struct gl_texture_object *t ) d207 1 a207 1 GLint maxLevel = MIN2(t->MaxLevel, MAX_TEXTURE_LEVELS-1); d236 1 a236 1 for (i=1; iDimensions != targetDimensions) { /* wrong dimensionality */ gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" ); return; @ 3.3 log @fixed a few incorrect error messages @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.2 1998/02/20 04:53:37 brianp Exp brianp $ */ d26 3 d187 1 a187 1 max = MAX2(max, t->Image[0]->DepthLog2); d335 2 a336 1 GLuint first, i; d369 1 a369 1 GLuint i; d545 1 a545 1 GLuint i; d578 1 a578 1 GLuint i; @ 3.2 log @implemented GL_SGIS_multitexture @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.1 1998/02/03 04:27:54 brianp Exp brianp $ */ d26 3 d69 1 a69 1 assert(dimensions >= 0 && dimensions <= 3); d368 1 a368 1 gl_error( ctx, GL_INVALID_OPERATION, "glAreTexturesResident" ); d428 1 a428 1 gl_error( ctx, GL_INVALID_OPERATION, "glAreTexturesResident" ); d479 1 a479 1 gl_error( ctx, GL_INVALID_OPERATION, "glBindTextureEXT" ); d544 1 a544 1 gl_error( ctx, GL_INVALID_OPERATION, "glAreTexturesResident" ); d548 1 a548 1 gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)" ); @ 3.1 log @added texture lod clamping @ text @d1 1 a1 1 /* $Id: texobj.c,v 3.0 1998/01/31 21:04:38 brianp Exp brianp $ */ d26 3 d375 21 a395 17 if (ctx->Texture.Current1D==t) { /* revert to default 1-D texture */ ctx->Texture.Current1D = ctx->Shared->Default1D; t->RefCount--; assert( t->RefCount >= 0 ); } else if (ctx->Texture.Current2D==t) { /* revert to default 2-D texture */ ctx->Texture.Current2D = ctx->Shared->Default2D; t->RefCount--; assert( t->RefCount >= 0 ); } else if (ctx->Texture.Current3D==t) { /* revert to default 3-D texture */ ctx->Texture.Current3D = ctx->Shared->Default3D; t->RefCount--; assert( t->RefCount >= 0 ); d418 1 d430 2 a431 2 oldTexObj = ctx->Texture.Current1D; targetPointer = &ctx->Texture.Current1D; d435 2 a436 2 oldTexObj = ctx->Texture.Current2D; targetPointer = &ctx->Texture.Current2D; d440 2 a441 2 oldTexObj = ctx->Texture.Current3D; targetPointer = &ctx->Texture.Current3D; d453 1 a453 1 newTexObj = ctx->Shared->Default1D; d456 1 a456 1 newTexObj = ctx->Shared->Default2D; d459 1 a459 1 newTexObj = ctx->Shared->Default3D; d516 2 a517 2 if (oldTexObj==ctx->Texture.Current) { ctx->Texture.Current = newTexObj; @ 3.0 log @initial rev @ text @d1 1 a1 1 /* $Id$ */ d25 4 a28 1 * $Log$ d75 4 d169 17 d190 8 a197 1 int i; d200 1 a200 1 for (i=1; iImage[i]) { t->Complete = GL_FALSE; return; } if (!t->Image[i]->Data) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Format != t->Image[0]->Format) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Border != t->Image[0]->Border) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Width2 != width ) { t->Complete = GL_FALSE; return; d255 16 a270 14 if (!t->Image[i]) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Width2 != width) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Height2 != height) { t->Complete = GL_FALSE; return; } if (width==1 && height==1) { return; /* found smallest needed mipmap, all done! */ d289 17 a305 15 if (!t->Image[i]) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Width2 != width) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Height2 != height) { t->Complete = GL_FALSE; return; } if (t->Image[i]->Depth2 != depth) { t->Complete = GL_FALSE; return; @