Commit Graph

16 Commits

Author SHA1 Message Date
Erich Gubler
611da6da2d fix(msl-out): emit and init struct member padding always
Previously, implicit padding members of `struct`s were suppressed from
structure definitions in Metal output if they had a binding specified
for them (i.e., `@location(0)`). This padding is, however, is necessary
for correct access of member fields passed into shaders by uniform and
storage buffers. Unconditionally emit padding members for `struct`s.

Resolves
[`gfx-rs/wgpu`#4701](https://github.com/gfx-rs/wgpu/pull/4701).
2023-11-22 03:54:16 -07:00
Connor Fitzgerald
1df98d9888
Test And Normalize Vertex Behavior on All Backends (#4723)
Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-11-21 22:11:24 +00:00
Jim Blandy
a820a3ffba [naga]: Make snapshot tests include paths in errors.
Following Rust convention, let `naga::front::wgsl::ParseError`'s
methods `emit_to_stderr_with_path` and `emit_to_string_with_path`
accept any `AsRef<Path>` argument as the path.

Pass input paths in snapshot tests, so that failures processing
shaders name the input file being processed.
2023-11-21 21:47:03 +01:00
Jim Blandy
104119a402 [naga] Fix type error in test.
Change the WGSL code in the `function_returns_void` test in
`tests/wgsl-errors.rs` so that the construction expression types
correctly. Subsequent iterations of the WGSL front end will be doing
some type checking earlier, to support WGSL's automatic conversions,
and without this fix, this test will stop checking what it is intended
to check.
2023-11-21 21:41:39 +01:00
Jim Blandy
72462267e8 [naga]: Let TypeInner::Matrix hold a Scalar, not just a width.
Let `naga::TypeInner::Matrix` hold a full `Scalar`, with a kind and
byte width, not merely a byte width, to make it possible to represent
matrices of AbstractFloats for WGSL.
2023-11-21 12:02:50 +01:00
Jim Blandy
fd53ea90e6 [naga] Let constant evaluation of As preserve Splat expressions.
When asked to evaluate an `Expression::As` cast applied to a `Splat`
expression, change `ConstantEvaluator::cast` to preserve the `Splat`,
rather than expanding it out to a `Compose` expression.
2023-11-17 16:20:11 -08:00
Teodor Tanasoaia
a26e4a009a
[naga] remove span and validate features (#4706) 2023-11-17 13:37:25 -05:00
Fredrik Fornwall
a5c93caa56
Add more metal keywords (#4707) 2023-11-17 17:02:36 +01:00
Jim Blandy
3ec547cdca [naga] Preserve spans when compacting Arenas.
When compacting a module, properly adjust spans along with `Arena`
contents.
2023-11-16 22:50:54 +01:00
Jim Blandy
b7dd59e1dc [naga] Let constant evaluation handle Compose of Splat.
When consuming a `Compose` expression that constructs a vector,
flatten `Splat` subexpressions out into their components.

Fixes #4581.
2023-11-16 13:34:27 +01:00
Jim Blandy
ecb522e4e3 [naga] New tests for GLSL double-precision builtin functions. 2023-11-14 20:12:31 -08:00
Jim Blandy
9f91c95c24 [naga] Introduce Scalar type to IR.
Introduce a new struct type, `Scalar`, combining a `ScalarKind` and a
`Bytes` width, and use this whenever such pairs of values are passed
around.

In particular, use `Scalar` in `TypeInner` variants `Scalar`, `Vector`,
`Atomic`, and `ValuePointer`.

Introduce associated `Scalar` constants `I32`, `U32`, `F32`, `BOOL`
and `F64`, for common cases.

Introduce a helper function `Scalar::float` for constructing `Float`
scalars of a given width, for dealing with `TypeInner::Matrix`, which
only supplies the scalar width of its elements, not a kind.

Introduce helper functions on `Literal` and `TypeInner`, to produce
the `Scalar` describing elements' values.

Use `Scalar` in `wgpu_core::validation::NumericType` as well.
2023-11-14 14:21:27 +01:00
Connor Fitzgerald
7f72c9fc3b
Fix GL Push Constant Layout (#4607)
* It verks!

* More tests

* Fixes

* Working multi-stage push constants

* Comments

* Add push constant partial update teste

* Docs

* Update Cargo.toml

* Comments
2023-11-06 07:58:26 -05:00
Jim Blandy
61bca7e0aa
wgsl-errors: Reverse "old" and "new" sides of diff output. (#4577)
When an error snapshot test fails and we generate a diff comparing the
expected output with the actual output, treat the expected output as
the diff "from", and the actual output as the diff "to" - not the
reverse.
2023-10-26 20:12:39 -04:00
Connor Fitzgerald
34e947de4b
Integration of Naga into Repo (#4296) 2023-10-25 16:51:36 -04:00
Connor Fitzgerald
5369eec3b2
Move naga to subfolder 2023-10-25 14:25:04 -04:00