_mesa_debug(ctx, "glPushAttrib %x\n", (int) mask);
if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) {
- _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" );
+ _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushAttrib");
return;
}
if (mask & GL_COLOR_BUFFER_BIT) {
GLuint i;
struct gl_colorbuffer_attrib *attr;
- attr = MALLOC_STRUCT( gl_colorbuffer_attrib );
+ attr = MALLOC_STRUCT(gl_colorbuffer_attrib);
if (attr == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
if (mask & GL_ENABLE_BIT) {
struct gl_enable_attrib *attr;
GLuint i;
- attr = MALLOC_STRUCT( gl_enable_attrib );
+ attr = MALLOC_STRUCT(gl_enable_attrib);
if (attr == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
if (mask & GL_PIXEL_MODE_BIT) {
struct gl_pixel_attrib *attr;
- attr = MALLOC_STRUCT( gl_pixel_attrib );
+ attr = MALLOC_STRUCT(gl_pixel_attrib);
if (attr == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
const GLuint curTexUnitSave = ctx->Texture.CurrentUnit;
GLuint i;
-#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \
- if ((VALUE) != (NEWVALUE)) { \
- _mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \
- }
+#define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \
+ if ((VALUE) != (NEWVALUE)) { \
+ _mesa_set_enable(ctx, ENUM, (NEWVALUE)); \
+ }
TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST);
if (ctx->Color.BlendEnabled != enable->Blend) {
for (i=0;i<ctx->Const.MaxClipPlanes;i++) {
const GLuint mask = 1 << i;
if ((ctx->Transform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask))
- _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i),
- !!(enable->ClipPlanes & mask));
+ _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i),
+ !!(enable->ClipPlanes & mask));
}
TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial,
GL_COLOR_MATERIAL);
TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
TEST_AND_UPDATE(ctx->Transform.DepthClamp, enable->DepthClamp,
- GL_DEPTH_CLAMP);
+ GL_DEPTH_CLAMP);
TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
_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);
+ unit->LodBias);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB,
- unit->Combine.ModeRGB);
+ unit->Combine.ModeRGB);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
- unit->Combine.ModeA);
+ unit->Combine.ModeA);
{
const GLuint n = ctx->Extensions.NV_texture_env_combine4 ? 4 : 3;
GLuint i;
}
}
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE,
- 1 << unit->Combine.ScaleShiftRGB);
+ 1 << unit->Combine.ScaleShiftRGB);
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE,
- 1 << unit->Combine.ScaleShiftA);
+ 1 << unit->Combine.ScaleShiftA);
/* Restore texture object state for each target */
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
FLUSH_VERTICES(ctx, 0);
if (ctx->AttribStackDepth == 0) {
- _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
+ _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopAttrib");
return;
}
else {
GLuint i;
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
- _mesa_ColorMaski(i,
+ _mesa_ColorMaski(i,
(GLboolean) (color->ColorMask[i][0] != 0),
(GLboolean) (color->ColorMask[i][1] != 0),
(GLboolean) (color->ColorMask[i][2] != 0),
* function, but legal for the later.
*/
GLboolean multipleBuffers = GL_FALSE;
- GLuint i;
+ GLuint i;
- for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
- if (color->DrawBuffer[i] != GL_NONE) {
- multipleBuffers = GL_TRUE;
- break;
- }
+ for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
+ if (color->DrawBuffer[i] != GL_NONE) {
+ multipleBuffers = GL_TRUE;
+ break;
+ }
}
/* Call the API_level functions, not _mesa_drawbuffers()
* since we need to do error checking on the pop'd
}
break;
case GL_CURRENT_BIT:
- FLUSH_CURRENT( ctx, 0 );
- memcpy( &ctx->Current, attr->data,
- sizeof(struct gl_current_attrib) );
+ FLUSH_CURRENT(ctx, 0);
+ memcpy(&ctx->Current, attr->data,
+ sizeof(struct gl_current_attrib));
break;
case GL_DEPTH_BUFFER_BIT:
{
const struct gl_enable_attrib *enable;
enable = (const struct gl_enable_attrib *) attr->data;
pop_enable_group(ctx, enable);
- ctx->NewState |= _NEW_ALL;
+ ctx->NewState |= _NEW_ALL;
ctx->NewDriverState |= ctx->DriverFlags.NewAlphaTest |
ctx->DriverFlags.NewBlend |
ctx->DriverFlags.NewClipPlaneEnable |
}
break;
case GL_EVAL_BIT:
- memcpy( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) );
- ctx->NewState |= _NEW_EVAL;
+ memcpy(&ctx->Eval, attr->data, sizeof(struct gl_eval_attrib));
+ ctx->NewState |= _NEW_EVAL;
break;
case GL_FOG_BIT:
{
const struct gl_hint_attrib *hint;
hint = (const struct gl_hint_attrib *) attr->data;
_mesa_Hint(GL_PERSPECTIVE_CORRECTION_HINT,
- hint->PerspectiveCorrection );
+ hint->PerspectiveCorrection);
_mesa_Hint(GL_POINT_SMOOTH_HINT, hint->PointSmooth);
_mesa_Hint(GL_LINE_SMOOTH_HINT, hint->LineSmooth);
_mesa_Hint(GL_POLYGON_SMOOTH_HINT, hint->PolygonSmooth);
_mesa_Hint(GL_FOG_HINT, hint->Fog);
- _mesa_Hint(GL_TEXTURE_COMPRESSION_HINT_ARB,
- hint->TextureCompression);
+ _mesa_Hint(GL_TEXTURE_COMPRESSION_HINT_ARB,
+ hint->TextureCompression);
}
break;
case GL_LIGHTING_BIT:
_mesa_set_enable(ctx, GL_LIGHTING, light->Enabled);
/* per-light state */
if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top))
- _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
-
+ _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
+
for (i = 0; i < ctx->Const.MaxLights; i++) {
const struct gl_light *l = &light->Light[i];
_mesa_set_enable(ctx, GL_LIGHT0 + i, l->Enabled);
_mesa_light(ctx, i, GL_AMBIENT, l->Ambient);
_mesa_light(ctx, i, GL_DIFFUSE, l->Diffuse);
- _mesa_light(ctx, i, GL_SPECULAR, l->Specular );
+ _mesa_light(ctx, i, GL_SPECULAR, l->Specular);
_mesa_light(ctx, i, GL_POSITION, l->EyePosition);
_mesa_light(ctx, i, GL_SPOT_DIRECTION, l->SpotDirection);
{
}
break;
case GL_LIST_BIT:
- memcpy( &ctx->List, attr->data, sizeof(struct gl_list_attrib) );
+ memcpy(&ctx->List, attr->data, sizeof(struct gl_list_attrib));
break;
case GL_PIXEL_MODE_BIT:
- memcpy( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) );
+ memcpy(&ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib));
/* XXX what other pixel state needs to be set by function calls? */
_mesa_ReadBuffer(ctx->Pixel.ReadBuffer);
- ctx->NewState |= _NEW_PIXEL;
+ ctx->NewState |= _NEW_PIXEL;
break;
case GL_POINT_BIT:
{
point->Threshold);
}
if (ctx->Extensions.NV_point_sprite
- || ctx->Extensions.ARB_point_sprite) {
+ || ctx->Extensions.ARB_point_sprite) {
GLuint u;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
_mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV,
polygon->OffsetFill);
}
break;
- case GL_POLYGON_STIPPLE_BIT:
- memcpy( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) );
+ case GL_POLYGON_STIPPLE_BIT:
+ memcpy(ctx->PolygonStipple, attr->data, 32*sizeof(GLuint));
if (ctx->DriverFlags.NewPolygonStipple)
ctx->NewDriverState |= ctx->DriverFlags.NewPolygonStipple;
else
ctx->NewState |= _NEW_POLYGONSTIPPLE;
- if (ctx->Driver.PolygonStipple)
- ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data );
- break;
+ if (ctx->Driver.PolygonStipple)
+ ctx->Driver.PolygonStipple(ctx, (const GLubyte *) attr->data);
+ break;
case GL_SCISSOR_BIT:
{
unsigned i;
xform = (const struct gl_transform_attrib *) attr->data;
_mesa_MatrixMode(xform->MatrixMode);
if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top))
- _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
+ _math_matrix_analyse(ctx->ProjectionMatrixStack.Top);
/* restore clip planes */
for (i = 0; i < ctx->Const.MaxClipPlanes; i++) {
_mesa_set_enable(ctx, GL_CLIP_PLANE0 + i,
!!(xform->ClipPlanesEnabled & mask));
if (ctx->Driver.ClipPlane)
- ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane );
+ ctx->Driver.ClipPlane(ctx, GL_CLIP_PLANE0 + i, eyePlane);
}
/* normalize/rescale */
struct texture_state *texstate
= (struct texture_state *) attr->data;
pop_texture_group(ctx, texstate);
- ctx->NewState |= _NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE;
}
break;
case GL_VIEWPORT_BIT:
const struct gl_multisample_attrib *ms;
ms = (const struct gl_multisample_attrib *) attr->data;
- TEST_AND_UPDATE(ctx->Multisample.Enabled,
- ms->Enabled,
- GL_MULTISAMPLE);
+ TEST_AND_UPDATE(ctx->Multisample.Enabled,
+ ms->Enabled,
+ GL_MULTISAMPLE);
- TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
- ms->SampleCoverage,
- GL_SAMPLE_COVERAGE);
+ TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
+ ms->SampleCoverage,
+ GL_SAMPLE_COVERAGE);
- TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage,
- ms->SampleAlphaToCoverage,
- GL_SAMPLE_ALPHA_TO_COVERAGE);
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage,
+ ms->SampleAlphaToCoverage,
+ GL_SAMPLE_ALPHA_TO_COVERAGE);
- TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
- ms->SampleAlphaToOne,
- GL_SAMPLE_ALPHA_TO_ONE);
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
+ ms->SampleAlphaToOne,
+ GL_SAMPLE_ALPHA_TO_ONE);
_mesa_SampleCoverage(ms->SampleCoverageValue,
ms->SampleCoverageInvert);
copy_array_attrib(ctx, dest, src, false);
_mesa_BindBuffer(GL_ARRAY_BUFFER_ARB,
- src->ArrayBufferObj->Name);
+ src->ArrayBufferObj->Name);
} else {
copy_array_attrib(ctx, dest, src, true);
}
if (is_vao_name_zero || src->VAO->IndexBufferObj->Name == 0 ||
_mesa_IsBuffer(src->VAO->IndexBufferObj->Name))
_mesa_BindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,
- src->VAO->IndexBufferObj->Name);
+ src->VAO->IndexBufferObj->Name);
}
/**
struct gl_array_attrib *attrib)
{
/* Get a non driver gl_vertex_array_object. */
- attrib->VAO = CALLOC_STRUCT( gl_vertex_array_object );
+ attrib->VAO = CALLOC_STRUCT(gl_vertex_array_object);
if (attrib->VAO == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
GET_CURRENT_CONTEXT(ctx);
if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) {
- _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" );
+ _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushClientAttrib");
return;
}
if (mask & GL_CLIENT_PIXEL_STORE_BIT) {
struct gl_pixelstore_attrib *attr;
/* packing attribs */
- attr = CALLOC_STRUCT( gl_pixelstore_attrib );
+ attr = CALLOC_STRUCT(gl_pixelstore_attrib);
if (attr == NULL) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" );
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
goto end;
}
if (save_attrib_data(&head, GL_CLIENT_PACK_BIT, attr)) {
copy_pixelstore(ctx, attr, &ctx->Pack);
}
else {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" );
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
free(attr);
goto end;
}
/* unpacking attribs */
- attr = CALLOC_STRUCT( gl_pixelstore_attrib );
+ attr = CALLOC_STRUCT(gl_pixelstore_attrib);
if (attr == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
goto end;
copy_pixelstore(ctx, attr, &ctx->Unpack);
}
else {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" );
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
free(attr);
goto end;
}
if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
struct gl_array_attrib *attr;
- attr = CALLOC_STRUCT( gl_array_attrib );
+ attr = CALLOC_STRUCT(gl_array_attrib);
if (attr == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
goto end;
}
-
-
void GLAPIENTRY
_mesa_PopClientAttrib(void)
{
FLUSH_VERTICES(ctx, 0);
if (ctx->ClientAttribStackDepth == 0) {
- _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" );
+ _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib");
return;
}
}
break;
case GL_CLIENT_VERTEX_ARRAY_BIT: {
- struct gl_array_attrib * attr =
- (struct gl_array_attrib *) node->data;
+ struct gl_array_attrib * attr =
+ (struct gl_array_attrib *) node->data;
restore_array_attrib(ctx, &ctx->Array, attr);
free_array_attrib_data(ctx, attr);
- ctx->NewState |= _NEW_ARRAY;
+ ctx->NewState |= _NEW_ARRAY;
break;
- }
+ }
default:
unreachable("Bad attrib flag in PopClientAttrib");
}
}
-void _mesa_init_attrib( struct gl_context *ctx )
+void
+_mesa_init_attrib(struct gl_context *ctx)
{
/* Renderer and client attribute stacks */
ctx->AttribStackDepth = 0;