wgsl: Print abstract-floats with full precision.

Change-Id: Ie95547f065b896983b90ffd5455538fdd843b81a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104824
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-10-12 19:13:38 +00:00
committed by Dawn LUCI CQ
parent 9f513ca541
commit d6daefc379
17 changed files with 321 additions and 116 deletions

View File

@@ -1,18 +1,18 @@
fn original_clusterfuzz_code() {
atan2(1, 0.100000001);
atan2(1, 0.1);
}
fn more_tests_that_would_fail() {
{
let a = atan2(1, 0.100000001);
let b = atan2(0.100000001, 1);
let a = atan2(1, 0.1);
let b = atan2(0.1, 1);
}
{
let a = (1 + 1.5);
let b = (1.5 + 1);
}
{
atan2(1, 0.100000001);
atan2(0.100000001, 1);
atan2(1, 0.1);
atan2(0.1, 1);
}
}

View File

@@ -1,6 +1,8 @@
SKIP: FAILED
bug/chromium/1367602-1.wgsl:2:23 error: array size (65536) must be less than 65536
var v = array<bool, 65536>();
^^^^^
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
bool v[65535] = (bool[65535])0;
}

View File

@@ -48,7 +48,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {
if ((index >= config.numLights)) {
return;
}
lightsBuffer.lights[index].position.y = ((lightsBuffer.lights[index].position.y - 0.100000001) + (0.001 * (f32(index) - (64.0 * floor((f32(index) / 64.0))))));
lightsBuffer.lights[index].position.y = ((lightsBuffer.lights[index].position.y - 0.1) + (0.001 * (f32(index) - (64.0 * floor((f32(index) / 64.0))))));
if ((lightsBuffer.lights[index].position.y < uniforms.min.y)) {
lightsBuffer.lights[index].position.y = uniforms.max.y;
}

View File

@@ -1,5 +1,5 @@
@compute @workgroup_size(1)
fn compute_main() {
let a = 1.230000019;
let a = 1.23;
var b = max(a, 1.17549435e-38);
}

View File

@@ -1,6 +1,6 @@
@vertex
fn main() -> @builtin(position) vec4<f32> {
var light : vec3<f32> = vec3<f32>(1.200000048, 1.0, 2.0);
var light : vec3<f32> = vec3<f32>(1.2, 1.0, 2.0);
var negative_light : vec3<f32> = -(light);
return vec4<f32>();
}

View File

@@ -7,7 +7,7 @@ struct Output {
@vertex
fn main(@builtin(vertex_index) VertexIndex : u32, @builtin(instance_index) InstanceIndex : u32) -> Output {
let zv : array<vec2<f32>, 4> = array<vec2<f32>, 4>(vec2<f32>(0.200000003, 0.200000003), vec2<f32>(0.300000012, 0.300000012), vec2<f32>(-0.100000001, -0.100000001), vec2<f32>(1.100000024, 1.100000024));
let zv : array<vec2<f32>, 4> = array<vec2<f32>, 4>(vec2<f32>(0.2, 0.2), vec2<f32>(0.3, 0.3), vec2<f32>(-0.1, -0.1), vec2<f32>(1.1, 1.1));
let z : f32 = zv[InstanceIndex].x;
var output : Output;
output.Position = vec4<f32>(0.5, 0.5, z, 1.0);

View File

@@ -1,6 +1,6 @@
@compute @workgroup_size(1)
fn main() {
let res = frexp(1.230000019);
let res = frexp(1.23);
let exp : i32 = res.exp;
let sig : f32 = res.sig;
}

View File

@@ -1,6 +1,6 @@
@compute @workgroup_size(1)
fn main() {
let res = modf(1.230000019);
let res = modf(1.23);
let fract : f32 = res.fract;
let whole : f32 = res.whole;
}

View File

@@ -2,5 +2,5 @@ enable f16;
@fragment
fn main() -> @location(0) vec4<f32> {
return vec4<f32>(0.100000001, 0.200000003, 0.300000012, 0.400000006);
return vec4<f32>(0.1, 0.2, 0.3, 0.4);
}

View File

@@ -4,5 +4,5 @@ enable f16;
@fragment
fn main() -> @location(0) vec4<f32> {
return vec4<f32>(0.100000001, 0.200000003, 0.300000012, 0.400000006);
return vec4<f32>(0.1, 0.2, 0.3, 0.4);
}

View File

@@ -75,7 +75,7 @@ fn comp_main(@builtin(global_invocation_id) gl_GlobalInvocationID : vec3<u32>) {
cVel = (cVel / vec2<f32>(f32(cVelCount), f32(cVelCount)));
}
vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale));
vVel = (normalize(vVel) * clamp(length(vVel), 0.0, 0.100000001));
vVel = (normalize(vVel) * clamp(length(vVel), 0.0, 0.1));
vPos = (vPos + (vVel * params.deltaT));
if ((vPos.x < -1.0)) {
vPos.x = 1.0;

View File

@@ -5,5 +5,5 @@ fn bar() {
fn main() -> @location(0) vec4<f32> {
var a : vec2<f32> = vec2<f32>();
bar();
return vec4<f32>(0.400000006, 0.400000006, 0.800000012, 1.0);
return vec4<f32>(0.4, 0.4, 0.8, 1.0);
}

View File

@@ -9,7 +9,7 @@ struct Interface {
@vertex
fn vert_main() -> Interface {
return Interface(0.400000006, 0.600000024, vec4<f32>());
return Interface(0.4, 0.6, vec4<f32>());
}
@fragment