Stop using GLEW_VERSION_* macros

Several tests were checking the GL version using GLEW's GLEW_VERSION_*
macros.  This patch changes the tests to use piglit_get_gl_version(),
which provides the same functionality in a way that is not dependent
on GLEW.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Stop using GLEW extension macros

Several tests were checking for the presence of GL extensions using
GLEW macros.  This patch changes the tests to use
piglit_is_extension_supported(), which provides the same functionality
in a way that is not dependent on GLEW.

v2: Follow piglit convention of including "GL_" in the string passed
to piglit_is_extension_supported().

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Stop using glewIsSupported

Several tests were using the function glewIsSupported() to check for
extensions and GL versions.  This patch changes the tests to use
piglit_get_gl_version() and piglit_is_extension_supported(), which
provide the same functionality in a way that is not dependent on GLEW.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Follow piglit convention of including "GL_" in the string passed
to piglit_is_extension_supported().
Stop using GLEW_GET_FUN

Some tests were using the GLEW_GET_FUN macro to retrieve GL function
pointers from GLEW.  This was necessary using old versions of GLEW,
but it is not necessary anymore; now we can just refer to the GLEW
function pointers directly.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Stop referring to nonstandard enums GL_CLIP_PLANE{6,7}.

GL_GLIP_PLANE6 and GL_CLIP_PLANE7 are defined by glew.h, but not by
the standard OpenGL headers.  The standard OpenGL headers name these
constants GL_CLIP_DISTANCE6 and GL_CLIP_DISTANCE7.  Unfortunately, we
can't use those names either, because glew.h uses #defines to prevent
the standard OpenGL headers from having any effect.

To work around this madness, just use GL_CLIP_PLANE0+6 and
GL_CLIP_PLANE_0+7, which work whether or not GLEW is in use.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Convert more older tests to use piglit-framework.c.

This patch converts the following tests to use the main() function in
piglit-framework.c rather than define their own main() function.

- crash-cubemap-order
- crash-texparameter-before-teximage
- fdo10370
- fdo23489
- fdo9833
- copytexsubimage

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Add a call to glewInit() to windowoverlap.c

Previously this test didn't initialize GLEW, presumably because it
only uses GL 1.0 functions, and those functions bypass GLEW.  But once
we switch to using piglit-dispatch instead of GLEW, we will need to
initialize it in order for any GL functions to work.  This patch adds
a call to glewInit() in the place where a call to
piglit_dispatch_default_init() will eventually be needed.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
cmake: Avoid depending on MinGW runtime DLLs.

It makes the binaries easier to deploy.

Tested-by: Brian Paul <brianp@vmware.com>
getteximage-formats: add debug code to disable blending

Sometimes useful for diagnosing failures.
getteximage-luminance: test readback of GL_LUMINANCE textures

Test various combinations of getting a luminance texture.

v2: also test reading back an RGBA texture as GL_LUMINANCE with glReadPixels.

See https://bugs.freedesktop.org/show_bug.cgi?id=46679
point-line-no-cull: probe two pixels instead of one

If the OpenGL max line width is really only one pixel (despite requesting
width=3) the black_pixel() probe function could miss the line because of
rasterization differences.  We'd report a false failure in that case.
Probing two pixels instead of one avoids that issue.

v2: change array size to be [2][3] since we're reading two RGB pixels.
cmake: Include GLEXT_INCLUDE_DIR wherever OPENGL_INCLUDE_PATH is included.

Because on Windows glext.h is not part of system headers, and needs to
be provided separately.
fbo-alphatest-formats: correct the expected intensity/luminance values

The expected intensity and luminance values are different depending on
whether we're doing glReadPixels() from a texture or sampling the texture.

Fixes failures both with NVIDIA's driver and Mesa since we changed/fixed
readback of luminance/intensity textures.

https://bugs.freedesktop.org/show_bug.cgi?id=47175

Reviewed-by: Eric Anholt <eric@anholt.net>
glslparsertest: Allow ! in extension list to require non-support.

For example:
// [config]
// required_extensions: !GL_ARB_draw_instanced
// [end config]
will cause the test to run only if the GL_ARB_draw_instanced is _not_
advertised.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Fix ARB_draw_instanced feature-macro-disabled tests.

If the GL supports the GL_ARB_draw_instanced extension, the preprocessor
macro must exist regardless of whether or not the shader enables the
extension.  (In fact, this allows them to check if it's supported!)

This patch changes the tests to only run if GL_ARB_draw_instanced is
_not_ supported by the driver, in which case it's an error to define
the preprocessor macro.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Make valgrind testing a command line option rather than extra tests.

Valgrind testing is useful, but really should be done as a separate
exercise from the usual regression testing, as it takes way too long.

Rather than including it by default in all.tests and making people
exclude it with the -x valgrind option (or by using quick.tests), it
makes sense to explicitly request valgrind testing with --valgrind.

To perform valgrind testing:
$ piglit-run.py --valgrind <options> tests/quick.tests results/vg-1

The ExecTest class now handles Valgrind wrapping natively, rather than
relying on the tests/valgrind-test/valgrind-test shell script wrapper.
This provides a huge benefit: we can leverage the interpretResult()
function to make it work properly for any subclass of ExecTest.  The
old shell script only worked for PlainExecTest (piglit) and GleanTest.

Another small benefit is that you can now use --valgrind with any test
profile (such as quick.tests).  Also, you can use all.tests without
having to remember to specify "-x valgrind".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
fbo-blending-formats: fix expected result for intensity and luminance textures

This is pretty much the same fix as for the fbo-alphatest-formats test.
Note: NVIDIA's driver is still failing for GL_RGB5_A1 for some unknown reason.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=47217
fbo-luminance-alpha: fix expected result colors

The results of reading back a luminance/alpha texture with glReadPixels
is different than the results of texturing with that texture.

Fixes failures with NVIDIA driver and Mesa.

http://bugs.freedesktop.org/show_bug.cgi?id=47261

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Move more MSVC workarounds to piglit-util.h

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
gl-2.1/minmax: Actually use the Y dimension we get for calculating OQ bits.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>