Commit Graph

9013 Commits

Author SHA1 Message Date
Systemcluster
539db1a317 [wgsl] support for statement 2021-02-15 23:51:19 -05:00
Dzmitry Malyshau
e6251a23fe [wgsl] fix boolean types and bang parsing 2021-02-15 22:59:04 -05:00
bors[bot]
94ee3d6c33 Merge #1219
1219: Validate texture bindings r=cwfitzgerald a=kvark

**Connections**
It was mentioned/requested somewhere, but I can't find the place...

**Description**
Fairly straightforward - just check the view properties against the bind group layout.

**Testing**
Tested on wgpu-rs examples

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-16 02:42:23 +00:00
Dzmitry Malyshau
9bf47dd772 Validate texture bindings 2021-02-15 20:14:23 -05:00
Dzmitry Malyshau
91a1f581e0 Fix insta dependency to 1.5.2 2021-02-15 11:13:11 -05:00
Dzmitry Malyshau
6d0c608626 [glsl-out] use existing Analysis instead of implementing Visitor 2021-02-15 11:13:11 -05:00
Joshua Groves
f42dc0c377 Fix some typos 2021-02-14 22:50:12 -05:00
Dzmitry Malyshau
ad423124c0 Support constants in the naming processor 2021-02-14 20:43:50 -05:00
Dzmitry Malyshau
61d711b58f Remove the Header from IR 2021-02-14 20:23:31 -05:00
Systemcluster
7a124550d4 [glsl-in] support inverse function 2021-02-14 12:34:26 -05:00
Systemcluster
b642c5b89b [spv-in] support string instruction 2021-02-14 11:57:26 -05:00
Systemcluster
dcd269782a [wgsl] restrict type casts to matching container types 2021-02-14 11:56:49 -05:00
Dzmitry Malyshau
18853ab149 Add warnings for trivial casts and clean them up in the code 2021-02-14 11:55:35 -05:00
Dzmitry Malyshau
8e96085caf [spv-in] support image load/store ops 2021-02-14 11:55:35 -05:00
Dzmitry Malyshau
de5bd77279 ImageStore statement in IR 2021-02-14 11:55:35 -05:00
Systemcluster
5de69f7276 Specify line endings in ron snapshot tests 2021-02-14 11:29:25 -05:00
Dzmitry Malyshau
08001981ba Add comments to Analysis methods and ControlFlags 2021-02-14 01:19:15 -05:00
Dzmitry Malyshau
c1fc5d6424 [msl] re-use expression results based on the analysis 2021-02-14 01:19:15 -05:00
Dzmitry Malyshau
eae40383d0 Add uniform control flow analysis to the validator 2021-02-14 01:19:15 -05:00
Dzmitry Malyshau
bde43cbec6 First uniform control flow tests 2021-02-14 01:19:15 -05:00
Dzmitry Malyshau
747040ee8a Analyzer processor - first draft 2021-02-14 01:19:15 -05:00
Anthony Cowley
d0ef4e9dbe [spv-out] support select expressions 2021-02-13 22:56:43 -05:00
Dzmitry Malyshau
8183f4ff6f [spv-out] annotate function and constant names 2021-02-13 19:37:54 -05:00
Dzmitry Malyshau
94bd97c0fb [wgsl] early depth test attribute 2021-02-13 12:49:23 -05:00
Dzmitry Malyshau
de39e7f4d1 [spv-in] patch function calls before deriving the global use 2021-02-13 12:33:15 -05:00
Dzmitry Malyshau
89f62bc584 [spv-out] make instruction constructions to be methods 2021-02-13 12:33:04 -05:00
Joshua Groves
9667a18980 [wgsl] Avoid consuming token twice in some cases 2021-02-13 00:13:23 -05:00
Joshua Groves
9c2a837a53 [wgsl] track number of bytes consumed per token 2021-02-13 00:13:23 -05:00
bors[bot]
0368bca1dd [rs] Merge #744
744: Demonstrate obj loading in the skybox example r=kvark a=kvark

I wanted to see which example is best suited for `typed-arena` demo... and here I am, implementing a completely different unrelated feature. But I think it's useful, still ;)
Model loading is something everybody needs, and for us depending on `obj` in dev-dependencies cost nothing, especially since I'm basically maintaining it.

<img width="395" alt="screenshot" src="https://user-images.githubusercontent.com/107301/106993149-186c7780-6748-11eb-94ca-7988ef9ee52d.png">


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-13 03:34:39 +00:00
Dzmitry Malyshau
1a9bd4d14b [rs] Stop using vertex attributes in the mipmap example 2021-02-12 22:33:17 -05:00
Dzmitry Malyshau
710901b1aa [rs] Demonstrate obj loading in the skybox example 2021-02-12 22:33:17 -05:00
Anthony Cowley
141d2e7661 [wgsl] ignore offset decorations on struct fields
naga does not require offset decorations on struct fields in WGSL
source, and automatically adds them to spv output. The `tint` compiler
does not automatically add them, and requires that they be present in
the WGSL source.

A potential confusion is that an spv binary missing required
`OpMemberDecorate` instructions that set the field's offset will fail
validation when run through `spirv-val`. But since naga automatically
produces these offsets, the same spv binary passed through naga will
be successfully validated.

This change is to ignore these decorations in naga's WGSL front end so
that the same WGSL source can be used with naga and tint to produce
valid spv.
2021-02-12 18:27:02 -05:00
bors[bot]
6442b947cb Merge #1210
1210: Reset the bindings on the push constant change r=wumpf a=kvark

**Connections**
Fixes #1207
(unconfirmed!)

**Description**
I was able to replay the trace in #1207 without validation errors, so I looked deeper into what might have gone wrong.
The code isolated in #1194 looks great. However, the calling code's handling of push constants might have changed a bit.
And I see that the trace uses push constants, so here is what happened, I think:
  - layout A was set, expecting bind group layouts X and Z
  - bind groups X and Y where bound
  - layout B was set, expecting bind group layout X and Y. We see that Y group can now be bound, so we do this. The old logic in this case wasn't considering the push constants in any way, it would only consider them if bind group layouts didn't change, erroneously.
  - layout B has different push constant ranges...

So it's a one-line fix now, which I'm hoping is correct.

**Testing**
Not tested
@Wumpf would you be able to check this?

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-02-12 21:10:26 +00:00
Dzmitry Malyshau
f3cab651bb [spv-out] support Switch statements 2021-02-12 10:17:27 -05:00
bors[bot]
835b374ebb Merge #1214
1214: fix rustdoc warnings r=kvark a=jakobhellermann

**Connections**
fixes #1213 

**Description**
Fixes rustdoc warnings (broken links, `<autourls>`)

**Testing**
`cargo doc` does not complain anymore.

Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
2021-02-12 15:04:46 +00:00
Jakob Hellermann
b89cb21ce3 fix rustdoc warnings 2021-02-12 13:56:51 +01:00
bors[bot]
218556c953 [rs] Merge #759
759: Correct FragmentState targets comment r=grovesNL a=Systemcluster

Previously the comment was copied verbatim from the `VertexState` `buffers` field. 

Co-authored-by: Chris <me@systemcluster.me>
2021-02-12 03:41:04 +00:00
Chris
795db84f38 [rs] Correct FragmentState targets comment 2021-02-12 04:29:06 +01:00
Dzmitry Malyshau
9b358efea1 [wgsl] support 'elseif' construct 2021-02-11 20:50:27 -05:00
Dzmitry Malyshau
86bb611905 [wgsl] support select() 2021-02-11 15:32:28 -05:00
Dzmitry Malyshau
692e82d521 Reset the bindings on the push constant change 2021-02-11 14:47:35 -05:00
bors[bot]
c71091b2e6 Merge #1209
1209: Handle player window resizing gracefully r=kvark a=kvark

**Connections**
Deprecates #794 and #793

**Description**
We were often getting this kind of errors when replaying on Linux:
>VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 (2094043421)] : Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x56194a357250, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (1980,1080), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (800,600), minImageExtent = (800,600), maxImageExtent = (800,600). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
object info: (type: DEVICE, hndl: 94666619187792)

It's annoying to work around!

**Testing**
Tested on replaying wgpu-rs stuff.

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-02-11 19:19:58 +00:00
Dzmitry Malyshau
b3387492a2 Handle player window resizing gracefully 2021-02-11 14:16:56 -05:00
Dzmitry Malyshau
b3d80de9e1 [spv-out] fix the clippy warning about Result type 2021-02-11 11:24:06 -05:00
Dzmitry Malyshau
38f3c4eb19 [spv-in] support dynamic vector insert/extract 2021-02-11 10:58:52 -05:00
Dzmitry Malyshau
49eb93cf7d [spv-in] support boolean constants 2021-02-11 10:58:52 -05:00
Dzmitry Malyshau
2507794bc6 [spv-in] add more capabilities we support 2021-02-11 10:58:52 -05:00
bors[bot]
7a9b622182 [rs] Merge #755
755: Add Instance::poll_all r=kvark a=lachlansneff

`Instance::poll_all` polls all devices. This will be useful for integrating into the winit event loop from a third-party crate.


Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com>
2021-02-11 15:52:26 +00:00
Pelle Johnsen
c04c971907 [glsl-in] Fix StorageClass for texture and sampler 2021-02-11 10:33:21 -05:00
bors[bot]
0542da88c9 [rs] Merge #756
756: Convert `PrimitiveState::cull_mode` to `Option<Face>` r=kvark a=yzsolt

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

Co-authored-by: Zsolt Bölöny <bolony.zsolt@gmail.com>
2021-02-11 15:29:30 +00:00