GLuint u;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
_mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV,
- (GLint) point->CoordReplace[u]);
+ !!(point->CoordReplaceBits & (1u << u)));
}
_mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite);
if (ctx->Extensions.NV_point_sprite)
GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */
GLboolean PointSprite; /**< GL_NV/ARB_point_sprite */
GLboolean CoordReplace[MAX_TEXTURE_COORD_UNITS]; /**< GL_ARB_point_sprite*/
+ GLbitfield CoordReplaceBits; /**< GL_ARB_point_sprite*/
GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */
GLenum SpriteOrigin; /**< GL_ARB_point_sprite */
};
return;
}
if (pname == GL_COORD_REPLACE_NV) {
- if (iparam0 == GL_TRUE || iparam0 == GL_FALSE) {
- /* It's kind of weird to set point state via glTexEnv,
- * but that's what the spec calls for.
- */
- const GLboolean state = (GLboolean) iparam0;
- if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state)
+ /* It's kind of weird to set point state via glTexEnv,
+ * but that's what the spec calls for.
+ */
+ if (iparam0 == GL_TRUE) {
+ if (ctx->Point.CoordReplaceBits & (1u << ctx->Texture.CurrentUnit))
return;
- FLUSH_VERTICES(ctx, _NEW_POINT);
- ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state;
- }
- else {
+ ctx->Point.CoordReplaceBits |= (1u << ctx->Texture.CurrentUnit);
+ ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = GL_TRUE;
+ } else if (iparam0 == GL_FALSE) {
+ if (~(ctx->Point.CoordReplaceBits) & (1u << ctx->Texture.CurrentUnit))
+ return;
+ ctx->Point.CoordReplaceBits &= ~(1u << ctx->Texture.CurrentUnit);
+ ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = GL_FALSE;
+ } else {
_mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", iparam0);
return;
}
+ FLUSH_VERTICES(ctx, _NEW_POINT);
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
return;
}
if (pname == GL_COORD_REPLACE_NV) {
- *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ if (ctx->Point.CoordReplaceBits & (1u << ctx->Texture.CurrentUnit))
+ *params = 1.0f;
+ else
+ *params = 0.0f;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" );
return;
}
if (pname == GL_COORD_REPLACE_NV) {
- *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit];
+ if (ctx->Point.CoordReplaceBits & (1u << ctx->Texture.CurrentUnit))
+ *params = GL_TRUE;
+ else
+ *params = GL_FALSE;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" );