mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
Adds initial GLES2 integration support
This makes it possible to integrate existing GLES2 code with applications using Cogl as the rendering api. Currently all GLES2 usage is handled with separate GLES2 contexts to ensure that GLES2 api usage doesn't interfere with Cogl's own use of OpenGL[ES]. The api has been designed though so we can provide tighter integration later. The api would allow us to support GLES2 virtualized on top of an OpenGL/GLX driver as well as GLES2 virtualized on the core rendering api of Cogl itself. Virtualizing the GLES2 support on Cogl will allow us to take advantage of Cogl debugging facilities as well as let us optimize the cost of allocating multiple GLES2 contexts and switching between them which can both be very expensive with many drivers. As as a side effect of this patch Cogl can also now be used as a portable window system binding API for GLES2 as an alternative to EGL. Parts of this patch are based on work done by Tomeu Vizoso <tomeu.vizoso@collabora.com> who did the first iteration of adding GLES2 API support to Cogl so that WebGL support could be added to webkit-clutter. This patch adds a very minimal cogl-gles2-context example that shows how to create a gles2 context, clear the screen to a random color and also draw a triangle with the cogl api. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 4bb6eff3dbd50d8fef7d6bdbed55c5aaa70036a8)
This commit is contained in:
@ -166,17 +166,33 @@ struct _CoglFramebuffer
|
||||
CoglBool clear_clip_dirty;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL = 1L<<0,
|
||||
COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH24_STENCIL8 = 1L<<1,
|
||||
COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH = 1L<<2,
|
||||
COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL = 1L<<3
|
||||
} CoglOffscreenAllocateFlags;
|
||||
|
||||
typedef struct _CoglGLFramebuffer
|
||||
{
|
||||
GLuint fbo_handle;
|
||||
GList *renderbuffers;
|
||||
int samples_per_pixel;
|
||||
} CoglGLFramebuffer;
|
||||
|
||||
struct _CoglOffscreen
|
||||
{
|
||||
CoglFramebuffer _parent;
|
||||
GLuint fbo_handle;
|
||||
GSList *renderbuffers;
|
||||
|
||||
CoglGLFramebuffer gl_framebuffer;
|
||||
|
||||
CoglTexture *texture;
|
||||
int texture_level;
|
||||
int texture_level_width;
|
||||
int texture_level_height;
|
||||
|
||||
CoglOffscreenAllocateFlags allocation_flags;
|
||||
|
||||
/* 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 */
|
||||
@ -400,4 +416,17 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
gboolean
|
||||
_cogl_framebuffer_try_creating_gl_fbo (CoglContext *ctx,
|
||||
CoglTexture *texture,
|
||||
int texture_level,
|
||||
int texture_level_width,
|
||||
int texture_level_height,
|
||||
CoglFramebufferConfig *config,
|
||||
CoglOffscreenAllocateFlags flags,
|
||||
CoglGLFramebuffer *gl_framebuffer);
|
||||
|
||||
void
|
||||
_cogl_gl_framebuffer_bind (CoglFramebuffer *framebuffer, GLenum target);
|
||||
|
||||
#endif /* __COGL_FRAMEBUFFER_PRIVATE_H */
|
||||
|
Reference in New Issue
Block a user