if (ctx->_ImageTransferState ||
ctx->FragmentProgram._Enabled ||
ctx->Fog.Enabled ||
- ctx->Texture._EnabledUnits ||
+ ctx->Texture._MaxEnabledTexImageUnit != -1 ||
width > tex->MaxSize ||
height > tex->MaxSize) {
_swrast_Bitmap(ctx, x, y, width, height, unpack, bitmap1);
return false;
}
- if (ctx->Texture._EnabledUnits) {
+ if (ctx->Texture._MaxEnabledTexImageUnit != -1) {
DBG("fallback due to texturing\n");
return false;
}
}
if (ctx->Fog.Enabled ||
- ctx->Texture._EnabledUnits ||
+ ctx->Texture._MaxEnabledTexImageUnit != -1 ||
ctx->FragmentProgram._Enabled) {
perf_debug("glCopyPixels(): Unsupported fragment shader state\n");
return false;
return false;
}
- if (ctx->Texture._EnabledUnits) {
+ if (ctx->Texture._MaxEnabledTexImageUnit != -1) {
DBG("fallback due to texturing\n");
return false;
}
}
if (ctx->Fog.Enabled ||
- ctx->Texture._EnabledUnits ||
+ ctx->Texture._MaxEnabledTexImageUnit != -1 ||
ctx->FragmentProgram._Enabled) {
perf_debug("glCopyPixels(): Unsupported fragment shader state\n");
return false;
/* calculate non-multitex state */
nv04->blend &= ~NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP__MASK;
- if (ctx->Texture._EnabledUnits)
+ if (ctx->Texture._MaxEnabledTexImageUnit != -1)
nv04->blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
else
nv04->blend |= get_texenv_mode(GL_MODULATE);
INPUT_ONE(&rc, E, 0);
}
- if (ctx->Texture._EnabledUnits) {
+ if (ctx->Texture._MaxEnabledTexImageUnit != -1) {
INPUT_SRC(&rc, B, SPARE0, RGB);
INPUT_SRC(&rc, G, SPARE0, ALPHA);
} else {
}
*in = rc.in;
- *n = log2i(ctx->Texture._EnabledUnits) + 1;
+ *n = ctx->Texture._MaxEnabledTexImageUnit + 1;
}
void
CHECK( always, GL_TRUE, 0 )
CHECK( always_add4, GL_TRUE, 4 )
CHECK( never, GL_FALSE, 0 )
-CHECK( tex_any, ctx->Texture._EnabledUnits, 0 )
-CHECK( tf, (ctx->Texture._EnabledUnits && !ctx->ATIFragmentShader._Enabled), 0 );
+CHECK( tex_any, ctx->Texture._MaxEnabledTexImageUnit != -1, 0 )
+CHECK( tf, (ctx->Texture._MaxEnabledTexImageUnit != -1 && !ctx->ATIFragmentShader._Enabled), 0 );
CHECK( pix_zero, !ctx->ATIFragmentShader._Enabled, 0 )
CHECK( texenv, (rmesa->state.envneeded & (1 << (atom->idx)) && !ctx->ATIFragmentShader._Enabled), 0 )
CHECK( afs_pass1, (ctx->ATIFragmentShader._Enabled && (ctx->ATIFragmentShader.Current->NumPasses > 1)), 0 )
if (ctx->RenderMode != GL_RENDER ||
ctx->Line.SmoothFlag ||
- ctx->Texture._EnabledUnits ||
+ ctx->Texture.MaxEnabledTexImageUnit == -1 ||
ctx->Light.ShadeModel != GL_FLAT ||
ctx->Line.Width != 1.0F ||
ctx->Line.StippleFlag ||
if (ctx->RenderMode != GL_RENDER ||
ctx->Polygon.SmoothFlag ||
ctx->Polygon.StippleFlag ||
- ctx->Texture._EnabledUnits) {
+ ctx->Texture._MaxEnabledTexImageUnit != -1) {
return NULL;
}
if (ctx->RenderMode == GL_RENDER
&& ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag
&& swrast->_RasterMask == 0
- && !ctx->Texture._EnabledUnits
+ && ctx->Texture._MaxEnabledTexImageUnit == -1
&& xmesa->xm_buffer->buffer != XIMAGE) {
swrast->Point = draw_points_ANY_pixmap;
}
return (swrast_line_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL;
if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL;
- if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL;
+ if (ctx->Texture._MaxEnabledTexImageUnit != -1) return (swrast_line_func) NULL;
if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL;
if (ctx->Line.StippleFlag) return (swrast_line_func) NULL;
if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag)
return (swrast_tri_func) NULL;
- if (ctx->Texture._EnabledUnits)
+ if (ctx->Texture._MaxEnabledTexImageUnit != -1)
return (swrast_tri_func) NULL;
if (swrast->_RasterMask & MULTI_DRAW_BIT)
return (swrast_tri_func) NULL;
if (ctx->Texture._TexGenEnabled ||
ctx->Texture._TexMatEnabled ||
- ctx->Texture._EnabledUnits)
+ ctx->Texture._MaxEnabledTexImageUnit != -1)
key->texture_enabled_global = 1;
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
/** GL_ARB_seamless_cubemap */
GLboolean CubeMapSeamless;
- /** Texture units/samplers used by vertex or fragment texturing */
- GLbitfield _EnabledUnits;
-
/** Texture coord units/sets used for fragment texturing */
GLbitfield _EnabledCoordUnits;
/* TODO: only set this if there are actual changes */
ctx->NewState |= _NEW_TEXTURE;
- ctx->Texture._EnabledUnits = 0x0;
ctx->Texture._GenFlags = 0x0;
ctx->Texture._TexMatEnabled = 0x0;
ctx->Texture._TexGenEnabled = 0x0;
}
/* if we get here, we know this texture unit is enabled */
-
- ctx->Texture._EnabledUnits |= (1 << unit);
ctx->Texture._MaxEnabledTexImageUnit = unit;
if (enabledTargetsByStage[MESA_SHADER_FRAGMENT])
/* Texture group */
ctx->Texture.CurrentUnit = 0; /* multitexture */
- ctx->Texture._EnabledUnits = 0x0;
/* Appendix F.2 of the OpenGL ES 3.0 spec says:
*
}
}
if (ctx->Color.ColorLogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
- if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT;
+ if (ctx->Texture._MaxEnabledTexImageUnit >= 0) rasterMask |= TEXTURE_BIT;
if ( ctx->ViewportArray[0].X < 0
|| ctx->ViewportArray[0].X + ctx->ViewportArray[0].Width > (GLfloat) ctx->DrawBuffer->Width
|| ctx->ViewportArray[0].Y < 0
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
swrast->SpecularVertexAdd = (separateSpecular
- && ctx->Texture._EnabledUnits == 0x0
+ && ctx->Texture._MaxEnabledTexImageUnit == -1
&& !_swrast_use_fragment_program(ctx)
&& !ctx->ATIFragmentShader._Enabled);
}
void
_swrast_map_textures(struct gl_context *ctx)
{
- GLbitfield enabledUnits = ctx->Texture._EnabledUnits;
+ int unit;
- /* loop over enabled texture units */
- while (enabledUnits) {
- GLuint unit = ffs(enabledUnits) - 1;
- struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
-
- _swrast_map_texture(ctx, texObj);
+ for (unit = 0; unit <= ctx->Texture._MaxEnabledTexImageUnit; unit++) {
+ if (ctx->Texture.Unit[unit]._ReallyEnabled) {
+ struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
- enabledUnits &= ~(1 << unit);
+ _swrast_map_texture(ctx, texObj);
+ }
}
}
void
_swrast_unmap_textures(struct gl_context *ctx)
{
- GLbitfield enabledUnits = ctx->Texture._EnabledUnits;
-
- /* loop over enabled texture units */
- while (enabledUnits) {
- GLuint unit = ffs(enabledUnits) - 1;
- struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
-
- _swrast_unmap_texture(ctx, texObj);
+ int unit;
+ for (unit = 0; unit <= ctx->Texture._MaxEnabledTexImageUnit; unit++) {
+ if (ctx->Texture.Unit[unit]._ReallyEnabled) {
+ struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
- enabledUnits &= ~(1 << unit);
+ _swrast_unmap_texture(ctx, texObj);
+ }
}
}
if (ctx->Texture._EnabledCoordUnits == 0x1
&& !_swrast_use_fragment_program(ctx)
&& !ctx->ATIFragmentShader._Enabled
- && ctx->Texture._EnabledUnits == 0x1
+ && ctx->Texture._MaxEnabledTexImageUnit == 0
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
&& samp->WrapS == GL_REPEAT
&& samp->WrapT == GL_REPEAT