[Mesa-dev] [PATCH 3/4] mesa/vbo: add ARB_vertex_type_2_10_10_10_rev APIs.

Eric Anholt eric at anholt.net
Mon Sep 5 11:13:14 PDT 2011


On Sun,  4 Sep 2011 15:05:04 +0100, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This adds the vertex processing paths for the 2101010 types. It converts
> the attributes to floats for all the immediate entry points, some entrypoints
> are normalised and the attrib APIs take a normalized parameter.
> 
> There are four main paths,
> ui10 -> float unnormalized
> i10 -> float unnormalized
> ui10 -> float normalized
> i10 -> float normalized
> along with the ui2/i2 equivs.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/vbo/vbo_attrib_tmp.h |  401 ++++++++++++++++++++++++++++++++++++++++-
>  src/mesa/vbo/vbo_exec_api.c   |   45 +++++
>  src/mesa/vbo/vbo_save_api.c   |   46 +++++
>  3 files changed, 490 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
> index c793ce0..4283154 100644
> --- a/src/mesa/vbo/vbo_attrib_tmp.h
> +++ b/src/mesa/vbo/vbo_attrib_tmp.h

> +static inline float conv_ui10_to_norm_float(unsigned ui10)
> +{
> +   return (float)(ui10) / 1023.0;
> +}
> +
> +static inline float conv_ui2_to_norm_float(unsigned ui2)
> +{
> +   return (float)(ui2) / 3.0;
> +}
> +
> +#define ATTRUI10_1( A, UI ) ATTR( A, 1, (UI) & 0x3ff, 0, 0, 1 )
> +#define ATTRUI10_2( A, UI ) ATTR( A, 2, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, 0, 1 )
> +#define ATTRUI10_3( A, UI ) ATTR( A, 3, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, 1 )
> +#define ATTRUI10_4( A, UI ) ATTR( A, 4, (UI) & 0x3ff, ((UI) >> 10) & 0x3ff, ((UI) >> 20) & 0x3ff, ((UI) >> 30) & 0x3 )
> +
> +#define ATTRUI10N_1( A, UI ) ATTR( A, 1, conv_ui10_to_norm_float((UI) & 0x3ff), 0, 0, 1 )
> +#define ATTRUI10N_2( A, UI ) ATTR( A, 2, \
> +				   conv_ui10_to_norm_float((UI) & 0x3ff), \
> +				   conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), 0, 1 )
> +#define ATTRUI10N_3( A, UI ) ATTR( A, 3, \
> +				   conv_ui10_to_norm_float((UI) & 0x3ff), \
> +				   conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
> +				   conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), 1 )
> +#define ATTRUI10N_4( A, UI ) ATTR( A, 4, \
> +				   conv_ui10_to_norm_float((UI) & 0x3ff), \
> +				   conv_ui10_to_norm_float(((UI) >> 10) & 0x3ff), \
> +				   conv_ui10_to_norm_float(((UI) >> 20) & 0x3ff), \
> +				   conv_ui2_to_norm_float(((UI) >> 30) & 0x3) )

I think the alpha value for <4-component UNSIGNED_INT types here should
be 0x3 (though it looks right for INT below).
-------------- 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/20110905/1fe498d0/attachment.pgp>


More information about the mesa-dev mailing list