@luma.gl/shaders 10.0.0-alpha.8 → 10.0.0-alpha.9
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/dist/dist.dev.js +189 -268
- package/dist/dist.min.js +119 -119
- package/dist/glsl.cjs.map +2 -2
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/shader-assembler-base.cjs +3 -4
- package/dist/lib/shader-assembler-base.d.ts +4 -5
- package/dist/lib/shader-assembler-base.d.ts.map +1 -1
- package/dist/lib/shader-assembler-base.js +3 -4
- package/dist/lib/shader-assembler-base.js.map +1 -1
- package/dist/lib/shader-assembly/assemble-glsl-shaders.cjs +5 -16
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts +4 -4
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts.map +1 -1
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js +13 -18
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js.map +1 -1
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.cjs +5 -24
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts +5 -6
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts.map +1 -1
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js +13 -26
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js.map +1 -1
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts +2 -2
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts.map +1 -1
- package/dist/lib/shader-assembly/shader-assembly-shared.js.map +1 -1
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts +7 -7
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts.map +1 -1
- package/dist/lib/shader-assembly/shader-hooks.cjs +17 -36
- package/dist/lib/shader-assembly/shader-hooks.d.ts +34 -32
- package/dist/lib/shader-assembly/shader-hooks.d.ts.map +1 -1
- package/dist/lib/shader-assembly/shader-hooks.js +20 -44
- package/dist/lib/shader-assembly/shader-hooks.js.map +1 -1
- package/dist/lib/shader-assembly/shader-injections.cjs +26 -2
- package/dist/lib/shader-assembly/shader-injections.d.ts +20 -7
- package/dist/lib/shader-assembly/shader-injections.d.ts.map +1 -1
- package/dist/lib/shader-assembly/shader-injections.js +24 -0
- package/dist/lib/shader-assembly/shader-injections.js.map +1 -1
- package/dist/lib/shader-module/shader-module.cjs +3 -9
- package/dist/lib/shader-module/shader-module.d.ts +4 -8
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-module.js +3 -6
- package/dist/lib/shader-module/shader-module.js.map +1 -1
- package/dist/lib/shader-plugin.cjs +13 -38
- package/dist/lib/shader-plugin.d.ts +5 -30
- package/dist/lib/shader-plugin.d.ts.map +1 -1
- package/dist/lib/shader-plugin.js +17 -40
- package/dist/lib/shader-plugin.js.map +1 -1
- package/dist/wgsl.cjs.map +2 -2
- package/package.json +2 -2
- package/src/index.ts +5 -6
- package/src/lib/shader-assembler-base.ts +5 -6
- package/src/lib/shader-assembly/assemble-glsl-shaders.ts +25 -25
- package/src/lib/shader-assembly/assemble-wgsl-shaders.ts +27 -42
- package/src/lib/shader-assembly/shader-assembly-shared.ts +5 -5
- package/src/lib/shader-assembly/shader-assembly-types.ts +7 -7
- package/src/lib/shader-assembly/shader-hooks.ts +55 -82
- package/src/lib/shader-assembly/shader-injections.ts +52 -8
- package/src/lib/shader-module/shader-module.ts +7 -14
- package/src/lib/shader-plugin.ts +31 -90
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ResolvedShaderInjection } from "./shader-injections.js";
|
|
2
2
|
import { type ShaderModule } from "../shader-module/shader-module.js";
|
|
3
3
|
export declare const INJECT_SHADER_DECLARATIONS = "\n\n__LUMA_INJECT_DECLARATIONS__\n";
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ export declare const INJECT_SHADER_DECLARATIONS = "\n\n__LUMA_INJECT_DECLARATION
|
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
12
|
export declare function assembleGetUniforms(modules: ShaderModule[]): (opts: Record<string, any>) => Record<string, any>;
|
|
13
|
-
export declare function appendInjections(injections: Record<string,
|
|
13
|
+
export declare function appendInjections(injections: Record<string, ResolvedShaderInjection[]>, hookInjections: Record<string, ResolvedShaderInjection[]>, declInjections: Record<string, ResolvedShaderInjection[]>, mainInjections: Record<string, ResolvedShaderInjection[]>): void;
|
|
14
14
|
/** Extracts the source code chunk for the specified shader type from the named shader module */
|
|
15
15
|
export declare function getShaderModuleSource(module: ShaderModule, stage: 'vertex' | 'fragment' | 'wgsl', log?: any): string;
|
|
16
16
|
//# sourceMappingURL=shader-assembly-shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-assembly-shared.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-assembly-shared.ts"],"names":[],"mappings":"AAIA,OAAO,EAA4B,KAAK,
|
|
1
|
+
{"version":3,"file":"shader-assembly-shared.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-assembly-shared.ts"],"names":[],"mappings":"AAIA,OAAO,EAA4B,KAAK,uBAAuB,EAAC,+BAA4B;AAC5F,OAAO,EAAC,KAAK,YAAY,EAAC,0CAAuC;AAIjE,eAAO,MAAM,0BAA0B,uCAAuC,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,IAC7B,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAU5E;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,EACrD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,EACzD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,EACzD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,GACxD,IAAI,CAkBN;AAED,gGAAgG;AAChG,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,EACrC,GAAG,CAAC,EAAE,GAAG,GACR,MAAM,CAgCR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-assembly-shared.js","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-assembly-shared.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"shader-assembly-shared.js","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-assembly-shared.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,yBAAyB,EAA+B,+BAA4B;AAE5F,OAAO,EAAC,MAAM,EAAC,2BAAwB;AACvC,OAAO,EAAC,iCAAiC,EAAC,yDAAsD;AAEhG,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,yBAAyB,IAAI,CAAC;AAE/E;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACzD,OAAO,SAAS,WAAW,CAAC,IAAyB;QACnD,MAAM,QAAQ,GAAG,EAAE,CAAC;QACpB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,wEAAwE;YACxE,gFAAgF;YAChF,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC5D,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CA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AM,CAAC,MAAM,IAAI,EAAE,CAAC;YACnC,MAAM;QACR;YACE,MAAM,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,iCAAiC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAC,GAAG,EAAC,CAAC,CAAC;IAExD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IACzE,IAAI,MAAM,GAAG;kBACG,MAAM,CAAC,IAAI;;CAE5B,CAAC;IACA,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,kBAAkB,UAAU,IAAI,CAAC;IAC7C,CAAC;IACD,MAAM,IAAI,GAAG,YAAY,IAAI,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type PlatformInfo } from "./platform-info.js";
|
|
2
2
|
import { type ShaderModule } from "../shader-module/shader-module.js";
|
|
3
3
|
import { type ShaderHook } from "./shader-hooks.js";
|
|
4
|
-
import { type ShaderInjection } from "./shader-injections.js";
|
|
4
|
+
import { type ShaderInjection, type ResolvedShaderInjection } from "./shader-injections.js";
|
|
5
5
|
import { type AttributeShaderType } from "../../types.js";
|
|
6
6
|
import { type ResolvedShaderPluginInterStageVariable } from "../shader-plugin.js";
|
|
7
7
|
export type ShaderAssemblyLog = {
|
|
@@ -38,13 +38,13 @@ export type AssembleShaderOptions = {
|
|
|
38
38
|
/** GLSL only: Overrides to be injected. In WGSL these are supplied during Pipeline creation time */
|
|
39
39
|
constants?: Record<string, number>;
|
|
40
40
|
/** Per-call hooks, appended after registered assembler hooks; matching names override for this call. */
|
|
41
|
-
hookFunctions?: readonly
|
|
41
|
+
hookFunctions?: readonly ShaderHook[];
|
|
42
42
|
/** Hook declarations contributed by resolved plugins. */
|
|
43
43
|
pluginHooks?: readonly ShaderHook[];
|
|
44
44
|
/** Code injections */
|
|
45
|
-
inject?: Record<string, string |
|
|
45
|
+
inject?: readonly ShaderInjection[] | Record<string, string | ResolvedShaderInjection>;
|
|
46
46
|
/** Ordered code injections contributed by ShaderPlugin descriptors. */
|
|
47
|
-
pluginInjections?: Record<string,
|
|
47
|
+
pluginInjections?: Record<string, ResolvedShaderInjection[]>;
|
|
48
48
|
/** Vertex inputs contributed by ShaderPlugin descriptors. */
|
|
49
49
|
pluginVertexInputs?: Record<string, AttributeShaderType>;
|
|
50
50
|
/** Inter-stage variables contributed by ShaderPlugin descriptors. */
|
|
@@ -73,13 +73,13 @@ export type AssembleStageOptions = {
|
|
|
73
73
|
/** GLSL only: Overrides to be injected. In WGSL these are supplied during Pipeline creation time */
|
|
74
74
|
constants?: Record<string, number>;
|
|
75
75
|
/** Per-call hooks, appended after registered assembler hooks; matching names override for this call. */
|
|
76
|
-
hookFunctions?: readonly
|
|
76
|
+
hookFunctions?: readonly ShaderHook[];
|
|
77
77
|
/** Hook declarations contributed by resolved plugins. */
|
|
78
78
|
pluginHooks?: readonly ShaderHook[];
|
|
79
79
|
/** Code injections */
|
|
80
|
-
inject?: Record<string, string |
|
|
80
|
+
inject?: readonly ShaderInjection[] | Record<string, string | ResolvedShaderInjection>;
|
|
81
81
|
/** Ordered code injections contributed by ShaderPlugin descriptors. */
|
|
82
|
-
pluginInjections?: Record<string,
|
|
82
|
+
pluginInjections?: Record<string, ResolvedShaderInjection[]>;
|
|
83
83
|
/** Vertex inputs contributed by ShaderPlugin descriptors. */
|
|
84
84
|
pluginVertexInputs?: Record<string, AttributeShaderType>;
|
|
85
85
|
/** Inter-stage variables contributed by ShaderPlugin descriptors. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-assembly-types.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-assembly-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,YAAY,EAAC,2BAAwB;AAClD,OAAO,EAAC,KAAK,YAAY,EAAC,0CAAuC;AACjE,OAAO,EAAC,KAAK,UAAU,EAAC,0BAAuB;AAC/C,OAAO,EAAC,KAAK,eAAe,EAAC,+BAA4B;
|
|
1
|
+
{"version":3,"file":"shader-assembly-types.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-assembly-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,YAAY,EAAC,2BAAwB;AAClD,OAAO,EAAC,KAAK,YAAY,EAAC,0CAAuC;AACjE,OAAO,EAAC,KAAK,UAAU,EAAC,0BAAuB;AAC/C,OAAO,EAAC,KAAK,eAAe,EAAE,KAAK,uBAAuB,EAAC,+BAA4B;AACvF,OAAO,EAAC,KAAK,mBAAmB,EAAC,uBAAoB;AACrD,OAAO,EAAC,KAAK,sCAAsC,EAAC,4BAAyB;AAE7E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,OAAO,CAAC;IACnD,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,OAAO,CAAC;IAChD,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,OAAO,CAAC;CAC9C,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG;IACxD,YAAY,EAAE,YAAY,CAAC;IAC3B,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iCAAiC;IACjC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,mCAAmC;IACnC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,qBAAqB,G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(hookFunctions, hookInjections, shaderLanguage = "glsl")
|
|
|
27
27
|
let result = "";
|
|
28
28
|
for (const hookName in hookFunctions) {
|
|
29
29
|
const hookFunction = hookFunctions[hookName];
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const returnType = hookFunction.returnType || "void";
|
|
31
|
+
const functionPrefix = shaderLanguage === "wgsl" ? "fn" : returnType;
|
|
32
|
+
const returnSuffix = shaderLanguage === "wgsl" && returnType !== "void" ? ` -> ${returnType}` : "";
|
|
33
|
+
result += `${functionPrefix} ${hookFunction.signature}${returnSuffix} {
|
|
32
34
|
`;
|
|
33
35
|
if (hookFunction.header) {
|
|
34
36
|
result += ` ${hookFunction.header}`;
|
|
@@ -48,21 +50,24 @@ function getShaderHooks(hookFunctions, hookInjections, shaderLanguage = "glsl")
|
|
|
48
50
|
}
|
|
49
51
|
return result;
|
|
50
52
|
}
|
|
51
|
-
function normalizeShaderHooks(hookFunctions, pluginHooks = [], language) {
|
|
53
|
+
function normalizeShaderHooks(hookFunctions, pluginHooks = [], language = "glsl") {
|
|
52
54
|
const result = { vertex: {}, fragment: {} };
|
|
53
|
-
for (const
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
for (const hook of hookFunctions) {
|
|
56
|
+
const implementation = hook[language];
|
|
57
|
+
if (implementation) {
|
|
58
|
+
const prefix = hook.stage === "vertex" ? "vs" : "fs";
|
|
59
|
+
result[hook.stage][`${prefix}:${hook.name}`] = {
|
|
60
|
+
...implementation,
|
|
61
|
+
signature: `${hook.name}(${implementation.parameters})`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
59
64
|
}
|
|
60
65
|
for (const hook of pluginHooks) {
|
|
61
|
-
const
|
|
66
|
+
const selected = normalizeShaderHooks([hook], [], language);
|
|
62
67
|
for (const stage of ["vertex", "fragment"]) {
|
|
63
|
-
for (const [name, declaration] of Object.entries(
|
|
68
|
+
for (const [name, declaration] of Object.entries(selected[stage])) {
|
|
64
69
|
const existing = result[stage][name];
|
|
65
|
-
if (existing && existing.signature !== declaration.signature) {
|
|
70
|
+
if (existing && (existing.signature !== declaration.signature || (existing.returnType || "void") !== (declaration.returnType || "void"))) {
|
|
66
71
|
throw new Error(`Conflicting ShaderPlugin hook ${name}`);
|
|
67
72
|
}
|
|
68
73
|
result[stage][name] = existing || declaration;
|
|
@@ -89,30 +94,6 @@ function validateShaderHookInjections(registry, hookInjections, stage) {
|
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
|
-
function addShaderHookToRegistry(registry, hookFunction) {
|
|
93
|
-
const options = typeof hookFunction === "string" ? {} : hookFunction;
|
|
94
|
-
const hook = (typeof hookFunction === "string" ? hookFunction : hookFunction.hook).trim();
|
|
95
|
-
const stageSeparatorIndex = hook.indexOf(":");
|
|
96
|
-
const shaderStage = hook.slice(0, stageSeparatorIndex);
|
|
97
|
-
const signature = hook.slice(stageSeparatorIndex + 1);
|
|
98
|
-
const name = hook.split("(")[0].trim();
|
|
99
|
-
const normalizedHook = {
|
|
100
|
-
hook: name,
|
|
101
|
-
signature,
|
|
102
|
-
header: options.header || "",
|
|
103
|
-
footer: options.footer || ""
|
|
104
|
-
};
|
|
105
|
-
switch (shaderStage) {
|
|
106
|
-
case "vs":
|
|
107
|
-
registry.vertex[name] = normalizedHook;
|
|
108
|
-
break;
|
|
109
|
-
case "fs":
|
|
110
|
-
registry.fragment[name] = normalizedHook;
|
|
111
|
-
break;
|
|
112
|
-
default:
|
|
113
|
-
throw new Error(shaderStage);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
97
|
// Annotate the CommonJS export names for ESM import in node:
|
|
117
98
|
0 && (module.exports = {
|
|
118
99
|
getShaderHooks,
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* If a shader module injects code it will be executed upon the hook
|
|
11
|
-
* function call.
|
|
12
|
-
*/
|
|
13
|
-
export type ShaderHook = {
|
|
14
|
-
/** `vs:` or `fs:` followed by the name and arguments of the function, e.g. `vs:MYHOOK_func(inout vec4 value)`. Hook name without arguments
|
|
15
|
-
will also be used as the name of the shader hook */
|
|
16
|
-
hook: string;
|
|
17
|
-
/** Code always included at the beginning of a hook function */
|
|
1
|
+
import type { ResolvedShaderInjection } from "./shader-injections.js";
|
|
2
|
+
/** Language-specific source for a callable shader hook. */
|
|
3
|
+
export type ShaderHookImplementation = {
|
|
4
|
+
/** Function parameters in the selected shader language, without parentheses. */
|
|
5
|
+
parameters: string;
|
|
6
|
+
/** Return type in this language. Omit for a hook that returns no value. */
|
|
7
|
+
returnType?: string;
|
|
8
|
+
/** Source included before injected code. */
|
|
18
9
|
header?: string;
|
|
19
|
-
/**
|
|
10
|
+
/** Source included after injected code. */
|
|
20
11
|
footer?: string;
|
|
21
|
-
/** To Be Documented */
|
|
22
|
-
signature?: string;
|
|
23
12
|
};
|
|
24
|
-
/**
|
|
25
|
-
export type
|
|
26
|
-
/**
|
|
13
|
+
/** One logical extension point with independent GLSL and WGSL syntax. */
|
|
14
|
+
export type ShaderHook = {
|
|
15
|
+
/** Function name shared by both shader languages. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Shader stage that owns the hook. */
|
|
18
|
+
stage: 'vertex' | 'fragment';
|
|
19
|
+
/** GLSL implementation. Omit to skip this hook during GLSL assembly. */
|
|
20
|
+
glsl?: ShaderHookImplementation;
|
|
21
|
+
/** WGSL implementation. Omit to skip this hook during WGSL assembly. */
|
|
22
|
+
wgsl?: ShaderHookImplementation;
|
|
23
|
+
};
|
|
24
|
+
/** Language-selected hook ready for source generation. */
|
|
25
|
+
type ResolvedShaderHook = ShaderHookImplementation & {
|
|
26
|
+
signature: string;
|
|
27
|
+
};
|
|
28
|
+
/** Normalized shader hooks per shader */
|
|
27
29
|
export type ShaderHookRegistry = {
|
|
28
|
-
vertex
|
|
29
|
-
|
|
30
|
+
/** Normalized shader hooks for vertex shader */
|
|
31
|
+
vertex: Record<string, ResolvedShaderHook>;
|
|
32
|
+
/** Normalized shader hooks for fragment shader */
|
|
33
|
+
fragment: Record<string, ResolvedShaderHook>;
|
|
30
34
|
};
|
|
31
35
|
/** Generate hook source code */
|
|
32
|
-
export declare function getShaderHooks(hookFunctions: Record<string,
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
* A later declaration of the same stage-prefixed hook name replaces an earlier one.
|
|
36
|
-
*/
|
|
37
|
-
export declare function normalizeShaderHooks(hookFunctions: readonly (ShaderHook | string)[], pluginHooks?: readonly ShaderHook[], language?: 'glsl' | 'wgsl'): ShaderHookRegistry;
|
|
36
|
+
export declare function getShaderHooks(hookFunctions: Record<string, ResolvedShaderHook>, hookInjections: Record<string, ResolvedShaderInjection[]>, shaderLanguage?: 'glsl' | 'wgsl'): string;
|
|
37
|
+
/** Select language syntax and merge compatible plugin declarations without mutating descriptors. */
|
|
38
|
+
export declare function normalizeShaderHooks(hookFunctions: readonly ShaderHook[], pluginHooks?: readonly ShaderHook[], language?: 'glsl' | 'wgsl'): ShaderHookRegistry;
|
|
38
39
|
/** Returns true if a stage-prefixed hook name such as `vs:MY_HOOK` is declared. */
|
|
39
40
|
export declare function isShaderHookRegistered(registry: ShaderHookRegistry, hookName: string): boolean;
|
|
40
41
|
/**
|
|
41
42
|
* Throws if a named hook injection targets a hook that is not declared for this assembly.
|
|
42
43
|
* @param stage Only validate injections for this GLSL stage. WGSL validates both stages.
|
|
43
44
|
*/
|
|
44
|
-
export declare function validateShaderHookInjections(registry: ShaderHookRegistry, hookInjections: Record<string,
|
|
45
|
+
export declare function validateShaderHookInjections(registry: ShaderHookRegistry, hookInjections: Record<string, ResolvedShaderInjection[]>, stage?: 'vertex' | 'fragment'): void;
|
|
46
|
+
export {};
|
|
45
47
|
//# sourceMappingURL=shader-hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-hooks.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-hooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"shader-hooks.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-hooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,uBAAuB,EAAC,+BAA4B;AAEjE,2DAA2D;AAC3D,MAAM,MAAM,wBAAwB,GAAG;IACrC,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG;IACvB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,wEAAwE;IACxE,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,wEAAwE;IACxE,IAAI,CAAC,EAAE,wBAAwB,CAAC;CACjC,CAAC;AAEF,0DAA0D;AAC1D,KAAK,kBAAkB,GAAG,wBAAwB,GAAG;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,CAAC;AAEzE,yCAAyC;AACzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC3C,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF,gCAAgC;AAChC,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACjD,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,EACzD,cAAc,GAAE,MAAM,GAAG,MAAe,GACvC,MAAM,CA0BR;AAED,oGAAoG;AACpG,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,SAAS,UAAU,EAAE,EACpC,WAAW,GAAE,SAAS,UAAU,EAAO,EACvC,QAAQ,GAAE,MAAM,GAAG,MAAe,GACjC,kBAAkB,CA6BpB;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG9F;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,EACzD,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,GAC5B,IAAI,CAkBN"}
|
|
@@ -6,8 +6,10 @@ export function getShaderHooks(hookFunctions, hookInjections, shaderLanguage = '
|
|
|
6
6
|
let result = '';
|
|
7
7
|
for (const hookName in hookFunctions) {
|
|
8
8
|
const hookFunction = hookFunctions[hookName];
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const returnType = hookFunction.returnType || 'void';
|
|
10
|
+
const functionPrefix = shaderLanguage === 'wgsl' ? 'fn' : returnType;
|
|
11
|
+
const returnSuffix = shaderLanguage === 'wgsl' && returnType !== 'void' ? ` -> ${returnType}` : '';
|
|
12
|
+
result += `${functionPrefix} ${hookFunction.signature}${returnSuffix} {\n`;
|
|
11
13
|
if (hookFunction.header) {
|
|
12
14
|
result += ` ${hookFunction.header}`;
|
|
13
15
|
}
|
|
@@ -25,29 +27,27 @@ export function getShaderHooks(hookFunctions, hookInjections, shaderLanguage = '
|
|
|
25
27
|
}
|
|
26
28
|
return result;
|
|
27
29
|
}
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
* A later declaration of the same stage-prefixed hook name replaces an earlier one.
|
|
31
|
-
*/
|
|
32
|
-
export function normalizeShaderHooks(hookFunctions, pluginHooks = [], language) {
|
|
30
|
+
/** Select language syntax and merge compatible plugin declarations without mutating descriptors. */
|
|
31
|
+
export function normalizeShaderHooks(hookFunctions, pluginHooks = [], language = 'glsl') {
|
|
33
32
|
const result = { vertex: {}, fragment: {} };
|
|
34
|
-
for (const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
: hookFunction);
|
|
33
|
+
for (const hook of hookFunctions) {
|
|
34
|
+
const implementation = hook[language];
|
|
35
|
+
if (implementation) {
|
|
36
|
+
const prefix = hook.stage === 'vertex' ? 'vs' : 'fs';
|
|
37
|
+
result[hook.stage][`${prefix}:${hook.name}`] = {
|
|
38
|
+
...implementation,
|
|
39
|
+
signature: `${hook.name}(${implementation.parameters})`
|
|
40
|
+
};
|
|
41
|
+
}
|
|
44
42
|
}
|
|
45
43
|
for (const hook of pluginHooks) {
|
|
46
|
-
const
|
|
44
|
+
const selected = normalizeShaderHooks([hook], [], language);
|
|
47
45
|
for (const stage of ['vertex', 'fragment']) {
|
|
48
|
-
for (const [name, declaration] of Object.entries(
|
|
46
|
+
for (const [name, declaration] of Object.entries(selected[stage])) {
|
|
49
47
|
const existing = result[stage][name];
|
|
50
|
-
if (existing &&
|
|
48
|
+
if (existing &&
|
|
49
|
+
(existing.signature !== declaration.signature ||
|
|
50
|
+
(existing.returnType || 'void') !== (declaration.returnType || 'void'))) {
|
|
51
51
|
throw new Error(`Conflicting ShaderPlugin hook ${name}`);
|
|
52
52
|
}
|
|
53
53
|
result[stage][name] = existing || declaration;
|
|
@@ -80,28 +80,4 @@ export function validateShaderHookInjections(registry, hookInjections, stage) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function addShaderHookToRegistry(registry, hookFunction) {
|
|
84
|
-
const options = typeof hookFunction === 'string' ? {} : hookFunction;
|
|
85
|
-
const hook = (typeof hookFunction === 'string' ? hookFunction : hookFunction.hook).trim();
|
|
86
|
-
const stageSeparatorIndex = hook.indexOf(':');
|
|
87
|
-
const shaderStage = hook.slice(0, stageSeparatorIndex);
|
|
88
|
-
const signature = hook.slice(stageSeparatorIndex + 1);
|
|
89
|
-
const name = hook.split('(')[0].trim();
|
|
90
|
-
const normalizedHook = {
|
|
91
|
-
hook: name,
|
|
92
|
-
signature,
|
|
93
|
-
header: options.header || '',
|
|
94
|
-
footer: options.footer || ''
|
|
95
|
-
};
|
|
96
|
-
switch (shaderStage) {
|
|
97
|
-
case 'vs':
|
|
98
|
-
registry.vertex[name] = normalizedHook;
|
|
99
|
-
break;
|
|
100
|
-
case 'fs':
|
|
101
|
-
registry.fragment[name] = normalizedHook;
|
|
102
|
-
break;
|
|
103
|
-
default:
|
|
104
|
-
throw new Error(shaderStage);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
83
|
//# sourceMappingURL=shader-hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-hooks.js","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-hooks.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;
|
|
1
|
+
{"version":3,"file":"shader-hooks.js","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-hooks.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAuC5D,gCAAgC;AAChC,MAAM,UAAU,cAAc,CAC5B,aAAiD,EACjD,cAAyD,EACzD,iBAAkC,MAAM;IAExC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE,CAAC;QACrC,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,IAAI,MAAM,CAAC;QACrD,MAAM,cAAc,GAAG,cAAc,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Injects: () => combineInjects,
|
|
22
22
|
injectShader: () => injectShader,
|
|
23
|
-
normalizeInjections: () => normalizeInjections
|
|
23
|
+
normalizeInjections: () => normalizeInjections,
|
|
24
|
+
resolveShaderInjections: () => resolveShaderInjections
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(shader_injections_exports);
|
|
26
27
|
var import_module_injectors = require("../../module-injectors.cjs");
|
|
@@ -33,6 +34,28 @@ const REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/;
|
|
|
33
34
|
const REGEX_END_OF_MAIN = /}\n?[^{}]*$/;
|
|
34
35
|
const fragments = [];
|
|
35
36
|
const DECLARATION_INJECT_MARKER = "__LUMA_INJECT_DECLARATIONS__";
|
|
37
|
+
function resolveShaderInjections(declarations, language, pluginName) {
|
|
38
|
+
const resolved = {};
|
|
39
|
+
for (const declaration of declarations) {
|
|
40
|
+
const source = declaration[language];
|
|
41
|
+
if (source === void 0)
|
|
42
|
+
continue;
|
|
43
|
+
if (declaration.stage !== "vertex" && declaration.stage !== "fragment" || declaration.target.includes(":")) {
|
|
44
|
+
throw new Error("Shader injection targets require an explicit stage and unqualified target");
|
|
45
|
+
}
|
|
46
|
+
const target = `${declaration.stage === "vertex" ? "vs" : "fs"}:${declaration.target}`;
|
|
47
|
+
if (!/^(vs|fs):(?:#(?:decl|main-start|main-end)|[A-Za-z_][A-Za-z0-9_]*)$/.test(target)) {
|
|
48
|
+
throw new Error(`Shader injection target "${target}" must be a named shader anchor or hook`);
|
|
49
|
+
}
|
|
50
|
+
resolved[target] ||= [];
|
|
51
|
+
resolved[target].push({
|
|
52
|
+
injection: source,
|
|
53
|
+
order: declaration.order ?? 0,
|
|
54
|
+
...pluginName ? { pluginName } : {}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return resolved;
|
|
58
|
+
}
|
|
36
59
|
function normalizeInjections(injections) {
|
|
37
60
|
const result = { vertex: {}, fragment: {} };
|
|
38
61
|
for (const hook in injections) {
|
|
@@ -176,5 +199,6 @@ function escapeRegExp(value) {
|
|
|
176
199
|
DECLARATION_INJECT_MARKER,
|
|
177
200
|
combineInjects,
|
|
178
201
|
injectShader,
|
|
179
|
-
normalizeInjections
|
|
202
|
+
normalizeInjections,
|
|
203
|
+
resolveShaderInjections
|
|
180
204
|
});
|
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
export declare const DECLARATION_INJECT_MARKER = "__LUMA_INJECT_DECLARATIONS__";
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
2
|
+
/** Language-specific source inserted at a named shader anchor or hook. */
|
|
5
3
|
export type ShaderInjection = {
|
|
4
|
+
/** Shader stage receiving the injection. */
|
|
5
|
+
stage: 'vertex' | 'fragment';
|
|
6
|
+
/** Unqualified hook name or structural anchor such as #main-start. */
|
|
7
|
+
target: string;
|
|
8
|
+
/** GLSL source. Omit to skip this injection for GLSL assembly. */
|
|
9
|
+
glsl?: string;
|
|
10
|
+
/** WGSL source. Omit to skip this injection for WGSL assembly. */
|
|
11
|
+
wgsl?: string;
|
|
12
|
+
/** Relative order at the target; defaults to zero. */
|
|
13
|
+
order?: number;
|
|
14
|
+
};
|
|
15
|
+
/** Language-selected source and ordering used internally during shader assembly. */
|
|
16
|
+
export type ResolvedShaderInjection = {
|
|
6
17
|
/** Plugin responsible for this injection, when supplied by a ShaderPlugin. */
|
|
7
18
|
pluginName?: string;
|
|
8
19
|
injection: string;
|
|
9
20
|
order: number;
|
|
10
21
|
};
|
|
22
|
+
/** Select language-specific injections while retaining repeated targets and declaration order. */
|
|
23
|
+
export declare function resolveShaderInjections(declarations: readonly ShaderInjection[], language: 'glsl' | 'wgsl', pluginName?: string): Record<string, ResolvedShaderInjection[]>;
|
|
11
24
|
/**
|
|
12
25
|
* ShaderInjections, parsed and split per shader
|
|
13
26
|
*/
|
|
14
27
|
export type ShaderInjections = {
|
|
15
|
-
vertex: Record<string,
|
|
16
|
-
fragment: Record<string,
|
|
28
|
+
vertex: Record<string, ResolvedShaderInjection>;
|
|
29
|
+
fragment: Record<string, ResolvedShaderInjection>;
|
|
17
30
|
};
|
|
18
31
|
/**
|
|
19
32
|
*
|
|
20
33
|
*/
|
|
21
|
-
export declare function normalizeInjections(injections: Record<string, string |
|
|
34
|
+
export declare function normalizeInjections(injections: Record<string, string | ResolvedShaderInjection>): ShaderInjections;
|
|
22
35
|
/**
|
|
23
36
|
// A minimal shader injection/templating system.
|
|
24
37
|
// RFC: https://github.com/visgl/luma.gl/blob/7.0-release/dev-docs/RFCs/v6.0/shader-injection-rfc.md
|
|
@@ -28,7 +41,7 @@ export declare function normalizeInjections(injections: Record<string, string |
|
|
|
28
41
|
* @param injectStandardStubs
|
|
29
42
|
* @returns
|
|
30
43
|
*/
|
|
31
|
-
export declare function injectShader(source: string, stage: 'vertex' | 'fragment', inject: Record<string,
|
|
44
|
+
export declare function injectShader(source: string, stage: 'vertex' | 'fragment', inject: Record<string, ResolvedShaderInjection[]>, injectStandardStubs?: boolean, language?: 'glsl' | 'wgsl', entryPoints?: {
|
|
32
45
|
vertex?: string;
|
|
33
46
|
fragment?: string;
|
|
34
47
|
}): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-injections.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-injections.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,yBAAyB,iCAAiC,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"shader-injections.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-injections.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,yBAAyB,iCAAiC,CAAC;AAExE,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GAAG;IAC5B,4CAA4C;IAC5C,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IA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 +12,30 @@ const REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/; // Beginning of m
|
|
|
12
12
|
const REGEX_END_OF_MAIN = /}\n?[^{}]*$/; // End of main, assumes main is last function
|
|
13
13
|
const fragments = [];
|
|
14
14
|
export const DECLARATION_INJECT_MARKER = '__LUMA_INJECT_DECLARATIONS__';
|
|
15
|
+
/** Select language-specific injections while retaining repeated targets and declaration order. */
|
|
16
|
+
export function resolveShaderInjections(declarations, language, pluginName) {
|
|
17
|
+
const resolved = {};
|
|
18
|
+
for (const declaration of declarations) {
|
|
19
|
+
const source = declaration[language];
|
|
20
|
+
if (source === undefined)
|
|
21
|
+
continue;
|
|
22
|
+
if ((declaration.stage !== 'vertex' && declaration.stage !== 'fragment') ||
|
|
23
|
+
declaration.target.includes(':')) {
|
|
24
|
+
throw new Error('Shader injection targets require an explicit stage and unqualified target');
|
|
25
|
+
}
|
|
26
|
+
const target = `${declaration.stage === 'vertex' ? 'vs' : 'fs'}:${declaration.target}`;
|
|
27
|
+
if (!/^(vs|fs):(?:#(?:decl|main-start|main-end)|[A-Za-z_][A-Za-z0-9_]*)$/.test(target)) {
|
|
28
|
+
throw new Error(`Shader injection target "${target}" must be a named shader anchor or hook`);
|
|
29
|
+
}
|
|
30
|
+
resolved[target] ||= [];
|
|
31
|
+
resolved[target].push({
|
|
32
|
+
injection: source,
|
|
33
|
+
order: declaration.order ?? 0,
|
|
34
|
+
...(pluginName ? { pluginName } : {})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return resolved;
|
|
38
|
+
}
|
|
15
39
|
/**
|
|
16
40
|
*
|
|
17
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-injections.js","sourceRoot":"","sources":["../../../src/lib/shader-assembly/shader-injections.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,kCAA+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AAC"}
|
|
@@ -24,7 +24,6 @@ __export(shader_module_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(shader_module_exports);
|
|
26
26
|
var import_prop_types = require("../filters/prop-types.cjs");
|
|
27
|
-
var import_shader_injections = require("../shader-assembly/shader-injections.cjs");
|
|
28
27
|
function initializeShaderModules(modules) {
|
|
29
28
|
modules.map((module2) => initializeShaderModule(module2));
|
|
30
29
|
}
|
|
@@ -33,15 +32,10 @@ function initializeShaderModule(module2) {
|
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
35
34
|
initializeShaderModules(module2.dependencies || []);
|
|
36
|
-
const {
|
|
37
|
-
propTypes = {},
|
|
38
|
-
deprecations = [],
|
|
39
|
-
// defines = {},
|
|
40
|
-
inject = {}
|
|
41
|
-
} = module2;
|
|
35
|
+
const { propTypes = {}, deprecations = [] } = module2;
|
|
42
36
|
const instance = {
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
parsedDeprecations: parseDeprecationDefinitions(deprecations),
|
|
38
|
+
normalizedInjections: { vertex: {}, fragment: {} }
|
|
45
39
|
};
|
|
46
40
|
if (propTypes) {
|
|
47
41
|
instance.propValidators = (0, import_prop_types.makePropValidators)(propTypes);
|