framebuffer-srgb: refactor and clean up the code

There was a lot of duplicated code in framebuffer_srgb_non_fbo()
and framebuffer_srgb_fbo().  Move it into new test_srgb() function.
Also improve the comments, etc.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
ARB_shading_language_packing: Allow some imprecision in unpackUnorm4x8

The unpack builtins are implemented using floating-point division, which
is implemented by reciprocal+multiply. As it so happens, 1.0/255.0 falls
almost exactly between two representable 32-bit floats and leads to bad
rounding. None of the other divisors (127, 32767, 65535) have this
property.

Paul was uncomfortable with allowing inexact results in only
unpackUnorm4x8, so allow the results of the builtins (except
unpackHalf2x16) to be within some small epsilon (0.00001) of the actual
value. Some values like 0.0 and 1.0 should be calculated exactly, so
handle them specially.
gen_builtin_packing_tests.py: Remove stray tab

Caused the shader_runner tests generated from that template to be
indented.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
tests/data: Remove.

Unused.

Reviewed-by: Brian Paul <brianp@vmware.com>
cmake: Allow to generate a tarball/zip with the binaries, scripts, data.

It doesn't make much sense to package piglit or install on machines, due
to the frequency piglit tests are added/changed.

However, binary packages are still useful for distributed testing where
the binaries are built on one machine, and then passed to (sometimes
other teams) for the actual testing.

This patch allows one to conveniently generate such packages, simply by
doing

  make package

Then one can run piglit by unpacking the package elsewhere, set the
PIGLIT_SOURCE_DIR and LD_LIBRARY_PATH accordingly, and run piglit scripts
as usual.

Reviewed-by: Brian Paul <brianp@vmware.com>
cmake: Ensure we use static libraries on Windows.

It would be nice to eventually get dynamic link libraries working with
WGL too, but for now ensure that we always do static as intended.

This might fix fdo bug 60352.
tests/all.tests: Add missing Group() initialization

These tests were relying on the generated tests discovery to create
empty groups from empty directories. However empty directories
were not being packaging, causing Python KeyError exceptions.

This change adds the Group initialization, like done elsewhere.

Reviewed-by: Brian Paul <brianp@vmware.com>
Using waffle, only prevent X11 windows from taking focus in automatic mode.

Otherwise this prevents any interaction with the windows in non-automatic
mode, not even the Escape key or the window decoration close button works.
That's quite annoying for investigating test failures.

Thanks to Chad Versace for pointing me in the right direction for this on
IRC.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
etc1: Fix glTexImage2D call in basic API test

On mesa-1559994 with Intel Sandybridge, this test failed due to two
unexpected GL errors. This patch fixes the first.

The test wanted

  glTexImage2D(format=GL_RGB, internalformat=GL_ETC1_RGB8_OES)

to emit GL_INVALID_VALUE. However, implementations are allowed to emit
GL_INVALID_VALUE or GL_INVALID_OPERATION for that call. From page 73 of
the OpenGL ES 1.1 spec:

  Specifying a value for internalformat that is not one of the above
  values generates the error INVALID VALUE. If internalformat does not
  match format, the error INVALID OPERATION is generated.

To correct this, change format to GL_ETC1_RGB8_OES.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55147
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
etc1: Fix glTexSubImage2D call in basic API test

On mesa-1559994 with Intel Sandybridge, this test failed due to an
unexpected GL error.

The test wanted

  glTexSubImage2D(width=8, height=8, size=4096)

to emit GL_INVALID_OPERATION. However, Mesa emitted GL_INVALID_VALUE
because the size was incorrect. From page 79 of the OpenGL ES 1.1 spec:

  If the imageSize parameter is not consistent with the format,
  dimensions, and contents of the compressed image, an INVALID VALUE error
  results.

This patch fixes the size.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55147
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
etc1: Document expected errors in basic API test

Document why we expect GL_INVALID_OPERATION from gl*TexSubImage2D calls.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
shader_tests: Fix mismatched GLSL versions in some shader_test files.

Replace inconsistent GLSL >= / #version with GLSL >= only.
The #version directive will be inserted by shader_runner.

Reviewed-by: Tom Gall <tom.gall@linaro.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
shader_tests: Add [require] / GLSL >= to shader_test files missing these.

The intention is for this to be mandatory for all shader_test files.

Reviewed-by: Tom Gall <tom.gall@linaro.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
shader_runner: Require [require] and GLSL version requirement.

Another step towards removing explicit #version directives.

Reviewed-by: Tom Gall <tom.gall@linaro.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
Revert "shader_runner: Require [require] and GLSL version requirement."

This reverts commit de1d4aa0f2f2d14cd0fd04dec593bf151dcbad8a.
The commit broke the ARB_fragment_program texturing tests.
cl: Add tests for arrays declared on the stack (private memory)
cl-program-tester: Fix parsing of vec16 types
shader_runner: Require [require] section in .shader_test files.

A step toward removing explicit #version directives.

Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
shader_runner: Require GLSL version requirement.

A step towards removing explicit #version directives.

This time the check is in compile_glsl.
ARB program tests are unaffected.

Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
Signed-off-by: Stuart Abercrombie <sabercrombie@chromium.org>
invalid-es3-queries: Check that GL_MAX_VARYING_COMPONENTS is rejected

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>