summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/texenv.c16
-rw-r--r--src/mesa/main/texgetimage.c19
-rw-r--r--src/mesa/main/teximage.c52
-rw-r--r--src/mesa/main/texparam.c9
-rw-r--r--src/mesa/main/texstate.h18
5 files changed, 53 insertions, 61 deletions
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 4c04a7ed375..1eab78c74ce 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -35,6 +35,7 @@
#include "main/enums.h"
#include "main/macros.h"
#include "main/texenv.h"
+#include "main/texstate.h"
#define TE_ERROR(errCode, msg, value) \
@@ -466,7 +467,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
return;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
if (target == GL_TEXTURE_ENV) {
switch (pname) {
@@ -793,7 +794,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
return;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
if (target == GL_TEXTURE_ENV) {
if (pname == GL_TEXTURE_ENV_COLOR) {
@@ -857,7 +858,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
return;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
if (target == GL_TEXTURE_ENV) {
if (pname == GL_TEXTURE_ENV_COLOR) {
@@ -936,7 +937,8 @@ _mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param )
ASSERT_OUTSIDE_BEGIN_END(ctx);
/* should return error if extension not supported? */
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ texUnit = _mesa_get_current_tex_unit(ctx);
if (pname == GL_BUMP_ROT_MATRIX_ATI) {
if (TEST_EQ_4V(param, texUnit->RotMatrix))
@@ -965,7 +967,8 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
ASSERT_OUTSIDE_BEGIN_END(ctx);
/* should return error if extension not supported? */
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ texUnit = _mesa_get_current_tex_unit(ctx);
if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
/* spec leaves open to support larger matrices.
@@ -1012,7 +1015,8 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
ASSERT_OUTSIDE_BEGIN_END(ctx);
/* should return error if extension not supported? */
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+
+ texUnit = _mesa_get_current_tex_unit(ctx);
if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
/* spec leaves open to support larger matrices.
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 8800ee22ea6..2d3b82dd387 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -37,6 +37,7 @@
#include "texformat.h"
#include "texgetimage.h"
#include "teximage.h"
+#include "texstate.h"
@@ -107,18 +108,6 @@ type_with_negative_values(GLenum type)
/**
- * Return pointer to current texture unit.
- * This the texture unit set by glActiveTexture(), not glClientActiveTexture().
- */
-static INLINE struct gl_texture_unit *
-get_current_tex_unit(GLcontext *ctx)
-{
- ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->Texture.Unit));
- return &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
-}
-
-
-/**
* This is the software fallback for Driver.GetTexImage().
* All error checking will have been done before this routine is called.
*/
@@ -429,7 +418,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
return GL_TRUE;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
if (!texObj || _mesa_is_proxy_texture(target)) {
@@ -519,7 +508,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
return;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -545,7 +534,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img)
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
if (!texObj) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB");
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 56d37904088..19e47b460fc 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -576,18 +576,6 @@ _mesa_is_proxy_texture(GLenum target)
/**
- * Return pointer to current texture unit.
- * This the texture unit set by glActiveTexture(), not glClientActiveTexture().
- */
-static INLINE struct gl_texture_unit *
-get_current_tex_unit(GLcontext *ctx)
-{
- ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->Texture.Unit));
- return &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
-}
-
-
-/**
* Get the texture object that corresponds to the target of the given texture unit.
*
* \param ctx GL context.
@@ -2163,7 +2151,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -2271,7 +2259,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -2374,7 +2362,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
_mesa_update_state(ctx);
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -2480,7 +2468,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
assert(texObj);
@@ -2540,7 +2528,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
return; /* error was detected */
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -2592,7 +2580,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level,
return; /* error was detected */
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -2653,7 +2641,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
postConvWidth, 1, border))
return;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -2719,7 +2707,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
postConvWidth, postConvHeight, border))
return;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -2779,7 +2767,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
if (copytexsubimage_error_check1(ctx, 1, target, level))
return;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -2834,7 +2822,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
if (copytexsubimage_error_check1(ctx, 2, target, level))
return;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -2889,7 +2877,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
if (copytexsubimage_error_check1(ctx, 3, target, level))
return;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -3143,7 +3131,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
return;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -3197,7 +3185,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -3240,7 +3228,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
return;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -3296,7 +3284,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
@@ -3336,7 +3324,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
return;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -3390,7 +3378,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -3429,7 +3417,7 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
return;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -3486,7 +3474,7 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
return;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
@@ -3543,7 +3531,7 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
return;
}
- texUnit = get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
{
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d27c59381c5..d9ba6007a0b 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -38,6 +38,7 @@
#include "main/texcompress.h"
#include "main/texparam.h"
#include "main/teximage.h"
+#include "main/texstate.h"
#include "shader/prog_instruction.h"
@@ -88,7 +89,7 @@ get_texobj(GLcontext *ctx, GLenum target)
return NULL;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
switch (target) {
case GL_TEXTURE_1D:
@@ -773,7 +774,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
return;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
/* this will catch bad target values */
dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */
@@ -1002,7 +1003,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
return;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
@@ -1169,7 +1170,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
return;
}
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ texUnit = _mesa_get_current_tex_unit(ctx);
obj = _mesa_select_tex_object(ctx, texUnit, target);
if (!obj) {
diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h
index a7d7088c621..17ac68000c5 100644
--- a/src/mesa/main/texstate.h
+++ b/src/mesa/main/texstate.h
@@ -35,6 +35,18 @@
#include "mtypes.h"
+/**
+ * Return pointer to current texture unit.
+ * This the texture unit set by glActiveTexture(), not glClientActiveTexture().
+ */
+static INLINE struct gl_texture_unit *
+_mesa_get_current_tex_unit(GLcontext *ctx)
+{
+ ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->Texture.Unit));
+ return &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
+}
+
+
extern void
_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst );
@@ -48,16 +60,14 @@ _mesa_print_texunit_state( GLcontext *ctx, GLuint unit );
*/
/*@{*/
-
-/*
- * GL_ARB_multitexture
- */
extern void GLAPIENTRY
_mesa_ActiveTextureARB( GLenum target );
extern void GLAPIENTRY
_mesa_ClientActiveTextureARB( GLenum target );
+/*@}*/
+
/**
* \name Initialization, state maintenance