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.
This commit is contained in:
Neil Roberts
2011-06-30 15:55:56 +01:00
parent d69d49fada
commit 461bff1867
7 changed files with 249 additions and 152 deletions

View File

@ -42,6 +42,7 @@
#include "cogl-bitmask.h"
#include "cogl-atlas.h"
#include "cogl-texture-driver.h"
#include "cogl-pipeline-cache.h"
typedef struct
{
@ -106,9 +107,7 @@ struct _CoglContext
int legacy_state_set;
#ifdef HAVE_COGL_GL
GHashTable *arbfp_cache;
#endif
CoglPipelineCache *pipeline_cache;
/* Textures */
CoglHandle default_gl_texture_2d_tex;