Commit Graph
213 Commits
Author SHA1 Message Date
Dzmitry Malyshau 7235072f6d Update version and dependencies to gfx-9 2021-02-01 02:16:31 -05:00
Dzmitry Malyshau 74eed253d8 Convert cube, skybox, msaa-line, and mipmap, to WGSL
Validate example shaders in tests

Support WGSL on the Web via Naga

Port the shadow WGSL partially

Convert hello-compute and boids to WGSL

Conver the shadow's fragment shader to WGSL

Shader entry point refactor
2021-01-30 01:02:04 -05:00
Dzmitry Malyshau 517ce3ef8d Update wgpu to the new render pipeline descriptor API 2021-01-29 00:51:44 -05:00
Connor Fitzgerald 6d52bc5535 Add pipeline statistics and timeline queries 2021-01-16 01:05:03 -05:00
Niklas Korz 0578cda7a6 Move get_swap_chain_preferred_format from device to adapter
Squashed commit of the following:

commit 260976b10e3a54b253768d71e5e47c51b976c25c
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 20:23:31 2021 +0100

    Formatting

commit e3f837e1b6a81c8c7a9566ba6a2c6dd8adfbbde7
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 20:20:37 2021 +0100

    Update examples

commit b0774c0aa56fbdfe741dd6c0e86d55b8c6b42de3
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 19:31:29 2021 +0100

    Use adapter.get_swap_chain_preferred_format
2021-01-11 20:32:03 +01:00
Jay Oster dae801baa0 Replace futures with pollster
This PR removes all of the `futures` dependencies. `std::future` does not contain a lot of useful helpers available in futures. The obvious ones are `join_all`, `FutureExt::map`, and `block_on`.

* `join_all` is replaced with a `Vec<T>` and async blocks.
* `FuturesExt::map` in the web backend is replaced by rolling the `map` function into the `MakeSendFuture` type.
* `block_on` is provided by `pollster`.

The original code using `join_all` ignored the result type yielded by the Future from `map_async`. This code does the same, but makes dropping the result a little more obvious.

These should not be troublesome. Figured I would call them out anyway.

The last big change is replacing `futures-executor` in the examples with `async-executor`. A new concrete `Spawner` type is used in the example framework instead of an implementation of `futures_task::LocalSpawn`.
2021-01-07 10:10:18 -08:00
Andreas Reich 2b2aed3a46 Fixed inconsistent framerate in examples.
Does not affect web builds.
Previously, framerate would float between 30-40 fps depending on how many events would come in. Fast mouse movements over the window lead to higher framerates since request_redraw was called every 20ms (-> 50fps) AND all events were consumed, additionally the event loop would wake up only every 10ms, so actual rate of request_redraw depended on how often we'd wake up.
Fixed this by setting the max sleep time of the event loop to the remaining time until hitting the desired time interval since the last frame.

The difference is most visible on the spinning cubes in the shadow example since the cubes currently spin with a fixed angle per frame (independent of frame timings).
2021-01-05 22:58:28 +01:00
Manuel Gil a5f44f2759 Remove wgpu-subscriber -> subscriber alias in examples 2021-01-05 19:05:52 +00:00
Manuel Gil e00ef5d584 Expose get_swap_chain_preferred_format on Device
- Update examples to make use of the new method
2021-01-03 17:35:04 +00:00
Connor Fitzgerald 1d216c590e Use only 1 and 4 samples for msaa-line example 2020-12-21 15:34:19 -05:00
Dzmitry Malyshau f3d6d242d7 Update wgpu with Naga fixes and OpenGL backend 2020-12-17 13:03:27 -05:00
Emanuele Dalla Longa bdd6edecd2 Require labels to match gfx-rs/wgpu#1088
Change-Id: I1acc45a3023dfc78b6694bd4a28a0131f07b7ba7
2020-12-16 00:15:05 +01:00
Connor Fitzgerald a4202a4ff0 Add create_texture_with_data helper 2020-12-12 01:50:49 -05:00
Dzmitry Malyshau f213d1db8f Update wgpu with Naga changes, replace hello-triangle shaders with WGSL 2020-12-07 09:45:24 -05:00
Connor Fitzgerald 7dbe4274fb Integrate ETC and ASTC textures in skybox example 2020-12-06 16:51:57 -05:00
Dzmitry Malyshau 7b06c4a3f7 Introduce ShaderModuleDescriptor 2020-12-05 18:53:37 -05:00
kejor 423c2489b8 API and examples update for index_format 2020-12-04 20:29:42 -05:00
Dzmitry Malyshau 9c529b94f5 Adopt the updated bind group entry API 2020-11-30 22:31:31 -05:00
Diggory Blake bed49ac654 Print chosen adapter when running examples 2020-11-30 18:33:51 +00:00
Devin Hill 337612a49f make TextureViewArray take a slice of refs; fix texture-arrays example to match. 2020-11-24 21:09:00 -05:00
Dzmitry Malyshau 2dc59ba2d9 Port to the updated wgpu error model 2020-11-23 17:59:21 -05:00
Joshua Groves 4fafceb30a Fix typo 2020-11-21 00:07:57 -03:30
Joshua Groves 8d5ef65dcb Temporarily use BackendBit::PRIMARY in examples
`BackendBit::all()` allows GL/surfman to be used on macOS which appears
to prevent rendering with Metal (e.g. hello-triangle displays an empty
window).

surfman will be removed in later versions of gfx, which will allow us
to switch back to `BackendBit::all()` in the examples.
2020-11-20 23:33:10 -03:30
Dzmitry Malyshau 9c638a2707 Update wgpu, work around surface validation 2020-11-18 10:05:20 -05:00
infinitesnow 2c2f778dba Fixed size in "boids" example 2020-11-17 21:26:35 +01:00
Timo de Kort ee220edce0 Remove implicit conversion hello-triangle shader.vert 2020-11-15 23:13:53 +01:00
Stygeon ef56676cfc Removed unusued Uniform struct in texture-arrays example. 2020-11-12 02:26:58 +01:00
Dzmitry Malyshau d004ddc038 Match inputs/outputs in msaa-line shader 2020-11-09 09:27:51 -05:00
Zsolt Bölöny 16427aed19 Rename TextureUsage::OUTPUT_ATTACHMENT to RENDER_ATTACHMENT 2020-11-09 10:35:55 +01:00
Dzmitry Malyshau b6cabe16a2 Enable GL backend 2020-11-04 23:02:01 -05:00
Dzmitry Malyshau 503b61dc6c Update wgpu with another bind group fix, updated power preference 2020-10-13 16:57:52 -04:00
Paris DOUADY c4d7ce146f Fix mipmap example which was y-flipped 2020-10-12 16:51:24 +02:00
Dzmitry Malyshau 30fb46a999 Really fix the environment to WGPU_BACKEND this time 2020-10-11 23:43:39 -04:00
Dzmitry Malyshau d8fe188305 Support WGPU_BACKEND environment in the examples 2020-10-11 23:17:38 -04:00
Joshua Groves 0fb8a436e5 Reorder framework window creation for web 2020-09-16 01:04:49 -02:30
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
qthree 0be45b5d67 Add hello-windows example 2020-09-10 06:55:42 +07:00
Rukai 085e50c798 Replace unsafe impl Pod with safe derive 2020-09-08 23:39:12 +10: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
Hiroaki Yutani 47c83600d2 Remove bake.frag 2020-09-01 00:22:19 +09: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
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
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
Jonathan Woollett-Light 82245e5f77 Added some explanatory comments to hello-compute example 2020-08-19 18:16:10 +01:00
Connor Fitzgerald dfac39efc1 Convert StagingBelt to take a &mut CommandEncoder 2020-08-16 23:10:14 -04:00