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)
/* 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];
}
}
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;
}
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];
#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 *
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)
* 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; \
/* 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);
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);
}
* 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; \
}
*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;
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++) {
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);
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++) {
{
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 ) );
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 |
(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;
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.
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;
}
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:
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;
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;
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;
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;
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 ||
if (needMatrix) {
rmesa->NeedTexMatrix |= 1 << unit;
radeonUploadTexMatrix( rmesa, unit,
- !ctx->Texture.Unit[unit].TexGenEnabled );
+ !ctx->Texture.FixedFuncUnit[unit].TexGenEnabled );
}
}
}
{
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",
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
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;
}
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];
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];
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] = {
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;
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));
}
}
- 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));
_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);
_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);
_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,
* 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;
* 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) {
return NULL;
}
else {
- return &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+ return &ctx->Texture.FixedFuncUnit[ctx->Texture.CurrentUnit];
}
}
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);
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;
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;
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;
}
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;
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;
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;
| 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))
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;
*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);
# 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" ],
[ "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" ],
/**
- * 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. */
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
*/
*/
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;
};
GLint NumCurrentTexUsed;
struct gl_texture_unit Unit[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
+ struct gl_fixedfunc_texture_unit FixedFuncUnit[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
};
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;
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],
/** 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;
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))
/** 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;
/** 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;
/** 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;
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;
_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);
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);
}
}
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;
* \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) {
_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)
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);
}
}
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;
}
_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)
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] );
}
}
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;
}
* 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) {
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);
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
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);
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
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);
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
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);
return;
}
- texUnit = _mesa_get_current_tex_unit(ctx);
+ texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx);
texgen = get_texgen(ctx, texUnit, coord);
if (!texgen) {
/* 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
_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;
+ }
}
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));
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;
* 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;
* 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;
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) {
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;
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;
break;
}
- pack_tex_combine(texUnit);
+ pack_tex_combine(fftexUnit);
}
static void
/* 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;
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
* 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];
ctx->Texture._EnabledCoordUnits |= 1 << unit;
- update_tex_combine(ctx, texUnit);
+ update_tex_combine(ctx, texUnit, fftexUnit);
}
}
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 );
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
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)
{
/* 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");
/* 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:
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) {
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];
#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 = \
#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 = \
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
&& 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
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];
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];
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;