@galacean/engine-shaderlab 1.4.0-alpha.3 → 1.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-shaderlab",
3
- "version": "1.4.0-alpha.3",
3
+ "version": "1.4.0-beta.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,11 +26,11 @@
26
26
  "verbose/package.json"
27
27
  ],
28
28
  "devDependencies": {
29
- "@galacean/engine": "1.4.0-alpha.3",
30
- "@galacean/engine-design": "1.4.0-alpha.3"
29
+ "@galacean/engine-design": "1.4.0-beta.1",
30
+ "@galacean/engine": "1.4.0-beta.1"
31
31
  },
32
32
  "peerDependencies": {
33
- "@galacean/engine": "1.4.0-alpha.3"
33
+ "@galacean/engine": "1.4.0-beta.1"
34
34
  },
35
35
  "scripts": {
36
36
  "b:types": "tsc"
@@ -66,6 +66,7 @@ export declare enum ETokenType {
66
66
  COLON = 1033,
67
67
  /** = */
68
68
  EQUAL = 1034,
69
+ /** ; */
69
70
  SEMICOLON = 1035,
70
71
  /** ! */
71
72
  BANG = 1036,
@@ -3,5 +3,5 @@ export default class LexerUtils {
3
3
  static isLetter(charCode: number): boolean;
4
4
  static isAlpha(charCode: number): boolean;
5
5
  static isPpCharactors(charCode: number): boolean;
6
- static isSpace(charCode: number): charCode is 9 | 10 | 32;
6
+ static isSpace(charCode: number): charCode is 9 | 10 | 13 | 32;
7
7
  }
@@ -22,6 +22,9 @@ export declare abstract class TreeNode implements IPoolElement {
22
22
  init(): void;
23
23
  dispose(): void;
24
24
  codeGen(visitor: CodeGenVisitor): string;
25
+ /**
26
+ * Do semantic analyze right after the ast node is generated.
27
+ */
25
28
  semanticAnalyze(sa: SematicAnalyzer): void;
26
29
  }
27
30
  export declare namespace ASTNode {
@@ -107,6 +110,7 @@ export declare namespace ASTNode {
107
110
  get type(): GalaceanDataType;
108
111
  get lexeme(): string;
109
112
  get arraySize(): number;
113
+ get arraySpecifier(): ArraySpecifier;
110
114
  get isCustom(): boolean;
111
115
  }
112
116
  export class ArraySpecifier extends TreeNode {
@@ -304,9 +308,14 @@ export declare namespace ASTNode {
304
308
  get arraySpecifier(): ArraySpecifier | undefined;
305
309
  }
306
310
  export class VariableDeclaration extends TreeNode {
311
+ type: FullySpecifiedType;
307
312
  semanticAnalyze(sa: SematicAnalyzer): void;
308
313
  codeGen(visitor: CodeGenVisitor): string;
309
314
  }
315
+ export class VariableDeclarationList extends TreeNode {
316
+ type: FullySpecifiedType;
317
+ semanticAnalyze(sa: SematicAnalyzer): void;
318
+ }
310
319
  export class VariableIdentifier extends TreeNode {
311
320
  symbolInfo: VarSymbol | BuiltinVariable | null;
312
321
  get lexeme(): string;
@@ -5,101 +5,103 @@ export declare enum NoneTerminal {
5
5
  gs_shader_program = 2001,
6
6
  global_declaration = 2002,
7
7
  variable_declaration = 2003,
8
- array_specifier_list = 2004,
9
- array_specifier = 2005,
10
- ext_builtin_type_specifier_nonarray = 2006,
11
- precision_specifier = 2007,
12
- variable_identifier = 2008,
13
- variable_identifier_node = 2009,
14
- primary_expression = 2010,
15
- postfix_expression = 2011,
16
- integer_expression = 2012,
17
- function_call = 2013,
18
- function_call_generic = 2014,
19
- function_call_header_no_parameters = 2015,
20
- function_call_header_with_parameters = 2016,
21
- function_call_parameter_list = 2017,
22
- function_call_header = 2018,
23
- function_identifier = 2019,
24
- constructor_identifier = 2020,
25
- unary_expression = 2021,
26
- unary_operator = 2022,
27
- multiplicative_expression = 2023,
28
- additive_expression = 2024,
29
- shift_expression = 2025,
30
- relational_expression = 2026,
31
- equality_expression = 2027,
32
- and_expression = 2028,
33
- inclusive_or_expression = 2029,
34
- exclusive_or_expression = 2030,
35
- logical_and_expression = 2031,
36
- logical_xor_expression = 2032,
37
- logical_or_expression = 2033,
38
- conditional_expression = 2034,
39
- assignment_expression = 2035,
40
- assignment_operator = 2036,
41
- expression = 2037,
42
- integer_constant_expression = 2038,
43
- integer_constant_expression_operator = 2039,
44
- declaration = 2040,
45
- function_prototype = 2041,
46
- function_declarator = 2042,
47
- function_header_with_parameters = 2043,
48
- function_header = 2044,
49
- function_parameter_list = 2045,
50
- parameter_declarator = 2046,
51
- parameter_declaration = 2047,
52
- parameter_qualifier = 2048,
53
- parameter_type_specifier = 2049,
54
- init_declarator_list = 2050,
55
- single_declaration = 2051,
56
- fully_specified_type = 2052,
57
- type_qualifier = 2053,
58
- single_type_qualifier = 2054,
59
- storage_qualifier = 2055,
60
- precision_qualifier = 2056,
61
- interpolation_qualifier = 2057,
62
- invariant_qualifier = 2058,
63
- type_specifier = 2059,
64
- type_specifier_nonarray = 2060,
65
- type_specifier_no_prec = 2061,
66
- basic_type = 2062,
67
- struct_specifier = 2063,
68
- struct_declaration_list = 2064,
69
- struct_declaration = 2065,
70
- layout_qualifier = 2066,
71
- struct_declarator_list = 2067,
72
- struct_declarator = 2068,
73
- identifier_list = 2069,
74
- decl_identifier = 2070,
75
- initializer = 2071,
76
- initializer_list = 2072,
77
- declaration_statement = 2073,
78
- simple_statement = 2074,
79
- compound_statement_no_scope = 2075,
80
- statement_with_scope = 2076,
81
- compound_statement = 2077,
82
- statement = 2078,
83
- statement_list = 2079,
84
- iteration_statement_no_new_scope = 2080,
85
- expression_statement = 2081,
86
- selection_statement = 2082,
87
- selection_rest_statement = 2083,
88
- condition = 2084,
89
- conditionopt = 2085,
90
- iteration_statement = 2086,
91
- for_init_statement = 2087,
92
- for_rest_statement = 2088,
93
- jump_statement = 2089,
94
- external_declaration = 2090,
95
- function_definition = 2091,
96
- field_selection = 2092,
97
- bool_constant = 2093,
98
- function_identifier_node = 2094,
99
- typename_identifier_node = 2095,
100
- scope_brace = 2096,
101
- scope_end_brace = 2097,
102
- _ignore = 2098
8
+ variable_declaration_list = 2004,
9
+ variable_declaration_statement = 2005,
10
+ array_specifier_list = 2006,
11
+ array_specifier = 2007,
12
+ ext_builtin_type_specifier_nonarray = 2008,
13
+ precision_specifier = 2009,
14
+ variable_identifier = 2010,
15
+ variable_identifier_node = 2011,
16
+ primary_expression = 2012,
17
+ postfix_expression = 2013,
18
+ integer_expression = 2014,
19
+ function_call = 2015,
20
+ function_call_generic = 2016,
21
+ function_call_header_no_parameters = 2017,
22
+ function_call_header_with_parameters = 2018,
23
+ function_call_parameter_list = 2019,
24
+ function_call_header = 2020,
25
+ function_identifier = 2021,
26
+ constructor_identifier = 2022,
27
+ unary_expression = 2023,
28
+ unary_operator = 2024,
29
+ multiplicative_expression = 2025,
30
+ additive_expression = 2026,
31
+ shift_expression = 2027,
32
+ relational_expression = 2028,
33
+ equality_expression = 2029,
34
+ and_expression = 2030,
35
+ inclusive_or_expression = 2031,
36
+ exclusive_or_expression = 2032,
37
+ logical_and_expression = 2033,
38
+ logical_xor_expression = 2034,
39
+ logical_or_expression = 2035,
40
+ conditional_expression = 2036,
41
+ assignment_expression = 2037,
42
+ assignment_operator = 2038,
43
+ expression = 2039,
44
+ integer_constant_expression = 2040,
45
+ integer_constant_expression_operator = 2041,
46
+ declaration = 2042,
47
+ function_prototype = 2043,
48
+ function_declarator = 2044,
49
+ function_header_with_parameters = 2045,
50
+ function_header = 2046,
51
+ function_parameter_list = 2047,
52
+ parameter_declarator = 2048,
53
+ parameter_declaration = 2049,
54
+ parameter_qualifier = 2050,
55
+ parameter_type_specifier = 2051,
56
+ init_declarator_list = 2052,
57
+ single_declaration = 2053,
58
+ fully_specified_type = 2054,
59
+ type_qualifier = 2055,
60
+ single_type_qualifier = 2056,
61
+ storage_qualifier = 2057,
62
+ precision_qualifier = 2058,
63
+ interpolation_qualifier = 2059,
64
+ invariant_qualifier = 2060,
65
+ type_specifier = 2061,
66
+ type_specifier_nonarray = 2062,
67
+ type_specifier_no_prec = 2063,
68
+ basic_type = 2064,
69
+ struct_specifier = 2065,
70
+ struct_declaration_list = 2066,
71
+ struct_declaration = 2067,
72
+ layout_qualifier = 2068,
73
+ struct_declarator_list = 2069,
74
+ struct_declarator = 2070,
75
+ identifier_list = 2071,
76
+ decl_identifier = 2072,
77
+ initializer = 2073,
78
+ initializer_list = 2074,
79
+ declaration_statement = 2075,
80
+ simple_statement = 2076,
81
+ compound_statement_no_scope = 2077,
82
+ statement_with_scope = 2078,
83
+ compound_statement = 2079,
84
+ statement = 2080,
85
+ statement_list = 2081,
86
+ iteration_statement_no_new_scope = 2082,
87
+ expression_statement = 2083,
88
+ selection_statement = 2084,
89
+ selection_rest_statement = 2085,
90
+ condition = 2086,
91
+ conditionopt = 2087,
92
+ iteration_statement = 2088,
93
+ for_init_statement = 2089,
94
+ for_rest_statement = 2090,
95
+ jump_statement = 2091,
96
+ external_declaration = 2092,
97
+ function_definition = 2093,
98
+ field_selection = 2094,
99
+ bool_constant = 2095,
100
+ function_identifier_node = 2096,
101
+ typename_identifier_node = 2097,
102
+ scope_brace = 2098,
103
+ scope_end_brace = 2099,
104
+ _ignore = 2100
103
105
  }
104
106
  export type GrammarSymbol = Terminal | NoneTerminal;
105
107
  export type Derivation = GrammarSymbol[];
@@ -19,17 +19,16 @@ export declare enum EGenType {
19
19
  export type NonGenericGalaceanType = Exclude<GalaceanDataType, string>;
20
20
  type BuiltinType = NonGenericGalaceanType | EGenType;
21
21
  export declare class BuiltinFunction {
22
- private _returnType;
23
22
  ident: string;
24
23
  readonly args: BuiltinType[];
25
24
  readonly scope: EShaderStage;
25
+ private _returnType;
26
+ private _realReturnType;
27
+ get realReturnType(): NonGenericGalaceanType;
26
28
  private constructor();
27
29
  static getReturnType(fn: BuiltinFunction, genType?: NonGenericGalaceanType): NonGenericGalaceanType;
28
30
  static _create(ident: string, returnType: BuiltinType, ...args: BuiltinType[]): void;
29
31
  static _createWithScop(ident: string, returnType: BuiltinType, scope: EShaderStage, ...args: BuiltinType[]): void;
30
- static getFn(ident: string, ...args: BuiltinType[]): {
31
- fun: BuiltinFunction;
32
- genType: Exclude<GalaceanDataType, string>;
33
- } | undefined;
32
+ static getFn(ident: string, parameterTypes: NonGenericGalaceanType[]): BuiltinFunction | undefined;
34
33
  }
35
34
  export {};