mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 04:31:30 +11:00
address feedback
This commit is contained in:
parent
e5081b51e4
commit
4ea379aaa7
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2019,7 +2019,6 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
"console_log",
|
"console_log",
|
||||||
"js-sys",
|
|
||||||
"piet-scene",
|
"piet-scene",
|
||||||
"piet-wgsl",
|
"piet-wgsl",
|
||||||
"pollster",
|
"pollster",
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
[package]
|
[package]
|
||||||
name = "winit-demo"
|
name = "winit-demo"
|
||||||
version = "0.1.0"
|
version.workspace = true
|
||||||
edition = "2021"
|
authors.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# 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_error_panic_hook = "0.1.7"
|
||||||
console_log = "0.2"
|
console_log = "0.2"
|
||||||
wasm-bindgen-futures = "0.4.33"
|
wasm-bindgen-futures = "0.4.33"
|
||||||
js-sys = "0.3.60"
|
web-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"
|
|
||||||
] }
|
|
||||||
|
|
|
@ -22,18 +22,7 @@ use piet_scene::{Scene, SceneBuilder};
|
||||||
use piet_wgsl::{util::RenderContext, Renderer};
|
use piet_wgsl::{util::RenderContext, Renderer};
|
||||||
use winit::{event_loop::EventLoop, window::Window};
|
use winit::{event_loop::EventLoop, window::Window};
|
||||||
|
|
||||||
async fn run() {
|
async fn run(event_loop: EventLoop<()>, window: Window) {
|
||||||
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) {
|
|
||||||
use winit::{event::*, event_loop::ControlFlow};
|
use winit::{event::*, event_loop::ControlFlow};
|
||||||
let render_cx = RenderContext::new().await.unwrap();
|
let render_cx = RenderContext::new().await.unwrap();
|
||||||
let size = window.inner_size();
|
let size = window.inner_size();
|
||||||
|
@ -106,7 +95,14 @@ async fn run_wasm(event_loop: EventLoop<()>, window: Window) {
|
||||||
fn main() {
|
fn main() {
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[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")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
{
|
{
|
||||||
|
@ -126,6 +122,6 @@ fn main() {
|
||||||
.and_then(|doc| doc.body())
|
.and_then(|doc| doc.body())
|
||||||
.and_then(|body| body.append_child(&web_sys::Element::from(canvas)).ok())
|
.and_then(|body| body.append_child(&web_sys::Element::from(canvas)).ok())
|
||||||
.expect("couldn't append canvas to document body");
|
.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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ let SY = 0.00390625;
|
||||||
|
|
||||||
let WG_SIZE = 256u;
|
let WG_SIZE = 256u;
|
||||||
let N_SLICE = 8u;
|
let N_SLICE = 8u;
|
||||||
//const N_SLICE = WG_SIZE / 32u;
|
//let N_SLICE = WG_SIZE / 32u;
|
||||||
let N_SUBSLICE = 4u;
|
let N_SUBSLICE = 4u;
|
||||||
|
|
||||||
var<workgroup> sh_bitmaps: array<array<atomic<u32>, N_TILE>, N_SLICE>;
|
var<workgroup> sh_bitmaps: array<array<atomic<u32>, N_TILE>, N_SLICE>;
|
||||||
|
|
|
@ -46,7 +46,7 @@ var<storage, read_write> ptcl: array<u32>;
|
||||||
// Much of this code assumes WG_SIZE == N_TILE. If these diverge, then
|
// Much of this code assumes WG_SIZE == N_TILE. If these diverge, then
|
||||||
// a fair amount of fixup is needed.
|
// a fair amount of fixup is needed.
|
||||||
let WG_SIZE = 256u;
|
let WG_SIZE = 256u;
|
||||||
//const N_SLICE = WG_SIZE / 32u;
|
//let N_SLICE = WG_SIZE / 32u;
|
||||||
let N_SLICE = 8u;
|
let N_SLICE = 8u;
|
||||||
|
|
||||||
var<workgroup> sh_bitmaps: array<array<atomic<u32>, N_TILE>, N_SLICE>;
|
var<workgroup> sh_bitmaps: array<array<atomic<u32>, N_TILE>, N_SLICE>;
|
||||||
|
|
|
@ -34,5 +34,5 @@ let TILE_HEIGHT = 16u;
|
||||||
// Number of tiles per bin
|
// Number of tiles per bin
|
||||||
let N_TILE_X = 16u;
|
let N_TILE_X = 16u;
|
||||||
let N_TILE_Y = 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;
|
let N_TILE = 256u;
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "run-wasm"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
publish = false
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue