Commit Graph
82 Commits
Author SHA1 Message Date
Zicklag f7f1ff699a Implement OpenGL Backend For Unix Platforms 2020-11-04 20:32:33 -06:00
Zicklag 165d7717b4 Add Error Message When Surface Creation Fails 2020-11-02 20:24:30 -06:00
frbimo fdd561e69e remove PowerPreference::Default
Signed-off-by: frbimo <fr.bimo@gmail.com>
2020-10-12 19:17:44 +08:00
Dzmitry Malyshau 45ade807cc Only request features that are needed 2020-10-05 14:51:32 -04:00
Dzmitry Malyshau 0a67d6a7be Enable RBA feature where available 2020-10-05 10:21:39 -04:00
Adam Nemecek db1870e7fc use self 2020-09-25 19:11:46 -07:00
Connor Fitzgerald a9750f83bc Remove erroneous extra feature check 2020-09-23 18:13:54 -04:00
Manuel Woelker 336d070b26 add polygon_mode: PolyonMode to RasterizationStateDescriptor to allow drawing wireframes 2020-09-09 21:34:37 +02:00
Zicklag 7572dbeaf9 Use CFG Aliases to Replace the backends! Macro
Uses the `cfg_aliases` crate to replace the `backends!` macro and
provide a more natural way to gate backend specific code.
2020-08-29 21:55:17 -05:00
Justin Shrake 19eeee27ee Add AddressMode::ClampToBorder behind a feature 2020-08-22 13:23:50 -07:00
John Mitchell 4cb50e8395 Added image cube array. 2020-08-16 23:10:06 -04:00
Dzmitry Malyshau 44fdfb80d0 Fix support for d24unorm format 2020-08-13 17:26:44 -04:00
Gabriel Majeri 021251a908 Remove power module 2020-08-05 16:27:41 +03:00
Dzmitry Malyshau dbd7e2c579 Separate valid internal IDs from external ones 2020-08-04 11:16:59 -04:00
Connor Fitzgerald e5c647745e Implement TEXTURE_COMPRESSION_BC extension 2020-07-29 18:43:50 -04:00
Gabriel Majeri e860dd995f Handle command pool creation error 2020-07-29 09:56:42 +03:00
Connor Fitzgerald cb485f3798 Convert all logging to tracing and add fmt logger 2020-07-25 19:33:21 -04:00
Dzmitry Malyshau 21be559a9f Add depth clamping support 2020-07-22 11:03:36 -04:00
Gabriel Majeri 1b563c8e3d Safe error handling in instance module (#817)
* Safe error handling in instance module

* Revert alignment checks back to assertions
2020-07-18 18:11:04 -04:00
Connor Fitzgerald c8bcc50ed6 Implement PUSH_CONSTANTS feature 2020-07-13 12:47:09 -04:00
bors[bot]andGabriel Majeri d7ee89018b Merge #791
791: Unify `wgpu-core` and `wgpu-rs` types r=kvark a=GabrielMajeri

**Connections**
Closes #689.

**Description**
Moves a lot of types from `wgpu-rs` which were duplicated in `wgpu-core` to `wgpu-types`.

**Testing**
Checked with core, player and `wgpu-rs`.

Corresponding `wgpu-rs` PR: https://github.com/gfx-rs/wgpu-rs/pull/437

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-13 15:45:09 +00:00
Gabriel Majeri f3b80f1d8d Unify wgpu-core and wgpu-rs types 2020-07-13 18:39:49 +03:00
bors[bot]andDavid Peicho 08c873969c Merge #790
790: core: make DeviceType repr(u8) r=kvark a=DavidPeicho

**Connections**

This PR will make gfx-rs/wgpu-native#43 mergeable.

**Description**

`DeviceType` wasn't made to be used in FFI. The enum is now set to `#[repr(u8)]`.

**Testing**

It's not tested 💯 


Co-authored-by: David Peicho <david.peicho@gmail.com>
2020-07-13 13:55:35 +00:00
David Peicho 257151b9a4 core: make DeviceType repr(u8) 2020-07-13 10:45:47 +01:00
Gabriel Majeri 9cd3d47ce7 Remove non-exhaustive markers 2020-07-12 19:56:04 +03:00
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