Commit Graph

4 Commits

Author SHA1 Message Date
Robert Bragg
7e9685294e [cogl] Updates all file headers and removes lots of trailing white space
Adds missing notices, and ensures all the notices are consistent. The Cogl
blurb also now reads:

 * Cogl
 *
 * An object oriented GL/GLES Abstraction/Utility Layer
2009-05-02 04:12:25 +01:00
Robert Bragg
ed272213f0 [cogl-handle] Optimize how we define cogl handles
The cogl_is_* functions were showing up quite high on profiles due to
iterating through arrays of cogl handles.

This does away with all the handle arrays and implements a simple struct
inheritance scheme. All cogl objects now add a CoglHandleObject _parent;
member to their main structures. The base object includes 2 members a.t.m; a
ref_count, and a klass pointer. The klass in turn gives you a type and
virtual function for freeing objects of that type.

Each handle type has a _cogl_##handle_type##_get_type () function
automatically defined which returns a GQuark of the handle type, so now
implementing the cogl_is_* funcs is just a case of comparing with
obj->klass->type.

Another outcome of the re-work is that cogl_handle_{ref,unref} are also much
more efficient, and no longer need extending for each handle type added to
cogl. The cogl_##handle_type##_{ref,unref} functions are now deprecated and
are no longer used internally to Clutter or Cogl. Potentially we can remove
them completely before 1.0.
2009-04-02 11:58:43 +01:00
Neil Roberts
cbd77008ff * clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-gles2-wrapper.c: All of the settings and
	uniforms are now proxied into COGL variables instead of setting
	the GL uniforms directly. Just before glDrawArrays is executed a
	shader is generated using the given settings to avoid using 'if'
	statements. The shaders are cached.

	* clutter/cogl/gles/cogl-fixed-vertex-shader.glsl: 
	* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl: The shaders
	are now split into parts using comments instead of 'if' statements
	so that the simplest shader can be generated on the fly.

	* clutter/cogl/gles/stringify.sh: Now splits up the shader sources
	into separate C strings where deliminated by special comments.

	* clutter/cogl/gles/cogl-program.h: 
	* clutter/cogl/gles/cogl-program.c: A custom shader can no longer
	be directly linked with the fixed-functionality replacement
	because the replacement changes depending on the settings. Instead
	the bound shader is linked with the appropriate replacement shader
	just before glDrawArrays is executed. The custom uniform variables
	must also be proxied through COGL variables because their location
	can change when relinked.
2008-06-24 16:21:40 +00:00
Neil Roberts
165531074b * clutter/cogl/gles/cogl-gles2-wrapper.h: The uniform numbers are
now stored in a separate struct so they can be stored for
	application program objects as well.

	* clutter/cogl/gles/cogl.c: Moved stub shader functions into
	separate files.
	(_cogl_features_init): Report support for the shaders feature on
	GLES 2

	* clutter/cogl/gles/cogl-shader.h:
	* clutter/cogl/gles/cogl-shader.c:
	* clutter/cogl/gles/cogl-program.h:
	* clutter/cogl/gles/cogl-program.c: Separate files to handle
	shaders on programs on GLES. If version 1.1 is being used then the
	stub functions which all fail are still used.

	* clutter/cogl/gles/cogl-gles2-wrapper.c
	(cogl_gles2_wrapper_init, cogl_gles2_wrapper_bind_attributes),
	(cogl_gles2_wrapper_get_uniforms): Move the uniforms and attribute
	bindings into a separate function so they can be used to bind on
	application shaders as well.
	(cogl_gles2_wrapper_update_matrix): Now takes a parameter and is
	no longer static so that it can be used to update all of the
	matrices when a new shader is bound.

	* clutter/cogl/gles/cogl-defines.h.in: Use GL_COMPILE_STATUS for
	CGL_OBJECT_COMPILE_STATUS if the latter isn't available (for
	example on GLES 2).

	* clutter/cogl/gles/cogl-context.h (CoglContext): Added handle
	arrays for programs and shaders.

	* clutter/cogl/gles/cogl-context.c (cogl_create_context)
	(cogl_destroy_context): Initialize and destroy program and shader
	handle array.

	* clutter/cogl/gles/Makefile.am (libclutter_cogl_la_SOURCES): Add
	cogl-{shader,program}.{c,h}
2008-06-02 10:58:57 +00:00