mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-14 00:56:05 +00:00
Change ast::Array to use an ast::Expression for its `size` field. The WGSL frontend now parses the array size as an `primary_expression`, and the Resolver is responsible for validating the expression is a signed or unsigned integer, and either a literal or a non-overridable module-scope constant. The Resolver evaluates the constant value of the size expression, and so the resolved sem::Array type still has a constant size as before. Fixed: tint:1068 Fixed: tint:1117 Change-Id: Icfa141482ea1e47ea8c21a25e9eb48221f176e9a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63061 Auto-Submit: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
67 lines
1.6 KiB
WebGPU Shading Language
67 lines
1.6 KiB
WebGPU Shading Language
type Arr = [[stride(64)]] array<mat4x4<f32>, 2u>;
|
|
|
|
type Arr_1 = [[stride(16)]] array<f32, 4u>;
|
|
|
|
[[block]]
|
|
struct LeftOver {
|
|
worldViewProjection : mat4x4<f32>;
|
|
time : f32;
|
|
[[size(12)]]
|
|
padding : u32;
|
|
test2 : Arr;
|
|
test : Arr_1;
|
|
};
|
|
|
|
var<private> position : vec3<f32>;
|
|
|
|
[[group(2), binding(2)]] var<uniform> x_14 : LeftOver;
|
|
|
|
var<private> vUV : vec2<f32>;
|
|
|
|
var<private> uv : vec2<f32>;
|
|
|
|
var<private> normal : vec3<f32>;
|
|
|
|
var<private> gl_Position : vec4<f32>;
|
|
|
|
fn main_1() {
|
|
var q : vec4<f32>;
|
|
var p : vec3<f32>;
|
|
let x_13 : vec3<f32> = position;
|
|
q = vec4<f32>(x_13.x, x_13.y, x_13.z, 1.0);
|
|
let x_21 : vec4<f32> = q;
|
|
p = vec3<f32>(x_21.x, x_21.y, x_21.z);
|
|
let x_27 : f32 = p.x;
|
|
let x_41 : f32 = x_14.test[0];
|
|
let x_45 : f32 = position.y;
|
|
let x_49 : f32 = x_14.time;
|
|
p.x = (x_27 + sin(((x_41 * x_45) + x_49)));
|
|
let x_55 : f32 = p.y;
|
|
let x_57 : f32 = x_14.time;
|
|
p.y = (x_55 + sin((x_57 + 4.0)));
|
|
let x_69 : mat4x4<f32> = x_14.worldViewProjection;
|
|
let x_70 : vec3<f32> = p;
|
|
gl_Position = (x_69 * vec4<f32>(x_70.x, x_70.y, x_70.z, 1.0));
|
|
let x_83 : vec2<f32> = uv;
|
|
vUV = x_83;
|
|
let x_87 : f32 = gl_Position.y;
|
|
gl_Position.y = (x_87 * -1.0);
|
|
return;
|
|
}
|
|
|
|
struct main_out {
|
|
[[builtin(position)]]
|
|
gl_Position : vec4<f32>;
|
|
[[location(0)]]
|
|
vUV_1 : vec2<f32>;
|
|
};
|
|
|
|
[[stage(vertex)]]
|
|
fn main([[location(0)]] position_param : vec3<f32>, [[location(2)]] uv_param : vec2<f32>, [[location(1)]] normal_param : vec3<f32>) -> main_out {
|
|
position = position_param;
|
|
uv = uv_param;
|
|
normal = normal_param;
|
|
main_1();
|
|
return main_out(gl_Position, vUV);
|
|
}
|