Commit Graph
574 Commits
Author SHA1 Message Date
bors[bot]andDzmitry Malyshau fdef9d61ba 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 40fa5e4d71 Document the bind buffer alignment 2020-09-13 00:10:11 -04:00
Dzmitry Malyshau 467b2ba8e9 Update wgpu with Naga changes 2020-09-13 00:10:11 -04:00
bors[bot]andDzmitry Malyshau e798278fd2 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 568072fb18 Use implicit bind group layout in the mipmap example 2020-09-10 23:59:52 -04:00
Dzmitry Malyshau a9e9f8cabc Update wgpu with the polygon modes support, use in the cube example 2020-09-10 22:02:05 -04:00
bors[bot]andRukai 860dadaf45 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
Rukai 0a0e9f57e1 Pin web-sys version 2020-09-10 23:10:07 +10:00
bors[bot]andqthree 1a3360197e 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
bors[bot]andJoshua Groves 408ab6feea 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 09a928a2cb Update to latest web-sys 2020-09-10 01:09:50 -02:30
qthree 0be45b5d67 Add hello-windows example 2020-09-10 06:55:42 +07:00
bors[bot]andRukai 2a610684df 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 085e50c798 Replace unsafe impl Pod with safe derive 2020-09-08 23:39:12 +10:00
Dzmitry Malyshau b89f912f5d Update wgpu to the latest DX11 fix 2020-09-06 20:41:24 -04:00
bors[bot]andMikko Lehtonen 532c03c509 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
Mikko Lehtonen daaf14fdd3 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 4dde3a68bc direct: ErrorSinkify Device methods 2020-09-05 00:21:53 +03:00
Mikko Lehtonen e660813072 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 996ca2f786 direct: Move Device to its own struct 2020-09-05 00:21:11 +03:00
Mikko Lehtonen a42d8d7e56 Add Device::on_captured_error
The implementation is dummy one
2020-09-03 09:37:09 +03:00
Mikko Lehtonen 4d3da5d7b3 Don't import Error directly 2020-09-03 09:34:10 +03:00
bors[bot]andDzmitry Malyshau 1f7716e22e 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 2a0e0bd93d wgpu update with correctness fixes 2020-09-02 16:45:20 -04:00
bors[bot]andIvan Mironov 2c47406c4c 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
bors[bot]andHiroaki Yutani cfe938dbd6 Merge #545
545: Remove bake.frag from shadow example r=kvark a=yutannihilation

Now that `fragment_stage` is a `Option`, I guess this is the case when we don't need fragment shader.

Co-authored-by: Hiroaki Yutani <yutani.ini@gmail.com>
2020-08-31 16:05:56 +00:00
Hiroaki Yutani 47c83600d2 Remove bake.frag 2020-09-01 00:22:19 +09:00
bors[bot]andDzmitry Malyshau d6ff0b6350 Merge #543
543: Don't use `log` crate in include_spirv r=kvark a=kvark

Fixes  #541

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-31 04:06:16 +00:00
Dzmitry Malyshau b3c1b1ccdd Don't use log crate in include_spirv 2020-08-31 00:05:45 -04:00
Ivan Mironov f19eef64d4 Add nonuniformEXT qualifier in examples/texture-arrays
This fixes corruption of output on some AMD GPUs.
2020-08-30 00:30:06 +05:00
Ivan Mironov 77166bba00 Use wgpu::include_spirv!() for all shaders in examples/texture-arrays
`wgpu::include_spirv!()` writes file name into log. This is useful to
understand which fragment shader is used (choice depends on device
features).
2020-08-29 22:41:14 +05:00
bors[bot]andDzmitry Malyshau 13248eaf87 Merge #537
537: Update wgpu with DepthComparison component and better shader validation r=cwfitzgerald a=kvark

Depends on https://github.com/gfx-rs/wgpu/pull/898

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-28 21:39:11 +00:00
Dzmitry Malyshau 19553fe697 Update wgpu with DepthComparison component and better shader validation 2020-08-28 17:37:33 -04:00
crispweed 1935cfa28a Removed erroneous zero size check related conditional in water example resize() (#534)
* The conditional at the start of resize() already tests for and exits on the zero width and height condition.
The conditional removed here was then getting run on every other call to resize(), which doesn't seem logical, doesn't correspond to the comment, and seemed to be causing at least one issue with rendered viewport going black during resize.

Fixes #532
(probably) Fixes #519

* Defensive coding to prevent various issues when window size goes to zero, e.g. NaN being passed in cgmath::perspective() aspect ratio parameter.

Fixes #531
2020-08-25 13:25:50 -04:00
bors[bot]andJustin Shrake 7396e92fcb Merge #526
526: Add optional border_color to SamplerDescriptor r=kvark a=jshrake

Depends on https://github.com/gfx-rs/wgpu/pull/891

Co-authored-by: Justin Shrake <justinshrake@gmail.com>
2020-08-23 05:08:06 +00:00
Justin Shrake 04da221db4 Add optional border_color to SamplerDescriptor 2020-08-22 22:00:33 -07:00
bors[bot]andAndreas Reich cef9bc54f2 Merge #527
527: Expose debug marker/groups for ComputePass and Encoder r=kvark a=Wumpf

Added uses of them to the examples to make sure everything compiles & works.
Marker on compute examples are arguably a bit awkward since they are so trivial. On the shadow example however it is a delight when inspected in RenderDoc! (and it will do wonders to my project which can run into situations with literally thousands of compute dispatches per frame 😅 )

RenderDoc, boids example:
![0_boids](https://user-images.githubusercontent.com/1220815/90963818-70c1fc80-e4bb-11ea-9842-25240ae5c927.png)

RenderDoc, shadow example:
![1_shadow](https://user-images.githubusercontent.com/1220815/90963819-728bc000-e4bb-11ea-9395-630a1f7b3a31.png)


Co-authored-by: Andreas Reich <r_andreas2@web.de>
2020-08-22 21:56:15 +00:00
Andreas Reich cb2072ed6a Added debug marker/groups for ComputePass & CommandEncoder 2020-08-22 21:37:01 +02:00
bors[bot]andDzmitry Malyshau 854b3f1c5d Merge #523
523: Change buffer binding to not take a slice r=cwfitzgerald,grovesNL a=kvark

This has been a constant source of confusion w.r.t dynamic offsets.
What it looks like it's doing: user provides a slice of buffer visible to the shader. Just like they provide slices to vertex and index buffer bindings.
What it's actually doing: it takes the offset and size separately, modifying the offset later on based on the dynamic offset.

We don't need this confusion. Semantics is different from `BufferSlice` and so we should have a different API here.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-22 01:57:56 +00:00
Dzmitry Malyshau 44c6910934 Change buffer binding to not take a slice.
Also switch the shadow example to use dynamic offsets.
Add the relevant feature to our example table.
2020-08-21 09:49:33 -04:00
bors[bot]andJonathan Woollett-Light fa964ba0b4 Merge #517
517: Added some explanatory comments to hello-compute example r=kvark a=JonathanWoollett-Light

Simply added some more comments explaing the basic compute example.

Also moved the lines:
```rust
let slice_size = numbers.len() * std::mem::size_of::<u32>();
let size = slice_size as wgpu::BufferAddress;
```
To be just before where they are used.

Co-authored-by: Jonathan Woollett-Light <jonathanwoollettlight@gmai.com>
2020-08-19 18:04:54 +00:00
Jonathan Woollett-Light 82245e5f77 Added some explanatory comments to hello-compute example 2020-08-19 18:16:10 +01:00
bors[bot]andJMS55 4bf2499336 Merge #516
516: Depend on less of futures r=cwfitzgerald a=JMS55



Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
2020-08-18 23:24:39 +00:00
JMS55 8108f50c07 Shrink futures dependencies 2020-08-18 19:23:53 -04:00
bors[bot]andConnor Fitzgerald bdddc3942b Merge #515
515: Add logging information to README r=kvark a=cwfitzgerald



Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
wgpu-v0.6.0
2020-08-18 15:11:41 +00:00
Connor Fitzgerald c685b40407 Add logging information 2020-08-18 11:08:15 -04:00
bors[bot]andDzmitry Malyshau 5642e2dfe2 Merge #514
514: Release version 0.6 r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-18 15:04:21 +00:00
Dzmitry Malyshau b370932078 Release version 0.6 2020-08-18 10:31:27 -04:00
bors[bot]andConnor Fitzgerald 02c1fa563f Merge #513
513: Update parking-lot to 0.11 r=trivial a=cwfitzgerald



Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-08-17 22:00:50 +00:00
Connor Fitzgerald dc047f07e9 Update parking-lot to 0.11 2020-08-17 17:59:58 -04:00