Add fragment and vertex snippet hooks for global declarations
This adds hook points to add global function and variable declarations to either the fragment or vertex shader. The declarations can then be used by subsequent snippets. Only the ‘declarations’ string of the snippet is used and the code is directly put in the global scope near the top of the shader. The reason this is necessary rather than just adding a normal snippet with the declarations is that for the other hooks Cogl assumes that the snippets are independent of each other. That means if a snippet has a replace string then it will assume that it doesn't even need to generate the code for earlier hooks which means the global declarations would be lost. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit ebb82d5b0bc30487b7101dc66b769160b40f92ca)
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
* Copyright (C) 2011, 2013 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -89,6 +89,11 @@ typedef struct
|
||||
void
|
||||
_cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data);
|
||||
|
||||
void
|
||||
_cogl_pipeline_snippet_generate_declarations (GString *declarations_buf,
|
||||
CoglSnippetHook hook,
|
||||
CoglPipelineSnippetList *list);
|
||||
|
||||
void
|
||||
_cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list);
|
||||
|
||||
|
Reference in New Issue
Block a user