Commit Graph

9013 Commits

Author SHA1 Message Date
PENGUINLIONG
39b9a6218b [rs] Notes on LoadOp 2020-09-15 14:43:30 +08:00
bors[bot]
9840ae4eb3 [rs] Merge #565
565: Add context to errors r=kvark a=scoopr

ContextError is just a simple wrapper that contains a string and the original error, and it is used to decorate the error to give it more context.

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-09-15 01:38:19 +00:00
bors[bot]
4829875193 [rs] Merge #566
566: Report out of memory errors r=kvark a=scoopr



Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-09-15 01:28:40 +00:00
Mikko Lehtonen
2e791cacde [rs] Report out of memory errors 2020-09-14 23:26:20 +03:00
bors[bot]
a0cef40550 Merge #928
928: Reverts the addition of LabeledContextError r=kvark a=scoopr

Removed as discussed, moving them to wgpu-rs side


Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-09-14 20:11:12 +00:00
Mikko Lehtonen
60af888c74 [rs] Add context to errors
ContextError is just a simple wrapper that contains a string and the original error, and it is used to decorate the error to give it more context.
2020-09-14 22:54:52 +03:00
Mikko Lehtonen
8252758674 Reverts the addition of LabeledContextError
Removed as discussed, moving them to wgpu-rs side
2020-09-14 22:45:10 +03:00
Pelle Johnsen
094e4fdd17 Fix lexer operator issues (with tests) (#188)
* Fix lexer operator issues (with tests)

* [glsl-in] Don't convet to string in lexer tests

* [glsl-in] cleanup lexer tests further

- Consolidate use statements

- Iterate lex directly, check for None at end
2020-09-14 01:16:12 -04:00
Pelle Johnsen
a9355f928f [glsl-in] Add gl_VertexIndex (#189)
* [glsl-in] Add gl_VertexIndex

Refactor variable handling out of parser.rs

* [glsl-in] Fixes for gl_VertexIndex

- Make lookup_variable a method of Program

- Try to cleanup conditional logic

* [glsl-in] Error on gl_ builtin in wrong stage

Wrapped in glsl-validate feature
2020-09-13 21:20:46 -04:00
Kunal Mohan
d423d3d5d7 Allow dropping of error resources (#925)
* Allow dropping of error resources

* Unregister error resources without panic
Panic when removing Vacant element or when index is out of range

* address review comments
2020-09-13 21:17:53 -04:00
Dzmitry Malyshau
089d0dd4f8 Minor fixes in feature checks (#194) 2020-09-13 21:03:00 -04:00
bors[bot]
3c0634fdec [rs] Merge #562
562: More errorsinkifying r=kvark a=scoopr

Continuing on with errorsinkifying more places, these wrap Buffer, Texture and CommandEncoder with a struct that includes the `error_sink`, and uses it for the error handling.

I think most of the apis are errorsinkified with this. The remaining ones may need some more thinking. 

Queue would be wrapped mostly for the submit, the write_ stuff could in theory piggyback on the texture/buffer error-sink.
Others like swapchain, some mapping stuff, etc. needs some discussion or other implementation work.


Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-09-13 04:28:57 +00:00
Pelle Johnsen
0235c4a86c [glsl-in] Fix unused braces in parser.rs (#190) 2020-09-13 00:22:06 -04:00
bors[bot]
f66bc8ff79 [rs] Merge #563
563: Document bind buffer alignment r=kvark a=kvark

Fixes  #561
Also updates wgpu dependency to latest, and our exampels are now fully validated for the shader interface 🎉 .

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-09-13 04:11:39 +00:00
Dzmitry Malyshau
c269703bcf [rs] Document the bind buffer alignment 2020-09-13 00:10:11 -04:00
Dzmitry Malyshau
24ad4af92c [rs] Update wgpu with Naga changes 2020-09-13 00:10:11 -04:00
bors[bot]
43adcbcf68 Merge #926
926: Update naga with new image API r=cwfitzgerald a=kvark

**Connections**
Gets us https://github.com/gfx-rs/naga/pull/187, https://github.com/gfx-rs/naga/pull/185, https://github.com/gfx-rs/naga/pull/182, partially https://github.com/gfx-rs/naga/pull/169, and https://github.com/gfx-rs/naga/pull/167

**Description**
Brings us to a point where all wgpu-rs shaders are successfully validated 🎉 

**Testing**
wgpu-rs examples

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-09-13 03:59:44 +00:00
Mikko Lehtonen
d0db3fc0a0 [rs] Errorsinkify CommandEncoder 2020-09-13 01:11:18 +03:00
Mikko Lehtonen
f5ab931aba [rs] Errorsinkify Texture 2020-09-12 23:26:35 +03:00
Mikko Lehtonen
d93d494582 [rs] Errorsinkify Buffer 2020-09-12 23:26:35 +03:00
bors[bot]
70732bb6ac [rs] Merge #559
559: Update wgpu with the polygon modes support, use in the cube example r=cwfitzgerald a=kvark

Uses https://github.com/gfx-rs/wgpu/pull/921, cc @manuel-woelker

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-09-11 20:04:31 +00:00
Dzmitry Malyshau
6a3c106cc4 Update naga with new image API 2020-09-11 12:34:20 -04:00
Dzmitry Malyshau
b278e10ea7 [spirv-in] make pointers totally transparent (#187) 2020-09-11 12:19:55 -04:00
Dzmitry Malyshau
dd850b8156 [rs] Use implicit bind group layout in the mipmap example 2020-09-10 23:59:52 -04:00
Dzmitry Malyshau
72ab5f2809 [rs] Update wgpu with the polygon modes support, use in the cube example 2020-09-10 22:02:05 -04:00
bors[bot]
9edf44118e [rs] Merge #557
557: Pin web-sys version r=grovesNL a=rukai

As mentioned in https://github.com/gfx-rs/wgpu-rs/pull/553 this will prevent the wasm build from breaking.
@grovesNL Is pinning just web-sys and wasm-bindgen sufficient?

Co-authored-by: Rukai <rubickent@gmail.com>
2020-09-10 22:43:34 +00:00
João Capucho
0129aa2ca6 [glsl-out]: combined image sampler (#177)
* Added generation of the texture mappings to the glsl backend

* Added a temporary workaround for the spirv shaders
Fixed some parts that were using vulkan glsl

* Made texture mapping not require a sampler

* Used interface to build the texture map

* Made global names mandatory except for sampler ones

* Addressed more comments

* Removed the temp fix for the spirv frontend

* Addressed the comments
2020-09-10 14:14:03 -04:00
Dzmitry Malyshau
e64f28375e ir: bitcast expression 2020-09-10 13:19:17 -04:00
bors[bot]
f6f7210b63 Merge #924
924: Unlock nightly builds on CI r=kvark a=kvark

See https://github.com/Xudong-Huang/generator-rs/issues/24

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-09-10 15:07:13 +00:00
Dzmitry Malyshau
fc27920fde Unlock nightly builds on CI 2020-09-10 11:04:24 -04:00
Rukai
0c213ec85d [rs] Pin web-sys version 2020-09-10 23:10:07 +10:00
Pelle Johnsen
2ea0310b63 [glsl] Promote glsl-new to glsl (#184)
* [glsl] Promote glsl-new to glsl

* [glsl-in] rename feature glsl > glsl-in
2020-09-10 01:11:52 -04:00
bors[bot]
93ac56514a [rs] Merge #553
553: Add hello-windows example r=kvark a=qthree

# `hello-windows`
## Description

This is demonstration of ability to create multiple windows with differently colored backgrounds.

## Screenshot
![screenshot](https://user-images.githubusercontent.com/9898555/92568685-bc411c80-f2a9-11ea-9d4d-84bb236c40f9.png)

# `shared-textures` (old version)
## Description

This is demonstration of ability to create multiple windows and share single texture across all of them.
Available in ad3030ae8f61e3ea3f7b913cd03c366119d058fb commit.

## Screenshot
![screenshot](https://user-images.githubusercontent.com/9898555/92500037-cc63e800-f226-11ea-8f50-bfa02538cce5.png)


Co-authored-by: qthree <qthree3@gmail.com>
2020-09-10 04:34:35 +00:00
Pelle Johnsen
2fa8eb596d [spv-out] Add initial Rosetta test (#181)
* [spv-out] Add initial Rosetta test

For now just check that spv-out succeeds

* [spv-out] Check spv output has len > 0
2020-09-10 00:32:02 -04:00
bors[bot]
67ee3d6678 [rs] Merge #555
555: Update to latest web-sys r=kvark a=grovesNL

Cherry-pick #497 into `master` now that new versions of web-sys/wasm-bindgen/js-sys/wasm-bindgen-futures are published.

We could also do this for `v0.6` too if we want CI to succeed there, or alternatively consider disabling CI for wasm builds on `v0.6`.

Co-authored-by: Joshua Groves <josh@joshgroves.com>
2020-09-10 04:25:18 +00:00
Joshua Groves
9d48bc26c0 [rs] Update to latest web-sys 2020-09-10 01:09:50 -02:30
qthree
5338992913 [rs] Add hello-windows example 2020-09-10 06:55:42 +07:00
João Capucho
e1e116537e Extended Interface to be used in more places (#183)
* Extended Interface to be used in more places

* Applied comments and added tests

* Removed the statement visitor

* Fixed remaining comments
2020-09-09 17:22:13 -04:00
bors[bot]
2972212d42 Merge #921
921: add `polygon_mode: PolyonMode` to `RasterizationStateDescriptor` to allow drawing wireframes r=kvark a=manuel-woelker

**Description**
This adds `polygon_mode: PolyonMode` to `RasterizationStateDescriptor` to allow drawing in wireframes and point mode

I added `hal::Features::NON_FILL_POLYGON_MODE` to the `wishful_features` in `instance.rs`. I don't know what side effects this might have.

**Testing**
Tested locally on my Windows machine with Vulkan backend.

Co-authored-by: Manuel Woelker <github@manuel.woelker.org>
2020-09-09 19:50:33 +00:00
Manuel Woelker
336d070b26 add polygon_mode: PolyonMode to RasterizationStateDescriptor to allow drawing wireframes 2020-09-09 21:34:37 +02:00
Dzmitry Malyshau
c122e064a7 Move storage class from image type into the global declaration (#182) 2020-09-09 13:59:29 -04:00
bors[bot]
8db3af7286 Merge #922
922: Add LabeledContextError r=kvark a=scoopr

Purpose for this is to add more context to an error.
create_render_pipeline error is improved, by showing the action
(creating render pipeline) and the user provided label, to aid with
the investigation.

Example error
before:
```
wgpu error: Validation error

Caused by:
    error in stage VERTEX: unable to find an entry point matching the Vertex execution model

thread 'main' panicked at 'Handling wgpu errors as fatal by default', src/backend/direct.rs:1457:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

after:
```
wgpu error: Validation error

Caused by:
    Creating render pipeline (label: Some("hello-triangle pipeline"))
    error in stage VERTEX
    unable to find an entry point matching the Vertex execution model

thread 'main' panicked at 'Handling wgpu errors as fatal by default', src/backend/direct.rs:1457:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-09-09 17:56:10 +00:00
Mikko Lehtonen
2fb8fc34d2 Add LabeledContextError
Purpose for this is to add more context to an error.
create_render_pipeline error is improved, by showing the action
(creating render pipeline) and the user provided label, to aid with
the investigation.
2020-09-08 17:44:53 +03:00
bors[bot]
cc33e622cf [rs] Merge #551
551: Replace unsafe impl Pod with safe derive r=kvark a=rukai

bytemuck now includes derives that will implement the Pod trait, failing to compile if the struct cannot safely be a Pod.
Lets use it to remove most of the unsafe usage from the examples.
closes https://github.com/gfx-rs/wgpu-rs/issues/190

Co-authored-by: Rukai <rubickent@gmail.com>
2020-09-08 13:40:45 +00:00
Rukai
3cfb3295cb [rs] Replace unsafe impl Pod with safe derive 2020-09-08 23:39:12 +10:00
bors[bot]
730313177e Merge #923
923: Fix invalid mip level count check r=kvark a=benfrankel

**Connections**
Fixes https://github.com/gfx-rs/wgpu/issues/894
Continues from https://github.com/gfx-rs/wgpu/pull/893

**Description**
Invalid mip level counts are allowed through `Device::create_texture`, triggering Vulkan validation errors. A fix was applied in https://github.com/gfx-rs/wgpu/pull/893, but the fix needs a minor correction to work properly.

Also added back the `MAX_MIP_LEVELS` check, because it's technically possible for `MAX_MIP_LEVELS` to be less than `kind.compute_num_levels()`, e.g. if one of the given dimensions is very big (2^16). 

Error message is updated to reflect the change in behavior: there are now three ways for a mip level count to be invalid: it's equal to zero; it's greater than `MAX_MIP_LEVELS`; or it's greater than the largest mip level count allowed for the given size.

**Testing**
Tested by manually modifying the `mipmap` example in `wgpu-rs` to pass various edge case values for `size` and `mip_level_count`.


Co-authored-by: Ben Frankel <ben.frankel7@gmail.com>
2020-09-08 12:20:50 +00:00
Pelle Johnsen
789d624710 [rosetta] Add explicit return (#180) 2020-09-08 01:18:07 -04:00
Ben Frankel
2ee07a2a47 Fix invalid mip level count check 2020-09-07 16:49:06 -07:00
Pelle Johnsen
43bad8ee50 [glsl-new] Add jump statements (#179)
* [glsl-new] Add jump statements

- continue
- break
- return
- discard

* [glsl-new] Fix clippy error for return statement
2020-09-07 01:28:13 -04:00
Dzmitry Malyshau
c69b03d32f [rs] Update wgpu to the latest DX11 fix 2020-09-06 20:41:24 -04:00