2 * Mesa 3-D graphics library
5 * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
25 #if !defined SLANG_COMPILE_H
26 #define SLANG_COMPILE_H
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"
35 #if defined __cplusplus
39 typedef enum slang_unit_type_
41 slang_unit_fragment_shader
,
42 slang_unit_vertex_shader
,
43 slang_unit_fragment_builtin
,
44 slang_unit_vertex_builtin
47 typedef struct slang_var_pool_
52 typedef struct slang_code_unit_
54 slang_variable_scope vars
;
55 slang_function_scope funs
;
56 slang_struct_scope structs
;
58 struct slang_code_object_
*object
;
62 _slang_code_unit_ctr (slang_code_unit
*, struct slang_code_object_
*);
65 _slang_code_unit_dtr (slang_code_unit
*);
67 #define SLANG_BUILTIN_CORE 0
68 #define SLANG_BUILTIN_COMMON 1
69 #define SLANG_BUILTIN_TARGET 2
71 #if defined(USE_X86_ASM) || defined(SLANG_X86)
72 #define SLANG_BUILTIN_VEC4 3
73 #define SLANG_BUILTIN_TOTAL 4
75 #define SLANG_BUILTIN_TOTAL 3
78 typedef struct slang_code_object_
80 slang_code_unit builtin
[SLANG_BUILTIN_TOTAL
];
82 slang_assembly_file assembly
;
83 slang_machine machine
;
84 slang_var_pool varpool
;
85 slang_atom_pool atompool
;
86 slang_export_data_table expdata
;
87 slang_export_code_table expcode
;
91 _slang_code_object_ctr (slang_code_object
*);
94 _slang_code_object_dtr (slang_code_object
*);
96 typedef struct slang_info_log_
102 void slang_info_log_construct (slang_info_log
*);
103 void slang_info_log_destruct (slang_info_log
*);
104 int slang_info_log_print (slang_info_log
*, const char *, ...);
105 int slang_info_log_error (slang_info_log
*, const char *, ...);
106 int slang_info_log_warning (slang_info_log
*, const char *, ...);
107 void slang_info_log_memory (slang_info_log
*);
110 _slang_compile (const char *, slang_code_object
*, slang_unit_type
, slang_info_log
*);