pipeline: Add a snippet hook for the texture lookup

This adds a per-layer snippet hook for the texure lookup. Here the
snippet can modify the texture coordinates used for the lookup or
modify the texel resulting from the lookup. This is the first
per-layer hook so this also adds the
COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS state and all of the
boilerplate needed to make that work.

Most of the functions used by the pipeline state to manage the snippet
list has been moved into cogl-pipeline-snippet.c so that it can be
shared with the layer state.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts
2011-11-25 17:36:03 +00:00
committed by Robert Bragg
parent 4cdf66f89b
commit df0f9a862f
11 changed files with 420 additions and 148 deletions

View File

@ -32,18 +32,12 @@
#include "cogl-queue.h"
/* Enumeration of all the hook points that a snippet can be attached
to within a pipeline. Note that although there are currently only
two points that directly correspond to the two state flags, the
idea isn't that each new enum here will mean a state flag. The
state flags are just intended to mark the split between hooks that
affect the fragment shader and hooks that affect the vertex
shader. For example, if we add a hook to wrap around the processing
for a particular layer then that hook would be part of the fragment
snippets state. */
to within a pipeline. */
typedef enum
{
COGL_PIPELINE_SNIPPET_HOOK_VERTEX,
COGL_PIPELINE_SNIPPET_HOOK_FRAGMENT
COGL_PIPELINE_SNIPPET_HOOK_FRAGMENT,
COGL_PIPELINE_SNIPPET_HOOK_TEXTURE_LOOKUP
} CoglPipelineSnippetHook;
typedef struct _CoglPipelineSnippet CoglPipelineSnippet;
@ -99,5 +93,25 @@ typedef struct
void
_cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data);
void
_cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list);
void
_cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list,
CoglPipelineSnippetHook hook,
CoglSnippet *snippet);
void
_cogl_pipeline_snippet_list_copy (CoglPipelineSnippetList *dst,
const CoglPipelineSnippetList *src);
void
_cogl_pipeline_snippet_list_hash (CoglPipelineSnippetList *list,
unsigned int *hash);
gboolean
_cogl_pipeline_snippet_list_equal (CoglPipelineSnippetList *list0,
CoglPipelineSnippetList *list1);
#endif /* __COGL_PIPELINE_SNIPPET_PRIVATE_H */