Commit Graph

9013 Commits

Author SHA1 Message Date
SparkyPotato
e6bd2e9071 fix panic on invalid zero array size 2023-02-01 12:28:31 +01:00
SparkyPotato
bb20ae8e79 check for leading { while parsing a block 2023-02-01 12:28:31 +01:00
Dzmitry Malyshau
16be1a9237 spv-out: support version 1.4 (#2230)
* spv-out: support version 1.4

* Extract SPV version numner from the comment
2023-02-01 12:24:05 +01:00
Evan Mark Hopkins
6be394dac3 Add countLeadingZeros (#2226)
* Add countLeadingZeros

* [glsl-out] Bake countLeadingZeros

* [hlsl-out] Bake countLeadingZeros

* [hlsl-out] Update Baked expressions

* Remove unnecessary bake for sints

* [glsl-out] CountLeadingZeros without findMSB

* Don't check negatives when uint

* Perform the type conv after mix

* use log2

* fix clippy lints

---------

Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-01-31 21:31:05 +01:00
teoxoy
a2b39e45bf [hlsl-out] clear named_expressions inserted by duplicated blocks
changed the type of `named_expressions` from `HashMap` to `IndexMap` so that insertion order is preserved
2023-01-31 10:43:02 -08:00
João Capucho
0074c68ec4 valid: Check dependencies between functions calls
This commit enforces the forward dependency rules on the IR across
functions and their calls, this fixes a crash in a later stage of the
validator.
2023-01-31 07:35:31 -08:00
João Capucho
bebaac93b6 valid: Fix handle dependency validation
The handle dependency validation code was using the handle's index
directly while trying to erase the handle type. This would cause the
validator to crash while processing the first handle of the arena since
it would be trying to construct a `NonZeroU32` with a zero.

This commit fixes the issue by adding 1 to the index which not only
fixes this panic but also makes so that the created Handle is equal to
the passed handle (minus the type that was erased)

It also fixes the error message not including the subject's kind
2023-01-31 07:35:31 -08:00
Shaye Garg
67ea8f0c06 [wgsl-in] Split into multiple files (#2207)
Make changes suggested in #2075, but put off to a separate PR because they would interfere with reviewing the change:

- Split the new WGSL front end into modules in a logical way.
- Rename `Parser` to `Frontend`.
2023-01-31 07:17:58 -08:00
João Capucho
ae049edc49 glsl-in: Add not vector relational builtin 2023-01-31 13:29:37 +00:00
João Capucho
191d71c107 glsl-in: Add test for relational vector builtins 2023-01-31 13:29:37 +00:00
João Capucho
372a715434 glsl-in: Add double overloads for relational vector builtins
All relational vector builtins that operate on floats can also operate
on doubles but these overloads were not present. This commit fixes that.
2023-01-31 13:29:37 +00:00
João Capucho
08366c8fd0 glsl-in: Add bool overloads for relational vector builtins
The `equal` and `notEqual` builtins also operate on boolean vectors but
the overloads accepting them were not added. This commit fixes that.
2023-01-31 13:29:37 +00:00
Nicolas Silva
48d8666de0 Remove some workspace inheritence from wgpu-types/Cargo.toml. (#3439)
Unfortunately that breaks the cargo vendor stuff in mozilla-central even though it is part of a build configuration that m-c does not use.
2023-01-31 12:28:42 +01:00
Jim Blandy
ca99d8bcbc Inline identifiers into format strings.
[Since Rust 1.58], Rust format strings have been able to "capture
arguments simply by writing {ident} in the string." Clippy 1.67 made
the corresponding warning, `uninlined_format_args`, warn-by-default.
Inlined arguments seem more readable, so Naga should adopt them.

[Since Rust 1.58]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1580-2022-01-13
2023-01-31 11:27:51 +01:00
Jim Blandy
26dca556a9 Allow clippy::needless_borrowed_reference.
In Clippy 1.67, the `needless_borrowed_reference` lint [was enhanced]
to look into struct and tuple patterns, so that a line like this:

    for &(ref module, ref info) in inputs.iter()

where `inputs.iter()` is yielding `&(Module, ModuleInfo)` pairs,
elicits a warning. Clippy suggests, instead:

    for (module, info) in inputs.iter()

but this is at odds with Naga's preference that `match` patterns
should have the same type as the expression being matched, for which
we have enabled the `pattern_type_mismatch` lint since
9e5cc4c9 (2021-3-12).

[was enhanced]: https://github.com/rust-lang/rust-clippy/pull/9855
2023-01-31 11:27:51 +01:00
Teodor Tanasoaia
98ea3500fd copyTextureToTexture src/dst aspects must both refer to all aspects of src/dst format (#3431)
* src/dst aspects must both refer to all aspects of src/dst format

* add changelog entry
2023-01-28 17:08:21 +01:00
Jinlei Li
b31069f14a Improve vk format msaa capabilities detection (#3429)
* Improve vk format msaa capabilities detection

* Update CHANGELOG

* Follow the suggestions

* Update wgpu-hal/src/vulkan/adapter.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-01-28 12:03:43 +00:00
Raph Levien
fe2b230b0e Implement clear_buffer on web (#3426) 2023-01-26 22:32:34 +00:00
Connor Fitzgerald
659f697705 Add naga section in changelog v0.15.0 2023-01-25 19:45:50 -05:00
Connor Fitzgerald
b04cae69c0 Fix winapi features wgpu-v0.15.0 wgpu-hal-v0.15.1 2023-01-25 19:38:29 -05:00
Connor Fitzgerald
cf17230e32 Fix d3d12 version 2023-01-25 19:32:47 -05:00
Connor Fitzgerald
71e7bb2cf9 Fix wgpu versioning 2023-01-25 19:30:45 -05:00
Connor Fitzgerald
007d933260 Fix wgpu-core versioning 2023-01-25 19:30:39 -05:00
Connor Fitzgerald
c3ed411375 Fix wgpu-hal versioning wgpu-hal-v0.15.0 2023-01-25 19:27:20 -05:00
Connor Fitzgerald
d3fec9524f Release of 0.15 (#3424) wgpu-types-v0.15.0 2023-01-25 19:25:41 -05:00
Teodor Tanasoaia
d2809137ba Zero-initialize workgroup memory (#3174)
fixes https://github.com/gfx-rs/wgpu/issues/2430
2023-01-25 18:28:35 -05:00
Connor Fitzgerald
f3090955e1 Move surface view formats to a vec (#3423) 2023-01-25 22:17:56 +00:00
Connor Fitzgerald
f0edae8ce9 Update to 0.11 (#2222) naga-cli-v0.11.0 naga-v0.11.0 2023-01-25 21:27:09 +00:00
Jinlei Li
33f94c7c84 Implement view_formats for SurfaceConfiguration (#3409)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-01-25 21:04:41 +00:00
Connor Fitzgerald
b940b1d71a Merge pull request #41 from cwfitzgerald/release-0.6 d3d12-v0.6.0 2023-01-25 16:04:10 -05:00
Connor Fitzgerald
7f9735fda6 Release 0.6 2023-01-25 16:00:25 -05:00
Teodor Tanasoaia
13944c0ae5 Update CHANGELOG.md 2023-01-25 15:11:16 -05:00
823984418
5ded4ba701 In IntelliJ Rust plugin, Declarative macro expansion of bitflags! fails when a backslash is present in rustdoc. (#3386) 2023-01-25 20:05:05 +00:00
Jinlei Li
0d433214c7 validate the number of color_attachments in begin_render_pass (#3404) 2023-01-25 14:48:27 -05:00
Teodor Tanasoaia
fe9db5dd8d install cargo-tarpaulin via cargo-binstall (#2220) 2023-01-25 18:21:24 +00:00
teoxoy
c7d02151f0 add support for zero-initializing workgroup memory 2023-01-25 18:07:48 +01:00
teoxoy
3ace8b81cb fix array being flagged as constructible when its base isn't 2023-01-25 18:07:48 +01:00
teoxoy
85e3b0844f add type_flags to ModuleInfo 2023-01-25 18:07:48 +01:00
teoxoy
a42857d291 [hlsl-out] simplify write_default_init 2023-01-25 18:07:48 +01:00
teoxoy
e5121ca012 factor out write_barrier functions 2023-01-25 18:07:48 +01:00
Patryk Wychowaniec
954cbaaff3 [spv-in] Support binding arrays (#2199) 2023-01-25 17:49:52 +01:00
Jinlei Li
969af43c05 move require_downlevel_flags(VIEW_FORMATS)? from create_texture_view() to create_texture() (#3420) 2023-01-25 17:33:58 +01:00
Almar Klein
9908f3ed04 Add test for writing a 3D texture (#3418) 2023-01-24 17:06:09 -05:00
IceSentry
bb876f372a Better error message for 16 byte alignment error (#3414)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: gilescope <gilescope@gmail.com>
Closes https://github.com/gfx-rs/wgpu/pull/3099
Closes https://github.com/gfx-rs/wgpu/issues/2832
2023-01-24 20:46:19 +00:00
Elabajaba
5da2b8ad6b implement add_srgb_suffix for TextureFormat (#3419) 2023-01-24 15:16:45 -05:00
Ashley
c039a74884 [WebGL] Allow creating a texture from an external web_sys::WebGlFramebuffer and writing to it (#2609) 2023-01-24 13:47:03 -05:00
Connor Fitzgerald
95a760bb42 Implement queue.copy_external_image_to_texture for WebGL2 and improve WebGPU Impl (#3288)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Closes https://github.com/gfx-rs/wgpu/issues/1888
2023-01-24 18:44:15 +00:00
Teodor Tanasoaia
964c94a02d Update TextureView validation (#3410)
* update TextureView validation

* add changelog entry

* remove call to clone

* dereference instead
2023-01-24 12:02:16 +01:00
Josh Groves
5a999e624a Update glow to 0.12.0 (#3417) 2023-01-24 02:36:31 +00:00
Jinlei Li
4cd753bccd vk: improve view_formats setting (#3412)
* vk: improve view_formats setting

* Fix extension detection

* Update wgpu-hal/src/vulkan/device.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Follow the suggestion

* Tiny doc fix

* Follow the suggestion

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-01-23 16:02:25 +01:00