Commit Graph
9013 Commits
Author SHA1 Message Date
Christofer Nolander 06316c1bac hal/metal: support Features::NON_FILL_POLYGON_MODE (#1885)
* hal/metal: support Features::NON_FILL_POLYGON_MODE

* Document Metal support for NON_FILL_POLYGON_MODE

* Split Features::NON_FILL_POLYGON_MODE in two

Adds two new features: `LINE_POLYGON_MODE` and `POINT_POLYGON_MODE`.

Allows metal to support `PolygonMode::Line` while not being required to
support `PolygonMode::Point`.

* Formatting

* Rename {LINE,POINT}_POLYGON_MODE to POLYGON_MODE_{LINE,POINT}
2021-08-31 16:20:38 +00:00
João Capucho bd411c28c2 [glsl-in] Allow code after terminator statements (#1308)
* [glsl-in] Allow code after terminator statements

* [glsl-in] Track finished state in the context

* [glsl-in] Cull statements after terminators
2021-08-31 12:15:30 -04:00
Riccardo Zaglia 0a2be6099c Add Texture::as_hal() 2021-08-31 10:30:23 -04:00
Luca Casonato 9606f9cc40 Align wgpu_types serde serializations to spec
The representation of most wgpu_types objects now aligns to how the
WebGPU spec represents them. Enums are serialized as kebab-case strings,
and structs are serialized as camelCase objects.
2021-08-31 10:27:24 -04:00
chee d36c74e1fe Fix a few comments. 2021-08-31 09:52:01 -04:00
Dzmitry Malyshau 43872d4544 hal/gles: fix the VB stride limit 2021-08-30 16:49:54 -04:00
Jim Blandy 995a7752a9 [spv-out] Replace map_dim with a From implementation. 2021-08-30 13:24:41 -04:00
Jim Blandy b35e40ec59 [spv-out] Use bit flags in LocalImageType, instead of bools. 2021-08-30 13:24:41 -04:00
Jim Blandy b226c5108a [spv-out] Add test for duplicate OpTypeImage instructions. 2021-08-30 13:24:41 -04:00
Jim Blandy 81fbad182c [spv-out] Avoid generating duplicate OpTypeImage instructions.
Fixes #1305.

Ensure that two `back::spv::LocalType::Image` values are sure to be equal (and
hash equal) whenever they would generate the same `OpTypeImage` instruction, so
that the usual duplicate removal via `Writer::lookup_type` works. Accomplish
this by changing the contents of `LocalType::Image` to more closely match the
operands of `OpTypeImage` instructions.

Previously, `LocalType::Image` included a `ImageClass::Storage::access` value,
which did not affect the `OpTypeImage` instruction generated. If two
`LocalType::Image` values differered only in their `access`, then they would get
separate entries in `Writer::lookup_type`, two identical `OpTypeImage`
instructions would be generated, and SPIR-V validation would fail.
2021-08-30 13:24:41 -04:00
Jim Blandy 5b1c2e59f6 [spv-out] Write debug names for all types, not just structs.
This affects a lot of snapshots, so it's in its own commit, for easier review.
2021-08-30 13:24:41 -04:00
Jim Blandy 6b72099d76 [spv-out] Let write_type_declaration_local handle all LocalTypes.
Change `write_type_declaration_local` to handle any type that can be represented
as a `LocalType`. This means that Image and Sampler types are handled there now.

Change `write_type_declaration_arena` to defer to `write_type_declaration_local`
to handle any type that can be represented as a `LocalType`. This makes the code
for those types in `write_type_declaration_arena` redundant, so remove it.

However, continue to request SPIR-V capabilities for image types from
`write_type_declaration_arena`, since that function is fallible, while
`write_type_declaration_local` is not.
2021-08-30 13:24:41 -04:00
Jim Blandy e8d35e8035 [spv-out] Avoid duplicate lookup in write_type_declaration_local. 2021-08-30 13:24:41 -04:00
Jim Blandy 846dbb5a3e [spv-out] Request proper capabilities for storage image formats. 2021-08-30 09:02:46 -07:00
Igor Shaposhnik f7040a2787 [hlsl-out] Fix output struct member names 2021-08-30 10:59:15 -04:00
Connor Fitzgerald b04b6ade8d Merge pull request #1884 from dev-chee/master
Fix some comment error.
2021-08-30 01:25:41 -04:00
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