[Piglit] [PATCH 04/16] util: Allow non-ES2 code to draw_rect with non-fixed-function arrays
Paul Berry
stereotype441 at gmail.com
Tue Aug 27 07:39:46 PDT 2013
On 26 August 2013 16:04, Eric Anholt <eric at anholt.net> wrote:
> Ian Romanick <idr at freedesktop.org> writes:
>
> > From: Ian Romanick <ian.d.romanick at intel.com>
> >
> > This will be used in future commits.
> >
> > Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> > Cc: Matt Turner <mattst88 at gmail.com>
> > Cc: Paul Berry <stereoytpe441 at gmail.com>
> > ---
> > tests/util/piglit-util-gl-common.c | 86
> ++++++++++++++++++++++++--------------
> > tests/util/piglit-util-gl-common.h | 3 +-
> > 2 files changed, 56 insertions(+), 33 deletions(-)
> >
> > diff --git a/tests/util/piglit-util-gl-common.c
> b/tests/util/piglit-util-gl-common.c
> > index b5e87bf..c097d8f 100644
> > --- a/tests/util/piglit-util-gl-common.c
> > +++ b/tests/util/piglit-util-gl-common.c
> > @@ -599,46 +599,68 @@ required_gl_version_from_glsl_version(unsigned
> glsl_version)
> > * float tex[4][2];
> > *
> > * if not NULL.
> > + *
> > + * \param fixed_function_attribute Should fixed-function attributes
> (e.g.,
> > + * \c glVertexPointer) be used? In an
> OpenGL
> > + * core profile this must be \c true.
> In
> > + * OpenGL ES the value is ignored.
> > */
> > void
> > -piglit_draw_rect_from_arrays(const void *verts, const void *tex)
> > +piglit_draw_rect_from_arrays(const void *verts, const void *tex,
> > + bool fixed_function_attributes)
> > {
> > +#if defined(PIGLIT_USE_OPENGL_ES1)
> > +#define USE_FF(x) true
> > +#elif defined(PIGLIT_USE_OPENGL_ES2) || defined(PIGLIT_USE_OPENGL_ES3)
> > +#define USE_FF(x) false
> > +#elif defined(PIGLIT_USE_OPENGL)
> > +#define USE_FF(x) x
> > +#else
> > +#error "don't know how to draw arrays"
> > +#endif
> > +
> > #if defined(PIGLIT_USE_OPENGL_ES1) || defined(PIGLIT_USE_OPENGL)
> > - if (verts) {
> > - glVertexPointer(4, GL_FLOAT, 0, verts);
> > - glEnableClientState(GL_VERTEX_ARRAY);
> > - }
> > + if (USE_FF(fixed_function_attributes)) {
> > + if (verts) {
> > + glVertexPointer(4, GL_FLOAT, 0, verts);
> > + glEnableClientState(GL_VERTEX_ARRAY);
> > + }
>
> One thing I'd been tempted to do when considering writing this patch
> myself was glGetIntegerv(GL_CURRENT_PROGRAM) and do patch 7/16 right
> here. I felt bad about putting getters in the draw path, but your patch
> 6 does that anyway and I think it's reasonable. Then you wouldn't need
> the bool input and the funny conditional use of it here, since it would
> be "always use generics on GLES2, and also use them if piglit_vertex is
> present". I'm assuming here that verts will always be non-NULL, which I
> think is reasonable.
>
This would be my preference too (and in fact I seem to remember us agreeing
on this plan when we discussed it several months ago). It has the
additional advantage that it allows us to simply call piglit_draw_rect()
from any .c test, rather than decide at each call site whether to call
piglit_draw_rect() or piglit_draw_rect_shader().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130827/5315f978/attachment.html>
More information about the Piglit
mailing list