cmake: Suppress warning on cmake 2.8.12+

cmake 2.8.12 Introduced a new policy (CMP0022). Because there are two
policy options and piglit doesn't explicitly ask for one it defaults to
the OLD setting, but spews warnings. By setting OLD explicitly this
warning goes away.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Revert "cmake: Suppress warning on cmake 2.8.12+"

This reverts commit 43c3d2ab0c44ed53baeebd2ca568922bb34b835a.
tests/gpu: actually make it be a subset of the quick tests

Commit 12cf501da67 (tests/gpu.py: Don't use execfile) accidentally
switched from execfile'ing quick.py to importing tests.all. Change this
to import tests.quick.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
cl: Add test program-scope-arrays.

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Adds piglit framework test to test GleanTest.globalParams bug

This patch adds a framework test to show the problem with
GleanTest.globalParams. It makes use of nose, a python testing
framework, which is simple to write tests for, and is in widespread
usage for testing python code.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Fix GleanTest.globalParams

The problem with the way global params work is that they surprise the
user, since they are applied at object initialization time. So the
following code doesn't do what one expects:
   a = GleanTest("basic")
   GleanTest.globalParams = ['--quick']
   b = GleanTest("basic")
   assert a.command == b.command

This would create an assertion failure with the current code, since
global params are applied at instance initialization. Since these params
are supposed to be global, one would expect them to be applied to all
instances, regardless of when the instance was created and the class
variable set.

This patch achieves that by converting Test to a new-type class,
allowing getters and setters to be created. It then creates a getter and
setter for ExecTest.command, and overwrites the getter in GleanTest to
return ``self.command + self.globalParams''. This allows an individual
gleantest to overwrite the global commands, but means that if a instance
hasn't created self.globalParams that the Gleantest.globalParams is
applied when self.command is called.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
tests/quick.tests: return to pep8 compliance

commit bab84213 exposed a behvarioral problem in GleanTest, and commit
832e498 worked around this bug by reordering code. While this was a
valid work around it wasn't pep8 compliant. Since the previous patch in
this series fixed the behvaior of GleanTest, there is no reason to keep
this change.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
framework/shader_test.py: fix bug from commit 260f211d

This patch fixes a minor bug. An exception catch calls a function with a
single leading underscore instead of two leading underscores.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
gles-3.0/texture-immutable-levels: Fix tex array size

We access tex[0] throught tex[3].
So, tex must have at least 4 elements.
This fixes a gcc warning:

warning: array subscript is above array bounds [-Warray-bounds]
  glBindTexture(GL_TEXTURE_3D, tex[3]);

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
all.tests: add texture-immutable-levels_gles3

This test was missing from all.tests.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
piglit_fbo_framework - don't even try for OpenGL ES 1.X

glGenFramebuffers is not supported for OpenGL ES 1.X, so init_gl is
hard coded to always fail for ES1.  Thus, there is no way to use a
fbo_framework w/ ES1.  In this case, just fail faster in
piglit_fbo_framework_create() instead of first initializing a wfl
framework, just to destroy it again in the failure path.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
ext_texture_array: Add sampler2DArray precision for GL ES 3.0

From GLSL_ES_Specification_3.0 [0]:

There is no default precision qualifier for the following sampler types in
either the vertex or fragment language:
   sampler2DArray

[0] http://www.khronos.org/registry/gles/specs/3.0/GLSL_ES_Specification_3.00.4.pdf

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
OES_compressed_ETC1_RGB8_texture-basic: fix glCopyTexImage2D error check

According to OpenGL ES 1.1 [0] and  OpenGL ES 2.0 [1], for
glCopyTexImage2D:

GL_INVALID_ENUM is generated if internalformat is not an accepted constant.

[0] http://www.khronos.org/opengles/sdk/1.1/docs/man/glCopyTexImage2D.xml
[1] http://www.khronos.org/opengles/sdk/docs/man/xhtml/glCopyTexImage2D.xml

Note: This is *different* than OpenGL [2] and OpenGL ES 3.0 [3], which
both specify:
GL_INVALID_VALUE is generated if internalformat is not an accepted format.

[2] http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml
[3] http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glCopyTexImage2D.xml

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
cubemap-getteximage-pbo: Silence NUMCOLORS redefined warning on MinGW.

cubemap-getteximage-pbo.c:41:0: warning: "NUMCOLORS" redefined [enabled by default]
 #define NUMCOLORS        7
 ^
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/windows.h:71:0,
                 from piglit/tests/util/piglit-util.h:35,
                 from piglit/tests/util/piglit-util-gl-common.h:32,
                 from piglit/tests/texturing/cubemap-getteximage-pbo.c:33:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/wingdi.h:1521:0: note: this is the location of the previous definition
 #define NUMCOLORS 24
 ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
tex3d-maxsize: Silence uninitialized variable warnings.

This patch fixes these GCC maybe-uninitialized warnings.

tex3d-maxsize.c: In function 'piglit_display':
tex3d-maxsize.c:123:15: warning: 'depth' may be used uninitialized in this function [-Wmaybe-uninitialized]
   glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, width, height, depth, 0,
               ^
tex3d-maxsize.c:123:15: warning: 'height' may be used uninitialized in this function [-Wmaybe-uninitialized]
tex3d-maxsize.c:123:15: warning: 'width' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
texwrap: Silence uninitialized variable warning.

This patch fixes this GCC maybe-uninitialized warning.

texwrap.c: In function 'init_int_texture.constprop.3':
texwrap.c:1345:8: warning: 'colors' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int **colors;
        ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
ARB_debug_output: add debug context as a requirement

Fixes failed tests in Mesa 10+

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
cmake: indent spaces -> tabs

The vast majority of lines are indented with tabs, convert the stragglers
so they don't stand out.

Also, move the final closing ')' of link_libraries to align with
the command, not the arguments.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
cmake: do not unconditionally find OpenGL package

The OpenGL package provides libGL and (Desktop) OpenGL header files.
libGL actually provides two interfaces:
  GLX "window system layer" (as defined by glproto)
  Desktop GL "GL Context API"

For environments that do not use either GLX nor Desktop GL, there is no
reason to look for this package.  In fact, if OpenGL is not found, the
following cmake variables get set to "NOTFOUND":
  OPENGL_INCLUDE_DIR
  OPENGL_gl_LIBRARY

OPENGL_INCLUDE_DIR as NOTFOUND is a problem when building EGL tests and
the piglitutil_gles* libraries, since OPENGL_INCLUDE_DIR is the common
UTIL_GL_INCLUDES, which is in the list of included directories.  It would
be better if it just wasn't defined at all.

Similarly, OPENGL_gl_LIBRARY is linked to the egl_khr_create_context tests
to enable them to use EGL to create a Desktop GL context.  Again, if there
is no Desktop GL, it would probably be better to just not define it at all.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
cmake: only find GLEXT paths if OpenGL is also found

If there is no OpenGL, there won't be OpenGL extensions either, so don't
look for them.  It is better to just leave GLEXT_INCLUDE_DIR undefined,
so it can be safely added to the list of include directories used for
building tests and utils that can be built either with or without Desktop
GL.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>