diff options
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/call/builtin/unpack2x16snorm.spec.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/call/builtin/unpack2x16snorm.spec.ts | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/call/builtin/unpack2x16snorm.spec.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/call/builtin/unpack2x16snorm.spec.ts new file mode 100644 index 0000000000..6b003ad5d2 --- /dev/null +++ b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/call/builtin/unpack2x16snorm.spec.ts @@ -0,0 +1,40 @@ +export const description = ` +Decomposes a 32-bit value into two 16-bit chunks, then reinterprets each chunk +as a signed normalized floating point value. +Component i of the result is max(v ÷ 32767, -1), where v is the interpretation +of bits 16×i through 16×i+15 of e as a twos-complement signed integer. +`; + +import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; +import { GPUTest } from '../../../../../gpu_test.js'; +import { TypeF32, TypeU32, TypeVec } from '../../../../../util/conversion.js'; +import { unpack2x16snormInterval } from '../../../../../util/f32_interval.js'; +import { fullU32Range } from '../../../../../util/math.js'; +import { makeCaseCache } from '../../case_cache.js'; +import { allInputSources, generateU32ToVectorCases, run } from '../../expression.js'; + +import { builtin } from './builtin.js'; + +export const g = makeTestGroup(GPUTest); + +export const d = makeCaseCache('unpack2x16snorm', { + u32_const: () => { + return generateU32ToVectorCases(fullU32Range(), 'f32-only', unpack2x16snormInterval); + }, + u32_non_const: () => { + return generateU32ToVectorCases(fullU32Range(), 'unfiltered', unpack2x16snormInterval); + }, +}); + +g.test('unpack') + .specURL('https://www.w3.org/TR/WGSL/#unpack-builtin-functions') + .desc( + ` +@const fn unpack2x16snorm(e: u32) -> vec2<f32> +` + ) + .params(u => u.combine('inputSource', allInputSources)) + .fn(async t => { + const cases = await d.get(t.params.inputSource === 'const' ? 'u32_const' : 'u32_non_const'); + await run(t, builtin('unpack2x16snorm'), [TypeU32], TypeVec(2, TypeF32), t.params, cases); + }); |