#define SLANG_STORAGE_H
#include "slang_compile.h"
+#include "slang_assemble.h"
+#include "slang_execute.h"
#if defined __cplusplus
extern "C" {
*
* For now, only the three basic types are supported, that is bool, int and float. Other built-in
* types like vector or matrix can easily be decomposed into a series of basic types.
+ *
+ * If the vec4 module is enabled, 4-component vectors of floats are used when possible. 4x4 matrices
+ * are constructed of 4 vec4 slots.
*/
typedef enum slang_storage_type_
{
- slang_stor_aggregate,
- slang_stor_bool,
- slang_stor_int,
- slang_stor_float
+ /* core */
+ slang_stor_aggregate,
+ slang_stor_bool,
+ slang_stor_int,
+ slang_stor_float,
+ /* vec4 */
+ slang_stor_vec4
} slang_storage_type;
/*
* elements. They are also required to support indirect addressing. That is, if B references
* first data slot in the array, S is the size of the data slot and I is the integral index that
* is not known at compile time, B+I*S references I-th data slot.
- *\r
+ *
* This structure is also used to break down built-in data types that are not supported directly.
* Vectors, like vec3, are constructed from arrays of their basic types. Matrices are formed of
* an array of column vectors, which are in turn processed as other vectors.
GLuint count;
} slang_storage_aggregate;
-struct slang_assembly_name_space_;
-
GLboolean slang_storage_aggregate_construct (slang_storage_aggregate *);
GLvoid slang_storage_aggregate_destruct (slang_storage_aggregate *);
-GLboolean _slang_aggregate_variable (slang_storage_aggregate *, struct slang_type_specifier_ *,
- GLuint, struct slang_function_scope_ *, slang_struct_scope *,
- slang_variable_scope *, struct slang_machine_ *, struct slang_assembly_file_ *,\r
- slang_atom_pool *);\r
-\r
-GLboolean _slang_evaluate_int (struct slang_assembly_file_ *, struct slang_machine_ *,\r
- struct slang_assembly_name_space_ *, struct slang_operation_ *, GLuint *, slang_atom_pool *);
+extern GLboolean
+_slang_aggregate_variable(slang_storage_aggregate *agg,
+ slang_type_specifier *spec,
+ GLuint array_len,
+ slang_function_scope *funcs,
+ slang_struct_scope *structs,
+ slang_variable_scope *vars,
+ slang_machine *mach,
+ slang_assembly_file *file,
+ slang_atom_pool *atoms);
+
+extern GLboolean
+_slang_evaluate_int(slang_assembly_file *file,
+ slang_machine *pmach,
+ slang_assembly_name_space *space,
+ slang_operation *array_size,
+ GLuint *pint,
+ slang_atom_pool *atoms);
+
+/*
+ * Returns the size (in machine units) of the given storage type.
+ * It is an error to pass-in slang_stor_aggregate.
+ * Returns 0 on error.
+ */
+extern GLuint
+_slang_sizeof_type (slang_storage_type);
/*
* Returns total size (in machine units) of the given aggregate.