@galacean/engine-shaderlab 2.0.0-alpha.24 → 2.0.0-alpha.26

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": "2.0.0-alpha.24",
3
+ "version": "2.0.0-alpha.26",
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": "2.0.0-alpha.24",
30
- "@galacean/engine-design": "2.0.0-alpha.24"
29
+ "@galacean/engine-design": "2.0.0-alpha.26",
30
+ "@galacean/engine": "2.0.0-alpha.26"
31
31
  },
32
32
  "peerDependencies": {
33
- "@galacean/engine": "2.0.0-alpha.24"
33
+ "@galacean/engine": "2.0.0-alpha.26"
34
34
  },
35
35
  "scripts": {
36
36
  "b:types": "tsc"
@@ -0,0 +1 @@
1
+ export type { ShaderInstruction } from "@galacean/engine-design";
@@ -1,5 +1,5 @@
1
- import { ShaderMacro, ShaderLanguage } from "@galacean/engine";
2
- import { IShaderLab, IShaderSource } from "@galacean/engine-design";
1
+ import { ShaderLanguage } from "@galacean/engine";
2
+ import { IPrecompiledShader, IShaderLab, IShaderSource } from "@galacean/engine-design";
3
3
  import { IShaderProgramSource } from "@galacean/engine-design/types/shader-lab/IShaderProgramSource";
4
4
  import { ShaderPosition, ShaderRange } from "./common";
5
5
  export declare class ShaderLab implements IShaderLab {
@@ -11,5 +11,6 @@ export declare class ShaderLab implements IShaderLab {
11
11
  static createRange(start: ShaderPosition, end: ShaderPosition): ShaderRange;
12
12
  _parseShaderSource(sourceCode: string): IShaderSource;
13
13
  _parseShaderPass(source: string, vertexEntry: string, fragmentEntry: string, backend: ShaderLanguage, basePathForIncludeKey: string): IShaderProgramSource | undefined;
14
- _parseMacros(content: string, macros: ShaderMacro[]): string;
14
+ _precompile(sourceCode: string, platformTarget: ShaderLanguage, basePath: string): IPrecompiledShader;
15
+ private _serializeRenderStates;
15
16
  }
@@ -1,13 +0,0 @@
1
- import { ShaderRange } from "../common";
2
- import { BaseToken } from "../common/BaseToken";
3
- export declare class MacroDefine {
4
- readonly macro: BaseToken;
5
- readonly body?: BaseToken;
6
- readonly location?: ShaderRange;
7
- readonly args?: BaseToken[];
8
- private _replaceRegex?;
9
- private readonly _argsLexemes?;
10
- get isFunction(): boolean;
11
- constructor(macro: BaseToken, body?: BaseToken, location?: ShaderRange, args?: BaseToken[]);
12
- expandFunctionBody(args: string[]): string;
13
- }
@@ -1,7 +0,0 @@
1
- import { ShaderRange } from "../common";
2
- import { BlockInfo } from "./sourceMap";
3
- export interface ExpandSegment {
4
- block?: BlockInfo;
5
- rangeInBlock: ShaderRange;
6
- replace: string;
7
- }
@@ -1,32 +0,0 @@
1
- import { ShaderPosition, ShaderRange } from "../common";
2
- import PpSourceMap from "./sourceMap";
3
- import { BaseLexer } from "../common/BaseLexer";
4
- import { BaseToken } from "../common/BaseToken";
5
- import { MacroParserToken } from "./constants";
6
- export type OnToken = (token: BaseToken, scanner: MacroParserLexer) => void;
7
- export default class MacroParserLexer extends BaseLexer {
8
- private static _isPpCharacters;
9
- private static _lexemeTable;
10
- private macroLvl;
11
- readonly sourceMap: PpSourceMap;
12
- readonly file: string;
13
- readonly blockRange?: ShaderRange;
14
- constructor(source: string, file?: string, blockRange?: ShaderRange);
15
- scanWordsUntilTerminator(terminatorChar: string): BaseToken[];
16
- scanWord(): BaseToken;
17
- scanToken(): BaseToken | undefined;
18
- scanQuotedString(): BaseToken<MacroParserToken.string_const>;
19
- scanToChar(char: string): void;
20
- scanMacroBranchBody(): {
21
- body: BaseToken<MacroParserToken.chunk>;
22
- nextDirective: BaseToken;
23
- };
24
- scanPairedBlock(lc: string, rc: string): void;
25
- /**
26
- * @returns end ShaderPosition
27
- */
28
- scanRemainMacro(): ShaderPosition;
29
- peekNonSpace(): string;
30
- scanInteger(): BaseToken<number>;
31
- scanMacroBody(): BaseToken<MacroParserToken.line_remain>;
32
- }
@@ -1,5 +0,0 @@
1
- import { ExpandSegment } from "./MacroParser";
2
- import PpSourceMap from "./sourceMap";
3
- export declare class PpUtils {
4
- static expand(segments: ExpandSegment[], source: string, sourceMap?: PpSourceMap): string;
5
- }
@@ -1,54 +0,0 @@
1
- export declare enum MacroParserToken {
2
- id = 0,
3
- line_remain = 1,
4
- chunk = 2,
5
- int_constant = 3,
6
- string_const = 4,
7
- /** \>> */
8
- right_op = 5,
9
- /** << */
10
- left_op = 6,
11
- left_paren = 7,
12
- right_paren = 8,
13
- /** \>= */
14
- ge = 9,
15
- /** <= */
16
- le = 10,
17
- /** == */
18
- eq = 11,
19
- /** != */
20
- neq = 12,
21
- /** && */
22
- and = 13,
23
- /** || */
24
- or = 14,
25
- /** < */
26
- left_angle = 15,
27
- /** \> */
28
- right_angle = 16,
29
- /** \* */
30
- star = 17,
31
- /** + */
32
- plus = 18,
33
- /** \- */
34
- dash = 19,
35
- /** ! */
36
- bang = 20,
37
- /** \/ */
38
- slash = 21,
39
- /** % */
40
- percent = 22,
41
- EOF = 100
42
- }
43
- export declare enum MacroParserKeyword {
44
- define = 101,
45
- undef = 102,
46
- if = 103,
47
- ifdef = 104,
48
- ifndef = 105,
49
- else = 106,
50
- elif = 107,
51
- endif = 108,
52
- defined = 109
53
- }
54
- export type MacroParserConstant = boolean | number;
@@ -1 +0,0 @@
1
- export * from "./MacroParser";
@@ -1,37 +0,0 @@
1
- import { ShaderRange } from "../../common/ShaderRange";
2
- export declare class BlockInfo {
3
- readonly sourceFile: string;
4
- readonly rangeInFile?: ShaderRange;
5
- readonly sourceMap?: PpSourceMap;
6
- constructor(sourceFile?: string, rangeInFile?: ShaderRange, sourceMap?: PpSourceMap);
7
- }
8
- export declare class MapRange {
9
- sourceLoc: {
10
- block: BlockInfo;
11
- rangeInBlock: ShaderRange;
12
- };
13
- generatedLoc: {
14
- start: number;
15
- end: number;
16
- };
17
- constructor(sourceBlock: BlockInfo, rangeInBlock: ShaderRange, generatedLoc: {
18
- start: number;
19
- end: number;
20
- });
21
- getSourceIndex(generatedIdx: number): {
22
- sourceFile: string;
23
- index: number;
24
- };
25
- }
26
- export default class PpSourceMap {
27
- readonly mapRanges: MapRange[];
28
- static rangeContains(range: MapRange["generatedLoc"], index: number): boolean;
29
- addMapRange(mapRange: MapRange): void;
30
- /**
31
- * @returns index
32
- */
33
- map(index: number): {
34
- sourceFile: string;
35
- index: number;
36
- };
37
- }