Skip to content

Commit

Permalink
add negative values and unsigned type filter to textureSample
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Mar 14, 2024
1 parent a5d91d5 commit 1072160
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
isConvertible,
ScalarType,
VectorType,
isUnsignedType,
} from '../../../../../util/conversion.js';
import { ShaderValidationTest } from '../../../shader_validation_test.js';

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

0 comments on commit 1072160

Please sign in to comment.