gs: Fix MSVC build.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
glsl-1.10 / glsl-1.20: Relax precision requirements of variable indexing tests

Many of these tests fail on older GPU such as Intel i915 due to the
precision requirement.  This is because many GPUs in this class only use
24-bit floats.  Many also implement many instructions cheaply (with poor
precision).

Do a couple things to relax the precision requirement.  First, use the
distance squared instead of the distance.  This saves an
inverse-square-root and a multiple.  The inverse-square-root has
notoriously poor precision on old GPUs.  Second, pick a precision that
passes on at least one 24-bit float GPU.  I picked 4e-9 because that was
the smallest bound that would pass on i915.

I suspect that r300 GPUs also fail these tests, but I don't have any of
that hardware around.  Could someone test before and after for me?

v2: Remove unnecessary abs() call.  Suggested by Brian Paul.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
gen_dispatch.py: PEP8 replace tabs

Remove mixed spaces and tabs replacing them all with tabs

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
gen_dispatch.py: PEP8 compliance

This brings gen_dispatch into PEP8 compliance with a few exceptions as
noted below:
35, 110, 112: These are part of a comments and are better left alone
472: This line is 81 charatres, and splitting it would actually make it
     harder to read than leaving it

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
gen_builtin_test.py: PEP8 compliance

This file is now 100% compliant according to the pep8 tool

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
shaders/gen_equal_tests.py: PEP8 compliance

Adds one extra space before a toplevel function definition.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
piglit-run.py: Remove deprecated options

Remove deprecated options that were carried over from the getopt =>
argparse conversion. These options were kept as for compatibility, but
marked as deprecated; and their continued existence clutters the code.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
piglit-print-commands.py: Remove deprecated options

This patch removes deprecated options from piglit-print-commands.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
glsl-1.50-get-active-attrib-array: Fix memory leak.

Fixes "Resource leak" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
glsl: Rewrite version-macro tests to ensure they're #defines.

The old tests verified that the value of __VERSION__ was correct, but
didn't verify that __VERSION__ is an actual #define, as opposed to a
built-in integer constant variable.

The new approach checks both.

Suggested-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Add new __VERSION__ tests for GLSL 1.10-1.40 and ES 1.00/3.00.

These follow the pattern of the 1.50 and 3.30 tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl-1.10: Test that __VERSION__ == 110 even without #version specified.

Again, following the pattern of the other __VERSION__ macro tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Delete shader runner tests for the __VERSION__ macro.

These have been superceded by tests/spec/glsl*/compiler/version-macro*.
The parser tests already ensure the value is correct (and fail to
compile if it isn't), so there's no additional value in having an
execution test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glsl: Make core-profile-define tests a bit more robust.

They now actually detect that GL_core_profile is a #define, rather than
a built-in constant, and also ensure that the value is 1, as required by
the spec.

Suggested-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
glslparsertest: Fix handling of --check-link option

The code in the PIGLIT_GL_TEST_CONFIG_BEGIN block assumes that various
command line parameters will be at specific locations.  However, if
--check-link is used, these locations will be off by one.  Process the
command line options in the PIGLIT_GL_TEST_CONFIG_BEGIN block to avoid
this problem.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl: Refactor some code out of shader_runner.c

These functions will be used in another file soon.

v2: Extract string_match (suggested by Eric) and strcpy_to_space as
well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
glsl: Add program to test all shader built-in constants

Using a simple text file, all shader built-in constants can be tested.
This has several advantages over the previous methodology.

1. All of the built-in constants and their expected values are kept in
one place per GLSL version.

2. The tests use the array-size idiom of many piglit tests which
guarantees that the values being tested are actually contants.

3. Since the tests are not execution tests, they run much faster.  The
single top-level test can also run concurrently with other tests.  The
speed difference is trivial most of the time, but in simlation
environments, each pixel drawn takes a very long time.  You're welcome,
Chad.

v2: Use required_gl_version_from_glsl_version, use string_match for
"gl_Max" comparison, and fix some whitespace issues (all suggested by
Eric).  Also use strcpy_to_space to simplify a bit of error handling
code.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
glsl-1.10: Convert minimum-maximums tests to use built-in-constants program

minimum-maximums.txt was generated by:

    cd tests/spec/glsl-1.10
    echo 1.10 > minimum-maximums.txt
    grep gl_Max execution/maximums/gl_Max* |\
        sort |\
        sed 's/[^(]\+[(]//;s/ >= / /;s/[)]$//' >> minimum-maximums.txt

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
glsl-1.20: Convert minimum-maximums tests to use built-in-constants program

minimum-maximums.txt was generated by:

    cd tests/spec/glsl-1.20
    echo 1.20 > minimum-maximums.txt
    grep gl_Max execution/maximums/gl_Max* |\
        sort |\
        sed 's/[^(]\+[(]//;s/ >= / /;s/[)]$//' >> minimum-maximums.txt

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
glsl-1.30: Convert minimum-maximums tests to use built-in-constants program

minimum-maximums.txt was generated by:

    cd tests/spec/glsl-1.30
    echo 1.30 > minimum-maximums.txt
    grep gl_Max execution/maximums/gl_Max* |\
        sort |\
        sed 's/[^(]\+[(]//;s/ >= / /;s/[)]$//' >> minimum-maximums.txt

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>