From 39bab0127b97dc4173a228931c6eb2295beafb32 Mon Sep 17 00:00:00 2001 From: ShrekShao <5031596+shrekshao@users.noreply.github.com> Date: Tue, 15 Oct 2024 09:11:23 -0700 Subject: [PATCH] Revert "robust_access_vertex shader add float tolerance (#3968)" (#4000) This reverts commit 11ac59b4615daf73d2e90de913d1d7de9ea6050a. --- .../shader/execution/robust_access_vertex.spec.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/webgpu/shader/execution/robust_access_vertex.spec.ts b/src/webgpu/shader/execution/robust_access_vertex.spec.ts index 91933aa2048f..d5792de1185f 100644 --- a/src/webgpu/shader/execution/robust_access_vertex.spec.ts +++ b/src/webgpu/shader/execution/robust_access_vertex.spec.ts @@ -63,10 +63,6 @@ import { makeTestGroup } from '../../../common/framework/test_group.js'; import { assert } from '../../../common/util/util.js'; import { GPUTest, TextureTestMixin } from '../../gpu_test.js'; -// This is a tolerance that should be less strict than oneULP(X) of a f32 where X is any arbitraryValues or 0. -// Given that in GLSL compat highp float can < 32 bit. -const kFloatTolerance = 0.000001; - // Encapsulates a draw call (either indexed or non-indexed) class DrawCall { private test: GPUTest; @@ -269,15 +265,11 @@ const typeInfoMap: { [k: string]: VertexInfo } = { sizeInBytes: 12, validationFunc: 'return valid(v.x) && valid(v.y) && valid(v.z);', }, - // It is valid to return (0, 0, 0, X) for an OOB access. (X can be anything) - // https://gpuweb.github.io/gpuweb/#security-shader float32x4: { wgslType: 'vec4', sizeInBytes: 16, validationFunc: `return (valid(v.x) && valid(v.y) && valid(v.z) && valid(v.w)) || - (abs(v.x - 0.0) <= ${kFloatTolerance} && - abs(v.y - 0.0) <= ${kFloatTolerance} && - abs(v.z - 0.0) <= ${kFloatTolerance});`, + (v.x == 0.0 && v.y == 0.0 && v.z == 0.0 && (v.w == 0.0 || v.w == 1.0));`, }, }; @@ -371,7 +363,7 @@ class F extends TextureTestMixin(GPUTest) { ${layoutStr} fn valid(f : f32) -> bool { - return ${validValues.map(v => `abs(f - ${v}.0) <= ${kFloatTolerance}`).join(' || ')}; + return ${validValues.map(v => `f == ${v}.0`).join(' || ')}; } fn validationFunc(v : ${typeInfo.wgslType}) -> bool {