Commit Graph

232 Commits

Author SHA1 Message Date
Joshua Groves
652c7242fb [rs] Avoid array indexing in hello-triangle 2020-03-30 07:58:06 -04:00
Lucas Kent
ef1e47216e [rs] Move multithreaded_compute.rs into hello-compute tests (#223)
Setup hello-compute tests to run during `cargo test`
2020-03-29 19:55:39 -04:00
aloucks
66243f12c9 [rs] Add VertexStateDescriptor (#221)
The vertex state properties are now bundled in the VertexStateDescriptor
which matches the spec.

Fixes #220
2020-03-28 10:45:18 -04:00
bors[bot]
49bcef0516 [rs] Merge #214
214: Rewrite GpuFuture to avoid blocking and to use less space r=kvark a=lachlansneff

Since `GpuFuture` doesn't blocking wait for the mapping to resolve anymore, we need to poll the device for it to actually work. ~~I haven't added that to the `hello-compute` example, so it doesn't work anymore.~~

Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
2020-03-27 04:18:29 +00:00
Lachlan Sneff
d4b59f8e2e [rs] Rewrite GpuFuture to avoid blocking and to use less space
Remove odd patching matching

Replace std::sync::Mutex with spin::Mutex in GpuFuture

Reduce GpuFuture usage to one explicit allocation instead of two

Fix examples to poll the device in the background when using map_read or map_write

Remove device.poll from GpuFuture::poll and document future invariants

Massively simplify examples

Use Arc::clone(...) instead of arc.clone()

Switch println to log::info
2020-03-27 00:16:35 -04:00
bors[bot]
25f70dc78a [rs] Merge #213
213: Cleanup user-interface around async buffer mapping r=grovesNL a=lachlansneff

This PR cleans up the interface for asynchronous buffer mapping a little. It turns `map_read` and `map_write` into `async` functions (instead of returning `impl Future<...>`). It also adds a standin error type and removes some confusing type aliases.

Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
2020-03-27 00:12:20 +00:00
bors[bot]
82583e3749 [rs] Merge #219
219: Update Zerocopy to 0.3 r=kvark a=cwfitzgerald

In an effort to eliminate duplicate dependencies, especially on the proc-macro/syn stack, this updates zerocopy 0.2 (using syn 0.6) to zerocopy 0.3 (using syn 1). There appears to be no real api changes based on my skimming of the docs. Things compile on my windows machine, and hopefully it will pass on mac and linux.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-03-26 17:58:55 +00:00
Connor Fitzgerald
7deefae6d9 [rs] Update zerocopy to 0.3 2020-03-26 13:22:44 -04:00
Lachlan Sneff
cc4e837792 [rs] Cleanup user-interface around async buffer mapping 2020-03-23 00:07:54 -04:00
bors[bot]
0fa4f114c8 [rs] Merge #210
210: Update WGPU deps to rev 08e8d406c1 r=kvark a=aloucks

I also moved the `path` chunks in `Cargo.toml` to a single `[patch]` section so that it's one block to commment/uncomment for local development. 

Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2020-03-23 01:03:33 +00:00
bors[bot]
980f5412c4 [rs] Merge #212
212: Improve BufferCopyView documentation r=kvark a=rukai

groves suggested that the alignment/multiple requirements are not implemented yet.
So I changed the documentation to reflect that.
Ideally we would change the examples to demonstrate how to work around this requirement, but I think its best to wait until we know for certain that this IS a requirement, currently the WebGPU spec does not have this as a requirement.

Additionally it seems like every example except for the skybox example failed to follow this part of the WebGPU spec.
"Note: rowsPerImage must be zero for copies with a copySize.depth of 1, and must be greater than zero otherwise."
So I fixed those examples and documented the requirement on the field.

Co-authored-by: Rukai <rubickent@gmail.com>
2020-03-22 19:02:48 +00:00
Rukai
2a3e6e572b [rs] Improve BufferCopyView documentation 2020-03-22 23:24:43 +11:00
Aaron Loucks
60f9c07e9e [rs] Update WGPU deps to rev 08e8d406c1 2020-03-20 21:48:25 -04:00
bors[bot]
514393ad05 [rs] Merge #208
208: Remove lifetime from SwapChainOutput r=kvark a=lachlansneff

The pr removes the lifetime from `SwapChainOutput`. It's not clear to me if the lifetime is necessary for soundness reasons, so let me know if so.

Resolves #207 

Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
2020-03-20 20:25:04 +00:00
Lachlan Sneff
ac7809cdcb [rs] Note that get_next_texture will error if a previous output is still alive. 2020-03-20 14:34:17 -04:00
Lachlan Sneff
af7a4282f2 [rs] Remove lifetime from SwapChainOutput 2020-03-19 11:43:38 -04:00
bors[bot]
5fa3a74061 [rs] Merge #204
204: Return futures from request adapter/request device r=kvark a=grovesNL

Relevant to #175

Backporting some parts of #193 for async request adapter and async request device.

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-03-16 22:56:43 +00:00
Joshua Groves
1a2101e939 [rs] Return futures from request adapter/request device 2020-03-16 16:35:51 -02:30
bors[bot]
11d594750b [rs] Merge #203
203: Update winit r=kvark a=grovesNL

Use the latest version of winit (0.22)

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-03-16 14:34:26 +00:00
bors[bot]
9564ae1f4d [rs] Merge #202
202: Remove `Hash` for ID types r=kvark a=grovesNL

Reverts some of the `Hash` derives added in #200 because we don't have a good way to support `Hash` for JavaScript objects (for the web backend) at the moment. JavaScript objects don't have a unique identifier that we can use for `Hash`, so any solution here would probably mean adding our own map of JS object<->unique ID.

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-03-16 13:59:17 +00:00
Joshua Groves
2a640b9611 [rs] Fix typo in readme 2020-03-16 09:31:35 -02:30
Joshua Groves
90f8d74c99 [rs] Update winit 2020-03-16 09:26:51 -02:30
Joshua Groves
0d7d4a160f [rs] Remove Hash for ID types 2020-03-16 08:53:51 -02:30
bors[bot]
fff08d2c63 [rs] Merge #200
200: Derive `Hash` and `PartialEq` for unique identifier wrapper types r=kvark a=mitchmindtree

This is particularly useful downstream for distinguishing between
instances of these types.

I was unsure about `Device` as I noticed it has a `Temp` field that
looks like it might eventually store some non-PartialEq/Hash-friendly
fields.

Let me know if you'd like me to add a derive for `Device` or if there
are any issues with those I have updated.

Co-authored-by: mitchmindtree <mitchell.nordine@gmail.com>
2020-03-15 23:18:13 +00:00
bors[bot]
c91758dc4a [rs] Merge #201
201: Add note that `slot` refers to the index in RenderPipelineDescriptor r=kvark a=aloucks

Add note that `slot` refers to the index in `RenderPipelineDescriptor::vertex_buffers`

Also fixed intra-doc links for `set_vertex_buffer`.

Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2020-03-15 23:04:27 +00:00
Aaron Loucks
c89d7edff5 [rs] Add note that slot refers to the index in RenderPipelineDescriptor::vertex_buffers
Also fixed intra-doc links for `set_vertex_buffer`.
2020-03-15 15:38:31 -04:00
bors[bot]
fbff46dc8f [rs] Merge #197
197: Update for the latest spec changes r=grovesNL a=kvark

Blocked on https://github.com/gfx-rs/wgpu/pull/518

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-03-15 18:41:29 +00:00
mitchmindtree
ebf97c2843 [rs] Derive Hash and PartialEq for unique identifier wrapper types
This is particularly useful downstream for distinguishing between
instances of these types.

I was unsure about `Device` as I noticed it has a `Temp` field that
looks like it might eventually store some non-PartialEq/Hash-friendly
fields.

Let me know if you'd like me to add a derive for `Device` or if there
are any issues with those I have updated.
2020-03-15 18:43:16 +01:00
Dzmitry Malyshau
fa0485f03f [rs] Update for the latest spec changes 2020-03-15 11:25:06 -04:00
bors[bot]
16855f6a7c [rs] Merge #192
192: Explicitly declare vertex attribute descriptors in cube example r=kvark a=aloucks

The new `vertex_attr_array!` macro is pretty wonderful, but it's nice to have at least one reference example of how `VertexAttributeDescriptor`s are constructed. 

Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2020-03-08 23:37:25 +00:00
Aaron Loucks
738653d1fe [rs] Explicitly declare vertex attribute descriptors in cube example 2020-03-07 23:37:32 -05:00
Dzmitry Malyshau
a332377222 [rs] Add grr-2d 2020-03-06 11:38:54 -05:00
Dzmitry Malyshau
ae045edcb6 [rs] Add nannou to the friends list 2020-03-05 23:45:24 -05:00
bors[bot]
2388007d1a [rs] Merge #189
189: Reexport Backend and DeviceType from wgpu-core r=kvark a=aloucks

These types are exposed on the `AdaptorInfo` struct.

Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2020-03-05 15:02:13 +00:00
Aaron Loucks
b2e70cc3d3 [rs] Reexport Backend and DeviceType from wgpu-core
These types are exposed on the `AdaptorInfo` struct.
2020-03-04 22:22:26 -05:00
bors[bot]
3cfb78d372 [rs] Merge #185
185: Update readme r=kvark a=grovesNL

Add logo and update readme text a bit (link to WASM progress, reword examples section slightly, etc.)

[Rendered](ea4bf79ff7/README.md)

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-03-03 17:36:51 +00:00
Joshua Groves
39072c80d4 [rs] Update readme 2020-03-03 00:34:24 -03:30
bors[bot]
e09b8d58a7 [rs] Merge #184
184: added test to hello-compute example r=kvark a=emmetthebarnraiser

I wasn't exactly sure of the proper way to test async stuff, but this is a strategy that seemed to work for me. Let me know if there is anything you would like me to change, or if this isn't something that you would like to add to the examples!

Co-authored-by: Brian Frazho <befrazho@gmail.com>
2020-03-01 02:43:59 +00:00
Brian Frazho
18b2ae1935 [rs] added test to hello-compute example 2020-02-28 20:50:28 -05:00
bors[bot]
609b745153 [rs] Merge #183
183: Expose `enumerate_adapters`. r=kvark a=daxpedda

Depends on gfx-rs/wgpu#505.

Use case was to give end user the ability to choose which GPU to use for an application.

Co-authored-by: daxpedda <daxpedda@gmail.com>
2020-02-27 12:36:40 +00:00
daxpedda
f77ce1bec1 [rs] Update wgpu dependency. 2020-02-27 00:45:02 +01:00
daxpedda
d584105943 [rs] Expose enumerate_adapters. 2020-02-26 16:35:31 +01:00
Dzmitry Malyshau
132b67898f [rs] Add oxidator to the readme 2020-02-22 22:28:14 -05:00
bors[bot]
f387fbb310 [rs] Merge #181
181: Fix vertex_attr_macro self invocation paths r=kvark a=kvark

Follow-up to #179 
cc @dhardy 

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-02-20 18:11:09 +00:00
Dzmitry Malyshau
5490914f19 [rs] Fix vertex_attr_macro self invocation paths 2020-02-20 13:10:14 -05:00
bors[bot]
dabdd8ee52 [rs] Merge #179
179: Add vertex_attr_array macro r=kvark a=dhardy

Specifying `VertexAttributeDescriptor` arrays is tedious, and for no good reason. This PR adds a macro to do the job.

All examples tested. Documentation is short but better than the standard for this crate I feel. 😉



Co-authored-by: Diggory Hardy <git@dhardy.name>
2020-02-20 14:38:46 +00:00
Diggory Hardy
028be69693 [rs] Add vertex_attr_array macro 2020-02-20 09:32:38 +00:00
bors[bot]
d85f8030c2 [rs] Merge #177
177: wgpu update with DynamicOffset r=trivial a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-02-17 02:50:43 +00:00
Dzmitry Malyshau
069d7cdc98 [rs] wgpu update with DynamicOffset 2020-02-16 21:49:56 -05:00
Dzmitry Malyshau
917e29754b [rs] Add Conrod to the friends list 2020-02-12 02:50:27 +01:00