mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Fixes #1745: Support out-of-order module scope declarations in WGSL Fixes #1044: Forbid local variable shadowing in WGSL Fixes #2076: [wgsl-in] no error for duplicated type definition Fixes #2071: Global item does not support 'const' Fixes #2105: [wgsl-in] Type aliases for a vecN<T> doesn't work when constructing vec from a single argument Fixes #1775: Referencing a function without a return type yields an unknown identifier error. Fixes #2089: Error span reported on the declaration of a variable instead of its use Fixes #1996: [wgsl-in] Confusing error: "expected unsigned/signed integer literal, found '1'" Separate parsing from lowering by generating an AST, which desugars as much as possible down to something like Naga IR. The AST is then used to resolve identifiers while lowering to Naga IR. Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Co-authored-by: Jim Blandy <jimb@red-bean.com>
39 lines
689 B
Plaintext
39 lines
689 B
Plaintext
// language: metal2.0
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using metal::uint;
|
|
|
|
struct S {
|
|
metal::float3 a;
|
|
};
|
|
struct Test {
|
|
S a;
|
|
float b;
|
|
};
|
|
struct type_2 {
|
|
metal::float3 inner[2];
|
|
};
|
|
struct Test2_ {
|
|
type_2 a;
|
|
float b;
|
|
};
|
|
struct Test3_ {
|
|
metal::float4x3 a;
|
|
float b;
|
|
};
|
|
|
|
struct vertex_Output {
|
|
metal::float4 member [[position]];
|
|
};
|
|
vertex vertex_Output vertex_(
|
|
constant Test& input1_ [[buffer(0)]]
|
|
, constant Test2_& input2_ [[buffer(1)]]
|
|
, constant Test3_& input3_ [[buffer(2)]]
|
|
) {
|
|
float _e4 = input1_.b;
|
|
float _e8 = input2_.b;
|
|
float _e12 = input3_.b;
|
|
return vertex_Output { ((metal::float4(1.0) * _e4) * _e8) * _e12 };
|
|
}
|