Marcin Slusarz
2012-May-06 18:53 UTC
[Nouveau] [mesa 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 --- 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) { -- 1.7.8.5
Christoph Bumiller
2012-May-06 19:05 UTC
[Nouveau] [mesa PATCH] nv50: handle VP without inputs
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
Reasonably Related Threads
- [PATCH] nv50: avoid using inline vertex data submit when gl_VertexID is used
- [PATCH 00/19] nv50: add sampler2DMS/GP support to get OpenGL 3.2
- [PATCH 1/3] nv50: rework primid logic
- Swig generates bad interface to GetTextExtent
- nv50: shader generation patches