2026-02-02 01:12:53 +10:00
|
|
|
import { Smc } from "./smc.js";
|
|
|
|
|
import { SmcErr } from "./errors.js";
|
|
|
|
|
|
2026-02-03 20:26:22 +10:00
|
|
|
export { Smc, SmcErr, fetchShader };
|
|
|
|
|
|
|
|
|
|
async function fetchShader(uri, delegate) {
|
|
|
|
|
const res = await fetch(uri);
|
|
|
|
|
if (res.ok)
|
|
|
|
|
return await res.text();
|
|
|
|
|
this.raiseError(
|
|
|
|
|
SmcErr.FETCH_SHADER,
|
|
|
|
|
`Failed to load shader source ${url}: ${res.status} ${res.json()}`);
|
|
|
|
|
return ""
|
|
|
|
|
}
|