@babylonjs/lite-gl 1.23.0 → 1.24.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/CHANGELOG.md +12 -0
- package/README.md +98 -2
- package/context.d.ts +5 -0
- package/context.js +8 -0
- package/context.js.map +1 -1
- package/depth-stencil.d.ts +1 -14
- package/depth-stencil.js.map +1 -1
- package/effect-renderer.d.ts +1 -11
- package/effect-renderer.js.map +1 -1
- package/effect.d.ts +5 -27
- package/effect.js +22 -0
- package/effect.js.map +1 -1
- package/family.d.ts +470 -0
- package/family.js +14 -0
- package/family.js.map +1 -0
- package/index.d.ts +8 -6
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/mesh.d.ts +4 -1
- package/mesh.js +10 -3
- package/mesh.js.map +1 -1
- package/native/command-stream.d.ts +1 -0
- package/native/command-stream.js +135 -0
- package/native/command-stream.js.map +1 -0
- package/native/context.d.ts +26 -0
- package/native/context.js +89 -0
- package/native/context.js.map +1 -0
- package/native/effect.d.ts +44 -0
- package/native/effect.js +276 -0
- package/native/effect.js.map +1 -0
- package/native/family.d.ts +75 -0
- package/native/family.js +2 -0
- package/native/family.js.map +1 -0
- package/native/identity.d.ts +11 -0
- package/native/identity.js +2 -0
- package/native/identity.js.map +1 -0
- package/native/index.d.ts +25 -0
- package/native/index.js +7 -0
- package/native/index.js.map +1 -0
- package/native/mesh.d.ts +53 -0
- package/native/mesh.js +137 -0
- package/native/mesh.js.map +1 -0
- package/native/render-target.d.ts +35 -0
- package/native/render-target.js +159 -0
- package/native/render-target.js.map +1 -0
- package/native/runtime.d.ts +1 -0
- package/native/runtime.js +12 -0
- package/native/runtime.js.map +1 -0
- package/native/state.d.ts +19 -0
- package/native/state.js +104 -0
- package/native/state.js.map +1 -0
- package/native/texture.d.ts +37 -0
- package/native/texture.js +86 -0
- package/native/texture.js.map +1 -0
- package/package.json +11 -3
- package/render-target.d.ts +7 -0
- package/render-target.js +38 -0
- package/render-target.js.map +1 -1
- package/scissor.d.ts +2 -2
- package/scissor.js +2 -2
- package/scissor.js.map +1 -1
- package/state.d.ts +1 -0
- package/state.js +2 -5
- package/state.js.map +1 -1
- package/text/text-renderer.js.map +1 -1
- package/web-family.d.ts +87 -0
- package/web-family.js +2 -0
- package/web-family.js.map +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GLEffectOptions } from "../family.js";
|
|
2
|
+
import type { GLEngineContext } from "./context.js";
|
|
3
|
+
import type { NativeResource } from "./identity.js";
|
|
4
|
+
import type { GLTexture } from "./texture.js";
|
|
5
|
+
/** Native shader program and its retained upload state. */
|
|
6
|
+
export interface GLEffect extends NativeResource<"effect"> {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
}
|
|
9
|
+
/** Compiles a native effect from host-prepared GLSL. */
|
|
10
|
+
export declare function createEffect(engine: GLEngineContext, options: GLEffectOptions): GLEffect;
|
|
11
|
+
/** Selects a program without reissuing an unchanged native binding. No-op for a disposed effect or engine. */
|
|
12
|
+
export declare function useEffect(effect: GLEffect): void;
|
|
13
|
+
/** Reports whether the effect's synchronous compilation succeeded and it is still owned. */
|
|
14
|
+
export declare function isEffectReady(effect: GLEffect): boolean;
|
|
15
|
+
/** Native compilation failures throw from {@link createEffect}, so there is never a deferred error. */
|
|
16
|
+
export declare function getEffectCompilationError(_effect: GLEffect): string | null;
|
|
17
|
+
/** Releases the owned shader program; after engine disposal it only marks the effect disposed. */
|
|
18
|
+
export declare function disposeEffect(effect: GLEffect): void;
|
|
19
|
+
/** Uploads a changed scalar float. */
|
|
20
|
+
export declare function setEffectFloat(effect: GLEffect, name: string, x: number): void;
|
|
21
|
+
/** Uploads a changed two-component float. */
|
|
22
|
+
export declare function setEffectFloat2(effect: GLEffect, name: string, x: number, y: number): void;
|
|
23
|
+
/** Uploads a changed three-component float. */
|
|
24
|
+
export declare function setEffectFloat3(effect: GLEffect, name: string, x: number, y: number, z: number): void;
|
|
25
|
+
/** Uploads a changed four-component float. */
|
|
26
|
+
export declare function setEffectFloat4(effect: GLEffect, name: string, x: number, y: number, z: number, w: number): void;
|
|
27
|
+
/** Uploads a changed scalar integer or Boolean uniform. */
|
|
28
|
+
export declare function setEffectInt(effect: GLEffect, name: string, value: number): void;
|
|
29
|
+
/** Uploads a changed matrix in column-major order. */
|
|
30
|
+
export declare function setEffectMatrix(effect: GLEffect, name: string, values: ArrayLike<number>): void;
|
|
31
|
+
/** Uploads a changed scalar float array. */
|
|
32
|
+
export declare function setEffectFloatArray(effect: GLEffect, name: string, values: ArrayLike<number>): void;
|
|
33
|
+
/** Uploads a changed array of two-component floats. */
|
|
34
|
+
export declare function setEffectFloatArray2(effect: GLEffect, name: string, values: ArrayLike<number>): void;
|
|
35
|
+
/** Uploads a changed array of three-component floats. */
|
|
36
|
+
export declare function setEffectFloatArray3(effect: GLEffect, name: string, values: ArrayLike<number>): void;
|
|
37
|
+
/** Uploads a changed array of four-component floats. */
|
|
38
|
+
export declare function setEffectFloatArray4(effect: GLEffect, name: string, values: ArrayLike<number>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Binds a texture to a declared sampler without repeating an unchanged binding.
|
|
41
|
+
* No-op for an undeclared sampler, a texture of another engine, or a disposed
|
|
42
|
+
* effect, texture or engine.
|
|
43
|
+
*/
|
|
44
|
+
export declare function setEffectTexture(effect: GLEffect, name: string, texture: GLTexture): void;
|
package/native/effect.js
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/** Compiles a native effect from host-prepared GLSL. */
|
|
2
|
+
export function createEffect(engine, options) {
|
|
3
|
+
const defines = options.defines ?? "";
|
|
4
|
+
const program = engine._native.createProgram(withDefines(options.vertexSource, defines), withDefines(options.fragmentSource, defines));
|
|
5
|
+
const names = [...options.uniformNames, ...options.samplerNames];
|
|
6
|
+
const handles = engine._native.getUniforms(program, names);
|
|
7
|
+
const uniforms = Object.create(null);
|
|
8
|
+
const values = Object.create(null);
|
|
9
|
+
for (let index = 0; index < names.length; index++) {
|
|
10
|
+
const name = names[index];
|
|
11
|
+
uniforms[name] = handles[index] ?? null;
|
|
12
|
+
values[name] = [];
|
|
13
|
+
}
|
|
14
|
+
const attributeNames = [...(options.attributeNames ?? ["position"])];
|
|
15
|
+
const locations = engine._native.getAttributes(program, attributeNames);
|
|
16
|
+
const attributes = Object.create(null);
|
|
17
|
+
for (let index = 0; index < attributeNames.length; index++) {
|
|
18
|
+
attributes[attributeNames[index]] = locations[index] ?? -1;
|
|
19
|
+
}
|
|
20
|
+
const textures = Object.create(null);
|
|
21
|
+
for (const name of options.samplerNames) {
|
|
22
|
+
textures[name] = undefined;
|
|
23
|
+
}
|
|
24
|
+
const fields = {
|
|
25
|
+
name: options.name,
|
|
26
|
+
_program: program,
|
|
27
|
+
_uniforms: uniforms,
|
|
28
|
+
_values: values,
|
|
29
|
+
_textures: textures,
|
|
30
|
+
_samplers: [...options.samplerNames],
|
|
31
|
+
_textureGeneration: -1,
|
|
32
|
+
_attributes: attributes,
|
|
33
|
+
_engine: engine,
|
|
34
|
+
_disposed: false,
|
|
35
|
+
};
|
|
36
|
+
return fields;
|
|
37
|
+
}
|
|
38
|
+
/** Native compiles unversioned GLSL, so the WebGL2 `#version` directive is dropped and defines lead the source. */
|
|
39
|
+
function withDefines(source, defines) {
|
|
40
|
+
const version = findVersionDirective(source);
|
|
41
|
+
let body = source;
|
|
42
|
+
if (version >= 0) {
|
|
43
|
+
const end = source.indexOf("\n", version);
|
|
44
|
+
body = source.slice(0, version) + (end < 0 ? "" : source.slice(end + 1));
|
|
45
|
+
}
|
|
46
|
+
return defines ? `${defines}\n${body}` : body;
|
|
47
|
+
}
|
|
48
|
+
/** Offset of a `#version` directive preceded only by whitespace and comments, or -1. */
|
|
49
|
+
function findVersionDirective(source) {
|
|
50
|
+
let index = 0;
|
|
51
|
+
while (index < source.length) {
|
|
52
|
+
const char = source[index];
|
|
53
|
+
if (char === " " || char === "\t" || char === "\r" || char === "\n") {
|
|
54
|
+
index++;
|
|
55
|
+
}
|
|
56
|
+
else if (source.startsWith("//", index)) {
|
|
57
|
+
const end = source.indexOf("\n", index);
|
|
58
|
+
index = end < 0 ? source.length : end + 1;
|
|
59
|
+
}
|
|
60
|
+
else if (source.startsWith("/*", index)) {
|
|
61
|
+
const end = source.indexOf("*/", index + 2);
|
|
62
|
+
index = end < 0 ? source.length : end + 2;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const directive = /#[ \t]*version\b/y;
|
|
66
|
+
directive.lastIndex = index;
|
|
67
|
+
return directive.test(source) ? index : -1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return -1;
|
|
71
|
+
}
|
|
72
|
+
/** Selects a program without reissuing an unchanged native binding. No-op for a disposed effect or engine. */
|
|
73
|
+
export function useEffect(effect) {
|
|
74
|
+
const engine = effect._engine;
|
|
75
|
+
if (effect._disposed || engine._disposed) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (engine._program !== effect._program) {
|
|
79
|
+
const commands = engine._commands;
|
|
80
|
+
commands.start(engine._runtime.Engine.COMMAND_SETPROGRAM);
|
|
81
|
+
commands.handle(effect._program);
|
|
82
|
+
commands.finish();
|
|
83
|
+
engine._program = effect._program;
|
|
84
|
+
engine._textureGeneration++;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Reports whether the effect's synchronous compilation succeeded and it is still owned. */
|
|
88
|
+
export function isEffectReady(effect) {
|
|
89
|
+
return !effect._disposed;
|
|
90
|
+
}
|
|
91
|
+
/** Native compilation failures throw from {@link createEffect}, so there is never a deferred error. */
|
|
92
|
+
export function getEffectCompilationError(_effect) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/** Releases the owned shader program; after engine disposal it only marks the effect disposed. */
|
|
96
|
+
export function disposeEffect(effect) {
|
|
97
|
+
if (effect._disposed) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
effect._disposed = true;
|
|
101
|
+
const engine = effect._engine;
|
|
102
|
+
if (engine._disposed) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const commands = engine._commands;
|
|
106
|
+
commands.start(engine._runtime.Engine.COMMAND_DELETEPROGRAM);
|
|
107
|
+
commands.handle(effect._program);
|
|
108
|
+
commands.finish();
|
|
109
|
+
if (engine._program === effect._program) {
|
|
110
|
+
engine._program = null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Records a changed declared uniform of a live effect and reports whether to upload it. */
|
|
114
|
+
function changed(effect, name, count, x, y = 0, z = 0, w = 0) {
|
|
115
|
+
const values = effect._values[name];
|
|
116
|
+
if (!values || !effect._uniforms[name] || effect._disposed || effect._engine._disposed) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
if (values.length === count && values[0] === x && (count < 2 || values[1] === y) && (count < 3 || values[2] === z) && (count < 4 || values[3] === w)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
values.length = count;
|
|
123
|
+
values[0] = x;
|
|
124
|
+
if (count > 1) {
|
|
125
|
+
values[1] = y;
|
|
126
|
+
}
|
|
127
|
+
if (count > 2) {
|
|
128
|
+
values[2] = z;
|
|
129
|
+
}
|
|
130
|
+
if (count > 3) {
|
|
131
|
+
values[3] = w;
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
function uniformCommand(effect, name, command) {
|
|
136
|
+
useEffect(effect);
|
|
137
|
+
const commands = effect._engine._commands;
|
|
138
|
+
commands.start(command);
|
|
139
|
+
commands.handle(effect._uniforms[name]);
|
|
140
|
+
}
|
|
141
|
+
/** Uploads a changed scalar float. */
|
|
142
|
+
export function setEffectFloat(effect, name, x) {
|
|
143
|
+
if (changed(effect, name, 1, x)) {
|
|
144
|
+
const engine = effect._engine;
|
|
145
|
+
uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT);
|
|
146
|
+
engine._commands.float(x);
|
|
147
|
+
engine._commands.finish();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Uploads a changed two-component float. */
|
|
151
|
+
export function setEffectFloat2(effect, name, x, y) {
|
|
152
|
+
if (changed(effect, name, 2, x, y)) {
|
|
153
|
+
const engine = effect._engine;
|
|
154
|
+
uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT2);
|
|
155
|
+
engine._commands.float(x);
|
|
156
|
+
engine._commands.float(y);
|
|
157
|
+
engine._commands.finish();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Uploads a changed three-component float. */
|
|
161
|
+
export function setEffectFloat3(effect, name, x, y, z) {
|
|
162
|
+
if (changed(effect, name, 3, x, y, z)) {
|
|
163
|
+
const engine = effect._engine;
|
|
164
|
+
uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT3);
|
|
165
|
+
engine._commands.float(x);
|
|
166
|
+
engine._commands.float(y);
|
|
167
|
+
engine._commands.float(z);
|
|
168
|
+
engine._commands.finish();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** Uploads a changed four-component float. */
|
|
172
|
+
export function setEffectFloat4(effect, name, x, y, z, w) {
|
|
173
|
+
if (changed(effect, name, 4, x, y, z, w)) {
|
|
174
|
+
const engine = effect._engine;
|
|
175
|
+
uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT4);
|
|
176
|
+
engine._commands.float(x);
|
|
177
|
+
engine._commands.float(y);
|
|
178
|
+
engine._commands.float(z);
|
|
179
|
+
engine._commands.float(w);
|
|
180
|
+
engine._commands.finish();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** Uploads a changed scalar integer or Boolean uniform. */
|
|
184
|
+
export function setEffectInt(effect, name, value) {
|
|
185
|
+
if (changed(effect, name, 1, value)) {
|
|
186
|
+
const engine = effect._engine;
|
|
187
|
+
uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETINT);
|
|
188
|
+
engine._commands.int(value);
|
|
189
|
+
engine._commands.finish();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @internal Uploads a changed declared array uniform; a rejected upload records nothing and leaves its own cached value unchanged.
|
|
194
|
+
* When reading the values makes a nested array upload, the nested upload keeps its result and this upload is rejected.
|
|
195
|
+
*/
|
|
196
|
+
export function setUniformArray(effect, name, values, command) {
|
|
197
|
+
const cached = effect._values[name];
|
|
198
|
+
if (!cached || !effect._uniforms[name] || effect._disposed || effect._engine._disposed) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const commands = effect._engine._commands;
|
|
202
|
+
const length = values.length;
|
|
203
|
+
const generation = commands.beginStaging(length);
|
|
204
|
+
// Every element is read once, before anything is recorded or cached, so a throwing read leaves both unchanged.
|
|
205
|
+
const staging = commands.staging;
|
|
206
|
+
let differs = cached.length !== length;
|
|
207
|
+
for (let index = 0; index < length; index++) {
|
|
208
|
+
const value = values[index];
|
|
209
|
+
staging[index] = value;
|
|
210
|
+
if (cached[index] !== value) {
|
|
211
|
+
differs = true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
commands.endStaging(generation);
|
|
215
|
+
// A value read may have disposed the effect or its engine.
|
|
216
|
+
if (!differs || effect._disposed || effect._engine._disposed) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
uniformCommand(effect, name, command);
|
|
220
|
+
commands.array(staging, length);
|
|
221
|
+
commands.finish();
|
|
222
|
+
cached.length = length;
|
|
223
|
+
for (let index = 0; index < length; index++) {
|
|
224
|
+
cached[index] = staging[index];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/** Uploads a changed matrix in column-major order. */
|
|
228
|
+
export function setEffectMatrix(effect, name, values) {
|
|
229
|
+
setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETMATRICES);
|
|
230
|
+
}
|
|
231
|
+
/** Uploads a changed scalar float array. */
|
|
232
|
+
export function setEffectFloatArray(effect, name, values) {
|
|
233
|
+
setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY);
|
|
234
|
+
}
|
|
235
|
+
/** Uploads a changed array of two-component floats. */
|
|
236
|
+
export function setEffectFloatArray2(effect, name, values) {
|
|
237
|
+
setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY2);
|
|
238
|
+
}
|
|
239
|
+
/** Uploads a changed array of three-component floats. */
|
|
240
|
+
export function setEffectFloatArray3(effect, name, values) {
|
|
241
|
+
setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY3);
|
|
242
|
+
}
|
|
243
|
+
/** Uploads a changed array of four-component floats. */
|
|
244
|
+
export function setEffectFloatArray4(effect, name, values) {
|
|
245
|
+
setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY4);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Binds a texture to a declared sampler without repeating an unchanged binding.
|
|
249
|
+
* No-op for an undeclared sampler, a texture of another engine, or a disposed
|
|
250
|
+
* effect, texture or engine.
|
|
251
|
+
*/
|
|
252
|
+
export function setEffectTexture(effect, name, texture) {
|
|
253
|
+
const engine = effect._engine;
|
|
254
|
+
const uniform = effect._uniforms[name];
|
|
255
|
+
if (!uniform || !(name in effect._textures) || effect._disposed || texture._disposed || texture._engine !== engine || engine._disposed) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
useEffect(effect);
|
|
259
|
+
// Native retains program uniforms, but sampler slots belong to the current frame's encoder.
|
|
260
|
+
if (effect._textureGeneration !== engine._textureGeneration) {
|
|
261
|
+
for (let index = 0; index < effect._samplers.length; index++) {
|
|
262
|
+
effect._textures[effect._samplers[index]] = undefined;
|
|
263
|
+
}
|
|
264
|
+
effect._textureGeneration = engine._textureGeneration;
|
|
265
|
+
}
|
|
266
|
+
if (effect._textures[name] === texture._handle) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const commands = engine._commands;
|
|
270
|
+
commands.start(engine._runtime.Engine.COMMAND_SETTEXTURE);
|
|
271
|
+
commands.handle(uniform);
|
|
272
|
+
commands.handle(texture._handle);
|
|
273
|
+
commands.finish();
|
|
274
|
+
effect._textures[name] = texture._handle;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.js","sourceRoot":"","sources":["../../src/native/effect.ts"],"names":[],"mappings":"AA6BA,wDAAwD;AACxD,MAAM,UAAU,YAAY,CAAC,MAAuB,EAAE,OAAwB;IAC1E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;IACvI,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAA0B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAwB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAW,CAAC;QACpC,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACtB,CAAC;IACD,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC,OAA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type { GLEffectOptions } from \"../family.js\";\nimport type { GLEngineContext } from \"./context.js\";\nimport type { NativeResource, NativeResourceFields } from \"./identity.js\";\nimport type { NativeHandle } from \"./runtime.js\";\nimport type { GLTexture } from \"./texture.js\";\n\n/** Native shader program and its retained upload state. */\nexport interface GLEffect extends NativeResource<\"effect\"> {\n readonly name: string;\n /** @internal */\n readonly _program: NativeHandle;\n /** @internal Declared uniform and sampler names; tables keyed by name have no prototype. */\n readonly _uniforms: Record<string, NativeHandle | null>;\n /** @internal */\n readonly _values: Record<string, number[]>;\n /** @internal Bound texture per declared sampler. */\n readonly _textures: Record<string, NativeHandle | undefined>;\n /** @internal */\n readonly _samplers: readonly string[];\n /** @internal */\n _textureGeneration: number;\n /** @internal */\n readonly _attributes: Record<string, number>;\n /** @internal The engine that owns this effect; effect operations derive it from here. */\n readonly _engine: GLEngineContext;\n /** @internal */\n _disposed: boolean;\n}\n\n/** Compiles a native effect from host-prepared GLSL. */\nexport function createEffect(engine: GLEngineContext, options: GLEffectOptions): GLEffect {\n const defines = options.defines ?? \"\";\n const program = engine._native.createProgram(withDefines(options.vertexSource, defines), withDefines(options.fragmentSource, defines));\n const names = [...options.uniformNames, ...options.samplerNames];\n const handles = engine._native.getUniforms(program, names);\n const uniforms: GLEffect[\"_uniforms\"] = Object.create(null);\n const values: GLEffect[\"_values\"] = Object.create(null);\n for (let index = 0; index < names.length; index++) {\n const name = names[index] as string;\n uniforms[name] = handles[index] ?? null;\n values[name] = [];\n }\n const attributeNames = [...(options.attributeNames ?? [\"position\"])];\n const locations = engine._native.getAttributes(program, attributeNames);\n const attributes: GLEffect[\"_attributes\"] = Object.create(null);\n for (let index = 0; index < attributeNames.length; index++) {\n attributes[attributeNames[index] as string] = locations[index] ?? -1;\n }\n const textures: GLEffect[\"_textures\"] = Object.create(null);\n for (const name of options.samplerNames) {\n textures[name] = undefined;\n }\n const fields: NativeResourceFields<GLEffect> = {\n name: options.name,\n _program: program,\n _uniforms: uniforms,\n _values: values,\n _textures: textures,\n _samplers: [...options.samplerNames],\n _textureGeneration: -1,\n _attributes: attributes,\n _engine: engine,\n _disposed: false,\n };\n return fields as GLEffect;\n}\n\n/** Native compiles unversioned GLSL, so the WebGL2 `#version` directive is dropped and defines lead the source. */\nfunction withDefines(source: string, defines: string): string {\n const version = findVersionDirective(source);\n let body = source;\n if (version >= 0) {\n const end = source.indexOf(\"\\n\", version);\n body = source.slice(0, version) + (end < 0 ? \"\" : source.slice(end + 1));\n }\n return defines ? `${defines}\\n${body}` : body;\n}\n\n/** Offset of a `#version` directive preceded only by whitespace and comments, or -1. */\nfunction findVersionDirective(source: string): number {\n let index = 0;\n while (index < source.length) {\n const char = source[index] as string;\n if (char === \" \" || char === \"\\t\" || char === \"\\r\" || char === \"\\n\") {\n index++;\n } else if (source.startsWith(\"//\", index)) {\n const end = source.indexOf(\"\\n\", index);\n index = end < 0 ? source.length : end + 1;\n } else if (source.startsWith(\"/*\", index)) {\n const end = source.indexOf(\"*/\", index + 2);\n index = end < 0 ? source.length : end + 2;\n } else {\n const directive = /#[ \\t]*version\\b/y;\n directive.lastIndex = index;\n return directive.test(source) ? index : -1;\n }\n }\n return -1;\n}\n\n/** Selects a program without reissuing an unchanged native binding. No-op for a disposed effect or engine. */\nexport function useEffect(effect: GLEffect): void {\n const engine = effect._engine;\n if (effect._disposed || engine._disposed) {\n return;\n }\n if (engine._program !== effect._program) {\n const commands = engine._commands;\n commands.start(engine._runtime.Engine.COMMAND_SETPROGRAM);\n commands.handle(effect._program);\n commands.finish();\n engine._program = effect._program;\n engine._textureGeneration++;\n }\n}\n\n/** Reports whether the effect's synchronous compilation succeeded and it is still owned. */\nexport function isEffectReady(effect: GLEffect): boolean {\n return !effect._disposed;\n}\n\n/** Native compilation failures throw from {@link createEffect}, so there is never a deferred error. */\nexport function getEffectCompilationError(_effect: GLEffect): string | null {\n return null;\n}\n\n/** Releases the owned shader program; after engine disposal it only marks the effect disposed. */\nexport function disposeEffect(effect: GLEffect): void {\n if (effect._disposed) {\n return;\n }\n effect._disposed = true;\n const engine = effect._engine;\n if (engine._disposed) {\n return;\n }\n const commands = engine._commands;\n commands.start(engine._runtime.Engine.COMMAND_DELETEPROGRAM);\n commands.handle(effect._program);\n commands.finish();\n if (engine._program === effect._program) {\n engine._program = null;\n }\n}\n\n/** Records a changed declared uniform of a live effect and reports whether to upload it. */\nfunction changed(effect: GLEffect, name: string, count: number, x: number, y = 0, z = 0, w = 0): boolean {\n const values = effect._values[name];\n if (!values || !effect._uniforms[name] || effect._disposed || effect._engine._disposed) {\n return false;\n }\n if (values.length === count && values[0] === x && (count < 2 || values[1] === y) && (count < 3 || values[2] === z) && (count < 4 || values[3] === w)) {\n return false;\n }\n values.length = count;\n values[0] = x;\n if (count > 1) {\n values[1] = y;\n }\n if (count > 2) {\n values[2] = z;\n }\n if (count > 3) {\n values[3] = w;\n }\n return true;\n}\n\nfunction uniformCommand(effect: GLEffect, name: string, command: NativeHandle): void {\n useEffect(effect);\n const commands = effect._engine._commands;\n commands.start(command);\n commands.handle(effect._uniforms[name] as NativeHandle);\n}\n\n/** Uploads a changed scalar float. */\nexport function setEffectFloat(effect: GLEffect, name: string, x: number): void {\n if (changed(effect, name, 1, x)) {\n const engine = effect._engine;\n uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT);\n engine._commands.float(x);\n engine._commands.finish();\n }\n}\n\n/** Uploads a changed two-component float. */\nexport function setEffectFloat2(effect: GLEffect, name: string, x: number, y: number): void {\n if (changed(effect, name, 2, x, y)) {\n const engine = effect._engine;\n uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT2);\n engine._commands.float(x);\n engine._commands.float(y);\n engine._commands.finish();\n }\n}\n\n/** Uploads a changed three-component float. */\nexport function setEffectFloat3(effect: GLEffect, name: string, x: number, y: number, z: number): void {\n if (changed(effect, name, 3, x, y, z)) {\n const engine = effect._engine;\n uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT3);\n engine._commands.float(x);\n engine._commands.float(y);\n engine._commands.float(z);\n engine._commands.finish();\n }\n}\n\n/** Uploads a changed four-component float. */\nexport function setEffectFloat4(effect: GLEffect, name: string, x: number, y: number, z: number, w: number): void {\n if (changed(effect, name, 4, x, y, z, w)) {\n const engine = effect._engine;\n uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETFLOAT4);\n engine._commands.float(x);\n engine._commands.float(y);\n engine._commands.float(z);\n engine._commands.float(w);\n engine._commands.finish();\n }\n}\n\n/** Uploads a changed scalar integer or Boolean uniform. */\nexport function setEffectInt(effect: GLEffect, name: string, value: number): void {\n if (changed(effect, name, 1, value)) {\n const engine = effect._engine;\n uniformCommand(effect, name, engine._runtime.Engine.COMMAND_SETINT);\n engine._commands.int(value);\n engine._commands.finish();\n }\n}\n\n/**\n * @internal Uploads a changed declared array uniform; a rejected upload records nothing and leaves its own cached value unchanged.\n * When reading the values makes a nested array upload, the nested upload keeps its result and this upload is rejected.\n */\nexport function setUniformArray(effect: GLEffect, name: string, values: ArrayLike<number>, command: NativeHandle): void {\n const cached = effect._values[name];\n if (!cached || !effect._uniforms[name] || effect._disposed || effect._engine._disposed) {\n return;\n }\n const commands = effect._engine._commands;\n const length = values.length;\n const generation = commands.beginStaging(length);\n // Every element is read once, before anything is recorded or cached, so a throwing read leaves both unchanged.\n const staging = commands.staging;\n let differs = cached.length !== length;\n for (let index = 0; index < length; index++) {\n const value = values[index] as number;\n staging[index] = value;\n if (cached[index] !== value) {\n differs = true;\n }\n }\n commands.endStaging(generation);\n // A value read may have disposed the effect or its engine.\n if (!differs || effect._disposed || effect._engine._disposed) {\n return;\n }\n uniformCommand(effect, name, command);\n commands.array(staging, length);\n commands.finish();\n cached.length = length;\n for (let index = 0; index < length; index++) {\n cached[index] = staging[index] as number;\n }\n}\n\n/** Uploads a changed matrix in column-major order. */\nexport function setEffectMatrix(effect: GLEffect, name: string, values: ArrayLike<number>): void {\n setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETMATRICES);\n}\n\n/** Uploads a changed scalar float array. */\nexport function setEffectFloatArray(effect: GLEffect, name: string, values: ArrayLike<number>): void {\n setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY);\n}\n\n/** Uploads a changed array of two-component floats. */\nexport function setEffectFloatArray2(effect: GLEffect, name: string, values: ArrayLike<number>): void {\n setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY2);\n}\n\n/** Uploads a changed array of three-component floats. */\nexport function setEffectFloatArray3(effect: GLEffect, name: string, values: ArrayLike<number>): void {\n setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY3);\n}\n\n/** Uploads a changed array of four-component floats. */\nexport function setEffectFloatArray4(effect: GLEffect, name: string, values: ArrayLike<number>): void {\n setUniformArray(effect, name, values, effect._engine._runtime.Engine.COMMAND_SETFLOATARRAY4);\n}\n\n/**\n * Binds a texture to a declared sampler without repeating an unchanged binding.\n * No-op for an undeclared sampler, a texture of another engine, or a disposed\n * effect, texture or engine.\n */\nexport function setEffectTexture(effect: GLEffect, name: string, texture: GLTexture): void {\n const engine = effect._engine;\n const uniform = effect._uniforms[name];\n if (!uniform || !(name in effect._textures) || effect._disposed || texture._disposed || texture._engine !== engine || engine._disposed) {\n return;\n }\n useEffect(effect);\n // Native retains program uniforms, but sampler slots belong to the current frame's encoder.\n if (effect._textureGeneration !== engine._textureGeneration) {\n for (let index = 0; index < effect._samplers.length; index++) {\n effect._textures[effect._samplers[index] as string] = undefined;\n }\n effect._textureGeneration = engine._textureGeneration;\n }\n if (effect._textures[name] === texture._handle) {\n return;\n }\n const commands = engine._commands;\n commands.start(engine._runtime.Engine.COMMAND_SETTEXTURE);\n commands.handle(uniform);\n commands.handle(texture._handle);\n commands.finish();\n effect._textures[name] = texture._handle;\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { GLFamily } from "../family.js";
|
|
2
|
+
import type { GLEngineContext, createNativeEngine, disposeNativeEngine } from "./context.js";
|
|
3
|
+
import type { GLEffect } from "./effect.js";
|
|
4
|
+
import type { GLAttributeDescriptor, GLIndexBuffer, GLMeshVao, GLVertexBuffer } from "./mesh.js";
|
|
5
|
+
import type { GLRenderTarget, GLRenderTargetOptions, updateWrappedNativeTexture } from "./render-target.js";
|
|
6
|
+
import type { GLBlendMode } from "./state.js";
|
|
7
|
+
import type { GLRawTextureOptions, GLTexture, GLTextureOptions, wrapNativeTexture } from "./texture.js";
|
|
8
|
+
/**
|
|
9
|
+
* The Babylon Native backend's types for the backend-neutral contract.
|
|
10
|
+
*
|
|
11
|
+
* Slots of features this backend does not implement are `never`, so their
|
|
12
|
+
* operations cannot be satisfied by native functions.
|
|
13
|
+
*/
|
|
14
|
+
export interface NativeGLFamily extends GLFamily {
|
|
15
|
+
readonly engine: GLEngineContext;
|
|
16
|
+
readonly effect: GLEffect;
|
|
17
|
+
readonly effectWrapper: never;
|
|
18
|
+
readonly texture: GLTexture;
|
|
19
|
+
readonly texture3D: never;
|
|
20
|
+
readonly renderTarget: GLRenderTarget;
|
|
21
|
+
readonly vertexBuffer: GLVertexBuffer;
|
|
22
|
+
readonly indexBuffer: GLIndexBuffer;
|
|
23
|
+
readonly meshVao: GLMeshVao;
|
|
24
|
+
readonly spriteRenderer: never;
|
|
25
|
+
readonly font: never;
|
|
26
|
+
readonly glyphStorage: never;
|
|
27
|
+
readonly textData: never;
|
|
28
|
+
readonly defaultTextData: never;
|
|
29
|
+
readonly textLayer: never;
|
|
30
|
+
readonly textRenderer: never;
|
|
31
|
+
readonly perfCounter: never;
|
|
32
|
+
/** Native samplers always sample a texture. */
|
|
33
|
+
readonly noTexture: never;
|
|
34
|
+
/** Native draws are non-instanced. */
|
|
35
|
+
readonly instanceCount: 0;
|
|
36
|
+
/** Native vertex buffers are immutable, so creation takes only the data. */
|
|
37
|
+
readonly vertexBufferArgs: [];
|
|
38
|
+
readonly floatArray: ArrayLike<number>;
|
|
39
|
+
/** Native raw uploads take RGBA8 bytes. */
|
|
40
|
+
readonly rawTextureData: Uint8Array;
|
|
41
|
+
readonly rawTextureOptions: GLRawTextureOptions;
|
|
42
|
+
readonly textureOptions: GLTextureOptions;
|
|
43
|
+
readonly renderTargetOptions: GLRenderTargetOptions;
|
|
44
|
+
readonly attributeDescriptor: GLAttributeDescriptor;
|
|
45
|
+
readonly blendMode: GLBlendMode;
|
|
46
|
+
readonly effectWaitOptions: never;
|
|
47
|
+
readonly effectWrapperOptions: never;
|
|
48
|
+
readonly textureUpdateOptions: never;
|
|
49
|
+
readonly floatTextureOptions: never;
|
|
50
|
+
readonly samplingMode: never;
|
|
51
|
+
readonly samplingFilters: never;
|
|
52
|
+
readonly texture3DOptions: never;
|
|
53
|
+
readonly floatRenderTargetOptions: never;
|
|
54
|
+
readonly readPixelsOptions: never;
|
|
55
|
+
readonly blendState: never;
|
|
56
|
+
readonly depthState: never;
|
|
57
|
+
readonly stencilState: never;
|
|
58
|
+
readonly stencilOpState: never;
|
|
59
|
+
readonly spriteRendererOptions: never;
|
|
60
|
+
readonly sprite: never;
|
|
61
|
+
readonly glyphCurves: never;
|
|
62
|
+
readonly quadCurve: never;
|
|
63
|
+
readonly glyphRun: never;
|
|
64
|
+
readonly textDataUpdate: never;
|
|
65
|
+
readonly textLayoutOptions: never;
|
|
66
|
+
readonly textLayerOptions: never;
|
|
67
|
+
readonly textRendererOptions: never;
|
|
68
|
+
}
|
|
69
|
+
/** Native operations that create or destroy an engine or exchange data with native texture storage. */
|
|
70
|
+
export interface NativeGLHostOps {
|
|
71
|
+
readonly createNativeEngine: typeof createNativeEngine;
|
|
72
|
+
readonly disposeNativeEngine: typeof disposeNativeEngine;
|
|
73
|
+
readonly wrapNativeTexture: typeof wrapNativeTexture;
|
|
74
|
+
readonly updateWrappedNativeTexture: typeof updateWrappedNativeTexture;
|
|
75
|
+
}
|
package/native/family.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family.js","sourceRoot":"","sources":["../../src/native/family.ts"],"names":[],"mappings":"","sourcesContent":["import type { GLFamily } from \"../family.js\";\nimport type { GLEngineContext, createNativeEngine, disposeNativeEngine } from \"./context.js\";\nimport type { GLEffect } from \"./effect.js\";\nimport type { GLAttributeDescriptor, GLIndexBuffer, GLMeshVao, GLVertexBuffer } from \"./mesh.js\";\nimport type { GLRenderTarget, GLRenderTargetOptions, updateWrappedNativeTexture } from \"./render-target.js\";\nimport type { GLBlendMode } from \"./state.js\";\nimport type { GLRawTextureOptions, GLTexture, GLTextureOptions, wrapNativeTexture } from \"./texture.js\";\n\n/**\n * The Babylon Native backend's types for the backend-neutral contract.\n *\n * Slots of features this backend does not implement are `never`, so their\n * operations cannot be satisfied by native functions.\n */\nexport interface NativeGLFamily extends GLFamily {\n readonly engine: GLEngineContext;\n readonly effect: GLEffect;\n readonly effectWrapper: never;\n readonly texture: GLTexture;\n readonly texture3D: never;\n readonly renderTarget: GLRenderTarget;\n readonly vertexBuffer: GLVertexBuffer;\n readonly indexBuffer: GLIndexBuffer;\n readonly meshVao: GLMeshVao;\n readonly spriteRenderer: never;\n readonly font: never;\n readonly glyphStorage: never;\n readonly textData: never;\n readonly defaultTextData: never;\n readonly textLayer: never;\n readonly textRenderer: never;\n readonly perfCounter: never;\n /** Native samplers always sample a texture. */\n readonly noTexture: never;\n /** Native draws are non-instanced. */\n readonly instanceCount: 0;\n /** Native vertex buffers are immutable, so creation takes only the data. */\n readonly vertexBufferArgs: [];\n readonly floatArray: ArrayLike<number>;\n /** Native raw uploads take RGBA8 bytes. */\n readonly rawTextureData: Uint8Array;\n readonly rawTextureOptions: GLRawTextureOptions;\n readonly textureOptions: GLTextureOptions;\n readonly renderTargetOptions: GLRenderTargetOptions;\n readonly attributeDescriptor: GLAttributeDescriptor;\n readonly blendMode: GLBlendMode;\n readonly effectWaitOptions: never;\n readonly effectWrapperOptions: never;\n readonly textureUpdateOptions: never;\n readonly floatTextureOptions: never;\n readonly samplingMode: never;\n readonly samplingFilters: never;\n readonly texture3DOptions: never;\n readonly floatRenderTargetOptions: never;\n readonly readPixelsOptions: never;\n readonly blendState: never;\n readonly depthState: never;\n readonly stencilState: never;\n readonly stencilOpState: never;\n readonly spriteRendererOptions: never;\n readonly sprite: never;\n readonly glyphCurves: never;\n readonly quadCurve: never;\n readonly glyphRun: never;\n readonly textDataUpdate: never;\n readonly textLayoutOptions: never;\n readonly textLayerOptions: never;\n readonly textRendererOptions: never;\n}\n\n/** Native operations that create or destroy an engine or exchange data with native texture storage. */\nexport interface NativeGLHostOps {\n readonly createNativeEngine: typeof createNativeEngine;\n readonly disposeNativeEngine: typeof disposeNativeEngine;\n readonly wrapNativeTexture: typeof wrapNativeTexture;\n readonly updateWrappedNativeTexture: typeof updateWrappedNativeTexture;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Keeps native resources distinct across backends and resource kinds in published declarations. */
|
|
2
|
+
export declare const nativeResource: unique symbol;
|
|
3
|
+
/** The kinds of resource the native backend creates. */
|
|
4
|
+
export type NativeResourceKind = "engine" | "effect" | "texture" | "renderTarget" | "vertexBuffer" | "indexBuffer" | "meshVao";
|
|
5
|
+
/** Marks a type as the native resource of one kind. */
|
|
6
|
+
export interface NativeResource<Kind extends NativeResourceKind> {
|
|
7
|
+
/** Distinguishes native resources by backend and kind; never present at runtime. */
|
|
8
|
+
readonly [nativeResource]: Kind;
|
|
9
|
+
}
|
|
10
|
+
/** A native resource's fields as its creator builds them, without the type-only identity. */
|
|
11
|
+
export type NativeResourceFields<T> = Omit<T, typeof nativeResource>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/native/identity.ts"],"names":[],"mappings":"","sourcesContent":["/** Keeps native resources distinct across backends and resource kinds in published declarations. */\nexport declare const nativeResource: unique symbol;\n\n/** The kinds of resource the native backend creates. */\nexport type NativeResourceKind = \"engine\" | \"effect\" | \"texture\" | \"renderTarget\" | \"vertexBuffer\" | \"indexBuffer\" | \"meshVao\";\n\n/** Marks a type as the native resource of one kind. */\nexport interface NativeResource<Kind extends NativeResourceKind> {\n /** Distinguishes native resources by backend and kind; never present at runtime. */\n readonly [nativeResource]: Kind;\n}\n\n/** A native resource's fields as its creator builds them, without the type-only identity. */\nexport type NativeResourceFields<T> = Omit<T, typeof nativeResource>;\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental, temporary Babylon Native backend for evaluation.
|
|
3
|
+
* Its API and implementation may change, be replaced, or be removed.
|
|
4
|
+
*
|
|
5
|
+
* It implements a subset of the backend-neutral contract in
|
|
6
|
+
* `@babylonjs/lite-gl/family`, described by {@link NativeGLFamily}, plus the
|
|
7
|
+
* native host operations in {@link NativeGLHostOps}.
|
|
8
|
+
*
|
|
9
|
+
* @experimental
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
export type { GLEffectOptions, GLViewport, GLClearOptions } from "../family.js";
|
|
13
|
+
export type { NativeGLFamily, NativeGLHostOps } from "./family.js";
|
|
14
|
+
export { createNativeEngine, disposeNativeEngine, beginFrame, endFrame, getRenderWidth, getRenderHeight, getCurrentRenderTarget } from "./context.js";
|
|
15
|
+
export type { GLEngineCaps, GLEngineContext } from "./context.js";
|
|
16
|
+
export { createEffect, useEffect, isEffectReady, getEffectCompilationError, disposeEffect, setEffectFloat, setEffectFloat2, setEffectFloat3, setEffectFloat4, setEffectInt, setEffectMatrix, setEffectFloatArray, setEffectFloatArray2, setEffectFloatArray3, setEffectFloatArray4, setEffectTexture, } from "./effect.js";
|
|
17
|
+
export type { GLEffect } from "./effect.js";
|
|
18
|
+
export { createVertexBuffer, createIndexBuffer, createMeshVao, bindMeshVao, drawMesh, disposeBuffer, disposeMeshVao } from "./mesh.js";
|
|
19
|
+
export type { GLVertexBuffer, GLIndexBuffer, GLAttributeDescriptor, GLMeshVertexBuffer, GLMeshVao } from "./mesh.js";
|
|
20
|
+
export { wrapNativeTexture, createRawTexture, disposeTexture } from "./texture.js";
|
|
21
|
+
export type { GLTexture, GLTextureOptions, GLRawTextureOptions, NativeTextureHandle } from "./texture.js";
|
|
22
|
+
export { createRenderTarget, bindRenderTarget, restoreDefaultFramebuffer, updateWrappedNativeTexture, disposeRenderTarget } from "./render-target.js";
|
|
23
|
+
export type { GLRenderTarget, GLRenderTargetOptions } from "./render-target.js";
|
|
24
|
+
export { setViewport, setScissor, disableScissor, setBlendMode, clearEngine } from "./state.js";
|
|
25
|
+
export type { GLBlendMode } from "./state.js";
|
package/native/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createNativeEngine, disposeNativeEngine, beginFrame, endFrame, getRenderWidth, getRenderHeight, getCurrentRenderTarget } from "./context.js";
|
|
2
|
+
export { createEffect, useEffect, isEffectReady, getEffectCompilationError, disposeEffect, setEffectFloat, setEffectFloat2, setEffectFloat3, setEffectFloat4, setEffectInt, setEffectMatrix, setEffectFloatArray, setEffectFloatArray2, setEffectFloatArray3, setEffectFloatArray4, setEffectTexture, } from "./effect.js";
|
|
3
|
+
export { createVertexBuffer, createIndexBuffer, createMeshVao, bindMeshVao, drawMesh, disposeBuffer, disposeMeshVao } from "./mesh.js";
|
|
4
|
+
export { wrapNativeTexture, createRawTexture, disposeTexture } from "./texture.js";
|
|
5
|
+
export { createRenderTarget, bindRenderTarget, restoreDefaultFramebuffer, updateWrappedNativeTexture, disposeRenderTarget } from "./render-target.js";
|
|
6
|
+
export { setViewport, setScissor, disableScissor, setBlendMode, clearEngine } from "./state.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/native/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtJ,OAAO,EACH,YAAY,EACZ,SAAS,EACT,aAAa,EACb,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEvI,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEtJ,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC","sourcesContent":["/**\n * Experimental, temporary Babylon Native backend for evaluation.\n * Its API and implementation may change, be replaced, or be removed.\n *\n * It implements a subset of the backend-neutral contract in\n * `@babylonjs/lite-gl/family`, described by {@link NativeGLFamily}, plus the\n * native host operations in {@link NativeGLHostOps}.\n *\n * @experimental\n * @packageDocumentation\n */\nexport type { GLEffectOptions, GLViewport, GLClearOptions } from \"../family.js\";\nexport type { NativeGLFamily, NativeGLHostOps } from \"./family.js\";\nexport { createNativeEngine, disposeNativeEngine, beginFrame, endFrame, getRenderWidth, getRenderHeight, getCurrentRenderTarget } from \"./context.js\";\nexport type { GLEngineCaps, GLEngineContext } from \"./context.js\";\nexport {\n createEffect,\n useEffect,\n isEffectReady,\n getEffectCompilationError,\n disposeEffect,\n setEffectFloat,\n setEffectFloat2,\n setEffectFloat3,\n setEffectFloat4,\n setEffectInt,\n setEffectMatrix,\n setEffectFloatArray,\n setEffectFloatArray2,\n setEffectFloatArray3,\n setEffectFloatArray4,\n setEffectTexture,\n} from \"./effect.js\";\nexport type { GLEffect } from \"./effect.js\";\nexport { createVertexBuffer, createIndexBuffer, createMeshVao, bindMeshVao, drawMesh, disposeBuffer, disposeMeshVao } from \"./mesh.js\";\nexport type { GLVertexBuffer, GLIndexBuffer, GLAttributeDescriptor, GLMeshVertexBuffer, GLMeshVao } from \"./mesh.js\";\nexport { wrapNativeTexture, createRawTexture, disposeTexture } from \"./texture.js\";\nexport type { GLTexture, GLTextureOptions, GLRawTextureOptions, NativeTextureHandle } from \"./texture.js\";\nexport { createRenderTarget, bindRenderTarget, restoreDefaultFramebuffer, updateWrappedNativeTexture, disposeRenderTarget } from \"./render-target.js\";\nexport type { GLRenderTarget, GLRenderTargetOptions } from \"./render-target.js\";\nexport { setViewport, setScissor, disableScissor, setBlendMode, clearEngine } from \"./state.js\";\nexport type { GLBlendMode } from \"./state.js\";\n"]}
|
package/native/mesh.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { GLEngineContext } from "./context.js";
|
|
2
|
+
import type { GLEffect } from "./effect.js";
|
|
3
|
+
import type { NativeResource } from "./identity.js";
|
|
4
|
+
/** Owned immutable float vertex storage. */
|
|
5
|
+
export interface GLVertexBuffer extends NativeResource<"vertexBuffer"> {
|
|
6
|
+
readonly byteLength: number;
|
|
7
|
+
}
|
|
8
|
+
/** Owned immutable index storage. */
|
|
9
|
+
export interface GLIndexBuffer extends NativeResource<"indexBuffer"> {
|
|
10
|
+
readonly count: number;
|
|
11
|
+
}
|
|
12
|
+
/** A non-instanced float attribute in composition geometry. */
|
|
13
|
+
export interface GLAttributeDescriptor {
|
|
14
|
+
name: string;
|
|
15
|
+
size: number;
|
|
16
|
+
offset?: number;
|
|
17
|
+
/** Lite GL treats an omitted divisor as instanced, so per-vertex attributes state `0`. */
|
|
18
|
+
divisor: 0;
|
|
19
|
+
}
|
|
20
|
+
/** Attribute layout supplied by one vertex buffer. */
|
|
21
|
+
export interface GLMeshVertexBuffer {
|
|
22
|
+
buffer: GLVertexBuffer;
|
|
23
|
+
attributes: readonly GLAttributeDescriptor[];
|
|
24
|
+
computeStride?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Recorded composition geometry; the caller retains ownership of its buffers. */
|
|
27
|
+
export interface GLMeshVao extends NativeResource<"meshVao"> {
|
|
28
|
+
readonly indexCount: number;
|
|
29
|
+
}
|
|
30
|
+
/** Uploads immutable float vertex data. */
|
|
31
|
+
export declare function createVertexBuffer(engine: GLEngineContext, data: Float32Array): GLVertexBuffer;
|
|
32
|
+
/** Uploads immutable index data. */
|
|
33
|
+
export declare function createIndexBuffer(engine: GLEngineContext, data: Uint16Array | Uint32Array): GLIndexBuffer;
|
|
34
|
+
/**
|
|
35
|
+
* Records a mesh's attribute and index bindings independently of shader
|
|
36
|
+
* ownership. Attribute names the effect did not declare are resolved from its
|
|
37
|
+
* program here, once. Throws before any host call for a disposed engine, or for
|
|
38
|
+
* an effect or buffer of another engine or one that has been disposed.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createMeshVao(engine: GLEngineContext, vertexBuffers: readonly GLMeshVertexBuffer[], indexBuffer: GLIndexBuffer, effect: GLEffect): GLMeshVao;
|
|
41
|
+
/** Selects recorded geometry without repeating an unchanged native binding. No-op for disposed geometry or engine. */
|
|
42
|
+
export declare function bindMeshVao(mesh: GLMeshVao): void;
|
|
43
|
+
/**
|
|
44
|
+
* Draws a triangle range from recorded composition geometry; the range defaults
|
|
45
|
+
* to the indices from `indexStart` to the end and must lie within the mesh.
|
|
46
|
+
* Native composition does not instance. Draws nothing without a current
|
|
47
|
+
* program or while the scissor rectangle is empty.
|
|
48
|
+
*/
|
|
49
|
+
export declare function drawMesh(mesh: GLMeshVao, _instanceCount?: 0, indexStart?: number, indexCount?: number): void;
|
|
50
|
+
/** Releases owned vertex or index storage; after engine disposal it only marks the buffer disposed. */
|
|
51
|
+
export declare function disposeBuffer(buffer: GLVertexBuffer | GLIndexBuffer): void;
|
|
52
|
+
/** Releases recorded geometry without releasing its caller-owned buffers or shader; after engine disposal it only marks the geometry disposed. */
|
|
53
|
+
export declare function disposeMeshVao(mesh: GLMeshVao): void;
|