if (dbg) printf("VARYING ");
}
else if (var->type.qualifier == SLANG_QUAL_ATTRIBUTE) {
+ /* attributes must be float, vec or mat */
+ if (!_slang_type_is_float_vec_mat(var->type.specifier.type)) {
+ slang_info_log_error(A->log,
+ "attribute '%s' must be float/vector/matrix",
+ varName);
+ return GL_FALSE;
+ }
+
if (prog) {
/* user-defined vertex attribute */
const GLint attr = -1; /* unknown */
/**
+ * Determine if a type is a float, float vector or float matrix.
+ * \return GL_TRUE if so, GL_FALSE otherwise
+ */
+GLboolean
+_slang_type_is_float_vec_mat(slang_type_specifier_type ty)
+{
+ switch (ty) {
+ case SLANG_SPEC_FLOAT:
+ case SLANG_SPEC_VEC2:
+ case SLANG_SPEC_VEC3:
+ case SLANG_SPEC_VEC4:
+ case SLANG_SPEC_MAT2:
+ case SLANG_SPEC_MAT3:
+ case SLANG_SPEC_MAT4:
+ case SLANG_SPEC_MAT23:
+ case SLANG_SPEC_MAT32:
+ case SLANG_SPEC_MAT24:
+ case SLANG_SPEC_MAT42:
+ case SLANG_SPEC_MAT34:
+ case SLANG_SPEC_MAT43:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
* Given a vector type, return the type of the vector's elements.
* For a matrix, return the type of the columns.
*/
extern GLboolean
_slang_type_is_vector(slang_type_specifier_type);
+extern GLboolean
+_slang_type_is_float_vec_mat(slang_type_specifier_type);
+
extern slang_type_specifier_type
_slang_type_base(slang_type_specifier_type);