From 19f03dc2ff8299f41f0874d585e91e6ecedcc9d4 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Sat, 24 Aug 2024 14:51:37 +0200 Subject: [PATCH] Test Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- naga/tests/in/local-const.param.ron | 1 + naga/tests/in/local-const.wgsl | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 naga/tests/in/local-const.param.ron create mode 100644 naga/tests/in/local-const.wgsl diff --git a/naga/tests/in/local-const.param.ron b/naga/tests/in/local-const.param.ron new file mode 100644 index 00000000000..dd626a0f311 --- /dev/null +++ b/naga/tests/in/local-const.param.ron @@ -0,0 +1 @@ +() \ No newline at end of file diff --git a/naga/tests/in/local-const.wgsl b/naga/tests/in/local-const.wgsl new file mode 100644 index 00000000000..0964377d4c2 --- /dev/null +++ b/naga/tests/in/local-const.wgsl @@ -0,0 +1,19 @@ +const ga = 4; // AbstractInt with a value of 4. +const gb: i32 = 4; // i32 with a value of 4. +const ge = vec3(ga, gb, ga); + +fn const_in_fn(arg: f32) { + let _abba = 5; + const a = 4; // AbstractInt with a value of 4. + const b: i32 = 4; // i32 with a value of 4. + const c: u32 = 4u; // u32 with a value of 4. + const d: f32 = 4.; // f32 with a value of 4. + const e = vec3(a, b, a); // vec3 of AbstractInt with a value of (4, 4, 4). + const f = 2.0; // AbstractFloat with a value of 2. + // TODO: Make it per spec: https://gpuweb.github.io/gpuweb/wgsl/#const-decls + // currently not possible because naga does not support automatic conversions of Abstract types + + //const fa = arg; +} + +// TODO: Test for scopes (shadowing?), globals. \ No newline at end of file