Commit Graph

208 Commits

Author SHA1 Message Date
Sjoerd Simons
cde0eb3e76 Make the default driver selectable at configure time
When building COGL with multiple backends it can be useful to force a
default driver to be selected. For example while for Debian we do want to
build the GL renderer on ARM, GLESv2 is much more suitable as the
default renderer on that platform.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8a43aa7167b56784f7b50c557391b990861d594f)
2012-09-03 15:51:45 +01:00
Chun-wei Fan
8dbf7ffe05 cogl/Makefile.am: Correct the way gen-enums.bat is created
Don't use --symbol-prefix cogl_gtype as we are still using the old
namespace in cogl-1.12, so there will still be the various _get_type()'s
like before

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-08-17 01:20:02 +08:00
Tomeu Vizoso
04348bda0b cogl-gles2: Install headers in cogl/ instead of in cogl2/
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-08-16 16:36:34 +01:00
Tomeu Vizoso
bb258c1d42 Avoid including the EGL headers from the public Cogl headers
Otherwise, X11 identifiers may leak and cause havoc in big applications

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit ed0cdca0eca815543619fe72fbd42d662d53f92d)
2012-08-06 18:51:32 +01:00
Tomeu Vizoso
93d0de1d9a Mass rename CLUTTER_COMPILATION to COGL_COMPILATION
Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit a99512e5798e48ffa3a9a1a7eb98bc55647ee1b6)
2012-08-06 14:27:45 +01:00
Neil Roberts
17c818a9a7 Add an SDL2 winsys
This adds an alternate version of the SDL winsys using the SDL 2 API.
The two versions are mutually exclusive and share the same
CoglWinsysID. Version 2 of SDL fits a little bit better with Cogl
because it supports multiple windows and the video subsystem can be
initialised entirely independently of the rest of the subsystems.

The SDL2 winsys creates an invisible dummy window in order to bind the
GL context after creating the Cogl display. This is similar to how the
X11 winsys's work.

SDL2 seems to support compiling with support for both GL and GLES.
However there doesn't seem to be a way to select between the two
backends outside of SDL. In fact if you do compile them both in it
seems to break down because it will always try to use the window
system functions from the GLES backend because those are filled in
second in the vtable. However when creating the window it will always
prefer to use the GL function to choose a visual. This function gets
confused because the GL backend has not been initialised at that
point. The Cogl backend therefore just leaves it up to SDL to pick a
sensible backend. It will then verify that it picked a GL library
which matches the Cogl driver by checking the string from
glGetString(GL_VERSION).

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 6cb5ab41355e7bfe28f367cf4afa39a7afcfeec2)
2012-08-06 14:27:44 +01:00
Rico Tzschichholz
5c16ad65c5 build: add newly introduced header to fix make dist
Missing bit of 4bb6eff3dbd50d8fef7d6bdbed55c5aaa70036a8

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 1674cf28f1f5b71bd25a1f253c99825d427dd243)
2012-08-06 14:27:44 +01:00
Robert Bragg
010d16f647 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)
2012-08-06 14:27:42 +01:00
Chun-wei Fan
23becf67a7 Fix Visual C++ build
-Create a pre-defined cogl/cogl-gl-header.h(.win32) that is to be used on
 any Windows builds, and adapt the MSVC build process to set up and use
 that file.
-Fix up glib-mkenums code generation .bat file that is generated during
 "make"/"make dist", like the autotools-based builds.
-Since cogl/cogl-defines.h now contain versionioning info, and it no longer
 directly includes the GL headers, update the pre-configured
 cogl-defines.h[.win32|.win32_SDL] and use autotools to fill in the
 versioning info during "make"/"make dist".
-Fix up cogl/cogl-pango.rc.in so that they reflect the cogl-2.x versioning
 stuff correctly and versioning info can be filled in correctly during
 "make"/"make dist"

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 7ff42bb1c5280b0f53370f8d94ef5f10c9f39e2f)
2012-08-06 14:27:42 +01:00
Neil Roberts
b6b9ac0b85 Add a cogl-version header
This adds a version header which contains macros to define which
version of Cogl the application is being compiled against. This helps
applications that want to support multiple incompatible versions of
Cogl at compile time.

The macros are called COGL_VERSION_{MAJOR,MINOR,MICRO}. This does not
match Clutter which names them CLUTTER_{MAJOR,MINOR,MICRO}_VERSION but
I think the former is nicer and it at least matches Cairo and Pango.

The values of the macro are defined to COGL_VERSION_*_INTERNAL which
is generated by the configure script into cogl-defines.h.

There is also a macro for the entire version as a string called
COGL_VERSION_STRING.

The internal utility macros for encoding a 3 part version number into
a single integer have been moved into the new header so they can be
used publicly as a convenient way to check if the version is within a
particular range. There is also a COGL_VERSION_CHECK macro for the
very common case that a feature will be used since a particular
version of Cogl. There is a macro called COGL_VERSION which contains
the pre-encoded version of Cogl being compiled against for
convenience.

Unlike in Clutter this patch does not add any runtime version
identification mechanism.

A test case is also added which just contains static asserts to sanity
check the macros.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 3480cf140dc355fa87ab3fbcf0aeeb0124798a8f)
2012-08-06 14:27:40 +01:00
Robert Bragg
882ff5612b Adds a "magazine" allocator for chunks of fixed size
This adds a very minimal and fast allocator for chunks of memory of a
predetermined size. This has some similarities to the glib slice
allocator although notably it is not thread safe and instead of
internally tracking multiple magazines for various sized allocations the
api lets you explicitly allocate a single magazine for a single specific
size and a pointer to the magazine is passed explicitly to the allocate
and free functions.

This allocator builds on the CoglMemoryStack allocator as an underlying
heap allocator and just never rewinds the stack. This means the heap is
effectively a grow only linked list of malloc()'d blocks of memory.

A CoglMagazine tracks a singly linked list of chunks of a predetermined
size and _cogl_magazine_chunk_alloc() simply unlinks and returns the
head of the list. If the list is empty it falls back to allocating from
the underlying stack.

_cogl_magazine_chunk_free() links the chunk back into the singly linked
list for re-use.

The chunk size passed to _cogl_magazine_new() is automatically rounded
to a multiple of 8 bytes to ensure that all stack allocations end up
aligned to 8 bytes. This also ensures that when a chunk is freed then it
will be large enough to store a pointer to the next free chunk as part
of a singly linked list.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 17799c2f109a008d6cf767f501b81aa9b32bbda8)
2012-08-06 14:27:40 +01:00
Robert Bragg
97d5406aef Adds internal CoglMemoryStack utility API
This adds a very minimal internal allocator api that lets us create a
dynamically growable (grow only) stack.

Underlying the allocator is the idea of "sub stacks" which are simply
malloc()'d chunks of memory kept in a linked list. The stack itself
maintains a pointer to the current sub-stack and a current
sub-stack-offset. 99% of the time allocating from the stack is just a
case of returning a pointer to the current sub-stack + sub-stack-offset
and bumping the offset by the allocation size. If there isn't room in
the current sub-stack then we walk through the list of free sub-stacks
looking for one that's big enough for the allocation and if we reach the
end of the list then we allocate a new sub-stack twice as big as the
last (or twice as big as the requested allocation if that's bigger).

Since it's a stack model there is no api to free allocations, just a
function to rewind the stack to the beginning.

We expect this to be useful in multiple places in Cogl as an extremely
fast allocator in cases when we know we can scrap all the allocations
after we're done figuring something out or as a building block for
other allocators.

For example the tessellator used for CoglPath allocates lots of tiny
structures that can all be freed after tessellation.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6ee4a7a1b7f695bdfeb10ffa4112e776beea0a9d)
2012-08-06 14:27:40 +01:00
Robert Bragg
09642a83b5 Removes all remaining use of CoglHandle
Removing CoglHandle has been an on going goal for quite a long time now
and finally this patch removes the last remaining uses of the CoglHandle
type and the cogl_handle_ apis.

Since the big remaining users of CoglHandle were the cogl_program_ and
cogl_shader_ apis which have replaced with the CoglSnippets api this
patch removes both of these apis.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6ed3aaf4be21d605a1ed3176b3ea825933f85cf0)

  Since the original patch was done after removing deprecated API
  this back ported patch doesn't affect deprecated API and so
  actually this cherry-pick doesn't remove all remaining use of
  CoglHandle as it did for the master branch of Cogl.
2012-08-06 14:27:39 +01:00
Neil Roberts
6400b455b8 Don't include any GL header from the public GL headers
This splits the GL header inclusion from cogl-defines.h into a
separate headear called cogl-gl-header.h which we will only include
internally. That way we don't leak GL declarations out of our public
headers. The texture functions that were using GLenum and GLuint in
the public header have now changed to just use unsigned int. Note
however that if an EGL winsys is enabled then it will still publicly
include an EGL header. This is a bit more awkward to fix because we
have public API which returns an EGLDisplay and we can't determine
what type that is.

There is also a conformance test which just verifies that no GL header
has been included while compiling. The test isn't added to
test-conform-main because it doesn't actually test anything at
runtime.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit ef5680d3fda5df929dbd0b420c8f598ded58dfee)
2012-08-06 14:27:38 +01:00
Chun-wei Fan
fa88ed8d74 cogl/Makefile.am: Fix filters for MSVC projects
We need to filter out all the *-egl-* sources as well, as the original
filter did not filter out the Wayland EGL sources

(Sorry, I forgot to add the reviewed by line for the same patch in the
cogl-1.10 branch :P)

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 3d4cb887a28d3bc2cde9e4e7cdd20a71c34a2eaa)
2012-08-06 14:27:38 +01:00
Robert Bragg
9a1f1df83f Rework sdl integration api
This re-works the SDL integration api to simplify the integration for
application developers and also allow Cogl to know when the application
is about to go idle waiting for events so it can perform idle
book-keeping work.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-12 12:31:46 +01:00
Robert Bragg
bdb645e7f5 kms: defer setting crtc modes until first swap buffers
Instead of creating a dummy framebuffer allocation just so we can setup
crtc modes during display_setup we now wait until the first swap_buffers
request before setting up the crtc modes.

This patch also adds a cogl_kms_display_queue_modes_reset() function
that allows developers to explicitly queue a reset of the crtc modes.
The idea is that applications that handle VT switching can use this for
VT enter events to explicitly ensure their mode is restored since modes
are often not automatically restored correctly.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-11 15:44:58 +01:00
Neil Roberts
2037e0f4f1 Add a mechanism for determining GPU driver details
This adds a CoglGpuInfo struct to the CoglContext which contains some
enums describing the GL driver in use. This currently includes the
driver package (ie, is it Mesa) the version number of the package and
the vendor of the GPU (ie, is it by Intel). There is also a bitmask
which will contain the workarounds that we should do for that
particular driver configuration. The struct is initialised on context
creation by using a series of string comparisons on the strings
returned from glGetString.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-05 13:52:43 +01:00
Neil Roberts
c33ce5fc6b Use GL_ARB_sampler_objects
GL_ARB_sampler_objects provides a GL object which overrides the
sampler state part of a texture object with different values. The
sampler state that Cogl currently exposes is the wrap modes and
filters. Cogl exposes the state as part of the pipeline layer state
but without this extension GL only exposes it as part of the texture
object state. This means that it won't work to use a single texture
multiple times in one primitive with different sampler states. It also
makes switching between different sampler states with a single texture
not terribly efficient because it has to change the texture object
state every time.

This patch adds a cache for sampler states in a shared hash table
attached to the CoglContext. The entire set of parameters for the
sampler state is used as the key for the hash table. When a unique
state is encountered the sampler cache will create a new entry,
otherwise it will return a const pointer to an existing entry. That
means we can have a single pointer to represent any combination of
sampler state.

Pipeline layers now just store this single pointer rather than storing
all of the sampler state. The two separate state flags for wrap modes
and filters have now been combined into one. It should be faster to
compare the sampler state now because instead of comparing each value
it can just compare the pointers to the cached sampler entries. The
hash table of cached sampler states should only need to perform its
more expensive hash on the state when a property is changed on a
pipeline, not every time it is flushed.

When the sampler objects extension is available each cached sampler
state will also get a sampler object to represent it. The common code
to flush the GL state will now simply bind this object to a unit
instead of flushing the state though the CoglTexture when possible.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-05 13:47:36 +01:00
Neil Roberts
e7f1582630 Add a CoglPrimitiveTexture interface
This interface represents any textures that are backed by a single
texture in GL and that can be used directly with the
cogl_framebuffer_draw_attributes family of functions. This currently
equates to CoglTexture2D, CoglTexture3D and CoglTextureRectangle.

The interface currently has only one method called
cogl_primitive_set_auto_mipmap. This replaces the
COGL_TEXTURE_NO_AUTO_MIPMAP flag from the CoglTextureFlags parameter
in the constructors. None of the other flags in CoglTextureFlags make
sense for primitive textures so it doesn't seem like a good idea to
need them for primitive constructors.

There is a boolean in the vtable to mark whether a texture type is
primitive which the new cogl_is_primitive function uses. There is also
a new texture virtual called set_auto_mipmap which is only required to
be implemented for primitive textures.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-04 17:02:23 +01:00
Neil Roberts
60812e6a0e Add a vtable for the driver
Cogl already had a vtable for the texture driver. This ended up being
used for some things that are not strictly related to texturing such
as converting between pixel formats and GL enums. Some other functions
that are driver dependent such as updating the features were not
indirected through a vtable but instead switched directly by looking
at the ctx->driver enum value. This patch normalises to the two uses
by adding a separate vtable for driver functions not related to
texturing and moves the pixel format conversion functions to it from
the texture driver vtable. It also adds a context parameter to all of
the functions in the new driver vtable so that they won't have to rely
on the global context.
2012-03-23 13:51:08 +00:00
Robert Bragg
890a75ab06 Create standalone public wayland client/server headers
Because the wayland-client-protocol.h header defines symbols that
collide with the wayland-server-protocol.h header we allow applications
to explicitly ensure that they are only including one at a time by
exposing corresponding <cogl/cogl-wayland-client.h> and
<cogl/cogl-wayland-server.h> headers. This also adds a missing guard to
cogl-texture-2d.h that it isn't included directly.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-03-20 14:26:44 +00:00
Neil Roberts
361bd516f3 Add compatibility API for functions removed after 1.9.8
The cleanup in 185630085 removed some symbols that were previously
exported as public experimental API in Cogl 1.9.8. That release is
already well after the point where we were meant to freeze the ABI so
we probably shouldn't be breaking it again. This patch adds the
removed functions back in so that for 1.9.10 we won't have to bump the
soname. The symbols are bundled together in a new file called
cogl2-compatibility.c so that they will be easy to remove again after
we can break ABI. It is expected that we will revert this patch
immediately after branching for Cogl 1.10.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-09 16:09:13 +00:00
Neil Roberts
185630085c Add -Wmissing-declarations to maintainer flags and fix problems
This option to GCC makes it give a warning whenever a global function
is defined without a declaration. This should catch cases were we've
defined a function but forgot to put it in a header. In that case it
is either only used within one file so we should make it static or we
should declare it in a header.

The following changes where made to fix problems:

• Some functions were made static

• cogl-path.h (the one containing the 1.0 API) was split into two
  files, one defining the functions and one defining the enums so that
  cogl-path.c can include the enum and function declarations from the
  2.0 API as well as the function declarations from the 1.0 API.

• cogl2-clip-state has been removed. This only had one experimental
  function called cogl_clip_push_from_path but as this is unstable we
  might as well remove it favour of the equivalent cogl_framebuffer_*
  API.

• The GLX, SDL and WGL winsys's now have a private header to define
  their get_vtable function instead of directly declaring in the C
  file where it is called.

• All places that were calling COGL_OBJECT_DEFINE need to have the
  cogl_is_whatever function declared so these have been added either
  as a public function or in a private header.

• Some files that were not including the header containing their
  function declarations have been fixed to do so.

• Any unused error quark functions have been removed. If we later want
  them we should add them back one by one and add a declaration for
  them in a header.

• _cogl_is_framebuffer has been renamed to cogl_is_framebuffer and
  made a public function with a declaration in cogl-framebuffer.h

• Similarly for CoglOnscreen.

• cogl_vdraw_indexed_attributes is called
  cogl_framebuffer_vdraw_indexed_attributes in the header. The
  definition has been changed to match the header.

• cogl_index_buffer_allocate has been removed. This had no declaration
  and I'm not sure what it's supposed to do.

• CoglJournal has been changed to use the internal CoglObject macro so
  that it won't define an exported cogl_is_journal symbol.

• The _cogl_blah_pointer_from_handle functions have been removed.
  CoglHandle isn't used much anymore anyway and in the few places
  where it is used I think it's safe to just use the implicit cast
  from void* to the right type.

• The test-utils.h header for the conformance tests explicitly
  disables the -Wmissing-declaration option using a pragma because all
  of the tests declare their main function without a header. Any
  mistakes relating to missing declarations aren't really important
  for the tests.

• cogl_quaternion_init_from_quaternion and init_from_matrix have been
  given declarations in cogl-quaternion.h

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-06 18:45:44 +00:00
Robert Bragg
85dddf9932 build: list cogl-bitmap-packing.h as source file
This fixes make release-check because cogl-bitmap-packing.h wasn't being
packaged.
2012-03-05 23:25:30 +00:00
Neil Roberts
8ce5f5ade8 bitmap: Remove the split between 'image library' and 'fallback'
Previously the bitmap code was setup so that there could be an image
library used to convert between formats and then some 'fallback' code
when the image library can't handle the conversion. However there was
never any implementation of the conversion in the image library so the
fallback was always used. I don't think this split really makes sense
so this patch renames cogl-bitmap-fallback to cogl-bitmap-conversion
and removes the stub conversion functions in the image library.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-05 17:44:52 +00:00
Robert Bragg
ee940a3d0d Move all types/prototypes from cogl.h -> cogl[1]-context.h
So we can get to the point where cogl.h is merely an aggregation of
header includes for the 1.x api this moves all the function prototypes
and type definitions into a cogl-context.h and a new cogl1-context.h.

Ideally no code internally should ever need to include cogl.h as it just
represents the public facing header for accessing the 1.x api which
should only be used by Clutter.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:44 +00:00
Robert Bragg
9c58d6c4e7 Clean up cogl 1.x/2.0 header separation
The cogl_public_h variable in cogl/Makefile.am was a mixture of 1.x
headers and experimental headers which meant that glib-mkenums was
processing lots of experimental api headers. This patch lists
experimental api headers under the cogl_experimental_h variable instead.
This patch also ensures we undef the COGL_ENABLE_EXPERIMENTAL_* defines
when running the gobject introspection scanner for Cogl-1.0.gir

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:44 +00:00
Chun-wei Fan
9b87e8602c cogl/Makefile.am: Filter out SDL winsys for Visual C++ builds
Just being a bit paranoid here, as the SDL winsys sources are dealt in the
projects as they are not built for all configurations to avoid them
included more than once in the projects, which can cause trouble.

https://bugzilla.gnome.org/show_bug.cgi?id=669785

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-13 12:22:19 +00:00
Robert Bragg
1a638b6fd6 kms: Adds api to get at the kms file descriptor
This adds a cogl_kms_renderer_get_kms_fd() function that lets developers
access the kms file descriptor being used for controlling the kernel
mode setting.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-08 17:00:25 +00:00
Neil Roberts
85d79ab4fa Add a utility to make a GSource out of a CoglContext
The GSource is created using cogl_glib_source_new which takes a
pointer to a CoglContext. The source calls cogl_poll_get_info() in its
prepare function and cogl_poll_dispatch() in its dispatch
function. The poll FDs on the source are updated according to what
Cogl reports.

The header is only included and the source only compiled if Cogl is
configured with GLib support.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:40:59 +00:00
Neil Roberts
7497475295 Add support for main loop integration
This adds two new functions:

void
cogl_poll_get_info (CoglContext *context,
                    CoglPollFD **poll_fds,
                    int *n_poll_fds,
                    gint64 *timeout);

void
cogl_poll_dispatch (CoglContext *context,
                    const CoglPollFD *poll_fds,
                    int n_poll_fds);

The application is expected to call the first function whenever it is
about to block to go idle, and the second function whenever it comes
out of idle. This gives Cogl winsys's the ability poll file
descriptors for events. For example when handing swap complete
notifications, it can report that it needs to block on a file
descriptor.

The two functions are backed by winsys virtual functions. There are
currently no implementations. The default handler for get_info just
reports no file descriptors and an infinite timeout.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:40:10 +00:00
Robert Bragg
def67a39fe gl-prototypes: split up cogl-ext-functions.h
This splits up cogl-ext-functions.h in to sets of prototypes that
can be included separately so that we can include just core
gles1 or gles2 functions without any extensions.

Since eglGetProcAddress can not be used to query core client APIs
and some implementations (notably on Android) can return a garbage
pointer instead of NULL this will allow us to explicitly check
when to use eglGetProcAddress and when to use dlsym().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-04 19:27:20 +00:00
Chun-wei Fan
e215902110 Bug 666349: Dist files needed by MSVC for SDL winsys
Distribute the new VS2008/2010 project/solution files and the
pre-configured cogl-defines.h(.win32_SDL) needed for the build with MSVC.
2011-12-20 22:41:55 +08:00
Chun-wei Fan
330146557d Bug 664827: Autotools changes for Windows .rc files
This will make autotools fill in the versioning info for the COGL/
COGL-Pango .rc files and distribute the resulting .rc files
2011-12-15 20:31:31 +08:00
Neil Roberts
bdcbb8af4d Update the SDL winsys
The SDL winsys was missing a few minor features, such as the
implementation. This patch adds that in.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-14 16:45:17 +00:00
Neil Roberts
ff5bfc4a86 Rename the EGL_X11 winsys to EGL_XLIB
Eventually we might want to have an XCB-based EGL winsys. We already
have xlib-specific API in CoglRenderer (eg, to set a foreign display)
so the application needs to be able to specifically select between XCB
and XLIB.

This also removes the POWERVR part while renaming
COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT to
COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT because the winsys is equally
applicable to Mesa.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-14 16:40:26 +00:00
Neil Roberts
7f74712a79 Remove CoglXlibDisplay
CoglXlibDisplay just contained one member called dummy_xwin. This was
not shared outside of the respective winsys's so I don't think it
really makes sense to have a separate shared struct for it. It seems
more like an implementation detail that is specific to the winsys
because for example it may be that the EGL winsys could use the
surfaceless extension and not bother with a dummy window. This will
also make it easier to factor out the Xlib-specific data in
CoglDisplayEGL to the platform data.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-12 16:14:18 +00:00
Neil Roberts
dd75926c1a egl: Split out the KMS winsys as overrides of the EGL winsys
Instead of having #ifdefs to hook into the normal EGL winsys, the KMS
winsys now overrides any winsys functions that it wants. Where the
winsys wants to hook into a point within a function provided by the
EGL winsys there is a EGL-platform vtable which gets set on the EGL
renderer data during renderer_connect. The KMS-specific data on all of
the structures is now allocated separately by the KMS winsys and is
pointed to by a new 'platform' pointer in the EGL data.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-09 17:29:49 +00:00
Neil Roberts
a1e1527b69 Add a separate winsys vtable for each EGL platform
Instead of just having an "EGL" renderer, there is now a separate
winsys for each platform. Currently they just directly copy the vtable
for the EGL platform so it is still only possible to have one EGL
platform compiled into Cogl. However the intention is that the
winsys-specific code for each platform will be moved into override
functions in the corresponding platform winsys.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-08 17:38:25 +00:00
Chun-wei Fan
1e7f536c40 cogl/Makefile.am VS Support Update
Should be one %, not two (%%) for echoing...
2011-12-08 16:30:37 +08:00
Chun-wei Fan
7069825cb5 cogl/Makefile.am: VS support-Create a .bat to gen enums
Pre-generate a .bat file to be used to generate the cogl-enum-types.[ch]
for the build process.  This will greatly simplify the maintenace process
as the listing of headers to be parsed by glib-mkenums can be manifested
automatically during 'make dist', and this list changes quite a bit during
the development cycle.
2011-12-08 16:16:58 +08:00
Chun-wei Fan
9cff9236ca cogl/Makefile.am: Visual C++ support updates
Filter out the kms winsys sources... these aren't for Windows.
2011-12-08 12:51:05 +08:00
Neil Roberts
f005f517fe Flush matrices in the progend and flip with a vector
Previously flushing the matrices was performed as part of the
framebuffer state. When on GLES2 this matrix flushing is actually
diverted so that it only keeps a reference to the intended matrix
stack. This is necessary because on GLES2 there are no builtin
uniforms so it can't actually flush the matrices until the program for
the pipeline is generated. When the matrices are flushed it would
store the age of modifications on the matrix stack so that it could
detect when the matrix hasn't changed and avoid flushing it.

This patch changes it so that the pipeline is responsible for flushing
the matrices even when we are using the GL builtins. The same
mechanism for detecting unmodified matrix stacks is used in all
cases. There is a new CoglMatrixStackCache type which is used to store
a reference to the intended matrix stack along with its last flushed
age. There are now two of these attached to the CoglContext to track
the flushed state for the global matrix builtins and also two for each
glsl progend program state to track the flushed state for a
program. The framebuffer matrix flush now just updates the intended
matrix stacks without actually trying to flush.

When a vertex snippet is attached to the pipeline, the GLSL vertend
will now avoid using the projection matrix to flip the rendering. This
is necessary because any vertex snippet may cause the projection
matrix not to be used. Instead the flip is done as a forced final step
by multiplying cogl_position_out by a vec4 uniform. This uniform is
updated as part of the progend pre_paint depending on whether the
framebuffer is offscreen or not.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:06 +00:00
Neil Roberts
4cdf66f89b pipeline: Move the snippet source loop into a common function
The two loops that generate the functions for the snippets in the
fragend and vertend are very similar so to avoid code duplication this
patch moves the logic to its own function in a new
cogl-pipeline-snippet.c file.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:06 +00:00
Neil Roberts
f37738453e Add a CoglSnippet type
This adds a CoglObject called CoglSnippet which will be used to store
strings used as GLSL snippets to be attached at hook points to a
CoglPipeline. The snippets can currently contain three strings:

declarations - This will be placed in the global scope and is intended
               to be used to declare uniforms, attributes and
               functions.

pre           - This will be inserted before the hook point.

post          - This will be inserted after the hook point.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:05 +00:00
Rob Bradford
1b54c8023e kms: Add first version of "baremetal" backend for EGL on KMS
To start with this backend only supports creating a single CoglOnscreen
framebuffer and will automatically set is up to display fullscreen on
the first suitable crtc it can find.

To compile this backend - get some dribbly black candles, sacrifice a
goat and configure with: --enable-kms-egl-platform

Note: There is currently a problem with using GLES2 with this winsys
so you need to run with EGL_DRIVER=gl
Note: If you have problems with mesa crashing in XCB during
eglInitialize then you may need to explicitly run with EGL_PLATFORM=gbm

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-28 17:37:28 +00:00
Chun-wei Fan
2055f6ba91 VS 2008/2010 project files to build Cogl
These are the VS 2008/2010 project files to build Cogl, with a README.txt
to explain the process involved.

Note that the Cogl and Cogl-Pango projects (and filters for VS2010) are
expanded with the correct source file listings during "make dist", which
is done to simplify maintenance of these project files.

-added preconfigured config.h(.win32.in), which is expanded with the
 correct versioining info during autogen
-added preconfigued cogl/cogl-defines.h.win32
-added symbols files for cogl and cogl-pango
-Have configure.ac expand the config.h.win32.in into config.h.win32
 with the correct versioning info, etc, and to include the Visual C++
 project files for distribution
-Added rules in cogl/Makefile.am to expand the cogl VS 2008/2010 projects
 and filters from the templates with up-to-date source file listings, to
 distribute cogl-enum-types.c, cogl-enum-types.h to ease compilation and
 to avoid depending on PERL on Windows installations.
-Added rules in cogl-pango/Makefile.am to expand the cogl-pango VS2008/
 2010 projects and filters from the templates with up-to-date source file
 listings.
-Added/edited various Makefile.am's in build to distribute the VS2008/2010
 project files and associated items required for the build.
-Update .gitignore. There needs to be a pre-configured
 config.h(.win32) and its template, config.h.win32.in for Visual C++
 builds

https://bugzilla.gnome.org/show_bug.cgi?id=650020

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-25 13:12:45 +00:00
Neil Roberts
256f5791fd cogl-program: Move the code for CoglBoxedValue to its own file
The code for manipulating CoglBoxedValues is now separated from
cogl-program.c into its own file. That way when we add support for
setting uniform values on a CoglPipeline the code for storing the
values can be shared.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-16 16:32:10 +00:00
Rico Tzschichholz
567661ccf3 build: add missing header to fix make dist 2011-11-02 07:34:26 -04:00