[Mesa-dev] Mesa (master): r300g: fix gl_PointCoord

keith whitwell keith.whitwell at gmail.com
Tue Aug 24 23:44:01 PDT 2010


The point state is complex, there are actually a lot of variations
built into GL itself which aren't obvious on first reading of the
spec.  Probably the most obscure is that wide points and point sprites
are specified to actually be rasterized differently, ie color
different pixels.  I'm doing this from memory, but Roland dug into it
in depth.  Wide points have an explicit set of rules for which pixels
they cover, but point sprites are to be rasterized with the same rules
as a quad of similar size (again from memory).  The docs do explain
it, but it's complex none the less, and I do still wonder if there is
a clear way of capturing all the variations.

On Wed, Aug 25, 2010 at 3:57 AM, Marek Olšák
<mareko at kemper.freedesktop.org> wrote:
> Module: Mesa
> Branch: master
> Commit: 879a73023189eed488db2840b829aa5c78e5ba3f
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=879a73023189eed488db2840b829aa5c78e5ba3f
>
> Author: Marek Olšák <maraeo at gmail.com>
> Date:   Wed Aug 25 04:55:01 2010 +0200
>
> r300g: fix gl_PointCoord
>
> Is this hackish or is this the correct way to use point_quad_rasterization?
> Copied from nvfx.
>
> ---
>
>  src/gallium/drivers/r300/r300_state.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
> index 3e35d7a..47e359c 100644
> --- a/src/gallium/drivers/r300/r300_state.c
> +++ b/src/gallium/drivers/r300/r300_state.c
> @@ -950,6 +950,11 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
>     rs->rs = *state;
>     rs->rs_draw = *state;
>
> +    /* Generate point sprite texture coordinates in GENERIC0
> +     * if point_quad_rasterization is TRUE. */
> +    rs->rs.sprite_coord_enable = state->point_quad_rasterization *
> +                                 (state->sprite_coord_enable | 1);
> +
>     /* Override some states for Draw. */
>     rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */
>
> @@ -1051,10 +1056,10 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
>
>     /* Point sprites */
>     stuffing_enable = 0;
> -    if (state->sprite_coord_enable) {
> +    if (rs->rs.sprite_coord_enable) {
>         stuffing_enable = R300_GB_POINT_STUFF_ENABLE;
>         for (i = 0; i < 8; i++) {
> -            if (state->sprite_coord_enable & (1 << i))
> +            if (rs->rs.sprite_coord_enable & (1 << i))
>                 stuffing_enable |=
>                     R300_GB_TEX_ST << (R300_GB_TEX0_SOURCE_SHIFT + (i*2));
>         }
>
> _______________________________________________
> mesa-commit mailing list
> mesa-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-commit
>


More information about the mesa-dev mailing list