@yali-engine/render 0.0.0-stage → 0.4.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/dist/bvh.d.ts +66 -0
- package/dist/bvh.js +493 -0
- package/dist/bvh.js.map +1 -0
- package/dist/camera.d.ts +34 -0
- package/dist/camera.js +66 -0
- package/dist/camera.js.map +1 -0
- package/dist/cluster-build.d.ts +46 -0
- package/dist/cluster-build.js +179 -0
- package/dist/cluster-build.js.map +1 -0
- package/dist/cluster-pages.d.ts +70 -0
- package/dist/cluster-pages.js +203 -0
- package/dist/cluster-pages.js.map +1 -0
- package/dist/cluster-stream.d.ts +83 -0
- package/dist/cluster-stream.js +226 -0
- package/dist/cluster-stream.js.map +1 -0
- package/dist/culled-draws.d.ts +30 -0
- package/dist/culled-draws.js +103 -0
- package/dist/culled-draws.js.map +1 -0
- package/dist/debug-lines.d.ts +51 -0
- package/dist/debug-lines.js +158 -0
- package/dist/debug-lines.js.map +1 -0
- package/dist/device-profile.d.ts +100 -0
- package/dist/device-profile.js +131 -0
- package/dist/device-profile.js.map +1 -0
- package/dist/device.d.ts +39 -0
- package/dist/device.js +79 -0
- package/dist/device.js.map +1 -0
- package/dist/environment.d.ts +60 -0
- package/dist/environment.js +204 -0
- package/dist/environment.js.map +1 -0
- package/dist/extract.d.ts +74 -0
- package/dist/extract.js +194 -0
- package/dist/extract.js.map +1 -0
- package/dist/frame-graph.d.ts +112 -0
- package/dist/frame-graph.js +226 -0
- package/dist/frame-graph.js.map +1 -0
- package/dist/gpu-health.d.ts +74 -0
- package/dist/gpu-health.js +106 -0
- package/dist/gpu-health.js.map +1 -0
- package/dist/gpu-timer.d.ts +26 -0
- package/dist/gpu-timer.js +93 -0
- package/dist/gpu-timer.js.map +1 -0
- package/dist/headless.d.ts +28 -0
- package/dist/headless.js +91 -0
- package/dist/headless.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/lights.d.ts +81 -0
- package/dist/lights.js +247 -0
- package/dist/lights.js.map +1 -0
- package/dist/matrix.d.ts +6 -0
- package/dist/matrix.js +59 -0
- package/dist/matrix.js.map +1 -0
- package/dist/meshes.d.ts +411 -0
- package/dist/meshes.js +545 -0
- package/dist/meshes.js.map +1 -0
- package/dist/meshlets-decoder.d.ts +20 -0
- package/dist/meshlets-decoder.js +47 -0
- package/dist/meshlets-decoder.js.map +1 -0
- package/dist/meshlets.d.ts +186 -0
- package/dist/meshlets.js +1040 -0
- package/dist/meshlets.js.map +1 -0
- package/dist/occlusion.d.ts +51 -0
- package/dist/occlusion.js +188 -0
- package/dist/occlusion.js.map +1 -0
- package/dist/pick-decoder.d.ts +19 -0
- package/dist/pick-decoder.js +45 -0
- package/dist/pick-decoder.js.map +1 -0
- package/dist/pick.d.ts +86 -0
- package/dist/pick.js +452 -0
- package/dist/pick.js.map +1 -0
- package/dist/pipeline-cache.d.ts +53 -0
- package/dist/pipeline-cache.js +96 -0
- package/dist/pipeline-cache.js.map +1 -0
- package/dist/post-options.d.ts +109 -0
- package/dist/post-options.js +23 -0
- package/dist/post-options.js.map +1 -0
- package/dist/post-shaders.gen.d.ts +40 -0
- package/dist/post-shaders.gen.js +43 -0
- package/dist/post-shaders.gen.js.map +1 -0
- package/dist/post.d.ts +101 -0
- package/dist/post.js +555 -0
- package/dist/post.js.map +1 -0
- package/dist/render-plugin.d.ts +239 -0
- package/dist/render-plugin.js +633 -0
- package/dist/render-plugin.js.map +1 -0
- package/dist/scene.d.ts +406 -0
- package/dist/scene.js +2005 -0
- package/dist/scene.js.map +1 -0
- package/dist/shaders.gen.d.ts +40 -0
- package/dist/shaders.gen.js +43 -0
- package/dist/shaders.gen.js.map +1 -0
- package/dist/shadows.d.ts +104 -0
- package/dist/shadows.js +227 -0
- package/dist/shadows.js.map +1 -0
- package/dist/staging-ring.d.ts +41 -0
- package/dist/staging-ring.js +125 -0
- package/dist/staging-ring.js.map +1 -0
- package/dist/textures.d.ts +165 -0
- package/dist/textures.js +361 -0
- package/dist/textures.js.map +1 -0
- package/dist/tonemap.d.ts +45 -0
- package/dist/tonemap.js +141 -0
- package/dist/tonemap.js.map +1 -0
- package/dist/viewport.d.ts +78 -0
- package/dist/viewport.js +130 -0
- package/dist/viewport.js.map +1 -0
- package/dist/webgl2/plugin.d.ts +40 -0
- package/dist/webgl2/plugin.js +190 -0
- package/dist/webgl2/plugin.js.map +1 -0
- package/dist/webgl2/program.d.ts +27 -0
- package/dist/webgl2/program.js +74 -0
- package/dist/webgl2/program.js.map +1 -0
- package/dist/webgl2/renderer.d.ts +128 -0
- package/dist/webgl2/renderer.js +976 -0
- package/dist/webgl2/renderer.js.map +1 -0
- package/dist/webgl2/shaders.glsl.gen.d.ts +27 -0
- package/dist/webgl2/shaders.glsl.gen.js +20 -0
- package/dist/webgl2/shaders.glsl.gen.js.map +1 -0
- package/dist/webgl2/textures.d.ts +11 -0
- package/dist/webgl2/textures.js +82 -0
- package/dist/webgl2/textures.js.map +1 -0
- package/dist/webgl2/webgl2.d.ts +1 -0
- package/dist/webgl2/webgl2.js +4 -0
- package/dist/webgl2/webgl2.js.map +1 -0
- package/dist/worker-mode.d.ts +85 -0
- package/dist/worker-mode.js +204 -0
- package/dist/worker-mode.js.map +1 -0
- package/package.json +47 -3
- package/README.md +0 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { YaliError } from '@yali-engine/core';
|
|
2
|
+
/**
|
|
3
|
+
* A linked GLSL ES 3.00 program from `tools/glsl-gen.mjs` (ADR-0070). GLSL ES 3.00 has no
|
|
4
|
+
* binding qualifiers, so naga reports each uniform block's and combined sampler's name and
|
|
5
|
+
* the WGSL binding it came from: each uniform block is bound to the binding point equal to
|
|
6
|
+
* its WGSL binding (the vertex and fragment stages' blocks for one binding share it), and
|
|
7
|
+
* each combined sampler gets a texture unit, where `bind` puts the binding's texture and the
|
|
8
|
+
* sampler binding's sampler object.
|
|
9
|
+
*/
|
|
10
|
+
export class GlProgram {
|
|
11
|
+
program;
|
|
12
|
+
/** Per texture unit: [texture binding, sampler binding or −1]. */
|
|
13
|
+
#units = [];
|
|
14
|
+
/** WGSL uniform bindings the program reads. */
|
|
15
|
+
#uniforms = [];
|
|
16
|
+
constructor(gl, label, src) {
|
|
17
|
+
const compile = (type, glsl, stage) => {
|
|
18
|
+
const s = gl.createShader(type);
|
|
19
|
+
gl.shaderSource(s, glsl);
|
|
20
|
+
gl.compileShader(s);
|
|
21
|
+
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS) && !gl.isContextLost()) {
|
|
22
|
+
const log = gl.getShaderInfoLog(s);
|
|
23
|
+
throw new YaliError('GL_SHADER', `The ${label} ${stage} shader failed to compile: ${log}`, 'This is an engine bug (tools/glsl-gen.mjs output); report it with the message.');
|
|
24
|
+
}
|
|
25
|
+
return s;
|
|
26
|
+
};
|
|
27
|
+
const p = gl.createProgram();
|
|
28
|
+
gl.attachShader(p, compile(gl.VERTEX_SHADER, src.vs.glsl, 'vertex'));
|
|
29
|
+
gl.attachShader(p, compile(gl.FRAGMENT_SHADER, src.fs.glsl, 'fragment'));
|
|
30
|
+
gl.linkProgram(p);
|
|
31
|
+
if (!gl.getProgramParameter(p, gl.LINK_STATUS) && !gl.isContextLost()) {
|
|
32
|
+
throw new YaliError('GL_LINK', `The ${label} program failed to link: ${gl.getProgramInfoLog(p)}`, 'This is an engine bug (tools/glsl-gen.mjs output); report it with the message.');
|
|
33
|
+
}
|
|
34
|
+
this.program = p;
|
|
35
|
+
gl.useProgram(p);
|
|
36
|
+
for (const stage of [src.vs, src.fs]) {
|
|
37
|
+
for (const [, binding, name] of stage.uniforms) {
|
|
38
|
+
const index = gl.getUniformBlockIndex(p, name);
|
|
39
|
+
if (index === gl.INVALID_INDEX)
|
|
40
|
+
continue; // optimized out
|
|
41
|
+
gl.uniformBlockBinding(p, index, binding);
|
|
42
|
+
if (!this.#uniforms.includes(binding))
|
|
43
|
+
this.#uniforms.push(binding);
|
|
44
|
+
}
|
|
45
|
+
for (const [name, , texBinding, , samplerBinding] of stage.textures) {
|
|
46
|
+
const loc = gl.getUniformLocation(p, name);
|
|
47
|
+
if (!loc)
|
|
48
|
+
continue;
|
|
49
|
+
gl.uniform1i(loc, this.#units.length);
|
|
50
|
+
this.#units.push([texBinding, samplerBinding]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Makes the program current and binds `b`'s resources to its blocks and units. */
|
|
55
|
+
bind(gl, b) {
|
|
56
|
+
gl.useProgram(this.program);
|
|
57
|
+
for (const binding of this.#uniforms) {
|
|
58
|
+
const buf = b.uniforms.get(binding);
|
|
59
|
+
if (!buf)
|
|
60
|
+
throw new YaliError('GL_BINDING', `Uniform binding ${binding} has no buffer.`, 'This is an engine bug; report it.');
|
|
61
|
+
gl.bindBufferBase(gl.UNIFORM_BUFFER, binding, buf);
|
|
62
|
+
}
|
|
63
|
+
for (let unit = 0; unit < this.#units.length; unit++) {
|
|
64
|
+
const [tb, sb] = this.#units[unit];
|
|
65
|
+
const t = b.textures.get(tb);
|
|
66
|
+
if (!t)
|
|
67
|
+
throw new YaliError('GL_BINDING', `Texture binding ${tb} has no texture.`, 'This is an engine bug; report it.');
|
|
68
|
+
gl.activeTexture(gl.TEXTURE0 + unit);
|
|
69
|
+
gl.bindTexture(t.target, t.texture);
|
|
70
|
+
gl.bindSampler(unit, sb >= 0 ? (b.samplers.get(sb) ?? null) : null);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/webgl2/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAiB9C;;;;;;;GAOG;AACH,MAAM,OAAO,SAAS;IACX,OAAO,CAAe;IAC/B,kEAAkE;IACzD,MAAM,GAAkC,EAAE,CAA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"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { Component, World } from '@yali-engine/core';
|
|
2
|
+
import type { OrbitCamera } from '../camera.ts';
|
|
3
|
+
import { type SkyOptions } from '../environment.ts';
|
|
4
|
+
import { type PaletteSource } from '../scene.ts';
|
|
5
|
+
import type { ExtractedInstances } from '../extract.ts';
|
|
6
|
+
import { LightPacker } from '../lights.ts';
|
|
7
|
+
import { type MaterialStore, type MeshStore } from '../meshes.ts';
|
|
8
|
+
import type { LightingOptions } from '../scene.ts';
|
|
9
|
+
import type { TextureStore } from '../textures.ts';
|
|
10
|
+
import { type ToneCurve } from '../tonemap.ts';
|
|
11
|
+
import type { GradingOptions } from '../post-options.ts';
|
|
12
|
+
import { type DebugLines } from '../debug-lines.ts';
|
|
13
|
+
/** A frame read back as drawn (RGBA8, rows top to bottom). */
|
|
14
|
+
export interface GlCapture {
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
readonly rgba: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
/** The sun's shadows on WebGL2: the cascade configuration (`fitCascades`). */
|
|
20
|
+
export interface GlShadowConfig {
|
|
21
|
+
readonly cascades: number;
|
|
22
|
+
readonly size: number;
|
|
23
|
+
distance: number;
|
|
24
|
+
readonly splitLambda: number;
|
|
25
|
+
/** PCF grid radius in taps (`SunShadows.pcfRadius`). */
|
|
26
|
+
readonly pcfRadius: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The WebGL2 backend's renderer (M2 increment 8, ADR-0070): the WebGPU renderer's frame on
|
|
30
|
+
* GLSL ES 3.00 that naga translated from the same WGSL (`tools/glsl-gen.mjs`). The CPU culls
|
|
31
|
+
* and picks LODs (the extract's `runCulled`, ADR-0057) and bins the lights (`binLights`,
|
|
32
|
+
* identical to the GPU pass); the GPU draws:
|
|
33
|
+
*
|
|
34
|
+
* 1. the sun's shadow cascades into one depth atlas (`fitCascades`, the same fit);
|
|
35
|
+
* 2. the scene into a half-float HDR target, lit by the sun, the binned lights and the
|
|
36
|
+
* environment cube (built here face by face with the same sky shaders);
|
|
37
|
+
* 3. the tone curve into an RGBA8 target, blitted to the canvas.
|
|
38
|
+
*
|
|
39
|
+
* Every offscreen pass renders with naga's clip-space adjustment (y flipped, z to −1..1), so
|
|
40
|
+
* render targets keep WebGPU's row order and fragment coordinates (row 0 at the top) and the
|
|
41
|
+
* shaders need no change; the flip reverses triangle winding, so front faces are clockwise
|
|
42
|
+
* here, and the final blit to the canvas flips back. WebGL2 has no base vertex and no base
|
|
43
|
+
* instance, so each draw re-points the attributes at its mesh's vertices and its instances.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Whether this GPU ignores LINEAR filtering on depth comparisons (GLES allows it: the Galaxy
|
|
47
|
+
* F04's PowerVR returns 0 or 1, never a blend, so shadow edges step by a texel). One 1×1
|
|
48
|
+
* draw at startup: a 2×1 depth texture [0, 1] compared at its middle gives 0.5 when filtered.
|
|
49
|
+
*/
|
|
50
|
+
export declare function comparesNearestOnly(gl: WebGL2RenderingContext): boolean;
|
|
51
|
+
export declare class GlRenderer {
|
|
52
|
+
#private;
|
|
53
|
+
readonly gl: WebGL2RenderingContext;
|
|
54
|
+
readonly cull: "cpu";
|
|
55
|
+
readonly path: "vertex";
|
|
56
|
+
readonly useBundles = false;
|
|
57
|
+
readonly staging: null;
|
|
58
|
+
readonly staticUploads = 0;
|
|
59
|
+
/** Instance bytes uploaded last frame (every visible record: the CPU cull rewrites them all). */
|
|
60
|
+
transformBytes: number;
|
|
61
|
+
shaderError: string;
|
|
62
|
+
capacity: number;
|
|
63
|
+
count: number;
|
|
64
|
+
visible: number;
|
|
65
|
+
errorPx: number;
|
|
66
|
+
lodBias: number;
|
|
67
|
+
minRadiusPx: number;
|
|
68
|
+
readonly stats: {
|
|
69
|
+
slots: number;
|
|
70
|
+
draws: number;
|
|
71
|
+
layouts: number;
|
|
72
|
+
meshes: number;
|
|
73
|
+
shaderBuilds: number;
|
|
74
|
+
};
|
|
75
|
+
/** The shading level (`SceneControls.shadingLevel`, ADR-0072). */
|
|
76
|
+
shadingLevel: number;
|
|
77
|
+
readonly shadingLevels: number;
|
|
78
|
+
readonly lighting: LightingOptions;
|
|
79
|
+
/** Tone mapping (`ToneMapper`'s knobs). */
|
|
80
|
+
exposure: number;
|
|
81
|
+
curve: ToneCurve;
|
|
82
|
+
/** Colour grading in the tone-mapping pass (ADR-0092), or null. */
|
|
83
|
+
grading: (Required<GradingOptions> & {
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
}) | null;
|
|
86
|
+
readonly shadows: GlShadowConfig | null;
|
|
87
|
+
/** The packed lights (`render.lights.count`, `dropped`). */
|
|
88
|
+
readonly lights: LightPacker;
|
|
89
|
+
/** Whether the HDR and environment targets are half-float (else RGBA8: highlights clip). */
|
|
90
|
+
readonly hdr: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* The draw tone-maps inline and renders straight into the RGBA8 target (T0's default,
|
|
93
|
+
* ADR-0071): no HDR target, no tone-mapping pass.
|
|
94
|
+
*/
|
|
95
|
+
readonly inlineTone: boolean;
|
|
96
|
+
/** Where the skinned draws read their palette each frame (`@yali-engine/animation` sets it). */
|
|
97
|
+
paletteSource: PaletteSource | null;
|
|
98
|
+
constructor(gl: WebGL2RenderingContext, store: MeshStore, materials: MaterialStore, textures: TextureStore, capacity: number, shadows: GlShadowConfig | null, hdrTarget?: boolean, shadingLevels?: number);
|
|
99
|
+
/** Always ready: WebGL2 draws node materials as the standard material (ADR-0070). */
|
|
100
|
+
shadersReady(): Promise<void>;
|
|
101
|
+
/** GL programs compile when first drawn: nothing to wait for. */
|
|
102
|
+
drawClassesReady(): Promise<void>;
|
|
103
|
+
/** The current sky. */
|
|
104
|
+
get sky(): Readonly<Required<SkyOptions>>;
|
|
105
|
+
/** Changes the sky (unset fields keep their values) and rebuilds the environment. */
|
|
106
|
+
setSky(sky: SkyOptions): void;
|
|
107
|
+
/** Renders the sky into every level of the base cube, copies level 0 and prefilters the rest; projects SH9. */
|
|
108
|
+
buildEnvironment(): void;
|
|
109
|
+
writeCullParams(f32: Float32Array, at: number, camera: OrbitCamera, heightPx: number, widthPx?: number): void;
|
|
110
|
+
/** Instances drawn at each LOD (index 0 = full detail). A diagnostic: it allocates. */
|
|
111
|
+
drawnByLod(): number[];
|
|
112
|
+
/**
|
|
113
|
+
* Uploads this frame: the camera, the lights (packed and binned), the shadow fit, the
|
|
114
|
+
* materials and geometry that changed, and the CPU-culled instances from linear memory.
|
|
115
|
+
*/
|
|
116
|
+
upload(heap: Uint8Array, u32: Uint32Array, x: ExtractedInstances | null, camera: OrbitCamera, width: number, height: number, world: World | null, Light: Component | null): void;
|
|
117
|
+
/** Draws the frame (shadows, scene, tone curve) and presents it to the canvas, `width × height`. */
|
|
118
|
+
render(width: number, height: number): void;
|
|
119
|
+
/** The next frame as drawn (rows top first: the offscreen targets have WebGPU's row order). */
|
|
120
|
+
capture(): Promise<GlCapture>;
|
|
121
|
+
/** Bytes of the geometry and instance buffers (the memory counter). */
|
|
122
|
+
get gpuBytes(): number;
|
|
123
|
+
/** GL buffers this renderer owns (the dispose leak check). */
|
|
124
|
+
get liveBuffers(): number;
|
|
125
|
+
/** Debug line segments drawn over the scene each frame (the render plugin's `render.debug`). */
|
|
126
|
+
debug: DebugLines | null;
|
|
127
|
+
destroy(): void;
|
|
128
|
+
}
|