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.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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().

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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().

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
msaa: Fix const correctness of TestPattern::draw() function.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
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().

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
msaa: Test that MSAA works properly for all core FBO color formats.

This test builds on the existing FBO and MSAA testing infrastructure
to verify proper functioning of MSAA for various formats.

All core formats which are framebufferbuffer complete are tested.  All
formats which are not framebuffer complete are skipped.

Tests for non-core and depth/stencil formats will be added in later
patches.

Verified using the proprietary nVidia driver for Linux--all formats
pass except the LUMINANCE_ALPHA formats, which fail due to a driver
bug (when rendering to these formats, the nVidia driver maps the red
channel to both luminance and alpha, instead of mapping red to
luminance and alpha to alpha).
WIP: clip and scissor blit test
Hack: don't test flipping src but not dst or vice versa
HACK: don't test src clips