Commit Graph

2602 Commits

Author SHA1 Message Date
Robert Bragg
de3e4b1560 build: remove duplicate cogl_info_SOURCES/LDADD lines
examples/Makefile.am had duplicate lines for defining the _SOURCES
and _LDADD files. This removes the lines within the USE_GLIB guards.
2012-09-03 15:55:14 +01:00
Aurimas Černius
308c424075 Updated Lithuanian translation
(cherry picked from commit b913509db70b0ca1ed1e633a4c0e5e0d82d2bd34)
2012-09-03 15:51:46 +01:00
Nilamdyuti Goswami
a388ae4b1c Implemented FUEL entries to Assamese translation
(cherry picked from commit fe69077dd82f4620816394692d8af087f0b6f1fe)
2012-09-03 15:51:46 +01:00
Andika Triwidada
53f6e1c35b Updated Indonesian translation
(cherry picked from commit 9a9de6c7f039eaf9f804b71255fe79505711511b)
2012-09-03 15:51:46 +01:00
Duarte Loreto
22cedf4b18 Updated Portuguese translation
(cherry picked from commit fe931f0783461a3dbd99f15d36738d0f0c2d4689)
2012-09-03 15:51:46 +01:00
Krishnababu Krothapalli
17369ef0ff Updated Telugu Translations
(cherry picked from commit 393dc07ba714155cadd5611d44d0f0368e470818)
2012-09-03 15:51:46 +01:00
A S Alam
0a5ff72186 Update Punjabi Translation
(cherry picked from commit 724a0a1e3167c137b7a8a2f31ea2efb55036617b)
2012-09-03 15:51:46 +01:00
Fran Diéguez
9212a87df8 Updated Galician translations
(cherry picked from commit ac01741cd7c07d315837e338e14776698dc72bc1)
2012-09-03 15:51:46 +01:00
Tom Tryfonidis
f48e0c0e30 Updated Greek translation
(cherry picked from commit 008028b4654a0e7f6537bde31128dde64e42086e)
2012-09-03 15:51:45 +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
69c6d50774 test-journal: Setup a UProf Mainloop timer
So that we can show a UProf profile when running test-journal the test
now declares a static "Mainloop" timer which it starts/stops around the
GLib mainloop it runs.

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

(cherry picked from commit 66b3d23c201b2e7dd74602e6e6e6c2d8ead47bcd)
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
Piotr Drąg
45f4175476 Updated Polish translation 2012-08-29 18:42:48 +02:00
Piotr Drąg
13ea51b6cc Updated Polish translation 2012-08-29 18:40:23 +02: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
Patrick Welche
4589c6f158 test(1) uses '=' to test if strings are identical
https://bugzilla.gnome.org/show_bug.cgi?id=682340

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

(cherry picked from commit 5cd15e7781466307a27c31e6e3f1e7f5ade5cfee)
2012-08-28 11:28:23 +01:00
Chun-wei Fan
615e319384 cogl-crate.vcproj: Don't link to SDL for non-SDL x64 builds
The x64 Release (non-SDL) build was linking to SDL.
Remove that dependency.
2012-08-17 10:01:57 +08: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
Chun-wei Fan
e6bd6128a2 Fix cogl.vcproj
x64 release builds with the SDL winsys need to link to the SDL libraries as
well, which was missed.  Make up for that.
2012-08-17 00:04:32 +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
8dc035d8b3 cogl-gles2: Require cogl-1.0
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-08-15 18:18:53 +01:00
Robert Bragg
002671bd3e Post-release version bump to 1.11.3 2012-08-15 17:56:30 +01:00
Robert Bragg
bc305b1150 Release 1.11.2 (snapshot) 2012-08-15 17:32:22 +01:00
Robert Bragg
6741f70d2e Updates NEWS for the 1.11.2 release 2012-08-15 17:32:15 +01:00
Neil Roberts
32fbd0ada6 kms: Use a dummy surface instead of the surfaceless extension
The surfaceless extension that Mesa advertises has been renamed to
EGL_KHR_surfaceless_context instead of a separate extension for the
GLES, GLES2 and GL APIs and the new extension has been ratified by
Khronos. Therefore the KMS backend no longer runs against Mesa master.
We could just rename the extension we check for, however Weston (the
sample Wayland compositor) has switched to just creating a dummy GBM
surface and not using the surfaceless extension at all. We should
probably do the same thing.

Using the surfaceless extension could be a good idea but we don't
really need to rely on it for KMS and we would want to do it for all
EGL backends, not just the KMS backend.

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

(cherry picked from commit d4f22f8cb013d417c99ba03924538924191c2fe6)
2012-08-15 17:29:16 +01:00
Neil Roberts
51d94769be framebuffer: Take const pointers for the matrix setters
cogl_framebuffer_set_{projection,modelview}_matrix don't need to read
from the matrix argument so they should probably take a const pointer.

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

(cherry picked from commit 710d6af053aca97935b54f9ff68858ef51f4482b)
2012-08-15 17:29:16 +01:00
Antoine Jacoutot
601abeadca build: remove unneeded check for libdrm
Since fallback for vblank wait via manual drm ioctl was removed in
commit 3bc70687ac there is no need to
check for libdrm anymore.

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

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

(cherry picked from commit b84047a578b7746e421cd553e781788925cff90f)
2012-08-15 17:29:16 +01:00
Neil Roberts
41539dd7f0 bitmap: Use the 'copy' blend mode when loading images on Quartz
When loading images on Quartz, the image is rendered into a bitmap
context using a buffer allocated with
_cogl_bitmap_new_with_malloc_buffer. However this buffer is not
initialised and by default Quartz will blend the source image with the
destination so if there are transparent parts in the source image it
will leave garbage in the destination. This patch changes the blend
mode to 'copy' so that it won't try to blend.

Before 5b785dd4 the buffer was cleared because it was allocated with
g_malloc0 so it was working in that case. Presumably it should be more
efficient to disable blending and avoid the clear though.

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

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

(cherry picked from commit 5ba7f4e6837a539d92cbe45491f79a8926fd6828)
2012-08-15 17:14:25 +01:00
Robert Bragg
470273db7e configure: use AC_GNU_SOURCE
This adds the AC_GNU_SOURCE macro to configure.ac to ensure _GNU_SOURCE
is defined while compiling Cogl. This is required to use memmem for
example.

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

(cherry picked from commit 1ed717dc12fc4d2cb49010232de93ff46684aa6a)
2012-08-15 14:09:53 +01:00
Sjoerd Simons
57f420e21e Remove one final user of cogl-handle and cogl-handle.h itself
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-08-15 13:46:25 +01:00
Yaron Shahrabani
09ddb9a633 Updated Hebrew translation.
(cherry picked from commit 139079499c6b6bd33987d92b01a9e55928157f65)
2012-08-15 13:46:25 +01:00
Stef Walter
0e69a6414f Support building with automake 1.12.x
https://bugzilla.gnome.org/show_bug.cgi?id=681285

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

(cherry picked from commit e5b5c5017487cec6426c93c364ff853831bc2080)
2012-08-15 13:46:25 +01:00
Neil Roberts
19ccb72b80 cogl-gles2-context: Wrap glCopyTex{Sub,}Image2D to flip the result
When the CoglGLES2Context is bound to read from a CoglOffscreen then
the result will be upside down from what GL expects if
glCopyTexImage2D is used directly. To fix that, this patch now wraps
glCopyTexImage2D and glCopyTexSubImage2D so that the copy is doing by
binding an FBO to the target texture and then rendering a quad
sampling from the texture in the offscreen framebuffer.

The rendering is done using the Cogl context rather than the GLES2
context because otherwise it would have to do a fair bit of work to
try and stash the old state on the context before setting up the state
to do the blit. The down side of this is that the contexts need to be
synchronized so that the rendering will be up-to-date. As far as I
understand from the GL spec, this requires a glFinish and then the
texture needs to be rebound in the new context because updates to
shared objects are guaranteed to be reflected until the object is
rebound.

GLES2 supports using glCopyTexImage2D for cube map textures. As Cogl
doesn't currently have support for cube maps, it is quite hard to get
that to work with this patch. For now attempts to copy to a cube map
texture will just be sliently ignored.

This patch also includes a test case which renders an image to the
framebuffer and then copies it to a texture. The texture is then
rendered back to the framebuffer and the contents are checked for the
correct orientation using glReadPixels.

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

(cherry picked from commit 30b6da8134bad95267265e26685c7475f6c351c9)
2012-08-15 13:46:20 +01:00
Neil Roberts
77edc1f204 cogl-gles2-context: Keep track of extra data per texture object
This patch adds a hash table mapping texture object IDs to a struct so
that we can keep track of some of the state for each texture object.
Currently it will just track the width and height of the texture 2D
target.

Additionally it will now try to delete any texture objects that have
data created for them by the GLES2 context so that it won't leak them.
It only tracks objects that get data set on them, not all objects that
are bound because it is possible to use the GLES2 context with foreign
textures via cogl_gles2_texture_get_handle() and we don't want to
delete those.

In order to keep track of the currently bound texture object it also
needs to track the active texture unit.

Note that this state tracking will probably go wrong if GL throws an
error for invalid state. For example if glActiveTexture is called with
an invalid texture unit then GL will ignore the binding but Cogl will
assume it is valid and the state tracking will get out of sync.
Perhaps it would be good if Cogl could detect the errors but this is
difficult to do without consuming them.

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

(cherry picked from commit d8c72bb56cf3598fc57d629edc618f1bfa79f125)
2012-08-15 13:44:22 +01:00
Neil Roberts
d12399b823 test-gles2-context: Add a test case for rendering to an FBO
This adds an extra test to test-gles2-context which renders to an FBO
and then checks that the orientation is correct once the texture is
rendered via Cogl. This should test the code path to flip the GLES2
rendering in Cogl.

The rendering is done in three different ways to test the various
state that needs flipping:

• Just renders two triangle strips, one at the top and one at the
  bottom.

• Renders two full screen triangle strips, but each with a different
  viewport to clip it to the top or the bottom.

• Clears the screen with two different colors and a scissor to either
  the top or the bottom.

• Renders both quads twice with two different colors and two different
  front face states.

Additionally the rendering is verified by calling glReadPixels to
check that the returned pixels are flipped correctly.

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

(cherry picked from commit 5b097f9bc4a3eb316c6bf0d9fe8db00ff93bfe73)
2012-08-15 13:44:16 +01:00
Neil Roberts
4c1b7c979d test-gles2-context: Fix error checking for cogl_gles2_context_new
The test was passing NULL as the error argument but then trying to use
the error object if it failed so it would just crash in that case.

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

(cherry picked from commit 61cbbb3000fb4001d51999fd05179c620b7e56bf)
2012-08-14 18:55:42 +01:00
Neil Roberts
8e12e40da9 cogl-gles2-context: Flip the rendering when framebuffer is offscreen
Cogl has a different origin for texture coordinates than OpenGL so
that the results of rendering to a texture should leave the top of the
image at the texture coordinate 0,0 rather than the bottom. When a
GLES2 context is used to render to a Cogl texture via a CoglOffscreen
we don't really want the application to have to be aware of the
mismatch and flip the texture coordinates. To get that to work, this
patch now tracks all of the programs that the application generates
using the context and sneaks in an extra vertex shader with an
alternative main function. This main function multiplies the final
calculated gl_Position by a vector uniform which we can use to flip
the image. When the application uploads the source code for a vertex
shader we now replace any occurrences of the token 'main' with '_c31'
and this renamed function gets called from the replacement main
function. The token has a weird name so that it will be unlikely to
conflict with a variable name in the application's source but it also
needs to have the same number of characters as the original token so
that it won't affect column numbers in the error reporting.

We are also wrapping glGetShaderSource so that we can try to revert
the token name. The same goes for the error logs just in case the
error report mentions function names.

Both places that cause drawing to occur (glDrawElements and
glDrawArrays) are now also wrapped so that we can update the uniform
value whenever the program is used with a different type of
framebuffer from last time.

We additionally need to manually track the state for the viewport, the
stencil box and the front face because all of these will be affected
by whether we are flipping the image or not. Any attempts to change
these states will be queued and instead flushed at the last minute
before drawing.

There are still some known issues with this patch:

• glCopyTexImage2D and glCopyTexSubImage2D will do the wrong thing
  when copying data from a CoglOffscreen. This could be quite fiddly
  to solve.

• Point sprites won't flip correctly. To make this work we would need
  to flip the gl_PointSprite builtin variable somehow. This is done in
  the fragment shader not the vertex shader so flipping the calculated
  gl_Position doesn't help here.

• The patch doesn't attempt to flip rendering to framebuffers for
  textures created within the GLES2 context. This probably makes sense
  because those textures are likely to be used within the GLES2
  context in which case we want to leave the texture coordinates as
  they are. However, if the texture is shared back out to Cogl with
  cogl_gles2_texture_2d_new_from_handle then the texture will be
  upside-down.

• The application can discover our secret uniform that we added via
  glGetActiveUniform. It might be worth trying to disguise this by
  wrapping that function although that could be quite fiddly.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit d589bf19e51f22c3241b2a18db10f22131ac126a)
2012-08-14 18:55:42 +01:00
Neil Roberts
0c66431df3 Add a wrapper for 'memmem'
memmem is a GNU libc extension that works like strstr except that the
size of the needle and the haystack are passed into the function
instead of using null-terminated strings.

This patch adds a wrapper function called 'cogl_util_memmem' so that
we can use this function. There is a configure check and if the
function is not available then a fallback implementation will be used.
Otherwise cogl_util_memmem is just defined to memmem.

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

(cherry picked from commit 1dd1b0a67f6238e13f7f9253fb03addada0541b7)
2012-08-14 18:55:42 +01:00
Neil Roberts
12a1ef72c0 cogl-gles2-context: Keep some extra data for shaders and programs
All of the functions that create and destroy shaders are now wrapped
in the CoglGLES2Context so that we can track some extra data for them.
There are hash tables mapping object IDs to the corresponding data.
The data is currently not used for anything but will be in later
patches.

The glUseProgram, glAttachShader and glDetachShader functions
additionally need to be wrapped because GL does not delete shader
objects that are in use. Therefore we need to have a reference count
on the data so we can recognise when the last use has been removed.

The IDs are assumed to be specific to an individual CoglGLES2Context.
This is technically not the case because all of the CoglGLES2Contexts
are in the same share list. However we don't really want this to be
the case so currently we will assume sharing the object IDs between
contexts is undefined behaviour. Eventually we may want to actually
enforce this.

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

(cherry picked from commit 05dc1e34785ae5f5484cd398ecc5464bd8bd3dcd)
2012-08-14 18:55:42 +01:00
Neil Roberts
0cd88bd676 cogl-gles2-context: Fix the default viewport and scissor size
In GL, the default viewport and scissor should be set to the size of
the first surface that the context is bound to. If a CoglGLES2Context
is first used with an offscreen framebuffer then this surface will
actually be the dummy 1x1 window which will mess up the defaults. To
fix that, this patch makes it just always override the viewport and
scissor the first time the context is bound to something.

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

(cherry picked from commit 02567b3e6b64e6849b9f7c6aa2137401be7ece8d)
2012-08-14 18:55:42 +01:00
Nilamdyuti Goswami
f373c4aba4 Assamese translation updated
(cherry picked from commit b9c1d87ddd6d3038690cc2ce99f08418caf3238a)
2012-08-14 18:55:42 +01:00