Fix for glsl-1.20 / glsl-1.30: Add tests for uniforms with initializers
glsl-1.20 / glsl-1.30: Add tests for uniforms with initializers from a constant

These tests are similar to the previous tests except the uniforms are
initialized using a variable declared as const.  Since any
compile-time constant expression can be used to initialize a uniform,
this should also work.

v2: Use '{0}{1}' formatting instead of '{}{}'.  The latter is added in
Python 2.7, but piglit only requires Python 2.6.  This was pointed out
by Jordan Justen.

v3: Clean up the generation of the if-statement based on feedback from
Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
glsl-1.20 / glsl-1.30: Add tests for uniforms with initializers in another stage

These are similar to the first tests except the uniform is initialized
in one stage (vertex or fragment) but used in the other stage
(vice-versa).

v2: Use '{0}{1}' formatting instead of '{}{}'.  The latter is added in
Python 2.7, but piglit only requires Python 2.6.  This was pointed out
by Jordan Justen.

v3: Clean up the generation of the if-statement based on feedback from
Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
glsl-1.20 / glsl-1.30: Add tests for uniforms with initializers modified by GL API

In these tests the uniforms are initialized with one set of values in
the shader source, but the values are changed using the GL API.  The
shaders expect the values set by the GL API.

v2: Use '{0}{1}' formatting instead of '{}{}'.  The latter is added in
Python 2.7, but piglit only requires Python 2.6.  This was pointed out
by Jordan Justen.

v3: Clean up the generation of the if-statement based on feedback from
Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
glsl-1.20: Add tests for uniform structures with initializers

It was just impractical to generate these tests using scripts, so they
are hand-written.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
glsl-1.20: Add tests for uniform array-of-structures with initializers

Like the non-array structure tests, it was just impractical to
generate these tests using scripts, so they are hand-written.
However, these tests currently fail on Mesa.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
msaa: Refactor all.tests so that sample counts to test are specified once.
msaa: Test that msaa blits are clipped and scissored correctly.

There are three reasons why the set of rectangles passed to
glBlitFramebuffer() might need to be clipped before performing the
blit:

1. If the destination rectangle falls (partly or completely) outside
the bounds of the draw framebuffer.

2. If the destination rectangle falls (partly or completely) outside
the scissor rectangle.

3. If the source rectangle falls (party or completely) outside the
bounds of the read framebuffer.

In cases 1 and 2, it is clear from the GL spec that the blit should be
clipped.  In case 3, the spec is less clear, however Ian Romanick and
I have received clarification from the ARB that clipping is the
intended behaviour.

This test verifies that blits are properly clipped in cases 1-3.  It
only tests blits in which the source and destination rectangles are
the same size (i.e. no scaling is occurring), since scaling blits are
not allowed for MSAA.
msaa: Verify accuracy of sRGB MSAA resolves.

From the GL spec, version 4.2, section 4.1.11 (Additional Multisample
Fragment Operations):

    If a framebuffer object is not bound, after all operations have
    been completed on the multisample buffer, the sample values for
    each color in the multisample buffer are combined to produce a
    single color value, and that value is written into the
    corresponding color buffers selected by DrawBuffer or
    DrawBuffers. An implementation may defer the writing of the color
    buffers until a later time, but the state of the framebuffer must
    behave as if the color buffers were updated as each fragment was
    processed. The method of combination is not specified. If the
    framebuffer contains sRGB values, then it is recommended that the
    an average of sample values is computed in a linearized space, as
    for blending (see section 4.1.7).

This patch adds a new "srgb" mode to the MSAA accuracy test, which
verifies that the formula used by the implementation to blend sRGB
samples matches the GL spec's recommendations.  When an "srgb"
accuracy test is requested, the test is modified to do the following
things:

- Render using a buffer format of SRGB8_ALPHA8 instead of RGBA.

- When manually downsampling the reference image, enable
  FRAMEBUFFER_SRGB, so that the data output by the manual downsampler
  gets converted from linear color space into sRGB color space.  This
  ensures that the reference image is generated according to the
  spec's recommendations.

- Convert pixels from sRGB color space to linear color space before
  comparing the test image and the reference image.  This ensures that
  the RMS error is computed in linear color space, so that the RMS
  error computed for sRGB mode is comparable with the RMS error
  computed for linear RGBA color.
Make a util func to compare images
fbo/formats: Make it possible to specify a test set on the command line.
Make it possible to change sunburst output type
Allow color gradient outputs to be offset and scaled.
Set up the fragment shader correctly for the output type.
msaa/formats: Read integer formats properly.
WIP: Don't use piglit_probe_image_color.
msaa/formats: Use a scale and offset for testing integer formats.
msaa: Add a function to all.tests for creating MSAA formats tests.
msaa/formats: Fix visualization of RED and RG formats

The switch statement in visualize_image() wasn't properly handling
formats whose base internal format is GL_RED or GL_RG.  As a result,
tests of these formats showed up as a black screen.  This patch addes
switch cases to handle the formats properly.
msaa: Test ARB_texture_rg and ARB_texture_rg-float formats