Commit Graph

9013 Commits

Author SHA1 Message Date
bors[bot]
4de1d24bc6 Merge #898
898: Update naga with improved SPIR-V parsing and reflection r=cwfitzgerald a=kvark

**Connections**
Fixes #892
Fixes #899
Includes https://github.com/gfx-rs/naga/pull/153 and the awesome https://github.com/gfx-rs/naga/pull/122
Also includes https://github.com/gfx-rs/naga/pull/157 now.

**Description**
This PR updates naga and our validation code.
~~We can successfully validate only `hello-triangle` and `cube` examples, still.~~
We mostly pass the validation of the examples now!
Meta-issue filed in https://github.com/gfx-rs/naga/issues/155 to unlock the rest.

**Testing**
Tested on examples in https://github.com/gfx-rs/wgpu-rs/pull/537

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-27 21:06:27 +00:00
bors[bot]
9b65d7433f Merge #902
902: Address nits in #897 r=cwfitzgerald a=scoopr



Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-08-27 20:10:11 +00:00
Mikko Lehtonen
5fab78e175 Address nits in #897 2020-08-27 22:11:42 +03:00
Dzmitry Malyshau
ceac2344fc Update naga to bd9efe5915 2020-08-27 11:52:02 -04:00
Dzmitry Malyshau
bd9efe5915 Allow struct members without an origin 2020-08-27 11:49:38 -04:00
Dzmitry Malyshau
b5d99e133b [spirv] fix binary operators, support more extensions 2020-08-27 11:49:38 -04:00
Dzmitry Malyshau
462c82fb71 As expressions 2020-08-27 11:49:38 -04:00
Dzmitry Malyshau
35e14378b3 [spirv] register function parameters, handle return values 2020-08-27 11:49:38 -04:00
Dzmitry Malyshau
cf6002be01 [spirv] dot product and a few more GLSL ops 2020-08-27 11:49:38 -04:00
Dzmitry Malyshau
4a61705201 Add matrix transposition expression 2020-08-27 11:49:38 -04:00
Dzmitry Malyshau
91a7bdf7e7 [spirv] handle LOD and BIAS image operands 2020-08-27 11:49:38 -04:00
Dzmitry Malyshau
58b35f13ba [spirv] refactor builtin handling 2020-08-27 11:49:38 -04:00
Pelle Johnsen
e41dc6958c Make CI test on multiple rust versions (#159)
Use 1.41.0 and nightly
2020-08-27 10:30:04 -04:00
João Capucho
64bb2104cf glsl-out: Less allocations, handle struct member origin and correctly handle empty names (#160)
* Removed half of the clones
Fixed struct field names with invalid ident

* Fix struct member origin not being respected

* is_valid_ident handles empty names
2020-08-27 10:26:55 -04:00
Matus Talcik
df8364f92c Add kill, unreachable + switch (#156) 2020-08-26 20:29:18 -04:00
Dzmitry Malyshau
03becf1a17 Force width=4 in all shader-matched variables 2020-08-26 15:53:39 -04:00
Dzmitry Malyshau
b5475d7d80 Update naga to 4797773152 2020-08-26 15:35:14 -04:00
Dzmitry Malyshau
4797773152 Image IR refactor (#153) 2020-08-26 13:26:51 -04:00
João Capucho
f7c5e4873e Made the output of glsl-out more human readable (#154) 2020-08-26 12:29:33 -04:00
bors[bot]
5b67fe71f8 Merge #897
897: Improve diagnostics of incompatible attachments r=kvark a=scoopr

**Description**
Attempt to improve the diagnostics of incompatible attachments


Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-08-26 13:18:54 +00:00
Mikko Lehtonen
dbd6081a8e Improve diagnostics of incompatible attachments 2020-08-26 10:03:44 +03:00
João Capucho
ac66d149a4 Fixed names beginning with digits and arguments without names (#151) 2020-08-25 15:54:13 -04:00
Pelle Johnsen
6a3af2fe87 Add dependency on serialize for Rosetta tests (#150)
* Add dependency on serialize for Rosetta tests

Fixes #149

* Also run default cargo test on CI
2020-08-25 13:51:27 -04:00
crispweed
25aab2d6c5 [rs] 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]
59f0996eab Merge #895
895: Improve validation in B2B copies and RenderCommands 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._
Validation for the following have been added-
- Validate all parameters in B2B copy even if `copy_size == 0`.
- Check for copy operations issued within same buffer.
- `RenderPass.setViewport()`
- `RenderPass.setScissorRect()`

**Testing**
_Explain how this change is tested._
Tested with CTS in Servo. More tests pass now. Will test on wgpu-rs now.
<!--
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-08-24 18:00:47 +00:00
bors[bot]
bf734d1005 Merge #893
893: Improve texture creation validation r=cwfitzgerald a=kvark

**Connections**
Fixes https://github.com/gfx-rs/wgpu-rs/issues/528#issuecomment-678853886

**Description**
Improves the mipmap levels check.
Note that it also removes the `TooManyLayers` error, and instead produces max `u16` value. This is to be followed up with a check for *real* limits, which has to happen regardless, and trying to catch it on the number conversion step seems wasteful.

**Testing**


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-24 17:49:10 +00:00
Dzmitry Malyshau
0779a5ce2f Allow CI fail on Windows Nightly, for now 2020-08-24 13:48:08 -04:00
Kunal Mohan
a10e5cdb53 Check whether attachments are of same size or not 2020-08-24 23:02:04 +05:30
Dzmitry Malyshau
b8b7561796 Improve texture creation validation 2020-08-24 13:00:34 -04:00
Kunal Mohan
f266431f24 Improve validation in b2b copies and RenderCommands 2020-08-24 21:14:07 +05:30
Pelle Johnsen
92c1ffb588 Add initial Rosetta testing (#148)
* Add initial Rosetta testing

* Make rosetta tests run as part of cargo test

* Fix rosetta test failure
2020-08-24 00:09:37 -04:00
Matus Talcik
c12c9a9fac init control flow graph (#122)
format

major refactor


Change spirv to spirv_headers


Remove files


First translation to naga + format


Fix Int Constant error


Don't add unnecessary blocks.


Some cleanups


format


remove constructs


docs


fix debug leftovers


format, clippy


satisfy clippy
2020-08-23 23:14:51 -04:00
bors[bot]
e0b6a17f84 [rs] 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
21602e311c [rs] Add optional border_color to SamplerDescriptor 2020-08-22 22:00:33 -07:00
bors[bot]
3adebcb2dd [rs] 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
bors[bot]
0bb6bb8647 Merge #891
891: Add AddressMode::ClampToBorder behind a feature r=kvark a=jshrake

**Connections**
Closes #890 
Linked to https://github.com/gfx-rs/wgpu-rs/pull/526

**Description**
- Adds support for border sampler addressing behind a new feature Features::ADDRESS_MODE_CLAMP_TO_BORDER.
- Adds a new enum SamplerBorderColor so that users can optionally specify a supported border color on the SamplerDescriptor.

**Testing**
Tested against the Metal (MacOS 10.15) and Vulkan (Ubuntu 18.04) backends.

Ran the wgpu-rs/cube example and switched the address modes to AddressMode::ClampToBorder, without enabling the feature, and confirmed I received an error message. Ran the same example with the new feature specified in the optional_features return and confirmed that the example ran and looks reasonable.

Co-authored-by: Justin Shrake <justinshrake@gmail.com>
2020-08-22 21:46:19 +00:00
Justin Shrake
19eeee27ee Add AddressMode::ClampToBorder behind a feature 2020-08-22 13:23:50 -07:00
Andreas Reich
8dd3e31a57 [rs] Added debug marker/groups for ComputePass & CommandEncoder 2020-08-22 21:37:01 +02:00
João Capucho
5d9489871d Add support for glsl es in the glsl backend (#128)
* Initial glsl es 300 support

* Set float default precision

* Generate interface blocks and check storage class in es

* Added more checks on es and fixed uniform blocks with same name type

* Added image checks

* Added the test to the makefile

* applied comments
2020-08-22 10:50:54 -04:00
bors[bot]
b3f31a0f8c [rs] 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
bors[bot]
85b18562ce Merge #889
889: Fix swapchain preferred format r=kvark a=kvark

**Connections**

**Description**
The old API was wrong because the idea is to query the format *before* creating a swapchain, not after it:)

**Testing**
nah, should just work

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-08-21 16:33:56 +00:00
Dzmitry Malyshau
6f1d6145f5 Fix swapchain preferred format 2020-08-21 12:31:52 -04:00
Pelle Johnsen
cf39a88f21 [glsl-new] match wgsl expression order (#147) 2020-08-21 10:13:36 -04:00
Dzmitry Malyshau
82866bac4a [rs] 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
Lachlan Sneff
e9d00d38a4 Make "None" interpolation mean default or nothing, depending on context (#146)
* Make no interpolation mean default or nothing, depending on context

* Re-add Interpolation::Perspective
2020-08-21 00:41:14 -04:00
Lachlan Sneff
6026e57404 [wgsl] Add more complete function calling support (#144)
* Add function calling support to wgsl frontend

* Fix external namespace with multiple namespaces

* changes after code review

* Don't re-tokenize std_namespace every time
2020-08-21 00:13:25 -04:00
Lachlan Sneff
5035362ee6 Better floating point support for wgsl (#142)
* Add custom consume_number function for consuming numbers into tokens to wgsl frontend

* clippy
2020-08-20 01:41:24 -04:00
Lachlan Sneff
bd276bf4a4 Add more builtins to wgsl frontend (#143) 2020-08-20 01:39:27 -04:00
Lachlan Sneff
88fb1bb22a [wgsl] Support for composite constant expressions. (#141)
* Add composite constant expression support to wgsl

* remove matching on reference

* Re-fix reference matching
2020-08-19 20:48:09 -04:00
Lachlan Sneff
8c0b1636ea Interpolation support for wgsl, glsl, glsl-new, spirv (front and back), and glsl-out (#140)
* Add interpolation support to naga core and wgsl

* Add glsl-new fragment shader support to examples/convert.rs

* Add interpolation support to glsl_new

* Add interpolation support to spirv frontend

* Add interpolation support to spirv backend

* Add interpolation support to glsl backend

* Add interpolation support to old glsl backend

* Fix interpolation field syntax in glsl backend

* Formatting fix

* thanks clippy

* Add wgsl struct interpolation decoration

* Change wgsl interpolation syntax

* Modify interpolation enum

* Changes responding to review

* Remove interpolation struct member qualifier

* code changes after review
2020-08-19 20:22:21 -04:00