On 26 August 2013 16:04, Eric Anholt <[email protected]> wrote: > Ian Romanick <[email protected]> writes: > > > From: Ian Romanick <[email protected]> > > > > This will be used in future commits. > > > > Signed-off-by: Ian Romanick <[email protected]> > > Cc: Matt Turner <[email protected]> > > Cc: Paul Berry <[email protected]> > > --- > > 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().
_______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
