@solidrt/core 0.0.44 → 0.0.46
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/AGENTS.md +1 -1
- package/examples/README.md +4 -1
- package/examples/gpu-draw-list.tsx +110 -0
- package/examples/gpu-instancing.tsx +47 -18
- package/examples/gpu-pipeline.tsx +44 -14
- package/examples/gpu-shared-params.tsx +135 -0
- package/examples/responsive-grid.tsx +5 -0
- package/examples/view-shader-history.tsx +85 -0
- package/examples/view-shader.tsx +81 -0
- package/examples/view-viewbox.tsx +86 -0
- package/package.json +5 -5
- package/src/gpu.ts +151 -59
- package/src/image.ts +8 -20
- package/src/index.ts +1 -1
- package/src/types.d.ts +61 -4
package/src/types.d.ts
CHANGED
|
@@ -23,10 +23,6 @@ declare global {
|
|
|
23
23
|
readonly env: { readonly DEV: boolean }
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
let image: {
|
|
27
|
-
decodeImage(bytes: Uint8Array): { data: Uint8Array, width: number, height: number }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
26
|
let speech: {
|
|
31
27
|
start(options: {
|
|
32
28
|
model: Uint8Array, vadModel: Uint8Array, lang?: string, microphone?: number,
|
|
@@ -447,6 +443,67 @@ export interface ViewOwnProps extends TransformProps, PointerProps {
|
|
|
447
443
|
* axis-aligned rects look identical, so prefer it for plain UI panels.
|
|
448
444
|
*/
|
|
449
445
|
repaintBoundary?: boolean | "snapshot" | "snapshot-no-aa"
|
|
446
|
+
/**
|
|
447
|
+
* Run this view's rasterized subtree through a GPU program and composite
|
|
448
|
+
* the result in its place. Requires repaintBoundary="snapshot" (the cost
|
|
449
|
+
* is snapshot semantics, kept explicit; declared without it the shader is
|
|
450
|
+
* ignored with a warning). The pass is region-sized and split from content
|
|
451
|
+
* invalidation: a params-only change re-runs just the pass against the
|
|
452
|
+
* cached snapshot, so animating an effect over a static subtree never
|
|
453
|
+
* re-rasterizes it.
|
|
454
|
+
*
|
|
455
|
+
* The effect samples only the subtree's own pixels - grading, warping or
|
|
456
|
+
* dissolving the panel works; anything needing what is behind it does not.
|
|
457
|
+
* Sampling outside the content clamps to the edge, and the output is
|
|
458
|
+
* cropped to the layout box like any snapshot. Hit-testing stays on layout
|
|
459
|
+
* geometry: a distortion moves pixels, not hit targets. The view's own
|
|
460
|
+
* transform and opacity apply after the effect, so the program sees
|
|
461
|
+
* unrotated, opaque content.
|
|
462
|
+
*/
|
|
463
|
+
shader?: ViewShaderProps | null
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* A boundary shader declaration. The program contract matches shader targets,
|
|
468
|
+
* not the window pass: the subtree's rasterization binds as
|
|
469
|
+
* `uniform sampler2D uSource` (top-left origin, like every sampled texture)
|
|
470
|
+
* and the pass draws the covering triangle attributeless. `iResolution`,
|
|
471
|
+
* filled by name, is the boundary in physical pixels.
|
|
472
|
+
*/
|
|
473
|
+
export interface ViewShaderProps {
|
|
474
|
+
/** Linked program handle from linkProgram. */
|
|
475
|
+
program: ProgramId
|
|
476
|
+
/**
|
|
477
|
+
* Uniforms filled by name, paced to the next real repaint. A number drives
|
|
478
|
+
* a scalar (`float`/`int`); a flat number array drives the declared GLSL
|
|
479
|
+
* type: 2/3/4 for `vec2`/`vec3`/`vec4`, 16 (column-major) for `mat4`.
|
|
480
|
+
*/
|
|
481
|
+
params?: Record<string, number | number[]>
|
|
482
|
+
/** Extra sampler2D inputs: uniform name to texture id. */
|
|
483
|
+
textures?: Record<string, TextureId>
|
|
484
|
+
/**
|
|
485
|
+
* Transparent margin in logical px on every side of the layout box, for
|
|
486
|
+
* the effect to write into - glow, drop shadow, blur that bleeds past the
|
|
487
|
+
* edge. Grows the rasterized canvas and the composited quad; the subtree's
|
|
488
|
+
* own paint stays clipped to the layout box either way. The pass sees only
|
|
489
|
+
* the bigger iResolution - declare an app uniform if the program needs the
|
|
490
|
+
* margin size. Default 0.
|
|
491
|
+
*/
|
|
492
|
+
outset?: number
|
|
493
|
+
/**
|
|
494
|
+
* Retain the prior rasterization of the subtree as
|
|
495
|
+
* `uniform sampler2D uPrevious`. Source history, not output history: it
|
|
496
|
+
* rotates when the content actually re-rasterizes, not per frame - on a
|
|
497
|
+
* content change uPrevious holds exactly the old look (transition
|
|
498
|
+
* material: cross-dissolve old into new), while for a static subtree with
|
|
499
|
+
* animated params uPrevious equals uSource. Feedback/accumulation is not
|
|
500
|
+
* this; that stays with manual targets. Costs one extra canvas-sized
|
|
501
|
+
* texture while declared; transparent until the first rotation, and reset
|
|
502
|
+
* to transparent by a size or scale change. Only declare the uPrevious
|
|
503
|
+
* uniform together with this flag - without it the uniform stays at unit 0
|
|
504
|
+
* and aliases uSource. Default false.
|
|
505
|
+
*/
|
|
506
|
+
previous?: boolean
|
|
450
507
|
}
|
|
451
508
|
|
|
452
509
|
export interface ViewProps extends ViewOwnProps, LayoutProps {}
|