mesa: whitespace fixes in attrib.c
authorBrian Paul <brianp@vmware.com>
Thu, 25 Jan 2018 16:56:06 +0000 (09:56 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 25 Jan 2018 19:17:26 +0000 (12:17 -0700)
Trivial.

src/mesa/main/attrib.c

index 43b585690135740753ba1bbc2e320e0902411e74..0fdadaf0aaa63fb8125c96c8340d8d8229fd11ce 100644 (file)
@@ -249,7 +249,7 @@ _mesa_PushAttrib(GLbitfield mask)
       _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;
    }
 
@@ -276,7 +276,7 @@ _mesa_PushAttrib(GLbitfield mask)
    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;
@@ -313,7 +313,7 @@ _mesa_PushAttrib(GLbitfield mask)
    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;
@@ -440,7 +440,7 @@ _mesa_PushAttrib(GLbitfield mask)
 
    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;
@@ -574,10 +574,10 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
    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) {
@@ -595,15 +595,15 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
    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);
@@ -802,11 +802,11 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
       _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;
@@ -822,9 +822,9 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
          }
       }
       _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++) {
@@ -926,7 +926,7 @@ _mesa_PopAttrib(void)
    FLUSH_VERTICES(ctx, 0);
 
    if (ctx->AttribStackDepth == 0) {
-      _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
+      _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopAttrib");
       return;
    }
 
@@ -975,7 +975,7 @@ _mesa_PopAttrib(void)
                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),
@@ -990,13 +990,13 @@ _mesa_PopAttrib(void)
                    * 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
@@ -1080,9 +1080,9 @@ _mesa_PopAttrib(void)
             }
             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:
             {
@@ -1104,7 +1104,7 @@ _mesa_PopAttrib(void)
                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 |
@@ -1122,8 +1122,8 @@ _mesa_PopAttrib(void)
             }
             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:
             {
@@ -1143,13 +1143,13 @@ _mesa_PopAttrib(void)
                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:
@@ -1161,14 +1161,14 @@ _mesa_PopAttrib(void)
                _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);
                   {
@@ -1233,13 +1233,13 @@ _mesa_PopAttrib(void)
             }
             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:
             {
@@ -1258,7 +1258,7 @@ _mesa_PopAttrib(void)
                                         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,
@@ -1299,17 +1299,17 @@ _mesa_PopAttrib(void)
                                 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;
@@ -1373,7 +1373,7 @@ _mesa_PopAttrib(void)
                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++) {
@@ -1383,7 +1383,7 @@ _mesa_PopAttrib(void)
                   _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 */
@@ -1404,7 +1404,7 @@ _mesa_PopAttrib(void)
                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:
@@ -1425,21 +1425,21 @@ _mesa_PopAttrib(void)
                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);
@@ -1595,7 +1595,7 @@ restore_array_attrib(struct gl_context *ctx,
       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);
    }
@@ -1603,7 +1603,7 @@ restore_array_attrib(struct gl_context *ctx,
    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);
 }
 
 /**
@@ -1615,7 +1615,7 @@ init_array_attrib_data(struct gl_context *ctx,
                        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");
@@ -1651,7 +1651,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
    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;
    }
 
@@ -1663,22 +1663,22 @@ _mesa_PushClientAttrib(GLbitfield mask)
    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;
@@ -1688,7 +1688,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
          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;
        }
@@ -1696,7 +1696,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
 
    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;
@@ -1726,8 +1726,6 @@ end:
 }
 
 
-
-
 void GLAPIENTRY
 _mesa_PopClientAttrib(void)
 {
@@ -1737,7 +1735,7 @@ _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;
    }
 
@@ -1763,13 +1761,13 @@ _mesa_PopClientAttrib(void)
             }
             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");
       }
@@ -1819,7 +1817,8 @@ _mesa_free_attrib_data(struct gl_context *ctx)
 }
 
 
-void _mesa_init_attrib( struct gl_context *ctx )
+void
+_mesa_init_attrib(struct gl_context *ctx)
 {
    /* Renderer and client attribute stacks */
    ctx->AttribStackDepth = 0;