Commit Graph
8897 Commits
Author SHA1 Message Date
chee 5cdbf3f946 Fix some comment error. 2021-08-30 12:33:18 +08:00
Jim Blandy cb0ad2504c [spv-out] Handle break and continue in switch statements.
Fixes #1030.
Fixes #1017.
2021-08-27 16:39:59 -07:00
Christofer Nolander 39e8921fe8 example-framework: resize surface on scale factor change 2021-08-27 15:10:03 -04:00
Dzmitry Malyshau c3de161dd2 hal/metal: inherit scaling from NSView 2021-08-27 13:39:13 -04:00
Jim Blandy 28547e3d3b Gather index, buffer, and texture bounds check policies into a single struct. 2021-08-26 19:08:06 -04:00
Jim Blandy 496525b7d3 Improve help messages, defaults for CLI bounds checking options. 2021-08-26 19:08:06 -04:00
Jim Blandy 1b95e023e7 [spv-out] Support a separate bounds check policy for buffers. 2021-08-26 19:08:06 -04:00
Jim Blandy 140e3223e2 snapshot tests: Parse bounds checks policy properly. 2021-08-26 19:08:06 -04:00
Jim Blandy bdf774aa8b Rename BoundsCheckPolicy::UndefinedBehavior to Unchecked.
When we are leaning on robust buffer access to do the job for us, there's no
undefined behavior going on. So `UndefinedBehavior` suggests people are doing
something reckless even if they're not. The policy just says what Naga is doing,
and it shouldn't pretend to say what the rest of the system is doing.
2021-08-26 19:08:06 -04:00
Dzmitry Malyshau 5fd4fffdde hal/dx12: don't assume D3DCompile error is some 2021-08-26 17:14:58 -04:00
Dzmitry Malyshau 1e9f2b9287 Add atomicSubtract support 2021-08-26 11:50:21 -04:00
Dzmitry Malyshau 42194168e0 Fix implicit storage texture access 2021-08-26 11:36:05 -04:00
Dzmitry Malyshau 715a53f891 [msl-out] don't pack location fields 2021-08-25 16:52:45 -04:00
Hans Christian Schmitz db845347f2 Fix fuzzing setup
Set naga features in `fuzz/Cargo.toml` to those required for SPIR-V and
WGSL input.
Also bump libfuzzer-sys version.
2021-08-25 11:45:52 -04:00
Riccardo Zaglia 1c086a51ff hal/vk: Allow non-owned Instance and Device from raw; allow owned Texture from raw 2021-08-25 00:34:19 -04:00
Dzmitry Malyshau 590ef1d8cf Switch naga to latest on git (#1858) 2021-08-24 18:20:44 -04:00
fsh f11afd4fcf [glsl-in] Avoid infinite loop when parsing invalid statements (#1280) 2021-08-24 19:46:54 +00:00
Connor Fitzgerald 0a3fd15fe3 Merge pull request #1855 from kvark/vertex-offset
Bump the vertex buffer sizes by 1
2021-08-24 13:54:55 -04:00
Dzmitry Malyshau 43d44c89e1 Bump the vertex buffer sizes by 1 2021-08-24 13:39:57 -04:00
Hugo Woodiwiss 663cb309a0 Update web-sys 0.3.51 to 0.3.53 (#1844)
* Update web-sys to work with newer ff nightly

* Update wgpu for web-sys 0.3.53

* Implement get_current_texture for web backend

* Set access for GpuStorageTextureBindingLayout

* Move inline mapping to use existing mapping fn

* Implement SPV to WGSL Conversion

Error handling is not completed yet.

* Update spv to wgsl conversion to match existing

Move to using spv::Parser struct
Remove need for unsafe block
Copied from https://github.com/gfx-rs/wgpu/blob/f3c9f412f69f367419cd4ac847f0a20f1f34d56e/wgpu/src/backend/direct.rs#L971-L978

* Add spirv-web feature

For spir-v --> wgsl conversion in the web backend

* Update README to include spirv-web
2021-08-24 15:52:08 +00:00
aentity a35de06f33 Update deps petgraph and rose-tree 2021-08-24 01:51:52 -04:00
Hans Christian Schmitz 58a5b7d2b9 Implement lexing and parsing for all WGSL number literal types (#1184)
* Implement lexing for all WGSL number literal types

* Move number literal test cases

* Adjust tests to match WGSL spec on number literals

Suffixes are not type names and currently only a plain `u` is supported
for uints. More specifically, `i` and `f` suffixes or suffixes with
widths in bits like `u32` are not supported at the moment.

* Add more tests for invalid number literal suffixes

* Replace code too new for Rust 1.43

* Implement parsing for hexadecimal integers

* Switch to enum number types, and Bytes for width

* Check for negative and leading zeros in int literals

* Implement parsing of hex floats with hexf-parse

* Update error message tests

* Update snapshot test output files

* Clean up lexer state machine code

* Clean up unexpected token error code

* Move number literal parsing to own submodule
2021-08-24 01:50:53 -04:00
Dzmitry Malyshau 0e65b9323a hal/dx12: do not reverse the pipeline layout (#1857) 2021-08-24 01:39:44 -04:00
Jim Blandy 93db57c12b [wgsl-in] Test validation of arrays with zero and negative lengths. 2021-08-23 15:57:23 -04:00
Dzmitry Malyshau c05b064bc8 Check for query resolve alignment (#1853) 2021-08-23 12:32:18 -04:00
Jim Blandy 9713dbbbc1 [spv-out] Quick tests for capability requests. 2021-08-23 09:10:16 -07:00
Jim Blandy b56349e9bf [spv-out] Fix the processing of cube array images.
Using 1D images should require either the `Sampled1D` or `Image1D` capability.

Using cube array images should require either the `SampledCubeArray` or
`ImageCubeArray` capability.
2021-08-23 09:10:16 -07:00
Connor Fitzgerald cb233d861b Merge pull request #1847 from kocsis1david/storage-mip-level-count
fixed mip level count check for storage textures
2021-08-23 12:02:46 -04:00
Dávid Kocsis f34f88538b fixed mip level count check for storage textures 2021-08-23 17:49:20 +02:00
Dzmitry Malyshau f3c9f412f6 Validate against cube storage textures (#1846) 2021-08-23 02:17:28 -04:00
Dzmitry Malyshau ea883d98e2 [spv-in] track function parameter sampling flags across handle permutation 2021-08-23 01:48:45 -04:00
Jim Blandy 901e2c0694 [spv-out] Implement BoundsCheckPolicy for image access 2021-08-22 23:41:27 -04:00
Jim Blandy c6ecd973e7 [spv-out] Use Selection for building conditionals.
Introduce a helper type that manages the details of emitting SPIR-V
conditionals, tracking labels, branches, merge annotations and phi nodes.

Change index bounds checks to use this helper.
2021-08-22 23:41:27 -04:00
Jim Blandy 99de387302 [spv-out] Move image operations into their own module.
For ease of review, there should be no meaningful code changes in this commit.
Match arms are merely moved out into their own functions, whose arguments are
the enum variant's fields, along with any free variables from the function
containing the match.
2021-08-22 23:41:27 -04:00
Jim Blandy 3f4cd9dc88 [spv-out] Add GlobalVariable helper functions. 2021-08-22 23:41:27 -04:00
Jim Blandy c1121a1e62 [spv-out] Use 'image' instead of 'texture', consistent with SPIR-V. 2021-08-22 23:41:27 -04:00
Jim Blandy de114e479b Rename IndexBoundsCheckPolicy to BoundsCheckPolicy. 2021-08-22 23:41:27 -04:00
Wumpf 9e1384dbb0 Memory init tracker refactor (#1839)
* split out init_tracker module
with explicit buffer init tracking types

* Added shortcut methods for checked init action handling
Fixed a few unchecked sites in the process

* fix clippy warnings
2021-08-22 22:46:13 -04:00
João Capucho fd10b7d9e8 [glsl-out] Modulo operator on float must be converted to mod function (#1271)
Fixes #1266
2021-08-22 22:43:52 -04:00
Dzmitry Malyshau 81f4ff032f HLSL: rewrite handling of interface matching rules (#1276)
* [hlsl-out] flatten the entry point inputs

Previously, the logic was re-ordering the inputs according to the binding.
This breaks if one of the inputs is a struct. With this change, the struct
fields are also flattened into the fake entry point struct. We also
construct the original arguments at the beginning of the function.

* hlsl-out: completely separate the flattened IO structs from the original IR structs

Previously, we had heuristics to detect if a particular struct needs the fields
to be re-ordered. We'd re-order interface structs without layout, and the detection
was very fragile and easily wrong.
The new logic is spawning separate struct types if we need any re-ordering to happen.
It's solid, there are no heuristics.
2021-08-22 22:40:31 -04:00
Jim Blandy 63e58f2022 [wgsl-in] Print errors nicely in convert_wgsl snapshot tests. (#1274) 2021-08-22 22:31:11 -04:00
Igor Shaposhnik 464788dc8d [hlsl-out] Implement switch statement (#1265)
* [hlsl-out] Implement switch statement

* [hlsl-out] Implement switch statement

* Add switch tests to control-flow snapshot
2021-08-22 22:30:22 -04:00
Andreas Reich 7f395b39af fix buffer collapse in initialize_buffer_memory
due to previous changes there was  only a no-op buffer collapse
The ranges it tried collapsing on were already guranteed to be merged by the init-trackers drain method. However, accross several init actions there can be opportunity for reducing fill_buffer calls.
2021-08-22 22:26:55 -04:00
João Capucho b0569d9593 [glsl-in] Add support for derivative functions 2021-08-22 22:21:30 -04:00
Mikko Lehtonen 222e0949bd [msl-out] Fix gradient sampling typo 2021-08-22 22:20:42 -04:00
Connor Fitzgerald 800f910103 Allow newer bitflags 2021-08-22 22:19:27 -04:00
Connor Fitzgerald 400fa44f88 Merge pull request #1838 from ngrid-io/master
use self
2021-08-20 22:56:20 -04:00
adamnemecek efd52e02af use self 2021-08-20 19:36:06 -07:00
Dzmitry Malyshau 70be72d9b9 [spv-in] fix expression emit in image store 2021-08-20 21:35:48 -04:00
João Capucho c09354c78e [glsl-in] Add support for float encoding/decoding builtins
Fixes #1246
2021-08-20 20:41:13 -04:00