[Mesa-dev] Mesa (master): st/mesa: add support for clip vertex.

Christoph Bumiller e0425955 at student.tuwien.ac.at
Tue Jan 10 03:01:29 PST 2012


On 10.01.2012 04:52, Stéphane Marchesin wrote:
> Hi Dave,
>
> This regresses interpolation-none-gl_FrontColor-flat-vertex.shader_test
> piglit test on i915g.

That's likely. You're probably not using the ClipVertex but instead
gl_Position for clipping since the prior was not identifiable before.

The only difference between them in this test is a projection
transformation, and since the projection transformation only changed for
the plane coefficients in i915 but not the vector you test it against,
the test naturally fails.

Christoph

> Stéphane
>
>
> On Sat, Jan 7, 2012 at 00:39, Dave Airlie
> <airlied at kemper.freedesktop.org> wrote:
>> Module: Mesa
>> Branch: master
>> Commit: a103c61d278b7f56208818c4b949c408c00286fa
>> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a103c61d278b7f56208818c4b949c408c00286fa
>>
>> Author: Dave Airlie <airlied at redhat.com>
>> Date:   Wed Jan  4 11:49:26 2012 +0000
>>
>> st/mesa: add support for clip vertex.
>>
>> We need to pass the pre-projection matrix clip planes into the driver,
>> instead of the post for the case we have a vertex shader that writes clip
>> vertex.
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>>
>> ---
>>
>>  src/mesa/state_tracker/st_atom_clip.c |   20 ++++++++++++++------
>>  src/mesa/state_tracker/st_program.c   |    4 ++++
>>  2 files changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c
>> index 1330db8..236d3cf 100644
>> --- a/src/mesa/state_tracker/st_atom_clip.c
>> +++ b/src/mesa/state_tracker/st_atom_clip.c
>> @@ -34,7 +34,7 @@
>>  #include "st_context.h"
>>  #include "pipe/p_context.h"
>>  #include "st_atom.h"
>> -
>> +#include "st_program.h"
>>  #include "cso_cache/cso_context.h"
>>
>>
>> @@ -45,15 +45,23 @@ static void update_clip( struct st_context *st )
>>    struct pipe_clip_state clip;
>>    const struct gl_context *ctx = st->ctx;
>>    GLuint i;
>> +   bool use_eye = FALSE;
>>
>>    memset(&clip, 0, sizeof(clip));
>>
>> +   /* if we have a vertex shader that writes clip vertex we need to pass
>> +      the pre-projection transformed coordinates into the driver. */
>> +   if (st->vp) {
>> +      if (ctx->Shader.CurrentVertexProgram)
>> +         use_eye = TRUE;
>> +   }
>> +
>>    for (i = 0; i < PIPE_MAX_CLIP_PLANES; i++) {
>>       if (ctx->Transform.ClipPlanesEnabled & (1 << i)) {
>> -        memcpy(clip.ucp[clip.nr],
>> -               ctx->Transform._ClipUserPlane[i],
>> -               sizeof(clip.ucp[0]));
>> -        clip.nr++;
>> +         memcpy(clip.ucp[clip.nr],
>> +                use_eye ? ctx->Transform.EyeUserPlane[i] : ctx->Transform._ClipUserPlane[i],
>> +                sizeof(clip.ucp[0]));
>> +         clip.nr++;
>>       }
>>    }
>>
>> @@ -69,7 +77,7 @@ static void update_clip( struct st_context *st )
>>  const struct st_tracked_state st_update_clip = {
>>    "st_update_clip",                                   /* name */
>>    {                                                   /* dirty */
>> -      (_NEW_TRANSFORM),                                        /* mesa */
>> +      (_NEW_TRANSFORM | _NEW_PROGRAM),                 /* mesa */
>>       0,                                               /* st */
>>    },
>>    update_clip                                         /* update */
>> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
>> index 35d0e0f..8d7469d 100644
>> --- a/src/mesa/state_tracker/st_program.c
>> +++ b/src/mesa/state_tracker/st_program.c
>> @@ -255,6 +255,10 @@ st_prepare_vertex_program(struct gl_context *ctx,
>>          case VERT_RESULT_EDGE:
>>             assert(0);
>>             break;
>> +         case VERT_RESULT_CLIP_VERTEX:
>> +            stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
>> +            stvp->output_semantic_index[slot] = 0;
>> +            break;
>>
>>          case VERT_RESULT_TEX0:
>>          case VERT_RESULT_TEX1:
>>
>> _______________________________________________
>> mesa-commit mailing list
>> mesa-commit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-commit
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



More information about the mesa-dev mailing list