summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/library/slang_shader.syn
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/slang/library/slang_shader.syn')
-rw-r--r--src/mesa/shader/slang/library/slang_shader.syn44
1 files changed, 40 insertions, 4 deletions
diff --git a/src/mesa/shader/slang/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn
index 47245e0d87..760dfbcea7 100644
--- a/src/mesa/shader/slang/library/slang_shader.syn
+++ b/src/mesa/shader/slang/library/slang_shader.syn
@@ -178,6 +178,9 @@
.emtcode TYPE_SPECIFIER_MAT34 30
.emtcode TYPE_SPECIFIER_MAT43 31
+/* optional array size. Ex: "float[6] myarray;" */
+.emtcode TYPE_ARRAY_SIZE 220
+.emtcode TYPE_NO_ARRAY_SIZE 221
/* structure field */
.emtcode FIELD_NONE 0
@@ -248,6 +251,7 @@
.emtcode OP_POSTINCREMENT 60
.emtcode OP_POSTDECREMENT 61
.emtcode OP_PRECISION 62
+.emtcode OP_METHOD 63
/* parameter qualifier */
.emtcode PARAM_QUALIFIER_IN 0
@@ -339,6 +343,25 @@ integer_expression
* <function_call> ::= <function_call_generic>
*/
function_call
+ function_call_or_method;
+
+/*
+ * <function_call_or_method> ::= <regular_function_call>
+ * | <postfix_expression> "." <function_call_generic>
+ */
+function_call_or_method
+ regular_function_call .or method_call;
+
+/*
+ * <method_call> ::= <identifier> "." <function_call_generic>
+ */
+method_call
+ identifier .emit OP_METHOD .and dot .and function_call_generic .and .true .emit OP_END;
+
+/*
+ * <regular_function_call> ::= <function_call_generic>
+ */
+regular_function_call
function_call_generic .emit OP_CALL .and .true .emit OP_END;
/*
@@ -885,14 +908,22 @@ single_declaration_6
constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;
/*
- * <fully_specified_type> ::= <opt_invariant> <opt_centroid> <opt_qualifer> <opt_precision> <type_specifier>
+ * <fully_specified_type> ::= <opt_invariant> <opt_centroid> <opt_qualifer> <opt_precision> <type_specifier> <opt_array_size>
*
- * Example: "invariant varying highp vec3"
+ * Example: "invariant varying highp vec3 [4]"
+ *
+ * Note that the *_space version doesn't parse the array size, make sure it is being invoked after the *_nospace version.
*/
fully_specified_type_space
- fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space;
+ fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space .and .true .emit TYPE_NO_ARRAY_SIZE;
fully_specified_type_nospace
- fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_nospace;
+ fully_specified_type_optinvariant .and fully_specified_type_optcentroid .and fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_array;
+type_specifier_array
+ type_specifier_array_1 .or type_specifier_array_2;
+type_specifier_array_1
+ type_specifier_space .and array_size;
+type_specifier_array_2
+ type_specifier_nospace .and opt_array_size;
fully_specified_type_optinvariant
fully_specified_type_invariant .or .true .emit TYPE_VARIANT;
fully_specified_type_invariant
@@ -909,6 +940,11 @@ fully_specified_type_optprec
fully_specified_type_prec .or .true .emit PRECISION_DEFAULT;
fully_specified_type_prec
precision .and space;
+opt_array_size
+ array_size .or .true .emit TYPE_NO_ARRAY_SIZE;
+array_size
+ lbracket .emit TYPE_ARRAY_SIZE .and constant_expression .and rbracket;
+
/*
* <invariant_qualifier> ::= "invariant"