Fixes#1642.
Since 1d textures cannot have mipmaps, MSL requires that the `level` argument to
texel accesses and dimension queries be a constexpr 0. For our purposes, just
omit the level argument altogether.
* glsl-in: Remove unneeded mutability from reference
* glsl-in: Fix composite constructors
In the recent rework of the constructors it seems that the logic for
composite types (arrays and structs) was accidentally removed by me.
* [hlsl-out] Write `mad` intrinsic for `fma` function
- This should be enough because we only support f32 for now.
- Adds a new test for WGSL functions, in the spirit of operators.wgsl.
- Closes#1579
* Add FMA feature to glsl backend
- I think this is right. Just iterate all known expressions in all
functions and entry points to locate any `fma` function call.
Should not need to walk the statement DAG.
* Transform GLSL fma function into an airthmetic expression when necessary
* Add tests for GLSL fma function tranformation
* Remove the hazard comment from the webgl test input
* Add helper method for fma function support checks
* Address review comment
* Add FindLsb / FindMsb
* Fixes and tests for FindLsb/FindMsb
* Add findLsb / findMsb as WGSL builtins
* Fix tests
* Fix incompatible type issue with MSL output
* Requested changes
* Test fewer cases of findLsb/findMsb
The IR doesn't allow having structs has bindings for entry point
input/output, so the glsl frontend must flatten them.
Glsl defines that the locations are sequential from the block base location.
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
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.
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.
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.
* [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.