Commit Graph
8897 Commits
Author SHA1 Message Date
dependabot[bot] 72ff326b53 Bump bytemuck from 1.12.3 to 1.13.0 (#3470)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-10 17:09:40 +00:00
dependabot[bot] 492b877b68 Bump libc from 0.2.126 to 0.2.139 (#3469)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-10 17:06:57 +00:00
daxpedda 5677195873 Add Dependabot (#3468) 2023-02-10 11:51:06 -05:00
Teodor Tanasoaia 40b8f66146 Fix setup-dxc not found and make sure workflows run if their file was changed (#2247)
* fix setup-dxc not found

* run validation-windows if its workflow file was changed

* run validation-macos if its workflow file was changed

* run validation-linux if its workflow file was changed

* run lazy if its workflow file was changed
2023-02-10 13:44:57 +01:00
daxpedda 5b8c55c451 Build for WASM on docs.rs (#3462) 2023-02-09 15:38:40 -05:00
Jinlei LiandConnor Fitzgerald 4593f951dd vk: fix surface view formats validation error (#3432)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-02-09 13:00:42 -05:00
Jinlei Li 0d5b4841d5 web: reimplement adapter|device_features (#3428) 2023-02-09 12:14:15 -05:00
Teodor Tanasoaia 4bebad706e Improve CI (#3453) 2023-02-09 10:33:53 -05:00
Connor Fitzgerald 49cfc88f35 [GL] Unbind Vertex Buffers After Renderpass (#3459)
Closes https://github.com/gfx-rs/wgpu/issues/3457
2023-02-09 10:32:27 -05:00
Connor Fitzgerald f1ef213bbb Fix CI for merge queues 2023-02-08 19:52:25 -05:00
João Capucho f038537e61 glsl-in: Add tests for output parameters casts 2023-02-08 11:39:09 +00:00
João Capucho 0a2e93c098 glsl-in: Perform output parameters implicit casts
Glsl defines under `Function Definitions` (Paragraph 6.1 in glsl 4.60),
the following:

> When function calls are resolved, an exact type match for all
> the arguments is sought.
> (...)
> If no exact match is found, then the implicit conversions in
> section “Implicit Conversions” will be applied to find a match.
> (...)
> Mismatched types on output parameters (out or inout) must have a
> conversion from the formal parameter type to the calling argument type.

The glsl frontend wasn't performing this implicit cast for output parameters.

This commit fixes that by using a proxy write, this
creates a spill variable with the correct type and in the call
prologue a conversion is made back to the original type and the
value is stored in the original variable.
2023-02-08 11:39:09 +00:00
Jim Blandy b1d2ec043e Don't try to build the entire workspace on wasm32. (#3460) 2023-02-07 21:56:00 +00:00
Nathan Adams 238697c2da Add MULTISAMPLE_X16 texture format feature flag where supported (#3454) 2023-02-06 19:53:48 +01:00
Andreas Reich 3ea2c22c47 Fix for some minor issues in comments on some features. (#3455) 2023-02-06 18:19:33 +01:00
Teodor Tanasoaia 64f8691e52 Improve CI (#2241)
* update to actions/checkout@v3

* update to actions/upload-artifact@v3

* remove minor version

* remove unmaintained actions-rs actions

* update to codecov/codecov-action@v3

* use ubuntu-latest

* use extra cargo/rust env vars

* use cargo-nextest

* check naga-fuzz

* only check on MSRV and minimal-versions

* add whitespace between steps

* rename to CI

* use cargo-llvm-cov to generate code coverage
2023-02-06 17:47:18 +01:00
manunio 2d0aab875a fuzz: fix build failure (#2240) 2023-02-03 15:11:48 +01:00
Teodor Tanasoaia 41de797c74 Change type of mip_level_count and array_layer_count (members of TextureViewDescriptor and ImageSubresourceRange) from Option<NonZeroU32> to Option<u32> (#3445)
Clean up duplicated code related to texture layers/mips.
2023-02-03 15:03:34 +01:00
Nicolas Silva 6399dd4866 Update naga to 0.11.0@git:4b796b157cb2b67b0ab166a2238fe4e9473bfd52 (#3451) 2023-02-03 12:30:08 +01:00
João Capucho fc81a20f53 spv-in: Don't apply interpolation to fragment shaders outputs (#2239)
SPIR-V doesn't allow the `Flat`, `NoPerspective`, `Sample` or
`Centroid` decorations on fragment shaders outputs, but the spirv
frontend was applying default interpolation to all outputs
unconditionally.

This wasn't an issue for most shaders since they output floats and the
default values for them don't interfere with SPIR-V semantics, but if
the shader returned a uint or int the interpolation would be set to
`Flat` which as stated above is disallowed.

This commit fixes the issue by only running the default interpolation
code when constructing the entry point and if the stage/IO allow it.
2023-02-03 11:48:23 +01:00
Elabajaba 42b48ecb9f Update gpu allocator to 0.22 (#3447)
* bump gpu-allocator version

* cargo.lock
2023-02-03 00:58:07 -05:00
Leo Kettmeir e36c080ef8 fix(deno): specify viewFormats in configure surface (#3446) 2023-02-02 22:14:31 +01:00
Evan Mark Hopkins 4b796b157c [glsl-out] Version check countLeadingZeros (#2238) 2023-02-02 22:11:09 +01:00
Evan Mark HopkinsandJim Blandy fb2d438dbd [msl-out] Update firstLeadingBit for signed integers (#2235)
The prior code only supported unsigned integers.

Also fixes #2236.

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2023-02-02 09:47:17 -08:00
Artavazd BalaianandTeodor Tanasoaia fe851fb008 [glsl] Inject default gl_PointSize = 1.0 in vertex shaders if FORCE_POINT_SIZE option was set (#2223)
According to https://registry.khronos.org/OpenGL/specs/es/3.2/GLSL_ES_Specification_3.20.html#built-in-language-variables

> The variable gl_PointSize is intended for a shader to write the size of the point to be rasterized. It is measured in pixels. If gl_PointSize is not written to, its value is undefined in subsequent pipe stages.

- Write warn message if `ClipDistance` and `CullDistance` are used on unsupported version

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-02-02 13:08:18 +01:00
Connor Fitzgerald 4ea31598a0 Re-sort view formats (#3444) 2023-02-02 09:22:33 +01:00
Elabajaba 7826092d86 Fix dx12 shader validation errors when dxil.dll isn't available in the local scope. (#3434)
* Fix dx12 shader validation errors when dxil.dll isn't available in the local scope.

* changelog

* clippy

* always explicitly validate shaders to simplify code

* destructor ordering
2023-02-01 22:55:54 -05:00
ElabajabaandConnor Fitzgerald c5e2f5a7b9 Add SHADERINT_16 feature to allow 16bit ints in Vulkan shaders (#3401)
* add support for vulkan SHADER_INT16

* changelog

* deno shader-i16

* better INT16 docs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* fix typo

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-02-02 02:00:22 +00:00
AdrianEddy 2562f323bb [Metal] Add a way to create a device and queue from raw resources in wgpu-hal (#3338) 2023-02-01 23:56:48 +00:00
Elabajaba 1e27fd4afb fix clippy for rust 1.67 (#3435)
* clippy --fix

* elide lifetimes

* fmt and more fixes

* disable clippy::needless_borrowed_reference as it clashes with clippy::pattern_type_mismatch

* missed flags for target=wasm32-unknown-unknown
2023-02-01 23:06:03 +01:00
João Capucho c371e7039d Implement the new checks for readonly stencils (#3443)
wgpu currently checks if the `write_mask` is 0 to determine wether a
stencil is used as readonly or not. However Webgpu contains a more
complex ruleset that also checks the cull mode and face operations to
determine if the stencil is readonly or not.

This commit brings these new rules to wgpu.
2023-02-01 21:13:46 +01:00
SparkyPotato a5c2cf94b8 update tests 2023-02-01 12:28:31 +01:00
SparkyPotato dcfd5c6f4a improve invalid assignment diagnostic 2023-02-01 12:28:31 +01:00
SparkyPotato 231af68386 expect semicolons wherever required 2023-02-01 12:28:31 +01:00
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 Hopkinsandteoxoy 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