From 88f0ba4e26bd84f1cbe8de4c4cc48de8ba4d39db Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Wed, 3 Feb 2021 19:42:07 +0000 Subject: [PATCH] Update ComputeLog2 to be more valid Per https://bugs.chromium.org/p/dawn/issues/detail?id=663#c6 and https://bugs.chromium.org/p/dawn/issues/detail?id=663#c7 BUG=dawn:663 Change-Id: Id2c0dbd4b029be30691f450af0454b442856c2ed Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40242 Auto-Submit: Ryan Harrison Reviewed-by: Austin Eng Reviewed-by: David Neto Commit-Queue: Ryan Harrison --- src/tests/end2end/ShaderTests.cpp | 40 ++++++++++++++++--------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/tests/end2end/ShaderTests.cpp b/src/tests/end2end/ShaderTests.cpp index a1f5312666..189eebbe2b 100644 --- a/src/tests/end2end/ShaderTests.cpp +++ b/src/tests/end2end/ShaderTests.cpp @@ -41,25 +41,27 @@ TEST_P(ShaderTests, ComputeLog2) { [[group(0), binding(0)]] var buf : [[access(read_write)]] Buf; [[stage(compute)]] fn main() -> void { - buf.data[0] = u32(log2(1.0)); - buf.data[1] = u32(log2(2.0)); - buf.data[2] = u32(log2(3.0)); - buf.data[3] = u32(log2(4.0)); - buf.data[4] = u32(log2(7.0)); - buf.data[5] = u32(log2(8.0)); - buf.data[6] = u32(log2(15.0)); - buf.data[7] = u32(log2(16.0)); - buf.data[8] = u32(log2(31.0)); - buf.data[9] = u32(log2(32.0)); - buf.data[10] = u32(log2(63.0)); - buf.data[11] = u32(log2(64.0)); - buf.data[12] = u32(log2(127.0)); - buf.data[13] = u32(log2(128.0)); - buf.data[14] = u32(log2(255.0)); - buf.data[15] = u32(log2(256.0)); - buf.data[16] = u32(log2(511.0)); - buf.data[17] = u32(log2(512.0)); - buf.data[18] = u32(log2(4294967295.0)); + const factor : f32 = 1.0001; + + buf.data[0] = u32(log2(1.0 * factor)); + buf.data[1] = u32(log2(2.0 * factor)); + buf.data[2] = u32(log2(3.0 * factor)); + buf.data[3] = u32(log2(4.0 * factor)); + buf.data[4] = u32(log2(7.0 * factor)); + buf.data[5] = u32(log2(8.0 * factor)); + buf.data[6] = u32(log2(15.0 * factor)); + buf.data[7] = u32(log2(16.0 * factor)); + buf.data[8] = u32(log2(31.0 * factor)); + buf.data[9] = u32(log2(32.0 * factor)); + buf.data[10] = u32(log2(63.0 * factor)); + buf.data[11] = u32(log2(64.0 * factor)); + buf.data[12] = u32(log2(127.0 * factor)); + buf.data[13] = u32(log2(128.0 * factor)); + buf.data[14] = u32(log2(255.0 * factor)); + buf.data[15] = u32(log2(256.0 * factor)); + buf.data[16] = u32(log2(511.0 * factor)); + buf.data[17] = u32(log2(512.0 * factor)); + buf.data[18] = u32(log2(4294967295.0 * factor)); })"; wgpu::ComputePipelineDescriptor csDesc;