@galacean/engine-shader-compiler 2.0.0-alpha.49 → 2.0.0-alpha.50

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-shader-compiler",
3
- "version": "2.0.0-alpha.49",
3
+ "version": "2.0.0-alpha.50",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -57,11 +57,11 @@
57
57
  ],
58
58
  "dependencies": {
59
59
  "@rollup/pluginutils": "^5.0.0",
60
- "@galacean/engine-math": "2.0.0-alpha.49",
61
- "@galacean/engine-core": "2.0.0-alpha.49"
60
+ "@galacean/engine-math": "2.0.0-alpha.50",
61
+ "@galacean/engine-core": "2.0.0-alpha.50"
62
62
  },
63
63
  "devDependencies": {
64
- "@galacean/engine-design": "2.0.0-alpha.49"
64
+ "@galacean/engine-design": "2.0.0-alpha.50"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "rollup -c rollup.config.js && node -e \"require('fs').chmodSync('bundler/cli.js', 0o755)\"",
@@ -3,9 +3,9 @@ import { ShaderRange } from "./common/ShaderRange";
3
3
  export declare class GSError extends Error {
4
4
  readonly location: ShaderRange | ShaderPosition;
5
5
  readonly source: string;
6
- readonly file?: string;
6
+ readonly file?: string | undefined;
7
7
  static wrappingLineCount: number;
8
- constructor(name: GSErrorName, message: string, location: ShaderRange | ShaderPosition, source: string, file?: string);
8
+ constructor(name: GSErrorName, message: string, location: ShaderRange | ShaderPosition, source: string, file?: string | undefined);
9
9
  toString(): string;
10
10
  }
11
11
  export declare enum GSErrorName {
@@ -11,7 +11,7 @@ export declare abstract class CodeGenVisitor {
11
11
  readonly errors: Error[];
12
12
  abstract getAttributeProp(prop: StructProp): string;
13
13
  abstract getVaryingProp(prop: StructProp): string;
14
- abstract getMRTProp(prop: StructProp): string;
14
+ abstract getMRTProp(prop: StructProp): string | null;
15
15
  protected static _tmpArrayPool: ReturnableObjectPool<TempArray<string>>;
16
16
  defaultCodeGen(children: NodeChild[]): string;
17
17
  visitPostfixExpression(node: ASTNode.PostfixExpression): string;
@@ -6,7 +6,7 @@ export declare class GLES100Visitor extends GLESVisitor {
6
6
  static getVisitor(): GLES100Visitor;
7
7
  getAttributeProp(prop: StructProp): string;
8
8
  getVaryingProp(prop: StructProp): string;
9
- getMRTProp(): string;
9
+ getMRTProp(): string | null;
10
10
  visitPostfixExpression(node: ASTNode.PostfixExpression): string;
11
11
  visitJumpStatement(node: ASTNode.JumpStatement): string;
12
12
  }
@@ -34,9 +34,9 @@ export declare class VisitorContext {
34
34
  _structVarMap: Record<string, StructRole>;
35
35
  _passSymbolTable: SymbolTable<SymbolInfo>;
36
36
  reset(resetAll?: boolean): void;
37
- isAttributeStruct(type: string): boolean;
38
- isVaryingStruct(type: string): boolean;
39
- isMRTStruct(type: string): boolean;
37
+ isAttributeStruct(type: string | undefined): boolean;
38
+ isVaryingStruct(type: string | undefined): boolean;
39
+ isMRTStruct(type: string | undefined): boolean;
40
40
  /** Return the role of a struct type, or undefined if it isn't one of the IO roles. */
41
41
  getStructRole(typeLexeme: string): StructRole | undefined;
42
42
  /** Register a variable as holding a value of a varying/attribute/mrt struct type. */
@@ -3,11 +3,11 @@ export declare class SymbolTable<T extends IBaseSymbol> {
3
3
  private _table;
4
4
  insert(symbol: T, isInMacroBranch?: boolean): void;
5
5
  getSymbol(symbol: T, includeMacro?: boolean): T | undefined;
6
- getSymbols(symbol: T, includeMacro: boolean, out: T[]): T[];
6
+ getSymbols(symbol: T, includeMacro: boolean | undefined, out: T[]): T[];
7
7
  /**
8
8
  * @internal
9
9
  */
10
- _getSymbols(symbol: T, includeMacro: boolean, out: T[]): T[];
10
+ _getSymbols(symbol: T, includeMacro: boolean | undefined, out: T[]): T[];
11
11
  /** Iterate every registered symbol. Order within a name bucket is insertion order. */
12
12
  forEach(callback: (symbol: T) => void): void;
13
13
  }
@@ -13,5 +13,5 @@ export declare class SymbolTableStack<S extends IBaseSymbol, T extends SymbolTab
13
13
  popScope(): T | undefined;
14
14
  insert(symbol: S): void;
15
15
  lookup(symbol: S, includeMacro?: boolean): S | undefined;
16
- lookupAll(symbol: S, includeMacro: boolean, out: S[]): S[];
16
+ lookupAll(symbol: S, includeMacro: boolean | undefined, out: S[]): S[];
17
17
  }
@@ -13,7 +13,7 @@ export default class GrammarUtils {
13
13
  /** the ast node */
14
14
  astTypePool?: ClearableObjectPool<{
15
15
  set: (loc: ShaderRange, children: NodeChild[]) => void;
16
- } & IPoolElement & TreeNode>): [GrammarSymbol[], TranslationRule][];
16
+ } & IPoolElement & TreeNode>): [GrammarSymbol[], TranslationRule | undefined][];
17
17
  static addMapSetItem<K, T>(map: Map<K, Set<T>>, k: K, v: T): void;
18
18
  static isSubSet<T>(sa: Set<T>, sb: Set<T>): boolean;
19
19
  static isActionEqual(a: ActionInfo, b: ActionInfo): boolean;
@@ -87,7 +87,7 @@ export declare namespace ASTNode {
87
87
  semanticAnalyze(sa: SemanticAnalyzer): void;
88
88
  }
89
89
  export class SingleDeclaration extends TreeNode {
90
- typeSpecifier: TypeSpecifier;
90
+ typeSpecifier: TypeSpecifier | undefined;
91
91
  arraySpecifier?: ArraySpecifier;
92
92
  init(): void;
93
93
  semanticAnalyze(sa: SemanticAnalyzer): void;
@@ -166,7 +166,7 @@ export declare namespace ASTNode {
166
166
  export class FunctionProtoType extends TreeNode {
167
167
  ident: BaseToken;
168
168
  returnType: FullySpecifiedType;
169
- parameterList: IParamInfo[];
169
+ parameterList: IParamInfo[] | undefined;
170
170
  paramSig: GalaceanDataType[] | undefined;
171
171
  semanticAnalyze(sa: SemanticAnalyzer): void;
172
172
  }
@@ -378,7 +378,7 @@ export declare namespace ASTNode {
378
378
  semanticAnalyze(sa: SemanticAnalyzer): void;
379
379
  }
380
380
  export class VariableIdentifier extends TreeNode {
381
- typeInfo: GalaceanDataType;
381
+ typeInfo: GalaceanDataType | undefined;
382
382
  referenceGlobalSymbolNames: string[];
383
383
  private _symbols;
384
384
  init(): void;
@@ -6,6 +6,6 @@ export declare class Grammar {
6
6
  static create(start: NoneTerminal, productions: GrammarSymbol[][]): Grammar;
7
7
  constructor(start: NoneTerminal, productions: Production[]);
8
8
  getProductionList(nonTerminal: NoneTerminal): Production[];
9
- isNullableNT(NT: NoneTerminal): Production;
10
- getProductionByID(pid: number): Production;
9
+ isNullableNT(NT: NoneTerminal): Production | undefined;
10
+ getProductionByID(pid: number): Production | undefined;
11
11
  }
@@ -19,11 +19,11 @@ export default class SemanticAnalyzer {
19
19
  */
20
20
  static _lookupSymbol: SymbolInfo;
21
21
  semanticStack: TreeNode[];
22
- acceptRule?: TranslationRule;
22
+ acceptRule?: TranslationRule | undefined;
23
23
  symbolTableStack: SymbolTableStack<SymbolInfo, SymbolTable<SymbolInfo>>;
24
24
  curFunctionInfo: {
25
25
  header?: ASTNode.FunctionDeclarator;
26
- returnStatement?: ASTNode.JumpStatement;
26
+ returnStatement?: ASTNode.JumpStatement | null;
27
27
  };
28
28
  private _shaderData;
29
29
  private _translationRuleTable;
@@ -34,9 +34,9 @@ export default class SemanticAnalyzer {
34
34
  constructor();
35
35
  reset(macroDefineList: MacroDefineList): void;
36
36
  pushScope(): void;
37
- popScope(): SymbolTable<SymbolInfo>;
37
+ popScope(): SymbolTable<SymbolInfo> | undefined;
38
38
  addTranslationRule(pid: number, rule: TranslationRule): void;
39
- getTranslationRule(pid: number): TranslationRule<any>;
39
+ getTranslationRule(pid: number): TranslationRule<any> | undefined;
40
40
  reportError(loc: ShaderRange, message: string): void;
41
41
  reportWarning(loc: ShaderRange, message: string): void;
42
42
  }
@@ -7,5 +7,5 @@ export declare class BuiltinVariable {
7
7
  scope: EShaderStage;
8
8
  private constructor();
9
9
  static createVariable(lexeme: string, type: GalaceanDataType, scope?: EShaderStage): void;
10
- static getVar(ident: string): BuiltinVariable;
10
+ static getVar(ident: string): BuiltinVariable | undefined;
11
11
  }
@@ -3,6 +3,6 @@ import { ASTNode } from "../AST";
3
3
  export declare class SymbolDataType {
4
4
  type: GalaceanDataType;
5
5
  typeLexeme: string;
6
- arraySpecifier?: ASTNode.ArraySpecifier;
7
- constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier);
6
+ arraySpecifier?: ASTNode.ArraySpecifier | undefined;
7
+ constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier | undefined);
8
8
  }
@@ -11,12 +11,12 @@ export declare enum ESymbolType {
11
11
  export type SymbolAstNode = ASTNode.Initializer | ASTNode.StructSpecifier | ASTNode.FunctionDefinition | ASTNode.ParameterDeclarator | ASTNode.InitDeclaratorList | ASTNode.VariableDeclaration;
12
12
  export declare class SymbolInfo implements IBaseSymbol {
13
13
  ident: string;
14
- type: ESymbolType;
15
- astNode?: SymbolAstNode;
16
- dataType?: SymbolDataType;
17
- paramSignature?: GalaceanDataType[];
14
+ type: ESymbolType | null;
15
+ astNode?: SymbolAstNode | undefined;
16
+ dataType?: SymbolDataType | undefined;
17
+ paramSignature?: GalaceanDataType[] | undefined;
18
18
  isInMacroBranch: boolean;
19
- constructor(ident: string, type: ESymbolType, astNode?: SymbolAstNode, dataType?: SymbolDataType, paramSignature?: GalaceanDataType[], isInMacroBranch?: boolean);
19
+ constructor(ident: string, type: ESymbolType | null, astNode?: SymbolAstNode | undefined, dataType?: SymbolDataType | undefined, paramSignature?: GalaceanDataType[] | undefined, isInMacroBranch?: boolean);
20
20
  set(ident: string, symbolType: ESymbolType, astNode?: SymbolAstNode, dataType?: SymbolDataType, paramSignature?: GalaceanDataType[]): void;
21
21
  equal(symbol: SymbolInfo): boolean;
22
22
  }
@@ -6,15 +6,15 @@ export type TraceStackItem = NoneTerminal | BaseToken;
6
6
  export declare class SymbolType {
7
7
  type: GalaceanDataType;
8
8
  typeLexeme: string;
9
- arraySpecifier?: ASTNode.ArraySpecifier;
10
- constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier);
9
+ arraySpecifier?: ASTNode.ArraySpecifier | undefined;
10
+ constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier | undefined);
11
11
  }
12
12
  export declare class StructProp implements IParamInfo {
13
13
  typeInfo: SymbolType;
14
14
  ident: BaseToken;
15
- mrtIndex?: number;
15
+ mrtIndex?: number | undefined;
16
16
  isInMacroBranch: boolean;
17
- constructor(typeInfo: SymbolType, ident: BaseToken, mrtIndex?: number, isInMacroBranch?: boolean);
17
+ constructor(typeInfo: SymbolType, ident: BaseToken, mrtIndex?: number | undefined, isInMacroBranch?: boolean);
18
18
  }
19
19
  export type NodeChild = TreeNode | BaseToken;
20
20
  export type IParamInfo = {
@@ -1,10 +1,10 @@
1
1
  import { IBaseSymbol } from "../common/IBaseSymbol";
2
2
  export declare class ShaderSourceSymbol implements IBaseSymbol {
3
3
  ident: string;
4
- type: number;
4
+ type: number | null;
5
5
  value?: any;
6
6
  isInMacroBranch: boolean;
7
- constructor(ident: string, type: number, value?: any);
7
+ constructor(ident: string, type: number | null, value?: any);
8
8
  set(ident: string, type: number, value?: any): void;
9
9
  equal(other: ShaderSourceSymbol): boolean;
10
10
  }
@@ -10,7 +10,7 @@ export default class SourceLexer extends BaseLexer {
10
10
  private static _scanDigits;
11
11
  scanNumber(): number;
12
12
  scanColor(): Color;
13
- scanToken(): BaseToken;
13
+ scanToken(): BaseToken | undefined;
14
14
  scanToCharacter(char: string): void;
15
15
  createCompileError(message: string, location?: ShaderPosition | ShaderRange): Error;
16
16
  private _scanWord;