melonjs 19.9.0 → 20.0.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/README.md +25 -14
- package/build/application/application.d.ts +70 -16
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +2 -2
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/settings.d.ts +150 -53
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +1 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +13 -11
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/const.d.ts +55 -26
- package/build/const.d.ts.map +1 -1
- package/build/geometries/box3d.d.ts +156 -0
- package/build/geometries/box3d.d.ts.map +1 -0
- package/build/index.d.ts +33 -23
- package/build/index.d.ts.map +1 -1
- package/build/index.js +21696 -7831
- package/build/index.js.map +4 -4
- package/build/lang/deprecated.d.ts +4 -4
- package/build/lang/deprecated.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +4 -0
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +42 -6
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/gltf/srgb.d.ts +20 -0
- package/build/level/gltf/srgb.d.ts.map +1 -0
- package/build/level/level.d.ts +21 -2
- package/build/level/level.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +61 -13
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/loader.d.ts +49 -21
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/mtl.d.ts +18 -0
- package/build/loader/parsers/mtl.d.ts.map +1 -1
- package/build/loader/parsers/obj.d.ts +49 -0
- package/build/loader/parsers/obj.d.ts.map +1 -1
- package/build/loader/parsers/pbr.d.ts +63 -0
- package/build/loader/parsers/pbr.d.ts.map +1 -0
- package/build/loader/parsers/shader.d.ts +32 -24
- package/build/loader/parsers/shader.d.ts.map +1 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +3 -1
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +12 -1
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/broadphase/octree.d.ts +35 -0
- package/build/physics/broadphase/octree.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +123 -6
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +12 -0
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/builtin/sat3d.d.ts +59 -0
- package/build/physics/builtin/sat3d.d.ts.map +1 -0
- package/build/physics/response.d.ts +32 -0
- package/build/physics/response.d.ts.map +1 -1
- package/build/physics/world.d.ts +1 -0
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +1 -0
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/entity/entity.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/groundshadow.d.ts +92 -0
- package/build/renderable/groundshadow.d.ts.map +1 -0
- package/build/renderable/instanced_mesh.d.ts +286 -0
- package/build/renderable/instanced_mesh.d.ts.map +1 -0
- package/build/renderable/mesh.d.ts +242 -23
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/nineslicesprite.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +6 -4
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +3 -1
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +17 -6
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -40
- package/build/system/device.d.ts.map +1 -1
- package/build/system/platform.d.ts +0 -16
- package/build/system/platform.d.ts.map +1 -1
- package/build/utils/utils.d.ts +2 -0
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +22 -16
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/{webgl/effects → effects}/blur.d.ts +2 -2
- package/build/video/effects/blur.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/chromaticAberration.d.ts +2 -2
- package/build/video/effects/chromaticAberration.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/colorMatrix.d.ts +3 -3
- package/build/video/effects/colorMatrix.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/desaturate.d.ts +1 -1
- package/build/video/effects/desaturate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dissolve.d.ts +2 -2
- package/build/video/effects/dissolve.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dropShadow.d.ts +2 -2
- package/build/video/effects/dropShadow.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/flash.d.ts +2 -2
- package/build/video/effects/flash.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/glow.d.ts +2 -2
- package/build/video/effects/glow.d.ts.map +1 -0
- package/build/video/effects/glsl_realization.d.ts +18 -0
- package/build/video/effects/glsl_realization.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/hologram.d.ts +2 -2
- package/build/video/effects/hologram.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/invert.d.ts +1 -1
- package/build/video/effects/invert.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/outline.d.ts +2 -2
- package/build/video/effects/outline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/pixelate.d.ts +2 -2
- package/build/video/effects/pixelate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/radialGradient.d.ts +3 -4
- package/build/video/effects/radialGradient.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/scanline.d.ts +2 -2
- package/build/video/effects/scanline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/sepia.d.ts +1 -1
- package/build/video/effects/sepia.d.ts.map +1 -0
- package/build/video/{webgl → effects}/shadereffect.d.ts +133 -25
- package/build/video/effects/shadereffect.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/shine.d.ts +2 -2
- package/build/video/effects/shine.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/tintPulse.d.ts +2 -2
- package/build/video/effects/tintPulse.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/vignette.d.ts +2 -2
- package/build/video/effects/vignette.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/wave.d.ts +2 -2
- package/build/video/effects/wave.d.ts.map +1 -0
- package/build/video/effects/wgsl/layout.d.ts +28 -0
- package/build/video/effects/wgsl/layout.d.ts.map +1 -0
- package/build/video/effects/wgsl/parse.d.ts +9 -0
- package/build/video/effects/wgsl/parse.d.ts.map +1 -0
- package/build/video/effects/wgsl/scaffold.d.ts +43 -0
- package/build/video/effects/wgsl/scaffold.d.ts.map +1 -0
- package/build/video/effects/wgsl_realization.d.ts +83 -0
- package/build/video/effects/wgsl_realization.d.ts.map +1 -0
- package/build/video/gpu/batcher.d.ts +71 -0
- package/build/video/gpu/batcher.d.ts.map +1 -0
- package/build/video/gpu/instancerecord.d.ts +164 -0
- package/build/video/gpu/instancerecord.d.ts.map +1 -0
- package/build/video/gpu/meshchunk.d.ts +49 -0
- package/build/video/gpu/meshchunk.d.ts.map +1 -0
- package/build/video/gpu/meshvertex.d.ts +54 -0
- package/build/video/gpu/meshvertex.d.ts.map +1 -0
- package/build/video/gpu/primitives.d.ts +60 -0
- package/build/video/gpu/primitives.d.ts.map +1 -0
- package/build/video/gpu/quadcorners.d.ts +11 -0
- package/build/video/gpu/quadcorners.d.ts.map +1 -0
- package/build/video/gpu/textureslots.d.ts +122 -0
- package/build/video/gpu/textureslots.d.ts.map +1 -0
- package/build/video/gpu/texturestore.d.ts +139 -0
- package/build/video/gpu/texturestore.d.ts.map +1 -0
- package/build/video/gpu/topology.d.ts +43 -0
- package/build/video/gpu/topology.d.ts.map +1 -0
- package/build/video/gpu/vertexformat.d.ts +72 -0
- package/build/video/gpu/vertexformat.d.ts.map +1 -0
- package/build/video/gradient.d.ts +14 -5
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +153 -8
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +7 -6
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +2 -2
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/rendertarget/webglrendertarget.d.ts +38 -2
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +83 -0
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -0
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +20 -2
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +2 -2
- package/build/video/utils/autodetect.d.ts.map +1 -1
- package/build/video/video.d.ts +1 -55
- package/build/video/video.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts +132 -35
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +14 -0
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +63 -36
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +29 -20
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +308 -14
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/primitive_batcher.d.ts +2 -2
- package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +0 -2
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +1 -1
- package/build/video/webgl/buffer/instance_buffer.d.ts +54 -0
- package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts +83 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgl/buffer/uniformblock.d.ts +81 -0
- package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -0
- package/build/video/webgl/buffer/vertexstate.d.ts +101 -0
- package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -0
- package/build/video/webgl/glshader.d.ts +101 -8
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/lighting/constants.d.ts +20 -8
- package/build/video/webgl/lighting/constants.d.ts.map +1 -1
- package/build/video/webgl/lighting/pack.d.ts +1 -1
- package/build/video/webgl/lighting/pack3d.d.ts +27 -11
- package/build/video/webgl/lighting/pack3d.d.ts.map +1 -1
- package/build/video/webgl/lighting/std140.d.ts +110 -0
- package/build/video/webgl/lighting/std140.d.ts.map +1 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts +7 -3
- package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -1
- package/build/video/webgl/texture/store.d.ts +52 -0
- package/build/video/webgl/texture/store.d.ts.map +1 -0
- package/build/video/webgl/utils/maxtextures.d.ts +37 -0
- package/build/video/webgl/utils/maxtextures.d.ts.map +1 -0
- package/build/video/webgl/utils/samplercache.d.ts +69 -0
- package/build/video/webgl/utils/samplercache.d.ts.map +1 -0
- package/build/video/webgl/utils/string.d.ts +16 -0
- package/build/video/webgl/utils/string.d.ts.map +1 -1
- package/build/video/webgl/utils/topology.d.ts +24 -0
- package/build/video/webgl/utils/topology.d.ts.map +1 -0
- package/build/video/webgl/utils/vertexformat.d.ts +27 -0
- package/build/video/webgl/utils/vertexformat.d.ts.map +1 -0
- package/build/video/webgl/webgl_renderer.d.ts +148 -30
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts +40 -0
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts +82 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +301 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts +39 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts +143 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts +70 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -0
- package/build/video/webgpu/buffer/arena.d.ts +64 -0
- package/build/video/webgpu/buffer/arena.d.ts.map +1 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts +65 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts +55 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgpu/buffer/uniformring.d.ts +68 -0
- package/build/video/webgpu/buffer/uniformring.d.ts.map +1 -0
- package/build/video/webgpu/effect_binding.d.ts +17 -0
- package/build/video/webgpu/effect_binding.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts +36 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/cache.d.ts +173 -0
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +90 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts +60 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts.map +1 -0
- package/build/video/webgpu/texture/compressed.d.ts +33 -0
- package/build/video/webgpu/texture/compressed.d.ts.map +1 -0
- package/build/video/webgpu/texture/frametexture.d.ts +65 -0
- package/build/video/webgpu/texture/frametexture.d.ts.map +1 -0
- package/build/video/webgpu/texture/store.d.ts +149 -0
- package/build/video/webgpu/texture/store.d.ts.map +1 -0
- package/build/video/webgpu/webgpu_renderer.d.ts +536 -0
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -0
- package/package.json +5 -5
- package/build/video/webgl/effects/blur.d.ts.map +0 -1
- package/build/video/webgl/effects/chromaticAberration.d.ts.map +0 -1
- package/build/video/webgl/effects/colorMatrix.d.ts.map +0 -1
- package/build/video/webgl/effects/desaturate.d.ts.map +0 -1
- package/build/video/webgl/effects/dissolve.d.ts.map +0 -1
- package/build/video/webgl/effects/dropShadow.d.ts.map +0 -1
- package/build/video/webgl/effects/flash.d.ts.map +0 -1
- package/build/video/webgl/effects/glow.d.ts.map +0 -1
- package/build/video/webgl/effects/hologram.d.ts.map +0 -1
- package/build/video/webgl/effects/invert.d.ts.map +0 -1
- package/build/video/webgl/effects/outline.d.ts.map +0 -1
- package/build/video/webgl/effects/pixelate.d.ts.map +0 -1
- package/build/video/webgl/effects/radialGradient.d.ts.map +0 -1
- package/build/video/webgl/effects/scanline.d.ts.map +0 -1
- package/build/video/webgl/effects/sepia.d.ts.map +0 -1
- package/build/video/webgl/effects/shine.d.ts.map +0 -1
- package/build/video/webgl/effects/tintPulse.d.ts.map +0 -1
- package/build/video/webgl/effects/vignette.d.ts.map +0 -1
- package/build/video/webgl/effects/wave.d.ts.map +0 -1
- package/build/video/webgl/shadereffect.d.ts.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive an instanced mesh WGSL module from the ordinary one (#1508).
|
|
3
|
+
*
|
|
4
|
+
* WGSL has no preprocessor, and a module carries **both** entry points in
|
|
5
|
+
* one file — so an instanced variant cannot be a second vertex file the way
|
|
6
|
+
* it is on the WebGL side. Rather than copy the module (which for the lit
|
|
7
|
+
* tier would duplicate the whole lighting loop, and the `Light3dBlock`
|
|
8
|
+
* layout that must agree byte-for-byte with the uniform packer), this
|
|
9
|
+
* rewrites the shared source:
|
|
10
|
+
*
|
|
11
|
+
* - everything before `@vertex` is kept — structs, bindings, `VSOut` —
|
|
12
|
+
* with one extra inter-stage field when the custom slot is in play;
|
|
13
|
+
* - the vertex stage is replaced with one that reads the per-instance
|
|
14
|
+
* attributes and applies them;
|
|
15
|
+
* - the fragment stage is kept **verbatim**, apart from one substitution
|
|
16
|
+
* that folds the per-instance slot into the emissive term.
|
|
17
|
+
*
|
|
18
|
+
* So the lighting loop, the light block and the alpha-cutout rule exist in
|
|
19
|
+
* exactly one place, and an instanced mesh shades identically to its
|
|
20
|
+
* uninstanced twin by construction rather than by review.
|
|
21
|
+
*
|
|
22
|
+
* Shader locations for the instance slots are **pinned**
|
|
23
|
+
* (`INSTANCE_SLOT_OFFSETS`), so a variant that omits the colour slot does
|
|
24
|
+
* not renumber the data slot.
|
|
25
|
+
* @param {string} source - the ordinary module (`mesh.wgsl` / `mesh-lit.wgsl`)
|
|
26
|
+
* @param {object} options - variant options
|
|
27
|
+
* @param {number} options.baseLocation - first vertex location after the tier's geometry attributes
|
|
28
|
+
* @param {number} options.varyingLocation - first free inter-stage location in `VSOut`
|
|
29
|
+
* @param {boolean} options.hasColor - whether the per-instance colour slot is present
|
|
30
|
+
* @param {boolean} options.hasData - whether the per-instance custom slot is present
|
|
31
|
+
* @param {string} options.geometryInputs - the tier's geometry attribute declarations
|
|
32
|
+
* @param {string} options.body - the tier's placement body, which reads the `instance` matrix the generated preamble declares and must leave a `clip` value for the shared tail
|
|
33
|
+
* @returns {string} the instanced module text
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
export function buildInstancedMeshWGSL(source: string, options: {
|
|
37
|
+
baseLocation: number;
|
|
38
|
+
varyingLocation: number;
|
|
39
|
+
hasColor: boolean;
|
|
40
|
+
hasData: boolean;
|
|
41
|
+
geometryInputs: string;
|
|
42
|
+
body: string;
|
|
43
|
+
}): string;
|
|
44
|
+
export namespace UNLIT_INSTANCED {
|
|
45
|
+
let baseLocation: number;
|
|
46
|
+
let varyingLocation: number;
|
|
47
|
+
let geometryInputs: string;
|
|
48
|
+
let body: string;
|
|
49
|
+
}
|
|
50
|
+
export namespace LIT_INSTANCED {
|
|
51
|
+
let baseLocation_1: number;
|
|
52
|
+
export { baseLocation_1 as baseLocation };
|
|
53
|
+
let varyingLocation_1: number;
|
|
54
|
+
export { varyingLocation_1 as varyingLocation };
|
|
55
|
+
let geometryInputs_1: string;
|
|
56
|
+
export { geometryInputs_1 as geometryInputs };
|
|
57
|
+
let body_1: string;
|
|
58
|
+
export { body_1 as body };
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=mesh-instanced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh-instanced.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/shaders/mesh-instanced.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,+CAXW,MAAM,WAEd;IAAwB,YAAY,EAA5B,MAAM;IACU,eAAe,EAA/B,MAAM;IACW,QAAQ,EAAzB,OAAO;IACU,OAAO,EAAxB,OAAO;IACS,cAAc,EAA9B,MAAM;IACU,IAAI,EAApB,MAAM;CACd,GAAU,MAAM,CAkIlB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload every mip level of a parsed CompressedImage into a GPUTexture
|
|
3
|
+
* via queue.writeTexture (block-aligned rows, largest mip first — the
|
|
4
|
+
* parser contract).
|
|
5
|
+
* @param {GPUDevice} device - the device
|
|
6
|
+
* @param {GPUTexture} texture - destination created with the mapped format
|
|
7
|
+
* @param {object} image - the parsed CompressedImage ({mipmaps, format})
|
|
8
|
+
* @param {object} metrics - the COMPRESSED_FORMATS entry for image.format
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
export function uploadCompressedTexture(device: GPUDevice, texture: GPUTexture, image: object, metrics: object): void;
|
|
12
|
+
/**
|
|
13
|
+
* WebGL compressed-format constant → WebGPU texture format + block
|
|
14
|
+
* metrics. The loader parsers (dds/pvr/pkm/ktx/ktx2) are backend-neutral
|
|
15
|
+
* and emit WebGL enum constants; this table is the WebGPU side of that
|
|
16
|
+
* contract. Families gate on the device features requested at init:
|
|
17
|
+
* "texture-compression-bc", "texture-compression-etc2",
|
|
18
|
+
* "texture-compression-astc" (PVRTC has no WebGPU equivalent).
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
export const COMPRESSED_FORMATS: Map<number, {
|
|
22
|
+
format: string;
|
|
23
|
+
blockW: number;
|
|
24
|
+
blockH: number;
|
|
25
|
+
bytes: number;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* the optional device features the renderer requests when the adapter
|
|
29
|
+
* offers them
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
export const COMPRESSION_FEATURES: string[];
|
|
33
|
+
//# sourceMappingURL=compressed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compressed.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/texture/compressed.js"],"names":[],"mappings":"AA+DA;;;;;;;;;GASG;AACH,gDANW,SAAS,WACT,UAAU,SACV,MAAM,WACN,MAAM,QAoBhB;AA1FD;;;;;;;;GAQG;AACH;;;;;GAyCG;AAEH;;;;GAIG;AACH,4CAIE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The WebGPU counterpart of the WebGL `FrameTexture`: a GPU-resident
|
|
3
|
+
* capture of the frame rendered so far, refreshed IN PLACE by
|
|
4
|
+
* {@link WebGPURenderer#captureFrame} via `copyTextureToTexture` — an
|
|
5
|
+
* encoder-ordered command, so the copy sees exactly the draws recorded
|
|
6
|
+
* before the capture point and none after (no queue-write retroactivity).
|
|
7
|
+
*
|
|
8
|
+
* Effects sample it through the `screen_texture` builtin: the effect's
|
|
9
|
+
* group-3 bind group binds `view`, keyed by `generation` so a size-change
|
|
10
|
+
* reallocation rebuilds stale bind groups. `isGPUResident` keeps the
|
|
11
|
+
* `setTexture` discriminant contract of the WebGL twin.
|
|
12
|
+
* @augments Texture2d
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
export class WebGPUFrameTexture extends Texture2d {
|
|
16
|
+
/**
|
|
17
|
+
* monotonic generation source shared by every capture instance
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
static generationCounter: number;
|
|
21
|
+
/**
|
|
22
|
+
* @param {import("../webgpu_renderer.js").default} renderer - the owning renderer
|
|
23
|
+
* @param {number} width - capture width in pixels
|
|
24
|
+
* @param {number} height - capture height in pixels
|
|
25
|
+
*/
|
|
26
|
+
constructor(renderer: import("../webgpu_renderer.js").default, width: number, height: number);
|
|
27
|
+
renderer: import("../webgpu_renderer.js").default;
|
|
28
|
+
/**
|
|
29
|
+
* marks this as a live GPU-resident source — see {@link ShaderEffect#setTexture}
|
|
30
|
+
* @type {boolean}
|
|
31
|
+
*/
|
|
32
|
+
isGPUResident: boolean;
|
|
33
|
+
/** @type {GPUTexture} */
|
|
34
|
+
gpuTexture: GPUTexture;
|
|
35
|
+
/**
|
|
36
|
+
* (Re)allocate the backing texture at the given size, keeping this
|
|
37
|
+
* object's identity — the caller-owned-refresh contract of
|
|
38
|
+
* `toFrameTexture({target})`. The old texture is retired (draws
|
|
39
|
+
* already recorded against it stay valid) and `generation` advances,
|
|
40
|
+
* so bind groups referencing the old view re-key instead of pointing
|
|
41
|
+
* at a destroyed texture and failing every subsequent submit.
|
|
42
|
+
* @param {number} width - capture width in pixels
|
|
43
|
+
* @param {number} height - capture height in pixels
|
|
44
|
+
*/
|
|
45
|
+
realloc(width: number, height: number): void;
|
|
46
|
+
/** @type {number} */
|
|
47
|
+
width: number | undefined;
|
|
48
|
+
/** @type {number} */
|
|
49
|
+
height: number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* unique per allocation (module-wide counter) — the bind-group key
|
|
52
|
+
* @type {number}
|
|
53
|
+
*/
|
|
54
|
+
generation: number | undefined;
|
|
55
|
+
/** @type {GPUTextureView} */
|
|
56
|
+
view: GPUTextureView | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* The opaque GPU-resident backing — itself.
|
|
59
|
+
* @returns {WebGPUFrameTexture}
|
|
60
|
+
*/
|
|
61
|
+
getTexture(): WebGPUFrameTexture;
|
|
62
|
+
}
|
|
63
|
+
export default WebGPUFrameTexture;
|
|
64
|
+
import Texture2d from "../../texture/texture2d.ts";
|
|
65
|
+
//# sourceMappingURL=frametexture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frametexture.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/texture/frametexture.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH;IACC;;;OAGG;IACH,iCAA6B;IAE7B;;;;OAIG;IACH,sBAJW,OAAO,uBAAuB,EAAE,OAAO,SACvC,MAAM,UACN,MAAM,EAahB;IATA,kDAAwB;IACxB;;;OAGG;IACH,eAFU,OAAO,CAEQ;IACzB,yBAAyB;IACzB,YADW,UAAU,CACC;IAIvB;;;;;;;;;OASG;IACH,eAHW,MAAM,UACN,MAAM,QAuBhB;IAjBA,qBAAqB;IACrB,0BAAkB;IAClB,qBAAqB;IACrB,2BAAoB;IACpB;;;OAGG;IACH,+BAAwD;IAOxD,6BAA6B;IAC7B,iCAAwC;IAGzC;;;OAGG;IACH,cAFa,kBAAkB,CAI9B;CAaD;;sBA7FqB,4BAA4B"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renderer-owned GPU texture store for the WebGPU backend — the counterpart
|
|
3
|
+
* of `MaterialBatcher`'s createTexture2D/bindTexture2D/deleteTexture2D tier,
|
|
4
|
+
* kept on the renderer (rather than a batcher) so the quad path and the
|
|
5
|
+
* future mesh / tile-layer paths share one resident-texture map.
|
|
6
|
+
*
|
|
7
|
+
* The engine-side bookkeeping is untouched: `TextureCache` still allocates
|
|
8
|
+
* the logical "unit" for each `(source, repeat)` pair; here a unit keys a
|
|
9
|
+
* `{GPUTexture, view, bind groups}` record instead of a GL texture binding.
|
|
10
|
+
* Bind groups pair the texture view with a cached `GPUSampler` — one bind
|
|
11
|
+
* group per (texture, sampler) combination, invalidated wholesale when the
|
|
12
|
+
* filter setting changes (textures stay resident; only the pairing is
|
|
13
|
+
* rebuilt — the WebGPU analogue of `_reapplyTextureFilter`, without the
|
|
14
|
+
* re-parameterization).
|
|
15
|
+
* @ignore
|
|
16
|
+
*/
|
|
17
|
+
export default class WebGPUTextureStore extends TextureStore {
|
|
18
|
+
/**
|
|
19
|
+
* @param {import("../webgpu_renderer.js").default} renderer - the owning renderer
|
|
20
|
+
*/
|
|
21
|
+
constructor(renderer: import("../webgpu_renderer.js").default);
|
|
22
|
+
renderer: import("../webgpu_renderer.js").default;
|
|
23
|
+
device: GPUDevice | undefined;
|
|
24
|
+
/** @type {Map<string, GPUSampler>} */
|
|
25
|
+
samplers: Map<string, GPUSampler>;
|
|
26
|
+
onCacheReset: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* resolve (creating on first use) the sampler for a filter/wrap combo
|
|
29
|
+
* @param {string} filter - "nearest" | "linear"
|
|
30
|
+
* @param {string} repeat - engine wrap mode string
|
|
31
|
+
* @returns {GPUSampler} the sampler
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
34
|
+
getSampler(filter: string, repeat: string, mipmaps?: boolean): GPUSampler;
|
|
35
|
+
/**
|
|
36
|
+
* The per-draw entry point: resolve the atlas to a bind group pairing
|
|
37
|
+
* its resident GPU texture with the currently-applicable sampler,
|
|
38
|
+
* uploading the source on first use (or re-uploading when forced — the
|
|
39
|
+
* video-frame path).
|
|
40
|
+
* @param {object} texture - a TextureAtlas
|
|
41
|
+
* @param {object} [options] - resolution options
|
|
42
|
+
* @param {boolean} [options.force=false] - re-upload the source pixels
|
|
43
|
+
* @param {string} [options.repeat] - per-use wrap override (else texture.repeat)
|
|
44
|
+
* @returns {GPUBindGroup} the material bind group for this draw
|
|
45
|
+
*/
|
|
46
|
+
getBinding(texture: object, options?: {
|
|
47
|
+
force?: boolean | undefined;
|
|
48
|
+
repeat?: string | undefined;
|
|
49
|
+
}): GPUBindGroup;
|
|
50
|
+
lastRecord: {
|
|
51
|
+
handle: any;
|
|
52
|
+
version: number;
|
|
53
|
+
generation: number;
|
|
54
|
+
} | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Build the full mip chain of a freshly-uploaded record: one blit pass
|
|
57
|
+
* per level, each rendering the previous level with linear filtering.
|
|
58
|
+
* Runs in its own encoder submitted immediately — queue ordering places
|
|
59
|
+
* it after the level-0 copy (a queue operation) and before the frame's
|
|
60
|
+
* own command buffer, so the frame's draws sample a complete chain.
|
|
61
|
+
* @param {object} record - the resident record (mipLevelCount > 1)
|
|
62
|
+
* @ignore
|
|
63
|
+
*/
|
|
64
|
+
generateMipmaps(record: object): void;
|
|
65
|
+
mipLayout: GPUBindGroupLayout | undefined;
|
|
66
|
+
mipPipeline: GPURenderPipeline | undefined;
|
|
67
|
+
mipSampler: GPUSampler | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the view + sampler a resident record should be bound with,
|
|
70
|
+
* plus the cache key identifying that pair. Shared by the one-texture
|
|
71
|
+
* material path and the mesh path, so the two cannot drift on which
|
|
72
|
+
* view a mip-wanting consumer gets.
|
|
73
|
+
* @ignore
|
|
74
|
+
*/
|
|
75
|
+
viewAndSampler(record: any, texture: any, wrap: any, wantMips: any): {
|
|
76
|
+
view: any;
|
|
77
|
+
sampler: GPUSampler;
|
|
78
|
+
key: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The group-1 material for a MESH: the diffuse texture/sampler pair plus
|
|
82
|
+
* the per-texel opacity pair (MTL `map_d`, #1575).
|
|
83
|
+
*
|
|
84
|
+
* Always four bindings. A mesh with no alpha map passes the shared white
|
|
85
|
+
* pixel, whose red channel is 1 — so the shader's multiply is a no-op and
|
|
86
|
+
* the same pipeline layout serves both cases rather than splitting the
|
|
87
|
+
* mesh family in two.
|
|
88
|
+
* @param {TextureAtlas} texture - the diffuse texture
|
|
89
|
+
* @param {TextureAtlas} alphaTexture - the opacity map, or the white pixel
|
|
90
|
+
* @param {object} [options] - wrap / mipmap options, as `getBinding` takes
|
|
91
|
+
* @returns {GPUBindGroup} the group-1 bind group
|
|
92
|
+
* @ignore
|
|
93
|
+
*/
|
|
94
|
+
getMeshBinding(texture: TextureAtlas, alphaTexture: TextureAtlas, options?: object): GPUBindGroup;
|
|
95
|
+
/**
|
|
96
|
+
* the per-sampler material bind group for a resident record (shared by
|
|
97
|
+
* the image and compressed upload paths)
|
|
98
|
+
* @ignore
|
|
99
|
+
*/
|
|
100
|
+
bindGroupFor(record: any, texture: any, wrap: any, wantMips?: boolean): any;
|
|
101
|
+
/**
|
|
102
|
+
* Ensure the texture is resident (same upload/validation path as
|
|
103
|
+
* getBinding) and return its record — callers composing their own bind
|
|
104
|
+
* groups (the lit batcher pairs the color view with a normal map) need
|
|
105
|
+
* the raw view rather than the standard material group.
|
|
106
|
+
* @param {object} texture - the texture atlas to resolve
|
|
107
|
+
* @param {object} [options] - same options as getBinding
|
|
108
|
+
* @returns {object} the resident record ({texture, view, width, height, …})
|
|
109
|
+
*/
|
|
110
|
+
getResidentRecord(texture: object, options?: object): object;
|
|
111
|
+
/**
|
|
112
|
+
* Dispose of a GPUTexture safely: while a frame is being recorded the
|
|
113
|
+
* texture may be referenced by already-recorded draws (destroying it
|
|
114
|
+
* would make `queue.submit()` reject the whole command buffer), so it
|
|
115
|
+
* parks on the renderer's retired list and is destroyed after submit.
|
|
116
|
+
* @param {GPUTexture} gpuTexture - the texture to dispose of
|
|
117
|
+
* @ignore
|
|
118
|
+
*/
|
|
119
|
+
retire(gpuTexture: GPUTexture): void;
|
|
120
|
+
/**
|
|
121
|
+
* drop every (texture, sampler) bind-group pairing while keeping the
|
|
122
|
+
* textures resident — the filter setting changed and the next draw
|
|
123
|
+
* re-pairs each texture with the newly-resolved sampler
|
|
124
|
+
*/
|
|
125
|
+
invalidateBindGroups(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Destroy the resident GPU texture(s) associated with an image — every
|
|
128
|
+
* `(source, repeat)` unit the cache knows about, mirroring
|
|
129
|
+
* `MaterialBatcher.deleteTexture2D`'s multi-repeat sweep.
|
|
130
|
+
* @param {object} texture - a TextureAtlas
|
|
131
|
+
*/
|
|
132
|
+
destroyTexture(texture: object): void;
|
|
133
|
+
/**
|
|
134
|
+
* drop every unit association and dispose of the resident textures
|
|
135
|
+
*/
|
|
136
|
+
/**
|
|
137
|
+
* Release the GPU texture behind a record. The base calls this; the device
|
|
138
|
+
* defers the actual destroy until the frame that referenced it has retired.
|
|
139
|
+
* @param {GPUTexture} handle - the texture to release
|
|
140
|
+
* @ignore
|
|
141
|
+
*/
|
|
142
|
+
onDestroy(handle: GPUTexture): void;
|
|
143
|
+
/**
|
|
144
|
+
* full teardown (device loss / renderer destroy)
|
|
145
|
+
*/
|
|
146
|
+
destroy(): void;
|
|
147
|
+
}
|
|
148
|
+
import { TextureStore } from "../../gpu/texturestore.js";
|
|
149
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/video/webgpu/texture/store.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH;IACC;;OAEG;IACH,sBAFW,OAAO,uBAAuB,EAAE,OAAO,EAoBjD;IAhBA,kDAAwB;IACxB,8BAA6B;IAC7B,sCAAsC;IACtC,UADW,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CACT;IAKzB,yBAMC;IAIF;;;;;;OAMG;IACH,mBALW,MAAM,UACN,MAAM,sBACJ,UAAU,CAkCtB;IAED;;;;;;;;;;OAUG;IACH,oBANW,MAAM,YAEd;QAA0B,KAAK;QACN,MAAM;KAC/B,GAAU,YAAY,CAuMxB;IAlHE;;;;kBAAwB;IAoH3B;;;;;;;;OAQG;IACH,wBAHW,MAAM,QAyEhB;IA/DC,0CAME;IAIF,2CAYE;IACF,mCAIE;IAsCJ;;;;;;OAMG;IACH;;;;MAqBC;IAED;;;;;;;;;;;;;OAaG;IACH,wBANW,YAAY,gBACZ,YAAY,YACZ,MAAM,GACJ,YAAY,CAmExB;IAED;;;;OAIG;IACH,4EAeC;IAED;;;;;;;;OAQG;IACH,2BAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAKlB;IAED;;;;;;;OAOG;IACH,mBAHW,UAAU,QAKpB;IAED;;;;OAIG;IACH,6BAIC;IAED;;;;;OAKG;IACH,wBAFW,MAAM,QAchB;IAED;;OAEG;IACH;;;;;OAKG;IACH,kBAHW,UAAU,QAKpB;IAED;;OAEG;IACH,gBAIC;CACD;6BAzkB4B,2BAA2B"}
|