Commit Graph

1523 Commits

Author SHA1 Message Date
Damien Lespiau
024a143cb8 stb_image: Fix warnings that the original stb_image has
Clean compiler output is a must! that also means imported source code
from other projects. I can't be bothered to submit a patch upstream,
because last time it was totally ignored by the stb_image guy.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit b43b1eac77e2f13d126e2211e12dc0c6d152716e)
2013-01-18 17:28:25 +00:00
Damien Lespiau
24fa64bea2 core: Don't use g_once_*() API
As Cogl is not thread safe, we don't really need a thread safe
cogl_init() function.

This also reduces the amount of dependency cogl has on glib, handy when
we want to create a standalone version of cogl, some day.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 429e49e3028a425eb198d8969dfbf57790e2e72a)
2013-01-18 17:28:25 +00:00
Damien Lespiau
c9fe28c93b renderer: Remove unused error from CoglRendererError
This type is not documented and is experimental. We don't use
COGL_RENDERER_ERROR_NOT_FOUND and it's pretty vague anyway, just remove
it.

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

(cherry picked from commit ffa78534616547b9bd4cd5c0ade8fdc039a2b977)
2013-01-18 17:28:25 +00:00
Damien Lespiau
ab91bdf12b build: Remove spurious Makefile.am
These days cogl/ has a non-recursive Makefile.am and an old one was
still present in cogl/driver.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit e1db8e38be72f5372e9d7571a3faec5039e0e6d0)
2013-01-18 17:28:25 +00:00
Robert Bragg
1161870670 matrix: Add cogl_debug_matrix_print api
As a convenience for debugging this adds a cogl_debug_matrix_print
function that prints out the components of a matrix and any internal
flags associated with the given matrix.

(cherry picked from commit 3b33889ff1204f19347a9548320ba95baa54c18c)
2013-01-18 17:28:25 +00:00
Robert Bragg
0ffad6ba20 texture-rectangle: Make new_from_foreign api public
This adds a new public cogl_texture_rectangle_new_from_foreign()
function so that we can look at removing the generic
cogl_texture_new_from_foreign().

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

(cherry picked from commit af02792b336bb492c5bd11afc34a5dcd417503f6)
2013-01-18 17:28:19 +00:00
Robert Bragg
13f228fe69 Remove all remaining _EXP suffix defines
To delimit which symbols were considered experimental we used to use
some preprocessor defines to gives experimental symbols an _EXP suffix
so that anyone monitoring the ABI for changes would easily be able to
discount changes made to clearly experimental functions.

These days we simply rely on the gtk-doc "Stability: unstable"
annotation to serve this purpose because changing the actual symbol name
made it slightly more awkward to debug Cogl using GDB and was an extra
mechanical step we decided we could do without.

This patch removes the last remaining _EXP suffix defines in Cogl

(cherry picked from commit 5a1c4a979e00accd492097cfb8f6a8d0fd8331bc)
2013-01-18 10:53:29 +00:00
Robert Bragg
ce5d06afe1 framebuffer: split GL code out from cogl-framebuffer.c
This splits out most of the OpenGL specific code from cogl-framebuffer.c
into cogl-framebuffer-gl.c and extends the CoglDriverVtable interface
for cogl-framebuffer.c to use.

There are hopes to support several different backends for Cogl
eventually to hopefully get us closer to the metal so this makes some
progress in organizing which parts of Cogl are OpenGL specific so these
parts can potentially be switched out later.

The only remaining use of OpenGL still in cogl-framebuffer.c is to
handle cogl_framebuffer_read_pixels.
2013-01-18 10:53:29 +00:00
Damien Lespiau
87bc616d34 framebuffer: Support texture based depth buffers
This commit introduces some new framebuffer api to be able to
enable texture based depth buffers for a framebuffer (currently
only supported for offscreen framebuffers) and once allocated
to be able to retrieve the depth buffer as a texture for further
usage, say, to implement shadow mapping.

The API works as follow:
  * Before the framebuffer is allocated, you can request that a depth
    texture is created with
    cogl_framebuffer_set_depth_texture_enabled()
  * cogl_framebuffer_get_depth_texture() can then be used to grab a
    CoglTexture once the framebuffer has been allocated.
2013-01-18 10:53:29 +00:00
Tomeu Vizoso
5bce5f88d9 Use the correct type for GLintptr
On 32bit, intptr_t has a different type than khronos_intptr_t.

https://bugzilla.gnome.org/show_bug.cgi?id=691296
(cherry picked from commit a77222385812a696a999a871cde439f50b648f69)
2013-01-08 14:56:25 +01:00
Neil Roberts
f1baa4d60f Clear the scissor before calling glBlitFramebuffer in swap_region
glBlitFramebuffer is affected by the scissor so we need to ensure
there is an empty clip flushed before using it. This is similar to
what is done in _cogl_blit_framebuffer().

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Tested-by: Aaron Plattner <aplattner@nvidia.com>

(cherry picked from commit 65da3f88af9c7b8d72758d116c2652aff68195c1)
2013-01-07 16:37:29 +00:00
Damien Lespiau
70f71e2627 doc: Generate a valid cogl-context.xml
The automagic paragraph support of gtk-doc is way too simple to support
things like multi-paragraphs <note>s. Let's trick gtk-doc and make it
generate a valid docbook snippet for cogl-context.

Without this, cogl-context remains absent of the reference
documentation, how sad is this?!

(cherry picked from commit 606b472d91450e3221da6631020f534892e866a9)
2013-01-04 17:02:02 +00:00
Adam Jackson
f326401094 opengl: Fix conditional call of BlendFuncSeparate
Checking whether src_rgb != src_alpha twice is pointless; not checking
whether dst_rgb != dst_alpha is clearly wrong.

Found by Coverity.

Signed-off-by: Adam Jackson <ajax@redhat.com>

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

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

(cherry picked from commit fc292c25db3004543e277d92693ab9cb388d2121)
2012-12-07 15:52:51 +00:00
Chun-wei Fan
491618a74c cogl-gles2-context: Cast func pointers to void* when filling
vtable

(Sorry, I had to re-apply Neil's patch as the original one somehow did
 not apply)

The function prototypes for the GL functions in CoglContext have the
GLAPIENTRY attribute which on Windows makes them use the stdcall
calling convention. The function pointers exposed from cogl-gles2.h
don't have GLAPIENTRY so they end up having a different calling
convention on Windows. When Cogl is compiled there it ends up giving a
lot of warnings because it assigns a pointer to an incompatible
function type.

We probably don't want to make the functions exposed in cogl-gles2.h
use the stdcall calling convention because we control that API so
there is no need to introduce a second calling convention. The GLES2
context support currently isn't going to work on Windows anyway
because there is no EGL or GLES2 implementation.

Eventually if we make the Cogl GLES2 context virtualized on top of
Cogl then we will provide our own implementations of all these
functions so we can easily keep the C calling convention even on
Windows.

Until then to avoid the warnings on Windows we can just cast the
function pointers temporarily to (void*) when filling in the vtable.

This will also fix the build on Windows using Visual Studio, as it is
more picky on calling convention mismatches.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-11-24 00:18:29 +08:00
Chun-wei Fan
fefa6bc929 cogl.symbols: Add symbols required for Clutter 1.12
Those symbols were missed and are needed for Clutter-1.12.x to build.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-11-24 00:01:40 +08:00
Neil Roberts
6a62e3077b sdl: Don't set SDL_GL_DOUBLEBUFFER when the swap chain has no pref
The ‘length’ for the swap chain is initially -1 which is supposed to
mean ‘no preference’. However, both of the SDL winsys's were
explicitly setting the SDL_GL_DOUBLEBUFFER attribute to zero in that
case which would try to disable double buffering.

On OS X, the equivalent to eglSwapBuffers (ie, [NSOpenGLContext
flushBuffer]) does nothing for a single buffer context. The
cogl-sdl-hello example does not specify the swap chain length so
presumably it would end up with a single buffer config. When
cogl_onscreen_swap_buffers is called it therefore does nothing and
nothing is painted.

I guess to make single-buffered contexts actually useful we should
expose some public equivalent to glFlush so that you can ensure the
rendering commands will actually hit the buffer. Alternatively we
could document that cogl_onscreen_swap_buffers performs this task on
single-buffered configs and then we could make the SDL winsys
explicitly call glFlush in that case.

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

(cherry picked from commit 71e57f99002d5dee79bbd44b3bc57712b99acb55)
2012-11-23 15:45:26 +00:00
Rob Bradford
0e33654efb wayland: Port to new Wayland protocol
Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit db50c3015c589375029a4c26c58db8295bb17bca)
2012-10-18 17:25:21 +01:00
Neil Roberts
0edb848850 Use the right context when pushing the GLES2 context to an onscreen
Previously when pushing the GLES2 context with an onscreen framebuffer
it would just call bind_onscreen. This actually binds it with Cogl's
context so presumably the context isolation wasn't working properly.
This patch splits out bind_onscreen to have a second function called
bind_onscreen_with_context that explicitly takes the EGL context to
use. Cogl now uses this when pushing the GLES2 context.

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

(cherry picked from commit 3653c5b10058a3f79900eb2644cb30f4cf1ca47e)
2012-10-01 15:05:22 +01:00
Neil Roberts
5e730568d4 Remove an out of date comment in the GLES2 context code
There was a FIXME comment about making glCopyTex{Sub,}Image2D work
with CoglOffscreen buffers. This has already been fixed so we should
remove the comment.

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

(cherry picked from commit 750e5668ee64a315c8090dd2223334b1e04bee54)
2012-10-01 15:05:16 +01:00
Neil Roberts
07a50012b9 egl: Only allow GLES2 context creation for the GLES2 driver
Previously, Cogl was advertising the GLES2 context feature whenever
the EGL winsys was used, even if the winsys was used with the GL
driver. This wasn't working because when the GL context is created the
API is set to GL with eglBindAPI and it is never changed back to GLES
when the GLES2 context is created. That meant that the created context
is actually GL not GLES2. Any rendering would then fail because the GL
context does not understand the precision statement.

It could be possible to fix it so that it will set the API correctly
before creating the context. It would then also need to reset the API
and unbind the previous context whenever switching between GLES2 and
GL contexts. If the context isn't unbound first then eglMakeCurrent
will actually try to bind both contexts at the same time and at least
Mesa detects this situation and reports that the two contexts
conflict. Presumably we would also need to do something more clever
when we retrieve the function pointers for the GLES2 context.
Currently we just copy them from the CoglContext but if the context is
using the GL driver then this would mean the functions came from libGL
not libGLESv2.

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

(cherry picked from commit 624dea207cf76ae9ccd7f57c4ebd15d3bd65bff0)
2012-10-01 15:05:11 +01:00
Neil Roberts
9563799655 Fix the terminator in one of the extension lists
The list of extension names in COGL_EXT_BEGIN should be a zero
separated list of strings which is terminated by an empty string. The
name for the GL_ARB_shader_objects extension was missing the zero
separator so presumably it was relying on the following byte to happen
to be a zero in order not to crash.

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

(cherry picked from commit f63381f23fa8b0b17e030561940b8a38efff221f)
2012-09-28 17:15:11 +01:00
Neil Roberts
f9e7f8df94 winsys-glx: Remove the vblank counter feature when indirect rendering
Previously when Cogl detects that the GLX context is indirect it
resets the function pointers for the VBLANK_COUNTER feature to NULL.
However it wasn't removing the VBLANK_COUNTER feature flag. Some other
parts of the winsys check for that feature flag rather than checking
whether the pointer is NULL so it would end up calling an invalid
function pointer and crashing. This just fixes it to also clear the
feature flag.

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

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

(cherry picked from commit e947c713a541086f80a308d22774229f0720196a)
2012-09-28 17:15:11 +01:00
Chun-wei Fan
b743d95e21 Bug 682071-cogl/cogl-sdl.h: MSVC: Link to SDL when apps are built
Link to SDL.lib and SDLmain.lib if Cogl was built with the SDL winsys.

Recent changes to the SDL winsys introduced a direct dependency to
SDLmain.lib (and hence SDL.lib) when programs are built, causing linker
errors to appear when any programs using cogl (with the SDL winsys built
in) are built.

Since we cannot determine whether a Cogl build is built with the SDL winsys
at build time easily, we could use #pragma comment (lib, ...) whenever
cogl-sdl.h is included by cogl.h so that SDLmain.lib and SDL.lib is linked
into the resulting binary, so that the program can link and run correctly.

This does not add any external dependencies as the Cogl DLL already depends
on SDL.dll when it is built with the SDL winsys.
2012-09-19 15:33:47 +08:00
Neil Roberts
1b3a7ac0ab gles2-context: Don't split the wrapper snippet into two
We don't need to split the wrapper snippet into two separate parts
because it should be ok to declare the flip uniform in the middle of
the shader as long as it is somewhere in the global scope. Therefore
we can just declare it right before the definition for the replacement
main function. This is important because we don't want to put anything
at the top of the application's shader in case it is using a
'#version' directive. In that case moving it to anything other than
the first line would break things.

This patch also adds a marker in a comment around the wrapper snippet
so that we can easily locate the snippet when glGetShaderSource is
called and remove it.

The wrapper for glGetAttachedShaders has been removed because there
are no longer any additional shaders attached to the program so we can
just let GL handle it directly.

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

(cherry picked from commit dbd92e24ae61dcbe7ef26f61c9117c5516a7fa87)
2012-09-17 23:06:21 +01:00
Robert Bragg
5f3768f086 gles2-context: only insert prelude + wrapper into strv once
In our wrapper for glShaderSource we special case when a vertex shader
is being specified so we can sneak in a wrapper for the main function to
potentially flip all rendering upside down for better integration with
Cogl.

Previously we were appending the wrapper to all the sub-strings passed
via the vector of strings to glShaderSource but we now grow the vector
instead and insert the prelude and wrapper strings into the beginning
and end of the vector respectively so we should only have one copy for a
single shader.

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

(cherry picked from commit d2904d518718e3fbf4441abe2c2bcfd63edfd64b)
2012-09-17 23:06:21 +01:00
Daniel Stone
a491789637 cogl-gles2-context: Append wrapper shader to user shaders
The SGX GLSL compiler refuses to accept shaders of the form:
    void foo();
    void bar() {
        foo();
    }
where foo is undefined at glShaderSource() time, left for definition at
link time.  To work around this, simply append the wrapper shader to
user shaders, rather than building a separate shader that's always
linked with user shaders.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 96f02c445f763ace088be71dc32b3374b2cdbab2)
2012-09-17 23:06:21 +01:00
Robert Bragg
50ba5fa130 gpu-info: Match latest Mesa strings
Mesa now reports a vendor string of "Mesa Project" instead of "VMWare,
Inc." and the software rasterizer renderer string is now "Software
Rasterizer". This update cogl-gpu-info.c to recognize these new strings.

Thanks to Alexander Larsson for the original patch.

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

(cherry picked from commit dfacbbd96f3fbadaffa4a76dfd71c47ece6ed6a3)
2012-09-17 23:06:20 +01:00
Robert Bragg
0f0ee4a909 texture: Add a context pointer to each texture
As part of our on-going goal to remove our dependence on a global Cogl
context this patch adds a pointer to the context to each CoglTexture
so that the various texture apis no longer need to use
_COGL_GET_CONTEXT.

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

(cherry picked from commit 83131072eea395f18ab0525ea2446f443a6033b1)
2012-09-17 23:06:20 +01:00
Robert Bragg
ea3d8eca91 Don't take internal references on the context
We want applications to fully control the lifetime of a CoglContext
without having to worry that internal resources (such as the default
2d,3d and rectangle textures, or any caches we maintain) could result in
circular references that keep the context alive. We also want to avoid
making CoglContext into a special kind of object that isn't ref-counted
or that can't be used with object apis such as
cogl_object_set_user_data. Being able to reliably destroy the context is
important on platforms such as Android where you may be required
bring-up and tear-down a CoglContext numerous times throughout the
applications lifetime. A dissadvantage of this policy is that it is now
possible to leave other object such as framebuffers in an inconsistent
state if the context is unreferenced and destroyed. The documentation
states that all objects that directly or indirectly depend on a context
that has been destroyed will be left in an inconsistent state and must
not be accessed thereafter. Applications (such as Android applications)
that need to cleanly destroy and re-create Cogl resources should make
sure to manually unref these dependant objects before destroying the
context.

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

(cherry picked from commit 23ce51beba1bb739a224e47614a59327dfbb65af)
2012-09-17 23:06:20 +01:00
Robert Bragg
2942fd362d Avoid referencing file scope context in _context_new()
cogl_context_new() had a mixture of references to the file scope context
variable (_context) and the local (context) variable. This renames the
file scope variable to _cogl_context to catch unnecessary references to
the old name and fixes the code accordingly to reference the local
variable instead.

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

(cherry picked from commit 33a9397ee1ae1729200be2e5084cf43cebb64289)
2012-09-17 23:06:20 +01:00
Robert Bragg
66169276f4 texture-2d: improve new_from_foreign error handling
There were lots of places where cogl_texture_2d_new_from_foreign would
simply return NULL without returning a corresponding error. We now
return an error wherever we are returning NULL except in cases where the
user provided invalid data.

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

(cherry picked from commit a1efc9405a13ac8aaf692c5f631a3b8f95d2f259)
2012-09-17 23:06:20 +01:00
Robert Bragg
7b5b0bef83 framebuffer: drop _ALLOCATE_FLAG_DEPTH24_STENCIL8
There are two extensions, GL_OES_packed_depth_stencil and
GL_EXT_packed_depth_stencil, that inform us that the hardware supports
packing the depth and stencil values together into one format.

The OES extension is the GLES equivalent of the EXT extension and the
two extensions provide the same enums with basically the same semantics,
except that the EXT extension is a lot more wordy due to a larger number
of features in the full OpenGL api and the OES extension has some
asymmetric limitations on when the GL_DEPTH_STENCIL and
GL_DEPTH24_STENCIL8 enums can be used as internal formats.

GL_OES_packed_depth_stencil doesn't allow the GL_DEPTH_STENCIL enum
to be passed to glRenderbufferStorage (GL_DEPTH24_STENCIL8 should be
used instead) and GL_OES_packed_depth_stencil doesn't allow
GL_DEPTH24_STENCIL8 to be passed as an internal format to glTexImage2D.

We had been handling the two extensions differently in Cogl by calling
try_creating_fbo with different flags depending on whether the OES or
EXT extension was available and passing GL_DEPTH_STENCIL to
glRenderbufferStorage when we have the EXT extension or
GL_DEPTH24_STENCIL8 with the OES extension.

To localize the code that deals with the differences between the
extensions this patch does away with the need for separate flags
so we now just have COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_DEPTH_STENCIL and
right before calling glRenderbufferStorage we check which extension we
are using to decide whether to use the GL_DEPTH_STENCIL or
GL_DEPTH24_STENCIL8 enums.

(cherry picked from commit 88a05fac6609f88c0f46d9df2611d9fbaf159939)
2012-09-17 23:06:19 +01:00
Alban Browaeys
8d09b93572 meta-texture: Fix textures[] index
textures[iter_y.index * n_y_spans + iter_x.index]
only works for vertical rectangles when n_x_spans > 0 (ie x != {0} )

is also wrong for horizontal rectangles ( x = {0, 1, 2, 3} , y = {0, 1}
-> second line will start at 2 = iter_y.index * n_y_spans + iter_x.index
-> iteration are 0, 1, 2, 3, \n 2, 3, 4, 5 instead of 0, 1, 2, 3 \n 4, 5, 6, 7

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

(cherry picked from commit bf0d187f1b5423b9ce1281aab1333fa2dfb9863f)
2012-09-17 11:47:04 +01:00
Neil Roberts
cb834c95e9 pipeline: Fix the layer index used when pruning layers
When pruning a pipeline to a set number of layers it records the index
of the first layer after the given number of layers have been found.
This is stored in a variable called 'first_index_to_prune' implying
that this layer should be included in the layers to be pruned. However
the subsequent if-statement was only pruning layers with an index
greater than the recorded index so it would presumably only prune the
following layers. This patch fixes it to use '>=' instead.

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

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

(cherry picked from commit d3063e8dea92a8f668acef6435cc68e0c901dc8d)
2012-09-07 11:44:41 +01:00
Neil Roberts
a18c97798f pipeline: Ensure the pipeline layer cache is freed when pruning layers
When pruning layers from a pipeline the pipeline cache would once be
freed due to the call to pre_change_notify but it would immediately be
recreated again when foreach_layer_internal is called. When n_layers
is later set to 0 it would end up with an invalid cache lying around.
This patch changes the order so that it will iterate the layers first
before triggering the pre-change notify so that the cache will be
cleared correctly.

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

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

(cherry picked from commit 1c8efdc838cc5ace380365cb54e0741645856edf)
2012-09-07 11:44:41 +01:00
Neil Roberts
27d74f09df kms: Fix the version check for GBM
The check for whether to use ‘stride’ instead of ‘pitch’ from the GBM
API tries to check whether the GBM version is >= 8.1.0. However it was
comparing the major and micro components independently so any version
with the minor part set to 0 would fail. The GBM version in Mesa
master is now 9.0.0 which breaks it. This patch changes it to check
the version using the COGL_VERSION_ENCODE macro instead.

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

(cherry picked from commit 38f1dc58b35023f9e6bbc0db746b1554bd0377fc)
2012-09-06 18:30:30 +01:00
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
Robert Bragg
ac72d0685c profile: Print warning if "Mainloop" timer missing
As a helpful aid Cogl will now print a warning if no "Mainloop" UProf
timer was setup by the application that explains that either Clutter
should be built with --enable-profile or if Clutter isn't being used
then it shows how it can create its own Mainloop timer.

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

(cherry picked from commit 3d052dbca86bf36f30b2d60ff59b967d14665436)
2012-09-03 15:51:45 +01:00
Robert Bragg
85efcfac2a journal: Add a uprof timer around the _flush() discard
This adds a uprof timer around the _cogl_journal_discard() at the end of
_cogl_journal_flush() since this sometimes takes a significant
proportion of the time to flush the journal.

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

(cherry picked from commit 14ffc3a197100be814452af2d0f839970353b04d)
2012-09-03 15:51:45 +01:00
Robert Bragg
c477e9ce49 debug: define COGL_DEBUG_ macros for non-debug builds
Since we only want to disable the debug features that may impact
performance when building with --disable-debug this ensures that the
COGL_DEBUG_ macros aren't defined as NOPs for non-debug builds.

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

(cherry picked from commit c4b50040b5c033e370eb721d1d217eced8ebdaad)
2012-09-03 15:51:45 +01:00
Robert Bragg
fb22383993 pipeline: make _GET_LAYER_NO_CREATE enum a flag
_cogl_pipeline_get_layer_with_flags accepts a CoglPipelineGetLayerFlags
flags argument and understands one COGL_PIPELINE_GET_LAYER_NO_CREATE
flag. There was a mistake with the definition of this enum though so
COGL_PIPELINE_GET_LAYER_NO_CREATE had a value of 0 and so testing for
the flag using the bitwise & operator would never find the flag set.

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

(cherry picked from commit 5923f92f1428b3eb4977b5f21723f1b19a9d284a)
2012-09-03 15:51:45 +01:00
Robert Bragg
71f20064ab debug: ignore wireframe debug drawing for line primitives
If a primitive is already line based then we don't need to do anything
special to draw it in wireframe mode.

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

(cherry picked from commit fb575a42c308739a7185311a613b1a5f49dbfb39)
2012-09-03 15:51:44 +01:00
Robert Bragg
971b5cfae1 primitive: Don't leak indices
If a CoglPrimitive is associated with a set of indices then we must
unref those indices when freeing the primitive to avoid a leak.

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

(cherry picked from commit 45cac786b55c953e44f98b864add952b9e398b13)
2012-09-03 15:51:44 +01:00
Robert Bragg
74d749eca4 kms: Update to latest gbm api
gbm_bo_get_pitch was renamed to gbm_bo_get_stride to be consistent with
how the terms pitch and stride are used throughout mesa. This updates
the Cogl backend to use the new gbm_bo_get_stride name.

For compatibility with previous version of libgbm we now explicitly
check the version of libgbm in configure.ac and expose
COGL_GBM_{MAJOR,MINOR,MICRO} defines to the code so we can conditionally
use the older gbm_bo_get_pitch() name with older versions.

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

(cherry picked from commit 47c6247095e2f1f8725c4eb08d38c9de15e283cd)
2012-09-03 15:51:44 +01:00
Neil Roberts
ef73e6e3b9 cogl-version: Fix the 'since' tags in the documentation
The COGL_VERSION_* macros will also be in Cogl 1.12.0.

(cherry picked from commit e9473b58b80a06d3be34a4b518aade190ed9b666)
2012-09-03 15:48:05 +01:00
Neil Roberts
f13f6b9175 cogl-version: Fix the version number
The version number macros were using the @COGL_VERSION_*@
substitutions. These are always defined to 2.0.0 in the 1.x releases
so we need to use the Cogl @COGL_1_VERSION_*@ substitutions instead to
get the real version number.
2012-09-03 15:47:56 +01:00
Neil Roberts
b3f56ccb48 tex-driver-gles: Fix subregion uploads without GL_EXT_unpack_subimage
When the GL_EXT_unpack_subimage extension is not available and a
subregion of a texture is uploaded then it should first copy the
subregion to a newly allocated bitmap. However it was then later still
trying to prepare the upload using the original src_x and src_y values
which would cause an assertion failure. This patch fixes it to just
reset those to zero if the subregion is first copied.

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

(cherry picked from commit 6f9a62db6f846f1d76e3ca16d9d8cdadf82a7009)
2012-08-29 15:01:31 +01:00
Chun-wei Fan
55e4394780 Update/fix cogl.symbols for 1.12
Update the cogl.symbols file for the 1.12 series, where symbols
were added for the following commits:

010d16f6: Adds initial GLES2 integration support
6eb88648: Add a cogl_matrix_init_from_euler function
5e8ff248: Add functions to directly transform from a euler or a quaternion
1686e754: bitmap: Adds cogl_android_bitmap_new_from_asset()
df515741: onscreen: Adds support for resizable windows
e347135b: Move cogl_wayland_display_ proto to cogl-wayland-server.h

Plus, when we branched out for 1.12, some needed symbols were missing, so
we would need to make up for them, in particular those in cogl-shader.h
and cogl-path-functions.h.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-08-17 01:20:13 +08: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