Skip to content

Commit d2f33dc

Browse files
committed
refactor: split entry points
1 parent f87dce3 commit d2f33dc

File tree

7 files changed

+9
-15
lines changed

7 files changed

+9
-15
lines changed

browser.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * as d from "https://esm.sh/[email protected]/data"
2+
export * from "./src/types.ts"
3+
4+
export * from "./src/GpuWrapper.ts"

mod.ts renamed to deno.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * as d from "https://esm.sh/[email protected]/data"
2-
32
export * from "./src/types.ts"
4-
export * from "./src/GpuWrapper.ts"
3+
54
export * from "./src/DenoGpuWrapper.ts"

example/browser/Basic.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ <h1>lilgpu: Basic</h1>
6262
return vec4(red, green, blue, 1.0);
6363
}
6464
`
65-
import { initCanvas } from "../../src/GpuWrapper.ts"
66-
import * as d from "https://esm.sh/[email protected]/data"
65+
import { initCanvas, d } from "../../browser.ts"
6766

6867
const g = await initCanvas({
6968
vertShader,

example/browser/HelloTriangle.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
<h1>lilgpu: HelloTriangle</h1>
2525
<canvas width="1280" height="720"></canvas>
2626
<script type="module">
27-
import { initCanvas } from "../../src/GpuWrapper.ts"
28-
import * as d from "https://esm.sh/[email protected]/data"
27+
import { initCanvas, d } from "../../browser.ts"
2928

3029
const g = await initCanvas({
3130
vertShader: `

example/deno/Basic.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
},
7373
"outputs": [],
7474
"source": [
75-
"import { initDeno, d } from \"../../mod.ts\"\n",
75+
"import { initDeno, d } from \"../../deno.ts\"\n",
7676
"\n",
7777
"const g = await initDeno({\n",
7878
" vertShader,\n",

example/deno/HelloTriangle.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"source": [
21-
"import { initDeno } from \"../../mod.ts\"\n",
21+
"import { initDeno } from \"../../deno.ts\"\n",
2222
"\n",
2323
"const g = await initDeno({\n",
2424
" vertShader: `\n",

src/GpuWrapper.ts

-7
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ export class GpuWrapper<T extends Layout> {
118118
}
119119
}
120120

121-
export async function init<T extends Layout>(info: GpuWrapperInfo<T>) {
122-
return new GpuWrapper(
123-
await tgpu.init(),
124-
info,
125-
)
126-
}
127-
128121
export async function initCanvas<T extends Layout>
129122
(info: Omit<GpuWrapperInfo<T>, "texture"> & { canvas: HTMLCanvasElement }) {
130123
const root = await tgpu.init()

0 commit comments

Comments
 (0)