@babylonjs/lite-gl 1.23.0 → 1.24.1

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +103 -6
  3. package/blend.d.ts +1 -1
  4. package/blend.js +1 -1
  5. package/blend.js.map +1 -1
  6. package/context.d.ts +52 -4
  7. package/context.js +108 -11
  8. package/context.js.map +1 -1
  9. package/depth-stencil.d.ts +4 -16
  10. package/depth-stencil.js +10 -11
  11. package/depth-stencil.js.map +1 -1
  12. package/dynamic-texture.d.ts +6 -3
  13. package/dynamic-texture.js +16 -4
  14. package/dynamic-texture.js.map +1 -1
  15. package/effect-renderer.d.ts +1 -11
  16. package/effect-renderer.js.map +1 -1
  17. package/effect.d.ts +16 -29
  18. package/effect.js +52 -19
  19. package/effect.js.map +1 -1
  20. package/family.d.ts +474 -0
  21. package/family.js +14 -0
  22. package/family.js.map +1 -0
  23. package/framebuffer-validation.d.ts +20 -0
  24. package/framebuffer-validation.js +37 -0
  25. package/framebuffer-validation.js.map +1 -0
  26. package/html-texture.d.ts +2 -2
  27. package/html-texture.js.map +1 -1
  28. package/index.d.ts +10 -7
  29. package/index.js +5 -4
  30. package/index.js.map +1 -1
  31. package/mesh.d.ts +72 -15
  32. package/mesh.js +221 -64
  33. package/mesh.js.map +1 -1
  34. package/native/command-stream.d.ts +1 -0
  35. package/native/command-stream.js +135 -0
  36. package/native/command-stream.js.map +1 -0
  37. package/native/context.d.ts +26 -0
  38. package/native/context.js +89 -0
  39. package/native/context.js.map +1 -0
  40. package/native/effect.d.ts +44 -0
  41. package/native/effect.js +276 -0
  42. package/native/effect.js.map +1 -0
  43. package/native/family.d.ts +75 -0
  44. package/native/family.js +2 -0
  45. package/native/family.js.map +1 -0
  46. package/native/identity.d.ts +11 -0
  47. package/native/identity.js +2 -0
  48. package/native/identity.js.map +1 -0
  49. package/native/index.d.ts +25 -0
  50. package/native/index.js +7 -0
  51. package/native/index.js.map +1 -0
  52. package/native/mesh.d.ts +53 -0
  53. package/native/mesh.js +137 -0
  54. package/native/mesh.js.map +1 -0
  55. package/native/render-target.d.ts +35 -0
  56. package/native/render-target.js +159 -0
  57. package/native/render-target.js.map +1 -0
  58. package/native/runtime.d.ts +1 -0
  59. package/native/runtime.js +12 -0
  60. package/native/runtime.js.map +1 -0
  61. package/native/state.d.ts +19 -0
  62. package/native/state.js +104 -0
  63. package/native/state.js.map +1 -0
  64. package/native/texture.d.ts +37 -0
  65. package/native/texture.js +86 -0
  66. package/native/texture.js.map +1 -0
  67. package/package.json +11 -3
  68. package/render-target.d.ts +18 -9
  69. package/render-target.js +84 -31
  70. package/render-target.js.map +1 -1
  71. package/scissor.d.ts +3 -3
  72. package/scissor.js +2 -2
  73. package/scissor.js.map +1 -1
  74. package/sprites.d.ts +5 -3
  75. package/sprites.js +24 -23
  76. package/sprites.js.map +1 -1
  77. package/state.d.ts +26 -13
  78. package/state.js +15 -15
  79. package/state.js.map +1 -1
  80. package/text/_gpu/text-instances.js +1 -1
  81. package/text/_gpu/text-instances.js.map +1 -1
  82. package/text/text-renderer.js.map +1 -1
  83. package/texture-3d.d.ts +2 -1
  84. package/texture-3d.js +7 -2
  85. package/texture-3d.js.map +1 -1
  86. package/texture-source.d.ts +4 -2
  87. package/texture-source.js +3 -2
  88. package/texture-source.js.map +1 -1
  89. package/texture.d.ts +18 -8
  90. package/texture.js +61 -35
  91. package/texture.js.map +1 -1
  92. package/web-family.d.ts +88 -0
  93. package/web-family.js +2 -0
  94. package/web-family.js.map +1 -0
@@ -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,O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C,kBAAkB,EAAE,CAAC;QAC1D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YAC3D,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAW,CAAC,GAAG,SAAS,CAAC;QACpE,CAAC;QACD,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAC1D,CAAC;IACD,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;QAC7C,OAAO;IACX,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;IAClC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC1D,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;AAC7C,CAAC","sourcesContent":["import 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
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=family.js.map
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=identity.js.map
@@ -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";
@@ -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"]}
@@ -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;
package/native/mesh.js ADDED
@@ -0,0 +1,137 @@
1
+ /** Uploads immutable float vertex data. */
2
+ export function createVertexBuffer(engine, data) {
3
+ const fields = {
4
+ byteLength: data.byteLength,
5
+ _handle: engine._native.createVertexBuffer(data.buffer, data.byteOffset, data.byteLength, false),
6
+ _index: false,
7
+ _engine: engine,
8
+ _disposed: false,
9
+ };
10
+ return fields;
11
+ }
12
+ /** Uploads immutable index data. */
13
+ export function createIndexBuffer(engine, data) {
14
+ const fields = {
15
+ count: data.length,
16
+ _handle: engine._native.createIndexBuffer(data.buffer, data.byteOffset, data.byteLength, data.BYTES_PER_ELEMENT === 4, false),
17
+ _index: true,
18
+ _engine: engine,
19
+ _disposed: false,
20
+ };
21
+ return fields;
22
+ }
23
+ /**
24
+ * Records a mesh's attribute and index bindings independently of shader
25
+ * ownership. Attribute names the effect did not declare are resolved from its
26
+ * program here, once. Throws before any host call for a disposed engine, or for
27
+ * an effect or buffer of another engine or one that has been disposed.
28
+ */
29
+ export function createMeshVao(engine, vertexBuffers, indexBuffer, effect) {
30
+ if (engine._disposed || !isUsable(engine, effect) || !isUsable(engine, indexBuffer) || !vertexBuffers.every((binding) => isUsable(engine, binding.buffer))) {
31
+ throw new Error("Native Lite GL createMeshVao requires an effect and buffers of this engine that have not been disposed.");
32
+ }
33
+ const handle = engine._native.createVertexArray();
34
+ const fields = { indexCount: indexBuffer.count, _handle: handle, _engine: engine, _disposed: false };
35
+ const mesh = fields;
36
+ try {
37
+ engine._native.recordIndexBuffer(handle, indexBuffer._handle);
38
+ for (const binding of vertexBuffers) {
39
+ let stride = 0;
40
+ if (binding.computeStride) {
41
+ for (const attribute of binding.attributes) {
42
+ stride += attribute.size * 4;
43
+ }
44
+ }
45
+ for (const attribute of binding.attributes) {
46
+ const location = getAttributeLocation(engine, effect, attribute.name);
47
+ if (location >= 0) {
48
+ engine._native.recordVertexBuffer(handle, binding.buffer._handle, location, attribute.offset ?? 0, stride || attribute.size * 4, attribute.size, engine._runtime.Engine.ATTRIB_TYPE_FLOAT, false, attribute.divisor);
49
+ }
50
+ }
51
+ }
52
+ return mesh;
53
+ }
54
+ catch (error) {
55
+ disposeMeshVao(mesh);
56
+ throw error;
57
+ }
58
+ }
59
+ function isUsable(engine, resource) {
60
+ return resource._engine === engine && !resource._disposed;
61
+ }
62
+ function getAttributeLocation(engine, effect, name) {
63
+ let location = effect._attributes[name];
64
+ if (location === undefined) {
65
+ location = engine._native.getAttributes(effect._program, [name])[0] ?? -1;
66
+ effect._attributes[name] = location;
67
+ }
68
+ return location;
69
+ }
70
+ /** Selects recorded geometry without repeating an unchanged native binding. No-op for disposed geometry or engine. */
71
+ export function bindMeshVao(mesh) {
72
+ const engine = mesh._engine;
73
+ if (mesh._disposed || engine._disposed) {
74
+ return;
75
+ }
76
+ if (engine._vertexArray !== mesh._handle) {
77
+ const commands = engine._commands;
78
+ commands.start(engine._runtime.Engine.COMMAND_BINDVERTEXARRAY);
79
+ commands.handle(mesh._handle);
80
+ commands.finish();
81
+ engine._vertexArray = mesh._handle;
82
+ }
83
+ }
84
+ /**
85
+ * Draws a triangle range from recorded composition geometry; the range defaults
86
+ * to the indices from `indexStart` to the end and must lie within the mesh.
87
+ * Native composition does not instance. Draws nothing without a current
88
+ * program or while the scissor rectangle is empty.
89
+ */
90
+ export function drawMesh(mesh, _instanceCount = 0, indexStart = 0, indexCount = mesh.indexCount - indexStart) {
91
+ if (!Number.isInteger(indexStart) || !Number.isInteger(indexCount) || indexStart < 0 || indexCount < 0 || indexStart + indexCount > mesh.indexCount) {
92
+ throw new RangeError(`Native Lite GL drawMesh range (start ${indexStart}, count ${indexCount}) must be whole indices within the mesh's ${mesh.indexCount}.`);
93
+ }
94
+ const engine = mesh._engine;
95
+ if (engine._disposed || mesh._disposed || engine._program === null || engine._scissorEmpty) {
96
+ return;
97
+ }
98
+ bindMeshVao(mesh);
99
+ const commands = engine._commands;
100
+ commands.start(engine._runtime.Engine.COMMAND_DRAWINDEXED);
101
+ commands.uint(0);
102
+ commands.uint(indexStart);
103
+ commands.uint(indexCount);
104
+ commands.finish();
105
+ }
106
+ /** Releases owned vertex or index storage; after engine disposal it only marks the buffer disposed. */
107
+ export function disposeBuffer(buffer) {
108
+ if (!buffer._disposed) {
109
+ buffer._disposed = true;
110
+ const engine = buffer._engine;
111
+ if (engine._disposed) {
112
+ return;
113
+ }
114
+ const commands = engine._commands;
115
+ commands.start(buffer._index ? engine._runtime.Engine.COMMAND_DELETEINDEXBUFFER : engine._runtime.Engine.COMMAND_DELETEVERTEXBUFFER);
116
+ commands.handle(buffer._handle);
117
+ commands.finish();
118
+ }
119
+ }
120
+ /** Releases recorded geometry without releasing its caller-owned buffers or shader; after engine disposal it only marks the geometry disposed. */
121
+ export function disposeMeshVao(mesh) {
122
+ if (!mesh._disposed) {
123
+ mesh._disposed = true;
124
+ const engine = mesh._engine;
125
+ if (engine._disposed) {
126
+ return;
127
+ }
128
+ const commands = engine._commands;
129
+ commands.start(engine._runtime.Engine.COMMAND_DELETEVERTEXARRAY);
130
+ commands.handle(mesh._handle);
131
+ commands.finish();
132
+ if (engine._vertexArray === mesh._handle) {
133
+ engine._vertexArray = null;
134
+ }
135
+ }
136
+ }
137
+ //# sourceMappingURL=mesh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh.js","sourceRoot":"","sources":["../../src/native/mesh.ts"],"names":[],"mappings":"AA0DA,2CAA2C;AAC3C,MAAM,UAAU,kBAAkB,CAAC,MAAuB,EAAE,IAAkB;IAC1E,MAAM,MAAM,GAAyC;QACjD,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;QAChG,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,KAAK;KACnB,CAAC;IACF,OAAO,MAAwB,CAAC;AACpC,CAAC;AAED,oCAAoC;AACpC,MAAM,UAAU,iBAAiB,CAAC,MAAuB,EAAE,IAA+B;IACtF,MAAM,MAAM,GAAwC;QAChD,KAAK,EAAE,IAAI,CAAC,MAAM;QAClB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,iBAAiB,KAAK,CAAC,EAAE,KAAK,CAAC;QAC7H,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,MAAM;QACf,SA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QAAQ,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;QACjE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,QAAQ,CAAC,MAAM,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,YAAY,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;YACvC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC;QAC/B,CAAC;IACL,CAAC;AACL,CAAC","sourcesContent":["import type { GLEngineContext } from \"./context.js\";\nimport type { GLEffect } from \"./effect.js\";\nimport type { NativeResource, NativeResourceFields } from \"./identity.js\";\nimport type { NativeHandle } from \"./runtime.js\";\n\n/** Owned immutable float vertex storage. */\nexport interface GLVertexBuffer extends NativeResource<\"vertexBuffer\"> {\n readonly byteLength: number;\n /** @internal */\n readonly _handle: NativeHandle;\n /** @internal */\n readonly _index: false;\n /** @internal The engine that owns this buffer. */\n readonly _engine: GLEngineContext;\n /** @internal */\n _disposed: boolean;\n}\n\n/** Owned immutable index storage. */\nexport interface GLIndexBuffer extends NativeResource<\"indexBuffer\"> {\n readonly count: number;\n /** @internal */\n readonly _handle: NativeHandle;\n /** @internal */\n readonly _index: true;\n /** @internal The engine that owns this buffer. */\n readonly _engine: GLEngineContext;\n /** @internal */\n _disposed: boolean;\n}\n\n/** A non-instanced float attribute in composition geometry. */\nexport interface GLAttributeDescriptor {\n name: string;\n size: number;\n offset?: number;\n /** Lite GL treats an omitted divisor as instanced, so per-vertex attributes state `0`. */\n divisor: 0;\n}\n\n/** Attribute layout supplied by one vertex buffer. */\nexport interface GLMeshVertexBuffer {\n buffer: GLVertexBuffer;\n attributes: readonly GLAttributeDescriptor[];\n computeStride?: boolean;\n}\n\n/** Recorded composition geometry; the caller retains ownership of its buffers. */\nexport interface GLMeshVao extends NativeResource<\"meshVao\"> {\n readonly indexCount: number;\n /** @internal */\n readonly _handle: NativeHandle;\n /** @internal The engine that owns this vertex array. */\n readonly _engine: GLEngineContext;\n /** @internal */\n _disposed: boolean;\n}\n\n/** Uploads immutable float vertex data. */\nexport function createVertexBuffer(engine: GLEngineContext, data: Float32Array): GLVertexBuffer {\n const fields: NativeResourceFields<GLVertexBuffer> = {\n byteLength: data.byteLength,\n _handle: engine._native.createVertexBuffer(data.buffer, data.byteOffset, data.byteLength, false),\n _index: false,\n _engine: engine,\n _disposed: false,\n };\n return fields as GLVertexBuffer;\n}\n\n/** Uploads immutable index data. */\nexport function createIndexBuffer(engine: GLEngineContext, data: Uint16Array | Uint32Array): GLIndexBuffer {\n const fields: NativeResourceFields<GLIndexBuffer> = {\n count: data.length,\n _handle: engine._native.createIndexBuffer(data.buffer, data.byteOffset, data.byteLength, data.BYTES_PER_ELEMENT === 4, false),\n _index: true,\n _engine: engine,\n _disposed: false,\n };\n return fields as GLIndexBuffer;\n}\n\n/**\n * Records a mesh's attribute and index bindings independently of shader\n * ownership. Attribute names the effect did not declare are resolved from its\n * program here, once. Throws before any host call for a disposed engine, or for\n * an effect or buffer of another engine or one that has been disposed.\n */\nexport function createMeshVao(engine: GLEngineContext, vertexBuffers: readonly GLMeshVertexBuffer[], indexBuffer: GLIndexBuffer, effect: GLEffect): GLMeshVao {\n if (engine._disposed || !isUsable(engine, effect) || !isUsable(engine, indexBuffer) || !vertexBuffers.every((binding) => isUsable(engine, binding.buffer))) {\n throw new Error(\"Native Lite GL createMeshVao requires an effect and buffers of this engine that have not been disposed.\");\n }\n const handle = engine._native.createVertexArray();\n const fields: NativeResourceFields<GLMeshVao> = { indexCount: indexBuffer.count, _handle: handle, _engine: engine, _disposed: false };\n const mesh = fields as GLMeshVao;\n try {\n engine._native.recordIndexBuffer(handle, indexBuffer._handle);\n for (const binding of vertexBuffers) {\n let stride = 0;\n if (binding.computeStride) {\n for (const attribute of binding.attributes) {\n stride += attribute.size * 4;\n }\n }\n for (const attribute of binding.attributes) {\n const location = getAttributeLocation(engine, effect, attribute.name);\n if (location >= 0) {\n engine._native.recordVertexBuffer(\n handle,\n binding.buffer._handle,\n location,\n attribute.offset ?? 0,\n stride || attribute.size * 4,\n attribute.size,\n engine._runtime.Engine.ATTRIB_TYPE_FLOAT,\n false,\n attribute.divisor\n );\n }\n }\n }\n return mesh;\n } catch (error) {\n disposeMeshVao(mesh);\n throw error;\n }\n}\n\nfunction isUsable(engine: GLEngineContext, resource: { readonly _engine: GLEngineContext; readonly _disposed: boolean }): boolean {\n return resource._engine === engine && !resource._disposed;\n}\n\nfunction getAttributeLocation(engine: GLEngineContext, effect: GLEffect, name: string): number {\n let location = effect._attributes[name];\n if (location === undefined) {\n location = engine._native.getAttributes(effect._program, [name])[0] ?? -1;\n effect._attributes[name] = location;\n }\n return location;\n}\n\n/** Selects recorded geometry without repeating an unchanged native binding. No-op for disposed geometry or engine. */\nexport function bindMeshVao(mesh: GLMeshVao): void {\n const engine = mesh._engine;\n if (mesh._disposed || engine._disposed) {\n return;\n }\n if (engine._vertexArray !== mesh._handle) {\n const commands = engine._commands;\n commands.start(engine._runtime.Engine.COMMAND_BINDVERTEXARRAY);\n commands.handle(mesh._handle);\n commands.finish();\n engine._vertexArray = mesh._handle;\n }\n}\n\n/**\n * Draws a triangle range from recorded composition geometry; the range defaults\n * to the indices from `indexStart` to the end and must lie within the mesh.\n * Native composition does not instance. Draws nothing without a current\n * program or while the scissor rectangle is empty.\n */\nexport function drawMesh(mesh: GLMeshVao, _instanceCount: 0 = 0, indexStart = 0, indexCount = mesh.indexCount - indexStart): void {\n if (!Number.isInteger(indexStart) || !Number.isInteger(indexCount) || indexStart < 0 || indexCount < 0 || indexStart + indexCount > mesh.indexCount) {\n throw new RangeError(`Native Lite GL drawMesh range (start ${indexStart}, count ${indexCount}) must be whole indices within the mesh's ${mesh.indexCount}.`);\n }\n const engine = mesh._engine;\n if (engine._disposed || mesh._disposed || engine._program === null || engine._scissorEmpty) {\n return;\n }\n bindMeshVao(mesh);\n const commands = engine._commands;\n commands.start(engine._runtime.Engine.COMMAND_DRAWINDEXED);\n commands.uint(0);\n commands.uint(indexStart);\n commands.uint(indexCount);\n commands.finish();\n}\n\n/** Releases owned vertex or index storage; after engine disposal it only marks the buffer disposed. */\nexport function disposeBuffer(buffer: GLVertexBuffer | GLIndexBuffer): void {\n if (!buffer._disposed) {\n buffer._disposed = true;\n const engine = buffer._engine;\n if (engine._disposed) {\n return;\n }\n const commands = engine._commands;\n commands.start(buffer._index ? engine._runtime.Engine.COMMAND_DELETEINDEXBUFFER : engine._runtime.Engine.COMMAND_DELETEVERTEXBUFFER);\n commands.handle(buffer._handle);\n commands.finish();\n }\n}\n\n/** Releases recorded geometry without releasing its caller-owned buffers or shader; after engine disposal it only marks the geometry disposed. */\nexport function disposeMeshVao(mesh: GLMeshVao): void {\n if (!mesh._disposed) {\n mesh._disposed = true;\n const engine = mesh._engine;\n if (engine._disposed) {\n return;\n }\n const commands = engine._commands;\n commands.start(engine._runtime.Engine.COMMAND_DELETEVERTEXARRAY);\n commands.handle(mesh._handle);\n commands.finish();\n if (engine._vertexArray === mesh._handle) {\n engine._vertexArray = null;\n }\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import type { GLEngineContext } from "./context.js";
2
+ import type { NativeResource } from "./identity.js";
3
+ import type { GLTexture, NativeTextureHandle } from "./texture.js";
4
+ /** Options for {@link createRenderTarget}. */
5
+ export interface GLRenderTargetOptions {
6
+ /** Caller-owned color attachment to render into instead of an owned RGBA8 texture. */
7
+ colorTexture?: GLTexture;
8
+ }
9
+ /** Native framebuffer and its color attachment. */
10
+ export interface GLRenderTarget extends NativeResource<"renderTarget"> {
11
+ readonly width: number;
12
+ readonly height: number;
13
+ readonly texture: GLTexture;
14
+ }
15
+ /** Creates a composition target around an owned or supplied color attachment of a live engine; a supplied attachment must be a live, renderable texture of this engine. */
16
+ export declare function createRenderTarget(engine: GLEngineContext, width: number, height: number, options?: GLRenderTargetOptions): GLRenderTarget;
17
+ /**
18
+ * Selects the drawing target, resolving the prior framebuffer before changing it,
19
+ * and sets the viewport to cover it. No-op for a disposed target or engine.
20
+ */
21
+ export declare function bindRenderTarget(target: GLRenderTarget): void;
22
+ /** Selects the default output, resolving the prior framebuffer, and sets the viewport to cover it. No-op for a disposed engine. */
23
+ export declare function restoreDefaultFramebuffer(engine: GLEngineContext): void;
24
+ /**
25
+ * Repoints a borrowed texture while preserving its render-target identities.
26
+ * If the host cannot create a replacement framebuffer, the texture and its
27
+ * targets keep their previous handles, but Lite GL cannot restore host storage
28
+ * that already changed behind them; retry the update or restore the host
29
+ * storage before using the texture or its targets.
30
+ * A host can replace the storage behind the same handle object, so every call
31
+ * rebuilds the framebuffers; call it only when the storage has changed.
32
+ */
33
+ export declare function updateWrappedNativeTexture(texture: GLTexture, replacement: NativeTextureHandle): void;
34
+ /** Releases a framebuffer and only the color storage it owns; after engine disposal it only marks them disposed. */
35
+ export declare function disposeRenderTarget(target: GLRenderTarget | null | undefined): void;
@@ -0,0 +1,159 @@
1
+ import { setNormalizedViewport } from "./state.js";
2
+ import { configureTexture, disposeTexture, makeTexture, validateTextureSize } from "./texture.js";
3
+ /** Creates a composition target around an owned or supplied color attachment of a live engine; a supplied attachment must be a live, renderable texture of this engine. */
4
+ export function createRenderTarget(engine, width, height, options) {
5
+ if (engine._disposed) {
6
+ throw new Error("Native Lite GL createRenderTarget requires an engine that has not been disposed.");
7
+ }
8
+ validateTextureSize(engine, width, height);
9
+ const colorTexture = options?.colorTexture;
10
+ if (colorTexture && (colorTexture._engine !== engine || colorTexture._disposed)) {
11
+ throw new Error("Native Lite GL createRenderTarget requires a color texture of this engine that has not been disposed.");
12
+ }
13
+ if (colorTexture?._sampledOnly) {
14
+ throw new Error("Native Lite GL createRenderTarget cannot render into a sampled-only texture such as one from createRawTexture.");
15
+ }
16
+ let texture = colorTexture;
17
+ if (!texture) {
18
+ const handle = engine._native.createTexture();
19
+ try {
20
+ engine._native.initializeTexture(handle, width, height, false, engine._runtime.Engine.TEXTURE_FORMAT_RGBA8, true, false, 1);
21
+ texture = makeTexture(engine, handle, true, false);
22
+ }
23
+ catch (error) {
24
+ engine._native.deleteTexture(handle);
25
+ throw error;
26
+ }
27
+ }
28
+ try {
29
+ const fields = {
30
+ width,
31
+ height,
32
+ texture,
33
+ _framebuffer: engine._native.createFrameBuffer(texture._handle, width, height, false, false, 1),
34
+ _ownsTexture: !colorTexture,
35
+ _engine: engine,
36
+ _disposed: false,
37
+ };
38
+ const target = fields;
39
+ texture._targets.push(target);
40
+ return target;
41
+ }
42
+ catch (error) {
43
+ if (!colorTexture) {
44
+ disposeTexture(texture);
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ /**
50
+ * Selects the drawing target, resolving the prior framebuffer before changing it,
51
+ * and sets the viewport to cover it. No-op for a disposed target or engine.
52
+ */
53
+ export function bindRenderTarget(target) {
54
+ if (target._disposed || target._engine._disposed) {
55
+ return;
56
+ }
57
+ selectFramebuffer(target._engine, target);
58
+ setNormalizedViewport(target._engine, 0, 0, 1, 1, 1, 1);
59
+ }
60
+ /** Selects the default output, resolving the prior framebuffer, and sets the viewport to cover it. No-op for a disposed engine. */
61
+ export function restoreDefaultFramebuffer(engine) {
62
+ if (engine._disposed) {
63
+ return;
64
+ }
65
+ selectFramebuffer(engine, null);
66
+ setNormalizedViewport(engine, 0, 0, 1, 1, 1, 1);
67
+ }
68
+ function selectFramebuffer(engine, target) {
69
+ if (engine._target === target) {
70
+ return;
71
+ }
72
+ const commands = engine._commands;
73
+ if (engine._target) {
74
+ commands.start(engine._runtime.Engine.COMMAND_UNBINDFRAMEBUFFER);
75
+ commands.handle(engine._target._framebuffer);
76
+ commands.finish();
77
+ }
78
+ if (target) {
79
+ commands.start(engine._runtime.Engine.COMMAND_BINDFRAMEBUFFER);
80
+ commands.handle(target._framebuffer);
81
+ commands.finish();
82
+ }
83
+ engine._target = target;
84
+ // The native viewport belongs to the framebuffer binding, so the cached value no longer applies.
85
+ engine._viewport.fill(NaN);
86
+ }
87
+ const NO_FRAMEBUFFERS = [];
88
+ /**
89
+ * Repoints a borrowed texture while preserving its render-target identities.
90
+ * If the host cannot create a replacement framebuffer, the texture and its
91
+ * targets keep their previous handles, but Lite GL cannot restore host storage
92
+ * that already changed behind them; retry the update or restore the host
93
+ * storage before using the texture or its targets.
94
+ * A host can replace the storage behind the same handle object, so every call
95
+ * rebuilds the framebuffers; call it only when the storage has changed.
96
+ */
97
+ export function updateWrappedNativeTexture(texture, replacement) {
98
+ const engine = texture._engine;
99
+ if (texture._owned || texture.width !== engine._native.getTextureWidth(replacement) || texture.height !== engine._native.getTextureHeight(replacement)) {
100
+ throw new Error("Replacement native texture must preserve the borrowed texture's shape.");
101
+ }
102
+ const targets = texture._targets;
103
+ const framebuffers = targets.length === 0 ? NO_FRAMEBUFFERS : createFramebuffers(engine, targets, replacement);
104
+ for (const target of targets) {
105
+ if (engine._target === target) {
106
+ selectFramebuffer(engine, null);
107
+ }
108
+ }
109
+ texture._handle = replacement;
110
+ configureTexture(engine, texture);
111
+ for (let index = 0; index < targets.length; index++) {
112
+ const target = targets[index];
113
+ deleteFramebuffer(engine, target._framebuffer);
114
+ target._framebuffer = framebuffers[index];
115
+ }
116
+ }
117
+ function createFramebuffers(engine, targets, texture) {
118
+ const framebuffers = [];
119
+ try {
120
+ for (const target of targets) {
121
+ framebuffers.push(engine._native.createFrameBuffer(texture, target.width, target.height, false, false, 1));
122
+ }
123
+ return framebuffers;
124
+ }
125
+ catch (error) {
126
+ for (const framebuffer of framebuffers) {
127
+ deleteFramebuffer(engine, framebuffer);
128
+ }
129
+ throw error;
130
+ }
131
+ }
132
+ function deleteFramebuffer(engine, framebuffer) {
133
+ const commands = engine._commands;
134
+ commands.start(engine._runtime.Engine.COMMAND_DELETEFRAMEBUFFER);
135
+ commands.handle(framebuffer);
136
+ commands.finish();
137
+ }
138
+ /** Releases a framebuffer and only the color storage it owns; after engine disposal it only marks them disposed. */
139
+ export function disposeRenderTarget(target) {
140
+ if (!target || target._disposed) {
141
+ return;
142
+ }
143
+ target._disposed = true;
144
+ const engine = target._engine;
145
+ if (!engine._disposed) {
146
+ if (engine._target === target) {
147
+ selectFramebuffer(engine, null);
148
+ }
149
+ deleteFramebuffer(engine, target._framebuffer);
150
+ }
151
+ const index = target.texture._targets.indexOf(target);
152
+ if (index >= 0) {
153
+ target.texture._targets.splice(index, 1);
154
+ }
155
+ if (target._ownsTexture) {
156
+ disposeTexture(target.texture);
157
+ }
158
+ }
159
+ //# sourceMappingURL=render-target.js.map