From 58d25c607b1f30d678905e224b0f46a7e69dc586 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Thu, 14 Mar 2024 12:02:26 -0700 Subject: [PATCH] Reverse filter for unsigned values and negative numbers In the previous PR for textureSample and textureSampleCompare WGSL validation this check was backward. --- .../expression/call/builtin/textureSample.spec.ts | 6 +++--- .../expression/call/builtin/textureSampleCompare.spec.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) 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 1588eb05b751..f4cf696de029 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts @@ -67,7 +67,7 @@ Validates that only incorrect coords arguments are rejected by ${builtin} .beginSubcases() .combine('value', [-1, 0, 1] as const) // filter out unsigned types with negative values - .filter(t => isUnsignedType(kValuesTypes[t.coordType]) && t.value < 0) + .filter(t => !isUnsignedType(kValuesTypes[t.coordType]) || t.value >= 0) .expand('offset', ({ textureType }) => { const offset = kValidTextureSampleParameterTypes[textureType].offsetArgType; return offset ? [false, true] : [false]; @@ -113,7 +113,7 @@ Validates that only incorrect array_index arguments are rejected by ${builtin} .beginSubcases() .combine('value', [-9, -8, 0, 7, 8]) // filter out unsigned types with negative values - .filter(t => isUnsignedType(kValuesTypes[t.arrayIndexType]) && t.value < 0) + .filter(t => !isUnsignedType(kValuesTypes[t.arrayIndexType]) || t.value >= 0) ) .fn(t => { const { textureType, arrayIndexType, value } = t.params; @@ -153,7 +153,7 @@ Validates that only incorrect offset arguments are rejected by ${builtin} .beginSubcases() .combine('value', [-9, -8, 0, 7, 8]) // filter out unsigned types with negative values - .filter(t => isUnsignedType(kValuesTypes[t.offsetType]) && t.value < 0) + .filter(t => !isUnsignedType(kValuesTypes[t.offsetType]) || t.value >= 0) ) .fn(t => { const { textureType, offsetType, value } = t.params; diff --git a/src/webgpu/shader/validation/expression/call/builtin/textureSampleCompare.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/textureSampleCompare.spec.ts index 21269b211c20..aa7e769b94f2 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/textureSampleCompare.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/textureSampleCompare.spec.ts @@ -57,7 +57,7 @@ Validates that only incorrect coords arguments are rejected by ${builtin} .beginSubcases() .combine('value', [-1, 0, 1] as const) // filter out unsigned types with negative values - .filter(t => isUnsignedType(kValuesTypes[t.coordType]) && t.value < 0) + .filter(t => !isUnsignedType(kValuesTypes[t.coordType]) || t.value >= 0) .expand('offset', ({ textureType }) => { const offset = kValidTextureSampleCompareParameterTypes[textureType].offsetArgType; return offset ? [false, true] : [false]; @@ -103,7 +103,7 @@ Validates that only incorrect array_index arguments are rejected by ${builtin} .beginSubcases() .combine('value', [-9, -8, 0, 7, 8]) // filter out unsigned types with negative values - .filter(t => isUnsignedType(kValuesTypes[t.arrayIndexType]) && t.value < 0) + .filter(t => !isUnsignedType(kValuesTypes[t.arrayIndexType]) || t.value >= 0) ) .fn(t => { const { textureType, arrayIndexType, value } = t.params; @@ -141,7 +141,7 @@ Validates that only incorrect depth_ref arguments are rejected by ${builtin} .beginSubcases() .combine('value', [-1, 0, 1]) // filter out unsigned types with negative values - .filter(t => isUnsignedType(kValuesTypes[t.depthRefType]) && t.value < 0) + .filter(t => !isUnsignedType(kValuesTypes[t.depthRefType]) || t.value >= 0) ) .fn(t => { const { textureType, depthRefType, value } = t.params; @@ -182,7 +182,7 @@ Validates that only incorrect offset arguments are rejected by ${builtin} .beginSubcases() .combine('value', [-9, -8, 0, 7, 8]) // filter out unsigned types with negative values - .filter(t => isUnsignedType(kValuesTypes[t.offsetType]) && t.value < 0) + .filter(t => !isUnsignedType(kValuesTypes[t.offsetType]) || t.value >= 0) ) .fn(t => { const { textureType, offsetType, value } = t.params;