From 9810c44f35d1bad0d0a1ecc7394a4d8ae1ce51fe Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Thu, 14 Mar 2024 17:20:51 -0700 Subject: [PATCH] Test varients of textureSample and textureSampleCompare w/wo offset --- .../expression/call/builtin/textureSample.spec.ts | 5 +++-- .../expression/call/builtin/textureSampleCompare.spec.ts | 9 +++++---- 2 files changed, 8 insertions(+), 6 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 4bdafdef417d..bdd3cbd8e8f0 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/textureSample.spec.ts @@ -8,6 +8,7 @@ Validation tests for the ${builtin}() builtin. * test textureSample offset parameter must be correct type * test textureSample offset parameter must be a const-expression * test textureSample offset parameter must be between -8 and +7 inclusive +* test textureSample not usable in a compute or vertex shader note: uniformity validation is covered in src/webgpu/shader/validation/uniformity/uniformity.spec.ts `; @@ -124,14 +125,14 @@ Validates that only incorrect array_index arguments are rejected by ${builtin} ) ) .fn(t => { - const { textureType, arrayIndexType, value } = t.params; + const { textureType, arrayIndexType, value, offset } = t.params; const arrayIndexArgType = kValuesTypes[arrayIndexType]; const args = [arrayIndexArgType.create(value)]; const { coordsArgType, offsetArgType } = kValidTextureSampleParameterTypes[textureType]; const coordWGSL = coordsArgType.create(0).wgsl(); const arrayWGSL = args.map(arg => arg.wgsl()).join(', '); - const offsetWGSL = offsetArgType ? `, ${offsetArgType.create(0).wgsl()}` : ''; + const offsetWGSL = offset ? `, ${offsetArgType!.create(0).wgsl()}` : ''; const code = ` @group(0) @binding(0) var s: sampler; 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 adbd6111684c..9c07d0354a80 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/textureSampleCompare.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/textureSampleCompare.spec.ts @@ -8,6 +8,7 @@ Validation tests for the ${builtin}() builtin. * test textureSampleCompare offset parameter must be correct type * test textureSampleCompare offset parameter must be a const-expression * test textureSampleCompare offset parameter must be between -8 and +7 inclusive +* test textureSample not usable in a compute or vertex shader note: uniformity validation is covered in src/webgpu/shader/validation/uniformity/uniformity.spec.ts `; @@ -118,14 +119,14 @@ Validates that only incorrect array_index arguments are rejected by ${builtin} ) ) .fn(t => { - const { textureType, arrayIndexType, value } = t.params; + const { textureType, arrayIndexType, value, offset } = t.params; const arrayIndexArgType = kValuesTypes[arrayIndexType]; const args = [arrayIndexArgType.create(value)]; const { coordsArgType, offsetArgType } = kValidTextureSampleCompareParameterTypes[textureType]; const coordWGSL = coordsArgType.create(0).wgsl(); const arrayWGSL = args.map(arg => arg.wgsl()).join(', '); - const offsetWGSL = offsetArgType ? `, ${offsetArgType.create(0).wgsl()}` : ''; + const offsetWGSL = offset ? `, ${offsetArgType!.create(0).wgsl()}` : ''; const code = ` @group(0) @binding(0) var s: sampler_comparison; @@ -162,7 +163,7 @@ Validates that only incorrect depth_ref arguments are rejected by ${builtin} ) ) .fn(t => { - const { textureType, depthRefType, value } = t.params; + const { textureType, depthRefType, value, offset } = t.params; const depthRefArgType = kValuesTypes[depthRefType]; const args = [depthRefArgType.create(value)]; const { coordsArgType, hasArrayIndexArg, offsetArgType } = @@ -171,7 +172,7 @@ Validates that only incorrect depth_ref arguments are rejected by ${builtin} const coordWGSL = coordsArgType.create(0).wgsl(); const arrayWGSL = hasArrayIndexArg ? ', 0' : ''; const depthRefWGSL = args.map(arg => arg.wgsl()).join(', '); - const offsetWGSL = offsetArgType ? `, ${offsetArgType.create(0).wgsl()}` : ''; + const offsetWGSL = offset ? `, ${offsetArgType!.create(0).wgsl()}` : ''; const code = ` @group(0) @binding(0) var s: sampler_comparison;