compute-toys / wgpu-compute-toy

Cross-platform compute shader engine
https://compute.toys
MIT License
119 stars 16 forks source link

Add optional extensions #24

Closed munrocket closed 5 months ago

munrocket commented 6 months ago

How to use extensions:

enable chromium_experimental_subgroups;
#define PI 3.14

@compute @workgroup_size(256)
#workgroup_count main 256 1 1
fn main(
  @builtin(global_invocation_id) global_id : vec3u,
  @builtin(subgroup_size) sg_size : u32,
  @builtin(subgroup_invocation_id) sg_id : u32
) {
      // TODO: Use subgroupBallot() and subgroupBroadcast()
}

The problem that wgpu not supporting chromium extension yet, but maybe we create device with web_sys?

Also it seems some errors introduced to wasm build after 79ad98d commit, @stefnotch can you please fix it? It is visible only with compute.toy website.

stefnotch commented 6 months ago

@munrocket Sure, how do I best locally reproduce the errors?

munrocket commented 6 months ago

@stefnotch you can replace wgpu-compute-toy folder in compute.toys than git checkout <some_hash> in this folder, yarn install & yarn dev

munrocket commented 6 months ago

Btw #23 also opened error in web with timestamps that was fixed here in de75501 by commenting it. So we should merge this PR for fixing web too. Timestamps need more general solution, I hope someday we will find it.

davidar commented 5 months ago

Thanks, I merged it manually with some minor changes, and also fixed wasm panicking over undefined canvas