Commit Graph
8323 Commits
Author SHA1 Message Date
Andreas Reich 4207e57c02 validation against adapter specific format features
TextureFormatFeatures is now a struct of two u32 flags. Query happens only at texture creation time
2020-12-30 10:38:55 +01:00
Andreas Reich 0ccad9a466 wip adapter specific format features & rw storage 2020-12-29 17:14:22 +01:00
bors[bot]and0x182d4454fb211940 ee3ca89105 [rs] Merge #690
690: Add `RenderEncoder` r=kvark a=0x182d4454fb211940

It seems like `RenderPass` and `RenderBundleEncoder` share many methods in common (`set_pipeline`, `draw_indexed`, etc). By creating a shared trait, it allows more reusable code. For instance:

```rust
impl RedCircle {
    fn new(...) -> Self { .. }
    fn draw<'a>(&'a self, encoder: &mut impl RenderEncoder<'a>) { .. }
}
```

This code would then work for both structs.

Moving the previous methods from their `impl`s to the trait's would break previous code, as to use these methods code would now have to import `RenderEncoder`. To avoid this, it is implemented by calling the direct methods.

It may be worth considering moving this to `wgpu::util`.

Co-authored-by: 0x182d4454fb211940 <nathanwoodformal@gmail.com>
2020-12-28 01:19:59 +00:00
bors[bot]andConnor Fitzgerald a90d2fcf8a Merge #1101
1101: Bump gfx-hal and gpu-alloc r=kvark a=cwfitzgerald

**Connections**

Absorbs https://github.com/zakarumych/gpu-alloc/pull/31 and https://github.com/gfx-rs/gfx/pull/3548#issuecomment-749158016

**Description**

This fixes the last of the DX11 issues listed in #1059.

**Testing**

Various examples ran.


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-12-27 06:11:06 +00:00
Connor Fitzgerald 79973aaaff Bump gfx-hal and gpu-alloc 2020-12-27 01:10:24 -05:00
0x182d4454fb211940 cbbf25c6f8 [rs] Add set_push_constants to RenderEncoder 2020-12-25 14:01:04 +00:00
0x182d4454fb211940 a2ff43f989 [rs] Remove unneeded cast from encoder.rs 2020-12-25 13:50:36 +00:00
0x182d4454fb211940 8dc1c0896b [rs] Move RenderEncoder to util 2020-12-25 13:47:38 +00:00
0x182d4454fb211940 6ee00ab401 [rs] Add RenderEncoder 2020-12-24 17:37:06 +00:00
Pelle Johnsen 6c8cdea936 [glsl-in] Check number of function args 2020-12-23 14:54:53 -05:00
Pelle Johnsen 7d9054f2c1 [glsl-in] Implement more MathFunctions 2020-12-23 14:54:53 -05:00
Pelle Johnsen 9a51d82c39 [glsl-in] Implement ceil
Related to #330
2020-12-23 14:54:53 -05:00
Pelle Johnsen 511000d022 [glsl-in] Extract function logic out of parser 2020-12-23 14:54:53 -05:00
bors[bot]andDzmitry Malyshau aded405479 Merge #1106
1106: Encode render passes while command buffer is only read-locked r=cwfitzgerald a=kvark

**Connections**
Could fix #1104 to some extent

**Description**
The heaviest part of the render pass encoding doesn't need a write lock. Only in the end we need it.

**Testing**
Untested.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-12-23 16:21:03 +00:00
Dzmitry Malyshau ab10d36ac0 Rename get_encoder to get_encoder_mut 2020-12-23 11:20:08 -05:00
bors[bot]andJoshua Groves 4add83a8c5 Merge #1107
1107: Use `repr(transparent)` for shader flags r=cwfitzgerald a=grovesNL

**Connections**
None

**Description**
This allows cbindgen to generate bindings for shader flags in wgpu-native.

**Testing**
After `WGPUShaderFlags` is exposed in wgpu-native, bindings for `WGPUShaderFlags` will be generated in wgpu.h

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-12-23 11:33:39 +00:00
Joshua Groves 45b5ddcb83 Use repr(transparent) for shader flags
This allows cbindgen to generate bindings for shader flags in
wgpu-native
2020-12-23 06:43:15 -03:30
Dzmitry Malyshau a7587b41e6 Move the render pass setup logic into a separate method/struct 2020-12-22 22:30:27 -05:00
Dzmitry Malyshau 35b163ebc8 Encode render passes while command buffer is only read-locked 2020-12-22 13:48:18 -05:00
Capucho 3f7ee8cd6e Generate locations with fixed naming scheme for linking 2020-12-22 13:02:22 -05:00
bors[bot]andVincent Jousse f1604cdc57 [rs] Merge #684
684: First step for WebGL support. r=grovesNL a=VincentFTS

This permits to test WebGL backend in Wgpu-rs.
Next step is to test examples to make them work with WebGL backend !

Co-authored-by: Vincent Jousse <contact@ftsoftware.fr>
2020-12-22 17:48:23 +00:00
Vincent Jousse 9f3a050fc4 [rs] First step for WebGL support. 2020-12-22 18:41:07 +01:00
bors[bot]andConnor Fitzgerald 2287ae3f8a Merge #1103
1103: Fix Assorted Low-Hanging Validation and Error Message Issues r=kvark a=cwfitzgerald

**Connections**

Closes #1085
Closes #393
Closes #1053

**Description**

These commits are independent and should be reviewed individually. Combined into a single PR to reduce noise.

Overview of what was done:
- Add validation for empty texture and buffer usage flags. (#393)
- Add allowed texture usage flags to `format.describe()` (#1085)
  Validate new textures follow the allowed usage flags.
- Properly validates vertex and buffers are bound. (#1053)
  Improves error messages when no vertex buffer is bound. (Before it said the limit was 0, now it says something is unbound)
- Improve the vertex buffer overrun messages by keeping track of which slot has the smallest index.

**Testing**

Tested on examples by artificially creating the situation I am trying to validate, as well as running clean examples to make sure they pass validation.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-12-22 04:29:38 +00:00
Connor Fitzgerald 1da153f3bd Improve vertex state error messages 2020-12-21 23:13:34 -05:00
Connor Fitzgerald 94579d8125 Properly validate vertex buffer state 2020-12-21 23:10:53 -05:00
Connor Fitzgerald 43814d258f Add format usage descriptions and validate on it. 2020-12-21 23:08:31 -05:00
bors[bot]andConnor Fitzgerald 7e3965bb5a Merge #1100
1100: Validate swapchain extent as non-zero r=kvark a=cwfitzgerald

**Connections**

Fixes #1026. 

**Description**

Zero area swapchains are UB under vulkan, and should be verboten.

**Testing**

Not tested


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-12-22 03:31:36 +00:00
bors[bot]andConnor Fitzgerald 46d9c19390 [rs] Merge #688
688: Use only 1 and 4 samples for msaa-line example r=kvark a=cwfitzgerald

As 1 and 4 samples are the only universally supported values, switch the msaa-line example to only using them. In the future where users can determine the supported sample counts. See https://github.com/gfx-rs/wgpu/issues/804

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-12-22 03:29:30 +00:00
Connor Fitzgerald 6c6ce2f28c Validate on empty usages 2020-12-21 17:27:17 -05:00
Connor Fitzgerald 5fac4835f6 [rs] Use only 1 and 4 samples for msaa-line example 2020-12-21 15:34:19 -05:00
Connor Fitzgerald 073c0b2f3e Validate swapchain extent as non-zero 2020-12-21 14:56:06 -05:00
Dzmitry Malyshau 001336b457 Tidy up constants IR 2020-12-20 17:42:00 +01:00
Dzmitry Malyshau 1e70432691 [validator] refactor type checks into a function 2020-12-20 17:42:00 +01:00
bors[bot]andImbris b3422257ef Merge #1099
1099: Pass DEPTH_CLAMPING feature request to gfx-hal r=cwfitzgerald a=Imberflur

**Connections**
Fixes #1087 

**Description**
The request for the depth clamping feature was not being passed down to `gfx-hal`. This led to a warning from the vulkan backend when attempting to use this feature.

**Testing**
ran `wgpu-rs` shadow example and the warning no longer appears
<!--
Non-trivial functional changes would need to be tested through:
  - [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
  - [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.

Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See https://github.com/gfx-rs/wgpu/pull/666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->


Co-authored-by: Imbris <imbrisf@gmail.com>
2020-12-19 22:41:21 +00:00
Imbris e775987233 Pass DEPTH_CLAMPING feature request to gfx-hal 2020-12-19 16:14:51 -05:00
Dzmitry Malyshau 300aa61de0 [spv] improves division and modulo operators 2020-12-19 15:41:45 +01:00
bors[bot]andDzmitry Malyshau 860265e5e9 [rs] Merge #682
682: Expose adapter.get_info() everywhere r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-12-19 04:51:29 +00:00
Dzmitry Malyshau 7a8c6cefe1 [rs] Expose adapter.get_info() everywhere 2020-12-18 21:18:07 -05:00
bors[bot]andDzmitry Malyshau 4ebe1f50b0 Merge #1098
1098: Move AdapterInfo into wgt r=grovesNL a=kvark

**Connections**
Fixes #1095

**Description**
This is just nicer code, and we'll be able to make `get_info` available on Web targets.

**Testing**
Untested


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-12-18 21:52:38 +00:00
Dzmitry Malyshau b95a66da5e Move AdapterInfo into wgt 2020-12-18 16:43:19 -05:00
bors[bot]andVincent Jousse 60086bb1d6 Merge #1096
1096: Fix build for wasm32 target r=kvark a=VincentFTS

**Connections**
#115 

**Description**
Fix Wgpu build for Wasm target

**Testing**
It’s just a first step toward wasm support in Wgpu-rs, a PR in Wgpu-rs will come later.


Co-authored-by: Vincent Jousse <contact@ftsoftware.fr>
2020-12-18 21:12:00 +00:00
Dzmitry Malyshau c0dfb247b6 Sizing processor 2020-12-18 16:11:12 -05:00
Dzmitry Malyshau b95346877a Remove MemberOrigin in favor of spans 2020-12-18 16:11:12 -05:00
Dzmitry Malyshau fca72fd333 [wgsl] avoid recursion in token parsing 2020-12-18 16:11:12 -05:00
Vincent Jousse 0899bb7207 Fix build for wasm32 target 2020-12-18 22:09:20 +01:00
bors[bot]andVincent Jousse e09cf3dbf4 Merge #1097
1097: Fix bad copy/paste in #907 r=grovesNL a=VincentFTS

**Connections**
#907

**Description**
Fix a copy/paste from dx11 code.



Co-authored-by: Vincent Jousse <contact@ftsoftware.fr>
2020-12-18 20:44:04 +00:00
Vincent Jousse ab64aa5b92 Fix bad copy/paste in #907 2020-12-18 21:37:17 +01:00
bors[bot]andDzmitry Malyshau 6489a1190d [rs] Merge #681
681: Move DeviceExt into a separate module r=cwfitzgerald a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-12-18 01:06:56 +00:00
Dzmitry Malyshau 92c7cdbaba [rs] Move DeviceExt into a separate module 2020-12-17 17:55:11 -05:00
bors[bot]andDzmitry Malyshau 5bbe5eb4f3 [rs] Merge #680
680: Update wgpu with Naga fixes and OpenGL backend r=cwfitzgerald a=kvark

This PR makes it easier to build wgpu-rs on Linux, since it doesn't require pkg-config into EGL.
Fixes #607
Fixes https://github.com/gfx-rs/wgpu/issues/1063

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-12-17 21:57:25 +00:00