Commit Graph

298 Commits

Author SHA1 Message Date
bors[bot]
49640d2497 Merge #281
281: The Context trait r=grovesNL a=kvark

The main motivation here is to avoid blocking the wgpu-core updates by `wgpu-native`. Instead, `wgpu-native` becomes a branch, and the dependency of `wgpu-rs` -> `wgpu-native` starts adhering to the contract/API of the standard webgpu-native headers.

The biggest change is the introduction of the Context trait. I recall us discussing 2 downsides to having this trait:
  1. inconvenient for the users to include. This is a non-issue here, since it's private.
  2. more code to maintain. This is less of an issue if we aim to have 3 backends.

What this gives in return is a well established contract with the backends. Unlike gfx-rs, the backend code is right here, a part of the crate, so the contract is only for internal use.

Fixes #156 : the "direct" implementation of it goes straight to wgpu-core. What this gives us is less overhead for command recording, since there is no longer an extra indirection on every command, and no heap allocation at the end of a render pass.

The downside of this PR is one extra `Arc` (with addref) per object.

This commit also has small improvements:
- consuming command buffers on submit (Fixes #267)
- Instance type
- proper call to destructors
- fallible `request_device`

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-04-27 04:12:38 +00:00
Dzmitry Malyshau
b7883e485c Small comment on WebGPU backend bit, readme update 2020-04-27 00:11:22 -04:00
Dzmitry Malyshau
e30a428190 Port the Web backend to the Context trait 2020-04-26 19:18:24 -04:00
Dzmitry Malyshau
0d85635008 Move everything into Context trait, remove async 2020-04-26 19:18:24 -04:00
Dzmitry Malyshau
ba95354734 Rewire the backend system to remove wgpu-native step
Main change here is the introduction of the Context trait.
The "direct" implementation of it goes straight to wgpu-core.

This commit also has small improvements:
- consuming command buffers on submit
- Instance type
- proper call to destructors
2020-04-26 19:18:24 -04:00
Chinedu Francis Nwafili
309cc1cedd Add screenshots of examples
When looking into wgpu-rs as a replacement for WebGL I went to the
examples directory on GitHub to browse for a bit.

I wanted to see some of the examples at a glance without needing to
clone the repository.

This commit enables that by adding a README to each example with a
description of the example and screenshots / example output.

In a few cases the description is a bit redundant - but my hope is that
in the future we can improve all the READMEs.

Being a web API and thus very accessible, WebGPU could end up being many
people's first introduction to graphics programming so the lower we make
the barrier the better.
2020-04-26 18:59:48 -02:30
bors[bot]
c0b09bebad Merge #280
280: Add required wasm-bindgen patches to readme r=grovesNL a=rukai

Fixes https://github.com/gfx-rs/wgpu-rs/issues/279

Co-authored-by: Rukai <rubickent@gmail.com>
2020-04-25 03:03:56 +00:00
Rukai
c7895732a4 Add required wasm-bindgen patches to readme 2020-04-25 12:09:13 +10:00
Gabriel Majeri
aa8f5d7267 Build and deploy examples in CI 2020-04-24 22:32:26 -02:30
Igor Shaposhnik
36289ea720 Disable fail fast on CI 2020-04-24 22:31:21 -02:30
Christophe Massolin
0fb47262ea Update README.md for running examples on the web (#275)
* [readme] add details for running on wasm32 target

* [readme] update

* [readme] [web] Running instruction on webgpu.io
2020-04-24 09:42:15 -04:00
bors[bot]
242a596e2c Merge #271
271: Improve docs for BindingType r=kvark a=HalfVoxel

I think everything should be correct.

The readonly flags seem obvious at face value, but I couldn't find anything in the specifications about them (other than some unrelated validation), so I didn't add any documentation for those fields.

Co-authored-by: Aron Granberg <aron.granberg@gmail.com>
2020-04-22 13:08:31 +00:00
Aron Granberg
567cb16f7c Improve docs for BindingType 2020-04-22 15:07:11 +02:00
bors[bot]
5f885ed3cc Merge #268
268: Fix hello-triangle example format and bind group r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-04-21 23:10:18 +00:00
Dzmitry Malyshau
b612d9c8ef Fix hello-triangle example format and bind group 2020-04-21 19:08:42 -04:00
bors[bot]
1e3b1a38fe Merge #262
262: Reverse srgb in hello-triangle r=kvark a=grovesNL

Reverse srgb support in hello-triangle (these were backwards by mistake)

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-04-20 02:18:30 +00:00
bors[bot]
fe565e7cef Merge #264
264: Use opaque texels in mipmap example r=kvark a=grovesNL

This fixes rendering for the mipmap example in Nightly

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-04-20 02:13:07 +00:00
Joshua Groves
6de7f82666 Use opaque texels in mipmap example 2020-04-19 23:38:58 -02:30
Joshua Groves
a75100209e Reverse srgb support in hello-triangle 2020-04-19 16:32:50 -02:30
Dzmitry Malyshau
644cd76cae Add harmony to README 2020-04-18 11:21:08 -04:00
Joshua Groves
423f576d8e Use srgb for swapchain when possible 2020-04-18 01:04:28 -02:30
Joshua Groves
bbbeb242ad Add wasm to CI 2020-04-18 01:04:28 -02:30
Joshua Groves
9952801e2f Add labels to mapped descriptors where possible 2020-04-18 01:04:28 -02:30
Joshua Groves
d1197c0c2e Fix some remaining TODOs in the web backend 2020-04-18 01:04:28 -02:30
Joshua Groves
643481ed81 Expose more functions on the web backend 2020-04-18 01:04:28 -02:30
Joshua Groves
f0ab842d6e Combine wasm_main/main and add console_log 2020-04-18 01:04:28 -02:30
Joshua Groves
349f992a7a Switch event loop back to ControlFlow::Poll 2020-04-18 01:04:28 -02:30
Joshua Groves
95c69a192c Allow describe example to run on the web 2020-04-18 01:04:28 -02:30
Joshua Groves
8ee80efe59 Get shadow mostly working
Some of the implementation is still missing in Canary
2020-04-18 01:04:28 -02:30
Joshua Groves
bf49c1a4f1 Update to latest winit and wasm-bindgen 2020-04-18 01:04:28 -02:30
Joshua Groves
b34c0af749 Only expose adapter info on native 2020-04-18 01:04:28 -02:30
Joshua Groves
a6473b52b9 Get capture mostly working
`File::create` isn't available on wasm, so we can't actually write the
output image anywhere unless we target something else as the file
system (e.g. local storage)
2020-04-18 01:04:28 -02:30
Joshua Groves
76d5855fdc Get mipmap mostly working
Subresource tracking for mip levels isn't available in Canary yet, so
we can't verify that the web example output matches native
2020-04-18 01:04:28 -02:30
Joshua Groves
2829bd3f00 Get skybox working 2020-04-18 01:04:28 -02:30
Joshua Groves
7a6fab83c4 Get cube working 2020-04-18 01:04:28 -02:30
Joshua Groves
2ea9e01e5c Get boids working 2020-04-18 01:04:28 -02:30
Joshua Groves
e1eaa6ca26 Add web backend 2020-04-18 01:04:28 -02:30
bors[bot]
764e6b8ca4 Merge #259
259: Remove zerocopy and replace with bytemuck. r=kvark a=StarArawn

fixes #146 

I've removed `zerocopy` from the examples and replaced it with `bytemuck`. I ran all of the examples/tests and everything ran great in vulkan on my windows box.

Co-authored-by: StarToaster <startoaster23@gmail.com>
2020-04-17 14:11:30 +00:00
StarToaster
40a19ebe66 Removed zerocopy and replaced it with bytemuck. 2020-04-17 10:07:24 -04:00
bors[bot]
bc547947ce Merge #256
256: Update wgpu for texture descriptor changes r=grovesNL a=kvark

Updates for https://github.com/gfx-rs/wgpu/pull/577
Detaches us from crates-io dependency (again).

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-04-14 11:30:02 +00:00
Dzmitry Malyshau
1678a267cb Update wgpu for texture descriptor changes 2020-04-14 01:13:47 -04:00
bors[bot]
1c1dc8c573 Merge #254
254: Specify expected structure for draw_indirect and draw_indexed_indirect r=kvark a=lachlansneff

~~Based on https://www.khronos.org/opengl/wiki/Vertex_Rendering#Indirect_rendering.~~ Turns out the opengl docs are wrong. Based on https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDrawIndirectCommand.html.

Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
2020-04-12 16:14:15 +00:00
Lachlan Sneff
0025ca0d34 Fix documentation based on vulkan docs 2020-04-12 10:56:15 -04:00
bors[bot]
5f211a0de5 Merge #251
251: cargo fmt the code and tweak format rules r=kvark a=chao-mu

Ran cargo fmt after removing rules per @kvark, two of which were because they needed nightly to run.

Co-authored-by: Hackpoetic <chao-mu@hackpoetic.com>
2020-04-12 12:24:30 +00:00
Lachlan Sneff
496d25db69 Specified expected structure for draw_indirect and draw_indexed_indirect 2020-04-11 23:33:31 -04:00
bors[bot]
1f87f9773d Merge #252
252: Typo r=grovesNL a=maghoff

Remove extra word

Co-authored-by: Magnus Hoff <maghoff@gmail.com>
2020-04-11 12:59:28 +00:00
Magnus Hoff
5bee0f7abf Typo
Remove extra word
2020-04-11 13:09:45 +02:00
Hackpoetic
b81be14348 add missing rust format config 2020-04-11 00:05:18 -04:00
Hackpoetic
a6e81dc703 cargo fmt the code and tweak format rules 2020-04-10 22:56:24 -04:00
Igor Shaposhnik
c1695a5a37 Migrate CI to GitHub Actions 2020-04-10 10:59:21 -04:00