Commit Graph

9013 Commits

Author SHA1 Message Date
bors[bot]
8034a17a72 Merge #672
672: Minor fixes in Gecko r=gecko a=kvark

Fixes requested in https://phabricator.services.mozilla.com/D73333

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-05-26 20:42:00 +00:00
Dzmitry Malyshau
79eb7b9c17 Minor fixes in Gecko 2020-05-26 16:41:24 -04:00
David Peicho
96bdaa2a9f storage: add attribute to pretty-print invalid resource usage 2020-05-26 18:46:10 +01:00
Paul Kernfeld
d529526e7f "Use the whole buffer" is !0, not 0 (#663)
* "Use the whole buffer" is !0, not 0

Fixes #654
Applies to BufferBinding, set_vertex_buffer, set_index_buffer

* Add BufferSize type alias

* Make BufferSize a transparent type

Add a custom serialization "buddy" type
Use BufferSize::WHOLE instead of crate::WHOLE_SIZE

* Move SerBufferSize into device::trace mod

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-26 13:25:06 -04:00
bors[bot]
605fe735b6 [rs] Merge #321
321: Update wgpu and use write_texture r=grovesNL a=kvark

Depends on https://github.com/gfx-rs/wgpu/pull/666

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-26 14:15:51 +00:00
Dzmitry Malyshau
09d8e4b64c [rs] Update wgpu and use write_texture 2020-05-26 10:10:32 -04:00
bors[bot]
f81638b4dd Merge #670
670: Switch CI to an older nightly for now, fix templates a bit r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-26 14:05:53 +00:00
Dzmitry Malyshau
65b1568305 Switch CI to an older nightly for now, fix templates a bit 2020-05-26 10:01:11 -04:00
Dzmitry Malyshau
4e1d76013c Add missing repr(C) on copy views 2020-05-26 09:35:09 -04:00
Dzmitry Malyshau
e4659b6d05 Bring back BufferCopyView 2020-05-26 00:15:09 -04:00
Dzmitry Malyshau
679dba044b Remove array layers from texture copies 2020-05-26 00:15:09 -04:00
Dzmitry Malyshau
dff37bb65d Move TextureDataLayout to wgpu-types 2020-05-26 00:15:09 -04:00
Dzmitry Malyshau
fcf1d2762d Use TextureDataLayout consistently 2020-05-26 00:15:09 -04:00
Dzmitry Malyshau
2695d64269 Share code between write_buffer and write_texture 2020-05-26 00:15:09 -04:00
Dzmitry Malyshau
a4ea5358ef Implement write_texture 2020-05-26 00:15:09 -04:00
bors[bot]
bd4804b88a [rs] Merge #320
320: Fix typo in Friends section of README r=kvark a=jakbyte



Co-authored-by: jakbyte <jakbyte@protonmail.com>
2020-05-23 15:01:49 +00:00
jakbyte
239be51348 [rs] Fix typo in Friends section of README 2020-05-22 17:24:39 -04:00
Dzmitry Malyshau
70154373f8 Fix indirect buffer access flags 2020-05-22 16:25:09 -04:00
Paul Kernfeld
b108a50089 Check constant types (#54)
* Check constant types

A baby step towards #43

* Move tp src/proc/typifier, remove unneeded return

* Don't do pub(crate)

* Don't use crate::proc::UnexpectedConstantTypeError

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-22 12:30:30 -04:00
Paul Kernfeld
2a3fc6dc54 Replace panics with errors in Metal backend
Fixes #31
2020-05-20 11:18:18 -04:00
Paul Kernfeld
e2bd93aa21 Replace write! with TypedGlobalVariable::try_fmt
A step towards #31
2020-05-19 12:48:32 -04:00
bors[bot]
d8e2f384f3 [rs] Merge #315
315: Update wgpu-core rev r=urgent a=kvark

Fixes #314 

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-18 16:11:53 +00:00
Dzmitry Malyshau
0b124826a4 [rs] Update wgpu-core rev 2020-05-18 12:11:02 -04:00
bors[bot]
a203333c3e Merge #660
660: Fix possible out-of-bounds when trace log level enabled r=kvark a=yanchith

Also, even when there was no out-of-bounds access, the log statement talked
about an incorrect submission index.

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

Co-authored-by: yanchith <yanchi.toth@gmail.com>
2020-05-18 16:02:36 +00:00
yanchith
58a60392c2 Fix possible out-of-bounds when trace log level enabled
Also, even when there was no out-of-bounds access, the log statement talked
about an incorrect submission index.
2020-05-17 12:17:36 +02:00
bors[bot]
9691649fc5 [rs] Merge #311
311: Read WGPU_TRACE environment in the examples r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-05-15 21:50:15 +00:00
Dzmitry Malyshau
07fb340ec4 [rs] Read WGPU_TRACE environment in the examples 2020-05-15 17:49:16 -04:00
bors[bot]
000bf85a20 Merge #657
657: Vecmap and Readme update r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-05-15 14:43:51 +00:00
Dzmitry Malyshau
7ce83ad1cd Small readme refactor 2020-05-15 10:41:28 -04:00
Dzmitry Malyshau
8b9ddbfbca Vecmap dependency update to 0.8.1 2020-05-15 10:41:20 -04:00
Dzmitry Malyshau
cfd17fdcbd [rs] Disable GHA deploy temporarily 2020-05-14 10:12:47 -04:00
Dzmitry Malyshau
c548050b47 [rs] Update wgpu and use write_buffer in the examples 2020-05-14 10:12:47 -04:00
bors[bot]
2484d00321 Merge #655
655: use unambigous ISO8601 format for dates r=kvark a=skierpage

06-04-2020 is in the future (June) for ~400 million people.
Oblig. XKCD https://xkcd.com/1179/ 😉

Co-authored-by: skierpage <info@skierpage.com>
2020-05-13 13:56:46 +00:00
bors[bot]
a7200bb865 Merge #653
653: Implement Queue::write_buffer r=nobody a=kvark

Implements https://github.com/gpuweb/gpuweb/pull/749
TODO:
- [x] handle a case where the buffer is dropped while there is a pending write. Edit: we bump the submission index on the buffer, so it will be kept alive.
- [x] properly free the temporary buffer and memory
- [x] properly destroy the pending command buffer on device drop
- [x] tweak the linear allocator settings - bumped to 16 megs
- [x] provide a patch to wgpu-rs and verify it works on the examples - https://github.com/gfx-rs/wgpu-rs/pull/307
- [x] provide a patch to wgpu-native - https://github.com/gfx-rs/wgpu-native/pull/25
- [x] check/fix the trace/replay support

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-13 13:29:09 +00:00
skierpage
67142eb944 use unambigous ISO8601 format for dates
06-04-2020 is in the future for ~400 million people.
Oblig. XKCD https://xkcd.com/1179/ 😉
2020-05-12 16:06:19 -07:00
bors[bot]
fe904b0706 [rs] Merge #306
306: Improve example friendliness: Don't busy-redraw in examples r=kvark a=khoek

Looking around for solid Rust graphics libraries, I was a bit shocked when the `wgpu-rs` examples made my whole X desktop environment in Ubuntu laggy---maximizing/minimizing other windows or moving any of them had very noticeable latency when an example was running.

This almost turned me off, but after playing around I found that this was just because of the
```rust
match event {
            event::Event::MainEventsCleared => window.request_redraw(),
            ...
```
in all of the examples. Trying to add the least code possible I've replaced a `ControlFlow::Poll` with `ControlFlow::WaitUntil(...)` in the event loops and capped the redraws-per-second below 50, which completely solves this problem for me (plus the window resize response on the examples themselves are much improved, etc.).

I was just going for an unintrusive fix---this is by no means a perfect solution, but I think in the worst case it won't be any worse that what was there originally. Plus, I think it will make people like me who try to start by copying an example more likely to stick around in the short term.

Co-authored-by: Keeley Hoek <keeley@hoek.io>
2020-05-11 21:35:47 +00:00
Dzmitry Malyshau
4c62b20282 Multiple fixes and clean ups.
- Clean up after the pending writes on destroy.
- Fix temporary buffer creation.
- Fix internal thread initialization by the command allocator.
- Clean up player event_loop usage.
2020-05-11 14:07:02 -04:00
Keeley Hoek
469b416632 [rs] Don't busy-redraw in examples 2020-05-12 03:20:19 +10:00
Dzmitry Malyshau
786ead9701 Destroy temporary buffers 2020-05-11 10:53:21 -04:00
Dzmitry Malyshau
35f2e8b70e Move queue logic into a submodule 2020-05-10 22:40:04 -04:00
bors[bot]
1de6a6c084 [rs] Merge #302
302: Add BufferRange struct for #199 r=kvark a=paulkernfeld

- Use in set_index_buffer
- Use in set_vertex_buffer
- Use in BindingResource

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-10 21:50:06 +00:00
Paul Kernfeld
445786d474 [rs] Add Buffer.slice fn for #199
This fn is used for set_index_buffer, set_vertex_buffer, and
BindingResource
2020-05-10 17:37:19 -04:00
Dzmitry Malyshau
ba8c2eae54 Implement Queue::write_buffer 2020-05-10 01:21:47 -04:00
bors[bot]
da4f9006a8 Merge #641
641: Add optional SPIR-V shader validation r=kvark a=GabrielMajeri

This PR adds some basic validation for SPIR-V shaders when creating pipelines. Starts work towards #269.

Currently, I'm marking this as a draft because `naga` isn't mature enough to be able to parse shaders from the `wgpu-rs` examples.

For example:
- Trying to run `hello-triangle` from `wgpu-rs` results in the following error:
`Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, Variable)`
- For `hello-compute` it is:
`Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)`

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-05-09 22:07:30 +00:00
Gabriel Majeri
f70f32af87 Add optional SPIR-V shader validation
# Conflicts:
#	Cargo.lock
2020-05-09 19:55:10 +03:00
bors[bot]
c985df9fc8 [rs] Merge #272
272: Force the wasm32 types to match Send / Sync with the native types r=kvark a=kyren

This is potentially a controversial change so this is just a draft to discuss it.

Currently, when building wgpu on wasm32, none of the interface types are Send or Sync, whereas on any other platform they are generally Send and Sync and this can cause a lot of pain, especially in the presence of async.

This PR is the nuclear option: lie and forcibly declare nearly all interface types to be Send or Send + Sync.

I think I understand the situation with proposed wasm32 threading a bit better now, and as of right now at least with my current understanding, it seems to me unlikely that javascript values held by rust could *ever* be sent transparently to another worker.  The mechanism that rust apparently will use to implement transparent threading will be to use `SharedArrayBuffer` to share memory between multiple workers.  Javascript provides a way for certain (serializable) objects to be shared with with other workers through `worker.postMessage()`, so Javascript has *some* story for sending javascript values to other threads, but only plain rust values that exist solely in the `SharedArrayBuffer` memory are send-able under this scheme.  I've looked briefly through some of the wasm proposals like the interface types proposal, but I don't have a good sense if there's any proposed mechanism at all for interface types and threads to interact at all.

If that's true that's really unfortunate because it seems like any thread safe API shared by native and web is doomed to mismatch.  This is even more unfortunate because many of the webgpu types in the draft standard are marked as 'Serializable', meaning that they *are* actually safe to send to another worker via `postMessage`, but there does not appear to be a planned way for rust to do this transparently.

I definitely could be misunderstanding the situation though and even if I am understanding it, the situation may have since changed.  I also don't know the timing here, I don't know what the eventual timing of wasm32 threading support will be vs webgpu support and interface types support.  *Right now* this PR is almost certainly sound, but there's definitely a possible future where it becomes unsound, and even maybe a possible future where it becomes unsound but then could later be made sound again.

Co-authored-by: kyren <kerriganw@gmail.com>
2020-05-07 04:09:14 +00:00
kyren
a3e6e1024f [rs] Force the wasm32 types to match Send / Sync with the native types
There are several things in this commit:

1) Add `Send` or `Send + Sync` bounds to most of the associated types in `Context`.
2) Force most of the handle types and future types returned by the web backend to be Send / Sync
3) Make `BufferReadMapping` and `BufferWriteMapping` `Send` again on native by
   making the associated detail types implement `Send`.
2020-05-06 23:02:27 -04:00
bors[bot]
54c6f6751b Merge #645
645: Add a loom test for RefCount r=kvark a=paulkernfeld

A first effort at gfx-rs/wgpu-rs#96
loom testing is gated behind cfg(loom)

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-06 18:10:43 +00:00
Paul Kernfeld
29a4cee002 Add a loom test for RefCount 2020-05-06 13:53:57 -04:00
bors[bot]
0df263fe3e Merge #649
649: Proper maintenance of the command pools r=cart a=kvark

Fixes #648
This brings the memory consumption on the multi-threaded cube to constant 50Mb.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-06 17:44:52 +00:00