diff --git a/Cargo.lock b/Cargo.lock index 9eb3574..d7f99c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2019,7 +2019,6 @@ version = "0.1.0" dependencies = [ "console_error_panic_hook", "console_log", - "js-sys", "piet-scene", "piet-wgsl", "pollster", diff --git a/piet-wgsl/examples/winit/Cargo.toml b/piet-wgsl/examples/winit/Cargo.toml index ff8b10c..d4719f1 100644 --- a/piet-wgsl/examples/winit/Cargo.toml +++ b/piet-wgsl/examples/winit/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "winit-demo" -version = "0.1.0" -edition = "2021" +version.workspace = true +authors.workspace = true +edition.workspace = true publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -19,133 +20,4 @@ roxmltree = "0.13" console_error_panic_hook = "0.1.7" console_log = "0.2" wasm-bindgen-futures = "0.4.33" -js-sys = "0.3.60" -web-sys = { version = "0.3.60", features = [ - "Document", - "Navigator", - "Node", - "NodeList", - "Gpu", - "GpuAdapter", - "GpuAddressMode", - "GpuAutoLayoutMode", - "GpuBindGroup", - "GpuBindGroupDescriptor", - "GpuBindGroupEntry", - "GpuBindGroupLayout", - "GpuBindGroupLayoutDescriptor", - "GpuBindGroupLayoutEntry", - "GpuBlendComponent", - "GpuBlendFactor", - "GpuBlendOperation", - "GpuBlendState", - "GpuBuffer", - "GpuBufferBinding", - "GpuBufferBindingLayout", - "GpuBufferBindingType", - "GpuBufferDescriptor", - "GpuCanvasAlphaMode", - "GpuCanvasContext", - "GpuCanvasConfiguration", - "GpuColorDict", - "GpuColorTargetState", - "GpuCommandBuffer", - "GpuCommandBufferDescriptor", - "GpuCommandEncoder", - "GpuCommandEncoderDescriptor", - "GpuCompareFunction", - "GpuCompilationInfo", - "GpuCompilationMessage", - "GpuCompilationMessageType", - "GpuComputePassDescriptor", - "GpuComputePassEncoder", - "GpuComputePipeline", - "GpuComputePipelineDescriptor", - "GpuCullMode", - "GpuDepthStencilState", - "GpuDevice", - "GpuDeviceDescriptor", - "GpuDeviceLostInfo", - "GpuDeviceLostReason", - "GpuError", - "GpuErrorFilter", - "GpuExtent3dDict", - "GpuFeatureName", - "GpuFilterMode", - "GpuFragmentState", - "GpuFrontFace", - "GpuImageCopyBuffer", - "GpuImageCopyExternalImage", - "GpuImageCopyTexture", - "GpuImageCopyTextureTagged", - "GpuImageDataLayout", - "GpuIndexFormat", - "GpuLoadOp", - "gpu_map_mode", - "GpuMipmapFilterMode", - "GpuMultisampleState", - "GpuObjectDescriptorBase", - "GpuOrigin2dDict", - "GpuOrigin3dDict", - "GpuOutOfMemoryError", - "GpuPipelineDescriptorBase", - "GpuPipelineLayout", - "GpuPipelineLayoutDescriptor", - "GpuPowerPreference", - "GpuPrimitiveState", - "GpuPrimitiveTopology", - "GpuProgrammableStage", - "GpuQuerySet", - "GpuQuerySetDescriptor", - "GpuQueryType", - "GpuQueue", - "GpuRenderBundle", - "GpuRenderBundleDescriptor", - "GpuRenderBundleEncoder", - "GpuRenderBundleEncoderDescriptor", - "GpuRenderPassColorAttachment", - "GpuRenderPassDepthStencilAttachment", - "GpuRenderPassDescriptor", - "GpuRenderPassEncoder", - "GpuRenderPipeline", - "GpuRenderPipelineDescriptor", - "GpuRequestAdapterOptions", - "GpuSampler", - "GpuSamplerBindingLayout", - "GpuSamplerBindingType", - "GpuSamplerDescriptor", - "GpuShaderModule", - "GpuShaderModuleDescriptor", - "GpuStencilFaceState", - "GpuStencilOperation", - "GpuStorageTextureAccess", - "GpuStorageTextureBindingLayout", - "GpuStoreOp", - "GpuSupportedFeatures", - "GpuSupportedLimits", - "GpuTexture", - "GpuTextureAspect", - "GpuTextureBindingLayout", - "GpuTextureDescriptor", - "GpuTextureDimension", - "GpuTextureFormat", - "GpuTextureSampleType", - "GpuTextureView", - "GpuTextureViewDescriptor", - "GpuTextureViewDimension", - "GpuUncapturedErrorEvent", - "GpuUncapturedErrorEventInit", - "GpuValidationError", - "GpuVertexAttribute", - "GpuVertexBufferLayout", - "GpuVertexFormat", - "GpuVertexState", - "GpuVertexStepMode", - "HtmlCanvasElement", - "OffscreenCanvas", - "ImageBitmap", - "ImageBitmapRenderingContext", - "Window", - "WorkerGlobalScope", - "WorkerNavigator" -] } +web-sys = "0.3.60" diff --git a/piet-wgsl/examples/winit/src/main.rs b/piet-wgsl/examples/winit/src/main.rs index 07cf31d..961d101 100644 --- a/piet-wgsl/examples/winit/src/main.rs +++ b/piet-wgsl/examples/winit/src/main.rs @@ -22,18 +22,7 @@ use piet_scene::{Scene, SceneBuilder}; use piet_wgsl::{util::RenderContext, Renderer}; use winit::{event_loop::EventLoop, window::Window}; -async fn run() { - use winit::{dpi::LogicalSize, window::WindowBuilder}; - let event_loop = EventLoop::new(); - let window = WindowBuilder::new() - .with_inner_size(LogicalSize::new(1044, 800)) - .with_resizable(true) - .build(&event_loop) - .unwrap(); - run_wasm(event_loop, window).await -} - -async fn run_wasm(event_loop: EventLoop<()>, window: Window) { +async fn run(event_loop: EventLoop<()>, window: Window) { use winit::{event::*, event_loop::ControlFlow}; let render_cx = RenderContext::new().await.unwrap(); let size = window.inner_size(); @@ -106,7 +95,14 @@ async fn run_wasm(event_loop: EventLoop<()>, window: Window) { fn main() { #[cfg(not(target_arch = "wasm32"))] { - pollster::block_on(run()); + use winit::{dpi::LogicalSize, window::WindowBuilder}; + let event_loop = EventLoop::new(); + let window = WindowBuilder::new() + .with_inner_size(LogicalSize::new(1044, 800)) + .with_resizable(true) + .build(&event_loop) + .unwrap(); + pollster::block_on(run(event_loop, window)); } #[cfg(target_arch = "wasm32")] { @@ -126,6 +122,6 @@ fn main() { .and_then(|doc| doc.body()) .and_then(|body| body.append_child(&web_sys::Element::from(canvas)).ok()) .expect("couldn't append canvas to document body"); - wasm_bindgen_futures::spawn_local(run_wasm(event_loop, window)); + wasm_bindgen_futures::spawn_local(run(event_loop, window)); } } diff --git a/piet-wgsl/shader/binning.wgsl b/piet-wgsl/shader/binning.wgsl index 9407f06..1783fc5 100644 --- a/piet-wgsl/shader/binning.wgsl +++ b/piet-wgsl/shader/binning.wgsl @@ -45,7 +45,7 @@ let SY = 0.00390625; let WG_SIZE = 256u; let N_SLICE = 8u; -//const N_SLICE = WG_SIZE / 32u; +//let N_SLICE = WG_SIZE / 32u; let N_SUBSLICE = 4u; var sh_bitmaps: array, N_TILE>, N_SLICE>; diff --git a/piet-wgsl/shader/coarse.wgsl b/piet-wgsl/shader/coarse.wgsl index 4e23a21..46e23be 100644 --- a/piet-wgsl/shader/coarse.wgsl +++ b/piet-wgsl/shader/coarse.wgsl @@ -46,7 +46,7 @@ var ptcl: array; // Much of this code assumes WG_SIZE == N_TILE. If these diverge, then // a fair amount of fixup is needed. let WG_SIZE = 256u; -//const N_SLICE = WG_SIZE / 32u; +//let N_SLICE = WG_SIZE / 32u; let N_SLICE = 8u; var sh_bitmaps: array, N_TILE>, N_SLICE>; diff --git a/piet-wgsl/shader/shared/config.wgsl b/piet-wgsl/shader/shared/config.wgsl index 29ea80b..54f94f6 100644 --- a/piet-wgsl/shader/shared/config.wgsl +++ b/piet-wgsl/shader/shared/config.wgsl @@ -34,5 +34,5 @@ let TILE_HEIGHT = 16u; // Number of tiles per bin let N_TILE_X = 16u; let N_TILE_Y = 16u; -//const N_TILE = N_TILE_X * N_TILE_Y; +//let N_TILE = N_TILE_X * N_TILE_Y; let N_TILE = 256u; diff --git a/run-wasm/Cargo.toml b/run-wasm/Cargo.toml index 463fdaa..ef47b50 100644 --- a/run-wasm/Cargo.toml +++ b/run-wasm/Cargo.toml @@ -3,6 +3,7 @@ name = "run-wasm" version.workspace = true authors.workspace = true edition.workspace = true +publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html