Пример #1
0
/* Helper functions for hardware which doesn't put back colors and/or
 * edgeflags into vertices.
 */
void _tnl_generic_interp_extras( struct gl_context *ctx,
				   GLfloat t,
				   GLuint dst, GLuint out, GLuint in,
				   GLboolean force_boundary )
{
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

   /* If stride is zero, BackfaceColorPtr is constant across the VB, so
    * there is no point interpolating between two values as they will
    * be identical.  In all other cases, this value is generated by
    * t_vb_lighttmp.h and has a stride of 4 dwords.
    */
   if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) {
      assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat));

      INTERP_4F( t,
		 VB->BackfaceColorPtr->data[dst],
		 VB->BackfaceColorPtr->data[out],
		 VB->BackfaceColorPtr->data[in] );
   }
   
   if (VB->BackfaceIndexPtr) {
      VB->BackfaceIndexPtr->data[dst][0] = LINTERP( t,
					       VB->BackfaceIndexPtr->data[out][0],
					       VB->BackfaceIndexPtr->data[in][0] );
   }

   if (VB->EdgeFlag) {
      VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
   }

   _tnl_generic_interp(ctx, t, dst, out, in, force_boundary);
}
Пример #2
0
INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
					  GLfloat t,
					  GLuint dst, GLuint out, GLuint in,
					  GLboolean force_boundary )
{
   LOCALVARS
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

   if (VB->ColorPtr[1]) {
      assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
      
      INTERP_4F( t,
		    GET_COLOR(VB->ColorPtr[1], dst),
		    GET_COLOR(VB->ColorPtr[1], out),
		    GET_COLOR(VB->ColorPtr[1], in) );

      if (VB->SecondaryColorPtr[1]) {
	 INTERP_3F( t,
		       GET_COLOR(VB->SecondaryColorPtr[1], dst),
		       GET_COLOR(VB->SecondaryColorPtr[1], out),
		       GET_COLOR(VB->SecondaryColorPtr[1], in) );
      }
   }

   if (VB->EdgeFlag) {
      VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
   }

   INTERP_VERTEX(ctx, t, dst, out, in, force_boundary);
}
Пример #3
0
static void interp_extras( GLcontext *ctx,
                           GLfloat t,
                           GLuint dst, GLuint out, GLuint in,
                           GLboolean force_boundary )
{
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

    if (VB->ColorPtr[1]) {
        /* If stride is zero, ColorPtr[1] is constant across the VB, so
         * there is no point interpolating between two values as they will
         * be identical.  This case is handled in t_dd_tritmp.h
         */
        if (VB->ColorPtr[1]->stride) {
            assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));
            INTERP_4F( t,
                       GET_COLOR(VB->ColorPtr[1], dst),
                       GET_COLOR(VB->ColorPtr[1], out),
                       GET_COLOR(VB->ColorPtr[1], in) );
        }

        if (VB->SecondaryColorPtr[1]) {
            INTERP_3F( t,
                       GET_COLOR(VB->SecondaryColorPtr[1], dst),
                       GET_COLOR(VB->SecondaryColorPtr[1], out),
                       GET_COLOR(VB->SecondaryColorPtr[1], in) );
        }
    }

    if (VB->EdgeFlag) {
        VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
    }

    setup_tab[FX_CONTEXT(ctx)->SetupIndex].interp(ctx, t, dst, out, in,
            force_boundary);
}
Пример #4
0
/* Helper functions for hardware which doesn't put back colors and/or
 * edgeflags into vertices.
 */
static void generic_interp_extras( GLcontext *ctx,
				   GLfloat t,
				   GLuint dst, GLuint out, GLuint in,
				   GLboolean force_boundary )
{
   struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

   if (VB->ColorPtr[1]) {
      assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat));

      INTERP_4F( t,
		 VB->ColorPtr[1]->data[dst],
		 VB->ColorPtr[1]->data[out],
		 VB->ColorPtr[1]->data[in] );

      if (VB->SecondaryColorPtr[1]) {
	 INTERP_3F( t,
		    VB->SecondaryColorPtr[1]->data[dst],
		    VB->SecondaryColorPtr[1]->data[out],
		    VB->SecondaryColorPtr[1]->data[in] );
      }
   }
   else if (VB->IndexPtr[1]) {
      VB->IndexPtr[1]->data[dst][0] = LINTERP( t,
					       VB->IndexPtr[1]->data[out][0],
					       VB->IndexPtr[1]->data[in][0] );
   }

   if (VB->EdgeFlag) {
      VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
   }

   generic_interp(ctx, t, dst, out, in, force_boundary);
}
Пример #5
0
void _tnl_generic_interp( struct gl_context *ctx,
                          GLfloat t,
                          GLuint edst, GLuint eout, GLuint ein,
                          GLboolean force_boundary )
{
    TNLcontext *tnl = TNL_CONTEXT(ctx);
    struct vertex_buffer *VB = &tnl->vb;
    struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
    const GLubyte *vin  = vtx->vertex_buf + ein  * vtx->vertex_size;
    const GLubyte *vout = vtx->vertex_buf + eout * vtx->vertex_size;
    GLubyte *vdst = vtx->vertex_buf + edst * vtx->vertex_size;
    const struct tnl_clipspace_attr *a = vtx->attr;
    const GLuint attr_count = vtx->attr_count;
    GLuint j;
    (void) force_boundary;

    if (tnl->NeedNdcCoords) {
        const GLfloat *dstclip = VB->ClipPtr->data[edst];
        if (dstclip[3] != 0.0) {
            const GLfloat w = 1.0f / dstclip[3];
            GLfloat pos[4];

            pos[0] = dstclip[0] * w;
            pos[1] = dstclip[1] * w;
            pos[2] = dstclip[2] * w;
            pos[3] = w;

            a[0].insert[4-1]( &a[0], vdst, pos );
        }
    }
    else {
        a[0].insert[4-1]( &a[0], vdst, VB->ClipPtr->data[edst] );
    }


    for (j = 1; j < attr_count; j++) {
        GLfloat fin[4], fout[4], fdst[4];

        a[j].extract( &a[j], fin, vin + a[j].vertoffset );
        a[j].extract( &a[j], fout, vout + a[j].vertoffset );

        INTERP_4F(t, fdst, fout, fin);

        a[j].insert[4-1]( &a[j], vdst + a[j].vertoffset, fdst );
    }
}
Пример #6
0
static void interp_extras( GLcontext *ctx,
                           GLfloat t,
                           GLuint dst, GLuint out, GLuint in,
                           GLboolean force_boundary )
{
    struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;

    /*fprintf(stderr, "%s\n", __FUNCTION__);*/

    if (VB->ColorPtr[1]) {
        INTERP_4F( t,
                   GET_COLOR(VB->ColorPtr[1], dst),
                   GET_COLOR(VB->ColorPtr[1], out),
                   GET_COLOR(VB->ColorPtr[1], in) );
    }

    if (VB->EdgeFlag) {
        VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary;
    }

    setup_tab[TDFX_CONTEXT(ctx)->SetupIndex].interp(ctx, t, dst, out, in,
            force_boundary);
}