GLSL fixes:
[mesa.git] / src / mesa / shader / slang / slang_compile.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 *
5 * Copyright (C) 2005-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_COMPILE_H
26 #define SLANG_COMPILE_H
27
28 #include "slang_export.h"
29 #include "slang_execute.h"
30 #include "slang_compile_variable.h"
31 #include "slang_compile_struct.h"
32 #include "slang_compile_operation.h"
33 #include "slang_compile_function.h"
34
35 #if defined __cplusplus
36 extern "C" {
37 #endif
38
39 typedef enum slang_unit_type_
40 {
41 slang_unit_fragment_shader,
42 slang_unit_vertex_shader,
43 slang_unit_fragment_builtin,
44 slang_unit_vertex_builtin
45 } slang_unit_type;
46
47 typedef struct slang_var_pool_
48 {
49 GLuint next_addr;
50 } slang_var_pool;
51
52 typedef struct slang_translation_unit_
53 {
54 slang_variable_scope globals;
55 slang_function_scope functions;
56 slang_struct_scope structs;
57 slang_unit_type type;
58 slang_assembly_file *assembly;
59 int free_assembly;
60 slang_var_pool *global_pool;
61 int free_global_pool;
62 slang_machine *machine;
63 int free_machine;
64 slang_atom_pool *atom_pool;
65 int free_atom_pool;
66 slang_export_data_table exp_data;
67 slang_export_code_table exp_code;
68 } slang_translation_unit;
69
70 int slang_translation_unit_construct (slang_translation_unit *);
71 int slang_translation_unit_construct2 (slang_translation_unit *, slang_assembly_file *,
72 slang_var_pool *, slang_machine *, slang_atom_pool *);
73 void slang_translation_unit_destruct (slang_translation_unit *);
74
75 typedef struct slang_info_log_
76 {
77 char *text;
78 int dont_free_text;
79 } slang_info_log;
80
81 void slang_info_log_construct (slang_info_log *);
82 void slang_info_log_destruct (slang_info_log *);
83 int slang_info_log_error (slang_info_log *, const char *, ...);
84 int slang_info_log_warning (slang_info_log *, const char *, ...);
85 void slang_info_log_memory (slang_info_log *);
86
87 int _slang_compile (const char *, slang_translation_unit *, slang_unit_type type, slang_info_log *);
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif
94