a8311e854652e250b2c4a854d2de962a02d3021f
[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_export.h"
31 #include "slang_execute.h"
32 #include "slang_compile_variable.h"
33 #include "slang_compile_struct.h"
34 #include "slang_compile_operation.h"
35 #include "slang_compile_function.h"
36
37 #if defined __cplusplus
38 extern "C" {
39 #endif
40
41 typedef enum slang_unit_type_
42 {
43 slang_unit_fragment_shader,
44 slang_unit_vertex_shader,
45 slang_unit_fragment_builtin,
46 slang_unit_vertex_builtin
47 } slang_unit_type;
48
49 typedef struct slang_var_pool_
50 {
51 GLuint next_addr;
52 } slang_var_pool;
53
54 typedef struct slang_code_unit_
55 {
56 slang_variable_scope vars;
57 slang_function_scope funs;
58 slang_struct_scope structs;
59 slang_unit_type type;
60 struct slang_code_object_ *object;
61 } slang_code_unit;
62
63 extern GLvoid
64 _slang_code_unit_ctr (slang_code_unit *, struct slang_code_object_ *);
65
66 extern GLvoid
67 _slang_code_unit_dtr (slang_code_unit *);
68
69 #define SLANG_BUILTIN_CORE 0
70 #define SLANG_BUILTIN_COMMON 1
71 #define SLANG_BUILTIN_TARGET 2
72
73 #if 0/*defined(USE_X86_ASM) || defined(SLANG_X86)*/
74 #define SLANG_BUILTIN_VEC4 3
75 #define SLANG_BUILTIN_TOTAL 4
76 #else
77 #define SLANG_BUILTIN_TOTAL 3
78 #endif
79
80 typedef struct slang_code_object_
81 {
82 slang_code_unit builtin[SLANG_BUILTIN_TOTAL];
83 slang_code_unit unit;
84 slang_assembly_file assembly;
85 slang_machine machine;
86 slang_var_pool varpool;
87 slang_atom_pool atompool;
88 slang_export_data_table expdata;
89 slang_export_code_table expcode;
90 } slang_code_object;
91
92 extern GLvoid
93 _slang_code_object_ctr (slang_code_object *);
94
95 extern GLvoid
96 _slang_code_object_dtr (slang_code_object *);
97
98 typedef struct slang_info_log_
99 {
100 char *text;
101 int dont_free_text;
102 } slang_info_log;
103
104 void slang_info_log_construct (slang_info_log *);
105 void slang_info_log_destruct (slang_info_log *);
106 int slang_info_log_print (slang_info_log *, const char *, ...);
107 int slang_info_log_error (slang_info_log *, const char *, ...);
108 int slang_info_log_warning (slang_info_log *, const char *, ...);
109 void slang_info_log_memory (slang_info_log *);
110
111 extern GLboolean
112 _slang_compile (GLcontext *ctx, struct gl_shader *shader);
113
114 #ifdef __cplusplus
115 }
116 #endif
117
118 #endif
119