Use simplejson if available

simplejson is a native code version of the json module in python
(the json module in core python implements the simplejson api), which
means that simplejson can be used in place of the json module, but it
performs much better. This patch attempts to load simplejson, and falls
back to normal json if it fails.

In the summary path on a single run of quick.tests, simplejson is about
3-4 seconds faster than json, ~7 seconds vs ~11 seconds.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Fix invalid gs qualifier "layout(triangles) out" in a few tests.

"triangles" is not a valid geometry shader output primitive type.
"triangle_strip" must be used instead.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Escape HTML output when generating test result pages.

If a test generates output containing '<', '>', or '&', we need to
HTML escape it so that the web browser doesn't interpret it as
containing HTML tags.

While we're at it, go ahead and HTML escape the traceback and dmesg
outputs too.

Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
arb_texture_storage: Use piglit idoms

This mostly reverts bd096a8a, but it keeps the subtest reporting.  The
non-idomatic way this test was implemented was causing confusion for at
least one new piglit developer.

v2: Rebase on top of 3c21a59.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: Corey Richardson <corey@octayn.net>
Cc: Jon Ashburn <jon@lunarg.com>
Cc: Brian Paul <brianp@vmware.com>
arb_texture_storage: Update test requirements

The test uses 3D textures which were not part of OpenGL until 1.2.  This
doesn't matter much in practice because the Linux OpenGL ABI requires at
least OpenGL 1.2.  Change the minimum GL version from 1.0 to 1.2.

Also, require GL_ARB_texture_cube_map for "cube texture" subtest.

v2: Add the GL_ARB_texture_cube_map requirement.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: Brian Paul <brianp@vmware.com>
arb_texture_storage: Comsetic fixes

Word wrap for 80-column displays.  Use the canonical form for spec
quotations.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
summary.py: align output of Summary.generate_text()

This lines up the colons for dmesg-* statuses with the other statuses.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
ARB_texture_gather: add initial execution test

This test exercises combinations of:
- Shader stage vs/fs
- Offsetting
- Component count, up to implementation-defined limit
- Swizzling
- Unsigned normalized, float, int, unsigned int component types
- 2D/2DArray/Cube/CubeArray samplers

The test works by numbering the texels, and ensuring that the four
texels sampled by textureGather*() are those we expect.

Not exercised yet:
- Other interesting internalformats [DEPTH_COMPONENT, etc]
- Addressing modes other than WRAP.
- Use in Geometry Shader. I'd like to pick this up later, as mesa's
  GS support matures.

V2: - Use textureSize rather than hardcoding size in shader;
    - Use piglit_build_simple_program
    - Whitespace tidyups
    - Convert swizzle to enum
    - More component types, for all gsampler2D variants.

V3: - More whitespace
V4: - allow explicit 'unorm' component type; rework usage
    - Support all required sampler types.
    - Refactor setup

V5: - Clear before drawing

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
shader_runner: add ability to control red swizzle texparameter

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
ARB_texture_gather: add new test for miplevel behavior

textureGather always samples the base level, regardless of what
filtering modes are set.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
ARB_gpu_shader5: add compiler tests for textureGather*()

This extension adds the following new variants:

- shadow sampler support
- rectangle sampler support
- nonconstant texture offsets
- constant component select parameter
- independent offsets per texel support

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
textureGather: add support for selecting component
textureGather: add support for nonconstant offsets

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
textureGather: add support for testing shadow samplers

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
textureGather: add some more sanity checks

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
textureGather: add support for rectangle samplers

Slightly fiddly:
	- Unnormalized coords
	- GL_REPEAT is not supported with rectangle textures, so we grow
	  support for specifying the address mode.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
ARB_gpu_shader5: add new textureGather* variants to all.tests

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glx-query-drawable: change piglit_id to signed

To silence signed vs. unsigned pointer warning in the call to
glXGetFBConfigAttrib().
piglit-summary.py: add missing space in help text
textureGather: rename enums to fix MingW, MSVC build

FLOAT, INT, UINT, etc. are typedefs on Windows.  Add _T suffix to
the enums to avoid name collisions.