[Mesa-dev] [PATCH V5 5/6] i965 Gen4/5: clip: Add support for noperspective varyings
Kenneth Graunke
kenneth at whitecape.org
Wed Jul 31 10:56:58 PDT 2013
On 07/31/2013 04:07 AM, Chris Forbes wrote:
[snip]
> @@ -148,12 +150,107 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
> */
> brw_copy_indirect_to_indirect(p, dest_ptr, v0_ptr, 1);
>
> - /* Iterate over each attribute (could be done in pairs?)
> +
> + /* First handle the 3D and NDC interpolation, in case we
> + * need noperspective interpolation. Doing it early has no
> + * performance impact in any case.
> + */
> +
> + /* Take a copy of the v0 NDC coordinates, in case dest == v0. */
> + if (c->has_noperspective_shading) {
> + GLuint offset = brw_varying_to_offset(&c->vue_map,
> + BRW_VARYING_SLOT_NDC);
> + v0_ndc_copy = get_tmp(c);
> + brw_MOV(p, v0_ndc_copy, deref_4f(v0_ptr, offset));
> + }
> +
> + /* Compute the new 3D position
> + *
> + * dest_hpos = v0_hpos * (1 - t0) + v1_hpos * t0
> + */
> + {
> + GLuint delta = brw_varying_to_offset(&c->vue_map, VARYING_SLOT_POS);
> + struct brw_reg tmp = get_tmp(c);
> + brw_MUL(p, vec4(brw_null_reg()), deref_4f(v1_ptr, delta), t0);
> + brw_MAC(p, tmp, negate(deref_4f(v0_ptr, delta)), t0);
> + brw_ADD(p, deref_4f(dest_ptr, delta), deref_4f(v0_ptr, delta), tmp);
> + release_tmp(c, tmp);
> + }
> +
> + /* Recreate the projected (NDC) coordinate in the new vertex header */
> + brw_clip_project_vertex(c, dest_ptr);
> +
> + /* If we have noperspective attributes,
> + * we need to compute the screen-space t
> + */
Your comment here stops mid-sentence.
I also agree with Paul's suggestions about bool types. Other than that,
though, this looks good!
This series is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
I don't think you need to send out a v6 - just touch up those few things
and push away! Thanks Chris.
More information about the mesa-dev
mailing list