Shadow demo for WebGPU-native

Hi WebGPU!

I've been working ([1]) on an example to test and polish our native 
WebGPU implementation, called "shadow". See the attached screenshot to 
get the idea. Just wanted to share a bit of feedback, now that I got a 
slight idea about what it is to *use* the API as opposed to designing it:

 1. Overall, the experience was very pleasant ([2]). I believe we are
    aiming for the right level of abstraction for the web: low enough to
    be efficient, high enough to actually be able to write the demo and
    not drown in details.
 2. Some of the structures are unbalanced. For example,
    GPURasterizationStateDescriptor has most of the fields related to
    depth biasing. It would be cleaner to have all the depth biasing in
    a dedicated structure instead.
 3. I find GLSL with Vulkan syntax to be pretty nice to use. It
    addresses the biggest problem GLSL has - separating textures and
    samplers ([3]), along with specifying all the bind group/binding
    registers explicitly. I see value in it being well supported by
    WebGPU (not a as digested format), given that the current users of
    WebGL would have easier time moving to that syntax than to HLSL.

Note: the example is written in Rust, but it's just a light wrapper over 
C API library (wgpu-native). The idea is for it to be compatible with 
Dawn, and also to gain the ability to target WASM in the future.

Links:

[1] https://github.com/gfx-rs/wgpu/pull/71

[2] 
https://github.com/kvark/wgpu/blob/616a3dd849c87db72db37d534bb21ddc700a2165/gfx-examples/src/shadow.rs

[3] 
https://github.com/kvark/wgpu/blob/616a3dd849c87db72db37d534bb21ddc700a2165/gfx-examples/data/shadow-forward.frag#L45


Regards,

Dzmitry

Received on Saturday, 23 February 2019 04:04:21 UTC