-/*\r
- * Mesa 3-D graphics library\r
- * Version: 6.3\r
- *\r
- * Copyright (C) 2005 Brian Paul All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-#if !defined SLANG_COMPILE_H\r
-#define SLANG_COMPILE_H\r
-\r
-#if defined __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-typedef enum slang_type_qualifier_\r
-{\r
- slang_qual_none,\r
- slang_qual_const,\r
- slang_qual_attribute,\r
- slang_qual_varying,\r
- slang_qual_uniform,\r
- slang_qual_out,\r
- slang_qual_inout,\r
- slang_qual_fixedoutput, /* internal */\r
- slang_qual_fixedinput /* internal */\r
-} slang_type_qualifier;\r
-\r
-typedef enum slang_type_specifier_type_\r
-{\r
- slang_spec_void,\r
- slang_spec_bool,\r
- slang_spec_bvec2,\r
- slang_spec_bvec3,\r
- slang_spec_bvec4,\r
- slang_spec_int,\r
- slang_spec_ivec2,\r
- slang_spec_ivec3,\r
- slang_spec_ivec4,\r
- slang_spec_float,\r
- slang_spec_vec2,\r
- slang_spec_vec3,\r
- slang_spec_vec4,\r
- slang_spec_mat2,\r
- slang_spec_mat3,\r
- slang_spec_mat4,\r
- slang_spec_sampler1D,\r
- slang_spec_sampler2D,\r
- slang_spec_sampler3D,\r
- slang_spec_samplerCube,\r
- slang_spec_sampler1DShadow,\r
- slang_spec_sampler2DShadow,\r
- slang_spec_struct,\r
- slang_spec_array\r
-} slang_type_specifier_type;\r
-\r
-typedef struct slang_type_specifier_\r
-{\r
- slang_type_specifier_type type;\r
- struct slang_struct_ *_struct; /* spec_struct */\r
- struct slang_type_specifier_ *_array; /* spec_array */\r
-} slang_type_specifier;\r
-\r
-typedef struct slang_fully_specified_type_\r
-{\r
- slang_type_qualifier qualifier;\r
- slang_type_specifier specifier;\r
-} slang_fully_specified_type;\r
-\r
-typedef struct slang_variable_scope_\r
-{\r
- struct slang_variable_ *variables;\r
- unsigned int num_variables;\r
- struct slang_variable_scope_ *outer_scope;\r
-} slang_variable_scope;\r
-\r
-typedef enum slang_operation_type_\r
-{\r
- slang_oper_none,\r
- slang_oper_block_no_new_scope,\r
- slang_oper_block_new_scope,\r
- slang_oper_variable_decl,\r
- slang_oper_asm,\r
- slang_oper_break,\r
- slang_oper_continue,\r
- slang_oper_discard,\r
- slang_oper_return,\r
- slang_oper_expression,\r
- slang_oper_if,\r
- slang_oper_while,\r
- slang_oper_do,\r
- slang_oper_for,\r
- slang_oper_void,\r
- slang_oper_literal_bool,\r
- slang_oper_literal_int,\r
- slang_oper_literal_float,\r
- slang_oper_identifier,\r
- slang_oper_sequence,\r
- slang_oper_assign,\r
- slang_oper_addassign,\r
- slang_oper_subassign,\r
- slang_oper_mulassign,\r
- slang_oper_divassign,\r
- /*slang_oper_modassign,*/\r
- /*slang_oper_lshassign,*/\r
- /*slang_oper_rshassign,*/\r
- /*slang_oper_orassign,*/\r
- /*slang_oper_xorassign,*/\r
- /*slang_oper_andassign,*/\r
- slang_oper_select,\r
- slang_oper_logicalor,\r
- slang_oper_logicalxor,\r
- slang_oper_logicaland,\r
- /*slang_oper_bitor,*/\r
- /*slang_oper_bitxor,*/\r
- /*slang_oper_bitand,*/\r
- slang_oper_equal,\r
- slang_oper_notequal,\r
- slang_oper_less,\r
- slang_oper_greater,\r
- slang_oper_lessequal,\r
- slang_oper_greaterequal,\r
- /*slang_oper_lshift,*/\r
- /*slang_oper_rshift,*/\r
- slang_oper_add,\r
- slang_oper_subtract,\r
- slang_oper_multiply,\r
- slang_oper_divide,\r
- /*slang_oper_modulus,*/\r
- slang_oper_preincrement,\r
- slang_oper_predecrement,\r
- slang_oper_plus,\r
- slang_oper_minus,\r
- /*slang_oper_complement,*/\r
- slang_oper_not,\r
- slang_oper_subscript,\r
- slang_oper_call,\r
- slang_oper_field,\r
- slang_oper_postincrement,\r
- slang_oper_postdecrement\r
-} slang_operation_type;\r
-\r
-typedef struct slang_operation_\r
-{\r
- slang_operation_type type;\r
- struct slang_operation_ *children;\r
- unsigned int num_children;\r
- float literal; /* bool, literal_int, literal_float */\r
- char *identifier; /* asm, identifier, call, field */\r
- slang_variable_scope *locals;\r
-} slang_operation;\r
-\r
-typedef struct slang_variable_\r
-{\r
- slang_fully_specified_type type;\r
- char *name;\r
- slang_operation *array_size; /* spec_array */\r
- slang_operation *initializer;\r
-} slang_variable;\r
-\r
-typedef struct slang_struct_scope_\r
-{\r
- struct slang_struct_ *structs;\r
- unsigned int num_structs;\r
- struct slang_struct_scope_ *outer_scope;\r
-} slang_struct_scope;\r
-\r
-typedef struct slang_struct_\r
-{\r
- char *name;\r
- slang_variable_scope *fields;\r
- slang_struct_scope *structs;\r
-} slang_struct;\r
-\r
-typedef enum slang_function_kind_\r
-{\r
- slang_func_ordinary,\r
- slang_func_constructor,\r
- slang_func_operator\r
-} slang_function_kind;\r
-\r
-typedef struct slang_function_\r
-{\r
- slang_function_kind kind;\r
- slang_variable header;\r
- slang_variable_scope *parameters;\r
- unsigned int param_count;\r
- slang_operation *body;\r
-} slang_function;\r
-\r
-typedef struct slang_function_scope_\r
-{\r
- slang_function *functions;\r
- unsigned int num_functions;\r
- struct slang_function_scope_ *outer_scope;\r
-} slang_function_scope;\r
-\r
-typedef enum slang_unit_type_\r
-{\r
- slang_unit_fragment_shader,\r
- slang_unit_vertex_shader\r
-} slang_unit_type;\r
- \r
-typedef struct slang_translation_unit_\r
-{\r
- slang_variable_scope *globals;\r
- slang_function_scope functions;\r
- slang_struct_scope *structs;\r
- slang_unit_type type;\r
-} slang_translation_unit;\r
-\r
-int _slang_compile (const char *, slang_translation_unit *, slang_unit_type type);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#if !defined SLANG_COMPILE_H
+#define SLANG_COMPILE_H
+
+#include "imports.h"
+#include "mtypes.h"
+#include "slang_export.h"
+#include "slang_execute.h"
+#include "slang_compile_variable.h"
+#include "slang_compile_struct.h"
+#include "slang_compile_operation.h"
+#include "slang_compile_function.h"
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+typedef enum slang_unit_type_
+{
+ slang_unit_fragment_shader,
+ slang_unit_vertex_shader,
+ slang_unit_fragment_builtin,
+ slang_unit_vertex_builtin
+} slang_unit_type;
+
+typedef struct slang_var_pool_
+{
+ GLuint next_addr;
+} slang_var_pool;
+
+typedef struct slang_code_unit_
+{
+ slang_variable_scope vars;
+ slang_function_scope funs;
+ slang_struct_scope structs;
+ slang_unit_type type;
+ struct slang_code_object_ *object;
+} slang_code_unit;
+
+extern GLvoid
+_slang_code_unit_ctr (slang_code_unit *, struct slang_code_object_ *);
+
+extern GLvoid
+_slang_code_unit_dtr (slang_code_unit *);
+
+#define SLANG_BUILTIN_CORE 0
+#define SLANG_BUILTIN_COMMON 1
+#define SLANG_BUILTIN_TARGET 2
+
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+#define SLANG_BUILTIN_VEC4 3
+#define SLANG_BUILTIN_TOTAL 4
+#else
+#define SLANG_BUILTIN_TOTAL 3
+#endif
+
+typedef struct slang_code_object_
+{
+ slang_code_unit builtin[SLANG_BUILTIN_TOTAL];
+ slang_code_unit unit;
+ slang_assembly_file assembly;
+ slang_machine machine;
+ slang_var_pool varpool;
+ slang_atom_pool atompool;
+ slang_export_data_table expdata;
+ slang_export_code_table expcode;
+} slang_code_object;
+
+extern GLvoid
+_slang_code_object_ctr (slang_code_object *);
+
+extern GLvoid
+_slang_code_object_dtr (slang_code_object *);
+
+typedef struct slang_info_log_
+{
+ char *text;
+ int dont_free_text;
+} slang_info_log;
+
+void slang_info_log_construct (slang_info_log *);
+void slang_info_log_destruct (slang_info_log *);
+int slang_info_log_print (slang_info_log *, const char *, ...);
+int slang_info_log_error (slang_info_log *, const char *, ...);
+int slang_info_log_warning (slang_info_log *, const char *, ...);
+void slang_info_log_memory (slang_info_log *);
+
+extern GLboolean
+_slang_compile (const char *, slang_code_object *, slang_unit_type, slang_info_log *, struct gl_shader *shader);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+