206
* Return pointer to current texture unit for setting/getting coordinate
208
* Note that we'll set GL_INVALID_OPERATION if the active texture unit is
209
* higher than the number of supported coordinate units. And we'll return NULL.
211
static struct gl_texture_unit *
212
get_texcoord_unit(GLcontext *ctx)
214
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
215
_mesa_error(ctx, GL_INVALID_OPERATION, "glEnable/Disable(texcoord unit)");
219
return &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
205
225
* Helper function to enable or disable a texture target.
615
case GL_TEXTURE_GEN_Q: {
616
GLuint unit = ctx->Texture.CurrentUnit;
617
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
618
GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
621
if (texUnit->TexGenEnabled == newenabled)
623
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
624
texUnit->TexGenEnabled = newenabled;
627
case GL_TEXTURE_GEN_R: {
628
GLuint unit = ctx->Texture.CurrentUnit;
629
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
630
GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
633
if (texUnit->TexGenEnabled == newenabled)
635
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
636
texUnit->TexGenEnabled = newenabled;
639
case GL_TEXTURE_GEN_S: {
640
GLuint unit = ctx->Texture.CurrentUnit;
641
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
642
GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
645
if (texUnit->TexGenEnabled == newenabled)
647
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
648
texUnit->TexGenEnabled = newenabled;
651
case GL_TEXTURE_GEN_T: {
652
GLuint unit = ctx->Texture.CurrentUnit;
653
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
654
GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
657
if (texUnit->TexGenEnabled == newenabled)
659
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
660
texUnit->TexGenEnabled = newenabled;
631
case GL_TEXTURE_GEN_Q:
633
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
635
GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT;
638
if (texUnit->TexGenEnabled == newenabled)
640
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
641
texUnit->TexGenEnabled = newenabled;
645
case GL_TEXTURE_GEN_R:
647
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
649
GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT;
652
if (texUnit->TexGenEnabled == newenabled)
654
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
655
texUnit->TexGenEnabled = newenabled;
659
case GL_TEXTURE_GEN_S:
661
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
663
GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT;
666
if (texUnit->TexGenEnabled == newenabled)
668
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
669
texUnit->TexGenEnabled = newenabled;
673
case GL_TEXTURE_GEN_T:
675
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
677
GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT;
680
if (texUnit->TexGenEnabled == newenabled)
682
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
683
texUnit->TexGenEnabled = newenabled;
665
689
* CLIENT STATE!!!
1153
1177
return is_texture_enabled(ctx, TEXTURE_3D_BIT);
1154
1178
case GL_TEXTURE_GEN_Q:
1156
const struct gl_texture_unit *texUnit;
1157
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
1158
return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
1180
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
1182
return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
1160
1186
case GL_TEXTURE_GEN_R:
1162
const struct gl_texture_unit *texUnit;
1163
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
1164
return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
1188
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
1190
return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
1166
1194
case GL_TEXTURE_GEN_S:
1168
const struct gl_texture_unit *texUnit;
1169
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
1170
return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
1196
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
1198
return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
1172
1202
case GL_TEXTURE_GEN_T:
1174
const struct gl_texture_unit *texUnit;
1175
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
1176
return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
1204
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
1206
return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
1180
1212
* CLIENT STATE!!!