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>
piglit-run: Fix resume path resolving

Fix resolution of relative paths to absolute paths. This will help keep
piglit from crashing out when resume path is not within source path. This
happens regularly when using distributed testing.

Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
framework/shader_test: Permit unicode paths

This fixes resume failures when paths are interpreted as unicode when the
script expects ascii.

[chadv]: Replace `if (!X and !Y) assert()` with `assert(X or Y)`.
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
port ttexrect.cpp to piglit from glean

This ported test goes into tests/spec/arb_texture_rectangle. It
tests the ARB_texture_rectangle extension.

Create a 255x127 texture of varying colors and bind it as a
GL_ARB_texture_recangle target.  Draw that rectangle to the window, and
check that the texture was drawn correctly.  The common failure to be
caught with this test is not adjusting the non-normalized coordinates on
hardware that expects normalized coordinates.

To all.tests, add new texrect_simple_arb_texrect

v2: add PIGLIT_GL_VISUAL_DOUBLE to the window_visual, move various
setup bits to piglit_init and add forgotten all.tests change.
v3: use piglit_present_results, and piglit_probe_image_rgb
v4: use piglit_draw_rect_tex, piglit_ortho_projection and minor
clean ups.

Signed-off-by: Tom Gall <tom.gall@linaro.org>

Reviewed-by: Brian Paul <brianp@vmware.com>
rm tests/glean/ttexrect.*

Remove ttexrect.* from glean as the previous patch ports the test
to piglit.

Remove texRect from all.tests.

Signed-off-by: Tom Gall <tom.gall@linaro.org>

Reviewed-by: Brian Paul <brianp@vmware.com>
Remove BindBufferRange out-of-range tests.

In the documentation for BindBufferRange, OpenGL specs from 3.0
through 4.1 contain this language:

    "The error INVALID_VALUE is generated if size is less than or
    equal to zero or if offset + size is greater than the value of
    BUFFER_SIZE."

This text was dropped from OpenGL 4.2, and it does not appear in the
GLES 3.0 spec.

Presumably the reason for the change is because come clients change
the size of the buffer after calling BindBufferRange.  Implementations
shouldn't generate an error at the time of the BindBufferRange call
just because the old size of the buffer was too small, when the buffer
is about to be resized.

Since this is a deliberate relaxation of error conditions in order to
allow clients to work, it seems sensible to allow implementations to
apply this change even if the GL version is less than 4.2.  This patch
eliminates the checks that would have required the error condition to
be flagged.

See associated Mesa patch:

    mesa: Don't check (offset + size <= bufObj->Size) in BindBufferRange.

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

v2: Replace the removed checks with a comment noting that we're
explicitly not testing this language.
texture-integer-glsl130: fix wrong expected G/B values for L/LA/I formats

The tests expects the green and blue values to be the same as the luminance
(or intensity) value but it should be zero.
(Mesa used to do the former for readpixels probably due to complex wording
in earlier gl specs but this was considered an error and subsequently changed
in ad897fff7730298c21289768d9b1b55f3d166ac5.)

Tested-by: Brian Paul <brianp@vmware.com>
getteximage-formats: test GetTexImage after rendering to textures

This tests whether our GetTexImage doesn't actually rely on TexImage being
called first. In this test, TexImage is not used to store data.

Reviewed-by: Brian Paul <brianp@vmware.com>
Test default precision qualifiers for samplers in GLSL ES.

Reviewed-by: Eric Anholt <eric@anholt.net>
GLES3: test that non-flat varying structs cannot contain ints.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Modify tests for error checking on "flat" keyword to match updated specs.

All of the GLSL specs from GLSL 1.30 (and GLSL ES 3.00) onward contain
language requiring certain integer variables to be declared with the
"flat" keyword, but they differ in exactly *when* the rule is
enforced:

(a) GLSL 1.30 and 1.40 say that vertex shader outputs having integral
type must be declared as "flat".  There is no restriction on fragment
shader inputs.

(b) GLSL 1.50 through 4.30 say that fragment shader inputs having
integral type must be declared as "flat".  There is no restriction on
vertex shader outputs.

(c) GLSL ES 3.00 says that both vertex shader outputs and fragment
shader inputs having integral type must be declared as "flat".

Previously, Piglit simply checked for behaviour (a).  This patch makes
it check for behaviour (b) in desktop GL and behaviour (c) in GLES.

Rationale: once geometry shader support is included, (b) is the only
sensible choice, because it requires "flat" in just the situations
where it matters.  Since many implementations extend geometry shader
support back before GLSL 1.50 (via ARB_geometry_shader4), it seems
sensible to regard the difference between (a) and (b) as a bug fix
rather than a deliberate behavioural difference, and therefore test
for behaviour (b) even in GLSL 1.30.

Some discussion about this has already happened on the Mesa-dev list.
See:

http://lists.freedesktop.org/archives/mesa-dev/2013-February/034199.html

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
cl: Add % to the list of illegal characters in test names

% was being interpreted as a format string in some cases
gles-2.0: Check illegality of attaching multiple shader objects of same type

From the OpenGL ES 2.0 spec, Section 2.10.3 Program Objects:

   Multiple shader objects of the same type may not be attached to
   a single program object. [...] The error INVALID_OPERATION is generated
   if [...] another shader object of the same type as shader is already
   attached to program.

This test checks that GL_INVALID_OPERATION is generated.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anunj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
arb_texture_buffer_range: add initial tests (dlist, errors, ranges)

v2:
errors: Test negative size and positive non-aligned offset.
ranges: Use macro to generate main function, fix issues with
fragment shader.

Reviewed-by: Eric Anholt <eric@anholt.net>
shader_runner and glslparsertest: choose GL version more accurately.

Previously, both shader_runner and glslparsertest contained switch
statements that attempted to choose a GL version for testing based on
a GLSL version requirement, and those switch statements didn't choose
a GL version very accurately (for example, they converted GLSL version
1.50 to GL version 3.1, which doesn't work).

This patch replaces the switch statements with a single common
function (in piglit-util-gl-common) that does the right thing.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
shader_runner: Remove unimplemented geometry_program vestiges.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
shader_runner: Add support for testing geometry shaders.

Note that there are two slightly different variants of geometry
shaders: those supported by GLSL 1.50 and those supported by
ARB_geometry_shader4.  A principal difference between these two
variants is in how geometry shader layout parameters are specified
(i.e. input and output primitive types, max number of output
vertices).  When using GLSL 1.50 style geometry shaders, these layout
parameters are specified in the shader source.  When using
ARB_geometry_shader4 style geometry shaders, these layout parameters
are specified by calling glProgramParameteriARB() prior to linking.

In order to support both variants, this patch allows an optional
"[geometry layout]" section to shader_runner test files.  For example
the following [geometry layout] section:

    [geometry layout]
    input type GL_POINTS
    output type GL_LINE_STRIP
    vertices out 3

Causes shader_runner to make these calls prior to linking:

    glProgramParameteriARB(prog, GL_GEOMETRY_INPUT_TYPE_ARB,
                           GL_POINTS);
    glProgramParameteriARB(prog, GL_GEOMETRY_OUTPUT_TYPE_ARB,
                           GL_LINE_STRIP);
    glProgramParameteriARB(prog, GL_GEOMETRY_VERTICES_OUT_ARB, 3);

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
glslparsertest: Add support for testing geometry shaders.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>