Commit Graph

2466 Commits

Author SHA1 Message Date
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
Daniel Mustieles
a97543824e Updated Spanish translation
(cherry picked from commit d3b8a5ab38ec8e63b158472d1bc6aa7140369835)
2012-08-14 18:55:42 +01:00
Matej Urbančič
1be1fda322 Updated Slovenian translation
(cherry picked from commit 69b6f82065d6930ce2fee1503a4022cea3d14563)
2012-08-14 18:55:42 +01:00
Chao-Hsiung Liao
3a755ed667 Updated Traditional Chinese translation(Hong Kong and Taiwan)
(cherry picked from commit fb6d1e67a874f0d7ab12412de8d2f51655f6be8f)
2012-08-14 18:55:41 +01:00
Robert Bragg
6a024acaa9 display: inc cogl-wayland-server.h if needed
Since 0773107deb9ede the prototype for
cogl_wayland_display_set_compositor_display() has moved into
cogl-wayland-server.h but cogl-display.c wasn't updated to include this
header.

(cherry picked from commit f6ccff9992fcfb9497ce91dd299460362476ba7a)
2012-08-06 18:51:34 +01:00
Neil Roberts
683545b1ff build: Remove clutter-project.org from the release rules
clutter-project.org is no longer accessible for uploading releases so
this just removes all mention of it from the release rules.

(cherry picked from commit 66c291a3a4e811bde7f022e756f93d0f224975c3)
2012-08-06 18:51:34 +01:00
Robert Bragg
e347135b6a Move cogl_wayland_display_ proto to cogl-wayland-server.h
We need to avoid including wayland-server.h or wayland-client.h
indirectly when including cogl.h because there are overlapping typedef
names between the client and server wayland headers and we can't assume
whether Cogl is being used client or server side. This moves the
prototype for cogl_wayland_display_set_compositor_display() into
cogl-wayland-server.h which Cogl apps must include explicitly if the
want access to server side Cogl Wayland symbols.

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

(cherry picked from commit 0773107deb9eded408e2801f217462c5d551f15a)
2012-08-06 18:51:34 +01:00
Мирослав Николић
f31ce3d0f7 Updated Serbian translation
(cherry picked from commit 5c5c577d44317e472c51aac2409df161bc4c63f4)
2012-08-06 18:51:34 +01:00
Neil Roberts
0e168ed0aa Fix the header guards for cogl-texture-2d{,-private}.h
The header guard for cogl-texture-2d-private.h was
__COGL_TEXTURE_2D_H. This would conflict with the header guard for
cogl-texture-2d.h except there a small typo ('TEXURE') so that it
was subtly different. This fixes them both to make more sense.

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

(cherry picked from commit 222ec4d009973cb62020a9da05f72dea41460b33)
2012-08-06 18:51:33 +01:00
Neil Roberts
96b726b518 cogl-winsys-sdl: Fix the signature for the get_proc_address method
This function should take an extra third paramter to specify whether
the procedure is in core or not. The parameter is not used so this
patch just fixes an annoying warning.

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

(cherry picked from commit eed4ac80cd8c3fa1859493c9bb00547038be6095)
2012-08-06 18:51:33 +01:00
Neil Roberts
59ff396875 cogl-winsys-egl-kms: Remove some unused variables
This just gets rid of some annoying warnings.

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

(cherry picked from commit 3d0aea04d1f6a8094b749e20a59d8a9a95a6235e)
2012-08-06 18:51:33 +01:00
Neil Roberts
5fff83cd3c cogl-texture-2d-private: Include egl-defines.h
The cogl-texture-2d-private.h header checks for the presence of
EGL_KHR_image_base before declaring
_cogl_egl_texture_2d_new_from_image. This define will only be
available if the EGL headers are included so we should make sure that
happens. This was resulting in a warning complaining that the function
was not previously declared.

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

(cherry picked from commit bd4840d7858efcf30eb5cf5d6fd0d39bdd59d1c1)
2012-08-06 18:51:33 +01:00
Neil Roberts
74fd618df9 Add conf vars to trick Cogl to think extensions are disabled
This adds two new configuration environment variables:

COGL_DISABLE_GL_EXTENSIONS and
COGL_OVERRIDE_GL_VERSION

The variables can also be set in the cogl.conf file using the same
names.

The first one is a list of GL extension names separated by commas.
When set Cogl will assume any extension listed here is not available
by removing it from the string returned from
glGetString(GL_EXTENSIONS). If the string is set in both the config
file and the environment variable then the union of the two lists will
be used.

The second overrides the value returned from glGetString(GL_VERSION).
If the string is set in both places the version from the environment
variable will take priority.

These are sometimes useful for debugging Cogl to test the various
combinations of extensions. It could also be useful to work around
driver bugs where an extension is badly supported and it would be
better not to use it.

The variables in cogl-config that just set a global char * variable
have been put together in an array instead of having a separate blob
of code for each one in order to make it simpler to add new variables.

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

(cherry picked from commit ec69c2dc576c78664e0b73879365cb7414ecf441)
2012-08-06 18:51:33 +01:00
Damien Lespiau
e5fea8b734 egl-x11: Don't use GLXDrawable on EGL
Someone trying to compile cogl (ThijsNL on irc0 for the Rasberry Pi
stumbled into that one. GLXDrawable may not be defined in a pure EGL/X
environment.

Change it to Window, the type used for XConfigureEvent.window.

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

(cherry picked from commit f05d6923fff28b1d167a391d486e319743c49215)
2012-08-06 18:51:33 +01:00
Neil Roberts
cbad21f0f4 pipeline: Remove the CoglPipelineFlag enum
This doesn't appear to be used anywhere in the code since it was added
in 1cc3ae69. Dead code is confusing so let's remove it.

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

(cherry picked from commit 41928d0ac528acf4ba89b5b27d7ca7ac5501b194)
2012-08-06 18:51:33 +01:00
Мирослав Николић
c7c90d4063 Updated Serbian translation
(cherry picked from commit bb4a65e6d07fe15921b39dd808ee8a762d588695)
2012-08-06 18:51:33 +01:00
fenghelong
371d509c94 Update Chinese simplified translation for ui
(cherry picked from commit 481770d969f2db190b8aa6a70fbcf6f6ab527745)
2012-08-06 18:51:33 +01:00
Chun-wei Fan
d559c93f8c Visual C++ support: Re-enable C4819 warnings
The C4819 warnings appear due to a bug on Visual C++ when running on
non-English locales, specifically CJK versions/locales of Windows.

Re-enable this, like what is done in GLib, and add a note in the Visual
C++ README.txt's to tell people about this, so that Cogl will be built
correctly.

(cherry picked from commit a93eafe6596e3b262dbb86f24a456e53b044055a)
2012-08-06 18:51:32 +01:00
Chao-Hsiung Liao
8960c8aed8 Updated Traditional Chinese translation(Hong Kong and Taiwan)
(cherry picked from commit 27cbf95b2dd5d6cc974db34fe8370e5b22e597d9)
2012-08-06 18:51:32 +01:00
Ihar Hrachyshka
9d50136277 Updated Belarusian translation.
(cherry picked from commit a4867fdce04e5202b5f2d12872301717eae53ee0)
2012-08-06 18:51:32 +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
Andika Triwidada
90641cf2ca Updated Indonesian translation
(cherry picked from commit 68dcb1d6292b485abb0f7360aa111786fb411532)
2012-08-06 18:51:32 +01:00
Kjartan Maraas
c66d886d96 Updated Norwegian bokmål translation
(cherry picked from commit 30c91bc6972b8cbb9d513940ef00806750b41fd0)
2012-08-06 18:51:32 +01:00
Robert Bragg
961832164b quaternions: Allow multiplication into 'a' arg
When multiplying two quaternions, we now implicitly copy the components
of the 'a' argument so that the result can be reliably written back to
the 'a' argument quaternion without conflicting with the multiplication
itself. This is consistent with the cogl_matrix_multiply() api which
allows the 'result' and 'a' arguments to point to the same matrix. In
debug builds Cogl will assert that the 'b' and 'result' arguments don't
point to the same quaternion.

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

(cherry picked from commit 207527313a8957789390069e84189254cf41e88f)
2012-08-06 18:51:32 +01:00
Robert Bragg
8f4dd4587e onscreen: Free swap notify callback state
When freeing a CoglOnscreen we weren't freeing the state associated with
swap notification callbacks.

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

(cherry picked from commit 70bc12fe20fa1be4eac58356861a730f18d6b59e)
2012-08-06 18:51:32 +01:00
Robert Bragg
56382435fa stack: don't deref freed mem in _cogl_memory_stack_free
This fixes _cogl_memory_stack_free to ensure we don't dereference freed
memory as we iterate the sub-stacks to free them.

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

(cherry picked from commit 1d27fedef9c599aa9976b809f18e0da1913cec26)
2012-08-06 18:51:32 +01:00
Robert Bragg
df51574116 onscreen: Adds support for resizable windows
This adds api to be able to request that the window system allows a
given onscreen framebuffer to be resizable, and api to add and remove
resize handlers to be called whenever the framebuffer does actually
change size.

The new functions are:
  cogl_onscreen_{get,set}_resizable()
  cogl_onscreen_{add,remove}_resize_handler()

The examples cogl-hello and cogl-x11-foreign have been updated to use
the new api. To smoke test how Cogl updates the viewport automatically
in response to window resizes the cogl-hello test doesn't explicitly
respond to resize events by setting the viewport and cogl-x11-foreign
responds by setting a viewport that is offset by a quarter of the
window's width/height and half the width and height of the window.

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

(cherry picked from commit a1a8cc00bfa2cecaf1007aec5f3dd95dc07b1786)
2012-08-06 18:51:32 +01:00
Chun-wei Fan
72f992effe Update Visual C++ project files
-The test program and examples must be linked to SDL too when COGL is
 built with the SDL renderer, so add configs accordingly.

-Also use Multibyte character sets (i.e. don't -DUNICODE) for all configs,
 like what GLib does, for consistency.

-Fix the VS2010 property sheets that was accidently malformed.

(cherry picked from commit 9ed541b4e35208df87ffaa5fbbb39e11e8c247ef)
2012-08-06 18:51:31 +01:00
Chun-wei Fan
0ac0ef34db Fix up Visual C++ property sheets
The command to copy cogl-gl-header.h from the pre-configured
cogl-gl-header.h.win32 is wrong.  Fix that.

Also add -DCOGL_ENABLE_EXPERIMENTAL_API for all creations of the cogl.def

(cherry picked from commit 6df152c411749a610a57ecaab6a983b51d2a7612)
2012-08-06 18:51:31 +01:00
Neil Roberts
786d1b8e40 Split test-point-sprite into two, one without checking orientation
There is currently a known bug where when rendering offscreen point
sprites will be rendered upside-down. For that reason
test-point-sprite is marked as a known failure because it checks the
orientation of the point sprites and the conformance test suite is
rendered to offscreen buffers by default. However this doesn't help to
catch more general failures that stop the point sprites being rendered
at all. To fix this the test-point-sprite test has been split into two
tests, one which verifies the orientation and one which does not. The
two tests are in the same source file and internally share the same
static function but pass a flag to specify whether to check the
orientation. If the orientation should be ignored then it will create
a 2x1 texture instead of a 2x2 texture so that it will appear the same
regardless of whether it is upside-down. The checks for the colors
have been altered accordingly.

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

(cherry picked from commit 51b7fdbe17f300cf2edf42c2ca740ad748c9fd78)
2012-08-06 18:51:31 +01:00
Neil Roberts
2ae352b0a6 Fix point sprite coordinates in shaders on GLES2
When using the GLES2 driver with a pipeline layer that has point
sprite coordinates enabled it extracts the texture coordinates from
the gl_PointCoord builtin instead of cogl_tex_coord_in[*].
gl_PointCoord is not quite the same as the regular texture coordinates
because it is only a vec2 instead of a vec4. This used to work ok
because either set of texture coordinates would always immediately be
accessed using a swizzle of '.st' so it would effectively be converted
to a vec2 anyway. However since the snippet hook for texture lookups
was added the texture coordinates are now passed to a function to
perform the actual lookup instead. This function always takes a vec4
so the shader would not compile. This patch fixes it to construct a
vec4 from gl_PointCoord by setting the third and fourth components to
0.0 and 1.0.

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

(cherry picked from commit cb3409b23caf324a548f82cfb88acc684cc71930)
2012-08-06 18:51:31 +01:00
Alexander Shopov
960cf64d04 Updated Bulgarian translation
(cherry picked from commit 04b9a54263f175fc8302aa172befbed897e34dda)
2012-08-06 18:51:31 +01:00
Tomeu Vizoso
053845f796 framebuffer: Only remember offscreen allocate flags when !COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL
Otherwise, if a texture is created before all the other FBOs, a new
atlas will be created, with a FBO with COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL
causing last_offscreen_allocate_flags to be 0.

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

(cherry picked from commit 7d2156785da8196e129eb393efb0d09093c4783e)
2012-08-06 18:51:31 +01:00
Robert Bragg
1686e754a7 bitmap: Adds cogl_android_bitmap_new_from_asset()
This adds some android specific api for creating a CoglBitmap from an
Android asset.

As part of the work it also seemed like a good time to change the
internal bitmap constructors to take an explicit CoglContext argument
and so the public cogl_bitmap_new_from_file() api was also changed
accordingly to take a CoglContext pointer as the first argument.

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

(cherry picked from commit 099d6d1b505b55bbd09c50d081deb41ab5764e19)

  Since we aren't able to break APIs on the 1.12 branch this cherry-pick
  skips the change to cogl_bitmap_new_from_file()
2012-08-06 18:50:22 +01:00
Neil Roberts
d1dc4e1e0b Don't use the label 'ERROR' because it conflicts with windows.h
wingdi.h which gets included from windows.h #defines ERROR to 0 so we
can't use it as a label in Cogl. This patch changes it to be error in
lower case instead.

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

(cherry picked from commit e9bac2755c2cba84c82a856d369a30560d19a32e)
2012-08-06 14:27:45 +01:00
Neil Roberts
df77e8565e Don't use eglGetProcAddress to retrieve core functions
According to the EGL spec, eglGetProcAddress should only be used to
retrieve extension functions. It also says that returning non-NULL
does not mean the extension is available so you could interpret this
as saying that the function is allowed to return garbage for core
functions. This seems to happen at least for the Android
implementation of EGL.

To workaround this the winsys's are now passed down a flag to say
whether the function is from the core API. This information is already
in the gl-prototypes headers as the minimum core GL version and as a
pair of flags to specify whether it is available in core GLES1 and
GLES2. If the function is in core the EGL winsys will now avoid using
eglGetProcAddress and always fallback to querying the library directly
with the GModule API.

The GLX winsys is left alone because glXGetProcAddress apparently
supports querying core API and extension functions.

The WGL winsys could ideally be changed because wglGetProcAddress
should also only be used for extension functions but the situation is
slightly different because WGL considers anything from GL > 1.1 to be
an extension so it would need a bit more information to determine
whether to query the function directly from the library.

The SDL winsys is also left alone because it's not as easy to portably
determine which GL library SDL has chosen to load in order to resolve
the symbols directly.

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

(cherry picked from commit 72089730ad06ccdd38a344279a893965ae68cec1)

  Since we aren't able to break API on the 1.12 branch
  cogl_get_proc_address is still supported but isn't easily able to
  determine whether the given name corresponds to a core symbol or
  not.  For now we just assume the symbol being queried isn't part
  of the core GL api and update the documentation accordingly.
2012-08-06 14:27:45 +01:00
Neil Roberts
7cdaaf2bd5 Don't use the transpose argument of glUniformMatrix*
According to the GLES1/2 spec, the transpose argument of
glUniformMatrix* should always be FALSE. Cogl directly exposes the
transposedness of the uniform value in
cogl_pipeline_set_uniform_matrix and we were previously passing this
value on to GL. This patch makes it instead just always transpose the
matrix in Cogl itself when copying the value to the CoglBoxedValue. It
doesn't seem like there could be much advantage to letting GL
transpose the uniform value and at least Mesa just does a very similar
loop to handle the transpose.

Mesa has started being more pedantic about this which was making
test_pipeline_uniforms fail.

http://cgit.freedesktop.org/mesa/mesa/commit/?id=60e8a4944081b42127b3

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

(cherry picked from commit f42ee670ff663d03073d6b1038b21a0aa1b3ec2b)
2012-08-06 14:27:45 +01:00