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_F( t, fdst[3], fout[3], fin[3] ); INTERP_F( t, fdst[2], fout[2], fin[2] ); INTERP_F( t, fdst[1], fout[1], fin[1] ); INTERP_F( t, fdst[0], fout[0], fin[0] ); a[j].insert[4-1]( &a[j], vdst + a[j].vertoffset, fdst ); } }
static void d_interp (float t, int vdst, int vout, int vin) { const GLfloat *view = ctx_mx_viewport.mat; GLfloat4 *clip = &tnl_vb.clip[vdst]; SWvertex *dst = &vb[vdst]; SWvertex *in = &vb[vin]; SWvertex *out = &vb[vout]; const GLfloat oow = (clip[0][3] == 0.0F) ? 1.0F : (1.0F / clip[0][3]); const GLfloat wout = oow / out->oow; const GLfloat win = oow / in->oow; dst->x = clip[0][0] * oow * view[0] + view[12]; dst->y = clip[0][1] * oow * view[5] + view[13]; dst->z = clip[0][2] * oow * view[10] + view[14]; dst->oow = oow; INTERP_F(t, dst->r, out->r, in->r); INTERP_F(t, dst->g, out->g, in->g); INTERP_F(t, dst->b, out->b, in->b); INTERP_F(t, dst->a, out->a, in->a); }