mutter/cogl/driver/gl/cogl-context-driver.h
Robert Bragg bb3a008318 [draw-buffers] First pass at overhauling Cogl's framebuffer management
Cogl's support for offscreen rendering was originally written just to support
the clutter_texture_new_from_actor API and due to lack of documentation and
several confusing - non orthogonal - side effects of using the API it wasn't
really possible to use directly.

This commit does a number of things:
- It removes {gl,gles}/cogl-fbo.{c,h} and adds shared cogl-draw-buffer.{c,h}
  files instead which should be easier to maintain.
- internally CoglFbo objects are now called CoglDrawBuffers. A
  CoglDrawBuffer is an abstract base class that is inherited from to
  implement CoglOnscreen and CoglOffscreen draw buffers.  CoglOffscreen draw
  buffers will initially be used to support the
  cogl_offscreen_new_to_texture API, and CoglOnscreen draw buffers will
  start to be used internally to represent windows as we aim to migrate some
  of Clutter's backend code to Cogl.
- It makes draw buffer objects the owners of the following state:
  - viewport
  - projection matrix stack
  - modelview matrix stack
  - clip state
(This means when you switch between draw buffers you will automatically be
 switching to their associated viewport, matrix and clip state)

Aside from hopefully making cogl_offscreen_new_to_texture be more useful
short term by having simpler and well defined semantics for
cogl_set_draw_buffer, as mentioned above this is the first step for a couple
of other things:
- Its a step toward moving ownership for windows down from Clutter backends
  into Cogl, by (internally at least) introducing the CoglOnscreen draw
  buffer.  Note: the plan is that cogl_set_draw_buffer will accept on or
  offscreen draw buffer handles, and the "target" argument will become
  redundant since we will instead query the type of the given draw buffer
  handle.
- Because we have a common type for on and offscreen framebuffers we can
  provide a unified API for framebuffer management. Things like:
  - blitting between buffers
  - managing ancillary buffers (e.g. attaching depth and stencil buffers)
  - size requisition
  - clearing
2009-11-03 17:23:03 +00:00

105 lines
5.3 KiB
C

/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __COGL_CONTEXT_DRIVER_H
#define __COGL_CONTEXT_DRIVER_H
#include "cogl.h"
typedef struct _CoglContextDriver
{
/* Relying on glext.h to define these */
COGL_PFNGLGENRENDERBUFFERSPROC pf_glGenRenderbuffers;
COGL_PFNGLDELETERENDERBUFFERSPROC pf_glDeleteRenderbuffers;
COGL_PFNGLBINDRENDERBUFFERPROC pf_glBindRenderbuffer;
COGL_PFNGLRENDERBUFFERSTORAGEPROC pf_glRenderbufferStorage;
COGL_PFNGLGENFRAMEBUFFERSPROC pf_glGenFramebuffers;
COGL_PFNGLBINDFRAMEBUFFERPROC pf_glBindFramebuffer;
COGL_PFNGLFRAMEBUFFERTEXTURE2DPROC pf_glFramebufferTexture2D;
COGL_PFNGLFRAMEBUFFERRENDERBUFFERPROC pf_glFramebufferRenderbuffer;
COGL_PFNGLCHECKFRAMEBUFFERSTATUSPROC pf_glCheckFramebufferStatus;
COGL_PFNGLDELETEFRAMEBUFFERSPROC pf_glDeleteFramebuffers;
COGL_PFNGLGENERATEMIPMAPPROC pf_glGenerateMipmap;
COGL_PFNGLBLITFRAMEBUFFEREXTPROC pf_glBlitFramebufferEXT;
COGL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC pf_glRenderbufferStorageMultisampleEXT;
COGL_PFNGLCREATEPROGRAMOBJECTARBPROC pf_glCreateProgramObjectARB;
COGL_PFNGLCREATESHADEROBJECTARBPROC pf_glCreateShaderObjectARB;
COGL_PFNGLSHADERSOURCEARBPROC pf_glShaderSourceARB;
COGL_PFNGLCOMPILESHADERARBPROC pf_glCompileShaderARB;
COGL_PFNGLATTACHOBJECTARBPROC pf_glAttachObjectARB;
COGL_PFNGLLINKPROGRAMARBPROC pf_glLinkProgramARB;
COGL_PFNGLUSEPROGRAMOBJECTARBPROC pf_glUseProgramObjectARB;
COGL_PFNGLGETUNIFORMLOCATIONARBPROC pf_glGetUniformLocationARB;
COGL_PFNGLDELETEOBJECTARBPROC pf_glDeleteObjectARB;
COGL_PFNGLGETINFOLOGARBPROC pf_glGetInfoLogARB;
COGL_PFNGLGETOBJECTPARAMETERIVARBPROC pf_glGetObjectParameterivARB;
COGL_PFNGLVERTEXATTRIBPOINTERARBPROC pf_glVertexAttribPointerARB;
COGL_PFNGLENABLEVERTEXATTRIBARRAYARBPROC pf_glEnableVertexAttribArrayARB;
COGL_PFNGLDISABLEVERTEXATTRIBARRAYARBPROC pf_glDisableVertexAttribArrayARB;
COGL_PFNGLGENBUFFERSARBPROC pf_glGenBuffersARB;
COGL_PFNGLBINDBUFFERARBPROC pf_glBindBufferARB;
COGL_PFNGLBUFFERDATAARBPROC pf_glBufferDataARB;
COGL_PFNGLBUFFERSUBDATAARBPROC pf_glBufferSubDataARB;
COGL_PFNGLMAPBUFFERARBPROC pf_glMapBufferARB;
COGL_PFNGLUNMAPBUFFERARBPROC pf_glUnmapBufferARB;
COGL_PFNGLDELETEBUFFERSARBPROC pf_glDeleteBuffersARB;
COGL_PFNGLUNIFORM1FARBPROC pf_glUniform1fARB;
COGL_PFNGLUNIFORM2FARBPROC pf_glUniform2fARB;
COGL_PFNGLUNIFORM3FARBPROC pf_glUniform3fARB;
COGL_PFNGLUNIFORM4FARBPROC pf_glUniform4fARB;
COGL_PFNGLUNIFORM1FVARBPROC pf_glUniform1fvARB;
COGL_PFNGLUNIFORM2FVARBPROC pf_glUniform2fvARB;
COGL_PFNGLUNIFORM3FVARBPROC pf_glUniform3fvARB;
COGL_PFNGLUNIFORM4FVARBPROC pf_glUniform4fvARB;
COGL_PFNGLUNIFORM1IARBPROC pf_glUniform1iARB;
COGL_PFNGLUNIFORM2IARBPROC pf_glUniform2iARB;
COGL_PFNGLUNIFORM3IARBPROC pf_glUniform3iARB;
COGL_PFNGLUNIFORM4IARBPROC pf_glUniform4iARB;
COGL_PFNGLUNIFORM1IVARBPROC pf_glUniform1ivARB;
COGL_PFNGLUNIFORM2IVARBPROC pf_glUniform2ivARB;
COGL_PFNGLUNIFORM3IVARBPROC pf_glUniform3ivARB;
COGL_PFNGLUNIFORM4IVARBPROC pf_glUniform4ivARB;
COGL_PFNGLUNIFORMMATRIX2FVARBPROC pf_glUniformMatrix2fvARB;
COGL_PFNGLUNIFORMMATRIX3FVARBPROC pf_glUniformMatrix3fvARB;
COGL_PFNGLUNIFORMMATRIX4FVARBPROC pf_glUniformMatrix4fvARB;
COGL_PFNGLDRAWRANGEELEMENTSPROC pf_glDrawRangeElements;
COGL_PFNGLACTIVETEXTUREPROC pf_glActiveTexture;
COGL_PFNGLCLIENTACTIVETEXTUREPROC pf_glClientActiveTexture;
COGL_PFNGLBLENDEQUATIONPROC pf_glBlendEquation;
COGL_PFNGLBLENDCOLORPROC pf_glBlendColor;
COGL_PFNGLBLENDFUNCSEPARATEPROC pf_glBlendFuncSeparate;
COGL_PFNGLBLENDEQUATIONSEPARATEPROC pf_glBlendEquationSeparate;
} CoglContextDriver;
#endif /* __COGL_CONTEXT_DRIVER_H */