Commit Graph

1427 Commits

Author SHA1 Message Date
Gabriel Majeri
04b0b4d3a5 Error type for command_encoder_finish 2020-07-18 10:46:47 +03:00
bors[bot]
a689aea3f2
Merge #810
810: Convert the existing error types to `thiserror` r=kvark a=GabrielMajeri

**Connections**
Part of #638

**Description**
Converts the crate's existing error types from a manual `Display` implementation to using `thiserror`.

**Testing**
Tested with core and `wgpu-rs`.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-18 04:51:46 +00:00
Gabriel Majeri
a27b24215d Convert the existing error types to thiserror 2020-07-18 07:29:20 +03:00
bors[bot]
20a5611b2c
Merge #809
809: Safe error handling for swap chain r=kvark a=GabrielMajeri

**Connections**
Part of #638 

**Description**
Error types for swap chain functions, using `thiserror` to avoid boilerplate code.

**Testing**
Checked with core and player.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-18 03:37:41 +00:00
Gabriel Majeri
8bd33c2242 Replace transpose with a match 2020-07-18 06:36:10 +03:00
Gabriel Majeri
314074d13c Safe error handling for swap chain 2020-07-17 21:11:28 +03:00
bors[bot]
a753f578be
Merge #808
808: Use `thiserror` for validation module r=kvark a=GabrielMajeri

**Connections**
Part of #638

**Description**
_Describe what problem this is solving, and how it's solved._

**Testing**
Checked with core repo. This doesn't change any code, just adds an `Error`/`Display` implementation.


Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-17 17:37:58 +00:00
Gabriel Majeri
ce5bcf86f1 Use thiserror for validation module 2020-07-17 20:21:19 +03:00
bors[bot]
2455a653f2
Merge #803
803: Player-based GPU test framework r=cwfitzgerald a=kvark

**Connections**
Closes #786

**Description**
This change adds a GPU-based testing by re-using the Player from tracing infrastructure - #289.
It converts the player into a lib + binary, and adds an integration test into the crate that implements RON-specified testing.

Current implementation has a few requirements/gotchas that are listed in `test.rs`:
* in all the IDs, the backend is `Empty`
* all expected buffers have `MAP_READ` usage on them
* last action is `Submit`

I believe it's workable, and we can improve it down the road (e.g. with #792).

**Testing**
MUHAHAHA
`cargo test` nails it

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-07-17 15:03:49 +00:00
Dzmitry Malyshau
eb7bdcd012 playtest: move the actions together with expectations 2020-07-17 10:59:02 -04:00
bors[bot]
0c7f189134
Merge #806
806: Fix rods error check - fixes water example r=kvark a=rukai

**Description**
Fixes water example panic

**Testing**
Tested on every wgpu-rs example


Co-authored-by: Rukai <rubickent@gmail.com>
2020-07-17 13:39:02 +00:00
Rukai
de0ac2ccb7 Fix rods error check 2020-07-17 19:31:45 +10:00
Dzmitry Malyshau
acef9206a6 Player-based GPU test framework 2020-07-17 00:08:43 -04:00
bors[bot]
3cdb9f72aa
Merge #800
800: Add the preferred format query r=cwfitzgerald a=kvark

Just getting us synced up to the spec naming and API for the swapchains...

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-07-16 19:59:10 +00:00
bors[bot]
d904598fbc
Merge #802
802: adds size function for VertexFormat r=kvark a=bootra-dev

Addresses https://github.com/gfx-rs/wgpu/issues/801

This PR adds a simple size function to the VertexFormat enum. It returns a u64 so that it can be conveniently used with the VertexAttributeDescriptor offset.


Co-authored-by: bootra-dev <bootragames@gmail.com>
2020-07-16 19:23:14 +00:00
bootra-dev
215c9fe750 refactor to group by size 2020-07-16 14:00:06 -04:00
bootra-dev
ee0e4850fd add size function for VertexFormat 2020-07-16 13:55:34 -04:00
Dzmitry Malyshau
76e136e375 add the preferred format query 2020-07-16 11:27:05 -04:00
bors[bot]
71e853d6ce
Merge #798
798: Fixed storage buffer counting towards storage textures for binding validation r=kvark a=Wumpf

See title.
(broke my group layout creation since my compute shaders need quite a few storage buffers _and_ storage textures bound... ;-))

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2020-07-16 14:33:40 +00:00
bors[bot]
8273bb373b
Merge #799
799: Derive Hash on BindGroupLayoutEntry r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_

**Description**
_Describe what problem this is solving, and how it's solved._
Required in Servo.

**Testing**
_Explain how this change is tested._
Not tested.
<!--
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: Kunal Mohan <kunalmohan99@gmail.com>
2020-07-16 14:26:05 +00:00
Kunal Mohan
62100584e8 Derive Hash on BindGroupLayoutEntry 2020-07-16 19:47:35 +05:30
Dzmitry Malyshau
9c8bf725a0
Add monocodus config with clippy support 2020-07-16 09:57:13 -04:00
Andreas Reich
ace186623e Fixed storage buffer counting towards storage textures for binding validation 2020-07-15 22:56:30 +02:00
bors[bot]
a0ed09a6a8
Merge #796
796: Safe error handling for command API r=kvark a=GabrielMajeri

**Connections**
Part of #638 

**Description**
Initially started to remove assertions from the `bundle.rs` file, but ended up implementing safe error handling for the whole `command` module.

**Testing**
Checked with core and player.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-15 20:54:32 +00:00
Gabriel Majeri
6f6893244a Rename InvalidBufferUsage 2020-07-15 17:09:53 +03:00
Gabriel Majeri
8e9a7bd3a9 Detailed error messages for compute errors 2020-07-15 17:06:46 +03:00
Gabriel Majeri
a8608d8bcd Rename error variants 2020-07-15 17:06:36 +03:00
Gabriel Majeri
151e300635 Detailed messages for RenderPassError 2020-07-15 16:48:58 +03:00
Gabriel Majeri
7df69b2740 Error message display for RenderCommandError 2020-07-15 15:59:36 +03:00
Gabriel Majeri
52922a7a8f Detailed error messages for render bundle creation 2020-07-15 14:34:18 +03:00
Gabriel Majeri
b7dd6a194f Implement Display for BindError 2020-07-15 14:32:07 +03:00
bors[bot]
fc4baa3107
Merge #795
795: Move `RenderPass*AttachmentDescriptor` types into core r=kvark a=GabrielMajeri

**Connections**
Follow up to #791.

**Description**
I had the impression that these two types were already shared between `wgpu-core` and `wgpu-rs`, considering they were generic. Further investigation reveals that not to be the case.

This PR moves these types into `wgpu-core`, since they're specific to this crate.

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

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-14 12:52:27 +00:00
Gabriel Majeri
1b03fbe9be Safe error handling for commands API 2020-07-14 11:40:54 +03:00
Gabriel Majeri
39ed7a008c Move RenderPass*AttachmentDescriptor types into core 2020-07-14 08:11:20 +03:00
bors[bot]
f67771fb87
Merge #777
777: Implement PUSH_CONSTANTS feature r=kvark a=cwfitzgerald

**Connections**

Closes #734. Makes minor progress on #689.

**Description**

This one is a doozy.

Implements Push Constant support in wgpu.

Implementation Notes:
- Push constants are unconditionally cleared on change to a pipeline with a different pipeline layout. This could be elided in a future revision, possibly making push constants slightly faster on non-vulkan platforms.
- This exposes basically a direct port of vulkan push constants to wgpu. There might be design decisions that would want to be changed for an upstream webgpu implementation.

Code Notes:
- The render bundle code needs to be heavily scrutinized because I wasn't able to test it and it requires pipeline invalidation.
- Validation should be correct as I have tested it pretty throughly, but there are a lot of factors involved, so I could have accidentally missed something (or not allowed something I should have).

Other Work:
- `PipelineLayoutDescriptor` was moved into wgt from wgpu-rs with a generic. 

**Testing**

I have modified the wgpu-rs example to use push constants for its uniform fallback, which is a perfect use case for push constants. I have not tested compute constants, but I expect no issues with them.

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


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-07-13 16:48:19 +00:00
Connor Fitzgerald
c8bcc50ed6 Implement PUSH_CONSTANTS feature 2020-07-13 12:47:09 -04:00
bors[bot]
2208048a89
Merge #789
789: Panic on using a pending buffer r=kvark a=kvark

**Connections**
Validates the use case of https://github.com/gfx-rs/wgpu-rs/issues/436

**Description**
We didn't detect if a buffer had pending *initial* mapping, previously, on submit.

**Testing**
Untested

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-07-13 15:51:50 +00:00
bors[bot]
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]
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
Dzmitry Malyshau
b7695ceac3 Panic on using a pending buffer 2020-07-13 00:54:24 -04:00
bors[bot]
8a038ba66e
Merge #788
788: Make register methods public again r=kvark a=kvark

Fixup after #783
Should unblock https://github.com/gfx-rs/wgpu-rs/pull/430

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-07-12 18:41:36 +00:00
Dzmitry Malyshau
dd38c7ba03 Make register methods public again 2020-07-12 14:39:38 -04:00
bors[bot]
ea680b964d
Merge #787
787: Remove non-exhaustive markers r=kvark a=GabrielMajeri

Based on the previous [discussion](https://github.com/gfx-rs/wgpu/pull/774#issuecomment-657171354), this PR removes the `NonExhaustive` structure and any `#[non_exhaustive]` attribute since it's too early to decide how to ensure forward compatibility.

**Testing**
Checked the `core`, `types` and `player` crates.

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-07-12 18:22:21 +00:00
Gabriel Majeri
9cd3d47ce7 Remove non-exhaustive markers 2020-07-12 19:56:04 +03:00
bors[bot]
28a3cdc22b
Merge #783
783: Basic use of Error for bind groups r=kvark a=kvark

**Connections**
Follow up to #776 

**Description**
Trying to tidy up a few things and add a public use of `Error` variant

**Testing**
not tested

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-07-12 03:44:36 +00:00
Dzmitry Malyshau
967217f89b Basic use of Error for bind groups 2020-07-11 23:41:43 -04:00
bors[bot]
6f48482ef3
Merge #782
782: Add check while trying to remove uninserted Ids r=kvark a=kunalmohan

**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_
An attempt to fix #781 
regression from #776 

**Description**
_Describe what problem this is solving, and how it's solved._
When we used `VecMap`, it simply returned `None` for even out of bounds access to the map (We depended on it returning `None`). After #776 , we get a panic. So adding a simple index check before accessing it fixes this issue.

**Testing**
_Explain how this change is tested._
Tested on wgpu-rs examples with the changes in https://github.com/gfx-rs/wgpu-rs/pull/430. All examples run fine except the `cube` which segfaults.
<!--
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: Kunal Mohan <kunalmohan99@gmail.com>
2020-07-11 22:32:33 +00:00
Kunal Mohan
4a116fca38 Add check while removing uninserted Ids 2020-07-12 01:13:34 +05:30