Commit Graph
9013 Commits
Author SHA1 Message Date
SpecificProtagonist b65ebb4b30 remove copyless (#3050) 2022-09-26 05:15:35 +00:00
Jim Blandy 27a27568d6 Placate clippy 0.1.64. (#3048)
Derive `Eq` on some types in `wgpu-hal`.
2022-09-23 23:54:40 +00:00
2c1d7a8a5c Split Blendability and Filterability into Two Different TextureFormatFeatureFlags (#3012)
* Split Blendability and Filterability into Two Different TextureFormatFeatureFlags

* Update CHANGELOG.md

* Split out individual booleans to improve readability

* Make sure blendablity is correctly set for guaranteed format features of WebGPU

* Cargo fmt

Co-authored-by: Xander Warnez <xander.warnez@materialise.be>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-21 19:39:01 +00:00
i509VCBandConnor Fitzgerald 061e04bff1 expose driver info in AdapterInfo (#3037)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-21 02:45:28 +00:00
Mauro GentileandMauro Gentile cdf6ee0c87 Updating TextureFormat matching specs (#2954)
Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
2022-09-20 12:08:06 -04:00
Leo Kettmeir f8ff5a8ffa Update deno (#3041) 2022-09-20 12:06:12 -04:00
Jinlei Li ffd733726a Update wasm32 dependencies, set alpha_mode on web target (#3040) 2022-09-20 06:53:55 +00:00
i509VCB 65e405193e vulkan: use effective api version for determining device features (#3011) 2022-09-20 01:11:15 -04:00
i509VCB f877a8a3c9 Vendor id clarification (#3036)
* set GL vendor for id Mesa and Apple

* match on "apple m" to mark M2 cpu as integrated in gles

* document AdapterInfo::vendor if the vendor has no PCI id
2022-09-19 23:52:00 -04:00
Leo KettmeirandVicary A 03b989c235 Upstream denoland/deno#15853 (#3038)
Co-authored-by: Vicary A <vicary@yahoo.com>
2022-09-20 02:54:25 +00:00
João Capucho c61f61ca0e dx12: Add support for push constants (#2866) 2022-09-19 20:47:24 -04:00
i509VCB 6f2c393024 move GL vendor magic numbers to "auxil::db" (#3035) 2022-09-19 06:48:15 +00:00
daxpedda 95408cd48b [BREAKING] Wrap ShaderSource::Naga in Cow<'static> (#2903) 2022-09-19 00:50:46 -04:00
ImbrisandConnor Fitzgerald 41006d7a88 Buffer usages mismatch check and documentation for mapped_at_creation size requirement. (#3023)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-09-19 04:41:29 +00:00
Jinlei Li 44399bb4a3 Expose alpha_mode, support non-opaque mode on metal and vk backends (#2836) 2022-09-19 00:10:21 -04:00
Alphyr d1c94d09e2 Update dependencies (#3021) 2022-09-18 23:53:21 -04:00
Max Ammann abc4e1572a Explicitely enable std, and don't rely on environment (#2062) 2022-09-17 12:39:34 -07:00
Jim Blandy 7e3750a7f2 [wgsl] Fix line endings on wgsl reserved words list. (#2059) 2022-09-17 00:52:00 +00:00
i509VCB b752c7d248 statically assert public wgpu types appropriately implement Send and Sync (#3025) 2022-09-16 12:36:23 -04:00
i509VCB 9e3efd7019 pass around RawDisplayHandle and RawWindowHandle in implementation (#3022)
This change is to help with an attempt to allow the Context type in wgpu to be swappable at runtime. In order to do that, the functions provided by Context and it's associated types need to be object safe. Instead of passing a impl trait that combines both HasRawWindowHandle and HasRawDisplayHandle, we seperate the types into their RawDisplayHandle and RawWindowHandle parts internally to reduce some of the hal implementation code mess.
2022-09-15 16:29:20 -07:00
Jim Blandy 33392382ee [wgsl-in] Break up long string, reformat rest of file. (#2057)
Whitespace and formatting changes only.

It turns out that if `cargo fmt` comes across a single line it can't
make fit within the margins, then it sort of gives up on the
surrounding construct. So breaking up the error message for
`Error::UnknownScalarType` in `Error::as_parse_error` and then
re-running `cargo fmt` cleans up lots of other stuff in the file.

cargo fmt issue:
https://github.com/rust-lang/rustfmt/issues/3863
2022-09-15 19:06:11 +00:00
Shaye Garg 5166c2a1d8 wgsl-in: Improve assignment diagnostics (#2056)
Fixes #2052.

* improved assignment statement errors

* hint immutable binding

* fix clippy

* add diagnostic tests

* cleanup formatting
2022-09-15 09:17:00 -07:00
SparkyPotato 4f8db997b0 remove trailing trivia 2022-09-14 23:16:24 -07:00
SparkyPotato 5d9cdd361f fix inclusion of trivia in spans 2022-09-14 23:16:24 -07:00
João Capucho 1a99c1cf06 wgsl-in: Fix bad span in assignment lhs error
The wgsl frontend was emiting errors for lhs expressions on assignments
that weren't references using a span that didn't skip blankspaces
causing the span to look weird (like starting at the end of the previous
line)

This is fixed by consuming the blankspace before constructing the span
2022-09-12 13:02:36 -07:00
João Capucho ff69053bf2 valid: Check regular functions don't have bindings
Checks that all arguments and return types have no bindings in regular functions.
2022-09-10 10:31:11 -07:00
João Capucho db1321cfb6 wgsl-in: Splat on compound assignments
Compound assignments on wgsl follow the same semantics as their
underlying operation, this includes the splatting behavior when mixing
scalar and vector operands, which was done for binary operations but not
for compound assignments.
2022-09-10 10:17:20 -07:00
Jim Blandy eb6124ec94 Document arithmetic binary operation type rules. 2022-09-10 17:12:35 +01:00
João Capucho 7d0e9847b0 Remove the glsl-validate feature
When it was introduced it was supposed to allow for fast compiles by
skipping glsl specific validation, but as it turns the subset of glsl that's
compilable code is already pretty close to the subset of valid glsl code.

So the current code gated behind glsl-validate amounts to a single branch that
isn't even performance sensitive, and most of the validation is not specific to
glsl and is made by naga's validator which can be turned off, so the original
goal of fast compile times by disabling validation can still be accomplished.
2022-09-05 19:37:39 -07:00
João Capucho d9c9fe6218 glsl-in: Migrate to SymbolTable 2022-09-05 13:30:55 +01:00
João Capucho 544f14ad2f Add some methods to SymbolTable and implement Debug 2022-09-05 13:30:55 +01:00
Jim Blandy 94ce76391b Fix link in README.md. 2022-09-04 09:22:25 -07:00
Jim Blandy 13a0d28ddc wgsl-in: Rename Scope to Rule, since we now have lexical scope.
Rename related functions and variables appropriately.

Also, make `Rule` private to the WGSL front end, and remove the unused
`ImportDecl` variant.
2022-09-03 08:56:52 -07:00
Jim Blandy 7505187476 [spv-out] Don't emit no-op OpBitCast instructions.
As reported in #2015, some drivers trip over these.
2022-09-03 16:39:07 +01:00
Jim Blandy 90eb399d43 Fill in Adapter::as_hal and Device::as_hal documentation. (#2992)
In particular, explain why a callback is needed, rather than just
having these functions return an `Option<&A::Mumble>`.
2022-09-02 20:56:27 -07:00
Jinlei Li e350f50b2f metal: remove PrivateCapabilities's format_rgb10a2_unorm_surface field (#2981)
* metal: remove PrivateCapabilities's format_rgb10a2_unorm_surface field

* Update CHANGELOG
2022-09-02 20:28:26 -07:00
Jim Blandy 254937c1b5 Explain which WGSL version wgpu supports in various configs. (#3009) 2022-09-02 20:26:46 -07:00
Jim Blandy bec26b79ec Don't use a callback to return backend instance handles. (#2991)
Change `Instance::as_hal<A>` to simply return an
`Option<&A::Instance>`, rather than passing it to a callback. We're
just borrowing a reference to some `wgpu_hal::Api::Instance` owned by
the `wgpu_core::instance::Instance`, so there's no special scoping or
locking magic required here.
2022-09-02 17:32:58 -07:00
Kevin Reid 4a7fc68df0 Document that write_buffer_with is sound to read from. (#3006)
* Document that `write_buffer_with` is sound to read from.

To a reader informed about Rust's memory model, the existing claim that

> dereferencing it to a `&[u8]` panics

without further context sounds awfully like someone thinks they've
invented a write-only reference, and that the API might actually be
exposing undefined behavior via an uninitialized `&mut [u8]`. Therefore,
let's specify what happens if you *do* read through the mutable
reference.  The text added in this commit is based on what was said in
the review when `write_buffer_with` was added:
https://github.com/gfx-rs/wgpu/pull/2777/files#r901392551

This is also relevant information to someone considering using
`write_buffer_with()` for performance gains: for example, it suggests
that it might be a bad idea to write data into the view and then sort
it in-place. (Or is that not a bad idea? Is it not slow if the CPU
already wrote over all the memory contiguously? I don't know.)

* Changelog addition (+ fixing duplicate documentation section)
2022-09-02 23:50:15 +00:00
Jim Blandy 7e84bb2eae Correct create_surface_from_(offscreen)_canvas docs. (#2990)
The function's does not depend on the `canvas` argument meeting the
given requirements to avoid undefined behavior, so it should just be a
normal contract, not a safety contract.
2022-09-02 16:29:06 -07:00
Andreas Monitzer 6348a07d28 Expose the vk::Queue and the queue index in the Vulkan hal. (#2950) 2022-09-02 22:58:01 +00:00
Jim Blandy 701564da8c Use () instead of PhantomData as IdentityManager's Input type. (#2972)
* Use () instead of PhantomData as IdentityManager's Input type.

PhantomData suggests that there's some sort of persuasion required
for lifetime variance inference or other sorts of arcana, but it
doesn't seem to be necessary at all. `()` works just fine.
2022-09-02 15:37:21 -07:00
Jinlei Li ee7fd47ecb metal: fix max_storage_xx max_texture max_sampler and max_vertex_xx limits (#2978) 2022-09-02 15:36:07 -07:00
Mauro GentileandMauro Gentile 35deadc108 Depth clear value for web target (#2984)
* Fix depth clear value on web

* Defaulting to 0.

* Added also stencil clear

Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
2022-09-02 15:35:42 -07:00
i509VCB c519901d57 vulkan: remove use of Vulkan12Features/Properties types (#2936)
Vulkan prohibits including `VkPhysicalDeviceVulkan12Features` structures in the chain passed to `VkCreateDevice` along with other more specific features structs. Similiar restrictions apply to the `...Properties` structures.

Fixes #2925.
2022-09-02 21:05:13 +00:00
François 27f6302d5b changelog 2022-09-02 11:41:20 -07:00
François b9564dbe74 enable union feature of smallvec 2022-09-02 11:41:20 -07:00
François a50335f0f8 use smallvec instead of onplace_it with fixed size 2022-09-02 11:41:20 -07:00
Jim Blandy 58bc205f2a Update to Naga b209d911 (2022-9-1).
This removes an expected failure on AMD RADV. I guess #2751 was our
bug all along.
2022-09-02 11:33:55 -07:00
João Capucho d64d78ff0b wgsl-in: Implement lexical scopes
Previously the wgsl frontend wasn't aware of lexical scopes causing all
variables and named expressions to share a single function scope, this
meant that if a variable was defined in a block with the same name as a
variable in the function body, the variable in the function body would
be lost and exiting the block all references to the variable in the
function body would be replaced with the variable of the block.

This commit fixes that by using the previously introduced `SymbolTable`
to track the lexical and perform the variable lookups, scopes are pushed
and popped as defined in the wgsl specification.
2022-09-01 17:31:50 -07:00