[Mesa-dev] [PATCH] nv50, nvc0: disable depth offsets when there is no depth buffer

Patrick Rudolph siro at das-labor.org
Mon Jan 16 06:24:48 UTC 2017


On Sun, 15 Jan 2017 22:06:01 +0100
Axel Davy <axel.davy at ens.fr> wrote:

As far as I remember this doesn't affact wine, as it resets the offset
in case no depth buffer is attached.
The same could be done in nine, but would add some overhead and
it isn't required on other gallium drivers.

Regards,
Patrick
> Shouldn't this be fixed in wine, rather than in the driver ?
> 
> 
> Yours,
> 
> Axel
> 
> On 15/01/2017 21:57, Ilia Mirkin wrote:
> > While I can find no support for this in the GL spec, this is
> > apparently what D3D9 wants. Also appears to fix a very
> > long-standing bug in Tomb Raider: Underworld and Deus Ex: Human
> > Revolution (probably based on the same engines).
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91247
> > References: https://github.com/iXit/Mesa-3D/issues/224
> > Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> > ---
> >   src/gallium/drivers/nouveau/nv50/nv50_state.c          |  4 ----
> >   src/gallium/drivers/nouveau/nv50/nv50_state_validate.c | 17
> > +++++++++++++++++
> > src/gallium/drivers/nouveau/nv50/nv50_stateobj.h       |  2 +-
> > src/gallium/drivers/nouveau/nvc0/nvc0_state.c          |  4 ----
> > src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c |  5 +++++
> > src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h       |  2 +- 6
> > files changed, 24 insertions(+), 10 deletions(-)
> >
> > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c
> > b/src/gallium/drivers/nouveau/nv50/nv50_state.c index
> > 99d70d1..e66257a 100644 ---
> > a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++
> > b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -301,10 +301,6
> > @@ nv50_rasterizer_state_create(struct pipe_context *pipe, 
> >      SB_BEGIN_3D(so, POLYGON_STIPPLE_ENABLE, 1);
> >      SB_DATA    (so, cso->poly_stipple_enable);
> > -   SB_BEGIN_3D(so, POLYGON_OFFSET_POINT_ENABLE, 3);
> > -   SB_DATA    (so, cso->offset_point);
> > -   SB_DATA    (so, cso->offset_line);
> > -   SB_DATA    (so, cso->offset_tri);
> >   
> >      if (cso->offset_point || cso->offset_line || cso->offset_tri) {
> >         SB_BEGIN_3D(so, POLYGON_OFFSET_FACTOR, 1);
> > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
> > b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c index
> > c6f0363..0db13d9 100644 ---
> > a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c +++
> > b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c @@ -347,6
> > +347,22 @@ nv50_validate_derived_2(struct nv50_context *nv50) }
> >   
> >   static void
> > +nv50_validate_rast_fb(struct nv50_context *nv50)
> > +{
> > +   struct nouveau_pushbuf *push = nv50->base.pushbuf;
> > +   struct pipe_framebuffer_state *fb = &nv50->framebuffer;
> > +   struct pipe_rasterizer_state *rast = &nv50->rast->pipe;
> > +
> > +   if (!rast)
> > +      return;
> > +
> > +   BEGIN_NV04(push, NV50_3D(POLYGON_OFFSET_POINT_ENABLE), 3);
> > +   PUSH_DATA (push, rast->offset_point * !!fb->zsbuf);
> > +   PUSH_DATA (push, rast->offset_line * !!fb->zsbuf);
> > +   PUSH_DATA (push, rast->offset_tri * !!fb->zsbuf);
> > +}
> > +
> > +static void
> >   nv50_validate_clip(struct nv50_context *nv50)
> >   {
> >      struct nouveau_pushbuf *push = nv50->base.pushbuf;
> > @@ -515,6 +531,7 @@ validate_list_3d[] = {
> >       { nv50_validate_derived_rs,    NV50_NEW_3D_FRAGPROG |
> > NV50_NEW_3D_RASTERIZER | NV50_NEW_3D_VERTPROG |
> > NV50_NEW_3D_GMTYPROG }, { nv50_validate_derived_2,
> > NV50_NEW_3D_ZSA | NV50_NEW_3D_FRAMEBUFFER },
> > +    { nv50_validate_rast_fb,       NV50_NEW_3D_RASTERIZER |
> > NV50_NEW_3D_FRAMEBUFFER }, { nv50_validate_clip,
> > NV50_NEW_3D_CLIP | NV50_NEW_3D_RASTERIZER | NV50_NEW_3D_VERTPROG |
> > NV50_NEW_3D_GMTYPROG }, { nv50_constbufs_validate,
> > NV50_NEW_3D_CONSTBUF }, diff --git
> > a/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
> > b/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h index
> > 579da9a..a5af115 100644 ---
> > a/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h +++
> > b/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h @@ -25,7 +25,7
> > @@ struct nv50_blend_stateobj { struct nv50_rasterizer_stateobj
> > { struct pipe_rasterizer_state pipe; int size;
> > -   uint32_t state[49];
> > +   uint32_t state[45];
> >   };
> >   
> >   struct nv50_zsa_stateobj {
> > diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
> > b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index
> > bba35f1..1c953eb 100644 ---
> > a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++
> > b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -285,10 +285,6
> > @@ nvc0_rasterizer_state_create(struct pipe_context *pipe, }
> >   
> >       SB_IMMED_3D(so, POLYGON_STIPPLE_ENABLE,
> > cso->poly_stipple_enable);
> > -    SB_BEGIN_3D(so, POLYGON_OFFSET_POINT_ENABLE, 3);
> > -    SB_DATA    (so, cso->offset_point);
> > -    SB_DATA    (so, cso->offset_line);
> > -    SB_DATA    (so, cso->offset_tri);
> >   
> >       if (cso->offset_point || cso->offset_line || cso->offset_tri)
> > { SB_BEGIN_3D(so, POLYGON_OFFSET_FACTOR, 1);
> > diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
> > b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c index
> > d4931cb..4dbcb1c 100644 ---
> > a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c +++
> > b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c @@ -689,6
> > +689,11 @@ nvc0_validate_rast_fb(struct nvc0_context *nvc0) else
> >            PUSH_DATAf(push, rast->offset_units * (1 << 24));
> >      }
> > +
> > +   BEGIN_NVC0(push, NVC0_3D(POLYGON_OFFSET_POINT_ENABLE), 3);
> > +   PUSH_DATA (push, rast->offset_point * !!fb->zsbuf);
> > +   PUSH_DATA (push, rast->offset_line * !!fb->zsbuf);
> > +   PUSH_DATA (push, rast->offset_tri * !!fb->zsbuf);
> >   }
> >   
> >   
> > diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h
> > b/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h index
> > 054b1e7..e93da9d 100644 ---
> > a/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h +++
> > b/src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h @@ -23,7 +23,7
> > @@ struct nvc0_blend_stateobj { struct nvc0_rasterizer_stateobj {
> >      struct pipe_rasterizer_state pipe;
> >      int size;
> > -   uint32_t state[42];
> > +   uint32_t state[38];
> >   };
> >   
> >   struct nvc0_zsa_stateobj {  
> 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list