From 1072160bbf08333e0618a681b87bd1e9e6bf5453 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Thu, 14 Mar 2024 11:02:50 -0700 Subject: [PATCH] add negative values and unsigned type filter to textureSample --- .../expression/call/builtin/textureSample.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts index 78150df07180..1588eb05b751 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts @@ -18,6 +18,7 @@ import { isConvertible, ScalarType, VectorType, + isUnsignedType, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -65,6 +66,8 @@ Validates that only incorrect coords arguments are rejected by ${builtin} .combine('coordType', keysOf(kValuesTypes)) .beginSubcases() .combine('value', [-1, 0, 1] as const) + // filter out unsigned types with negative values + .filter(t => isUnsignedType(kValuesTypes[t.coordType]) && t.value < 0) .expand('offset', ({ textureType }) => { const offset = kValidTextureSampleParameterTypes[textureType].offsetArgType; return offset ? [false, true] : [false]; @@ -109,6 +112,8 @@ Validates that only incorrect array_index arguments are rejected by ${builtin} .combine('arrayIndexType', keysOf(kValuesTypes)) .beginSubcases() .combine('value', [-9, -8, 0, 7, 8]) + // filter out unsigned types with negative values + .filter(t => isUnsignedType(kValuesTypes[t.arrayIndexType]) && t.value < 0) ) .fn(t => { const { textureType, arrayIndexType, value } = t.params; @@ -147,6 +152,8 @@ Validates that only incorrect offset arguments are rejected by ${builtin} .combine('offsetType', keysOf(kValuesTypes)) .beginSubcases() .combine('value', [-9, -8, 0, 7, 8]) + // filter out unsigned types with negative values + .filter(t => isUnsignedType(kValuesTypes[t.offsetType]) && t.value < 0) ) .fn(t => { const { textureType, offsetType, value } = t.params;