All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Christoph Bumiller
	<e0425955-oe7qfRrRQffzPE21tAIdciO7C/xPubJB@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [mesa PATCH] nv50: handle VP without inputs
Date: Sun, 6 May 2012 22:54:29 +0200	[thread overview]
Message-ID: <20120506205429.GA11614@joi.lan> (raw)
In-Reply-To: <4FA6CB71.9070308-oe7qfRrRQffzPE21tAIdciO7C/xPubJB@public.gmane.org>

On Sun, May 06, 2012 at 09:05:21PM +0200, Christoph Bumiller wrote:
> On 06.05.2012 20:53, Marcin Slusarz wrote:
> > Fixes 3 piglit tests:
> > general/pos-array
> > shaders/glsl-novertexdata
> > shaders/glsl-vs-point-size
> > and makes shaders/vp-ignore-input not trigger PGRAPH DATA_ERROR
> > ---
> > It's a bit ugly... If there's a way to fix it properly, I'm open to suggestions.
> > ---
> >  src/gallium/drivers/nv50/nv50_program.c |    7 +++++++
> >  1 files changed, 7 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
> > index 48e8db3..c44f537 100644
> > --- a/src/gallium/drivers/nv50/nv50_program.c
> > +++ b/src/gallium/drivers/nv50/nv50_program.c
> > @@ -53,6 +53,13 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info *info)
> >           if (info->in[i].mask & (1 << c))
> >              info->in[i].slot[c] = n++;
> >     }
> > +
> > +   // Corner case: VP has no inputs, but we will still need to submit data to
> > +   // draw it. HW will shout at us and won't draw anything if we don't enable
> > +   // any input, so let's just pretend it's the first one.
> > +   if (info->numInputs == 0)
> > +      prog->vp.attrs[0] |= 0xf;
> > +
> >     prog->in_nr = info->numInputs;
> >  
> >     for (i = 0; i < info->numSysVals; ++i) {
> Ah thank you, I've been wondering how to make the nv50 draw without any
> inputs (on nvc0 it just works even if you don't enable any).
> 
> 2 issues though:
> - please don't use C++ style comments in here (the style guardians would
> sooner or later patch this up)
> - if InstanceID or VertexID are used, enabling any inputs will move them
> to a different position in input space, they always come after all the
> ordinary vertex attributes; see usage of the "unsigned n" in the code
> directly above & below

Thanks. I hacked glsl-vs-point-size test to use gl_VertexID/gl_InstanceID and
it indeed failed. But patch below works in all cases :).

---
From: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] nv50: handle VP without inputs

Fixes 3 piglit tests:
general/pos-array
shaders/glsl-novertexdata
shaders/glsl-vs-point-size
and makes shaders/vp-ignore-input not trigger PGRAPH DATA_ERROR
---
 src/gallium/drivers/nv50/nv50_program.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 48e8db3..e6f1097 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -68,6 +68,17 @@ nv50_vertprog_assign_slots(struct nv50_ir_prog_info *info)
          break;
       }
    }
+
+   /*
+    * Corner case: VP has no inputs, but we will still need to submit data to
+    * draw it. HW will shout at us and won't draw anything if we don't enable
+    * any input, so let's just pretend it's the first one.
+    */
+   if (prog->vp.attrs[0] == 0 &&
+         prog->vp.attrs[1] == 0 &&
+         prog->vp.attrs[2] == 0)
+      prog->vp.attrs[0] |= 0xf;
+
    /* VertexID before InstanceID */
    if (info->io.vertexId < info->numSysVals)
       info->sv[info->io.vertexId].slot[0] = n++;
-- 
1.7.8.5

      parent reply	other threads:[~2012-05-06 20:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-06 18:53 [mesa PATCH] nv50: handle VP without inputs Marcin Slusarz
     [not found] ` <20120506185308.GC4311-OI9uyE9O0yo@public.gmane.org>
2012-05-06 19:05   ` Christoph Bumiller
     [not found]     ` <4FA6CB71.9070308-oe7qfRrRQffzPE21tAIdciO7C/xPubJB@public.gmane.org>
2012-05-06 20:54       ` Marcin Slusarz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120506205429.GA11614@joi.lan \
    --to=marcin.slusarz-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=e0425955-oe7qfRrRQffzPE21tAIdciO7C/xPubJB@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.