Commit Graph
57 Commits
Author SHA1 Message Date
Connor Fitzgerald 238e6b74ee Populate limits struct 2020-07-07 16:12:03 -04: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
Oskar Nehlin 5b4b695ad3 Check parent adaptor limits instead of physical device limits (#761)
* Check parent adaptor limits instead of physical device limits

* Fix pr comment
2020-07-06 14:14:09 -04:00
bors[bot]andConnor Fitzgerald 43c67ac59c Merge #754
754: Implement MultiDrawIndirect Extensions r=kvark a=cwfitzgerald

**Connections**

Closes #742.

**Description**

These extensions, especially when combined with binding indexing, allow the creation of extremely cpu-efficient gpu powered pipelines.

Adds two extensions allowing various types of multi-draw-indirect
- MULTI_DRAW_INDIRECT (giving `multi_draw_indirect` and `multi_draw_indexed_indirect`)
- MULTI_DRAW_INDIRECT_COUNT (giving `multi_draw_indirect_count` and `multi_draw_indexed_indirect_count`)

This adds what I believe to be an extra restriction on the `*count` family of functions when compared to the underlying api. The buffer _must_ be large enough to draw `max_count` draws, even if that many draws are never drawn. This makes these operations no more unsafe than indirect would be, which is currently safe.

I did not implement these for renderbundles, but there's no reason they couldn't work, so those branches are marked with `unimplemented` as opposed to `unreachable`.

Additional Changes:
- Added some validation to the normal `draw_*_indirect` functions to prevent buffer overruns.
- The DX12 gfx-hal backend requires the strides to _always_ be non-zero, so I modified the normal indirect draws to use explicit strides.
- Made device limits and features `pub(crate)` as they need to be checked in random places in the code.

**Testing**

The change was tested using a modified version of wgpu-rs's texture-array example using a variety of permutations. I have not been able to test regular MULTI_DRAW_INDIRECT on mac, but I see no reason why that wouldn't work.

https://github.com/gfx-rs/wgpu-rs/pull/414

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-06-28 04:47:13 +00:00
Connor Fitzgerald 441b6e0d04 Implement MultiDrawIndirect Extensions 2020-06-27 23:43:23 -04:00
Andreas Reich cd87f1e80f added independent blending to the list of required features 2020-06-27 22:33:47 +02:00
Connor Fitzgerald ac62a11619 Convert Extensions + Capabilities into Features 2020-06-26 00:18:46 -04:00
Marvin Löbel 962f65ac27 Add backends! and backends_map! macros
to reduce code duplication in instance.rs
2020-06-23 00:41:01 +02:00
Connor Fitzgerald 62a870280f Refine Logging Levels 2020-06-22 02:13:04 -04:00
Connor Fitzgerald c1f0021a05 Add Chrome Backend 2020-06-20 20:55:59 -04:00
Connor Fitzgerald 1b2cf3cd22 Add Tracing and Instrument Entry Points 2020-06-20 14:26:50 -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
Connor Fitzgerald 15d0db8828 wgpu-types documentation pass 2020-06-17 20:38:44 -04:00
Connor Fitzgerald 5a7fb4c1e5 Implement Capability/Extension Split 2020-06-14 02:32:54 -04:00
Connor Fitzgerald bfcc369bc7 Implement SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING 2020-06-12 19:52:10 -04:00
Connor Fitzgerald 57b3b72571 Implement TEXTURE_BINDING_ARRAY extension 2020-06-10 22:35:25 -04:00
Connor Fitzgerald 4258c60f46 Implement mappable primary buffers extension 2020-06-08 22:33:47 -04:00
Dzmitry Malyshau 16424bfac1 Add shader validation bool to DeviceDescriptor 2020-06-06 23:34:04 -04:00
bors[bot]andDzmitry Malyshau 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
Connor Fitzgerald ade7ce10b2 Rustification of Extensions and SamplerDescriptor 2020-06-02 21:04:25 -04:00
Dzmitry Malyshau 321a5cee0f Enforce copy buffer-texture row pitch alignment 2020-06-01 16:51:42 -04:00
Connor Fitzgerald 415ce97415 Implement anisotropic filtering and extensions/limits 2020-06-01 10:43:54 -04:00
Dzmitry Malyshau 3e57c11260 Refactor create_surface a bit 2020-05-05 09:47:51 -04:00
Anton Lazarev 29ce9a44cf Pass through raw-window-handle 2020-05-04 15:55:19 -04:00
bors[bot]andDzmitry Malyshau e2100b6911 Merge #621
621: Keep Adapter alive r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-01 04:30:09 +00:00
Dzmitry Malyshau f35dd741aa Android support (#625) 2020-05-01 00:22:00 -04:00
Dzmitry Malyshau 9500cfa4f3 Keep Adapter alive by the device 2020-05-01 00:20:54 -04:00
Dzmitry Malyshau f64b2dd3bb trace: make Id serialization nicer 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 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
Dzmitry Malyshau 5035ffdfe2 Split limits and private features, add tracing module 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau 0e533547a1 Split serde feature into trace+replay 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau a3aefe2535 Rustfmt stable pass 2020-04-06 08:55:39 -04:00
Dzmitry Malyshau f07943f2d8 Use NonZeroU64 for Id 2020-04-04 19:43:16 -04:00
Dzmitry Malyshau f3eee020e6 Check surface compatibility 2020-03-30 23:31:24 -04:00
Joshua Groves f3bb6eb230 Move more types to wgpu-types 2020-03-27 23:26:17 -02:30
Dzmitry Malyshau 2e9610e8c9 Request NDC_Y_FLIP feature 2020-03-27 00:54:01 -04:00
Dzmitry Malyshau 8aeeb8e318 Port to gfx-extras and gfx-hal-0.5 2020-03-27 00:54:01 -04:00
Dzmitry Malyshau 0a30cf4b46 Recycled identity management (#533) 2020-03-24 19:18:42 -04:00
Joshua Groves 24caf76765 Rename serde feature 2020-03-10 23:19:45 -02:30
Joshua Groves 9940aef599 Move some types into shared wgpu-types crate 2020-03-10 22:36:23 -02:30
bors[bot]anddaxpedda 73374021d7 Merge #480
480: Implement `enumerate_adapters`. r=kvark a=daxpedda

This is take two of #478, it's a much smaller change with less abstraction.

-  implement `internal_enumerate_adapters`, which refactors `instance.{BACKEND}.enumerate_adapters()` out of `pick_adapter`
-  implement `enumerate_adapters`, which just returns a vector of all GPUs in the form of `AdapterId`

Co-authored-by: daxpedda <daxpedda@gmail.com>
2020-02-10 19:01:20 +00:00
daxpedda eb6eec5c95 Implement enumerate_adapters. 2020-02-10 19:54:36 +01:00
Dzmitry Malyshau ab416bcc68 All the missing Gecko fixes 2020-02-09 20:15:55 -05:00
daxpedda cd8e2a30b2 Duplicate DeviceType from gfx-hal. 2020-01-26 23:09:58 +01:00
daxpedda 8c80557dd6 Return custom AdapterInfo that contains backend. 2020-01-25 18:22:34 +01:00