Commit Graph

997 Commits

Author SHA1 Message Date
Robert Bragg
8e8690a562 framebuffer: lazily allocate framebuffers as needed
If the user doesn't explicitly allocate a CoglFramebuffer then Cogl
should automatically allocate the framebuffer when the user starts to
draw to the framebuffer. So this way calling cogl_framebuffer_allocate
is only required if you are explicitly interested in checking for and
gracefully handling failures to allocate a framebuffer. If automatic
allocation fails then application behaviour becomes undefined.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:43 +01:00
Robert Bragg
f7b1bab1ad framebuffer: don't reference default fb in _clear apis
Some of the functions we were calling in cogl_framebuffer_clear[4f] were
referring to the current framebuffer, which would result in a crash
if nothing had been pushed before trying to explicitly clear a given
framebuffer.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:43 +01:00
Robert Bragg
19d12e65e5 framebuffer: avoid redundant calls to _init_bits
There is no need to call _cogl_framebuffer_init_bits for the draw and
read buffers each time we flush the framebuffer state since we will
always re-sync with gl if necessary when the
cogl_framebuffer_get_red/green/blue/alpha_bits functions are called.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:43 +01:00
Robert Bragg
f3a4d21187 buffer: make the COGL_BUFFER casting macro public
The CoglBuffer api is available as experimental 2.0 api but we forgot to
exposed the COGL_BUFFER casting macro.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:43 +01:00
Robert Bragg
dd6935f129 stb_image: use glib sized types
Instead of creating typedefs like uint8, uint16 and uint32 we now use
the glib sized typedefs in stb_image to avoid conflict with the uint8,
uint16 and uint32 typedefs on android.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:42 +01:00
Robert Bragg
b2964b6910 ext-functions: Don't assume GLchar typedef
We shouldn't assume the GLchar is a valid typedef with all GL headers
when declaring all the symbols in cogl-ext-functions.h to lookup. GLchar
may not be avilable with gles1 for example so we were seeing build
failures. The patch simply replaces occurrences of GLchar with char.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:42 +01:00
Robert Bragg
2ac4002084 cogl: Add support for reading a cogl.conf config file
When cogl initializes we now check for a cogl/cogl.conf in any of the
system config dirs (determined using $XDG_CONFIG_DIRS on linux) we then
also check the user's config directory (determined using XDG_CONFIG_HOME
on linux) for a cogl/cogl.conf file. Options specified in the user
config file have priority over the system config options.

The config file has an .ini style syntax with a mandatory [global]
section and we currently understand 3 keynames: COGL_DEBUG, COGL_DRIVER
and COGL_RENDERER which have the same semantics as the corresponding
environment variables.

Options set using the environment variables have priority over options
set in the config files. To allow users to undo the enabling of debug
options in config files this patch also adds a check for COGL_NO_DEBUG
environment variable which will disable the specified options which may
have been enabled in config files.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:28:42 +01:00
Neil Roberts
9270412495 cogl-blend-string: Fix TEXTURE_N sources
The parser couldn't cope with TEXTURE_N source arguments because the
sources are checked in turn to find one that matches the beginning of
the argument. The TEXTURE_N source was checked last so it would end up
matching the regular 'TEXTURE' source and then the parser would choke
when it tries to parse the trailing parts.

This patch just moves the check for TEXTURE_ to the top. It also also
changes it so that the argument only needs to be at least 8 characters
long instead of 9. This is necessary because the parser doesn't
consider the digits to be part of the name of the argument so while we
are parsing 'TEXTURE_0' the length is only 8.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-08-04 19:14:27 +01:00
Robert Bragg
89fd2edeb0 Flush the journal before changing the projection
Since the projection matrix isn't tracked in the journal and since our
software transform of vertices as we log into the journal doesn't
include the projective transform we need to make sure we flush all
primitives in the journal before ever changing the projection.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-02 12:05:37 +01:00
Damien Lespiau
ee01fd263a egl-gdl: Don't generate cogl-display.h
It's not necessary to generate cogl-display.h just for the GDL backend
and to change the inclusion of libgdl.h. We can just tweak the include
CFLAGS to put /usr/include/CE4100 in the search path when needed.

Previously this did not work because of a stay ',' at the end of the
COGL_EXTRA_CFLAGS int he configure.ac. This actually simplifies the
code, which is always good.

This also fixes out of tree builds.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-01 16:36:52 +01:00
Damien Lespiau
89426a802f egl-gdl: Silence a gcc warning
gcc warns us that we should put some {} to make to which 'if's the
'else' belongs to very clear.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-01 16:36:09 +01:00
Neil Roberts
bbbe6db284 cogl-primitives: Plug some leaks in cogl_polygon
cogl_polygon creates some temporary strings, CoglAttributeBuffers and
CoglAttributes but it was never freeing them.

Based on a patch by Florian Renaut

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-08-01 14:08:46 +01:00
Neil Roberts
38deb97478 cogl-winsys-wgl: Add a fallback for failed wglGetProcAddress
The documentation for wglGetProcAddress implies that it should only be
used for extension functions. The rest of Cogl assumes that it can
dynamically resolve all GL symbols so it would crash if this
happens. This patch makes it fallback to trying to resolve the symbol
using GModule to open the opengl32 library if wglGetProcAddress fails.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-08-01 14:08:42 +01:00
Neil Roberts
93e69387cc Add the missing check for COGL_FEATURE_POINT_SPRITE on the GL driver
The check for the point sprite feature got lost when the feature
functions header was combined for GL and GLES in dae02a99a.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-08-01 14:05:09 +01:00
Chun-wei Fan
f7bdc92d6c Include cogl-win32-renderer.h in cogl.h on Windows
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-31 17:46:35 +01:00
Chun-wei Fan
3d92038237 Fix cogl/cogl-framebuffer.h (#define error)
The cogl_framebuffer_get_blue_bits was defined 2 times-fix to use the
correct define for cogl_framebuffer_get_alpha_bits

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-31 17:46:35 +01:00
Chun-wei Fan
6256ad8a7b Update vtable.id in cogl-winsys-wgl.c
Change EGL id to WGL id.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-31 17:46:35 +01:00
Damien Lespiau
d4dc51849e egl: Make sure to free the underlying egl objects when the display is freed
If the display has been setup up, we should destroy the underlying
objects that the winsys has created. This can be done by calling the
winsys->destroy_display() function in _free.

Then, in that function, and for the NULL and GDL EGL platform we can
destroy the surface we have created in the setup_display() function
(through create_context()).

This allows to have clutter create a "dummy" display in
cogl_renderer_check_onscreen_template(), then free it, then recreate the
context and the surface that will be the final ones.

https://bugzilla.gnome.org/show_bug.cgi?id=655355
2011-07-29 11:50:15 +01:00
Damien Lespiau
2c3827aced egl-gdl: Provide defaults to be able to initialize a "dummy" context
If we are being called without any GDL specific call (either the plane
we want to render to or the swap chain length) we can provide sane
defaults to still be able to create a context and a surface.

https://bugzilla.gnome.org/show_bug.cgi?id=655355
2011-07-29 11:50:15 +01:00
Damien Lespiau
ff5a3503af egl-gdl: Make the egl winsys know about the GDL platform
The egl winsys has a few code paths depending on the platform we are
compiling for. The GDL platform needs those defined as well.

A few tweaks were needed here and there to make it compile again.

https://bugzilla.gnome.org/show_bug.cgi?id=655355
2011-07-29 11:50:15 +01:00
Damien Lespiau
388abe2907 egl-gdl: struct gdl_plane never was a valid type
The enum for the planes is called gdl_plant_id_t.

https://bugzilla.gnome.org/show_bug.cgi?id=655355
2011-07-29 11:50:15 +01:00
Damien Lespiau
a53af153c3 egl-gdl: Correctly substitute COGL_CEX100_LIBGDL_PREFIX
We weren't defining CLUTTER_CEX100_LIBGDL_PREFIX in the configure.ac and
thus failing to compile when selecting the EGL/GDL winsys. Take the
opportunity to rename that to COGL_CEX100_LIBGDL_PREFIX

https://bugzilla.gnome.org/show_bug.cgi?id=655355
2011-07-29 11:50:15 +01:00
Damien Lespiau
9ca3308892 egl: Guard the feature discovery of eglCreateImage()
EGLImageKHR might not be defined, the rest of the code seems to guard it
with #ifdef EGL_KHR_image_base.

https://bugzilla.gnome.org/show_bug.cgi?id=655216
2011-07-29 11:44:55 +01:00
Robert Bragg
912d46817e glx: Bail from _renderer_connect if not GL driver
The GLX winsys is only compatible with GL drivers so we now bail out
from cogl-winsys-glx.c:_cogl_winsys_renderer_connect if a GLES driver
has been chosen.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-28 20:44:46 +01:00
Robert Bragg
6e6620e089 egl: pass EGL_NO_CONTEXT to eglCreateImage for tfp
When passing the EGL_NATIVE_PIXMAP_KHR target to eglCreateImage the
EGL_KHR_image_pixmap extension explicitly states that EGL_NO_CONTEXT
must also be passed so we are now careful to do this.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-28 20:44:32 +01:00
Robert Bragg
b8503418ff framebuffer: dec current_pipeline_age to force color_mask
When we need to guarantee that the glColorMask is re-asserted the next
time that a primitive is drawn it is not enough to just OR in the
LOGIC_OPS flag to ctx->current_pipeline_changes_since_flush because
_cogl_pipeline_flush_gl_state actually checks the age of the pipeline
before checking that. If the pipeline hasn't aged then we bail out
early. This makes sure we decrement
ctx->current_pipeline_changes_since_flush so the next time we come to
flush a pipeline we will see a differing age.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-28 20:44:21 +01:00
Philip Withnall
d51c3c423e Fix testing of undefined macro constants to check for definedness instead
Reviewed-By: Robert Bragg <robert@linux.intel.com>
2011-07-27 18:46:36 +01:00
Robert Bragg
b8b37f6c41 quaternion: fix init_from_array and get_rotation_axis
In cogl_quaternion_init_from_array we were passing the address of the x
component as the destination for memcpy, but that was wrong at least
because w is actually the first member in the structure.  Another
concern raised was whether it was safe to assume that there was no
padding within the CoglQuaternion struct with some compilers so we also
switch to explicitly indexing each element of the array we want to copy.
In practice I think it's pretty safe to assume that padding will only be
introduced to ensure members are naturally aligned, but being explicit
is readable and it can't hurt to be extra cautious.

Another good catch in bug #655228 was that in
cogl_quaternion_get_rotation_axis we had a copy and paste error at the
end where we finally extract the axis and we were repeatedly calculating
just the x component. Now we calculate the y and z components too.

Thanks to Bug #655228 for identifying these issues.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-27 18:21:27 +01:00
Neil Roberts
d259a87602 Don't use the 'NULL' GModule to resolve GL symbols
Previously, _cogl_get_proc_address had a fallback to resolve the
symbol using g_module_open(NULL) to get the symbol from anywhere in
the address space. The EGL backend ends up using this on some drivers
because eglGetProcAddress isn't meant to return a pointer for core
functions. This causes problems if something in the process is linking
against a different GL library, for example Cairo may be linking
against libGL itself. In this case it may end up resolving symbols
from the GL library even if GLES is being used.

This patch removes the fallback. The EGL version now has its own
fallback instead which passes the existing libgl_module from the
renderer to g_module_symbol so that it should only get symbols from
that library or its dependency chain. The GLX and WGL winsys only call
glXGetProcAddress and wglGetProcAddress. The stub winsys does however
continue using the global symbol lookup.

The internal _cogl_get_proc_address function has been renamed to
_cogl_renderer_get_proc_address because it needs a connected renderer
to work so it could be considered to be a renderer method. The pointer
to the renderer is passed down to the winsys backends so that it can
use the data attached to the renderer to get the module pointers.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-07-27 16:10:02 +01:00
Kirk A. Baker
76c88958b7 Fixed uninitialized data (current_clip_stack_valid) in context creation
Reviewed-By: Robert Bragg <robert@linux.intel.com>
2011-07-27 15:55:27 +01:00
Neil Roberts
1287d26444 cogl-pipeline-fragend-arbfp: Initialise template_pipeline
The template_pipeline variable in _cogl_pipeline_fragend_arbfp_start
was not being initialised if the program caches are disabled with
COGL_DEBUG=disable-program-caches so it would crash. The other
backends have a similar variable but they already initialise it.

https://bugzilla.gnome.org/show_bug.cgi?id=655400
2011-07-27 10:55:47 +01:00
Robert Bragg
a9184d5cb7 Export API for uploading a tex subregion from a CoglBuffer
This exposes 2 experimental functions that make it possible to upload a
subregion of a texture from a CoglBuffer by first wrapping the buffer as
a CoglBitmap and then allowing uploading of a subregion from a
CoglBitmap. The new functions are:

cogl_bitmap_new_from_buffer() and
cogl_texture_set_region_from_bitmap()

Actually for now we are exporting this API for practical reasons since
we already had this API internally and it enables a specific feature
that was requested, but it is worth nothing that it's quite likely we
will replace these with functions that don't involve the CoglBitmap API
at some point.

For reference: The CoglBitmap API was actually removed from the 2.0
experimental API reference manual some time ago because the hope was
that we'd come up with a neater replacement. It doesn't seem entirely
clear what the scope of the CoglBitmap api is so it has became a bit of
a dumping ground.  CoglBitmap is used for image loading, as a means to
represent the layout of image data and also internally deals with format
conversions.

Note: Because we are avoiding including CoglBitmap as part of the 2.0
API these functions aren't currently included in the 2.0 reference
manual.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-25 22:45:24 +01:00
Robert Bragg
52a5fae136 gles: don't check for glClientActiveTexture
in cogl-ext-functions.h we had one multitexture feature that checked for
the ARB_multitexture extension and if found it then expected to find
glActiveTexture and glClientActiveTexture. The problem is that the
multitexture extension is part of the core GLES 1 and 2 APIs except that
for GLES2 there is no glClientActiveTexture function. By trying to
handle it as one feature that meant that Cogl would fail to check the
multitexture extension which is a hard requirement for Cogl.

The reason this went unnoticed is because Cogl can indirectly end up
linked to an OpenGL library via cairo and so we were finding a
glClientActiveTexture symbol there. This highlights that we should
probably stop using g_module_open (NULL) when checking features and
instead we should use the module we opened in cogl-renderer.c.
2011-07-20 16:43:29 +01:00
Robert Bragg
1144a05bfd x11: don't try and close a NULL display
If we failed to open an X display then don't later try and close a NULL
display resulting in a crash.
2011-07-20 16:43:29 +01:00
Robert Bragg
8b34a39319 Adds ColorMask support to Cogl
This adds CoglPipeline and CoglFramebuffer support for setting a color
mask which is a bit mask defining which color channels should be written
to the current framebuffer.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-19 19:27:09 +01:00
Neil Roberts
03c4b20931 Specify the full filename when g_module_open'ing the GL library
Instead of using g_module_build_path with the short name of the GL
library (eg, "GL") and relying on glib to add the suffix and prefix,
the configure script now directly encodes the full name including the
version number (eg, "libGL.so.1"). This is necessary because distros
don't always install the non-versioned suffix for the library.

The GLES libraries are left without the version suffix because it's
not clear what should be placed here and I can't find any
documentation from Khronos to clarify this. Mesa seems to install a
file called libGLESv2.so.2 but the IMG SDK doesn't install any
versioned library. There is an example of dynamically loading
libGLESv2 in the Chromium source code and that does not use the
version suffix even though it does use the version suffix for GL. This
implies that it's at least fairly normal to load the unversioned name
for GLES.

https://bugzilla.gnome.org/show_bug.cgi?id=654593
2011-07-19 15:12:10 +01:00
Robert Bragg
eb578e4e0c gles: Or in private features into ctx->private_feature_flags
When we moved all the GL function pointers to be part of CoglContext in
commit dae02a99a5 we made a mistake and started to OR in the private
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE feature flag into the non
private flags which would mean cogl would think the GL_OES_EGL_image
extension wasn't supported.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-19 14:40:29 +01:00
Robert Bragg
6d79657f76 egl: if texture_pixmap_x11_create fails free priv data
This makes sure the egl winsys frees the private egl_tex_pixmap state if
in _cogl_winsys_texture_pixmap_x11_create if there is a failure to
create an EGLImage.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-18 16:49:07 +01:00
Robert Bragg
02ba1a7345 texture-pixmap-x11: set ->winsys = NULL if _create fails
If _cogl_winsys_texture_pixmap_x11_create() fails then implicitly no
private state has been associated with the given tex_pixmap. Since that
winsys isn't associated with it we explicitly set tex_pixmap->winsys =
NULL.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-18 16:49:07 +01:00
Robert Bragg
c058b50ac0 texture-pixmap-x11: initialize ->use_winsys_texture
This ensures that tex_pixmap->use_winsys_texture is always initialized
during cogl_texture_pixmap_x11_new - either according to the result of
winsys->texture_pixmap_x11_create, or if the winsys doesn't support tfp
we explicitly initialize to FALSE.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-18 16:49:07 +01:00
Neil Roberts
231be91fb0 Combine _cogl_context_check_gl_version and update_features into one
The _cogl_context_check_gl_version function is meant to be called once
Cogl has a GL context so that it can check whether the context found
is supported by Cogl. However, only the stub winsys was calling this
and it was doing it before Cogl had a chance to retrieve the function
pointer for glString so it would just crash. This patch combines the
two functions into one so that _cogl_context_update_features returns a
gboolean and a GError. Then it can just check the context itself.

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

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-07-18 15:41:35 +01:00
Emmanuele Bassi
2fc069888f Compilation fixes for suncc
https://bugzilla.gnome.org/show_bug.cgi?id=654718

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-07-18 15:37:38 +01:00
Robert Bragg
6f79eb8a5a Use MESA_pack_invert to avoid read_pixels flip
cogl_read_pixels returns image data in a top-down memory order, but
because OpenGL normally returns pixel data in a bottom-up order we
have to flip the data before returning it to the user. If the OpenGL
driver supports the GL_MESA_pack_invert extension though we can ask the
driver to return the data in a top-down order in the first place.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-13 19:06:19 +01:00
Robert Bragg
1527b017c5 build: don't referencing wayland syms if not available
cogl-winsys-egl-feature-functions.h was unconditionally depending on the
struct wl_display type being defined. This guards the check for the
"WL_bind_wayland_display" extension with
 #ifdef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT

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

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

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

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-13 19:06:19 +01:00
Neil Roberts
f3b90d1717 cogl-pipeline: Use the pipeline cache for the GLSL backends
The CoglPipelineCache is now extended to store templates for state
affecting vertex shaders and combined programs. The GLSL fragend,
vertend and progend now uses this to get cached shaders and a program.

When a new pipeline is created it will now get hashed three times if
the GLSL backends are in use (once for the fragend, once for the
vertend and once for the progend). Ideally we should add some way for
the progend to check its cache before the fragends and vertends are
checked so that it can bypass them entirely if it can find a cached
combined program.
2011-07-13 12:30:07 +01:00
Neil Roberts
461bff1867 fragend-arbfp: Move the pipeline cache to a separate file
The pipeline cache is now handled in CoglPipelineCache instead of
directly in the ARBfp fragend. The flags needed to hash a pipeline
should be exactly the same for the ARBfp and GLSL fragends so it's
convenient to share the code. The hash table now stores the actual
pipeline as the value instead of the private data so that the two
fragends can attach their data to it. That way it's possible to use
the same pipeline key with ancestors that are using different
fragends.

The hash table is created with g_hash_table_new_full to set a
destructor for the key and value and there is a destructor for
CoglPipelineCache that gets called when the CoglContext is
destroyed. That way we no longer leak the pipelines and shader state
when the context is desroyed.
2011-07-13 12:30:07 +01:00
Neil Roberts
d69d49fada pipeline: Unify how the backends store private data
Previously the fragends had a separate private data pointer which was
used by the GLSL and ARBfp fragends to store a tiny struct containing
a single pointer to the ref-counted shader state. The space for the
private data pointer is reserved in all of the pipelines for all of
the potential backends. The vertends and progends however did this
differently by directly storing the pointer to the ref counted data
using cogl_object_set_user_data. This patch unifies the different
methods so that they all use cogl_object_set_user_data and the
fragends don't bother with the separate tiny allocation for the
private data. The private data pointer array has been removed from
CoglPipeline and the corresponding fragend virtual to free the private
data has also been removed because this can instead be done with the
destroy notify from the object user data.

The variable names used have been unified so that all of the vertends
and fragends name their data struct CoglPipelineShaderState and use a
variable called shader_state to refer to it. The progend uses
CoglPipelineProgramState and a variable called program_state.

This should also fix two potential bugs. the ARBfp fragend was
apprently leaking a reference to the private state when it creates the
private data because it was adding a reference before stroring the
pointer to the newly allocated data but the ref count is already set
to 1 on creation. The other potential bug is that the free function
for CoglPipeline was only calling the free_priv virtual for the
currently used fragend of the pipeline. The design of the fragends is
meant to allow a pipeline to have multiple fragend priv datas because
a child pipeline could be attaching its fragend data to the ancestor
and its allowed to pick a different fragend.
2011-07-13 12:30:07 +01:00