i915: Simplify intel_wpos_* with a helper function.

This commit is contained in:
Eric Anholt
2011-07-13 10:57:58 -07:00
parent fceda4342c
commit cb5e0ba2aa
3 changed files with 27 additions and 47 deletions

View File

@@ -1342,7 +1342,6 @@ i915ValidateFragmentProgram(struct i915_context *i915)
intel->vertex_attr_count = 0;
intel->wpos_offset = 0;
intel->wpos_size = 0;
intel->coloroffset = 0;
intel->specoffset = 0;
@@ -1385,17 +1384,15 @@ i915ValidateFragmentProgram(struct i915_context *i915)
EMIT_ATTR(_TNL_ATTRIB_GENERIC0 + i, EMIT_SZ(sz), 0, sz * 4);
}
else if (i == p->wpos_tex) {
int wpos_size = 4 * sizeof(float);
/* If WPOS is required, duplicate the XYZ position data in an
* unused texture coordinate:
*/
s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(4));
s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(wpos_size));
intel->wpos_offset = offset;
intel->wpos_size = 4 * sizeof(GLuint);
EMIT_PAD(intel->wpos_size);
EMIT_PAD(wpos_size);
}
}