summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/meta.c18
-rw-r--r--src/mesa/drivers/dri/i915/i830_texblend.c3
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_util.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_context.c14
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_frag.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_frag.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tex.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tex.c3
-rw-r--r--src/mesa/drivers/dri/r200/r200_tex.c3
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c31
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_maos_verts.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c13
-rw-r--r--src/mesa/main/attrib.c17
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/enable.c23
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp3
-rw-r--r--src/mesa/main/ffvertex_prog.c3
-rw-r--r--src/mesa/main/get.c7
-rw-r--r--src/mesa/main/get_hash_params.py10
-rw-r--r--src/mesa/main/mtypes.h40
-rw-r--r--src/mesa/main/rastpos.c5
-rw-r--r--src/mesa/main/texenv.c40
-rw-r--r--src/mesa/main/texgen.c18
-rw-r--r--src/mesa/main/texstate.c83
-rw-r--r--src/mesa/main/texstate.h15
-rw-r--r--src/mesa/program/prog_statevars.c20
-rw-r--r--src/mesa/swrast/s_context.c2
-rw-r--r--src/mesa/swrast/s_texcombine.c3
-rw-r--r--src/mesa/swrast/s_triangle.c10
-rw-r--r--src/mesa/tnl/t_vb_texgen.c10
32 files changed, 250 insertions, 174 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index a7dd139500f..cd898e26f6f 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -631,14 +631,14 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
GLuint u, tgt;
save->ActiveUnit = ctx->Texture.CurrentUnit;
- save->EnvMode = ctx->Texture.Unit[0].EnvMode;
+ save->EnvMode = ctx->Texture.FixedFuncUnit[0].EnvMode;
/* Disable all texture units */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled;
- save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled;
- if (ctx->Texture.Unit[u].Enabled ||
- ctx->Texture.Unit[u].TexGenEnabled) {
+ save->TexEnabled[u] = ctx->Texture.FixedFuncUnit[u].Enabled;
+ save->TexGenEnabled[u] = ctx->Texture.FixedFuncUnit[u].TexGenEnabled;
+ if (ctx->Texture.FixedFuncUnit[u].Enabled ||
+ ctx->Texture.FixedFuncUnit[u].TexGenEnabled) {
_mesa_ActiveTexture(GL_TEXTURE0 + u);
_mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
if (ctx->Extensions.ARB_texture_cube_map)
@@ -1065,14 +1065,14 @@ _mesa_meta_end(struct gl_context *ctx)
/* Restore fixed function texture enables, texgen */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- if (ctx->Texture.Unit[u].Enabled != save->TexEnabled[u]) {
+ if (ctx->Texture.FixedFuncUnit[u].Enabled != save->TexEnabled[u]) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.Unit[u].Enabled = save->TexEnabled[u];
+ ctx->Texture.FixedFuncUnit[u].Enabled = save->TexEnabled[u];
}
- if (ctx->Texture.Unit[u].TexGenEnabled != save->TexGenEnabled[u]) {
+ if (ctx->Texture.FixedFuncUnit[u].TexGenEnabled != save->TexGenEnabled[u]) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- ctx->Texture.Unit[u].TexGenEnabled = save->TexGenEnabled[u];
+ ctx->Texture.FixedFuncUnit[u].TexGenEnabled = save->TexGenEnabled[u];
}
}
diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c
index 15d6d54a795..390a54f917f 100644
--- a/src/mesa/drivers/dri/i915/i830_texblend.c
+++ b/src/mesa/drivers/dri/i915/i830_texblend.c
@@ -388,7 +388,8 @@ static void
emit_texblend(struct i830_context *i830, GLuint unit, GLuint blendUnit,
bool last_stage)
{
- struct gl_texture_unit *texUnit = &i830->intel.ctx.Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &i830->intel.ctx.Texture.FixedFuncUnit[unit];
GLuint tmp[I830_TEXBLEND_SIZE], tmp_sz;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index 8087445b65a..088a2563766 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -193,7 +193,7 @@ is_texture_source(int s)
}
static inline struct gl_texgen *
-get_texgen_coord(struct gl_texture_unit *u, int i)
+get_texgen_coord(struct gl_fixedfunc_texture_unit *u, int i)
{
return ((struct gl_texgen *[])
{ &u->GenS, &u->GenT, &u->GenR, &u->GenQ }) [i];
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 4dbb950e9ab..324595e2403 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -32,17 +32,18 @@
#include "nv04_driver.h"
static GLboolean
-texunit_needs_combiners(struct gl_texture_unit *u)
+texunit_needs_combiners(struct gl_texture_unit *u,
+ struct gl_fixedfunc_texture_unit *f)
{
struct gl_texture_object *t = u->_Current;
struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
return ti->TexFormat == MESA_FORMAT_A_UNORM8 ||
ti->TexFormat == MESA_FORMAT_L_UNORM8 ||
- u->EnvMode == GL_COMBINE ||
- u->EnvMode == GL_COMBINE4_NV ||
- u->EnvMode == GL_BLEND ||
- u->EnvMode == GL_ADD;
+ f->EnvMode == GL_COMBINE ||
+ f->EnvMode == GL_COMBINE4_NV ||
+ f->EnvMode == GL_BLEND ||
+ f->EnvMode == GL_ADD;
}
struct nouveau_object *
@@ -54,7 +55,8 @@ nv04_context_engine(struct gl_context *ctx)
struct nouveau_object *fahrenheit;
if ((ctx->Texture.Unit[0]._Current &&
- texunit_needs_combiners(&ctx->Texture.Unit[0])) ||
+ texunit_needs_combiners(&ctx->Texture.Unit[0],
+ &ctx->Texture.FixedFuncUnit[0])) ||
ctx->Texture.Unit[1]._Current ||
ctx->Stencil.Enabled ||
GET_COLORMASK(ctx->Color.ColorMask, 0) != 0xf)
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index bfe8eaea123..26e2e91a6e0 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -64,7 +64,7 @@ struct combiner_state {
* context. */
#define INIT_COMBINER(chan, ctx, rc, i) do { \
struct gl_tex_env_combine_state *c = \
- ctx->Texture.Unit[i]._CurrentCombine; \
+ ctx->Texture.FixedFuncUnit[i]._CurrentCombine; \
(rc)->ctx = ctx; \
(rc)->unit = i; \
(rc)->alpha = __INIT_COMBINER_ALPHA_##chan; \
@@ -287,7 +287,7 @@ nv04_emit_tex_env(struct gl_context *ctx, int emit)
/* calculate non-multitex state */
nv04->blend &= ~NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP__MASK;
if (ctx->Texture._MaxEnabledTexImageUnit != -1)
- nv04->blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
+ nv04->blend |= get_texenv_mode(ctx->Texture.FixedFuncUnit[0].EnvMode);
else
nv04->blend |= get_texenv_mode(GL_MODULATE);
@@ -295,5 +295,5 @@ nv04_emit_tex_env(struct gl_context *ctx, int emit)
nv04->alpha[i] = rc_a.hw;
nv04->color[i] = rc_c.hw;
nv04->factor = pack_rgba_f(MESA_FORMAT_B8G8R8A8_UNORM,
- ctx->Texture.Unit[0].EnvColor);
+ ctx->Texture.FixedFuncUnit[0].EnvColor);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index 42dff085ca5..27400d3ebdc 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -80,7 +80,7 @@ struct combiner_state {
* context. */
#define INIT_COMBINER(chan, ctx, rc, i) do { \
struct gl_tex_env_combine_state *c = \
- ctx->Texture.Unit[i]._CurrentCombine; \
+ ctx->Texture.FixedFuncUnit[i]._CurrentCombine; \
(rc)->ctx = ctx; \
(rc)->unit = i; \
(rc)->premodulate = c->_NumArgs##chan == 4; \
@@ -332,7 +332,7 @@ nv10_get_general_combiner(struct gl_context *ctx, int i,
}
*k = pack_rgba_f(MESA_FORMAT_B8G8R8A8_UNORM,
- ctx->Texture.Unit[i].EnvColor);
+ ctx->Texture.FixedFuncUnit[i].EnvColor);
*a_in = rc_a.in;
*a_out = rc_a.out;
*c_in = rc_c.in;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index d85adfa9cf7..d741d416673 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -39,7 +39,8 @@ nv10_emit_tex_gen(struct gl_context *ctx, int emit)
const int i = emit - NOUVEAU_STATE_TEX_GEN0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_pushbuf *push = context_push(ctx);
- struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *unit =
+ &ctx->Texture.FixedFuncUnit[i];
int j;
for (j = 0; j < 4; j++) {
@@ -73,7 +74,7 @@ nv10_emit_tex_mat(struct gl_context *ctx, int emit)
if (nctx->fallback == HWTNL &&
((ctx->Texture._TexMatEnabled & 1 << i) ||
- ctx->Texture.Unit[i]._GenFlags)) {
+ ctx->Texture.FixedFuncUnit[i]._GenFlags)) {
BEGIN_NV04(push, NV10_3D(TEX_MATRIX_ENABLE(i)), 1);
PUSH_DATA (push, 1);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index 72df81476c5..9960ae0d449 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -39,7 +39,8 @@ nv20_emit_tex_gen(struct gl_context *ctx, int emit)
const int i = emit - NOUVEAU_STATE_TEX_GEN0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_pushbuf *push = context_push(ctx);
- struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *unit =
+ &ctx->Texture.FixedFuncUnit[i];
int j;
for (j = 0; j < 4; j++) {
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 0696c0dc683..1b217b9ed2b 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -297,7 +297,8 @@ static void r200TexEnv( struct gl_context *ctx, GLenum target,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
radeon_print(RADEON_TEXTURE | RADEON_STATE, RADEON_VERBOSE, "%s( %s )\n",
__func__, _mesa_enum_to_string( pname ) );
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index dcf211f521e..60a20071d97 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -217,7 +217,9 @@ do { \
static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slot, GLuint replaceargs )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_texture_unit *rtexUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint color_combine, alpha_combine;
GLuint color_scale = rmesa->hw.pix[slot].cmd[PIX_PP_TXCBLEND2] &
~(R200_TXC_SCALE_MASK | R200_TXC_OUTPUT_REG_MASK | R200_TXC_TFACTOR_SEL_MASK |
@@ -244,7 +246,7 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
(unit << R200_TXA_TFACTOR_SEL_SHIFT) |
(replaceargs << R200_TXA_TFACTOR1_SEL_SHIFT);
- if ( !texUnit->_Current ) {
+ if ( !rtexUnit->_Current ) {
assert( unit == 0);
color_combine = R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO
| R200_TXC_ARG_C_DIFFUSE_COLOR | R200_TXC_OP_MADD;
@@ -261,9 +263,9 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
const GLint replaceoprgb =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->OperandRGB[0] - GL_SRC_COLOR;
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->OperandRGB[0] - GL_SRC_COLOR;
const GLint replaceopa =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->OperandA[0] - GL_SRC_ALPHA;
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->OperandA[0] - GL_SRC_ALPHA;
/* Step 1:
* Extract the color and alpha combine function arguments.
@@ -286,7 +288,7 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
case GL_PREVIOUS:
if (replaceargs != unit) {
const GLint srcRGBreplace =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->SourceRGB[0];
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->SourceRGB[0];
if (op >= 2) {
op = op ^ replaceopa;
}
@@ -373,7 +375,7 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
case GL_PREVIOUS:
if (replaceargs != unit) {
const GLint srcAreplace =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->SourceA[0];
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->SourceA[0];
op = op ^ replaceopa;
switch (srcAreplace) {
case GL_TEXTURE:
@@ -771,7 +773,9 @@ static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx )
stageref[maxunitused + 1] = REF_COLOR | REF_ALPHA;
for ( j = maxunitused; j >= 0; j-- ) {
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[j];
+ const struct gl_texture_unit *rtexUnit = &ctx->Texture.Unit[j];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[j];
rmesa->state.texture.unit[j].outputreg = -1;
@@ -793,7 +797,7 @@ static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx )
nextunit[j] = currentnext;
- if (!texUnit->_Current) {
+ if (!rtexUnit->_Current) {
/* the not enabled stages are referenced "indirectly",
must not cut off the lower stages */
stageref[j] = REF_COLOR | REF_ALPHA;
@@ -880,10 +884,10 @@ static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx )
if (ctx->Texture.Unit[i]._Current && stageref[i+1]) {
GLuint replaceunit = i;
/* try to optimize GL_REPLACE away (only one level deep though) */
- if ( (ctx->Texture.Unit[i]._CurrentCombine->ModeRGB == GL_REPLACE) &&
- (ctx->Texture.Unit[i]._CurrentCombine->ModeA == GL_REPLACE) &&
- (ctx->Texture.Unit[i]._CurrentCombine->ScaleShiftRGB == 0) &&
- (ctx->Texture.Unit[i]._CurrentCombine->ScaleShiftA == 0) &&
+ if ( (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ModeRGB == GL_REPLACE) &&
+ (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ModeA == GL_REPLACE) &&
+ (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ScaleShiftRGB == 0) &&
+ (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ScaleShiftA == 0) &&
(nextunit[i] > 0) ) {
/* yippie! can optimize it away! */
replaceunit = i;
@@ -1086,7 +1090,8 @@ static GLuint r200_need_dis_texgen(const GLbitfield texGenEnabled,
static GLboolean r200_validate_texgen( struct gl_context *ctx, GLuint unit )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit*4;
GLuint tgi, tgcm;
GLuint mode = 0;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
index 9a778506205..c9c91f8640c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
@@ -352,7 +352,7 @@ void radeonEmitArrays( struct gl_context *ctx, GLuint inputs )
req |= RADEON_Q_BIT(unit);
vtx |= RADEON_Q_BIT(unit);
}
- if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
+ if ( (ctx->Texture.FixedFuncUnit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
vtx |= RADEON_Q_BIT(unit);
else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) &&
(!ctx->Texture.Unit[unit]._Current ||
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index e413df3542e..58d8fc54b79 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1890,7 +1890,7 @@ static void update_texturematrix( struct gl_context *ctx )
if (needMatrix) {
rmesa->NeedTexMatrix |= 1 << unit;
radeonUploadTexMatrix( rmesa, unit,
- !ctx->Texture.Unit[unit].TexGenEnabled );
+ !ctx->Texture.FixedFuncUnit[unit].TexGenEnabled );
}
}
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c
index b4964f13cdf..da5d469e04c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -257,7 +257,8 @@ static void radeonTexEnv( struct gl_context *ctx, GLenum target,
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
if ( RADEON_DEBUG & RADEON_STATE ) {
fprintf( stderr, "%s( %s )\n",
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index 5cabba1227f..47eac855c66 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -208,7 +208,9 @@ texture_base_format(const struct gl_texture_object *t)
static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_texture_unit *rtexUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint color_combine, alpha_combine;
const GLuint color_combine0 = RADEON_COLOR_ARG_A_ZERO | RADEON_COLOR_ARG_B_ZERO
| RADEON_COLOR_ARG_C_CURRENT_COLOR | RADEON_BLEND_CTL_ADD
@@ -234,7 +236,7 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
rmesa->state.texture.unit[unit].format = 0;
rmesa->state.texture.unit[unit].envMode = 0;
- if ( !texUnit->_Current ) {
+ if ( !rtexUnit->_Current ) {
color_combine = color_combine0;
alpha_combine = alpha_combine0;
}
@@ -257,7 +259,7 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
assert(op <= 3);
switch ( srcRGBi ) {
case GL_TEXTURE:
- if (texture_base_format(texUnit->_Current) == GL_ALPHA)
+ if (texture_base_format(rtexUnit->_Current) == GL_ALPHA)
color_arg[i] = radeon_zero_color[op];
else
color_arg[i] = radeon_texture_color[op][unit];
@@ -302,7 +304,7 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
assert(op <= 1);
switch ( srcAi ) {
case GL_TEXTURE:
- if (texture_base_format(texUnit->_Current) == GL_LUMINANCE)
+ if (texture_base_format(rtexUnit->_Current) == GL_LUMINANCE)
alpha_arg[i] = radeon_zero_alpha[op+1];
else
alpha_arg[i] = radeon_texture_alpha[op][unit];
@@ -798,7 +800,8 @@ static void set_texgen_matrix( r100ContextPtr rmesa,
static GLboolean radeon_validate_texgen( struct gl_context *ctx, GLuint unit )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
GLuint tmp = rmesa->TexGenEnabled;
static const GLfloat reflect[16] = {
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 8ac5db062fc..398ff653b73 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -374,8 +374,8 @@ _mesa_PushAttrib(GLbitfield mask)
attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne;
attr->SampleCoverage = ctx->Multisample.SampleCoverage;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
- attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
+ attr->Texture[i] = ctx->Texture.FixedFuncUnit[i].Enabled;
+ attr->TexGen[i] = ctx->Texture.FixedFuncUnit[i].TexGenEnabled;
}
/* GL_ARB_vertex_program */
attr->VertexProgram = ctx->VertexProgram.Enabled;
@@ -718,7 +718,7 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
const GLbitfield enabled = enable->Texture[i];
const GLbitfield genEnabled = enable->TexGen[i];
- if (ctx->Texture.Unit[i].Enabled != enabled) {
+ if (ctx->Texture.FixedFuncUnit[i].Enabled != enabled) {
_mesa_ActiveTexture(GL_TEXTURE0 + i);
_mesa_set_enable(ctx, GL_TEXTURE_1D, !!(enabled & TEXTURE_1D_BIT));
@@ -734,7 +734,7 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
}
}
- if (ctx->Texture.Unit[i].TexGenEnabled != genEnabled) {
+ if (ctx->Texture.FixedFuncUnit[i].TexGenEnabled != genEnabled) {
_mesa_ActiveTexture(GL_TEXTURE0 + i);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_S, !!(genEnabled & S_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_GEN_T, !!(genEnabled & T_BIT));
@@ -758,7 +758,8 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
_mesa_lock_context_textures(ctx);
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- const struct gl_texture_unit *unit = &texstate->Texture.Unit[u];
+ const struct gl_fixedfunc_texture_unit *unit =
+ &texstate->Texture.FixedFuncUnit[u];
GLuint tgt;
_mesa_ActiveTexture(GL_TEXTURE0_ARB + u);
@@ -785,7 +786,9 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
_mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->GenQ.ObjectPlane);
/* Eye plane done differently to avoid re-transformation */
{
- struct gl_texture_unit *destUnit = &ctx->Texture.Unit[u];
+ struct gl_fixedfunc_texture_unit *destUnit =
+ &ctx->Texture.FixedFuncUnit[u];
+
COPY_4FV(destUnit->GenS.EyePlane, unit->GenS.EyePlane);
COPY_4FV(destUnit->GenT.EyePlane, unit->GenT.EyePlane);
COPY_4FV(destUnit->GenR.EyePlane, unit->GenR.EyePlane);
@@ -802,7 +805,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
_mesa_set_enable(ctx, GL_TEXTURE_GEN_R, !!(unit->TexGenEnabled & R_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, !!(unit->TexGenEnabled & Q_BIT));
_mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS,
- unit->LodBias);
+ texstate->Texture.Unit[u].LodBias);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,
unit->Combine.ModeRGB);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 7dbf67871dd..79d3e39e922 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1264,8 +1264,10 @@ _mesa_initialize_context(struct gl_context *ctx,
* GL_OES_texture_cube_map says
* "Initially all texture generation modes are set to REFLECTION_MAP_OES"
*/
- for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ for (i = 0; i < ARRAY_SIZE(ctx->Texture.FixedFuncUnit); i++) {
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[i];
+
texUnit->GenS.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenT.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenR.Mode = GL_REFLECTION_MAP_NV;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 967d23080c7..4c5f9dce5e4 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -186,7 +186,7 @@ _mesa_DisableClientState( GLenum cap )
* Note that we'll set GL_INVALID_OPERATION and return NULL if the active
* texture unit is higher than the number of supported coordinate units.
*/
-static struct gl_texture_unit *
+static struct gl_fixedfunc_texture_unit *
get_texcoord_unit(struct gl_context *ctx)
{
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
@@ -194,7 +194,7 @@ get_texcoord_unit(struct gl_context *ctx)
return NULL;
}
else {
- return &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return &ctx->Texture.FixedFuncUnit[ctx->Texture.CurrentUnit];
}
}
@@ -207,7 +207,9 @@ get_texcoord_unit(struct gl_context *ctx)
static GLboolean
enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit)
{
- struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+ struct gl_fixedfunc_texture_unit *texUnit =
+ _mesa_get_current_fixedfunc_tex_unit(ctx);
+
const GLbitfield newenabled = state
? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit);
@@ -748,7 +750,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_TEXTURE_GEN_R:
case GL_TEXTURE_GEN_Q:
{
- struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+ struct gl_fixedfunc_texture_unit *texUnit = get_texcoord_unit(ctx);
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
@@ -769,7 +771,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
case GL_TEXTURE_GEN_STR_OES:
/* disable S, T, and R at the same time */
{
- struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+ struct gl_fixedfunc_texture_unit *texUnit = get_texcoord_unit(ctx);
if (ctx->API != API_OPENGLES)
goto invalid_enum_error;
@@ -1288,8 +1290,9 @@ _mesa_IsEnabledi( GLenum cap, GLuint index )
static GLboolean
is_texture_enabled(struct gl_context *ctx, GLbitfield bit)
{
- const struct gl_texture_unit *const texUnit =
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ const struct gl_fixedfunc_texture_unit *const texUnit =
+ _mesa_get_current_fixedfunc_tex_unit(ctx);
+
return (texUnit->Enabled & bit) ? GL_TRUE : GL_FALSE;
}
@@ -1506,7 +1509,8 @@ _mesa_IsEnabled( GLenum cap )
case GL_TEXTURE_GEN_R:
case GL_TEXTURE_GEN_Q:
{
- const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ get_texcoord_unit(ctx);
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
@@ -1519,7 +1523,8 @@ _mesa_IsEnabled( GLenum cap )
return GL_FALSE;
case GL_TEXTURE_GEN_STR_OES:
{
- const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ get_texcoord_unit(ctx);
if (ctx->API != API_OPENGLES)
goto invalid_enum_error;
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 2be3ae37de3..a698931d99e 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -268,7 +268,8 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
i = u_bit_scan(&mask);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
const struct gl_texture_object *texObj = texUnit->_Current;
- const struct gl_tex_env_combine_packed *comb = &texUnit->_CurrentCombinePacked;
+ const struct gl_tex_env_combine_packed *comb =
+ &ctx->Texture.FixedFuncUnit[i]._CurrentCombinePacked;
if (!texObj)
continue;
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 6a022b83bdc..976b6f46b9f 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -235,7 +235,8 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
| ctx->Texture._TexMatEnabled | ctx->Point.CoordReplace;
while (mask) {
const int i = u_bit_scan(&mask);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[i];
if (ctx->Point.PointSprite)
if (ctx->Point.CoordReplace & (1u << i))
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 516e8d174ce..218801791e2 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1390,7 +1390,6 @@ static const struct value_desc *
find_value(const char *func, GLenum pname, void **p, union value *v)
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_texture_unit *unit;
int mask, hash;
const struct value_desc *d;
int api;
@@ -1445,8 +1444,10 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
*p = ((char *) ctx->Array.VAO + d->offset);
return d;
case LOC_TEXUNIT:
- unit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- *p = ((char *) unit + d->offset);
+ if (ctx->Texture.CurrentUnit < ARRAY_SIZE(ctx->Texture.FixedFuncUnit)) {
+ unsigned index = ctx->Texture.CurrentUnit;
+ *p = ((char *)&ctx->Texture.FixedFuncUnit[index] + d->offset);
+ }
return d;
case LOC_CUSTOM:
find_custom_value(ctx, d, v);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index df082af2074..e127b6bdb23 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -234,7 +234,7 @@ descriptor=[
# GL_ARB_texture_cube_map
[ "TEXTURE_CUBE_MAP_ARB", "LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA" ],
# S, T, and R are always set at the same time
- [ "TEXTURE_GEN_STR_OES", "LOC_TEXUNIT, TYPE_BIT_0, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ],
+ [ "TEXTURE_GEN_STR_OES", "LOC_TEXUNIT, TYPE_BIT_0, offsetof(struct gl_fixedfunc_texture_unit, TexGenEnabled), NO_EXTRA" ],
# GL_ARB_multisample
[ "MULTISAMPLE_ARB", "CONTEXT_BOOL(Multisample.Enabled), NO_EXTRA" ],
@@ -760,10 +760,10 @@ descriptor=[
[ "TEXTURE_3D", "LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA" ],
[ "TEXTURE_BINDING_1D", "LOC_CUSTOM, TYPE_INT, TEXTURE_1D_INDEX, NO_EXTRA" ],
[ "TEXTURE_BINDING_1D_ARRAY", "LOC_CUSTOM, TYPE_INT, TEXTURE_1D_ARRAY_INDEX, extra_EXT_texture_array" ],
- [ "TEXTURE_GEN_S", "LOC_TEXUNIT, TYPE_BIT_0, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ],
- [ "TEXTURE_GEN_T", "LOC_TEXUNIT, TYPE_BIT_1, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ],
- [ "TEXTURE_GEN_R", "LOC_TEXUNIT, TYPE_BIT_2, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ],
- [ "TEXTURE_GEN_Q", "LOC_TEXUNIT, TYPE_BIT_3, offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA" ],
+ [ "TEXTURE_GEN_S", "LOC_TEXUNIT, TYPE_BIT_0, offsetof(struct gl_fixedfunc_texture_unit, TexGenEnabled), NO_EXTRA" ],
+ [ "TEXTURE_GEN_T", "LOC_TEXUNIT, TYPE_BIT_1, offsetof(struct gl_fixedfunc_texture_unit, TexGenEnabled), NO_EXTRA" ],
+ [ "TEXTURE_GEN_R", "LOC_TEXUNIT, TYPE_BIT_2, offsetof(struct gl_fixedfunc_texture_unit, TexGenEnabled), NO_EXTRA" ],
+ [ "TEXTURE_GEN_Q", "LOC_TEXUNIT, TYPE_BIT_3, offsetof(struct gl_fixedfunc_texture_unit, TexGenEnabled), NO_EXTRA" ],
[ "UNPACK_LSB_FIRST", "CONTEXT_BOOL(Unpack.LsbFirst), NO_EXTRA" ],
[ "UNPACK_SWAP_BYTES", "CONTEXT_BOOL(Unpack.SwapBytes), NO_EXTRA" ],
[ "ZOOM_X", "CONTEXT_FLOAT(Pixel.ZoomX), NO_EXTRA" ],
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 46137f5d4ae..562fb17c10f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1275,11 +1275,32 @@ struct gl_texgen
/**
- * Texture unit state. Contains enable flags, texture environment/function/
- * combiners, texgen state, and pointers to current texture objects.
+ * Sampler-related subset of a texture unit, like current texture objects.
*/
struct gl_texture_unit
{
+ GLfloat LodBias; /**< for biasing mipmap levels */
+
+ /** Texture targets that have a non-default texture bound */
+ GLbitfield _BoundTextures;
+
+ /** Current sampler object (GL_ARB_sampler_objects) */
+ struct gl_sampler_object *Sampler;
+
+ /** Current texture object pointers */
+ struct gl_texture_object *CurrentTex[NUM_TEXTURE_TARGETS];
+
+ /** Points to highest priority, complete and enabled texture object */
+ struct gl_texture_object *_Current;
+};
+
+
+/**
+ * Fixed-function-related subset of a texture unit, like enable flags,
+ * texture environment/function/combiners, and texgen state.
+ */
+struct gl_fixedfunc_texture_unit
+{
GLbitfield Enabled; /**< bitmask of TEXTURE_*_BIT flags */
GLenum16 EnvMode; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */
@@ -1293,14 +1314,6 @@ struct gl_texture_unit
GLbitfield TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */
GLbitfield _GenFlags; /**< Bitwise-OR of Gen[STRQ]._ModeBit */
- GLfloat LodBias; /**< for biasing mipmap levels */
-
- /** Texture targets that have a non-default texture bound */
- GLbitfield _BoundTextures;
-
- /** Current sampler object (GL_ARB_sampler_objects) */
- struct gl_sampler_object *Sampler;
-
/**
* \name GL_EXT_texture_env_combine
*/
@@ -1318,12 +1331,6 @@ struct gl_texture_unit
*/
struct gl_tex_env_combine_state *_CurrentCombine;
- /** Current texture object pointers */
- struct gl_texture_object *CurrentTex[NUM_TEXTURE_TARGETS];
-
- /** Points to highest priority, complete and enabled texture object */
- struct gl_texture_object *_Current;
-
/** Current compressed TexEnv & Combine state */
struct gl_tex_env_combine_packed _CurrentCombinePacked;
};
@@ -1363,6 +1370,7 @@ struct gl_texture_attrib
GLint NumCurrentTexUsed;
struct gl_texture_unit Unit[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
+ struct gl_fixedfunc_texture_unit FixedFuncUnit[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
};
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 43f67596d1f..dd1042fc8c2 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -266,7 +266,8 @@ static void
compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
const GLfloat normal[3], GLuint unit, GLfloat texcoord[4])
{
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
/* always compute sphere map terms, just in case */
GLfloat u[3], two_nu, rx, ry, rz, m, mInv;
@@ -464,7 +465,7 @@ _mesa_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
GLfloat tc[4];
COPY_4V(tc, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]);
- if (ctx->Texture.Unit[u].TexGenEnabled) {
+ if (ctx->Texture.FixedFuncUnit[u].TexGenEnabled) {
compute_texgen(ctx, vObj, eye, norm, u, tc);
}
TRANSFORM_POINT(ctx->Current.RasterTexCoords[u],
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 2fcaf7c07e4..9018ce9bc4c 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -48,7 +48,7 @@
/** Set texture env mode */
static void
set_env_mode(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
+ struct gl_fixedfunc_texture_unit *texUnit,
GLenum mode)
{
GLboolean legal;
@@ -88,7 +88,7 @@ set_env_mode(struct gl_context *ctx,
static void
set_env_color(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
+ struct gl_fixedfunc_texture_unit *texUnit,
const GLfloat *color)
{
if (TEST_EQ_4V(color, texUnit->EnvColorUnclamped))
@@ -105,7 +105,7 @@ set_env_color(struct gl_context *ctx,
/** Set an RGB or A combiner mode/function */
static void
set_combiner_mode(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
+ struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLenum mode)
{
GLboolean legal;
@@ -171,7 +171,7 @@ set_combiner_mode(struct gl_context *ctx,
/** Set an RGB or A combiner source term */
static void
set_combiner_source(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
+ struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLenum param)
{
GLuint term;
@@ -261,7 +261,7 @@ set_combiner_source(struct gl_context *ctx,
/** Set an RGB or A combiner operand term */
static void
set_combiner_operand(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
+ struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLenum param)
{
GLuint term;
@@ -342,7 +342,7 @@ set_combiner_operand(struct gl_context *ctx,
static void
set_combiner_scale(struct gl_context *ctx,
- struct gl_texture_unit *texUnit,
+ struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname, GLfloat scale)
{
GLuint shift;
@@ -386,7 +386,6 @@ void GLAPIENTRY
_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
{
const GLint iparam0 = (GLint) param[0];
- struct gl_texture_unit *texUnit;
GLuint maxUnit;
GET_CURRENT_CONTEXT(ctx);
@@ -397,9 +396,10 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
-
if (target == GL_TEXTURE_ENV) {
+ struct gl_fixedfunc_texture_unit *texUnit =
+ _mesa_get_current_fixedfunc_tex_unit(ctx);
+
switch (pname) {
case GL_TEXTURE_ENV_MODE:
set_env_mode(ctx, texUnit, (GLenum) iparam0);
@@ -441,6 +441,9 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
}
}
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ struct gl_texture_unit *texUnit =
+ _mesa_get_current_tex_unit(ctx);
+
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
if (texUnit->LodBias == param[0])
return;
@@ -547,7 +550,8 @@ _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
* \return value of queried pname or -1 if error.
*/
static GLint
-get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
+get_texenvi(struct gl_context *ctx,
+ const struct gl_fixedfunc_texture_unit *texUnit,
GLenum pname)
{
switch (pname) {
@@ -632,7 +636,6 @@ void GLAPIENTRY
_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
{
GLuint maxUnit;
- const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
@@ -642,9 +645,10 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
-
if (target == GL_TEXTURE_ENV) {
+ struct gl_fixedfunc_texture_unit *texUnit =
+ _mesa_get_current_fixedfunc_tex_unit(ctx);
+
if (pname == GL_TEXTURE_ENV_COLOR) {
if(ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
_mesa_update_state(ctx);
@@ -661,6 +665,8 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
}
}
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ const struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
*params = texUnit->LodBias;
}
@@ -698,7 +704,6 @@ void GLAPIENTRY
_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
{
GLuint maxUnit;
- const struct gl_texture_unit *texUnit;
GET_CURRENT_CONTEXT(ctx);
maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV)
@@ -708,9 +713,10 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
-
if (target == GL_TEXTURE_ENV) {
+ struct gl_fixedfunc_texture_unit *texUnit =
+ _mesa_get_current_fixedfunc_tex_unit(ctx);
+
if (pname == GL_TEXTURE_ENV_COLOR) {
params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] );
params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] );
@@ -725,6 +731,8 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
}
}
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
+ const struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
*params = (GLint) texUnit->LodBias;
}
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
index 1b8d187cd3b..45f86fd911f 100644
--- a/src/mesa/main/texgen.c
+++ b/src/mesa/main/texgen.c
@@ -44,7 +44,7 @@
* Return texgen state for given coordinate
*/
static struct gl_texgen *
-get_texgen(struct gl_context *ctx, struct gl_texture_unit *texUnit,
+get_texgen(struct gl_context *ctx, struct gl_fixedfunc_texture_unit *texUnit,
GLenum coord)
{
if (ctx->API == API_OPENGLES) {
@@ -70,7 +70,7 @@ get_texgen(struct gl_context *ctx, struct gl_texture_unit *texUnit,
void GLAPIENTRY
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{
- struct gl_texture_unit *texUnit;
+ struct gl_fixedfunc_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
@@ -86,7 +86,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
@@ -289,7 +289,7 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
void GLAPIENTRY
_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
{
- struct gl_texture_unit *texUnit;
+ struct gl_fixedfunc_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
@@ -298,7 +298,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
@@ -326,7 +326,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
void GLAPIENTRY
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
{
- struct gl_texture_unit *texUnit;
+ struct gl_fixedfunc_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
@@ -335,7 +335,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
@@ -371,7 +371,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
void GLAPIENTRY
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
{
- struct gl_texture_unit *texUnit;
+ struct gl_fixedfunc_texture_unit *texUnit;
struct gl_texgen *texgen;
GET_CURRENT_CONTEXT(ctx);
@@ -380,7 +380,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index e24b3c494cc..2b05630e619 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -78,19 +78,8 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
/* per-unit state */
for (u = 0; u < src->Const.MaxCombinedTextureImageUnits; u++) {
- dst->Texture.Unit[u].Enabled = src->Texture.Unit[u].Enabled;
- dst->Texture.Unit[u].EnvMode = src->Texture.Unit[u].EnvMode;
- COPY_4V(dst->Texture.Unit[u].EnvColor, src->Texture.Unit[u].EnvColor);
- dst->Texture.Unit[u].TexGenEnabled = src->Texture.Unit[u].TexGenEnabled;
- dst->Texture.Unit[u].GenS = src->Texture.Unit[u].GenS;
- dst->Texture.Unit[u].GenT = src->Texture.Unit[u].GenT;
- dst->Texture.Unit[u].GenR = src->Texture.Unit[u].GenR;
- dst->Texture.Unit[u].GenQ = src->Texture.Unit[u].GenQ;
dst->Texture.Unit[u].LodBias = src->Texture.Unit[u].LodBias;
- /* GL_EXT_texture_env_combine */
- dst->Texture.Unit[u].Combine = src->Texture.Unit[u].Combine;
-
/*
* XXX strictly speaking, we should compare texture names/ids and
* bind textures in the dest context according to id. For now, only
@@ -113,6 +102,20 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
_mesa_unlock_context_textures(dst);
}
}
+
+ for (u = 0; u < src->Const.MaxCombinedTextureImageUnits; u++) {
+ dst->Texture.FixedFuncUnit[u].Enabled = src->Texture.FixedFuncUnit[u].Enabled;
+ dst->Texture.FixedFuncUnit[u].EnvMode = src->Texture.FixedFuncUnit[u].EnvMode;
+ COPY_4V(dst->Texture.FixedFuncUnit[u].EnvColor, src->Texture.FixedFuncUnit[u].EnvColor);
+ dst->Texture.FixedFuncUnit[u].TexGenEnabled = src->Texture.FixedFuncUnit[u].TexGenEnabled;
+ dst->Texture.FixedFuncUnit[u].GenS = src->Texture.FixedFuncUnit[u].GenS;
+ dst->Texture.FixedFuncUnit[u].GenT = src->Texture.FixedFuncUnit[u].GenT;
+ dst->Texture.FixedFuncUnit[u].GenR = src->Texture.FixedFuncUnit[u].GenR;
+ dst->Texture.FixedFuncUnit[u].GenQ = src->Texture.FixedFuncUnit[u].GenQ;
+
+ /* GL_EXT_texture_env_combine */
+ dst->Texture.FixedFuncUnit[u].Combine = src->Texture.FixedFuncUnit[u].Combine;
+ }
}
@@ -122,7 +125,7 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
void
_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit )
{
- const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit;
+ const struct gl_fixedfunc_texture_unit *texUnit = ctx->Texture.FixedFuncUnit + unit;
printf("Texture Unit %d\n", unit);
printf(" GL_TEXTURE_ENV_MODE = %s\n", _mesa_enum_to_string(texUnit->EnvMode));
printf(" GL_COMBINE_RGB = %s\n", _mesa_enum_to_string(texUnit->Combine.ModeRGB));
@@ -461,7 +464,7 @@ tex_combine_translate_operand(GLenum operand)
static void
-pack_tex_combine(struct gl_texture_unit *texUnit)
+pack_tex_combine(struct gl_fixedfunc_texture_unit *texUnit)
{
struct gl_tex_env_combine_state *state = texUnit->_CurrentCombine;
struct gl_tex_env_combine_packed *packed = &texUnit->_CurrentCombinePacked;
@@ -493,7 +496,9 @@ pack_tex_combine(struct gl_texture_unit *texUnit)
* Examine texture unit's combine/env state to update derived state.
*/
static void
-update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
+update_tex_combine(struct gl_context *ctx,
+ struct gl_texture_unit *texUnit,
+ struct gl_fixedfunc_texture_unit *fftexUnit)
{
struct gl_tex_env_combine_state *combine;
@@ -505,9 +510,9 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
* state, or the combiner state which is derived from traditional texenv
* mode.
*/
- if (texUnit->EnvMode == GL_COMBINE ||
- texUnit->EnvMode == GL_COMBINE4_NV) {
- texUnit->_CurrentCombine = & texUnit->Combine;
+ if (fftexUnit->EnvMode == GL_COMBINE ||
+ fftexUnit->EnvMode == GL_COMBINE4_NV) {
+ fftexUnit->_CurrentCombine = & fftexUnit->Combine;
}
else {
const struct gl_texture_object *texObj = texUnit->_Current;
@@ -516,11 +521,11 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
format = texObj->DepthMode;
}
- calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format);
- texUnit->_CurrentCombine = & texUnit->_EnvMode;
+ calculate_derived_texenv(&fftexUnit->_EnvMode, fftexUnit->EnvMode, format);
+ fftexUnit->_CurrentCombine = & fftexUnit->_EnvMode;
}
- combine = texUnit->_CurrentCombine;
+ combine = fftexUnit->_CurrentCombine;
/* Determine number of source RGB terms in the combiner function */
switch (combine->ModeRGB) {
@@ -529,7 +534,7 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
break;
case GL_ADD:
case GL_ADD_SIGNED:
- if (texUnit->EnvMode == GL_COMBINE4_NV)
+ if (fftexUnit->EnvMode == GL_COMBINE4_NV)
combine->_NumArgsRGB = 4;
else
combine->_NumArgsRGB = 2;
@@ -561,7 +566,7 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
break;
case GL_ADD:
case GL_ADD_SIGNED:
- if (texUnit->EnvMode == GL_COMBINE4_NV)
+ if (fftexUnit->EnvMode == GL_COMBINE4_NV)
combine->_NumArgsA = 4;
else
combine->_NumArgsA = 2;
@@ -582,7 +587,7 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
break;
}
- pack_tex_combine(texUnit);
+ pack_tex_combine(fftexUnit);
}
static void
@@ -592,7 +597,8 @@ update_texgen(struct gl_context *ctx)
/* Setup texgen for those texture coordinate sets that are in use */
for (unit = 0; unit < ctx->Const.MaxTextureCoordUnits; unit++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
texUnit->_GenFlags = 0x0;
@@ -748,10 +754,12 @@ update_ff_texture_state(struct gl_context *ctx,
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *fftexUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLbitfield mask;
bool complete;
- if (texUnit->Enabled == 0x0)
+ if (fftexUnit->Enabled == 0x0)
continue;
/* If a shader already dictated what texture target was used for this
@@ -788,7 +796,7 @@ update_ff_texture_state(struct gl_context *ctx,
* undefined."
*/
complete = false;
- mask = texUnit->Enabled;
+ mask = fftexUnit->Enabled;
while (mask) {
const int texIndex = u_bit_scan(&mask);
struct gl_texture_object *texObj = texUnit->CurrentTex[texIndex];
@@ -815,7 +823,7 @@ update_ff_texture_state(struct gl_context *ctx,
ctx->Texture._EnabledCoordUnits |= 1 << unit;
- update_tex_combine(ctx, texUnit);
+ update_tex_combine(ctx, texUnit, fftexUnit);
}
}
@@ -998,6 +1006,19 @@ _mesa_init_texture(struct gl_context *ctx)
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
GLuint tex;
+ /* initialize current texture object ptrs to the shared default objects */
+ for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
+ _mesa_reference_texobj(&texUnit->CurrentTex[tex],
+ ctx->Shared->DefaultTex[tex]);
+ }
+
+ texUnit->_BoundTextures = 0;
+ }
+
+ for (u = 0; u < ARRAY_SIZE(ctx->Texture.FixedFuncUnit); u++) {
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[u];
+
texUnit->EnvMode = GL_MODULATE;
ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 );
@@ -1024,14 +1045,6 @@ _mesa_init_texture(struct gl_context *ctx)
ASSIGN_4V( texUnit->GenT.EyePlane, 0.0, 1.0, 0.0, 0.0 );
ASSIGN_4V( texUnit->GenR.EyePlane, 0.0, 0.0, 0.0, 0.0 );
ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 );
-
- /* initialize current texture object ptrs to the shared default objects */
- for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
- _mesa_reference_texobj(&texUnit->CurrentTex[tex],
- ctx->Shared->DefaultTex[tex]);
- }
-
- texUnit->_BoundTextures = 0;
}
/* After we're done initializing the context's texture state the default
diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h
index 4f515e425a8..cf3f7e5a216 100644
--- a/src/mesa/main/texstate.h
+++ b/src/mesa/main/texstate.h
@@ -54,6 +54,21 @@ _mesa_get_current_tex_unit(struct gl_context *ctx)
return _mesa_get_tex_unit(ctx, ctx->Texture.CurrentUnit);
}
+
+/**
+ * Return pointer to current fixed-func texture unit.
+ * This the texture unit set by glActiveTexture(), not glClientActiveTexture().
+ * \return NULL if the current unit is not a fixed-func texture unit
+ */
+static inline struct gl_fixedfunc_texture_unit *
+_mesa_get_current_fixedfunc_tex_unit(struct gl_context *ctx)
+{
+ unsigned unit = ctx->Texture.CurrentUnit;
+
+ return &ctx->Texture.FixedFuncUnit[unit];
+}
+
+
static inline GLuint
_mesa_max_tex_unit(struct gl_context *ctx)
{
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 481123a7dc2..78f70053017 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -215,28 +215,28 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
/* state[2] is the texgen attribute */
switch (state[2]) {
case STATE_TEXGEN_EYE_S:
- COPY_4V(value, ctx->Texture.Unit[unit].GenS.EyePlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenS.EyePlane);
return;
case STATE_TEXGEN_EYE_T:
- COPY_4V(value, ctx->Texture.Unit[unit].GenT.EyePlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenT.EyePlane);
return;
case STATE_TEXGEN_EYE_R:
- COPY_4V(value, ctx->Texture.Unit[unit].GenR.EyePlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenR.EyePlane);
return;
case STATE_TEXGEN_EYE_Q:
- COPY_4V(value, ctx->Texture.Unit[unit].GenQ.EyePlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenQ.EyePlane);
return;
case STATE_TEXGEN_OBJECT_S:
- COPY_4V(value, ctx->Texture.Unit[unit].GenS.ObjectPlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenS.ObjectPlane);
return;
case STATE_TEXGEN_OBJECT_T:
- COPY_4V(value, ctx->Texture.Unit[unit].GenT.ObjectPlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenT.ObjectPlane);
return;
case STATE_TEXGEN_OBJECT_R:
- COPY_4V(value, ctx->Texture.Unit[unit].GenR.ObjectPlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenR.ObjectPlane);
return;
case STATE_TEXGEN_OBJECT_Q:
- COPY_4V(value, ctx->Texture.Unit[unit].GenQ.ObjectPlane);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].GenQ.ObjectPlane);
return;
default:
_mesa_problem(ctx, "Invalid texgen state in fetch_state");
@@ -248,9 +248,9 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
/* state[1] is the texture unit */
const GLuint unit = (GLuint) state[1];
if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
- COPY_4V(value, ctx->Texture.Unit[unit].EnvColor);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].EnvColor);
else
- COPY_4V(value, ctx->Texture.Unit[unit].EnvColorUnclamped);
+ COPY_4V(value, ctx->Texture.FixedFuncUnit[unit].EnvColorUnclamped);
}
return;
case STATE_FOG_COLOR:
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index f7f08b19dd9..0c12a63ae0b 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -185,7 +185,7 @@ _swrast_update_texture_env( struct gl_context *ctx )
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
const struct gl_tex_env_combine_state *combine =
- ctx->Texture.Unit[i]._CurrentCombine;
+ ctx->Texture.FixedFuncUnit[i]._CurrentCombine;
GLuint term;
for (term = 0; term < combine->_NumArgsRGB; term++) {
if (combine->SourceRGB[term] == GL_PRIMARY_COLOR) {
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index da4a013634c..743ee4015bb 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -84,7 +84,8 @@ texture_combine( struct gl_context *ctx, GLuint unit,
SWspan *span )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]);
+ const struct gl_fixedfunc_texture_unit *textureUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine;
float4_array argRGB[MAX_COMBINER_TERMS];
float4_array argA[MAX_COMBINER_TERMS];
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index c84cfec93d3..d80ab180bac 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -539,7 +539,7 @@ affine_span(struct gl_context *ctx, SWspan *span,
#define SETUP_CODE \
struct affine_info info; \
- struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
+ struct gl_fixedfunc_texture_unit *unit = ctx->Texture.FixedFuncUnit+0; \
const struct gl_texture_object *obj = \
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
const struct gl_texture_image *texImg = \
@@ -808,7 +808,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
#define SETUP_CODE \
struct persp_info info; \
- const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
+ const struct gl_fixedfunc_texture_unit *unit = ctx->Texture.FixedFuncUnit+0; \
const struct gl_texture_object *obj = \
ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \
const struct gl_texture_image *texImg = \
@@ -1066,7 +1066,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
format = texImg ? texImg->TexFormat : MESA_FORMAT_NONE;
minFilter = texObj2D ? samp->MinFilter : GL_NONE;
magFilter = texObj2D ? samp->MagFilter : GL_NONE;
- envMode = ctx->Texture.Unit[0].EnvMode;
+ envMode = ctx->Texture.FixedFuncUnit[0].EnvMode;
/* First see if we can use an optimized 2-D texture function */
if (ctx->Texture._EnabledCoordUnits == 0x1
@@ -1085,8 +1085,8 @@ _swrast_choose_triangle( struct gl_context *ctx )
&& minFilter == magFilter
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR
&& !swrast->_FogEnabled
- && ctx->Texture.Unit[0].EnvMode != GL_COMBINE_EXT
- && ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) {
+ && ctx->Texture.FixedFuncUnit[0].EnvMode != GL_COMBINE_EXT
+ && ctx->Texture.FixedFuncUnit[0].EnvMode != GL_COMBINE4_NV) {
if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) {
if (minFilter == GL_NEAREST
&& format == MESA_FORMAT_BGR_UNORM8
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 94066f4f6ef..a13262d1db2 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -337,7 +337,8 @@ static void texgen( struct gl_context *ctx,
struct vertex_buffer *VB = &tnl->vb;
GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit];
GLvector4f *out = &store->texcoord[unit];
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
const GLvector4f *obj = VB->AttribPtr[_TNL_ATTRIB_POS];
const GLvector4f *eye = VB->EyePtr;
const GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL];
@@ -489,10 +490,10 @@ static GLboolean run_texgen_stage( struct gl_context *ctx,
return GL_TRUE;
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[i];
if (texUnit->TexGenEnabled) {
-
store->TexgenFunc[i]( ctx, store, i );
VB->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->texcoord[i];
@@ -513,7 +514,8 @@ static void validate_texgen_stage( struct gl_context *ctx,
return;
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[i];
if (texUnit->TexGenEnabled) {
GLuint sz;