util: Generalize piglit_probe_image_{rgb,rgba}

This patch eliminates code duplication between
piglit_probe_image_rgb() and piglit_probe_image_rgba() by implementing
them both in terms of a common function, piglit_probe_image_color().
In addition to being able to test GL_RGB and GL_RGBA,
piglit_probe_image_color() should be able to test any color buffer
format (e.g. GL_RG or GL_LUMINANCE_ALPHA).

piglit_probe_image_color() makes use of a new function,
piglit_num_components(), to determine how many components a given base
internal format contains (e.g. piglit_num_components(GL_RGBA) == 4).
This function is exposed through piglit-util.h in case it can be
useful in writing tests.
fbo: Make fbo-formats.h able to be included from a .cpp file.

This required changing format_desc::name to a const char *, renaming a
variable called "new", and fixing a few signed/unsigned comparison
warnings.
fbo: Add base internal format info to fbo-formats.h

This patch augments the format_desc structure (used by fbo-formats.h
to describe a format to be tested) with a base_internal_format field,
which indicates the base internal format corresponding to each
particular internal format (e.g. the base internal format of
GL_R3_G3_B2 is GL_RGB).

The field test_desc::base (which carries the same information, but
only for depth/stencil formats, and is sometimes incorrect) will be
removed in a later patch.
msaa: Add ColorGradientSunburst program.

This patch adds a new program to the common infrastructure for MSAA
tests, ColorGradientSunburst, which draws a triangle sunburst where
the color of each triangle is a gradient.  This program will be used
to verify proper operation of MSAA when applied to color buffer
formats.
msaa: Make a data structure for fbo config.

This patch creates a data structure to contain the configuration
parameters passed to Fbo::init().  This allows obscure parameters
(attach_texture and combine_depth_stencil) to take on default values
in all tests except those that need to give them special treatment.
This will be especially important when future patches in the series
add more obscure configuration parameters.
msaa: Reuse FboConfig data structure in Fbo.

This patch modifies Fbo so that instead of storing its copy of the
configuration parameters passed to init() as primitive values, it
stores them using an FboConfig data structure.
msaa: Make a separate Fbo setup() function.

This patch splits the function Fbo::set_samples() into two functions,
Fbo::set_samples() (which sets the number of samples and then updates
the framebuffer object to reflect the contents of Fbo::config), and
Fbo::setup() (which simply updates the framebuffer object to reflect
the contents of Fbo::config).  This lets us avoid a clumsy call to
Fbo::set_samples() from Fbo::init().
msaa: Fix GL object leak when changing fbo config.

Previously, we would allocate new textures and renderbuffers whenever
the configuration of a framebuffer changed (e.g. when changing its
sample count), causing the old textures and renderbuffers to be
leaked.  This patch fixes the leak by allocating all of the textures
and renderbuffers that will be needed up front.  It also renames the
generate() function to generate_gl_objects() to clarify its purpose.
msaa: Make it possible to reconfigure the fbo after initial use.

This patch makes it safe to re-initialize the state of an Fbo object
to a new configuration.  This will be necessary to allow this object
to be used for testing formats, since one piglit test will have to
test several different Fbo formats in sequence.

To reflect the fact that initialization of the Fbo object is no longer
a one-time action, we now use the name setup() for the function that
sets the Fbo state, rather than init().
msaa: Allow format of the color buffer used in the MSAA fbos to be configured.

This will make it possible to test proper operation of MSAA with
various color buffer formats.  For tests that don't need to vary the
color buffer format, a default format of GL_RGBA is used.
msaa: Make a new Fbo::try_setup() function.

In contrast to the Fbo::setup() function (which terminates the test if
the framebuffer is incomplete), Fbo::try_setup() merely returns a
boolean indicating whether the framebuffer is complete.  This will be
necessary to allow different color formats to be tested, since we
won't want to terminate the test if a non-renderable color format is
attempted.
msaa: Fix const correctness of TestPattern::draw() function.
msaa: Make a static identity matrix for convenience.

This patch adds a constant matrix TestPattern::no_projection (which is
the identity matrix), for use by tests that don't need to pass a
projection matrix when calling TestPattern::draw().
Rearrange if tests so as not to rely on misclassification of GL_DEPTH32F_STENCIL8
Stop using incorrect baseformat
Eliminate bogus baseformat
Eliminate unnecessary variable test_set.

This variable's purpose was to point to test_sets[test_index], but it
was not consistently updated.  This patch replaces it with explicit
references to test_sets[test_index] to reduce confusion.
Split out a function for selecting an fbo test set by name.
Make an alternate function for initializing fbo formats
WIP: formats test

Passes on Mesa now with core formats.  Passes on nVidia with everything but LUMINANCE_ALPHA formats (due to a driver bug).