Commit Graph
8897 Commits
Author SHA1 Message Date
João Capucho 9fac7c48a6 glsl-in: Allow vector/matrix in vector constructor
The glsl spec defines that vector constructors flatten their arguments
and consume them in order, ignoring the remaining arguments if there are
more than needed
2021-11-29 11:06:18 -05:00
Dzmitry Malyshau b32dcbb041 hal/gles: force unbind samplers (#2226) 2021-11-29 10:08:11 -05:00
Aleksander Guryanov 1b1c826ac7 Remove duplicate line in mod.rs (#2223) 2021-11-29 13:34:15 +00:00
Dzmitry Malyshau 62b036b55b hal/gles: fix setting filtering on integer textures (#2222) 2021-11-28 23:04:43 -05:00
Igor Shaposhnik dba6beb941 [wgsl-in] Don't allow redefinition of module scope identifiers 2021-11-28 21:23:22 -05:00
Igor Shaposhnik 20b96ef47b Avoid function name redefinition in tests 2021-11-28 21:23:22 -05:00
Leo Kettmeir cda893fe73 feat(deno_webgpu): fill buffer (#2221)
* fill buffer

* fix

* fmt
2021-11-28 21:22:15 -05:00
Leo Kettmeir 943145b4df chore: update deno_webgpu (#2214)
* update deno

* more fixes

* revert debug

* clean
2021-11-26 16:05:16 -05:00
Dzmitry Malyshau daa61b5fcb Fix shapshots to run without deserialize feature 2021-11-26 12:16:50 -05:00
Dzmitry Malyshau 74132ba947 Actually disable explicit types on most WGSL outputs 2021-11-26 11:36:46 -05:00
Dzmitry Malyshau f4ba74544a Refactor snapshot test arguments to avoid checking for deserialize feature too often.
We can safely assume that deserialize is enabled for all output tests.
Supporting other modes of operation has low utility.

This change also adds an option to skip the explicit types for WGSL output.
2021-11-26 11:36:46 -05:00
Igor Shaposhnik 7c2fdf94c0 [wgsl-out] Add double underscores as a reserved prefix 2021-11-26 09:36:18 -05:00
Dzmitry Malyshau ddbc1c4b1f WGSL: use underscore prefix like the other backends 2021-11-25 16:23:24 -05:00
Dzmitry Malyshau 5f6c067815 hal/vulkan: use multiple semaphores in a relay (#2212) 2021-11-25 15:44:33 -05:00
Xiaopeng Li f4d51451fa Unique HalManagedMetalLayerDelegate class (#2209)
* Unique HalManagedMetalLayerDelegate class

* Remove once-cell dependency
2021-11-25 11:23:26 -05:00
Igor Shaposhnik 2107b20561 [wgsl-in] Don't allow keywords to be used as identifiers 2021-11-24 16:34:17 -05:00
Igor Shaposhnik cb6d3fa815 [wgsl] Move backend keyword list into its own module 2021-11-24 16:34:17 -05:00
Igor Shaposhnik ae0c7355ca [wgsl] Remove IsInf and IsNan 2021-11-24 16:05:03 -05:00
Mariusz Kryński dde73ed236 use native webgl2 buffers for MAP_READ usage (#2201)
* use native gl buffers for map_read

* Buffer refactor

* lint
2021-11-23 17:16:26 -05:00
Dzmitry Malyshau 5864b776a4 Refactor command buffer states to ensure proper cleanup on errors (#2208) 2021-11-23 15:57:13 -05:00
Dzmitry Malyshau 2b38439f65 Add INDIRECT_FIRST_INSTANCE feature (#2206) 2021-11-23 10:01:07 -05:00
Neil Blakey-Milner 4f639622d0 Add strip_index_format to linestrip in conservative-raster example (#2199) 2021-11-22 14:01:24 +00:00
Andy Fiedler 8196b7567c Web backend: call set_vertex_buffer with size as optional 2021-11-22 08:59:25 -05:00
Andy Fiedler 385d9caa8d Web backend: call set_index_buffer with size as optional
Size must be passed to setIndexBuffer in Javascript as undefined in order for WebGGPU to use the default size, which is the full buffer size.
2021-11-22 08:59:25 -05:00
James Beilby ed7f8a84a3 Remove very slow debug assertion in hubs (#2193) (#2203) 2021-11-22 13:58:53 +00:00
dan cd59c76e3a Add new BindingResource type SamplerArray (#2113)
* implemented SamplerArray

* modified shaders

* fixed doc

* fixed code format
2021-11-22 12:19:46 +00:00
Connor Fitzgerald 8c0c01b338 Merge pull request #2200 from CatCode79/patch-1
minor typo
2021-11-21 09:36:18 -05:00
CatCode79 8acde0b0e1 minor typo
GSLS -> GLSL
2021-11-21 12:29:57 +01:00
Dzmitry Malyshau ddac6a369b Validate min_binding_size at draw time (#2195) 2021-11-20 16:15:54 -05:00
LaylandLayl Bongers 2ef72b9313 Add multiview support (#2187)
Co-authored-by: Layl Bongers <2385329-layl@users.noreply.gitlab.com>
2021-11-19 10:56:48 -05:00
Dzmitry Malyshau fca82ddd7e Populate sampling pairs for validation (#2188) 2021-11-18 19:06:24 -05:00
Jim Blandy 7fd172515d [spv-out] Don't support arguments pointing to unsized types.
Functions with such arguments could never have been called anyway, and now they
are forbidden in validation.
2021-11-18 17:39:56 -05:00
Jim Blandy cc930180d9 Tighten checks on pointers to unsized values, and pointer arguments.
Pointers should not be `DATA`: they can never be stored in anything. (Function
arguments are not storage; they're like `let` bindings.)

Un-`SIZED` values may only live in the `Storage` storage class, so creating
pointers to them in other storage classes is meaningless.

The `ARGUMENT` flag should be set only on pointers in those storage classes that
are permitted to be passed to functions.

See comments in code for details.

Fixes #1513.
2021-11-18 17:39:56 -05:00
Jim Blandy 633f1b3377 [wgsl-in] Don't be confused by pointers to globals.
The WGSL front end knows that globals in the `Handle` storage class do not
produce references, but it attempts to manage this in two places which trip over
each other. As a consequence, referring to a `let` binding holding a pointer to
a global flips the variable's type from WGSL `ptr` to WGSL reference, with
bewildering consequences.
2021-11-18 17:39:56 -05:00
Xiaopeng Li 39f3f08b55 Add Device::as_hal and always assume texture from hal is initialized (#2180)
* Add Device::as_hal, create_texture_from_hal_initialized

* Add Safety doc

* Always assume that the texture from hal is initialized
2021-11-18 17:34:01 -05:00
Layl Bongers 29571cc4cf Add multiview wgsl builtin 2021-11-18 09:57:37 -05:00
Jim Blandy 6a5b33fa24 Move BoundsCheckPolicy/Policies into proc, from back. (#1537) 2021-11-17 19:15:59 -08:00
bjorn3 38366e382f Switch to rustc-hash
See gfx-rs/rspirv#221 for the rationale behind this change
2021-11-16 23:51:19 -05:00
Igor Shaposhnik 30a0a37af0 Update dependencies 2021-11-16 23:46:54 -05:00
Jim Blandy ce18eba695 Check that stores are permitted by the pointer's storage access.
Fixes #1533.
2021-11-16 23:40:56 -05:00
Boris-Chengbiao Zhou 47fd77619f Don't use duplicate function name in boids shader (#2183)
From the spec: "A declaration must not introduce a name when that
identifier is already in scope with the same end scope as another
instance of that name."

naga doesn't yet check this (gfx-rs/naga#1480) but Chrome/Tint rightly
complains with: error: redefinition of 'main'
2021-11-16 23:25:33 -05:00
Boris-Chengbiao Zhou 3545a4fdd5 Introduce SamplerBindingType enum and fix bug in validation (#2181)
* Introduce SamplerBindingType enum and fix bug in validation

This matches the WebGPU spec more closely and also lets us implement the
validation as it's written in the spec[1]. This fixes a bug which
previously prevented the "shadow" example from running in Firefox.

Previously the validation would check whether the filtering was
appropiate even if it was a comparison sampler. This didn't matter when
running the shadow example natively since the example was setting
`filtering: true` in addition to `comparison: true`. But this failed
when running through a browser since there the used WebIDL has the
proper enum representation and eventually resulted in `filtering: false`
being passed to wgpu-core which would then fail validation.[2]

[1]: https://gpuweb.github.io/gpuweb/#bind-group-creation
[2]: https://github.com/mozilla/gecko-dev/blob/674b6582bafedc11fba6dc537769c88e9ed921d3/dom/webgpu/ipc/WebGPUChild.cpp#L502-L513

* Fix remaining examples

* Fix deno_webgpu
2021-11-16 23:08:03 -05:00
Jim Blandy 3d6cbcf8a6 Remove IndexableLength::Specializable variant.
Specializable constants are no longer permitted as array lengths, so this case
should not arise in valid code.
2021-11-16 09:12:42 -05:00
Jim Blandy 90daa9edfe Forbid specializable constants as array lengths.
Only the SPIR-V front end can produce such array types, and it seems that our
back ends don't support this case well.
2021-11-16 09:12:42 -05:00
Dzmitry Malyshau 1ff70329f1 Refactor texture view non-referenced resources (#2184) 2021-11-15 15:58:47 -05:00
Jerónimo Sánchez 052cb3da39 Renaming CommandEncoder::clearBuffer to CommandEncoder::fillBuffer (#2174)
* Renamed clear_buffer to fill_buffer (keeping up with spec)
* fill_buffer does not require CLEAR_BUFFER feature

* Changed ClearBuffer to FillBuffer for `trace` feature

* Renamed clearBuffer for web backend
2021-11-14 19:16:10 -05:00
Boris-Chengbiao Zhou 1dcde48d09 [valid] Check that switches have a default case (#1529)
From the WGSL spec: "Each switch statement must have exactly one default clause."
2021-11-15 00:07:55 +00:00
Jay Oster 66c3499df8 [spv-out] Fix scalar-times-matrix operations (#1524) 2021-11-14 19:07:38 -05:00
Boris-Chengbiao Zhou 08b9c46ec4 Validate strip_index_format (#2177)
The spec mandates that stripIndexFormat is set even when drawIndexed is
not used. (https://www.w3.org/TR/webgpu/#primitive-state)
There is some recent discussion about this though:
https://github.com/gpuweb/gpuweb/issues/2199
2021-11-14 19:03:33 -05:00
Jim Blandy e69a70bfb7 [spv-in] Permit pointers to runtime arrays only in StorageBuffer. (#1522)
* [spv-in] Change shadow.spv test input to use StorageBuffer.

The ecosystem around Naga will generally not be able to use Vulkan adapters that
don't support the SPV_KHR_storage_buffer_storage_class (which was incorporated
into SPIR-V 1.3), so we can assume it is present.

Changing the test not to use runtime-sized arrays in the Uniform storage class
will allow Naga to tighten up some validation checks.

* [spv-in] Permit pointers to runtime arrays only in StorageBuffer.

Fixes #1519.
2021-11-10 16:58:57 -05:00