[Mesa-dev] [PATCH 31/36] i965: clip: Add a function to determine whether a vert_result is in use.
Eric Anholt
eric at anholt.net
Fri Sep 2 14:40:07 PDT 2011
On Fri, 2 Sep 2011 09:07:10 -0700, Paul Berry <stereotype441 at gmail.com> wrote:
> Previously we would examine the offset[] array (since an offset of 0
> meant "not in use"). This paves the way for removing the offset[]
> array.
> ---
> src/mesa/drivers/dri/i965/brw_clip.h | 9 +++++++++
> src/mesa/drivers/dri/i965/brw_clip_unfilled.c | 14 +++++++++-----
> src/mesa/drivers/dri/i965/brw_clip_util.c | 8 ++++----
> 3 files changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_clip.h b/src/mesa/drivers/dri/i965/brw_clip.h
> index 0324fea..80d4412 100644
> --- a/src/mesa/drivers/dri/i965/brw_clip.h
> +++ b/src/mesa/drivers/dri/i965/brw_clip.h
> @@ -126,6 +126,15 @@ struct brw_clip_compile {
>
> #define ATTR_SIZE (4*4)
>
> +/**
> + * True if the given vert_result is one of the outputs of the vertex shader.
> + */
> +static inline GLboolean brw_clip_have_vert_result(struct brw_clip_compile *c,
> + GLuint vert_result)
> +{
> + return (c->key.attrs & BITFIELD64_BIT(vert_result)) ? 1 : 0;
> +}
This helper function doesn't look like it's really saving typing, but if
you like it, please use "bool" instead of "GLboolean" except in GL API
implementation.
> +
> /* Points are only culled, so no need for a clip routine, however it
> * works out easier to have a dummy one.
> */
> diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
> index da58796..53345f1 100644
> --- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
> +++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
> @@ -130,8 +130,10 @@ static void copy_bfc( struct brw_clip_compile *c )
>
> /* Do we have any colors to copy?
> */
> - if (!(c->offset[VERT_RESULT_COL0] && c->offset[VERT_RESULT_BFC0]) &&
> - !(c->offset[VERT_RESULT_COL1] && c->offset[VERT_RESULT_BFC1]))
> + if (!(brw_clip_have_vert_result(c, VERT_RESULT_COL0) &&
> + brw_clip_have_vert_result(c, VERT_RESULT_BFC0)) &&
> + !(brw_clip_have_vert_result(c, VERT_RESULT_COL1) &&
> + brw_clip_have_vert_result(c, VERT_RESULT_BFC1)))
> return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110902/4177c076/attachment-0001.pgp>
More information about the mesa-dev
mailing list