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

@@ -333,18 +333,6 @@ COGL_EXT_FUNCTION (void, glBlitFramebuffer,
GLenum filter))
COGL_EXT_END ()
COGL_EXT_BEGIN (offscreen_multisample, 255, 255,
0, /* not in either GLES */
"EXT\0",
"framebuffer_multisample\0")
COGL_EXT_FUNCTION (void, glRenderbufferStorageMultisample,
(GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height))
COGL_EXT_END ()
/* ARB_fragment_program */
COGL_EXT_BEGIN (arbfp, 255, 255,
0, /* not in either GLES */
@@ -660,3 +648,21 @@ COGL_EXT_FUNCTION (void, glDiscardFramebuffer,
const GLenum *attachments))
COGL_EXT_END ()
COGL_EXT_BEGIN (IMG_multisampled_render_to_texture, 255, 255,
0, /* not in either GLES */
"\0",
"IMG_multisampled_render_to_texture\0")
COGL_EXT_FUNCTION (void, glRenderbufferStorageMultisampleIMG,
(GLenum target,
GLsizei samples,
GLenum internal_format,
GLsizei width,
GLsizei height))
COGL_EXT_FUNCTION (void, glFramebufferTexture2DMultisampleIMG,
(GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level,
GLsizei samples))
COGL_EXT_END ()