Skip to content

Commit

Permalink
Revert "robust_access_vertex shader add float tolerance (#3968)"
Browse files Browse the repository at this point in the history
This reverts commit 11ac59b.
  • Loading branch information
shrekshao committed Oct 14, 2024
1 parent 00c3c50 commit 767cf96
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/webgpu/shader/execution/robust_access_vertex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<f32>',
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));`,
},
};

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 767cf96

Please sign in to comment.