"Initial commit to Gerrit"
[profile/ivi/cogl.git] / cogl / cogl-pipeline-snippet-private.h
1 /*
2  * Cogl
3  *
4  * An object oriented GL/GLES Abstraction/Utility Layer
5  *
6  * Copyright (C) 2011 Intel Corporation.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see
20  * <http://www.gnu.org/licenses/>.
21  *
22  *
23  *
24  * Authors:
25  *   Neil Roberts <neil@linux.intel.com>
26  */
27
28 #ifndef __COGL_PIPELINE_SNIPPET_PRIVATE_H
29 #define __COGL_PIPELINE_SNIPPET_PRIVATE_H
30
31 #include "cogl-snippet.h"
32 #include "cogl-queue.h"
33
34 typedef struct _CoglPipelineSnippet CoglPipelineSnippet;
35
36 COGL_LIST_HEAD (CoglPipelineSnippetList, CoglPipelineSnippet);
37
38 struct _CoglPipelineSnippet
39 {
40   COGL_LIST_ENTRY (CoglPipelineSnippet) list_node;
41
42   CoglSnippet *snippet;
43 };
44
45 /* Arguments to pass to _cogl_pipeline_snippet_generate_code() */
46 typedef struct
47 {
48   CoglPipelineSnippetList *snippets;
49
50   /* Only snippets at this hook point will be used */
51   CoglSnippetHook hook;
52
53   /* The final function to chain on to after all of the snippets code
54      has been run */
55   const char *chain_function;
56
57   /* The name of the final generated function */
58   const char *final_name;
59
60   /* A prefix to insert before each generate function name */
61   const char *function_prefix;
62
63   /* The return type of all of the functions, or NULL to use void */
64   const char *return_type;
65
66   /* A variable to return from the functions. The snippets are
67      expected to modify this variable. Ignored if return_type is
68      NULL */
69   const char *return_variable;
70
71   /* If this is TRUE then it won't allocate a separate variable for
72      the return value. Instead it is expected that the snippet will
73      modify one of the argument variables directly and that will be
74      returned */
75   gboolean return_variable_is_argument;
76
77   /* The argument names or NULL if there are none */
78   const char *arguments;
79
80   /* The argument types or NULL */
81   const char *argument_declarations;
82
83   /* The string to generate the source into */
84   GString *source_buf;
85 } CoglPipelineSnippetData;
86
87 void
88 _cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data);
89
90 void
91 _cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list);
92
93 void
94 _cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list,
95                                  CoglSnippet *snippet);
96
97 void
98 _cogl_pipeline_snippet_list_copy (CoglPipelineSnippetList *dst,
99                                   const CoglPipelineSnippetList *src);
100
101 void
102 _cogl_pipeline_snippet_list_hash (CoglPipelineSnippetList *list,
103                                   unsigned int *hash);
104
105 gboolean
106 _cogl_pipeline_snippet_list_equal (CoglPipelineSnippetList *list0,
107                                    CoglPipelineSnippetList *list1);
108
109 #endif /* __COGL_PIPELINE_SNIPPET_PRIVATE_H */
110