offscreen: Adds support for offscreen multisampling

This adds support for multisample rendering to offscreen framebuffers.
After an offscreen framebuffer is first instantiated using
cogl_offscreen_new_to_texture() it is then possible to use
cogl_framebuffer_set_samples_per_pixel() to request multisampling before
the framebuffer is allocated. This also adds
cogl_framebuffer_resolve_samples() for explicitly resolving point
samples into pixels. Even though we currently only support the
IMG_multisampled_render_to_texture extension which doesn't require an
explicit resolve, the plan is to also support the
EXT_framebuffer_multisample extension which uses the framebuffer_blit
extension to issue an explicit resolve.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg
2011-08-23 13:55:12 +01:00
parent a74c81ada3
commit dd7b16faf2
5 changed files with 488 additions and 236 deletions

View File

@ -54,6 +54,12 @@ typedef struct
int samples_per_pixel;
} CoglFramebufferConfig;
/* Flags to pass to _cogl_offscreen_new_to_texture_full */
typedef enum
{
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1
} CoglOffscreenFlags;
struct _CoglFramebuffer
{
CoglObject _parent;
@ -121,13 +127,15 @@ typedef struct _CoglOffscreen
GSList *renderbuffers;
CoglTexture *texture;
} CoglOffscreen;
int texture_level;
int texture_level_width;
int texture_level_height;
/* Flags to pass to _cogl_offscreen_new_to_texture_full */
typedef enum
{
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1
} CoglOffscreenFlags;
/* FIXME: _cogl_offscreen_new_to_texture_full should be made to use
* fb->config to configure if we want a depth or stencil buffer so
* we can get rid of these flags */
CoglOffscreenFlags create_flags;
} CoglOffscreen;
#define COGL_OFFSCREEN(X) ((CoglOffscreen *)(X))