Merge branch 'origin' into glsl-compiler-1
[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 "imports.h"
29 #include "mtypes.h"
30 #include "slang_typeinfo.h"
31 #include "slang_compile_variable.h"
32 #include "slang_compile_struct.h"
33 #include "slang_compile_operation.h"
34 #include "slang_compile_function.h"
35
36 #if defined __cplusplus
37 extern "C" {
38 #endif
39
40 typedef enum slang_unit_type_
41 {
42 SLANG_UNIT_FRAGMENT_SHADER,
43 SLANG_UNIT_VERTEX_SHADER,
44 SLANG_UNIT_FRAGMENT_BUILTIN,
45 SLANG_UNIT_VERTEX_BUILTIN
46 } slang_unit_type;
47
48
49 typedef struct slang_var_pool_
50 {
51 GLuint next_addr;
52 } slang_var_pool;
53
54
55 typedef struct slang_code_unit_
56 {
57 slang_variable_scope vars;
58 slang_function_scope funs;
59 slang_struct_scope structs;
60 slang_unit_type type;
61 struct slang_code_object_ *object;
62 } slang_code_unit;
63
64
65 extern GLvoid
66 _slang_code_unit_ctr (slang_code_unit *, struct slang_code_object_ *);
67
68 extern GLvoid
69 _slang_code_unit_dtr (slang_code_unit *);
70
71 #define SLANG_BUILTIN_CORE 0
72 #define SLANG_BUILTIN_COMMON 1
73 #define SLANG_BUILTIN_TARGET 2
74
75 #define SLANG_BUILTIN_TOTAL 3
76
77 typedef struct slang_code_object_
78 {
79 slang_code_unit builtin[SLANG_BUILTIN_TOTAL];
80 slang_code_unit unit;
81 slang_var_pool varpool;
82 slang_atom_pool atompool;
83 } slang_code_object;
84
85 extern GLvoid
86 _slang_code_object_ctr (slang_code_object *);
87
88 extern GLvoid
89 _slang_code_object_dtr (slang_code_object *);
90
91 extern GLboolean
92 _slang_compile (GLcontext *ctx, struct gl_shader *shader);
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif
99