mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
Added cache check to WebGPU renderer's loadShader method. Un-commented entries into config.js. Inclusions are now explicit dynamic import lambdas, so the cache functions can detect and call them; however, webpack and rollup seem to use them differently.
This commit is contained in:
11
js/Matrix.js
11
js/Matrix.js
@@ -112,7 +112,9 @@ export const Matrix = memo((props) => {
|
||||
const [rRenderer, setRenderer] = useState(null);
|
||||
const [rRain, setRain] = useState(null);
|
||||
|
||||
const configProps = Object.fromEntries(Object.entries(rawConfigProps).filter(([_, value]) => value != null));
|
||||
const configProps = Object.fromEntries(
|
||||
Object.entries(rawConfigProps).filter(([_, value]) => value != null),
|
||||
);
|
||||
|
||||
const supportsWebGPU = () => {
|
||||
return (
|
||||
@@ -155,7 +157,12 @@ export const Matrix = memo((props) => {
|
||||
setCanvas(canvas);
|
||||
|
||||
const loadRain = async () => {
|
||||
const renderer = await import(`./${useWebGPU ? "webgpu" : "regl"}/main.js`);
|
||||
let renderer;
|
||||
if (useWebGPU) {
|
||||
renderer = await import("./webgpu/main.js");
|
||||
} else {
|
||||
renderer = await import("./regl/main.js");
|
||||
}
|
||||
setRenderer(renderer);
|
||||
const rain = await renderer.init(canvas);
|
||||
setRain(rain);
|
||||
|
||||
Reference in New Issue
Block a user