mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-24 08:21:25 +01: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>
44 lines
747 B
HLSL
44 lines
747 B
HLSL
|
|
struct S {
|
|
float3 a;
|
|
int _end_pad_0;
|
|
};
|
|
|
|
struct Test {
|
|
S a;
|
|
float b;
|
|
int _end_pad_0;
|
|
int _end_pad_1;
|
|
int _end_pad_2;
|
|
};
|
|
|
|
struct Test2_ {
|
|
float3 a[2];
|
|
int _pad1_0;
|
|
float b;
|
|
int _end_pad_0;
|
|
int _end_pad_1;
|
|
int _end_pad_2;
|
|
};
|
|
|
|
struct Test3_ {
|
|
row_major float4x3 a;
|
|
int _pad1_0;
|
|
float b;
|
|
int _end_pad_0;
|
|
int _end_pad_1;
|
|
int _end_pad_2;
|
|
};
|
|
|
|
cbuffer input1_ : register(b0) { Test input1_; }
|
|
cbuffer input2_ : register(b1) { Test2_ input2_; }
|
|
cbuffer input3_ : register(b2) { Test3_ input3_; }
|
|
|
|
float4 vertex() : SV_Position
|
|
{
|
|
float _expr4 = input1_.b;
|
|
float _expr8 = input2_.b;
|
|
float _expr12 = input3_.b;
|
|
return ((((1.0).xxxx * _expr4) * _expr8) * _expr12);
|
|
}
|