summaryrefslogtreecommitdiff
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2000-12-26 05:09:27 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2000-12-26 05:09:27 +0000
commitcab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290 (patch)
tree45385bd755d8e3876c54b2b0113636f5ceb7976a /src/mesa/main/texobj.c
parentd1ff1f6798b003a820f5de9fad835ff352f31afe (diff)
Major rework of tnl module
New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges.
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r--src/mesa/main/texobj.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 68ce55b738..1204668dc3 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.36 2000/12/14 20:25:56 brianp Exp $ */
+/* $Id: texobj.c,v 1.37 2000/12/26 05:09:29 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -420,8 +420,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName )
GET_CURRENT_CONTEXT(ctx);
GLuint first;
GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGenTextures");
if (n < 0) {
gl_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
return;
@@ -462,8 +462,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName)
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures");
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */
if (!texName)
return;
@@ -525,13 +524,12 @@ _mesa_BindTexture( GLenum target, GLuint texName )
struct gl_texture_object *oldTexObj;
struct gl_texture_object *newTexObj;
GLuint targetDim;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
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");
-
switch (target) {
case GL_TEXTURE_1D:
targetDim = 1;
@@ -607,7 +605,11 @@ _mesa_BindTexture( GLenum target, GLuint texName )
newTexObj->RefCount++;
- /* do the actual binding */
+
+ /* do the actual binding, but first flush outstanding vertices:
+ */
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+
switch (target) {
case GL_TEXTURE_1D:
texUnit->Current1D = newTexObj;
@@ -625,8 +627,6 @@ _mesa_BindTexture( GLenum target, GLuint texName )
gl_problem(ctx, "bad target in BindTexture");
}
- ctx->NewState |= _NEW_TEXTURE;
-
/* Pass BindTexture call to device driver */
if (ctx->Driver.BindTexture)
(*ctx->Driver.BindTexture)( ctx, target, newTexObj );
@@ -654,8 +654,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures");
if (n < 0) {
gl_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
return;
@@ -691,9 +691,8 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName,
GET_CURRENT_CONTEXT(ctx);
GLboolean allResident = GL_TRUE;
GLint i;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- 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;
@@ -737,13 +736,7 @@ GLboolean
_mesa_IsTexture( GLuint texture )
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures",
- GL_FALSE);
- if (texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+ return texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture);
}