remove stray tab
[mesa.git] / src / mesa / shader / slang / slang_export.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 *
5 * Copyright (C) 2006 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 #if !defined SLANG_EXPORT_H
26 #define SLANG_EXPORT_H
27
28 #include "slang_utility.h"
29
30 #if defined __cplusplus
31 extern "C" {
32 #endif
33
34 /*
35 * Basic data quantity to transfer between application and assembly.
36 * The <size> is the actual size of the data quantity including padding, if any. It is
37 * used to calculate offsets from the beginning of the data.
38 * If the <array_len> is not 0, the data quantity is an array of <array_len> size.
39 * If the <structure> is not NULL, the data quantity is a struct. The <basic_type> is
40 * invalid and the <field_count> holds the size of the <structure> array.
41 * The <basic_type> values match those of <type> parameter for glGetActiveUniformARB.
42 */
43
44 typedef struct slang_export_data_quant_
45 {
46 slang_atom name;
47 GLuint size;
48 GLuint array_len;
49 struct slang_export_data_quant_ *structure;
50 union
51 {
52 GLenum basic_type;
53 GLuint field_count;
54 } u;
55 } slang_export_data_quant;
56
57 GLvoid slang_export_data_quant_ctr (slang_export_data_quant *);
58 GLvoid slang_export_data_quant_dtr (slang_export_data_quant *);
59 slang_export_data_quant *slang_export_data_quant_add_field (slang_export_data_quant *);
60
61 /*
62 * Returns GL_FALSE if the quant is not an array.
63 */
64 GLboolean slang_export_data_quant_array (slang_export_data_quant *);
65
66 /*
67 * Returns GL_FALSE if the quant is not a structure.
68 */
69 GLboolean slang_export_data_quant_struct (slang_export_data_quant *);
70
71 /*
72 * Returns GL_TRUE if the quant is neither an array nor a structure.
73 */
74 GLboolean slang_export_data_quant_simple (slang_export_data_quant *);
75
76 /*
77 * Returns basic type of the quant. It must not be a structure.
78 */
79 GLenum slang_export_data_quant_type (slang_export_data_quant *);
80
81 /*
82 * Returns number of fields in the quant that is a structure.
83 */
84 GLuint slang_export_data_quant_fields (slang_export_data_quant *);
85
86 /*
87 * Return number of elements in the quant.
88 * For arrays, return the size of the array.
89 * Otherwise, return 1.
90 */
91 GLuint slang_export_data_quant_elements (slang_export_data_quant *);
92
93 /*
94 * Returns total number of components withing the quant element.
95 */
96 GLuint slang_export_data_quant_components (slang_export_data_quant *);
97
98 /*
99 * Returns size of the quant element.
100 */
101 GLuint slang_export_data_quant_size (slang_export_data_quant *);
102
103 /*
104 * Data access pattern. Specifies how data is accessed at what frequency.
105 */
106
107 typedef enum
108 {
109 slang_exp_uniform,
110 slang_exp_varying,
111 slang_exp_attribute
112 } slang_export_data_access;
113
114 /*
115 * Data export entry. Holds the data type information, access pattern and base address.
116 */
117
118 typedef struct
119 {
120 slang_export_data_quant quant;
121 slang_export_data_access access;
122 GLuint address;
123 } slang_export_data_entry;
124
125 GLvoid slang_export_data_entry_ctr (slang_export_data_entry *);
126 GLvoid slang_export_data_entry_dtr (slang_export_data_entry *);
127
128 /*
129 * Data export table.
130 */
131
132 typedef struct
133 {
134 slang_export_data_entry *entries;
135 GLuint count;
136 slang_atom_pool *atoms;
137 } slang_export_data_table;
138
139 GLvoid slang_export_data_table_ctr (slang_export_data_table *);
140 GLvoid slang_export_data_table_dtr (slang_export_data_table *);
141 slang_export_data_entry *slang_export_data_table_add (slang_export_data_table *);
142
143 /*
144 * Code export entry. Contains label name and its entry point (label, address).
145 */
146
147 typedef struct
148 {
149 slang_atom name;
150 GLuint address;
151 } slang_export_code_entry;
152
153 /*
154 * Code export table.
155 */
156
157 typedef struct
158 {
159 slang_export_code_entry *entries;
160 GLuint count;
161 slang_atom_pool *atoms;
162 } slang_export_code_table;
163
164 GLvoid slang_export_code_table_ctr (slang_export_code_table *);
165 GLvoid slang_export_code_table_dtr (slang_export_code_table *);
166 slang_export_code_entry *slang_export_code_table_add (slang_export_code_table *);
167
168 /*
169 * _slang_find_exported_data()
170 *
171 * Parses the name string and returns corresponding data entry, data quantity and offset.
172 * Returns GL_TRUE if the data is found, returns GL_FALSE otherwise.
173 */
174
175 GLboolean _slang_find_exported_data (slang_export_data_table *, const char *,
176 slang_export_data_entry **, slang_export_data_quant **, GLuint *);
177
178 #ifdef __cplusplus
179 }
180 #endif
181
182 #endif
183