Commit Graph

199 Commits

Author SHA1 Message Date
Dzmitry Malyshau
91a66b4b4a Fix player warnings 2020-12-05 18:55:27 -05:00
Dzmitry Malyshau
749f737c89 Add pervasive Naga support to shader module loading
The purpose of the PR is to support Naga modules everywhere.
As a requirement, it updates the gfx-rs version used.
Most of the logic is dedicated towards building a shader interface,
where previously we just used naga's IR. Now we have our own mini-IR.
2020-12-05 11:31:03 -05:00
kejor
4513fb2b83 Match upstream API changes for IndexFormat 2020-12-01 19:19:41 -05:00
Dzmitry Malyshau
9e2f6c2f01 Move to gfx master 2020-11-30 22:50:13 -05:00
Dzmitry Malyshau
5949dec61d Update bind group layout API to match upstream 2020-11-28 00:30:27 -05:00
Dzmitry Malyshau
55851add9b player: use the wgpu-cores's gfx-select macro 2020-11-26 14:47:48 -05:00
Dzmitry Malyshau
c6bc37dbde [error] render bundles 2020-11-23 12:00:47 -05:00
Dzmitry Malyshau
6307294e2b [error] pipeline creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
ad824de268 [error] bind groups and layouts creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
fccbca28bd [error] shader module creation, separate descriptor 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
e96e5f917c [error] sampler creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
8287464855 [error] texture view creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
bedd037517 [error] buffer creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
eb4f633e39 [error] texture creation 2020-11-23 11:57:32 -05:00
Dzmitry Malyshau
6714c4fe7e
Update players readme 2020-11-05 16:58:40 -05:00
frbimo
fdd561e69e remove PowerPreference::Default
Signed-off-by: frbimo <fr.bimo@gmail.com>
2020-10-12 19:17:44 +08:00
bors[bot]
f963193be1
Merge #966
966: Immediate resource destruction and freeing r=cwfitzgerald a=kvark

**Connections**
Fixes #964

**Description**
We are making it so a buffer or a texture can have their native resources freed while they are still referenced, so without waiting for GC.

In addition, the PR adds a few missing cases where error IDs should have been handled, like at render pass encoding.

**Testing**
Tested on wgpu-rs examples, see https://github.com/gfx-rs/wgpu-rs/pull/591

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-10-11 17:10:42 +00:00
Dzmitry Malyshau
c87a94f976 Early texture destruction 2020-10-08 23:21:11 -04:00
Dzmitry Malyshau
c4c8e3b224 Early buffer destruction logic 2020-10-08 22:28:52 -04:00
Noah Charlton
5ff6b11daf CI playtests for Dx12, Vulkan 2020-10-08 17:17:16 -04:00
Dzmitry Malyshau
0a7d81351c Handle cases where buffer contents are destroyed 2020-10-08 12:57:17 -04:00
Dzmitry Malyshau
eed8bf84ef Playtest for binding a group 2020-09-04 23:47:24 -04:00
Noah Charlton
d05d1aeec1 Add Quad play test 2020-09-01 16:07:24 -04:00
Dzmitry Malyshau
901b043b19 Version bump to 0.6 and changelog update 2020-08-17 16:51:22 -04:00
Connor Fitzgerald
350637df40 Factor wgpu-subscriber into its own repo 2020-08-17 16:36:22 -04:00
Dzmitry Malyshau
d1da6d8106 Switch gfx-hal to 0.6 2020-08-17 10:34:50 -04:00
Dzmitry Malyshau
d8341c5996 Add labels to pipelines 2020-08-13 12:14:24 -04:00
Dzmitry Malyshau
d07d8503a0 Move the subscriber into a different crate 2020-08-12 15:00:15 -04:00
Dzmitry Malyshau
9d8dc0b04d Grand cleanup and refactor of the descriptors in the API 2020-08-12 14:13:32 -04:00
Dzmitry Malyshau
173c7c3dbf Create implicit layouts for render pipelines 2020-08-09 14:43:44 -04:00
Dzmitry Malyshau
a9b8a99e19 Create implicit layouts for compute pipelines 2020-08-09 08:33:33 -04:00
Dzmitry Malyshau
dbd7e2c579 Separate valid internal IDs from external ones 2020-08-04 11:16:59 -04:00
Gabriel Majeri
e860dd995f Handle command pool creation error 2020-07-29 09:56:42 +03:00
Dzmitry Malyshau
bf862b7907 Clarity renames according to the Gecko review 2020-07-28 16:58:28 -04:00
Gabriel Majeri
8316e9e678 Safe error handling for queue module 2020-07-26 17:49:53 +03:00
Connor Fitzgerald
cb485f3798 Convert all logging to tracing and add fmt logger 2020-07-25 19:33:21 -04:00
bors[bot]
6182495102
Merge #838
838: wait for buffer to be done in the player r=cwfitzgerald a=kvark

**Connections**
Fixes our code enough to replay #834 without issues. Doesn't help to solve the original problem though.

**Description**
There are two things in here:
  1. don't deduplicate the BGLs if we are not generating new IDs at this layer. This helps Servo/Gecko/player. cc @kunalmohan 
  2. have an option in `buffer_destroy` to *actually* kill it, at the cost of blocking on GPU sometimes. This is required for the player, since the very next command may try to reuse the ID.

**Testing**
Tested on the trace in #834 

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-07-24 22:57:04 +00:00
Gabriel Majeri
7cf9970121 Error handling for device functions 2020-07-24 22:56:51 +03:00
Dzmitry Malyshau
7e4ce4a4fe wait for buffer to be done in the player 2020-07-24 14:34:18 -04:00
Dzmitry Malyshau
82d149b871 Naga update, remove spirv_headers dependency 2020-07-22 11:05:42 -04:00
Marvin Löbel
4ed2c0a313
Replace borrowed slices in Descriptor structs with copy on write slices (#822)
* Replace &[T] in descriptor structs with Cow<[T]>

* Changed label fields to use Cow<'a, str>

* Deduplicate types across the tracing API

Introduce the ToStatic trait

* Deduplicate trace::RenderBundleDescriptor

* Remove ugly ToOwned bounds

* Simplifiy Action variants

* Make Clone bounds on type defs less verbose

* Fix a error in play.rs

* Remove ToStatic, and Make Action<'a> borrow descriptors instead
2020-07-20 12:31:05 -04:00
Gabriel Majeri
ec12d9547d Error types for buffer mapping API 2020-07-20 07:22:52 +03:00
Gabriel Majeri
e53aa70b9a Error type for texture creation 2020-07-19 20:42:31 +03:00
bors[bot]
d73683e35e
Merge #813
813: Add buffer creation error type r=kvark a=GabrielMajeri

**Connections**
Part of #638 

**Description**
Adds an error type for the buffer creation functions.

**Testing**
Checked with core and ran test on player.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-19 17:19:01 +00:00
bors[bot]
8cfe8bb56d
Merge #812
812: Error type for `WaitIdle` r=kvark a=GabrielMajeri

**Connections**
Part of #638 

**Description**
Adds an error type for the `wait_idle` function.

**Testing**
Checked with core.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-18 22:12:37 +00:00
Gabriel Majeri
fc460f4eab Propagate WaitIdleError up through the API 2020-07-18 20:39:11 +03:00
Gabriel Majeri
2ac778b312 Add buffer creation error type 2020-07-18 11:12:15 +03:00
Gabriel Majeri
04b0b4d3a5 Error type for command_encoder_finish 2020-07-18 10:46:47 +03:00
Gabriel Majeri
314074d13c Safe error handling for swap chain 2020-07-17 21:11:28 +03:00
Dzmitry Malyshau
eb7bdcd012 playtest: move the actions together with expectations 2020-07-17 10:59:02 -04:00
Dzmitry Malyshau
acef9206a6 Player-based GPU test framework 2020-07-17 00:08:43 -04:00
Dzmitry Malyshau
76e136e375 add the preferred format query 2020-07-16 11:27:05 -04:00
Gabriel Majeri
1b03fbe9be Safe error handling for commands API 2020-07-14 11:40:54 +03:00
Connor Fitzgerald
c8bcc50ed6 Implement PUSH_CONSTANTS feature 2020-07-13 12:47:09 -04:00
Gabriel Majeri
f3b80f1d8d Unify wgpu-core and wgpu-rs types 2020-07-13 18:39:49 +03:00
bors[bot]
7d5082753b
Merge #773
773: Error handling for data transfer API r=kvark a=GabrielMajeri

**Connections**
Work on the error model described in #376 

**Description**
Removes assertions from the transfer functions, instead returning a custom error type.

**Testing**
Checked with `player` and `wgpu-rs`: https://github.com/gfx-rs/wgpu-rs/pull/430

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-11 02:28:25 +00:00
Gabriel Majeri
98e4f73a10 Error handling for data transfer API 2020-07-10 21:50:22 +03:00
Dzmitry Malyshau
e693170aef Rename bindings to entries 2020-07-08 23:41:09 -04:00
bors[bot]
cfd21d4913
Merge #763
763: Remove raw pointers from the render pipelines API r=kvark a=GabrielMajeri

**Connections**
Rust-ification of API, as part of #689

**Description**
The objective is to get rid of raw pointers in the render pipeline descriptor and associated structures.

**Testing**
Checked with `player` and the `trace` feature, and with `wgpu-rs` with the changes in https://github.com/gfx-rs/wgpu-rs/pull/425

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-07 17:29:37 +00:00
Gabriel Majeri
d4eeea8118 Remove pointers from pipelines API 2020-07-07 19:37:04 +03:00
Dzmitry Malyshau
46230720b5 Remove UnsafeFeatures as we decided the top level guard is not useful 2020-07-06 23:46:46 -04:00
Oskar Nehlin
8a51f4bc7f
Return result instead of panicking when requesting device. (#762)
* Return Result instead of panic for recoverable errors

* Update LimitsExceeded error variant

* Update LimitsExceeded error message
2020-07-06 16:45:11 -04:00
Connor Fitzgerald
ac62a11619 Convert Extensions + Capabilities into Features 2020-06-26 00:18:46 -04:00
Connor Fitzgerald
62a870280f Refine Logging Levels 2020-06-22 02:13:04 -04:00
Connor Fitzgerald
1b2cf3cd22 Add Tracing and Instrument Entry Points 2020-06-20 14:26:50 -04:00
bors[bot]
c7be94047d
Merge #739
739: Remove Peek-Poke r=cwfitzgerald a=kvark

**Connections**
Related to https://github.com/gfx-rs/wgpu/issues/738
Related to https://github.com/djg/peek-poke/issues/10

**Description**
As of #726 , the buffers have a minimum binding size that has to include the shader struct size. It, therefore, can't be zero.
We can remove the hacks we had previously and switch fully to the idiomatic `Option<NonZeroU64>`.

Peek-poke doesn't `NonZeroU64` and friends, so this made me reconsider the user of it entirely. Today, render bundles as well as the Player already represent command streams using a much rustier method. I tried to move everything to this method now, and I think this is going to work much better, and safer.

**Testing**
wgpu-rs works - https://github.com/gfx-rs/wgpu-rs/pull/396

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-06-20 17:52:29 +00:00
Gabriel Majeri
69b41dc0d3 Validate sampler type in create_bind_group 2020-06-20 17:29:58 +03:00
Dzmitry Malyshau
365f4e8786 Remove peek-poke.
There was a lot of highly unsafe use of serialization based on peek-poke that we
weren't entirely happy with. It's replaced by just serializing the passes now.
Also, switch BufferSize to Option<NonZero>.
2020-06-20 00:39:11 -04:00
Marvin Löbel
e88e3517d6 Move backend selection to Instance::new()
Keep `inputs` parameter in `pick_adapter()`
2020-06-18 22:04:16 +02:00
Dzmitry Malyshau
35a1dc3076 Basic support for WGSL 2020-06-17 13:29:43 -04:00
Dzmitry Malyshau
a27341bd6d Basic support for minBufferBindingSize 2020-06-16 00:34:58 -04:00
Dzmitry Malyshau
58de765961 Always use DepthStencilReadOnlyOptimal for sampled depth 2020-06-15 17:45:19 -04:00
Dzmitry Malyshau
c038c206e7 Add RODS texture binding property 2020-06-12 21:26:19 -04:00
Dzmitry Malyshau
7aa5753701 Re-architecture the bundles using normalized command streams.
This is a major change in how the bundles are implemented. Instead of
transparently injecting them into the pass command stream, we are now
treating bundles as first-class API objects and API tracing them
accordingly. The bundle contains a normalized command stream that is
very easy to inject into a native command buffer multiple times.
2020-06-11 15:34:45 -04:00
Connor Fitzgerald
57b3b72571 Implement TEXTURE_BINDING_ARRAY extension 2020-06-10 22:35:25 -04:00
Dzmitry Malyshau
cdbf23813a Return errors on create_render_pipeline 2020-06-08 01:04:26 -04:00
bors[bot]
417ea69b45
Merge #704
704: Pipeline layout validation r=cwfitzgerald a=kvark

**Connections**
Implements a solid part of #269
Starts converting the function to return results, related to #638
cc @GabrielMajeri 

**Description**
This change matches shader bindings against the pipeline layout. It's *mostly* complete, minus some bugs and not handling the `storage_texture_format` properly.

The risk here is that Naga reflection may have bugs, or our validation may have bugs, and we don't want to break the user content while this is in flux. So the PR introduces an internal `WGPU_SHADER_VALIDATION` environment variable. Switching it to "0" skips Naga shader parsing completely and allows the users to unsafely use the API.

Another aspect of the PR is that some of the functions now return `Result`. The way I see us proceeding is that any errors that we don't expect users to handle should result in panics when `wgpu` is used natively (i.e. not from a browser). These panics would happen in the "direct" backend of wgpu-rs (as well as in wgpu-native), but the `Result` would not be exposed to wgpu-rs, so that it matches the Web behavior.

At the same time, browser implementations (Gecko and Servo) will check the result on their GPU process and implement the WebGPU error model accordingly. This means `wgpu-core` can be super Rusty and safe.

**Testing**
Running on wgpu-rs examples. Most of them fail to get parsed by Naga, but `boids` succeeds and passes validation 🎉 

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-06-06 22:01:49 +00:00
Connor Fitzgerald
f32cb103b8 Implement extensions interface as described in #691 2020-06-06 02:00:41 -04:00
Dzmitry Malyshau
15cdc794fa Shader binding validation 2020-06-05 12:48:34 -04:00
Dzmitry Malyshau
534d7ac504 Validate pipeline layout creation 2020-06-05 12:48:34 -04:00
Dzmitry Malyshau
f158709dd0 Validate bind group layouts 2020-06-05 12:48:34 -04:00
Dzmitry Malyshau
e648516ff9 player: enable x11 on Unix/Vulkan 2020-06-01 16:54:40 -04:00
bors[bot]
6650b94ff6
Merge #668
668: Return failures to the user in swap_chain_get_next_texture, rather than transparently reconfiguring. r=kvark a=AlphaModder

TODO:
- [x] Change `Global::swap_chain_get_next_texture` in `wgpu-core`.
- [x] Update `wgpu_swap_chain_get_next_texture` in `wgpu-native`. (https://github.com/gfx-rs/wgpu-native/pull/32)
- [x] Wrap `SwapChainOutput`/`SwapChainStatus` in a nice enum in `wgpu-rs`. (https://github.com/gfx-rs/wgpu-rs/pull/323)
- [ ] Update `wgpu_bindings` (?)

Co-authored-by: AlphaModder <quasiflux@gmail.com>
2020-05-26 21:26:15 +00:00
AlphaModder
e89c3d6b1c Alter swap_chain_get_next_texture to bubble up failures to the user. 2020-05-26 14:15:22 -07:00
Dzmitry Malyshau
79eb7b9c17 Minor fixes in Gecko 2020-05-26 16:41:24 -04:00
Dzmitry Malyshau
e4659b6d05 Bring back BufferCopyView 2020-05-26 00:15:09 -04:00
Dzmitry Malyshau
fcf1d2762d Use TextureDataLayout consistently 2020-05-26 00:15:09 -04:00
Dzmitry Malyshau
a4ea5358ef Implement write_texture 2020-05-26 00:15:09 -04: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
Dzmitry Malyshau
786ead9701 Destroy temporary buffers 2020-05-11 10:53:21 -04:00
Anton Lazarev
29ce9a44cf
Pass through raw-window-handle 2020-05-04 15:55:19 -04:00
Dzmitry Malyshau
2d09b1d08d Fix player validation errors on exit 2020-05-01 23:33:16 -04:00
Dzmitry Malyshau
5bbe6ec38c
Integrate with RenderDoc on winit-less captures (#627) 2020-05-01 15:34:32 -04:00
Dzmitry Malyshau
f64b2dd3bb trace: make Id serialization nicer 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau
3c68fb17e4 player: full winit integration 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau
77a5eda796 trace: fix reusing object ids 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau
854c1be035 trace: support pipelines, refactor destruction sequence 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau
018417f174 trace: replaying all the commands 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau
47f37ad78e trace: player skeleton 2020-04-30 09:55:52 -04:00