From adaa4793aae30c2b96c94eaa72b93c61f9ea62ab Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 7 Mar 2024 15:34:14 -0500 Subject: [PATCH] Simplify some type constants (#3461) This CL adds `kAllScalarsAndVec` and a `kConvertableToFloatScalarsAndVec` helper types which allow removing a couple of the combined type helpers. --- src/resources/cache/hashes.json | 216 +++++++++--------- .../cache/webgpu/shader/execution/bitcast.bin | Bin 2221448 -> 2221448 bytes .../expression/call/builtin/abs.spec.ts | 12 +- .../expression/call/builtin/acos.spec.ts | 8 +- .../expression/call/builtin/acosh.spec.ts | 8 +- .../expression/call/builtin/asin.spec.ts | 8 +- .../expression/call/builtin/asinh.spec.ts | 8 +- .../expression/call/builtin/atan.spec.ts | 8 +- .../expression/call/builtin/atanh.spec.ts | 8 +- .../expression/call/builtin/ceil.spec.ts | 8 +- .../expression/call/builtin/clamp.spec.ts | 8 +- .../expression/call/builtin/cos.spec.ts | 9 +- .../expression/call/builtin/cosh.spec.ts | 8 +- .../expression/call/builtin/degrees.spec.ts | 8 +- .../expression/call/builtin/exp.spec.ts | 10 +- .../expression/call/builtin/exp2.spec.ts | 10 +- .../expression/call/builtin/floor.spec.ts | 9 +- .../call/builtin/inverseSqrt.spec.ts | 9 +- .../expression/call/builtin/length.spec.ts | 20 +- .../expression/call/builtin/log.spec.ts | 8 +- .../expression/call/builtin/log2.spec.ts | 9 +- .../expression/call/builtin/modf.spec.ts | 8 +- .../expression/call/builtin/radians.spec.ts | 8 +- .../expression/call/builtin/round.spec.ts | 8 +- .../expression/call/builtin/saturate.spec.ts | 8 +- .../expression/call/builtin/sign.spec.ts | 8 +- .../expression/call/builtin/sin.spec.ts | 8 +- .../expression/call/builtin/sinh.spec.ts | 8 +- .../expression/call/builtin/sqrt.spec.ts | 8 +- .../expression/call/builtin/tan.spec.ts | 8 +- src/webgpu/util/conversion.ts | 72 +++--- 31 files changed, 214 insertions(+), 322 deletions(-) diff --git a/src/resources/cache/hashes.json b/src/resources/cache/hashes.json index 87d6fb0b51da..e92b0937b6d4 100644 --- a/src/resources/cache/hashes.json +++ b/src/resources/cache/hashes.json @@ -1,110 +1,110 @@ { - "webgpu/shader/execution/binary/af_addition.bin": "4440d4b4", - "webgpu/shader/execution/binary/af_logical.bin": "c54d7fff", - "webgpu/shader/execution/binary/af_division.bin": "d17fa436", - "webgpu/shader/execution/binary/af_matrix_addition.bin": "7a788e99", - "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "f84dd903", - "webgpu/shader/execution/binary/af_multiplication.bin": "5334f9e1", - "webgpu/shader/execution/binary/af_remainder.bin": "470a66d7", - "webgpu/shader/execution/binary/af_subtraction.bin": "2c78e197", - "webgpu/shader/execution/binary/f16_addition.bin": "a579fc47", - "webgpu/shader/execution/binary/f16_logical.bin": "1f3267c4", - "webgpu/shader/execution/binary/f16_division.bin": "dfb9f322", - "webgpu/shader/execution/binary/f16_matrix_addition.bin": "ca9128f5", - "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "88155047", - "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "15278661", - "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "aaa23b6", - "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "7d9e4d5c", - "webgpu/shader/execution/binary/f16_multiplication.bin": "f9d4994", - "webgpu/shader/execution/binary/f16_remainder.bin": "244c4ad6", - "webgpu/shader/execution/binary/f16_subtraction.bin": "ed388083", - "webgpu/shader/execution/binary/f32_addition.bin": "22c323e7", - "webgpu/shader/execution/binary/f32_logical.bin": "b5a1fcd6", - "webgpu/shader/execution/binary/f32_division.bin": "af0c6a91", - "webgpu/shader/execution/binary/f32_matrix_addition.bin": "cea1c11f", - "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "4ca215e2", - "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "e0ecc16f", - "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "cd1f8542", - "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "d4d592a1", - "webgpu/shader/execution/binary/f32_multiplication.bin": "bad73246", - "webgpu/shader/execution/binary/f32_remainder.bin": "fd8b81ca", - "webgpu/shader/execution/binary/f32_subtraction.bin": "ab7a62cd", - "webgpu/shader/execution/binary/i32_arithmetic.bin": "390c929d", - "webgpu/shader/execution/binary/i32_comparison.bin": "21a872e9", - "webgpu/shader/execution/binary/u32_arithmetic.bin": "b6785d3e", - "webgpu/shader/execution/binary/u32_comparison.bin": "20e75aaf", - "webgpu/shader/execution/abs.bin": "7a1a8101", - "webgpu/shader/execution/acos.bin": "4f35a566", - "webgpu/shader/execution/acosh.bin": "1ddcdd7f", - "webgpu/shader/execution/asin.bin": "8c73cd", - "webgpu/shader/execution/asinh.bin": "9737e4c9", - "webgpu/shader/execution/atan.bin": "1274adbb", - "webgpu/shader/execution/atan2.bin": "6d414c8c", - "webgpu/shader/execution/atanh.bin": "ae463ca8", - "webgpu/shader/execution/bitcast.bin": "6acaafbe", - "webgpu/shader/execution/ceil.bin": "891015dc", - "webgpu/shader/execution/clamp.bin": "b1a757bd", - "webgpu/shader/execution/cos.bin": "1754b8bf", - "webgpu/shader/execution/cosh.bin": "db77b7bb", - "webgpu/shader/execution/cross.bin": "b4242751", - "webgpu/shader/execution/degrees.bin": "c19fa30", - "webgpu/shader/execution/determinant.bin": "28eea1a1", - "webgpu/shader/execution/distance.bin": "286532ef", - "webgpu/shader/execution/dot.bin": "68354d0d", - "webgpu/shader/execution/exp.bin": "8df9e76d", - "webgpu/shader/execution/exp2.bin": "494e5007", - "webgpu/shader/execution/faceForward.bin": "944e22", - "webgpu/shader/execution/floor.bin": "24434e6e", - "webgpu/shader/execution/fma.bin": "14d92aba", - "webgpu/shader/execution/fract.bin": "7bc1425a", - "webgpu/shader/execution/frexp.bin": "f6631fec", - "webgpu/shader/execution/inverseSqrt.bin": "511e859", - "webgpu/shader/execution/ldexp.bin": "f5d530d6", - "webgpu/shader/execution/length.bin": "b3dac96e", - "webgpu/shader/execution/log.bin": "34156eea", - "webgpu/shader/execution/log2.bin": "877d274b", - "webgpu/shader/execution/max.bin": "42174209", - "webgpu/shader/execution/min.bin": "e3ebfbb8", - "webgpu/shader/execution/mix.bin": "fd942c9a", - "webgpu/shader/execution/modf.bin": "1679c273", - "webgpu/shader/execution/normalize.bin": "be31d825", - "webgpu/shader/execution/pack2x16float.bin": "7e3e86c3", - "webgpu/shader/execution/pow.bin": "bf4ec2d7", - "webgpu/shader/execution/quantizeToF16.bin": "5d067d96", - "webgpu/shader/execution/radians.bin": "ebe086b6", - "webgpu/shader/execution/reflect.bin": "700f38a0", - "webgpu/shader/execution/refract.bin": "c859267f", - "webgpu/shader/execution/round.bin": "88045cd4", - "webgpu/shader/execution/saturate.bin": "dae68a14", - "webgpu/shader/execution/sign.bin": "91b4c481", - "webgpu/shader/execution/sin.bin": "1300bbbf", - "webgpu/shader/execution/sinh.bin": "27ab484c", - "webgpu/shader/execution/smoothstep.bin": "cfcaa136", - "webgpu/shader/execution/sqrt.bin": "4ae8ec04", - "webgpu/shader/execution/step.bin": "a83d7ab5", - "webgpu/shader/execution/tan.bin": "68b7a197", - "webgpu/shader/execution/tanh.bin": "32474b6e", - "webgpu/shader/execution/transpose.bin": "84e5ec15", - "webgpu/shader/execution/trunc.bin": "2fb9f2b", - "webgpu/shader/execution/unpack2x16float.bin": "4eef83ca", - "webgpu/shader/execution/unpack2x16snorm.bin": "5a8de9dc", - "webgpu/shader/execution/unpack2x16unorm.bin": "24b228cc", - "webgpu/shader/execution/unpack4x8snorm.bin": "7d98eec7", - "webgpu/shader/execution/unpack4x8unorm.bin": "546459f9", - "webgpu/shader/execution/unary/af_arithmetic.bin": "e31cea5d", - "webgpu/shader/execution/unary/af_assignment.bin": "ce59880f", - "webgpu/shader/execution/unary/bool_conversion.bin": "1bae513f", - "webgpu/shader/execution/unary/f16_arithmetic.bin": "9276efd8", - "webgpu/shader/execution/unary/f16_conversion.bin": "254f60da", - "webgpu/shader/execution/unary/f32_arithmetic.bin": "ed5d236e", - "webgpu/shader/execution/unary/f32_conversion.bin": "c570be4c", - "webgpu/shader/execution/unary/i32_arithmetic.bin": "cc46fe", - "webgpu/shader/execution/unary/i32_conversion.bin": "457ade75", - "webgpu/shader/execution/unary/u32_conversion.bin": "4900fd1c", - "webgpu/shader/execution/unary/ai_assignment.bin": "1bdfc2f", - "webgpu/shader/execution/binary/ai_arithmetic.bin": "80388ed7", - "webgpu/shader/execution/unary/ai_arithmetic.bin": "fb7c8c8b", - "webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "64af08ac", - "webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "58e9a3ca", - "webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "77ca543f" + "webgpu/shader/execution/binary/af_addition.bin": "1a138e40", + "webgpu/shader/execution/binary/af_logical.bin": "2a334d4b", + "webgpu/shader/execution/binary/af_division.bin": "801a63d2", + "webgpu/shader/execution/binary/af_matrix_addition.bin": "d392437a", + "webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "8a56ca30", + "webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "3b36edc4", + "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "c2a167d1", + "webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "3bdd724b", + "webgpu/shader/execution/binary/af_multiplication.bin": "af6472be", + "webgpu/shader/execution/binary/af_remainder.bin": "582570bc", + "webgpu/shader/execution/binary/af_subtraction.bin": "65e85cff", + "webgpu/shader/execution/binary/ai_arithmetic.bin": "3876accd", + "webgpu/shader/execution/binary/f16_addition.bin": "12057229", + "webgpu/shader/execution/binary/f16_logical.bin": "b6ee9faf", + "webgpu/shader/execution/binary/f16_division.bin": "9f3479f0", + "webgpu/shader/execution/binary/f16_matrix_addition.bin": "a19f6dc5", + "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "be7786cc", + "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "afbc3dd2", + "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "84f6917", + "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "9036e4da", + "webgpu/shader/execution/binary/f16_multiplication.bin": "946528a5", + "webgpu/shader/execution/binary/f16_remainder.bin": "6e7cb89", + "webgpu/shader/execution/binary/f16_subtraction.bin": "55fe509d", + "webgpu/shader/execution/binary/f32_addition.bin": "3d2058bb", + "webgpu/shader/execution/binary/f32_logical.bin": "390ba598", + "webgpu/shader/execution/binary/f32_division.bin": "73fa9316", + "webgpu/shader/execution/binary/f32_matrix_addition.bin": "afb0e609", + "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "745cb3d9", + "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "1fa39b30", + "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "a0b386f7", + "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "89c1eca2", + "webgpu/shader/execution/binary/f32_multiplication.bin": "712f02a6", + "webgpu/shader/execution/binary/f32_remainder.bin": "8304c08d", + "webgpu/shader/execution/binary/f32_subtraction.bin": "ccdf094f", + "webgpu/shader/execution/binary/i32_arithmetic.bin": "8a775ab8", + "webgpu/shader/execution/binary/i32_comparison.bin": "dd37b753", + "webgpu/shader/execution/binary/u32_arithmetic.bin": "c3781404", + "webgpu/shader/execution/binary/u32_comparison.bin": "bed8f168", + "webgpu/shader/execution/abs.bin": "61e06f54", + "webgpu/shader/execution/acos.bin": "1402a723", + "webgpu/shader/execution/acosh.bin": "828c987f", + "webgpu/shader/execution/asin.bin": "557d3d3f", + "webgpu/shader/execution/asinh.bin": "be348f39", + "webgpu/shader/execution/atan.bin": "963520fc", + "webgpu/shader/execution/atan2.bin": "a912218b", + "webgpu/shader/execution/atanh.bin": "f46f32cc", + "webgpu/shader/execution/bitcast.bin": "44bd25ea", + "webgpu/shader/execution/ceil.bin": "7debbc4c", + "webgpu/shader/execution/clamp.bin": "26d3bfb", + "webgpu/shader/execution/cos.bin": "a64fea9a", + "webgpu/shader/execution/cosh.bin": "dfd5945e", + "webgpu/shader/execution/cross.bin": "4835bc3a", + "webgpu/shader/execution/degrees.bin": "528e631e", + "webgpu/shader/execution/determinant.bin": "e3866c2b", + "webgpu/shader/execution/distance.bin": "4d015170", + "webgpu/shader/execution/dot.bin": "c67a6363", + "webgpu/shader/execution/exp.bin": "c483696", + "webgpu/shader/execution/exp2.bin": "b248fa4b", + "webgpu/shader/execution/faceForward.bin": "429078d0", + "webgpu/shader/execution/floor.bin": "2f4fb64b", + "webgpu/shader/execution/fma.bin": "8cf2c018", + "webgpu/shader/execution/fract.bin": "4fe1141d", + "webgpu/shader/execution/frexp.bin": "38dd5724", + "webgpu/shader/execution/inverseSqrt.bin": "b010463d", + "webgpu/shader/execution/ldexp.bin": "94762c6c", + "webgpu/shader/execution/length.bin": "9007cea7", + "webgpu/shader/execution/log.bin": "8918d035", + "webgpu/shader/execution/log2.bin": "55ab0d73", + "webgpu/shader/execution/max.bin": "ea6871eb", + "webgpu/shader/execution/min.bin": "da3976b4", + "webgpu/shader/execution/mix.bin": "716aa87b", + "webgpu/shader/execution/modf.bin": "97fb95d0", + "webgpu/shader/execution/normalize.bin": "b4b3d66d", + "webgpu/shader/execution/pack2x16float.bin": "65dca45b", + "webgpu/shader/execution/pow.bin": "9c93c51e", + "webgpu/shader/execution/quantizeToF16.bin": "9bba3a59", + "webgpu/shader/execution/radians.bin": "31835823", + "webgpu/shader/execution/reflect.bin": "cef377fe", + "webgpu/shader/execution/refract.bin": "6a72b15f", + "webgpu/shader/execution/round.bin": "eb65ff2d", + "webgpu/shader/execution/saturate.bin": "6be2db42", + "webgpu/shader/execution/sign.bin": "6c0ac68f", + "webgpu/shader/execution/sin.bin": "6548201", + "webgpu/shader/execution/sinh.bin": "df389ed", + "webgpu/shader/execution/smoothstep.bin": "90af9360", + "webgpu/shader/execution/sqrt.bin": "37f1d81b", + "webgpu/shader/execution/step.bin": "a2a1103e", + "webgpu/shader/execution/tan.bin": "db82969", + "webgpu/shader/execution/tanh.bin": "9469a1c6", + "webgpu/shader/execution/transpose.bin": "51d503cb", + "webgpu/shader/execution/trunc.bin": "c5e6ed27", + "webgpu/shader/execution/unpack2x16float.bin": "a4812794", + "webgpu/shader/execution/unpack2x16snorm.bin": "48982cdb", + "webgpu/shader/execution/unpack2x16unorm.bin": "8a52d694", + "webgpu/shader/execution/unpack4x8snorm.bin": "de64f4f", + "webgpu/shader/execution/unpack4x8unorm.bin": "42074fbd", + "webgpu/shader/execution/unary/af_arithmetic.bin": "677d6662", + "webgpu/shader/execution/unary/af_assignment.bin": "9035f5c0", + "webgpu/shader/execution/unary/ai_arithmetic.bin": "62304038", + "webgpu/shader/execution/unary/ai_assignment.bin": "d0ecdfb1", + "webgpu/shader/execution/unary/bool_conversion.bin": "9df31641", + "webgpu/shader/execution/unary/f16_arithmetic.bin": "55060b95", + "webgpu/shader/execution/unary/f16_conversion.bin": "2a471445", + "webgpu/shader/execution/unary/f32_arithmetic.bin": "de075203", + "webgpu/shader/execution/unary/f32_conversion.bin": "8c96deed", + "webgpu/shader/execution/unary/i32_arithmetic.bin": "11e8bb3", + "webgpu/shader/execution/unary/i32_conversion.bin": "a3062e7d", + "webgpu/shader/execution/unary/u32_conversion.bin": "c1c5240c" } \ No newline at end of file diff --git a/src/resources/cache/webgpu/shader/execution/bitcast.bin b/src/resources/cache/webgpu/shader/execution/bitcast.bin index d3954903ac89afcfbe5049a356005ed02cf10aae..3c24c88e1ffbc42f87639912bacab411154e6d63 100644 GIT binary patch delta 151 zcmWN=M-6~L006yPYE?jRVw)gr0)tx&a delta 152 zcmWN=%MpSw6hP4l3d%o-f*(*Rf!897WKSO%h7G$EpiObl%&~u?EEgxU8};PHcu@>^ r;E^FCo_J==gef!TELc*r;)OM@ys=@+J0E=V#g0AS{P4SZ8Gh>y9V9$( diff --git a/src/webgpu/shader/validation/expression/call/builtin/abs.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/abs.spec.ts index b51fc02ade0d..183fa296248f 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/abs.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/abs.spec.ts @@ -5,12 +5,7 @@ Validation tests for the ${builtin}() builtin. import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; import { keysOf, objectsToRecord } from '../../../../../../common/util/data_tables.js'; -import { - TypeF16, - elementType, - kAllFloatAndConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, -} from '../../../../../util/conversion.js'; +import { TypeF16, elementType, kAllScalarsAndVectors } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; import { @@ -22,10 +17,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatAndConcreteIntegerScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kAllScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/acos.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/acos.spec.ts index 8883bd72e11c..dc9ed497574e 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/acos.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/acos.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { absBigInt } from '../../../../../util/math.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -27,10 +26,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/acosh.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/acosh.spec.ts index 29cb1aad44e1..31e44f373b0d 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/acosh.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/acosh.spec.ts @@ -9,10 +9,9 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, TypeAbstractInt, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, TypeAbstractFloat, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; @@ -29,10 +28,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/asin.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/asin.spec.ts index 82f426035729..5c698f589f74 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/asin.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/asin.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { absBigInt } from '../../../../../util/math.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -27,10 +26,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/asinh.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/asinh.spec.ts index 6cff91c384da..4e1fc37ffd5e 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/asinh.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/asinh.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, TypeAbstractFloat, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; @@ -29,10 +28,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); const additionalRangeForType = rangeForType( linearRange(-2000, 2000, 10), diff --git a/src/webgpu/shader/validation/expression/call/builtin/atan.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/atan.spec.ts index 8ad4230bc58d..201ff5efd550 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/atan.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/atan.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -26,10 +25,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/atanh.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/atanh.spec.ts index a299284c877b..d45df767c223 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/atanh.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/atanh.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { absBigInt } from '../../../../../util/math.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -27,10 +26,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/ceil.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/ceil.spec.ts index d415c4b9dd3c..bf76b3f2f11b 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/ceil.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/ceil.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -24,10 +23,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts index b05bc030f437..638c5ae2e884 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/clamp.spec.ts @@ -8,7 +8,8 @@ import { keysOf, objectsToRecord } from '../../../../../../common/util/data_tabl import { TypeF16, elementType, - kAllFloatAndConcreteIntegerScalarsAndVectors, + kAllFloatScalarsAndVectors, + kAllConcreteIntegerScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -21,7 +22,10 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord(kAllFloatAndConcreteIntegerScalarsAndVectors); +const kValuesTypes = objectsToRecord([ + ...kAllFloatScalarsAndVectors, + ...kAllConcreteIntegerScalarsAndVectors, +]); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/cos.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/cos.spec.ts index b62c236803c0..7975d7d7c6d5 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/cos.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/cos.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -26,10 +25,8 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); + g.test('values') .desc( ` diff --git a/src/webgpu/shader/validation/expression/call/builtin/cosh.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/cosh.spec.ts index 55d0200ef16b..9a4864c4f972 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/cosh.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/cosh.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, TypeAbstractFloat, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; @@ -26,10 +25,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/degrees.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/degrees.spec.ts index 4e4137daf4bd..9c60548e01dd 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/degrees.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/degrees.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, TypeAbstractFloat, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; @@ -26,10 +25,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/exp.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/exp.spec.ts index a7a37fb08cdb..b4a76018f2a0 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/exp.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/exp.spec.ts @@ -9,11 +9,10 @@ import { kValue } from '../../../../../util/constants.js'; import { TypeF16, TypeF32, + TypeAbstractFloat, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - TypeAbstractFloat, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -27,10 +26,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); const valueForType = rangeForType( [ diff --git a/src/webgpu/shader/validation/expression/call/builtin/exp2.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/exp2.spec.ts index 40a8542b8d95..36074ee42ecc 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/exp2.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/exp2.spec.ts @@ -9,11 +9,10 @@ import { kValue } from '../../../../../util/constants.js'; import { TypeF16, TypeF32, + TypeAbstractFloat, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - TypeAbstractFloat, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -27,10 +26,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); const valueForType = rangeForType( [ diff --git a/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts index 6a12c3d67db8..998ca5618344 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -24,10 +23,8 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); + g.test('values') .desc( ` diff --git a/src/webgpu/shader/validation/expression/call/builtin/inverseSqrt.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/inverseSqrt.spec.ts index f459303d580b..fc9351584b08 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/inverseSqrt.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/inverseSqrt.spec.ts @@ -9,10 +9,9 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, TypeAbstractFloat, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -28,10 +27,8 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); + g.test('values') .desc( ` diff --git a/src/webgpu/shader/validation/expression/call/builtin/length.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/length.spec.ts index 1f24a86d9107..cb9be19963f2 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/length.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/length.spec.ts @@ -10,16 +10,12 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalars, - kAllFloatVector2, - kAllFloatVector3, - kAllFloatVector4, kAllConcreteIntegerScalarsAndVectors, - kAbstractIntegerScalar, - kAbstractIntegerVector2, + kConvertableToFloatScalar, + kConvertableToFloatVec2, + kConvertableToFloatVec3, + kConvertableToFloatVec4, TypeAbstractFloat, - kAbstractIntegerVector3, - kAbstractIntegerVector4, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -72,7 +68,7 @@ function calculate( }; } -const kScalarTypes = objectsToRecord([...kAbstractIntegerScalar, ...kAllFloatScalars]); +const kScalarTypes = objectsToRecord(kConvertableToFloatScalar); g.test('scalar') .desc( @@ -106,7 +102,7 @@ the input scalar value always compiles without error ); }); -const kVec2Types = objectsToRecord([...kAbstractIntegerVector2, ...kAllFloatVector2]); +const kVec2Types = objectsToRecord(kConvertableToFloatVec2); g.test('vec2') .desc( @@ -141,7 +137,7 @@ Validates that constant evaluation and override evaluation of ${builtin}() with ); }); -const kVec3Types = objectsToRecord([...kAbstractIntegerVector3, ...kAllFloatVector3]); +const kVec3Types = objectsToRecord(kConvertableToFloatVec3); g.test('vec3') .desc( @@ -177,7 +173,7 @@ Validates that constant evaluation and override evaluation of ${builtin}() with ); }); -const kVec4Types = objectsToRecord([...kAbstractIntegerVector4, ...kAllFloatVector4]); +const kVec4Types = objectsToRecord(kConvertableToFloatVec4); g.test('vec4') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/log.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/log.spec.ts index bffc433103e8..79036e5d86b9 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/log.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/log.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -24,10 +23,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/log2.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/log2.spec.ts index 6eaf08993c8c..dff27e655c99 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/log2.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/log2.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -24,10 +23,8 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); + g.test('values') .desc( ` diff --git a/src/webgpu/shader/validation/expression/call/builtin/modf.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/modf.spec.ts index bdb0691436f4..6b809dc31ca1 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/modf.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/modf.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -24,10 +23,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/radians.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/radians.spec.ts index 8cb7f62d92b9..3c9105a11fd6 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/radians.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/radians.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -24,10 +23,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/round.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/round.spec.ts index 267c743c805f..39c170496d5e 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/round.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/round.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { fpTraitsFor } from '../../../../../util/floating_point.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -26,10 +25,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/saturate.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/saturate.spec.ts index c7b0a50e9409..8ac53d8a4e9a 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/saturate.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/saturate.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -24,10 +23,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/sign.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/sign.spec.ts index f844961aee27..b9d58a4cf9ca 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/sign.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/sign.spec.ts @@ -9,7 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatAndSignedIntegerScalarsAndVectors, + kAllFloatScalarsAndVectors, + kAllSignedIntegerScalarsAndVectors, kAllUnsignedIntegerScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -23,7 +24,10 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord(kAllFloatAndSignedIntegerScalarsAndVectors); +const kValuesTypes = objectsToRecord([ + ...kAllFloatScalarsAndVectors, + ...kAllSignedIntegerScalarsAndVectors, +]); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/sin.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/sin.spec.ts index 9e0d091e11d0..d300af4e26e9 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/sin.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/sin.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -26,10 +25,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/sinh.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/sinh.spec.ts index d4c94e1a5290..6f7764c0dbd4 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/sinh.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/sinh.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, TypeAbstractFloat, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; @@ -26,10 +25,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/sqrt.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/sqrt.spec.ts index 0844652acdf6..96b3d8cbba5b 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/sqrt.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/sqrt.spec.ts @@ -9,9 +9,8 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, + kConvertableToFloatScalarsAndVectors, TypeAbstractFloat, } from '../../../../../util/conversion.js'; import { isRepresentable } from '../../../../../util/floating_point.js'; @@ -28,10 +27,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/shader/validation/expression/call/builtin/tan.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/tan.spec.ts index 02616455a67e..7f24912476f5 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/tan.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/tan.spec.ts @@ -9,10 +9,9 @@ import { TypeF16, TypeF32, elementType, - kAllFloatScalarsAndVectors, kAllConcreteIntegerScalarsAndVectors, - kAllAbstractIntegerScalarAndVectors, TypeAbstractFloat, + kConvertableToFloatScalarsAndVectors, } from '../../../../../util/conversion.js'; import { fpTraitsFor } from '../../../../../util/floating_point.js'; import { ShaderValidationTest } from '../../../shader_validation_test.js'; @@ -28,10 +27,7 @@ import { export const g = makeTestGroup(ShaderValidationTest); -const kValuesTypes = objectsToRecord([ - ...kAllAbstractIntegerScalarAndVectors, - ...kAllFloatScalarsAndVectors, -]); +const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors); g.test('values') .desc( diff --git a/src/webgpu/util/conversion.ts b/src/webgpu/util/conversion.ts index ac6ff5bbea38..6e4f09cc5940 100644 --- a/src/webgpu/util/conversion.ts +++ b/src/webgpu/util/conversion.ts @@ -1654,33 +1654,26 @@ export function isFloatType(ty: Type): boolean { export const kAllFloatScalars = [TypeAbstractFloat, TypeF32, TypeF16] as const; /// All floating-point vec2 types -export const kAllFloatVector2 = [ +const kAllFloatVec2 = [ TypeVec(2, TypeAbstractFloat), TypeVec(2, TypeF32), TypeVec(2, TypeF16), ] as const; /// All floating-point vec3 types -export const kAllFloatVector3 = [ +const kAllFloatVec3 = [ TypeVec(3, TypeAbstractFloat), TypeVec(3, TypeF32), TypeVec(3, TypeF16), ] as const; /// All floating-point vec4 types -export const kAllFloatVector4 = [ +const kAllFloatVec4 = [ TypeVec(4, TypeAbstractFloat), TypeVec(4, TypeF32), TypeVec(4, TypeF16), ] as const; -/// All floating-point vector types -export const kAllFloatVectors = [ - ...kAllFloatVector2, - ...kAllFloatVector3, - ...kAllFloatVector4, -] as const; - /// All f16 floating-point scalar and vector types export const kAllF16ScalarsAndVectors = [ TypeF16, @@ -1690,31 +1683,11 @@ export const kAllF16ScalarsAndVectors = [ ] as const; /// All floating-point scalar and vector types -export const kAllFloatScalarsAndVectors = [...kAllFloatScalars, ...kAllFloatVectors] as const; - -/// Abstract integer scalar type -export const kAbstractIntegerScalar = [TypeAbstractInt] as const; - -/// Abstract integer vec2 type -export const kAbstractIntegerVector2 = [TypeVec(2, TypeAbstractInt)] as const; - -/// Abstract integer vec3 type -export const kAbstractIntegerVector3 = [TypeVec(3, TypeAbstractInt)] as const; - -/// Abstract integer vec4 type -export const kAbstractIntegerVector4 = [TypeVec(4, TypeAbstractInt)] as const; - -/// All abstract integer scalar vector types -export const kAbstractIntegerVectors = [ - ...kAbstractIntegerVector2, - ...kAbstractIntegerVector3, - ...kAbstractIntegerVector4, -] as const; - -/// Abstract integer scalar and vector types -export const kAllAbstractIntegerScalarAndVectors = [ - ...kAbstractIntegerScalar, - ...kAbstractIntegerVectors, +export const kAllFloatScalarsAndVectors = [ + ...kAllFloatScalars, + ...kAllFloatVec2, + ...kAllFloatVec3, + ...kAllFloatVec4, ] as const; // Abstract and concrete integer types are not grouped into an 'all' type, @@ -1752,16 +1725,31 @@ export const kAllUnsignedIntegerScalarsAndVectors = [ TypeVec(4, TypeU32), ] as const; -/// All floating-point and integer scalar and vector types -export const kAllFloatAndConcreteIntegerScalarsAndVectors = [ +/// All types which are convertable to floating-point scalar types. +export const kConvertableToFloatScalar = [TypeAbstractInt, ...kAllFloatScalars] as const; + +/// All types which are convertable to floating-point vector 2 types. +export const kConvertableToFloatVec2 = [TypeVec(2, TypeAbstractInt), ...kAllFloatVec2] as const; + +/// All types which are convertable to floating-point vector 3 types. +export const kConvertableToFloatVec3 = [TypeVec(3, TypeAbstractInt), ...kAllFloatVec3] as const; + +/// All types which are convertable to floating-point vector 4 types. +export const kConvertableToFloatVec4 = [TypeVec(4, TypeAbstractInt), ...kAllFloatVec4] as const; + +/// All types which are convertable to floating-point scalar or vector types. +export const kConvertableToFloatScalarsAndVectors = [ + TypeAbstractInt, + TypeVec(2, TypeAbstractInt), + TypeVec(3, TypeAbstractInt), + TypeVec(4, TypeAbstractInt), ...kAllFloatScalarsAndVectors, - ...kAllConcreteIntegerScalarsAndVectors, ] as const; -/// All floating-point and signed integer scalar and vector types -export const kAllFloatAndSignedIntegerScalarsAndVectors = [ - ...kAllFloatScalarsAndVectors, - ...kAllSignedIntegerScalarsAndVectors, +/// All the scalar and vector types +export const kAllScalarsAndVectors = [ + ...kConvertableToFloatScalarsAndVectors, + ...kAllConcreteIntegerScalarsAndVectors, ] as const; /** @returns the inner element type of the given type */