cl: Add OpenCL tests

All of the tests are located in tests/cl. Each type of tests are located
in their own subfolders. Custom tests in custom folder, API in api and
Program in program.

Program folder has special tests that are run by program-tester.c which
parses .cl or .program_test tests. This type of tests test program
building and kernel execution. These tests are located in program/build
and program/execute.

Signed-off-by: Blaž Tomažič <blaz.tomazic@gmail.com>
cmake: Build OpenCL tests

Build OpenCL tests to binaries with 'cl-' prefix. Each test type adds
another prefix to it, for example Custom test has a 'cl-custom-' prefix.

Signed-off-by: Blaž Tomažič <blaz.tomazic@gmail.com>
cl: Add all_cl.tests test set

This test set includes all the OpenCL tests.

Signed-off-by: Blaž Tomažič <blaz.tomazic@gmail.com>
doc: Add cl tests documentation

Here the OpenCL testing framework is documented in README file and each
test type is documented in respective doc_type and template_type files.

Signed-off-by: Blaž Tomažič <blaz.tomazic@gmail.com>
README: Include OpenCL information

Update README to include information about OpenCL tests.

Signed-off-by: Blaž Tomažič <blaz.tomazic@gmail.com>
max-texture-size-level: test per-level max texture size error checking
glut_waffle: Improve error messages

When a waffle functions fails, print the complete error message returned
emitted by waffle.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Convert simple if(piglit_get_gl_version() < N) { SKIP } to require

Generated from the following semantic patch:

@@
expression VER;
expression MSG;
@@

-	if (piglit_get_gl_version() < VER) {
-		printf(MSG);
-		piglit_report_result(PIGLIT_SKIP);
(
-		exit(1);
|
)
-	}

+   piglit_require_gl_version(VER);

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Fix explicit attrib location tests layout-12|13.frag; add a new one.

The ARB_explicit_attrib_location tests layout-12.frag and layout-13.frag
were incorrect: they both used index == 2 (which is invalid) and
expected the compile to succeed.  Although the extension spec doesn't
state anything about generating an error on indices other than 0 or 1,
the GLSL 4.30 spec clarifies this as a compile error.  This matches the
behavior of the API call defined in ARB_blend_func_extended,
glBindFragDataLocationIndexed, which generates INVALID_VALUE for indices
other than 0 or 1.

This patch changes layout-13.frag to use index = 1 so it will actually
test the intended behavior.

layout-12.frag was just bogus: the comment said "Even though the
specified locations overlap [...]" but the test only had one variable.
This patch turns it into a negative test to ensure index == 2 is a
compile error.

This patch also adds layout-14.frag, a test to check that index < 0 is
also a compile error.
max-texture-size-level: don't try to create maxSize x maxSize textures

We might not have enough memory for a texture that large.
Use width or height = 1 instead.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
max-texture-size: asst. formatting, etc. fixes
texture-storage: fix internal format mistakes in the test

Per issue 17 of the extension spec, unsized internalFormat values are
not allowed.  Change GL_RGBA to GL_RGBA8 and add some extra error
checks.

The test passes on NVIDIA now.
texture-storage: do more thorough testing of internal format values

Check that all the common unsized internal formats are illegal.
And check that some common sized formats are accepted.
glean/texCombine: test fewer combinations

It takes 10 minutes for llvmpipe to finish this test. With this patch,
it takes 20 seconds.

Before:

Tested 104 GL_REPLACE combinations
Tested 7540 GL_ADD combinations
Tested 7540 GL_ADD_SIGNED_EXT combinations
Tested 7540 GL_MODULATE combinations
Tested 5957 GL_INTERPOLATE_EXT combinations
Tested 7540 GL_DOT3_RGB_EXT combinations
Tested 7540 GL_DOT3_RGBA_EXT combinations
Tested 47662 GL_MODULATE_ADD_ATI combinations
Tested 47662 GL_MODULATE_SIGNED_ADD_ATI combinations
Tested 47662 GL_MODULATE_SUBTRACT_ATI combinations
Tested 218 multitexture combinations
Tested 8 crossbar combinations

After:

Tested 17 GL_REPLACE combinations
Tested 1237 GL_ADD combinations
Tested 1237 GL_ADD_SIGNED_EXT combinations
Tested 1237 GL_MODULATE combinations
Tested 978 GL_INTERPOLATE_EXT combinations
Tested 1237 GL_DOT3_RGB_EXT combinations
Tested 1237 GL_DOT3_RGBA_EXT combinations
Tested 7825 GL_MODULATE_ADD_ATI combinations
Tested 7825 GL_MODULATE_SIGNED_ADD_ATI combinations
Tested 7825 GL_MODULATE_SUBTRACT_ATI combinations
Tested 35 multitexture combinations
Tested 8 crossbar combinations

Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>

before with r600g:

real    0m24.506s
user    0m22.393s
sys     0m1.812s

after with r600g

real    0m0.747s
user    0m0.616s
sys     0m0.100s

before with llvmpipe

real    4m28.217s
user    4m27.061s
sys     0m1.020s

after with llvmpipe

real    0m7.358s
user    0m7.224s
sys     0m0.112s
glean/depthStencil: fix the test

It wasn't doing anything.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
fbo-blit-stretch: add ability to choose a subtest

Reviewed-by: Brian Paul <brianp@vmware.com>
msaa: Test that multisampled blits can flip the image in the X or Y direction.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
util: Add a piglit_probe_image_stencil() function.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
framebuffer-blit-levels: fix off-by-one error.

Previously, the test made the erroneous assumption that if the size of
a texture is 2^n, then that texture has n miplevels.  This was
wrong--the texture has n+1 miplevels, ranging in size from 2^n to 2^0.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Make shader_runner add a #version directive to shaders lacking one.

The version number is taken from the GLSL version requirement, if there is one.

This is part of the effort to make version handling more flexible for GLES.

v2 (Paul Berry <stereotype441@gmail.com>): use strstr() to check
whether a #version directive is already present, in case it isn't at
the start of the shader.

Reviewed-by: Paul Berry <stereotype441@gmail.com>