+ struct gl_fixedfunc_texture_unit *texUnit =
+ _mesa_get_current_fixedfunc_tex_unit(ctx);
+
+ /* The GL spec says that we should report an error if the unit is greater
+ * than GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, but in practice, only
+ * fixed-function units are usable. This is probably a spec bug.
+ * Ignore glTexEnv(GL_TEXTURE_ENV) calls for non-fixed-func units,
+ * because we don't want to process calls that have no effect.
+ */
+ if (!texUnit)
+ return;
+