Skip to content

Commit

Permalink
Update align tests for const expressions. (gpuweb#1854)
Browse files Browse the repository at this point in the history
This Cl updates the align shader test to allow for const expressions
as the align value. Tests are added to verify the const value must
be an i32.
  • Loading branch information
dj2 authored Sep 21, 2022
1 parent e77a9f2 commit 0860ad6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/webgpu/shader/validation/parse/align.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const kValidAlign = new Set([
'@align(4i)',
'@align(0x4)',
'@align(4,)',
'@align(i_val)',
'@align(i_val + 4 - 6)',
'@align(1073741824)',
'@\talign\t(4)',
'@/^comment^/align/^comment^/(4)',
Expand All @@ -24,7 +26,8 @@ const kInvalidAlign = new Set([
'@align(4, 2)',
'@align(4,)',
'@align(3)', // Not a power of 2
'@align(val)',
'@align(u_val)',
'@align(f_val)',
'@align(1.0)',
'@align(4u)',
'@align(4f)',
Expand All @@ -42,7 +45,9 @@ g.test('missing_attribute_on_param_struct')
.fn(t => {
const v = t.params.align.replace(/\^/g, '*');
const code = `
const val: i32 = 4;
const i_val: i32 = 4;
const u_val: u32 = 4;
const f_val: f32 = 4.2;
struct B {
${v} a: i32,
}
Expand Down

0 comments on commit 0860ad6

Please sign in to comment.