1
0
Fork 0
Commit graph

22 commits

Author SHA1 Message Date
Robert Bragg
dd7b16faf2 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>
2011-10-28 19:10:16 +01:00
Robert Bragg
63461c0f8b framebuffer: Add explicit buffer discard API
This adds cogl_framebuffer_discard_buffers API that allows applications
to explicitly discard depth and stencil buffers which really helps when
using a tile based GPU architexture by potentially avoiding the need to
save the results of depth and stencil buffer changes to system memory
between frames since these can usually be handled directly with on-chip
memory instead.

The semantics for cogl_framebuffer_swap_buffers and
cogl_framebuffer_swap_region are now documented to include an implicit
discard of all buffers, including the color buffer.

We now recommend that all rendering to a CoglOffscreen framebuffer
should be followed by a call like:
cogl_framebuffer_discard_buffers (fb,
                                  COGL_BUFFER_BIT_DEPTH|
                                  COGL_BUFFER_BIT_STENCIL);

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-10-28 19:10:16 +01:00
Robert Bragg
191d915671 framebuffer: Add a getter for the framebuffer format
This adds a new function, cogl_framebuffer_get_color_format() to be able
to query the common pixel format for any color buffers attached to a
given CoglFramebuffer. For example an offscreen framebuffer created
using cogl_offscreen_new_to_texture() would have a format matching the
texture.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-09-05 19:02:05 +01:00
Robert Bragg
3a2f94045e framebuffer: make _swap_region coords top-left relative
Cogl aims to consistently put the origin of 2D objects at the top-left
instead of the bottom left as OpenGL does, but there was an oversight
and the experimental cogl_framebuffer_swap_region API was accepting
coordinates relative to the bottom left. Cogl will now flip the user's
given rectangles to be relative to the bottom of the framebufffer before
sending them to APIs like glXCopySubBuffer and glBlitFramebuffer.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:43 +01:00
Robert Bragg
a3ad808f57 framebuffer: Make framebuffer_clear APIs public experimental
This makes cogl_framebuffer_clear and cogl_framebuffer_clear4f public as
experimental API. Since these functions take explicit framebuffer
pointers you don't need to push/pop a framebuffer just to clear it. Also
these functions are implicitly tied to a specific CoglContext via the
framebuffer pointer unlike cogl_clear.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:43 +01:00
Robert Bragg
64b2bbab84 framebuffer: Adds a context getter for CoglFramebuffer
This adds a function to query what CoglContext a given framebuffer
belongs too. This can be useful if you pass framebuffer pointers around
and at some point you want to create another framebuffer as part of the
same context as a given framebuffer without assuming there is a single
default context.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:43 +01:00
Chun-wei Fan
3d92038237 Fix cogl/cogl-framebuffer.h (#define error)
The cogl_framebuffer_get_blue_bits was defined 2 times-fix to use the
correct define for cogl_framebuffer_get_alpha_bits

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-31 17:46:35 +01:00
Philip Withnall
d51c3c423e Fix testing of undefined macro constants to check for definedness instead
Reviewed-By: Robert Bragg <robert@linux.intel.com>
2011-07-27 18:46:36 +01:00
Robert Bragg
8b34a39319 Adds ColorMask support to Cogl
This adds CoglPipeline and CoglFramebuffer support for setting a color
mask which is a bit mask defining which color channels should be written
to the current framebuffer.

The final color mask is the intersection of the framebuffer color mask
and the pipeline color mask. The framebuffer mask affects all rendering
to the framebuffer while the pipeline masks can be used to affect
individual primitives.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-19 19:27:09 +01:00
Robert Bragg
3ed8c8d0ba framebuffer: Add dither_enabled getter/setters
This adds a getter and setter for requesting dithering to be enabled.

Dithering is a hardware dependent technique to increase the visible
color resolution beyond what the underlying hardware supports by playing
tricks with the colors placed into the framebuffer to give the illusion
of other colors. (For example this can be compared to half-toning used
by some news papers to show varying levels of grey even though their may
only be black and white are available).

The results of enabling dithering are platform dependent and may have no
effect.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-13 19:06:19 +01:00
Robert Bragg
38b67e2884 onscreen: make platform specific onscreen apis consistent
There were several CoglOnscreen functions named like:
cogl_onscreen_<platform>_blah instead of cogl_<platform>_onscreen_blah
so this patch updates those to be consistent with other platform
specific apis we have in cogl.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-11 14:07:01 +01:00
Robert Bragg
a3fa7f5d96 docs: Adds missing cogl_framebuffer syms to reference
This adds a description for the cogl-framebuffer section and adds lots
of missing symbols to the 2.0 reference manual.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Robert Bragg
dcb033489e framebuffer: Add _get_XYZ_bits() functions
This exposes the previously internal only
_cogl_framebuffer_get_red/green/blue/alpha_bits() functions as 2.0
experimental API.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-04 15:31:50 +01:00
Robert Bragg
c4eb869bd7 framebuffer: expose viewport getters/setters
This exposes experimental cogl_framebuffer APIs for getting and setting
a viewport without having to refer to the implicit CoglContext. It adds
the following experimental API:

  cogl_framebuffer_set_viewport
  cogl_framebuffer_get_viewport4fv
  cogl_framebuffer_get_viewport_x
  cogl_framebuffer_get_viewport_y
  cogl_framebuffer_get_viewport_width
  cogl_framebuffer_get_viewport_height

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-06-30 14:33:11 +01:00
Robert Bragg
2282455f27 wayland: Allow setting foreign display/compositor
To support toolkits targeting wayland and using Cogl we allow toolkits
to be responsible for connecting to a wayland display and asking Cogl to
use the toolkit owned display and compositor object. Note: eventually
the plan is that wayland will allow retrospective querying of objects so
we won't need the foreign compositor API when Cogl can simply query it
from the foreign display.
2011-05-11 16:46:52 +01:00
Neil Roberts
442d4586b7 win32: Use the right macro name for COGL_HAS_WIN32_SUPPORT
Some places were using COGL_HAS_WIN32 but the only macro defined is
COGL_HAS_WIN32_SUPPORT. The similar macros such as COGL_HAS_XLIB are
only defined for compatibility with existing code but COGL_HAS_WIN32
was never defined so there's no need to support it.

One of the places was including the non-existant cogl-win32.h. This
has been removed because the file only temporarily existed during
development of the backend.
2011-05-11 15:20:59 +01:00
Neil Roberts
6788c80342 Add a WGL winsys
This adds a full winsys to handle WGL and Win32.
2011-05-10 17:58:41 +01:00
Robert Bragg
6c23f27801 Adds a way for Cogl to control event_mask of foreign wins
This extends cogl_onscreen_x11_set_foreign_xid to take a callback to a
function that details the event mask the Cogl requires the application
to select on foreign windows. This is required because Cogl, for
example, needs to track size changes of a window and may also in the
future want other notifications such as map/unmap.

Most applications wont need to use the foreign xwindow apis, but those
that do are required to pass a valid callback and update the event mask
of their window according to Cogl's requirements.
2011-05-05 15:05:42 +01:00
Robert Bragg
97243ad9ac Adds cogl_onscreen_show/hide functions
This adds Cogl API to show and hide onscreen framebuffers. We don't want
to go too far down the road of abstracting window system APIs with Cogl
since that would be out of its scope but the previous idea that we would
automatically map framebuffers on allocation except for those made from
foreign windows wasn't good enough. The problem is that we don't want to
make Clutter always create stages from foreign windows but with the
automatic map semantics then Clutter doesn't get an opportunity to
select for all the events it requires before mapping. This meant that we
wouldn't be delivered a mouse enter event for windows mapped underneath
the cursor which would break Clutters handling of button press events.
2011-05-05 15:05:42 +01:00
Robert Bragg
2a150003ad add missing name mangle for cogl_onscreen_set_swap_throttled
We weren't mangling cogl_onscreen_set_swap_throttled to give it an _EXP
postfix to clarify that it is an experimental symbol.
2011-05-05 15:05:42 +01:00
Robert Bragg
2bbb0d895b Make cogl_framebuffer_get_width/height experimental public API
It's generally useful to be able to query the width and height of a
framebuffer and we expect to need this in Clutter when we move the
eglnative backend code into Cogl since Clutter will need to read back
the fixed size of the framebuffer when realizing the stage.
2011-04-11 17:54:36 +01:00
Robert Bragg
d40cdfa3e1 Moves all GLX code down from Clutter to Cogl
This migrates all the GLX window system code down from the Clutter
backend code into a Cogl winsys. Moving OpenGL window system binding
code down from Clutter into Cogl is the biggest blocker to having Cogl
become a standalone 3D graphics library, so this is an important step in
that direction.
2011-04-11 17:54:36 +01:00