Skip to content

Commit

Permalink
Correct expectation for shift equal to bit width (#3868)
Browse files Browse the repository at this point in the history
It is a shader/pipeline-creation error if the number of bits to shift is greater than *or equal* to the bit width of the value to shift. This change corrects the expectations for the equals case, and adds a function reference to the pipeline subcase so it isn't stripped out.

These tests will pass in Dawn following: https://dawn-review.googlesource.com/c/dawn/+/199075
sudonatalie authored Jul 18, 2024
1 parent fb57fd8 commit c2c2fa9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -298,14 +298,14 @@ g.test('shift_right_abstract')
});

g.test('partial_eval_errors')
.desc('Tests partial evaluation errors for left shift')
.desc('Tests partial evaluation errors for left and right shift')
.params(u =>
u
.combine('op', ['<<', '>>'] as const)
.combine('type', ['i32', 'u32'] as const)
.beginSubcases()
.combine('stage', ['shader', 'pipeline'] as const)
.combine('value', [32, 33, 64] as const)
.combine('value', [31, 32, 33, 64] as const)
)
.fn(t => {
const u32 = Type.u32;
@@ -315,12 +315,12 @@ g.test('partial_eval_errors')
}
const wgsl = `
override o = 0u;
fn foo() {
fn foo() -> ${t.params.type} {
var v : ${t.params.type} = 0;
let tmp = v ${t.params.op} ${rhs};
return v ${t.params.op} ${rhs};
}`;

const expect = t.params.value <= 32;
const expect = t.params.value < 32;
if (t.params.stage === 'shader') {
t.expectCompileResult(expect, wgsl);
} else {
@@ -330,7 +330,7 @@ fn foo() {
expectedResult: expect,
code: wgsl,
constants,
reference: ['o'],
reference: ['o', 'foo()'],
});
}
});

0 comments on commit c2c2fa9

Please sign in to comment.