[Piglit] [PATCH 04/16] util: Allow non-ES2 code to draw_rect with non-fixed-function arrays
Eric Anholt
eric at anholt.net
Mon Aug 26 16:04:37 PDT 2013
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130826/72560e41/attachment.pgp>
More information about the Piglit
mailing list