Commit Graph
8897 Commits
Author SHA1 Message Date
bors[bot]andDzmitry Malyshau 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]andDzmitry Malyshau 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]andRukai 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]andDzmitry Malyshau 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]andqthree 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]andJoshua Groves 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]andManuel Woelker 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]andMikko Lehtonen 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]andRukai 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]andBen Frankel 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
Dzmitry Malyshau 68bf10a3a5 Fix invalidated segment of the staging memory 2020-09-06 20:37:03 -04:00
Timo de Kort a3bac5ee0f [Spirv-out] Move instructions to own module (#174)
* [spirv-out] Move instructions to own module

* [spirv-out] Fix wrong function use of some instructions

* [spirv-out] Update instruction parameters

* [spirv-out] Update current instruction tests

* [spirv-out] Order current instruction tests

* [spirv-out] Add missing instruction tests
2020-09-06 00:35:59 -04:00
bors[bot]andDzmitry Malyshau 5cfdd4a135 Merge #920
920: Don't bind groups that aren't expected by the layout  r=grovesNL a=kvark

**Connections**
Sibling of #919 for master.

**Description**

**Testing**
In addition to the fix itself, this comes with a new regression playtest!

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-09-06 02:22:02 +00:00
bors[bot]andMikko Lehtonen 9e81e3d6ef [rs] Merge #547
547: Implement on_uncaptured_error  r=kvark,cwfitzgerald a=scoopr

This is very crude at the moment, I'm mostly just checking if the directions is at all viable.

So I set out to implement `on_caught_error`, focusing solely on the direct backend. It just accepts a `Fn(GPUError)` (and I named it GPUError because I didn't yet want to rename the import of `std::error::Error`).

I store the handler in a `ErrorSinkRaw` struct, which is then wrapped in Arc+Mutex, with the idea that other resources can point to the same Arc, so when `Device::on_uncaught_error` is called mid application, all resources will point to the right place. Otherwise I think something like `Buffer::unmap` would have to find the `Device` it was created with, to find the uncaught handler.

Now I store the `ErrorSink` in the `Device` struct, because it is a convenient place to hold it. But I guess it is a bit nonsensical with the web backend, so either it would need to be `cfg(not(wasm32))`, or move the whole thing in the backend side, but in the direct backend, I don't see a convenient place to store the closure. But the unwrapping is done in direct backend, so it can't really be moved up in to wgpu-core either, unless the error handling overall is moved there.

Also related, I'm now passing the `error_sink` argument to the few methods where I implemented the error handling, which I think is a bit ugly, but it works.

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-09-05 16:02:20 +00:00
Dzmitry Malyshau eed8bf84ef Playtest for binding a group 2020-09-04 23:47:24 -04:00
Dzmitry Malyshau 1886149cae Don't bind groups that aren't expected by the layout 2020-09-04 23:47:24 -04:00
Mikko Lehtonen e28bc9cbbb [rs] impl std error for Error
Relies more on the source() of error for informative messages
2020-09-05 01:29:03 +03:00
Mikko Lehtonen 4277bcab2c [rs] direct: ErrorSinkify Device methods 2020-09-05 00:21:53 +03:00
Mikko Lehtonen 03fda219e3 [rs] direct: Implement on_uncaptured_error
Currently the sink is used only in Device::create_shader_module and
Device::create_render_pipeline, to be expanded in future commits.
2020-09-05 00:21:47 +03:00
Mikko Lehtonen 506ee7a368 [rs] direct: Move Device to its own struct 2020-09-05 00:21:11 +03:00
Mikko Lehtonen f987a82503 [rs] Add Device::on_captured_error
The implementation is dummy one
2020-09-03 09:37:09 +03:00
Mikko Lehtonen 117d323f71 [rs] Don't import Error directly 2020-09-03 09:34:10 +03:00
bors[bot]andDzmitry Malyshau 1e7eec0686 [rs] Merge #548
548: wgpu update with correctness fixes r=kvark a=kvark

Picks up a few important correctness fixes, such as https://github.com/gfx-rs/wgpu/pull/916 and https://github.com/gfx-rs/wgpu/pull/912

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-09-02 20:47:07 +00:00
Dzmitry Malyshau 2ac4876361 [rs] wgpu update with correctness fixes 2020-09-02 16:45:20 -04:00
bors[bot]andIvan Mironov 3f1abf571e Merge #908
908: Clarify usage of SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING r=cwfitzgerald a=im-0

**Connections**
https://github.com/gfx-rs/wgpu-rs/pull/540

**Description**
This clarifies usage of SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING with GLSL.

**Testing**
This commit only changes documentation.

Co-authored-by: Ivan Mironov <mironov.ivan@gmail.com>
2020-09-02 20:43:32 +00:00
bors[bot]andIvan Mironov ad3657aba8 [rs] Merge #540
540: Improve and fix examples/texture-arrays r=cwfitzgerald a=im-0

Original examples/texture-arrays produces following output on my machine (Linux, Mesa/RADV 20.2-rc3, Radeon VII):

![texture-arrays-non-uniform-bug](https://user-images.githubusercontent.com/18099621/91645079-8c00af00-ea5b-11ea-854a-ef5ab5a63ce2.png)

Quick investigation showed that only shaders with non-uniform indexing are problematic (first commit helped with this). Then, after searching on the web, I figured out that the problem is in missing `nonuniformEXT`. Second commit fixes this.

I am new to graphics programming, and `nonuniformEXT` may work just by accident. So please confirm my finding before merging.

Co-authored-by: Ivan Mironov <mironov.ivan@gmail.com>
2020-09-02 20:38:32 +00:00