More GLSL code:
[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 #if defined __cplusplus
29 extern "C" {
30 #endif
31
32 /*
33 * Basic data quantity to transfer between application and assembly.
34 * The <size> is the actual size of the data quantity including padding, if any. It is
35 * used to calculate offsets from the beginning of the data.
36 * The <array_len> is not 0, the data quantity is an array of <array_len> size.
37 * If the <structure> is not NULL, the data quantity is a struct. The <basic_type> is
38 * invalid and the <field_count> holds the size of the <structure> array.
39 * The <basic_type> values match those of <type> parameter for glGetActiveUniformARB.
40 */
41
42 typedef struct slang_export_data_quant_
43 {
44 slang_atom name;
45 GLuint size;
46 GLuint array_len;
47 struct slang_export_data_quant_ *structure;
48 union
49 {
50 GLenum basic_type;
51 GLuint field_count;
52 } u;
53 } slang_export_data_quant;
54
55 GLvoid slang_export_data_quant_ctr (slang_export_data_quant *);
56 GLvoid slang_export_data_quant_dtr (slang_export_data_quant *);
57 slang_export_data_quant *slang_export_data_quant_add_field (slang_export_data_quant *);
58
59 /*
60 * Data access pattern. Specifies how data is accessed at what frequency.
61 */
62
63 typedef enum
64 {
65 slang_exp_uniform,
66 slang_exp_varying,
67 slang_exp_attribute
68 } slang_export_data_access;
69
70 /*
71 * Data export entry. Holds the data type information, access pattern and base address.
72 */
73
74 typedef struct
75 {
76 slang_export_data_quant quant;
77 slang_export_data_access access;
78 GLuint address;
79 } slang_export_data_entry;
80
81 GLvoid slang_export_data_entry_ctr (slang_export_data_entry *);
82 GLvoid slang_export_data_entry_dtr (slang_export_data_entry *);
83
84 /*
85 * Data export table. Holds <count> elements in <entries> array.
86 */
87
88 typedef struct
89 {
90 slang_export_data_entry *entries;
91 GLuint count;
92 slang_atom_pool *atoms;
93 } slang_export_data_table;
94
95 GLvoid slang_export_data_table_ctr (slang_export_data_table *);
96 GLvoid slang_export_data_table_dtr (slang_export_data_table *);
97 slang_export_data_entry *slang_export_data_table_add (slang_export_data_table *);
98
99 /*
100 * _slang_find_exported_data()
101 *
102 * Parses the name string and returns corresponding data entry, data quantity and offset.
103 * Returns GL_TRUE if the data is found, returns GL_FALSE otherwise.
104 */
105
106 GLboolean _slang_find_exported_data (slang_export_data_table *, const char *,
107 slang_export_data_entry **, slang_export_data_quant **, GLuint *);
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif
114