From e734224cff091036ce46dc3e6aee9afbe47ebcfa Mon Sep 17 00:00:00 2001 From: John Owens Date: Tue, 5 Nov 2024 14:03:19 -0800 Subject: [PATCH] cut down to only what is needed to work --- both_webgpu/both_deno_gfx.mjs | 57 ++--------------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/both_webgpu/both_deno_gfx.mjs b/both_webgpu/both_deno_gfx.mjs index 2af0745..6076fea 100644 --- a/both_webgpu/both_deno_gfx.mjs +++ b/both_webgpu/both_deno_gfx.mjs @@ -1,61 +1,8 @@ "use strict"; -import { main, getDeviceAndAdapter } from "./both.mjs"; -import { - Canvas, - EventType, - PixelFormat, - Rect, - Texture, - TextureAccess, - Window, - WindowBuilder, -} from "../../../src/deno_sdl2/mod.ts"; +import { main } from "./both.mjs"; +import { EventType, WindowBuilder } from "../../../src/deno_sdl2/mod.ts"; -class MinimumWindow { - dimensions = { - width: 800, - height: 800, - }; - screenDimensions = { - width: 800, - height: 800, - }; - texture; - canvas; - window; - constructor(device) { - const window = new WindowBuilder( - "Hi, Deno Minimum Window!", - this.dimensions.width, - this.dimensions.height - ).build(); - this.canvas = window.canvas(); - this.window = window; - const creator = this.canvas.textureCreator(); - this.sdl2texture = creator.createTexture( - PixelFormat.ABGR8888, - TextureAccess.Streaming, - this.dimensions.width, - this.dimensions.height - ); - this.texture = this.device.createTexture({ - label: "Capture", - size: this.dimensions, - format: "rgba8unorm-srgb", - usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC, - }); - const { padded } = getRowPadding(this.dimensions.width); - this.outputBuffer = this.device.createBuffer({ - label: "Capture", - size: padded * this.dimensions.height, - usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST, - }); - } -} - -const { adapter, device } = await getDeviceAndAdapter(navigator); -// const minwin = new MinimumWindow(device); const window = new WindowBuilder("Hello, Deno!", 640, 480).build(); const canvas = window.canvas();