gl-3.2-depth-tex-sampling: fix the test to expect "red" depth samples

I missed the language in section 3.8.7 about depth texture sampling.
Thanks, Marek.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
tests/util: Link with rt if PIGLIT_HAS_POSIX_CLOCK_MONOTONIC

If PIGLIT_HAS_POSIX_CLOCK_MONOTONIC, piglit-util.c will use clock_gettime,
so, make sure to link against -lrt, too.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Brian Paul <brianp@vmware.com>
NV_conditional_render: glBeginConditionalRenderNV begin zero

INVALID_VALUE should be genrated instead of INVALID_OPERATION

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
fbo-bind-renderbuffer:  Expect INVALID_OPERATION error instead of INVALID_VALUE

The spec clearly requires INVALID_OPERATION, so add a quotation from the
spec.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
depthstencil-render-miplevels: Add missing extension checks

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
sparse-samplers: Add missing extension checks

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
arb_fragment_program: Fix several copy-and-paste errors in minmax test

1. The extension check was wrong: GL_ARB_vertex_program instead of
GL_ARB_fragment_program.

2. The program query was wrong: GL_VERTEX_PROGRAM_ARB instead of
GL_FRAGMENT_PROGRAM_ARB.

3. The limit for GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB was wrong: 1 (the
vertex program limit) instead of 0.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
texwrap: Add missing extension checks

Also update the setting of has_texture_swizzle.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
fbo-incomplete: Fix GCC format-security warnings.

This patch fixes these GCC warnings.

fbo-incomplete.cpp: In function ‘bool invalid_1d_array_layer()’:
fbo-incomplete.cpp:304:57: warning: format not a string literal and no format arguments [-Wformat-security]
fbo-incomplete.cpp: In function ‘bool invalid_2d_array_layer()’:
fbo-incomplete.cpp:331:57: warning: format not a string literal and no format arguments [-Wformat-security]
fbo-incomplete.cpp: In function ‘bool invalid_cube_array_layer()’:
fbo-incomplete.cpp:358:57: warning: format not a string literal and no format arguments [-Wformat-security]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
tests/util: Link with rt only if librt exists.

This patch fixes the OpenBSD build.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73332
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Test that a layered fbo can have attachments with different layer counts.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Test full framebuffer clear color with mismatched layer count.

GL 3.2 allows different framebuffer attachments to have different
layer counts.  Rendering to layers that do not exist in all
attachments is undefined; however, clearing the framebuffer should
still clear all layers of all attachments.

Reviewed-by: Matt Turner <mattst88@gmail.com>
glslparsertest: Test compute shaders.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Save and restore platform for piglit

This patch adds support in piglit-run to save the -p platform
information if it was provided, and adds support in piglit-resume to
restore this information if it is stored.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Simplify piglit threading

This patch simplifies threading in piglit by removing the hand-rolled
threadpool, and instead using the Pool class from multiprocessing.dummy.
This provides a map interface, allowing for very clear succinct code.

The previous implementation ran all tests out of thread pools, a serial
pool and a multi-threaded pool. This patch does the same thing for a
couple of reasons. First, the obvious solution is to use the map()
builtin for serial tests. However, map in python3 returns an iterator
instead of a list so calling map(f, x) will not actually run f(x) until
something tries to use those values. This would require considerable
restructuring to work around. Second, that could easily be split out
into another patch, and limits the number of changes in this patch.

Multiproccessing.dummy is a wrapper around the Threading module,
providing the multiproccessing API, but with threads instead of
processes.

V2: - Renamed run() helper to test()
    - use multiprocessing.dummy.Pool() default thread count value, which
      is equal to multiproccessing.cpu_count(), instead of cpu_count()
      explicitly
V3: - use Pool.imap() instead of Pool.map(), it is slightly faster.
V4: - Remove use of map() builtin

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
cmake: Fix waffle version requirement

CMake is so stupid sometimes :(

When building with waffle, piglit requires waffle >= 1.2.2. Piglit's
CMake captures the required by calling

    pkg_check_modules(WAFFLE REQUIRED waffle-1>=1.2.2)

However, we cannot reliably check the version with pkg_check_modules(). The
problem is that, if one passes a required version to pkg_check_modules(), CMake
validates the required version at most once for the lifetime of the source tree.
If someone changes the required version by editing the CMakeLists, CMake fails
to detect the new requirement.

To workaround this deficiency of CMake, check the version instead with

    if(WAFFLE_VERSION VERSION_LESS 1.2.2)

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
cmake: If using Waffle, require waffle >= 1.3

Subsequent patches will enable creation of forward-compatible and debug
contexts, which arrived in waffle-1.3.

After this patch, you may need to remove CMakeCache.txt and rerun CMake. The
problem is that CMake caches the results of pkg-config queries.  Alternatively,
you may manually update the value of CMakeCache.txt:WAFFLE_VERSION in any text
editor.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
util/waffle: Print more info when context creation fails

When waffle_config_choose() or waffle_context_create() fails, print
Waffle's error message to stderr. Several people (Carl, Ian, Timothy
Arceri) have requested this.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Tested-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
util/wfl: Refactor make_context_current_singlepass()

Let make_context_current_singlepass() directly call
waffle_config_choose(). Add helper function make_config_attrib_list()
that makes the attribute list passed to waffle_config_choose(). This
refactor will make possible better error messages.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Tested-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
util/waffle: Improve error messages when context creation fails

Unify the 3 occurences of message "Failed to create ... context", and
move the message closer to the failure.

Print a more helpful message when special_case_gl_31() fails.

Add helper function make_context_description(), used in the newer better
error messages.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Tested-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <idr@freedesktop.org>