mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
[mesa.git] / src / mesa / swrast / s_context.c
index 238f923e3d14e3628a085a58c4186b866a4057a9..d6d1004d9d89c28adbac8d100f65ff7f46345576 100644 (file)
@@ -17,7 +17,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
@@ -251,9 +251,7 @@ _swrast_update_fog_state( struct gl_context *ctx )
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
 
-   assert((fp == NULL) ||
-          (fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB) ||
-          (fp->Base.Target == GL_FRAGMENT_PROGRAM_NV));
+   assert(fp == NULL || fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB);
 
    /* determine if fog is needed, and if so, which fog mode */
    swrast->_FogEnabled = (!_swrast_use_fragment_program(ctx) &&
@@ -504,7 +502,7 @@ _swrast_update_active_attribs(struct gl_context *ctx)
    if (_swrast_use_fragment_program(ctx)) {
       /* fragment program/shader */
       attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
-      attribsMask &= ~FRAG_BIT_WPOS; /* WPOS is always handled specially */
+      attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */
    }
    else if (ctx->ATIFragmentShader._Enabled) {
       attribsMask = ~0;  /* XXX fix me */
@@ -514,19 +512,19 @@ _swrast_update_active_attribs(struct gl_context *ctx)
       attribsMask = 0x0;
 
 #if CHAN_TYPE == GL_FLOAT
-      attribsMask |= FRAG_BIT_COL0;
+      attribsMask |= VARYING_BIT_COL0;
 #endif
 
       if (ctx->Fog.ColorSumEnabled ||
           (ctx->Light.Enabled &&
            ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
-         attribsMask |= FRAG_BIT_COL1;
+         attribsMask |= VARYING_BIT_COL1;
       }
 
       if (swrast->_FogEnabled)
-         attribsMask |= FRAG_BIT_FOGC;
+         attribsMask |= VARYING_BIT_FOGC;
 
-      attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0);
+      attribsMask |= (ctx->Texture._EnabledUnits << VARYING_SLOT_TEX0);
    }
 
    swrast->_ActiveAttribMask = attribsMask;
@@ -534,11 +532,11 @@ _swrast_update_active_attribs(struct gl_context *ctx)
    /* Update _ActiveAttribs[] list */
    {
       GLuint i, num = 0;
-      for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+      for (i = 0; i < VARYING_SLOT_MAX; i++) {
          if (attribsMask & BITFIELD64_BIT(i)) {
             swrast->_ActiveAttribs[num++] = i;
             /* how should this attribute be interpolated? */
-            if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)
+            if (i == VARYING_SLOT_COL0 || i == VARYING_SLOT_COL1)
                swrast->_InterpMode[i] = ctx->Light.ShadeModel;
             else
                swrast->_InterpMode[i] = GL_SMOOTH;
@@ -720,7 +718,7 @@ GLboolean
 _swrast_CreateContext( struct gl_context *ctx )
 {
    GLuint i;
-   SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
+   SWcontext *swrast = calloc(1, sizeof(SWcontext));
 #ifdef _OPENMP
    const GLuint maxThreads = omp_get_max_threads();
 #else
@@ -775,9 +773,9 @@ _swrast_CreateContext( struct gl_context *ctx )
     * using multiple threads, it is necessary to have one SpanArrays instance
     * per thread.
     */
-   swrast->SpanArrays = (SWspanarrays *) malloc(maxThreads * sizeof(SWspanarrays));
+   swrast->SpanArrays = malloc(maxThreads * sizeof(SWspanarrays));
    if (!swrast->SpanArrays) {
-      FREE(swrast);
+      free(swrast);
       return GL_FALSE;
    }
    for(i = 0; i < maxThreads; i++) {
@@ -787,7 +785,7 @@ _swrast_CreateContext( struct gl_context *ctx )
 #elif CHAN_TYPE == GL_UNSIGNED_SHORT
       swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].rgba16;
 #else
-      swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[FRAG_ATTRIB_COL0];
+      swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[VARYING_SLOT_COL0];
 #endif
    }
 
@@ -803,10 +801,10 @@ _swrast_CreateContext( struct gl_context *ctx )
 
    ctx->swrast_context = swrast;
 
-   swrast->stencil_temp.buf1 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
-   swrast->stencil_temp.buf2 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
-   swrast->stencil_temp.buf3 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
-   swrast->stencil_temp.buf4 = (GLubyte *) malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+   swrast->stencil_temp.buf1 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+   swrast->stencil_temp.buf2 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+   swrast->stencil_temp.buf3 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
+   swrast->stencil_temp.buf4 = malloc(SWRAST_MAX_WIDTH * sizeof(GLubyte));
 
    if (!swrast->stencil_temp.buf1 ||
        !swrast->stencil_temp.buf2 ||
@@ -828,17 +826,16 @@ _swrast_DestroyContext( struct gl_context *ctx )
       _mesa_debug(ctx, "_swrast_DestroyContext\n");
    }
 
-   FREE( swrast->SpanArrays );
-   if (swrast->ZoomedArrays)
-      FREE( swrast->ZoomedArrays );
-   FREE( swrast->TexelBuffer );
+   free( swrast->SpanArrays );
+   free( swrast->ZoomedArrays );
+   free( swrast->TexelBuffer );
 
    free(swrast->stencil_temp.buf1);
    free(swrast->stencil_temp.buf2);
    free(swrast->stencil_temp.buf3);
    free(swrast->stencil_temp.buf4);
 
-   FREE( swrast );
+   free( swrast );
 
    ctx->swrast_context = 0;
 }
@@ -921,18 +918,18 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
 
    if (SWRAST_DEBUG_VERTICES) {
       _mesa_debug(ctx, "win %f %f %f %f\n",
-                  v->attrib[FRAG_ATTRIB_WPOS][0],
-                  v->attrib[FRAG_ATTRIB_WPOS][1],
-                  v->attrib[FRAG_ATTRIB_WPOS][2],
-                  v->attrib[FRAG_ATTRIB_WPOS][3]);
+                  v->attrib[VARYING_SLOT_POS][0],
+                  v->attrib[VARYING_SLOT_POS][1],
+                  v->attrib[VARYING_SLOT_POS][2],
+                  v->attrib[VARYING_SLOT_POS][3]);
 
       for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
         if (ctx->Texture.Unit[i]._ReallyEnabled)
            _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][0],
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][1],
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][2],
-                        v->attrib[FRAG_ATTRIB_TEX0 + i][3]);
+                        v->attrib[VARYING_SLOT_TEX0 + i][0],
+                        v->attrib[VARYING_SLOT_TEX0 + i][1],
+                        v->attrib[VARYING_SLOT_TEX0 + i][2],
+                        v->attrib[VARYING_SLOT_TEX0 + i][3]);
 
 #if CHAN_TYPE == GL_FLOAT
       _mesa_debug(ctx, "color %f %f %f %f\n",
@@ -942,12 +939,12 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
                   v->color[0], v->color[1], v->color[2], v->color[3]);
 #endif
       _mesa_debug(ctx, "spec %g %g %g %g\n",
-                  v->attrib[FRAG_ATTRIB_COL1][0],
-                  v->attrib[FRAG_ATTRIB_COL1][1],
-                  v->attrib[FRAG_ATTRIB_COL1][2],
-                  v->attrib[FRAG_ATTRIB_COL1][3]);
-      _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
-      _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]);
+                  v->attrib[VARYING_SLOT_COL1][0],
+                  v->attrib[VARYING_SLOT_COL1][1],
+                  v->attrib[VARYING_SLOT_COL1][2],
+                  v->attrib[VARYING_SLOT_COL1][3]);
+      _mesa_debug(ctx, "fog %f\n", v->attrib[VARYING_SLOT_FOGC][0]);
+      _mesa_debug(ctx, "index %f\n", v->attrib[VARYING_SLOT_CI][0]);
       _mesa_debug(ctx, "pointsize %f\n", v->pointSize);
       _mesa_debug(ctx, "\n");
    }