@@ -17,7 +17,7 @@ export class DenoGpuWrapper<T extends Layout> extends GpuWrapper<T> {
1717 constructor (
1818 root : TgpuRoot ,
1919 info : GpuWrapperInfo < T > & { width ?: number , height ?: number } ,
20- outputBuffer : GPUBuffer ,
20+ outputBuffer ? : GPUBuffer ,
2121 ) {
2222 super ( root , info )
2323 this . outputBuffer = outputBuffer
@@ -28,7 +28,7 @@ export class DenoGpuWrapper<T extends Layout> extends GpuWrapper<T> {
2828 }
2929
3030 override beforeDrawFinish ( commandEncoder : GPUCommandEncoder ) {
31- if ( ! this . getTexture || ! this . dimension ) {
31+ if ( ! this . getTexture || ! this . dimension || ! this . outputBuffer ) {
3232 throw new Error ( "No texture provided" )
3333 }
3434 copyToBuffer (
@@ -39,7 +39,7 @@ export class DenoGpuWrapper<T extends Layout> extends GpuWrapper<T> {
3939 )
4040 }
4141 async getImage ( ) {
42- if ( ! this . dimension ) {
42+ if ( ! this . dimension || ! this . outputBuffer ) {
4343 throw new Error ( "No texture provided" )
4444 }
4545 return await createPng (
@@ -50,8 +50,16 @@ export class DenoGpuWrapper<T extends Layout> extends GpuWrapper<T> {
5050}
5151
5252export async function initDeno < T extends Layout >
53- ( info : Omit < GpuWrapperInfo < T > , "getTexture" > & { width : number , height : number } ) {
53+ ( info : Omit < GpuWrapperInfo < T > , "getTexture" > & { width ? : number , height ? : number } ) {
5454 const root = await tgpu . init ( )
55+
56+ if ( ! info . width || ! info . height ) {
57+ return new DenoGpuWrapper (
58+ root ,
59+ info ,
60+ )
61+ }
62+
5563 const { texture, outputBuffer } = createCapture (
5664 root . device ,
5765 info . width ,
0 commit comments