mutter/cogl
Neil Roberts 63206a208b Merge cogl-program-{gl,gles}.c into one cogl-program.c
This merges the two implementations of CoglProgram for the GLES2 and
GL backends into one. The implementation is more like the GLES2
version which would track the uniform values and delay sending them to
GL. CoglProgram is now effectively just a GList of CoglShaders along
with an array of stored uniform values. CoglProgram never actually
creates a GL program, instead this is left up to the GLSL material
backend. This is necessary on GLES2 where we may need to relink the
user's program with different generated shaders depending on the other
emulated fixed function state. It will also be necessary in the future
GLSL backends for regular OpenGL. The GLSL and ARBfp material backends
are now the ones that create and link the GL program from the list of
shaders. The linked program is attached to the private material state
so that it can be reused if the CoglProgram is used again with the
same material. This does mean the program will get relinked if the
shader is used with multiple materials. This will be particularly bad
if the legacy cogl_program_use function is used because that
effectively always makes one-shot materials. This problem will
hopefully be alleviated if we make a hash table with a cache of
generated programs. The cogl program would then need to become part of
the hash lookup.

Each CoglProgram now has an age counter which is incremented every
time a shader is added. This is used by the material backends to
detect when we need to create a new GL program for the user program.

The internal _cogl_use_program function now takes a GL program handle
rather than a CoglProgram. It no longer needs any special differences
for GLES2. The GLES2 wrapper function now also uses this function to
bind its generated shaders.

The ARBfp shaders no longer store a copy of the program source but
instead just directly create a program object when cogl_shader_source
is called. This avoids having to reupload the source if the same
shader is used in multiple materials.

There are currently a few gross hacks to get the GLES2 backend to work
with this. The problem is that the GLSL material backend is now
generating a complete GL program but the GLES2 wrapper still needs to
add its fixed function emulation shaders if the program doesn't
provide either a vertex or fragment shader. There is a new function in
the GLES2 wrapper called _cogl_gles2_use_program which replaces the
previous cogl_program_use implementation. It extracts the GL shaders
from the GL program object and creates a new GL program containing all
of the shaders plus its fixed function emulation. This new program is
returned to the GLSL material backend so that it can still flush the
custom uniforms using it. The user_program is attached to the GLES2
settings struct as before but its stored using a GL program handle
rather than a CoglProgram pointer. This hack will go away once the
GLSL material backend replaces the GLES2 wrapper by generating the
code itself.

Under Mesa this currently generates some GL errors when glClear is
called in test-cogl-shader-glsl. I think this is due to a bug in Mesa
however. When the user program on the material is changed the GLSL
backend gets notified and deletes the GL program that it linked from
the user shaders. The program will still be bound in GL
however. Leaving a deleted shader bound exposes a bug in Mesa's
glClear implementation. More details are here:

https://bugs.freedesktop.org/show_bug.cgi?id=31194
2010-10-28 19:51:42 +01:00
..
driver Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
tesselator build: Do not build a noinst library for the tesselator 2010-09-12 19:25:47 +01:00
winsys cogl-context-winsys: Avoid zero-length arrays 2010-10-25 13:18:25 +01:00
cogl-atlas-texture-private.h cogl-atlas-texture: Split out the atlas data structure 2010-08-12 11:56:59 +01:00
cogl-atlas-texture.c cogl-atlas: Support multiple formats and clearing the texture 2010-08-12 11:56:59 +01:00
cogl-atlas.c cogl-atlas: Verify that the chosen initial size is supported 2010-08-12 11:57:00 +01:00
cogl-atlas.h cogl-atlas: Support multiple formats and clearing the texture 2010-08-12 11:56:59 +01:00
cogl-bitmap-fallback.c cogl-bitmap: Encapsulate the CoglBitmap even internally 2010-07-15 17:24:01 +01:00
cogl-bitmap-pixbuf.c cogl-bitmap-pixbuf: Avoid copying the buffer in more circumstances 2010-07-22 20:13:37 +01:00
cogl-bitmap-private.h Add an internal _cogl_bitmap_new_from_buffer 2010-07-15 17:27:15 +01:00
cogl-bitmap.c buffer: remove flag macros 2010-10-26 13:21:11 +01:00
cogl-bitmap.h Make a public CoglBitmapError enum 2010-07-13 14:28:45 +01:00
cogl-bitmask.c cogl: Add an internal CoglBitmask type 2010-05-24 16:10:56 +01:00
cogl-bitmask.h cogl: Add an internal CoglBitmask type 2010-05-24 16:10:56 +01:00
cogl-blend-string.c blend-strings: removes the AUTO_COMPOSITE function enum 2010-06-15 15:26:27 +01:00
cogl-blend-string.h blend-strings: removes the AUTO_COMPOSITE function enum 2010-06-15 15:26:27 +01:00
cogl-buffer-private.h buffer: BufferBindTarget + BufferUsageHint enum renaming 2010-10-26 17:25:27 +01:00
cogl-buffer.c buffer: BufferBindTarget + BufferUsageHint enum renaming 2010-10-26 17:25:27 +01:00
cogl-buffer.h Enumeration value should be on the same line 2010-09-15 11:56:59 +01:00
cogl-callback-list.c cogl: Add an internal utility to maintain a list of callback functions 2010-08-12 11:54:42 +01:00
cogl-callback-list.h cogl: Add an internal utility to maintain a list of callback functions 2010-08-12 11:54:42 +01:00
cogl-clip-stack.c cogl: Adds {push,pop,get}_source functions 2010-10-26 12:08:20 +01:00
cogl-clip-stack.h clip_stack: Remove use of CoglHandle in the CoglClipStack API 2010-06-01 12:20:59 +01:00
cogl-clip-state.c framebuffer: Replace CoglHandle with CoglFramebuffer * 2010-07-07 14:41:54 +01:00
cogl-clip-state.h cogl: Implement retained clip stacks 2010-04-15 14:51:01 +01:00
cogl-color-private.h cogl-color: add private _cogl_color_get_rgba_4ubv API 2010-06-15 15:26:27 +01:00
cogl-color.c cogl-color: add cogl_color_init_from_xyz funcs 2010-06-15 15:26:27 +01:00
cogl-color.h cogl-color: add cogl_color_init_from_xyz funcs 2010-06-15 15:26:27 +01:00
cogl-context.c cogl: Use separate materials for set_source_color and texture 2010-10-27 15:07:03 +01:00
cogl-context.h cogl: Use separate materials for set_source_color and texture 2010-10-27 15:07:03 +01:00
cogl-debug-options.h profile: Update to uprof-0.3 dep for --enable-profile 2010-09-14 12:43:16 +01:00
cogl-debug.c cogl: Use Cogl (not COGL) consistently 2010-10-05 08:03:19 +01:00
cogl-debug.h profile: Update to uprof-0.3 dep for --enable-profile 2010-09-14 12:43:16 +01:00
cogl-defines.h.in configure: Include gl2ext.h or glext.h under GLES 2010-07-13 14:28:51 +01:00
cogl-deprecated.h Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-enum-types.c.in Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys 2009-10-16 18:58:50 +01:00
cogl-enum-types.h.in Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys 2009-10-16 18:58:50 +01:00
cogl-feature-private.c cogl: Add the infrastructure for checking for winsys extensions 2010-06-22 12:22:43 +01:00
cogl-feature-private.h cogl: Add the infrastructure for checking for winsys extensions 2010-06-22 12:22:43 +01:00
cogl-fixed.c Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-fixed.h analysis: Fix some CoglFixed API 2010-06-01 12:08:18 +01:00
cogl-framebuffer-private.h framebuffer: Replace CoglHandle with CoglFramebuffer * 2010-07-07 14:41:54 +01:00
cogl-framebuffer.c cogl-framebuffer.c: GL_DEPTH_STENCIL not supported in gles 2010-09-23 17:33:11 +01:00
cogl-handle.h CoglObject: Adds cogl_object_{get,set}_user_data 2010-06-04 14:44:15 +01:00
cogl-internal.h Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-journal-private.h cogl: remove _cogl_material_flush_gl_state flush options 2010-06-15 15:26:27 +01:00
cogl-journal.c journal: provide more detailed uprof instrumentation 2010-09-14 12:43:17 +01:00
cogl-material-arbfp-private.h material: don't declare backend vtables in headers 2010-09-15 14:07:50 +01:00
cogl-material-arbfp.c Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-material-fixed-private.h material: don't declare backend vtables in headers 2010-09-15 14:07:50 +01:00
cogl-material-fixed.c Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-material-glsl-private.h material: don't declare backend vtables in headers 2010-09-15 14:07:50 +01:00
cogl-material-glsl.c Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-material-opengl-private.h cogl-program: gles2: bind programs lazily as for GL 2010-08-03 15:00:07 +01:00
cogl-material-opengl.c Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-material-private.h Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-material.c material: Adds _cogl_material_get_layer_texture 2010-10-26 13:06:54 +01:00
cogl-material.h material: Adds missing get_layer_wrap_mode_xyz prototypes 2010-10-26 13:02:23 +01:00
cogl-matrix-mesa.c Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-matrix-mesa.h Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-matrix-private.h Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-matrix-stack.c Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-matrix-stack.h Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-matrix.c cogl: don't include cogl-debug.h in cogl.h or install 2010-08-02 17:41:42 +01:00
cogl-matrix.h docs: Fixes for gtk-doc 2010-09-03 16:12:24 +01:00
cogl-object-private.h cogl-object-private.h: Include cogl-debug.h 2010-09-17 17:22:16 +01:00
cogl-object.c CoglObject: Adds cogl_object_{get,set}_user_data 2010-06-04 14:44:15 +01:00
cogl-object.h CoglObject: Adds a COGL_OBJECT macro for casting 2010-06-04 14:44:15 +01:00
cogl-offscreen.h Add some more introspection annotations 2010-09-06 16:11:46 +01:00
cogl-path-private.h cogl-path: Allow changing the fill rule 2010-06-29 20:37:14 +01:00
cogl-path.c cogl: Adds {push,pop,get}_source functions 2010-10-26 12:08:20 +01:00
cogl-path.h docs: API reference fixes 2010-09-20 13:15:44 +01:00
cogl-pixel-array-private.h pixel-array: Remove flags member and flag macros 2010-10-26 16:16:40 +01:00
cogl-pixel-array.c pixel-array: Remove some benign variables 2010-10-26 16:16:50 +01:00
cogl-pixel-array.h pixel-array: Only allow allocation of arrays with a 2D size 2010-07-05 15:20:04 +01:00
cogl-primitives.c cogl: Adds {push,pop,get}_source functions 2010-10-26 12:08:20 +01:00
cogl-primitives.h Use begin/end macros in cogl-primitives.h 2010-03-25 09:33:26 +00:00
cogl-profile.c Initialize the cogl uprof state in cogl_create_context 2010-09-14 12:43:17 +01:00
cogl-profile.h Initialize the cogl uprof state in cogl_create_context 2010-09-14 12:43:17 +01:00
cogl-program-private.h Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-program.c Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-rectangle-map.c cogl-rectangle-map: Record largest gap rather than the remaining space 2010-08-12 11:57:00 +01:00
cogl-rectangle-map.h cogl-atlas: Rename to CoglRectangleMap 2010-08-12 11:54:42 +01:00
cogl-shader-private.h Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-shader.c Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
cogl-shader.h cogl-shader: Add deprecation guards for cogl_program_uniform_* 2010-09-03 16:59:01 +01:00
cogl-spans.c Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-spans.h Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-sub-texture-private.h Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-sub-texture.c Rename the third texure coordinate from 'r' to 'p' 2010-07-13 14:29:07 +01:00
cogl-texture-2d-private.h Support foreign textures in the texture-2d and rectangle backends 2010-10-22 12:19:02 +01:00
cogl-texture-2d-sliced-private.h cogl-texture-2d-sliced: Use the other backends for the slices 2010-10-22 12:19:04 +01:00
cogl-texture-2d-sliced.c cogl-texture-2d-sliced: Use the other backends for the slices 2010-10-22 12:19:04 +01:00
cogl-texture-2d.c Support foreign textures in the texture-2d and rectangle backends 2010-10-22 12:19:02 +01:00
cogl-texture-3d-private.h cogl-bitmap: Encapsulate the CoglBitmap even internally 2010-07-15 17:24:01 +01:00
cogl-texture-3d.c profile: Update to uprof-0.3 dep for --enable-profile 2010-09-14 12:43:16 +01:00
cogl-texture-3d.h Add a Cogl texture 3D backend 2010-07-13 14:28:52 +01:00
cogl-texture-driver.h Add a Cogl texture 3D backend 2010-07-13 14:28:52 +01:00
cogl-texture-private.h cogl-bitmap: Encapsulate the CoglBitmap even internally 2010-07-15 17:24:01 +01:00
cogl-texture-rectangle-private.h Support foreign textures in the texture-2d and rectangle backends 2010-10-22 12:19:02 +01:00
cogl-texture-rectangle.c Support foreign textures in the texture-2d and rectangle backends 2010-10-22 12:19:02 +01:00
cogl-texture.c cogl: Adds {push,pop,get}_source functions 2010-10-26 12:08:20 +01:00
cogl-texture.h Remove mentions of the FSF address 2010-03-01 12:56:10 +00:00
cogl-types.h Move IndicesType and VerticesMode typedefs to cogl-types.h 2010-10-26 17:25:33 +01:00
cogl-util.c cogl: Make cogl_util_next_p2 internal and fix the documentation 2010-09-15 15:01:43 +01:00
cogl-util.h cogl: Make cogl_util_next_p2 internal and fix the documentation 2010-09-15 15:01:43 +01:00
cogl-vector.c math: Adds an experimental cogl_vector3_* API 2010-05-20 17:18:24 +01:00
cogl-vector.h cogl: declare experimental symbols consistently 2010-06-30 18:51:31 +01:00
cogl-vertex-buffer-private.h vertex-buffer: remove the unstrided CBO type 2010-10-26 12:38:15 +01:00
cogl-vertex-buffer.c vertex-buffer: remove the unstrided CBO type 2010-10-26 12:38:15 +01:00
cogl-vertex-buffer.h Move IndicesType and VerticesMode typedefs to cogl-types.h 2010-10-26 17:25:33 +01:00
cogl.c cogl: Use separate materials for set_source_color and texture 2010-10-27 15:07:03 +01:00
cogl.h cogl: Adds {push,pop,get}_source functions 2010-10-26 12:08:20 +01:00
cogl.pc.in Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys 2009-10-16 18:58:50 +01:00
Makefile.am Merge cogl-program-{gl,gles}.c into one cogl-program.c 2010-10-28 19:51:42 +01:00
stb_image.c Update stb_image.c 2010-03-03 17:02:51 +00:00