GL_ARB_texture_buffer_object: Add a first test for the extension.
GL_ARB_texture_buffer_object/negative-bad-bo: New test for error behavior.
GL_ARB_texture_buffer_object/negative-bad-target: New test for error behavior.
GL_ARB_texture_buffer_object/negative-bad-format: New test for error behavior

v2: Drop the copy-and-pasted bad-target code.
glsl-1.40: New test that ftransform() is gone.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl-1.40: Test that the deprecated structure definitions are gone.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
glsl-1.30: Add tests for mix(gentype, gentype, genbtype).

We missed testing this in the GLSL 1.30 work.

v2: Fix mistaken generation of mix(vec, vec, bool) variants, and
    adjust the lambda to Ken's tastes.
glsl-1.30: Add some specific tests for mix(, genbtype) with inf/nan.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
cmake: Add GLEXT_INCLUDE_DIR include to arb_texture_buffer_object.
Only define bool in non-C++ builds.

On MSVC builds, piglit-util.h defines "bool", "true" and "false" to
appropriate C equivalents, to work around the fact that MSVC does not
have a "stdbool.h" header.  This patch limits the workaround to only
apply when building pure C sources.

This allows piglit-util.h to be included safely by C++ source files,
such as those in Glean.
glean: use piglit-util and initialize GLEW.

Later patches in this series will introduce a new mechanism for
binding Piglit to GL functions, called piglit-dispatch.  This
mechanism will reside in the piglit-util library, and will require
initialization.

To ease the transition, this patch causes Glean to link to
piglit-util, and initializes GLEW using the glewInit() function.  When
GLEW is replaced with piglit-dispatch, the call to glewInit() will
serve to initialize new piglit-dispatch mechanism.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Add glewInit() calls to glx tests.

Previously these tests didn't initialize GLEW, presumably because they
only use (a) GL 1.0 functions, which bypass GLEW, and (b) GLX
functions, which they bind to using glXGetProcAddressARB().  Once we
switch to using piglit-dispatch instead of GLEW, we will need to
initialize it in order for the GL 1.0 functions to work.  This patch
adds a call to glewInit() in the place where a call to
piglit_dispatch_default_init() will eventually be needed.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Add glewInit() calls to GLX_ARB_create_context tests.

Previously these tests didn't initialize GLEW, because they only use
GLX functions and functions defined in GL 1.0 and 1.1 (all of which
bypass GLEW).  But once we switch to using piglit-dispatch instead of
GLEW, we will need to initialize it in order for any GL functions to
work.  This patch adds a call to glewInit() in the place where a call
to piglit_dispatch_default_init() will eventually be needed.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Fixup APIENTRY macro on Apple

The version of glut.h that ships on Mac OSX undefines the APIENTRY
macro.  APIENTRY is used on Windows builds to specify that GL
functions use the __stdcall calling convention, so it needs to be
defined to be the empty string on Mac OSX.  Previously this hasn't
been a problem because all of the GL function prototypes and typedefs
are finished by the time glut.h is included.  However, when we switch
to using piglit-dispatch instead of GLEW, there will be at least one
compilation unit (piglit-dispatch.c) which needs to use the APIENTRY
macro after including glut.h.

This patch works around the problem by redefining APIENTRY to the
correct value (which is the empty string) after including glut.h on
Apple builds.
piglit-dispatch: Introduce OpenGL API spec files.

This is the first in a series of patches that replaces GLEW with a new
mechanism called "piglit-dispatch".

This patch introduces files which describe the OpenGL API in
machine-readable form.  These files are duplicates of those found at
http://www.opengl.org/registry/.

The exact URLs of the files are as follows:

http://www.opengl.org/registry/api/gl.spec
http://www.opengl.org/registry/api/gl.tm
http://www.opengl.org/registry/api/enumext.spec

Later patches in the series will transform these spec files to C code.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
piglit-dispatch: Corrections to OpenGL API spec files.

This patch corrects a few minor errors in the OpenGL API spec files
from http://www.opengl.org/registry/:

- ALL_ATTRIB_BITS was incorrectly defined as 0xFFFFFFFF.  The correct
  value is 0x000FFFFF, since ALL_ATTRIB_BITS is not meant to apply to
  MULTISAMPLE_BIT (see extension specs 3DFX_multisample,
  ARB_multisample, EXT_multisample, and SGIS_multisample).

- IsProgramARB and IsProgramNV were incorrectly marked as aliases of
  IsProgram.  This is not the case, since IsProgram is used for GLSL
  programs, and IsProgramARB/IsProgramNV are used for assembly
  programs.

- GenVertexArraysAPPLE was incorrectly marked as an alias for
  "GenVertexArray".  There is no such function--the correct function
  is "GenVertexArrays".

- TransformFeedbackVaryingsNV was incorrectly marked as an alias for
  TransformFeedbackVaryings.  This is incorrect--the two functions
  interpret their arguments differently.  Similarly,
  GetTransformFeedbackVaryingNV was incorrectly marked as an alias for
  GetTransformFeedbackVarying.

- StencilFuncSeparateATI was incorrectly marked as an alias for
  StencilFuncSeparate.  This is incorrect--the two functions interpret
  their arguments differently.

- NV functions dealing with vertex attributes
  (GetVertexAttrib{d,f,i}vNV, VertexAttrib{1,2,3,4}{d,f,s}{,v}NV, and
  VertexAttrib4ub{,v}NV) were incorrectly marked as an alias for the
  corresponding core functions.  This is incorrect--NV extensions
  handle vertex attribute numbering differently.

The reason these errors were not caught by the maintainers of
opengl.org is likely because they don't affect the contents of the
glext.h header file.

Acked-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
piglit-dispatch: Additions to OpenGL API spec files.

This patch adds enums for the following extensions to the OpenGL API
spec files:

- OES_compressed_paletted_texture: This extension defines 10 enums,
  which are required to compile the test
  "spec/OES_compressed_paletted_texture/invalid formats".  These enums
  were already present in the OpenGL API spec files, but they were
  commented out (since they are part of GLES).

- ATI_texture_compression_3dc: These enums are required to compile the
  test "spec/ARB_texture_compression/unknown formats".

- NVX_gpu_memory_info: These enums are required to compile the file
  "tests/util/piglit-util-enum.c".

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
piglit-dispatch: Code generation scripts.

This patch contains the code generation scripts that convert the files
gl.spec, gl.tm, and enumext.spec into C code, as well as the CMake
directives to run the scripts.

Code generation occurs in two phases: first the script
glapi/parse_glspec.py converts the .spec and .tm files into an
intermediate JSON format, which is stored in glapi/glapi.json.  Then,
the script tests/util/gen_dispatch.py converts the JSON file into two
files, tests/util/generated_dispatch.c and
tests/util/generated_dispatch.h.

There are two motivations for breaking code generation into two phases:
(1) there are other code generation tasks we may add in the future
(e.g. generating the tests/util/piglit-util-enum.c file), and it would
be nice not to have to rewrite any parsing code when we do so.  (2) if
the GL consortium ever decides to change the format of gl.spec, gl.tm,
and enumext.spec, then we only have to change parse_glspec.py.

These code generation scripts can be run by invoking "make
piglit_dispatch_gen" from the toplevel source directory.

v2: Add clarifying comments, remove a bogus "print" statement, and
raise an exception if an unrecognized multiplicity is encountered.
Also, handle "reference" multiplicity.

v3: Add APIENTRY to stub functions.  Rename "near" and "far" to avoid
problems on MSVC.  Get rid of "__" in function names.  Rename
initialize_dispatch_pointers => reset_dispatch_pointers.  Add
gl_10x_version parameter to get_core_proc().  Output generated code
relative to CMAKE_BINARY_DIR so that it won't pollute source
directories when building out of tree.  Add .gitignore so that
generated files are ignored when building in tree.
cmake: Move utility functions into piglit_util.cmake

Currently there is only one utility function, piglit_include_target_api.
However, subsequent commits will add several more.

I'm choosing to define all the utility functions in their own file,
piglit_util.cmake, in order to keep things organized and the top
CMakeLists uncluttered.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
cmake: Define wrapper functions piglit_add_{executable,library}

For now, `piglit_add_executable` is a trivial wrapper around
`add_executable`.  Ditto for `piglit_add_library`.

A subsequent commit will leverage the wrappers to add to each object file
an explicit dependency on the header files generated by piglit_dispatch.

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