@galacean/engine-shader-compiler 0.0.0-experimental-2.0-spine.0
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/LICENSE +21 -0
- package/README.md +43 -0
- package/bundler/cli.js +341 -0
- package/bundler/precompile.cjs.js +324 -0
- package/bundler/precompile.js +294 -0
- package/bundler/rollup.cjs.js +368 -0
- package/bundler/rollup.js +341 -0
- package/dist/browser.js +8938 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.min.js +2 -0
- package/dist/browser.min.js.map +1 -0
- package/dist/browser.verbose.js +9601 -0
- package/dist/browser.verbose.js.map +1 -0
- package/dist/browser.verbose.min.js +2 -0
- package/dist/browser.verbose.min.js.map +1 -0
- package/dist/main.js +8935 -0
- package/dist/main.js.map +1 -0
- package/dist/main.verbose.js +9598 -0
- package/dist/main.verbose.js.map +1 -0
- package/dist/module.js +8928 -0
- package/dist/module.js.map +1 -0
- package/dist/module.verbose.js +9591 -0
- package/dist/module.verbose.js.map +1 -0
- package/package.json +69 -0
- package/types/GSError.d.ts +16 -0
- package/types/ParserUtils.d.ts +39 -0
- package/types/Preprocessor.d.ts +30 -0
- package/types/ShaderCompiler.d.ts +21 -0
- package/types/ShaderCompilerUtils.d.ts +10 -0
- package/types/ShaderInstructionEncoder.d.ts +1 -0
- package/types/TempArray.d.ts +5 -0
- package/types/bundler/cli.d.ts +1 -0
- package/types/bundler/precompile.d.ts +25 -0
- package/types/bundler/rollup.d.ts +41 -0
- package/types/codeGen/CodeGenVisitor.d.ts +1 -0
- package/types/codeGen/GLES100.d.ts +12 -0
- package/types/codeGen/GLES300.d.ts +20 -0
- package/types/codeGen/GLESVisitor.d.ts +1 -0
- package/types/codeGen/VisitorContext.d.ts +2 -0
- package/types/codeGen/index.d.ts +3 -0
- package/types/codeGen/types.d.ts +12 -0
- package/types/common/BaseLexer.d.ts +2 -0
- package/types/common/BaseToken.d.ts +35 -0
- package/types/common/IBaseSymbol.d.ts +5 -0
- package/types/common/ShaderPosition.d.ts +8 -0
- package/types/common/ShaderRange.d.ts +8 -0
- package/types/common/SymbolTable.d.ts +9 -0
- package/types/common/SymbolTableStack.d.ts +13 -0
- package/types/common/enums/Keyword.d.ts +124 -0
- package/types/common/enums/ShaderStage.d.ts +5 -0
- package/types/common/index.d.ts +5 -0
- package/types/common/types.d.ts +101 -0
- package/types/index.d.ts +3 -0
- package/types/lalr/CFG.d.ts +5 -0
- package/types/lalr/LALR1.d.ts +27 -0
- package/types/lalr/Production.d.ts +9 -0
- package/types/lalr/State.d.ts +20 -0
- package/types/lalr/StateItem.d.ts +20 -0
- package/types/lalr/Utils.d.ts +22 -0
- package/types/lalr/index.d.ts +2 -0
- package/types/lalr/types.d.ts +14 -0
- package/types/lexer/Lexer.d.ts +143 -0
- package/types/lexer/index.d.ts +1 -0
- package/types/parser/AST.d.ts +502 -0
- package/types/parser/Grammar.d.ts +11 -0
- package/types/parser/GrammarSymbol.d.ts +128 -0
- package/types/parser/SemanticAnalyzer.d.ts +2 -0
- package/types/parser/ShaderInfo.d.ts +10 -0
- package/types/parser/ShaderTargetParser.d.ts +24 -0
- package/types/parser/builtin/functions.d.ts +34 -0
- package/types/parser/builtin/index.d.ts +2 -0
- package/types/parser/builtin/variables.d.ts +11 -0
- package/types/parser/index.d.ts +2 -0
- package/types/parser/symbolTable/FnSymbol.d.ts +6 -0
- package/types/parser/symbolTable/StructSymbol.d.ts +6 -0
- package/types/parser/symbolTable/SymbolDataType.d.ts +8 -0
- package/types/parser/symbolTable/SymbolInfo.d.ts +22 -0
- package/types/parser/symbolTable/VarSymbol.d.ts +8 -0
- package/types/parser/symbolTable/index.d.ts +6 -0
- package/types/parser/types.d.ts +24 -0
- package/types/sourceParser/ShaderSourceFactory.d.ts +8 -0
- package/types/sourceParser/ShaderSourceParser.d.ts +1 -0
- package/types/sourceParser/ShaderSourceSymbol.d.ts +10 -0
- package/types/sourceParser/SourceLexer.d.ts +19 -0
- package/types/sourceParser/index.d.ts +1 -0
- package/verbose/package.json +11 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GalaceanDataType } from "../../common";
|
|
2
|
+
import { EShaderStage } from "../../common/enums/ShaderStage";
|
|
3
|
+
export declare enum GenericType {
|
|
4
|
+
GenType = 200,
|
|
5
|
+
GenIntType = 201,
|
|
6
|
+
GenUintType = 202,
|
|
7
|
+
GenBoolType = 203,
|
|
8
|
+
Mat = 204,
|
|
9
|
+
BoolVec = 205,
|
|
10
|
+
IntVec = 206,
|
|
11
|
+
UintVec = 207,
|
|
12
|
+
Vec = 208,
|
|
13
|
+
GVec4 = 209,
|
|
14
|
+
GSampler2D = 210,
|
|
15
|
+
GSampler3D = 211,
|
|
16
|
+
GSamplerCube = 212,
|
|
17
|
+
GSampler2DArray = 213
|
|
18
|
+
}
|
|
19
|
+
export type NonGenericGalaceanType = Exclude<GalaceanDataType, string>;
|
|
20
|
+
type BuiltinType = NonGenericGalaceanType | GenericType;
|
|
21
|
+
export declare class BuiltinFunction {
|
|
22
|
+
ident: string;
|
|
23
|
+
readonly args: BuiltinType[];
|
|
24
|
+
readonly scope: EShaderStage;
|
|
25
|
+
private _returnType;
|
|
26
|
+
private _realReturnType;
|
|
27
|
+
get realReturnType(): NonGenericGalaceanType;
|
|
28
|
+
private constructor();
|
|
29
|
+
static _create(ident: string, returnType: BuiltinType, ...args: BuiltinType[]): void;
|
|
30
|
+
static _createWithScope(ident: string, returnType: BuiltinType, scope: EShaderStage, ...args: BuiltinType[]): void;
|
|
31
|
+
static resolveOverload(funcName: string, callArgTypes: NonGenericGalaceanType[] | undefined): BuiltinFunction | undefined;
|
|
32
|
+
static isExist(ident: string): boolean;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GalaceanDataType } from "../../common";
|
|
2
|
+
import { EShaderStage } from "../../common/enums/ShaderStage";
|
|
3
|
+
export declare const BuiltinVariableTable: Map<string, BuiltinVariable>;
|
|
4
|
+
export declare class BuiltinVariable {
|
|
5
|
+
type: GalaceanDataType;
|
|
6
|
+
lexeme: string;
|
|
7
|
+
scope: EShaderStage;
|
|
8
|
+
private constructor();
|
|
9
|
+
static createVariable(lexeme: string, type: GalaceanDataType, scope?: EShaderStage): void;
|
|
10
|
+
static getVar(ident: string): BuiltinVariable;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GalaceanDataType } from "../../common";
|
|
2
|
+
import { ASTNode } from "../AST";
|
|
3
|
+
export declare class SymbolDataType {
|
|
4
|
+
type: GalaceanDataType;
|
|
5
|
+
typeLexeme: string;
|
|
6
|
+
arraySpecifier?: ASTNode.ArraySpecifier;
|
|
7
|
+
constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier);
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IBaseSymbol } from "../../common/IBaseSymbol";
|
|
2
|
+
import { GalaceanDataType } from "../../common/types";
|
|
3
|
+
import { ASTNode } from "../AST";
|
|
4
|
+
import { SymbolDataType } from "./SymbolDataType";
|
|
5
|
+
export declare enum ESymbolType {
|
|
6
|
+
VAR = 0,
|
|
7
|
+
FN = 1,
|
|
8
|
+
STRUCT = 2,
|
|
9
|
+
Any = 3
|
|
10
|
+
}
|
|
11
|
+
export type SymbolAstNode = ASTNode.Initializer | ASTNode.StructSpecifier | ASTNode.FunctionDefinition | ASTNode.ParameterDeclarator | ASTNode.InitDeclaratorList | ASTNode.VariableDeclaration;
|
|
12
|
+
export declare class SymbolInfo implements IBaseSymbol {
|
|
13
|
+
ident: string;
|
|
14
|
+
type: ESymbolType;
|
|
15
|
+
astNode?: SymbolAstNode;
|
|
16
|
+
dataType?: SymbolDataType;
|
|
17
|
+
paramSignature?: GalaceanDataType[];
|
|
18
|
+
isInMacroBranch: boolean;
|
|
19
|
+
constructor(ident: string, type: ESymbolType, astNode?: SymbolAstNode, dataType?: SymbolDataType, paramSignature?: GalaceanDataType[], isInMacroBranch?: boolean);
|
|
20
|
+
set(ident: string, symbolType: ESymbolType, astNode?: SymbolAstNode, dataType?: SymbolDataType, paramSignature?: GalaceanDataType[]): void;
|
|
21
|
+
equal(symbol: SymbolInfo): boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ASTNode } from "../AST";
|
|
2
|
+
import { SymbolDataType } from "./SymbolDataType";
|
|
3
|
+
import { SymbolInfo } from "./SymbolInfo";
|
|
4
|
+
export declare class VarSymbol extends SymbolInfo {
|
|
5
|
+
astNode: ASTNode.Initializer | ASTNode.ParameterDeclarator | ASTNode.InitDeclaratorList | ASTNode.VariableDeclaration;
|
|
6
|
+
readonly isGlobalVariable: boolean;
|
|
7
|
+
constructor(ident: string, dataType: SymbolDataType, isGlobalVariable: boolean, initAst: ASTNode.Initializer | ASTNode.ParameterDeclarator | ASTNode.InitDeclaratorList | ASTNode.VariableDeclaration);
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GalaceanDataType } from "../common";
|
|
2
|
+
import { BaseToken } from "../common/BaseToken";
|
|
3
|
+
import { ASTNode, TreeNode } from "./AST";
|
|
4
|
+
import { NoneTerminal } from "./GrammarSymbol";
|
|
5
|
+
export type TraceStackItem = NoneTerminal | BaseToken;
|
|
6
|
+
export declare class SymbolType {
|
|
7
|
+
type: GalaceanDataType;
|
|
8
|
+
typeLexeme: string;
|
|
9
|
+
arraySpecifier?: ASTNode.ArraySpecifier;
|
|
10
|
+
constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier);
|
|
11
|
+
}
|
|
12
|
+
export declare class StructProp implements IParamInfo {
|
|
13
|
+
typeInfo: SymbolType;
|
|
14
|
+
ident: BaseToken;
|
|
15
|
+
mrtIndex?: number;
|
|
16
|
+
isInMacroBranch: boolean;
|
|
17
|
+
constructor(typeInfo: SymbolType, ident: BaseToken, mrtIndex?: number, isInMacroBranch?: boolean);
|
|
18
|
+
}
|
|
19
|
+
export type NodeChild = TreeNode | BaseToken;
|
|
20
|
+
export type IParamInfo = {
|
|
21
|
+
ident?: BaseToken;
|
|
22
|
+
typeInfo?: SymbolType;
|
|
23
|
+
astNode?: ASTNode.ParameterDeclaration | ASTNode.MacroParamBlock;
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IRenderStates, IShaderPassSource, IShaderSource, ISubShaderSource } from "@galacean/engine-design";
|
|
2
|
+
export declare class ShaderSourceFactory {
|
|
3
|
+
static createRenderStates(): IRenderStates;
|
|
4
|
+
static createShaderSource(name: string): IShaderSource;
|
|
5
|
+
static createSubShaderSource(name: string): ISubShaderSource;
|
|
6
|
+
static createShaderPassSource(name: string): IShaderPassSource;
|
|
7
|
+
static createUsePass(name: string): IShaderPassSource;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IBaseSymbol } from "../common/IBaseSymbol";
|
|
2
|
+
export declare class ShaderSourceSymbol implements IBaseSymbol {
|
|
3
|
+
ident: string;
|
|
4
|
+
type: number;
|
|
5
|
+
value?: any;
|
|
6
|
+
isInMacroBranch: boolean;
|
|
7
|
+
constructor(ident: string, type: number, value?: any);
|
|
8
|
+
set(ident: string, type: number, value?: any): void;
|
|
9
|
+
equal(other: ShaderSourceSymbol): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Color } from "@galacean/engine-math";
|
|
2
|
+
import { ShaderPosition, ShaderRange } from "../common";
|
|
3
|
+
import { BaseLexer } from "../common/BaseLexer";
|
|
4
|
+
import { BaseToken } from "../common/BaseToken";
|
|
5
|
+
export default class SourceLexer extends BaseLexer {
|
|
6
|
+
hasPendingContent: boolean;
|
|
7
|
+
private static _keywordLexemeTable;
|
|
8
|
+
private static _symbolLexemeTable;
|
|
9
|
+
private static _isWordSeparatorChar;
|
|
10
|
+
private static _scanDigits;
|
|
11
|
+
scanNumber(): number;
|
|
12
|
+
scanColor(): Color;
|
|
13
|
+
scanToken(): BaseToken;
|
|
14
|
+
scanToCharacter(char: string): void;
|
|
15
|
+
createCompileError(message: string, location?: ShaderPosition | ShaderRange): Error;
|
|
16
|
+
private _scanWord;
|
|
17
|
+
private _validateWordBoundaries;
|
|
18
|
+
private _isValidWordBoundary;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShaderSourceParser } from "./ShaderSourceParser";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"license": "MIT",
|
|
3
|
+
"main": "../dist/main.verbose.js",
|
|
4
|
+
"module": "../dist/module.verbose.js",
|
|
5
|
+
"browser": "../dist/browser.verbose.min.js",
|
|
6
|
+
"debug": "../src/index.ts",
|
|
7
|
+
"types": "../types/index.d.ts",
|
|
8
|
+
"umd": {
|
|
9
|
+
"name": "Galacean.ShaderCompiler"
|
|
10
|
+
}
|
|
11
|
+
}
|