akarisub 0.2.0 → 0.2.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.
- package/README.md +3 -3
- package/dist/akarisub-worker.js +2 -2
- package/dist/akarisub-worker.wasm +0 -0
- package/dist/akarisub.umd.js +3 -3
- package/dist/index.js +3 -3
- package/dist/ts/index.d.ts +14 -0
- package/dist/ts/index.d.ts.map +1 -0
- package/dist/ts/index.js +17 -0
- package/dist/ts/index.js.map +1 -0
- package/dist/ts/ts/akarisub.d.ts +229 -0
- package/dist/ts/ts/akarisub.d.ts.map +1 -0
- package/dist/ts/ts/akarisub.js +1079 -0
- package/dist/ts/ts/akarisub.js.map +1 -0
- package/dist/ts/ts/types.d.ts +424 -0
- package/dist/ts/ts/types.d.ts.map +1 -0
- package/dist/ts/ts/types.js +5 -0
- package/dist/ts/ts/types.js.map +1 -0
- package/dist/ts/ts/utils.d.ts +78 -0
- package/dist/ts/ts/utils.d.ts.map +1 -0
- package/dist/ts/ts/utils.js +395 -0
- package/dist/ts/ts/utils.js.map +1 -0
- package/dist/ts/ts/webgl2-renderer.d.ts +51 -0
- package/dist/ts/ts/webgl2-renderer.d.ts.map +1 -0
- package/dist/ts/ts/webgl2-renderer.js +388 -0
- package/dist/ts/ts/webgl2-renderer.js.map +1 -0
- package/dist/ts/ts/webgpu-renderer.d.ts +64 -0
- package/dist/ts/ts/webgpu-renderer.d.ts.map +1 -0
- package/dist/ts/ts/webgpu-renderer.js +610 -0
- package/dist/ts/ts/webgpu-renderer.js.map +1 -0
- package/dist/ts/ts/worker.d.ts +6 -0
- package/dist/ts/ts/worker.d.ts.map +1 -0
- package/dist/ts/ts/worker.js +1695 -0
- package/dist/ts/ts/worker.js.map +1 -0
- package/dist/ts/wrapper.d.ts +8 -0
- package/dist/ts/wrapper.d.ts.map +1 -0
- package/dist/ts/wrapper.js +9 -0
- package/dist/ts/wrapper.js.map +1 -0
- package/package.json +7 -6
- package/src/ts/akarisub.ts +46 -4
- package/src/ts/types.ts +18 -4
- package/src/ts/worker.ts +177 -23
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
/// <reference types="@webgpu/types" />
|
|
2
|
+
// Maximum images per batch
|
|
3
|
+
const MAX_IMAGES_PER_BATCH = 256;
|
|
4
|
+
// WebGPU max texture array layers
|
|
5
|
+
const MAX_TEXTURE_ARRAY_LAYERS = 256;
|
|
6
|
+
// WGSL Vertex Shader
|
|
7
|
+
const VERTEX_SHADER = /* wgsl */ `
|
|
8
|
+
struct VertexOutput {
|
|
9
|
+
@builtin(position) position: vec4f,
|
|
10
|
+
@location(0) @interpolate(flat) instanceIndex: u32,
|
|
11
|
+
@location(1) @interpolate(flat) destXY: vec2f,
|
|
12
|
+
@location(2) @interpolate(flat) texSize: vec2f,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
struct Uniforms {
|
|
16
|
+
resolution: vec2f,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
struct ImageData {
|
|
20
|
+
destRect: vec4f, // x, y, w, h
|
|
21
|
+
texInfo: vec4f, // texW, texH, texIndex, 0
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
|
|
25
|
+
@group(0) @binding(1) var<storage, read> imageData: array<ImageData>;
|
|
26
|
+
|
|
27
|
+
// Quad vertices (two triangles)
|
|
28
|
+
const QUAD_POSITIONS = array<vec2f, 6>(
|
|
29
|
+
vec2f(0.0, 0.0),
|
|
30
|
+
vec2f(1.0, 0.0),
|
|
31
|
+
vec2f(0.0, 1.0),
|
|
32
|
+
vec2f(1.0, 0.0),
|
|
33
|
+
vec2f(1.0, 1.0),
|
|
34
|
+
vec2f(0.0, 1.0)
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
@vertex
|
|
38
|
+
fn vertexMain(
|
|
39
|
+
@builtin(vertex_index) vertexIndex: u32,
|
|
40
|
+
@builtin(instance_index) instanceIndex: u32
|
|
41
|
+
) -> VertexOutput {
|
|
42
|
+
var output: VertexOutput;
|
|
43
|
+
|
|
44
|
+
let data = imageData[instanceIndex];
|
|
45
|
+
let quadPos = QUAD_POSITIONS[vertexIndex];
|
|
46
|
+
let wh = data.destRect.zw;
|
|
47
|
+
|
|
48
|
+
// Calculate pixel position
|
|
49
|
+
let pixelPos = data.destRect.xy + quadPos * wh;
|
|
50
|
+
|
|
51
|
+
// Convert to clip space (-1 to 1)
|
|
52
|
+
var clipPos = (pixelPos / uniforms.resolution) * 2.0 - 1.0;
|
|
53
|
+
clipPos.y = -clipPos.y;
|
|
54
|
+
|
|
55
|
+
output.position = vec4f(clipPos, 0.0, 1.0);
|
|
56
|
+
output.instanceIndex = instanceIndex;
|
|
57
|
+
output.destXY = data.destRect.xy;
|
|
58
|
+
output.texSize = data.texInfo.xy;
|
|
59
|
+
|
|
60
|
+
return output;
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
// WGSL Fragment Shader
|
|
64
|
+
const FRAGMENT_SHADER = /* wgsl */ `
|
|
65
|
+
@group(0) @binding(2) var texArray: texture_2d_array<f32>;
|
|
66
|
+
|
|
67
|
+
struct ImageData {
|
|
68
|
+
destRect: vec4f,
|
|
69
|
+
texInfo: vec4f,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@group(0) @binding(1) var<storage, read> imageData: array<ImageData>;
|
|
73
|
+
|
|
74
|
+
struct FragmentInput {
|
|
75
|
+
@builtin(position) fragCoord: vec4f,
|
|
76
|
+
@location(0) @interpolate(flat) instanceIndex: u32,
|
|
77
|
+
@location(1) @interpolate(flat) destXY: vec2f,
|
|
78
|
+
@location(2) @interpolate(flat) texSize: vec2f,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@fragment
|
|
82
|
+
fn fragmentMain(input: FragmentInput) -> @location(0) vec4f {
|
|
83
|
+
let data = imageData[input.instanceIndex];
|
|
84
|
+
let texIndex = u32(data.texInfo.z);
|
|
85
|
+
|
|
86
|
+
// Calculate texel coordinates
|
|
87
|
+
let texCoordF = floor(input.fragCoord.xy - input.destXY);
|
|
88
|
+
let texCoord = vec2i(texCoordF);
|
|
89
|
+
|
|
90
|
+
// Bounds check
|
|
91
|
+
let texSizeI = vec2i(input.texSize);
|
|
92
|
+
if (texCoord.x < 0 || texCoord.y < 0 || texCoord.x >= texSizeI.x || texCoord.y >= texSizeI.y) {
|
|
93
|
+
discard;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Load from texture array
|
|
97
|
+
let color = textureLoad(texArray, texCoord, texIndex, 0);
|
|
98
|
+
|
|
99
|
+
// Premultiplied alpha output
|
|
100
|
+
return vec4f(color.rgb * color.a, color.a);
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
/**
|
|
104
|
+
* Check if WebGPU is supported in the current browser.
|
|
105
|
+
*/
|
|
106
|
+
export function isWebGPUSupported() {
|
|
107
|
+
return typeof navigator !== 'undefined' && 'gpu' in navigator;
|
|
108
|
+
}
|
|
109
|
+
function toUint8View(data) {
|
|
110
|
+
if (data instanceof ArrayBuffer) {
|
|
111
|
+
return new Uint8Array(data);
|
|
112
|
+
}
|
|
113
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* High-performance WebGPU subtitle renderer for AkariSub.
|
|
117
|
+
*/
|
|
118
|
+
export class WebGPURenderer {
|
|
119
|
+
device = null;
|
|
120
|
+
context = null;
|
|
121
|
+
pipeline = null;
|
|
122
|
+
bindGroupLayout = null;
|
|
123
|
+
uniformBuffer = null;
|
|
124
|
+
imageDataBuffer = null;
|
|
125
|
+
// Texture array for batched rendering
|
|
126
|
+
textureArray = null;
|
|
127
|
+
textureArrayView = null;
|
|
128
|
+
textureArraySize = 0;
|
|
129
|
+
textureArrayWidth = 0;
|
|
130
|
+
textureArrayHeight = 0;
|
|
131
|
+
pendingDestroyTextures = [];
|
|
132
|
+
// Pre-allocated typed arrays (reused every frame - ZERO allocations in hot path)
|
|
133
|
+
imageDataArray;
|
|
134
|
+
resolutionArray = new Float32Array(2);
|
|
135
|
+
// Reusable conversion buffer for RGBA->BGRA (grows as needed, never shrinks)
|
|
136
|
+
conversionBuffer = null;
|
|
137
|
+
conversionBufferSize = 0;
|
|
138
|
+
// Bind group (recreated only when texture array changes)
|
|
139
|
+
bindGroup = null;
|
|
140
|
+
bindGroupDirty = true;
|
|
141
|
+
// Track canvas size to avoid redundant updates
|
|
142
|
+
lastCanvasWidth = 0;
|
|
143
|
+
lastCanvasHeight = 0;
|
|
144
|
+
format = 'bgra8unorm';
|
|
145
|
+
_canvas = null;
|
|
146
|
+
_initPromise = null;
|
|
147
|
+
_initialized = false;
|
|
148
|
+
constructor() {
|
|
149
|
+
// Pre-allocate buffer for max images (8 floats per image: destRect + texInfo)
|
|
150
|
+
this.imageDataArray = new Float32Array(MAX_IMAGES_PER_BATCH * 8);
|
|
151
|
+
}
|
|
152
|
+
async init() {
|
|
153
|
+
if (this._initPromise)
|
|
154
|
+
return this._initPromise;
|
|
155
|
+
this._initPromise = this._initDevice();
|
|
156
|
+
return this._initPromise;
|
|
157
|
+
}
|
|
158
|
+
async _initDevice() {
|
|
159
|
+
if (!navigator.gpu) {
|
|
160
|
+
throw new Error('WebGPU not supported');
|
|
161
|
+
}
|
|
162
|
+
const adapter = await navigator.gpu.requestAdapter({
|
|
163
|
+
powerPreference: 'high-performance'
|
|
164
|
+
});
|
|
165
|
+
if (!adapter) {
|
|
166
|
+
throw new Error('No WebGPU adapter found');
|
|
167
|
+
}
|
|
168
|
+
this.device = await adapter.requestDevice();
|
|
169
|
+
this.format = navigator.gpu.getPreferredCanvasFormat();
|
|
170
|
+
const vertexModule = this.device.createShaderModule({ code: VERTEX_SHADER });
|
|
171
|
+
const fragmentModule = this.device.createShaderModule({ code: FRAGMENT_SHADER });
|
|
172
|
+
this.uniformBuffer = this.device.createBuffer({
|
|
173
|
+
size: 16,
|
|
174
|
+
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
175
|
+
});
|
|
176
|
+
// Large storage buffer for all image data
|
|
177
|
+
this.imageDataBuffer = this.device.createBuffer({
|
|
178
|
+
size: MAX_IMAGES_PER_BATCH * 8 * 4,
|
|
179
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST
|
|
180
|
+
});
|
|
181
|
+
// Create initial texture array with reasonable defaults
|
|
182
|
+
this.createTextureArray(256, 256, 32);
|
|
183
|
+
this.bindGroupLayout = this.device.createBindGroupLayout({
|
|
184
|
+
entries: [
|
|
185
|
+
{ binding: 0, visibility: GPUShaderStage.VERTEX, buffer: { type: 'uniform' } },
|
|
186
|
+
{
|
|
187
|
+
binding: 1,
|
|
188
|
+
visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT,
|
|
189
|
+
buffer: { type: 'read-only-storage' }
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
binding: 2,
|
|
193
|
+
visibility: GPUShaderStage.FRAGMENT,
|
|
194
|
+
texture: { sampleType: 'unfilterable-float', viewDimension: '2d-array' }
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
const pipelineLayout = this.device.createPipelineLayout({
|
|
199
|
+
bindGroupLayouts: [this.bindGroupLayout]
|
|
200
|
+
});
|
|
201
|
+
this.pipeline = this.device.createRenderPipeline({
|
|
202
|
+
layout: pipelineLayout,
|
|
203
|
+
vertex: { module: vertexModule, entryPoint: 'vertexMain' },
|
|
204
|
+
fragment: {
|
|
205
|
+
module: fragmentModule,
|
|
206
|
+
entryPoint: 'fragmentMain',
|
|
207
|
+
targets: [
|
|
208
|
+
{
|
|
209
|
+
format: this.format,
|
|
210
|
+
blend: {
|
|
211
|
+
color: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha', operation: 'add' },
|
|
212
|
+
alpha: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha', operation: 'add' }
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
primitive: { topology: 'triangle-list' }
|
|
218
|
+
});
|
|
219
|
+
this._initialized = true;
|
|
220
|
+
}
|
|
221
|
+
// Round up to next power of 2 for GPU-friendly sizes
|
|
222
|
+
nextPowerOf2(n) {
|
|
223
|
+
n--;
|
|
224
|
+
n |= n >> 1;
|
|
225
|
+
n |= n >> 2;
|
|
226
|
+
n |= n >> 4;
|
|
227
|
+
n |= n >> 8;
|
|
228
|
+
n |= n >> 16;
|
|
229
|
+
return n + 1;
|
|
230
|
+
}
|
|
231
|
+
createTextureArray(width, height, layers) {
|
|
232
|
+
if (this.textureArray) {
|
|
233
|
+
this.pendingDestroyTextures.push(this.textureArray);
|
|
234
|
+
}
|
|
235
|
+
// Use power-of-2 dimensions for better GPU performance
|
|
236
|
+
const w = this.nextPowerOf2(Math.max(width, 64));
|
|
237
|
+
const h = this.nextPowerOf2(Math.max(height, 64));
|
|
238
|
+
// Clamp layers to WebGPU max (256)
|
|
239
|
+
const l = Math.min(this.nextPowerOf2(Math.max(layers, 16)), MAX_TEXTURE_ARRAY_LAYERS);
|
|
240
|
+
this.textureArray = this.device.createTexture({
|
|
241
|
+
size: [w, h, l],
|
|
242
|
+
format: this.format,
|
|
243
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT
|
|
244
|
+
});
|
|
245
|
+
this.textureArrayView = this.textureArray.createView({ dimension: '2d-array' });
|
|
246
|
+
this.textureArrayWidth = w;
|
|
247
|
+
this.textureArrayHeight = h;
|
|
248
|
+
this.textureArraySize = l;
|
|
249
|
+
this.bindGroupDirty = true;
|
|
250
|
+
// Clear all texture layers to transparent to prevent garbage border artifacts
|
|
251
|
+
const commandEncoder = this.device.createCommandEncoder();
|
|
252
|
+
for (let layer = 0; layer < l; layer++) {
|
|
253
|
+
const layerView = this.textureArray.createView({
|
|
254
|
+
dimension: '2d',
|
|
255
|
+
baseArrayLayer: layer,
|
|
256
|
+
arrayLayerCount: 1
|
|
257
|
+
});
|
|
258
|
+
const renderPass = commandEncoder.beginRenderPass({
|
|
259
|
+
colorAttachments: [
|
|
260
|
+
{
|
|
261
|
+
view: layerView,
|
|
262
|
+
clearValue: { r: 0, g: 0, b: 0, a: 0 },
|
|
263
|
+
loadOp: 'clear',
|
|
264
|
+
storeOp: 'store'
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
});
|
|
268
|
+
renderPass.end();
|
|
269
|
+
}
|
|
270
|
+
this.device.queue.submit([commandEncoder.finish()]);
|
|
271
|
+
}
|
|
272
|
+
ensureTextureArray(maxWidth, maxHeight, count) {
|
|
273
|
+
// Clamp count to max layers
|
|
274
|
+
const clampedCount = Math.min(count, MAX_TEXTURE_ARRAY_LAYERS);
|
|
275
|
+
if (maxWidth <= this.textureArrayWidth &&
|
|
276
|
+
maxHeight <= this.textureArrayHeight &&
|
|
277
|
+
clampedCount <= this.textureArraySize) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
// Grow with some headroom to avoid frequent resizes, but cap at max layers
|
|
281
|
+
const newWidth = this.nextPowerOf2(Math.max(this.textureArrayWidth, maxWidth));
|
|
282
|
+
const newHeight = this.nextPowerOf2(Math.max(this.textureArrayHeight, maxHeight));
|
|
283
|
+
const newLayers = Math.min(this.nextPowerOf2(Math.max(this.textureArraySize, clampedCount, clampedCount + 16)), MAX_TEXTURE_ARRAY_LAYERS);
|
|
284
|
+
this.createTextureArray(newWidth, newHeight, newLayers);
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
updateBindGroup() {
|
|
288
|
+
if (!this.bindGroupDirty || !this.device || !this.bindGroupLayout)
|
|
289
|
+
return;
|
|
290
|
+
this.bindGroup = this.device.createBindGroup({
|
|
291
|
+
layout: this.bindGroupLayout,
|
|
292
|
+
entries: [
|
|
293
|
+
{ binding: 0, resource: { buffer: this.uniformBuffer } },
|
|
294
|
+
{ binding: 1, resource: { buffer: this.imageDataBuffer } },
|
|
295
|
+
{ binding: 2, resource: this.textureArrayView }
|
|
296
|
+
]
|
|
297
|
+
});
|
|
298
|
+
this.bindGroupDirty = false;
|
|
299
|
+
}
|
|
300
|
+
ensureConversionBuffer(size) {
|
|
301
|
+
if (this.conversionBufferSize < size) {
|
|
302
|
+
// Grow with 50% headroom to reduce reallocations
|
|
303
|
+
this.conversionBufferSize = Math.max(size, (this.conversionBufferSize * 1.5) | 0, 65536);
|
|
304
|
+
this.conversionBuffer = new Uint8Array(this.conversionBufferSize);
|
|
305
|
+
}
|
|
306
|
+
return this.conversionBuffer;
|
|
307
|
+
}
|
|
308
|
+
async setCanvas(canvas, width, height) {
|
|
309
|
+
await this.init();
|
|
310
|
+
if (!this.device)
|
|
311
|
+
throw new Error('WebGPU device not initialized');
|
|
312
|
+
if (width <= 0 || height <= 0)
|
|
313
|
+
return;
|
|
314
|
+
this._canvas = canvas;
|
|
315
|
+
canvas.width = width;
|
|
316
|
+
canvas.height = height;
|
|
317
|
+
if (!this.context) {
|
|
318
|
+
this.context = canvas.getContext('webgpu');
|
|
319
|
+
if (!this.context)
|
|
320
|
+
throw new Error('Could not get WebGPU context');
|
|
321
|
+
this.context.configure({
|
|
322
|
+
device: this.device,
|
|
323
|
+
format: this.format,
|
|
324
|
+
alphaMode: 'premultiplied'
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
this.resolutionArray[0] = width;
|
|
328
|
+
this.resolutionArray[1] = height;
|
|
329
|
+
this.device.queue.writeBuffer(this.uniformBuffer, 0, this.resolutionArray);
|
|
330
|
+
this.lastCanvasWidth = width;
|
|
331
|
+
this.lastCanvasHeight = height;
|
|
332
|
+
}
|
|
333
|
+
updateSize(width, height) {
|
|
334
|
+
if (!this.device || !this._canvas || width <= 0 || height <= 0)
|
|
335
|
+
return;
|
|
336
|
+
if (width === this.lastCanvasWidth && height === this.lastCanvasHeight)
|
|
337
|
+
return;
|
|
338
|
+
this._canvas.width = width;
|
|
339
|
+
this._canvas.height = height;
|
|
340
|
+
this.resolutionArray[0] = width;
|
|
341
|
+
this.resolutionArray[1] = height;
|
|
342
|
+
this.device.queue.writeBuffer(this.uniformBuffer, 0, this.resolutionArray);
|
|
343
|
+
this.lastCanvasWidth = width;
|
|
344
|
+
this.lastCanvasHeight = height;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Render ImageBitmaps (async render mode)
|
|
348
|
+
* Handles batching when image count exceeds MAX_TEXTURE_ARRAY_LAYERS
|
|
349
|
+
*/
|
|
350
|
+
renderBitmaps(images, _canvasWidth, _canvasHeight) {
|
|
351
|
+
if (!this.device || !this.context || !this.pipeline)
|
|
352
|
+
return;
|
|
353
|
+
const len = images.length;
|
|
354
|
+
if (len === 0) {
|
|
355
|
+
this.clear();
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const currentTexture = this.context.getCurrentTexture();
|
|
359
|
+
if (currentTexture.width === 0 || currentTexture.height === 0)
|
|
360
|
+
return;
|
|
361
|
+
// Single pass: find max dimensions and count valid images
|
|
362
|
+
let maxW = 0, maxH = 0, validCount = 0;
|
|
363
|
+
for (let i = 0; i < len; i++) {
|
|
364
|
+
const { image } = images[i];
|
|
365
|
+
const w = image.width, h = image.height;
|
|
366
|
+
if (w > 0 && h > 0) {
|
|
367
|
+
if (w > maxW)
|
|
368
|
+
maxW = w;
|
|
369
|
+
if (h > maxH)
|
|
370
|
+
maxH = h;
|
|
371
|
+
validCount++;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (validCount === 0) {
|
|
375
|
+
this.clear();
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
// Ensure texture array is large enough (capped at MAX_TEXTURE_ARRAY_LAYERS)
|
|
379
|
+
const batchSize = Math.min(validCount, MAX_TEXTURE_ARRAY_LAYERS);
|
|
380
|
+
this.ensureTextureArray(maxW, maxH, batchSize);
|
|
381
|
+
this.updateBindGroup();
|
|
382
|
+
const device = this.device;
|
|
383
|
+
const queue = device.queue;
|
|
384
|
+
const textureArray = this.textureArray;
|
|
385
|
+
const imageDataArray = this.imageDataArray;
|
|
386
|
+
const textureView = currentTexture.createView();
|
|
387
|
+
// Process images in batches if needed
|
|
388
|
+
let imageIndex = 0;
|
|
389
|
+
let isFirstBatch = true;
|
|
390
|
+
while (imageIndex < len) {
|
|
391
|
+
let texIndex = 0;
|
|
392
|
+
// Upload batch of textures
|
|
393
|
+
while (imageIndex < len && texIndex < MAX_TEXTURE_ARRAY_LAYERS) {
|
|
394
|
+
const img = images[imageIndex++];
|
|
395
|
+
const bitmap = img.image;
|
|
396
|
+
const w = bitmap.width, h = bitmap.height;
|
|
397
|
+
if (w <= 0 || h <= 0)
|
|
398
|
+
continue;
|
|
399
|
+
// Copy to texture array layer
|
|
400
|
+
queue.copyExternalImageToTexture({ source: bitmap, flipY: false }, { texture: textureArray, origin: [0, 0, texIndex], premultipliedAlpha: false }, { width: w, height: h });
|
|
401
|
+
// Fill pre-allocated array
|
|
402
|
+
const offset = texIndex << 3;
|
|
403
|
+
imageDataArray[offset] = img.x;
|
|
404
|
+
imageDataArray[offset + 1] = img.y;
|
|
405
|
+
imageDataArray[offset + 2] = w;
|
|
406
|
+
imageDataArray[offset + 3] = h;
|
|
407
|
+
imageDataArray[offset + 4] = w;
|
|
408
|
+
imageDataArray[offset + 5] = h;
|
|
409
|
+
imageDataArray[offset + 6] = texIndex;
|
|
410
|
+
imageDataArray[offset + 7] = 0;
|
|
411
|
+
texIndex++;
|
|
412
|
+
}
|
|
413
|
+
if (texIndex === 0)
|
|
414
|
+
continue;
|
|
415
|
+
// Upload buffer and draw batch
|
|
416
|
+
queue.writeBuffer(this.imageDataBuffer, 0, imageDataArray.buffer, 0, texIndex << 5);
|
|
417
|
+
const commandEncoder = device.createCommandEncoder();
|
|
418
|
+
const renderPass = commandEncoder.beginRenderPass({
|
|
419
|
+
colorAttachments: [
|
|
420
|
+
{
|
|
421
|
+
view: textureView,
|
|
422
|
+
clearValue: { r: 0, g: 0, b: 0, a: 0 },
|
|
423
|
+
loadOp: isFirstBatch ? 'clear' : 'load',
|
|
424
|
+
storeOp: 'store'
|
|
425
|
+
}
|
|
426
|
+
]
|
|
427
|
+
});
|
|
428
|
+
renderPass.setPipeline(this.pipeline);
|
|
429
|
+
renderPass.setBindGroup(0, this.bindGroup);
|
|
430
|
+
renderPass.draw(6, texIndex);
|
|
431
|
+
renderPass.end();
|
|
432
|
+
queue.submit([commandEncoder.finish()]);
|
|
433
|
+
isFirstBatch = false;
|
|
434
|
+
}
|
|
435
|
+
this.cleanupPendingTextures();
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Render from raw ArrayBuffer data (non-async render mode)
|
|
439
|
+
* Handles batching when image count exceeds MAX_TEXTURE_ARRAY_LAYERS
|
|
440
|
+
*/
|
|
441
|
+
render(images, _canvasWidth, _canvasHeight) {
|
|
442
|
+
if (!this.device || !this.context || !this.pipeline)
|
|
443
|
+
return;
|
|
444
|
+
const len = images.length;
|
|
445
|
+
if (len === 0) {
|
|
446
|
+
this.clear();
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
const currentTexture = this.context.getCurrentTexture();
|
|
450
|
+
if (currentTexture.width === 0 || currentTexture.height === 0)
|
|
451
|
+
return;
|
|
452
|
+
// Single pass: find max dimensions and count valid images
|
|
453
|
+
let maxW = 0, maxH = 0, validCount = 0;
|
|
454
|
+
for (let i = 0; i < len; i++) {
|
|
455
|
+
const { w, h } = images[i];
|
|
456
|
+
if (w > 0 && h > 0) {
|
|
457
|
+
if (w > maxW)
|
|
458
|
+
maxW = w;
|
|
459
|
+
if (h > maxH)
|
|
460
|
+
maxH = h;
|
|
461
|
+
validCount++;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (validCount === 0) {
|
|
465
|
+
this.clear();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
// Ensure texture array is large enough (capped at MAX_TEXTURE_ARRAY_LAYERS)
|
|
469
|
+
const batchSize = Math.min(validCount, MAX_TEXTURE_ARRAY_LAYERS);
|
|
470
|
+
this.ensureTextureArray(maxW, maxH, batchSize);
|
|
471
|
+
this.updateBindGroup();
|
|
472
|
+
const device = this.device;
|
|
473
|
+
const queue = device.queue;
|
|
474
|
+
const textureArray = this.textureArray;
|
|
475
|
+
const imageDataArray = this.imageDataArray;
|
|
476
|
+
const isBGRA = this.format === 'bgra8unorm';
|
|
477
|
+
const textureView = currentTexture.createView();
|
|
478
|
+
// Process images in batches if needed
|
|
479
|
+
let imageIndex = 0;
|
|
480
|
+
let isFirstBatch = true;
|
|
481
|
+
while (imageIndex < len) {
|
|
482
|
+
let texIndex = 0;
|
|
483
|
+
// Upload batch of textures
|
|
484
|
+
while (imageIndex < len && texIndex < MAX_TEXTURE_ARRAY_LAYERS) {
|
|
485
|
+
const img = images[imageIndex++];
|
|
486
|
+
const w = img.w, h = img.h;
|
|
487
|
+
if (w <= 0 || h <= 0)
|
|
488
|
+
continue;
|
|
489
|
+
// Upload texture data
|
|
490
|
+
const imgData = img.image;
|
|
491
|
+
if (imgData instanceof ImageBitmap) {
|
|
492
|
+
queue.copyExternalImageToTexture({ source: imgData, flipY: false }, { texture: textureArray, origin: [0, 0, texIndex], premultipliedAlpha: false }, { width: w, height: h });
|
|
493
|
+
}
|
|
494
|
+
else if (imgData instanceof ArrayBuffer || imgData instanceof Uint8Array || imgData instanceof Uint8ClampedArray) {
|
|
495
|
+
this.uploadTextureData(texIndex, imgData, w, h, isBGRA);
|
|
496
|
+
}
|
|
497
|
+
// Fill pre-allocated array
|
|
498
|
+
const offset = texIndex << 3;
|
|
499
|
+
imageDataArray[offset] = img.x;
|
|
500
|
+
imageDataArray[offset + 1] = img.y;
|
|
501
|
+
imageDataArray[offset + 2] = w;
|
|
502
|
+
imageDataArray[offset + 3] = h;
|
|
503
|
+
imageDataArray[offset + 4] = w;
|
|
504
|
+
imageDataArray[offset + 5] = h;
|
|
505
|
+
imageDataArray[offset + 6] = texIndex;
|
|
506
|
+
imageDataArray[offset + 7] = 0;
|
|
507
|
+
texIndex++;
|
|
508
|
+
}
|
|
509
|
+
if (texIndex === 0)
|
|
510
|
+
continue;
|
|
511
|
+
// Upload buffer and draw batch
|
|
512
|
+
queue.writeBuffer(this.imageDataBuffer, 0, imageDataArray.buffer, 0, texIndex << 5);
|
|
513
|
+
const commandEncoder = device.createCommandEncoder();
|
|
514
|
+
const renderPass = commandEncoder.beginRenderPass({
|
|
515
|
+
colorAttachments: [
|
|
516
|
+
{
|
|
517
|
+
view: textureView,
|
|
518
|
+
clearValue: { r: 0, g: 0, b: 0, a: 0 },
|
|
519
|
+
loadOp: isFirstBatch ? 'clear' : 'load',
|
|
520
|
+
storeOp: 'store'
|
|
521
|
+
}
|
|
522
|
+
]
|
|
523
|
+
});
|
|
524
|
+
renderPass.setPipeline(this.pipeline);
|
|
525
|
+
renderPass.setBindGroup(0, this.bindGroup);
|
|
526
|
+
renderPass.draw(6, texIndex);
|
|
527
|
+
renderPass.end();
|
|
528
|
+
queue.submit([commandEncoder.finish()]);
|
|
529
|
+
isFirstBatch = false;
|
|
530
|
+
}
|
|
531
|
+
this.cleanupPendingTextures();
|
|
532
|
+
}
|
|
533
|
+
uploadTextureData(layerIndex, rgbaBuffer, width, height, swapRB) {
|
|
534
|
+
const size = width * height * 4;
|
|
535
|
+
const src = toUint8View(rgbaBuffer);
|
|
536
|
+
if (swapRB) {
|
|
537
|
+
// Use reusable conversion buffer
|
|
538
|
+
const uploadData = this.ensureConversionBuffer(size);
|
|
539
|
+
// Unrolled loop for better performance
|
|
540
|
+
for (let j = 0; j < size; j += 4) {
|
|
541
|
+
uploadData[j] = src[j + 2]; // B <- R
|
|
542
|
+
uploadData[j + 1] = src[j + 1]; // G
|
|
543
|
+
uploadData[j + 2] = src[j]; // R <- B
|
|
544
|
+
uploadData[j + 3] = src[j + 3]; // A
|
|
545
|
+
}
|
|
546
|
+
this.device.queue.writeTexture({ texture: this.textureArray, origin: [0, 0, layerIndex] }, uploadData.buffer, { bytesPerRow: width * 4 }, { width, height });
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
this.device.queue.writeTexture({ texture: this.textureArray, origin: [0, 0, layerIndex] }, src, { bytesPerRow: width * 4 }, { width, height });
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
cleanupPendingTextures() {
|
|
553
|
+
const pending = this.pendingDestroyTextures;
|
|
554
|
+
const len = pending.length;
|
|
555
|
+
if (len === 0)
|
|
556
|
+
return;
|
|
557
|
+
for (let i = 0; i < len; i++) {
|
|
558
|
+
pending[i].destroy();
|
|
559
|
+
}
|
|
560
|
+
pending.length = 0;
|
|
561
|
+
}
|
|
562
|
+
clear() {
|
|
563
|
+
if (!this.device || !this.context)
|
|
564
|
+
return;
|
|
565
|
+
try {
|
|
566
|
+
const currentTexture = this.context.getCurrentTexture();
|
|
567
|
+
if (currentTexture.width === 0 || currentTexture.height === 0)
|
|
568
|
+
return;
|
|
569
|
+
const commandEncoder = this.device.createCommandEncoder();
|
|
570
|
+
const renderPass = commandEncoder.beginRenderPass({
|
|
571
|
+
colorAttachments: [
|
|
572
|
+
{
|
|
573
|
+
view: currentTexture.createView(),
|
|
574
|
+
clearValue: { r: 0, g: 0, b: 0, a: 0 },
|
|
575
|
+
loadOp: 'clear',
|
|
576
|
+
storeOp: 'store'
|
|
577
|
+
}
|
|
578
|
+
]
|
|
579
|
+
});
|
|
580
|
+
renderPass.end();
|
|
581
|
+
this.device.queue.submit([commandEncoder.finish()]);
|
|
582
|
+
}
|
|
583
|
+
catch {
|
|
584
|
+
// Ignore errors
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
get initialized() {
|
|
588
|
+
return this._initialized;
|
|
589
|
+
}
|
|
590
|
+
destroy() {
|
|
591
|
+
this.cleanupPendingTextures();
|
|
592
|
+
this.textureArray?.destroy();
|
|
593
|
+
this.textureArray = null;
|
|
594
|
+
this.textureArrayView = null;
|
|
595
|
+
this.uniformBuffer?.destroy();
|
|
596
|
+
this.uniformBuffer = null;
|
|
597
|
+
this.imageDataBuffer?.destroy();
|
|
598
|
+
this.imageDataBuffer = null;
|
|
599
|
+
this.bindGroup = null;
|
|
600
|
+
this.conversionBuffer = null;
|
|
601
|
+
this.conversionBufferSize = 0;
|
|
602
|
+
this.device?.destroy();
|
|
603
|
+
this.device = null;
|
|
604
|
+
this.context = null;
|
|
605
|
+
this._canvas = null;
|
|
606
|
+
this._initialized = false;
|
|
607
|
+
this._initPromise = null;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
//# sourceMappingURL=webgpu-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpu-renderer.js","sourceRoot":"","sources":["../../../src/ts/webgpu-renderer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AAIvC,2BAA2B;AAC3B,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEhC,kCAAkC;AAClC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAEpC,qBAAqB;AACrB,MAAM,aAAa,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDhC,CAAA;AAED,uBAAuB;AACvB,MAAM,eAAe,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsClC,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,OAAO,SAAS,KAAK,WAAW,IAAI,KAAK,IAAI,SAAS,CAAA;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,IAAkD;IACrE,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;QAChC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;IAED,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;AACtE,CAAC;AAED;;GAEG;AACH,MAAM,OA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