typegpu 0.10.1 → 0.11.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_virtual/_rolldown/runtime.js +13 -0
- package/builtin.d.ts +50 -0
- package/builtin.js +35 -0
- package/common/fullScreenTriangle.d.ts +22 -0
- package/common/fullScreenTriangle.js +34 -0
- package/common/index.d.ts +4 -4
- package/common/index.js +8 -7
- package/common/writeSoA.d.ts +16 -0
- package/common/writeSoA.js +90 -0
- package/core/buffer/buffer.d.ts +79 -0
- package/core/buffer/buffer.js +246 -0
- package/core/buffer/bufferShorthand.d.ts +48 -0
- package/core/buffer/bufferShorthand.js +53 -0
- package/core/buffer/bufferUsage.d.ts +43 -0
- package/core/buffer/bufferUsage.js +165 -0
- package/core/constant/tgpuConstant.d.ts +29 -0
- package/core/constant/tgpuConstant.js +68 -0
- package/core/declare/tgpuDeclare.d.ts +18 -0
- package/core/declare/tgpuDeclare.js +39 -0
- package/core/function/autoIO.d.ts +38 -0
- package/core/function/autoIO.js +85 -0
- package/core/function/comptime.d.ts +39 -0
- package/core/function/comptime.js +49 -0
- package/core/function/createCallableSchema.js +40 -0
- package/core/function/dualImpl.js +52 -0
- package/core/function/entryInputRouter.js +39 -0
- package/core/function/extractArgs.js +204 -0
- package/core/function/fnCore.js +90 -0
- package/core/function/fnTypes.d.ts +40 -0
- package/core/function/ioSchema.d.ts +10 -0
- package/core/function/ioSchema.js +51 -0
- package/core/function/shelllessImpl.d.ts +28 -0
- package/core/function/shelllessImpl.js +21 -0
- package/core/function/templateUtils.js +12 -0
- package/core/function/tgpuComputeFn.d.ts +48 -0
- package/core/function/tgpuComputeFn.js +55 -0
- package/core/function/tgpuFn.d.ts +52 -0
- package/core/function/tgpuFn.js +168 -0
- package/core/function/tgpuFragmentFn.d.ts +72 -0
- package/core/function/tgpuFragmentFn.js +63 -0
- package/core/function/tgpuVertexFn.d.ts +59 -0
- package/core/function/tgpuVertexFn.js +59 -0
- package/core/pipeline/applyPipelineState.js +35 -0
- package/core/pipeline/computePipeline.d.ts +54 -0
- package/core/pipeline/computePipeline.js +227 -0
- package/core/pipeline/connectAttachmentToShader.js +24 -0
- package/core/pipeline/connectTargetsToShader.js +27 -0
- package/core/pipeline/limitsOverflow.js +12 -0
- package/core/pipeline/pipelineUtils.js +29 -0
- package/core/pipeline/renderPipeline.d.ts +284 -0
- package/core/pipeline/renderPipeline.js +489 -0
- package/core/pipeline/timeable.d.ts +20 -0
- package/core/pipeline/timeable.js +55 -0
- package/core/pipeline/typeGuards.js +27 -0
- package/core/querySet/querySet.d.ts +20 -0
- package/core/querySet/querySet.js +104 -0
- package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +59 -0
- package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +94 -0
- package/core/resolve/externals.d.ts +8 -0
- package/core/resolve/externals.js +56 -0
- package/core/resolve/namespace.d.ts +38 -0
- package/core/resolve/namespace.js +39 -0
- package/core/resolve/resolveData.js +144 -0
- package/core/resolve/stitch.js +23 -0
- package/core/resolve/tgpuResolve.d.ts +153 -0
- package/core/resolve/tgpuResolve.js +66 -0
- package/core/root/configurableImpl.js +17 -0
- package/core/root/init.d.ts +64 -0
- package/core/root/init.js +464 -0
- package/core/root/rootTypes.d.ts +642 -0
- package/core/sampler/sampler.d.ts +31 -0
- package/core/sampler/sampler.js +116 -0
- package/core/simulate/tgpuSimulate.d.ts +36 -0
- package/core/simulate/tgpuSimulate.js +74 -0
- package/core/slot/accessor.d.ts +9 -0
- package/core/slot/accessor.js +95 -0
- package/core/slot/internalSlots.js +5 -0
- package/core/slot/lazy.d.ts +6 -0
- package/core/slot/lazy.js +40 -0
- package/core/slot/slot.d.ts +6 -0
- package/core/slot/slot.js +39 -0
- package/core/slot/slotTypes.d.ts +92 -0
- package/core/slot/slotTypes.js +19 -0
- package/core/texture/externalTexture.d.ts +6 -0
- package/core/texture/externalTexture.js +47 -0
- package/core/texture/texture.d.ts +114 -0
- package/core/texture/texture.js +314 -0
- package/core/texture/textureFormats.d.ts +29 -0
- package/core/texture/textureFormats.js +97 -0
- package/core/texture/textureProps.d.ts +11 -0
- package/core/texture/textureUtils.js +222 -0
- package/core/texture/usageExtension.d.ts +21 -0
- package/core/texture/usageExtension.js +19 -0
- package/core/unroll/tgpuUnroll.d.ts +68 -0
- package/core/unroll/tgpuUnroll.js +94 -0
- package/core/valueProxyUtils.js +42 -0
- package/core/variable/tgpuVariable.d.ts +38 -0
- package/core/variable/tgpuVariable.js +99 -0
- package/core/vertexLayout/connectAttributesToShader.js +57 -0
- package/core/vertexLayout/vertexAttribute.d.ts +29 -0
- package/core/vertexLayout/vertexLayout.d.ts +19 -0
- package/core/vertexLayout/vertexLayout.js +103 -0
- package/data/alignIO.js +14 -0
- package/data/alignmentOf.d.ts +9 -0
- package/data/alignmentOf.js +86 -0
- package/data/array.d.ts +26 -0
- package/data/array.js +46 -0
- package/data/atomic.d.ts +15 -0
- package/data/atomic.js +24 -0
- package/data/attributes.d.ts +121 -0
- package/data/attributes.js +145 -0
- package/data/autoStruct.d.ts +1 -0
- package/data/autoStruct.js +81 -0
- package/data/compiledIO.js +228 -0
- package/data/dataIO.js +556 -0
- package/data/dataTypes.d.ts +115 -0
- package/data/dataTypes.js +100 -0
- package/data/deepEqual.d.ts +25 -0
- package/data/deepEqual.js +56 -0
- package/data/disarray.d.ts +32 -0
- package/data/disarray.js +50 -0
- package/data/getLongestContiguousPrefix.d.ts +9 -0
- package/data/getLongestContiguousPrefix.js +13 -0
- package/data/index.d.ts +26 -4
- package/data/index.js +36 -9
- package/data/instanceToSchema.d.ts +33 -0
- package/data/isContiguous.d.ts +9 -0
- package/data/isContiguous.js +13 -0
- package/data/matrix.d.ts +124 -0
- package/data/matrix.js +531 -0
- package/data/numberOps.js +23 -0
- package/data/numeric.d.ts +81 -0
- package/data/numeric.js +221 -0
- package/data/offsetUtils.d.ts +33 -0
- package/data/offsetUtils.js +165 -0
- package/data/offsets.js +34 -0
- package/data/partialIO.js +113 -0
- package/data/ptr.d.ts +11 -0
- package/data/ptr.js +44 -0
- package/data/ref.d.ts +34 -0
- package/data/ref.js +94 -0
- package/data/sampler.d.ts +107 -0
- package/data/sampler.js +24 -0
- package/data/schemaCallWrapper.js +30 -0
- package/data/schemaMemoryLayout.js +198 -0
- package/data/sizeOf.d.ts +9 -0
- package/data/sizeOf.js +13 -0
- package/data/snippet.d.ts +26 -0
- package/data/snippet.js +70 -0
- package/data/struct.d.ts +17 -0
- package/data/struct.js +44 -0
- package/data/texture.d.ts +292 -0
- package/{texture-BagDrrks.js → data/texture.js} +6 -5
- package/data/unstruct.d.ts +24 -0
- package/data/unstruct.js +41 -0
- package/data/vector.d.ts +191 -0
- package/data/vector.js +239 -0
- package/data/vectorImpl.js +515 -0
- package/data/vectorOps.js +681 -0
- package/data/vertexFormatData.d.ts +190 -0
- package/data/vertexFormatData.js +109 -0
- package/data/wgslTypes.d.ts +924 -0
- package/data/wgslTypes.js +222 -0
- package/errors.d.ts +44 -0
- package/errors.js +131 -0
- package/execMode.js +49 -0
- package/extension.d.ts +11 -0
- package/extension.js +16 -0
- package/getGPUValue.js +7 -0
- package/index.d.ts +42 -243
- package/index.js +21 -6320
- package/indexNamedExports.d.ts +40 -0
- package/mathUtils.js +12 -0
- package/memo.js +22 -0
- package/nameRegistry.d.ts +30 -0
- package/nameRegistry.js +447 -0
- package/package.js +4 -0
- package/package.json +26 -26
- package/resolutionCtx.d.ts +19 -0
- package/resolutionCtx.js +612 -0
- package/shared/env.js +12 -0
- package/shared/generators.js +13 -0
- package/shared/meta.d.ts +39 -0
- package/shared/meta.js +61 -0
- package/shared/repr.d.ts +138 -0
- package/shared/stringify.js +20 -0
- package/shared/symbols.d.ts +70 -0
- package/shared/symbols.js +48 -0
- package/shared/utilityTypes.d.ts +33 -0
- package/shared/utilityTypes.js +6 -0
- package/shared/vertexFormat.d.ts +70 -0
- package/shared/vertexFormat.js +63 -0
- package/std/array.d.ts +7 -0
- package/std/array.js +25 -0
- package/std/atomic.d.ts +19 -0
- package/std/atomic.js +111 -0
- package/std/bitcast.d.ts +10 -0
- package/std/bitcast.js +41 -0
- package/std/boolean.d.ts +141 -0
- package/std/boolean.js +299 -0
- package/std/derivative.d.ts +16 -0
- package/std/derivative.js +87 -0
- package/std/discard.d.ts +6 -0
- package/std/discard.js +14 -0
- package/std/extensions.d.ts +6 -0
- package/std/extensions.js +12 -0
- package/std/index.d.ts +17 -4
- package/std/index.js +21 -7
- package/std/matrix.d.ts +41 -0
- package/std/matrix.js +85 -0
- package/std/numeric.d.ts +200 -0
- package/std/numeric.js +845 -0
- package/std/operators.d.ts +56 -0
- package/std/operators.js +227 -0
- package/std/packing.d.ts +26 -0
- package/std/packing.js +84 -0
- package/std/range.d.ts +24 -0
- package/std/range.js +38 -0
- package/std/subgroup.d.ts +47 -0
- package/std/subgroup.js +218 -0
- package/std/texture.d.ts +117 -0
- package/std/texture.js +207 -0
- package/tgpu.js +42 -0
- package/tgpuBindGroupLayout.d.ts +161 -0
- package/tgpuBindGroupLayout.js +272 -0
- package/tgpuUnstable.d.ts +48 -0
- package/tgpuUnstable.js +64 -0
- package/tgsl/accessIndex.js +43 -0
- package/tgsl/accessProp.js +115 -0
- package/tgsl/consoleLog/deserializers.js +115 -0
- package/tgsl/consoleLog/logGenerator.js +84 -0
- package/tgsl/consoleLog/serializers.js +223 -0
- package/tgsl/consoleLog/types.d.ts +52 -0
- package/tgsl/consoleLog/types.js +11 -0
- package/tgsl/conversion.js +198 -0
- package/tgsl/forOfUtils.js +71 -0
- package/tgsl/generationHelpers.d.ts +37 -0
- package/tgsl/generationHelpers.js +67 -0
- package/tgsl/math.js +43 -0
- package/tgsl/shaderGenerator.d.ts +20 -0
- package/tgsl/shaderGenerator_members.d.ts +2 -0
- package/tgsl/shaderGenerator_members.js +6 -0
- package/tgsl/shellless.d.ts +11 -0
- package/tgsl/shellless.js +46 -0
- package/tgsl/wgslGenerator.d.ts +36 -0
- package/tgsl/wgslGenerator.js +639 -0
- package/types.d.ts +265 -0
- package/types.js +43 -0
- package/unwrapper.d.ts +27 -0
- package/wgslExtensions.d.ts +5 -0
- package/wgslExtensions.js +17 -0
- package/builtin-DdtWpk2t.js +0 -818
- package/builtin-DdtWpk2t.js.map +0 -1
- package/chunk-BYypO7fO.js +0 -18
- package/common/index.d.ts.map +0 -1
- package/common/index.js.map +0 -1
- package/data/index.d.ts.map +0 -1
- package/data/index.js.map +0 -1
- package/deepEqual-DQxK4vdp.js +0 -413
- package/deepEqual-DQxK4vdp.js.map +0 -1
- package/extensions-DIVuAfBM.js +0 -2032
- package/extensions-DIVuAfBM.js.map +0 -1
- package/fullScreenTriangle-CfFyQd_0.js +0 -543
- package/fullScreenTriangle-CfFyQd_0.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/indexNamedExports-oL6tyaJ9.d.ts +0 -5697
- package/indexNamedExports-oL6tyaJ9.d.ts.map +0 -1
- package/operators-d-PMVTo7.js +0 -4158
- package/operators-d-PMVTo7.js.map +0 -1
- package/std/index.d.ts.map +0 -1
- package/std/index.js.map +0 -1
- package/texture-BagDrrks.js.map +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DualFn } from "../types.js";
|
|
2
|
+
import { AnyIntegerVecInstance, AnyMatInstance, AnyNumericVecInstance, mBaseForVec, vBaseForMat, vecIToVecU } from "../data/wgslTypes.js";
|
|
3
|
+
|
|
4
|
+
//#region src/std/operators.d.ts
|
|
5
|
+
type NumVec = AnyNumericVecInstance;
|
|
6
|
+
type Mat = AnyMatInstance;
|
|
7
|
+
declare function cpuAdd(lhs: number, rhs: number): number;
|
|
8
|
+
declare function cpuAdd<T extends NumVec>(lhs: number, rhs: T): T;
|
|
9
|
+
declare function cpuAdd<T extends NumVec>(lhs: T, rhs: number): T;
|
|
10
|
+
declare function cpuAdd<T extends NumVec | Mat>(lhs: T, rhs: T): T;
|
|
11
|
+
declare function cpuAdd<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : Lhs extends Mat ? Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
|
|
12
|
+
declare const add: DualFn;
|
|
13
|
+
declare function cpuSub(lhs: number, rhs: number): number;
|
|
14
|
+
declare function cpuSub<T extends NumVec>(lhs: number, rhs: T): T;
|
|
15
|
+
declare function cpuSub<T extends NumVec>(lhs: T, rhs: number): T;
|
|
16
|
+
declare function cpuSub<T extends NumVec | Mat>(lhs: T, rhs: T): T;
|
|
17
|
+
declare function cpuSub<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec : Lhs extends NumVec ? number | Lhs : Lhs extends Mat ? Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
|
|
18
|
+
declare const sub: DualFn;
|
|
19
|
+
declare function cpuMul(lhs: number, rhs: number): number;
|
|
20
|
+
declare function cpuMul<MV extends NumVec | Mat>(lhs: number, rhs: MV): MV;
|
|
21
|
+
declare function cpuMul<MV extends NumVec | Mat>(lhs: MV, rhs: number): MV;
|
|
22
|
+
declare function cpuMul<V extends NumVec>(lhs: V, rhs: V): V;
|
|
23
|
+
declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: V, rhs: M): V;
|
|
24
|
+
declare function cpuMul<M extends Mat, V extends vBaseForMat<M>>(lhs: M, rhs: V): V;
|
|
25
|
+
declare function cpuMul<M extends Mat>(lhs: M, rhs: M): M;
|
|
26
|
+
declare function cpuMul<Lhs extends number | NumVec | Mat, Rhs extends (Lhs extends number ? number | NumVec | Mat : Lhs extends NumVec ? number | Lhs | mBaseForVec<Lhs> : Lhs extends Mat ? number | vBaseForMat<Lhs> | Lhs : never)>(lhs: Lhs, rhs: Rhs): Lhs | Rhs;
|
|
27
|
+
declare const mul: DualFn;
|
|
28
|
+
declare function cpuDiv(lhs: number, rhs: number): number;
|
|
29
|
+
declare function cpuDiv<T extends NumVec>(lhs: T, rhs: T): T;
|
|
30
|
+
declare function cpuDiv<T extends NumVec>(lhs: number, rhs: T): T;
|
|
31
|
+
declare function cpuDiv<T extends NumVec>(lhs: T, rhs: number): T;
|
|
32
|
+
declare const div: DualFn;
|
|
33
|
+
type ModOverload = {
|
|
34
|
+
(a: number, b: number): number;
|
|
35
|
+
<T extends NumVec>(a: T, b: T): T;
|
|
36
|
+
<T extends NumVec>(a: number, b: T): T;
|
|
37
|
+
<T extends NumVec>(a: T, b: number): T;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @privateRemarks
|
|
41
|
+
* Both JS and WGSL implementations use truncated definition of modulo
|
|
42
|
+
*/
|
|
43
|
+
declare const mod: DualFn;
|
|
44
|
+
declare function cpuNeg(value: number): number;
|
|
45
|
+
declare function cpuNeg<T extends NumVec>(value: T): T;
|
|
46
|
+
declare const neg: DualFn;
|
|
47
|
+
declare function cpuBitShiftLeft(lhs: number, rhs: number): number;
|
|
48
|
+
declare function cpuBitShiftLeft<T extends AnyIntegerVecInstance>(lhs: T, rhs: number): T;
|
|
49
|
+
declare function cpuBitShiftLeft<T extends AnyIntegerVecInstance>(lhs: T, rhs: vecIToVecU<T>): T;
|
|
50
|
+
declare const bitShiftLeft: DualFn;
|
|
51
|
+
declare function cpuBitShiftRight(lhs: number, rhs: number): number;
|
|
52
|
+
declare function cpuBitShiftRight<T extends AnyIntegerVecInstance>(lhs: T, rhs: number): T;
|
|
53
|
+
declare function cpuBitShiftRight<T extends AnyIntegerVecInstance>(lhs: T, rhs: vecIToVecU<T>): T;
|
|
54
|
+
declare const bitShiftRight: DualFn;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { add, bitShiftLeft, bitShiftRight, div, mod, mul, neg, sub };
|
package/std/operators.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { isFloat32VecInstance, isInteger32VecInstance, isMat, isMatInstance, isUint32VecInstance, isVec, isVecInstance } from "../data/wgslTypes.js";
|
|
2
|
+
import { SignatureNotSupportedError } from "../errors.js";
|
|
3
|
+
import { stitch } from "../core/resolve/stitch.js";
|
|
4
|
+
import { unify } from "../tgsl/conversion.js";
|
|
5
|
+
import { abstractFloat, f16, f32, i32, u32 } from "../data/numeric.js";
|
|
6
|
+
import { vec2i, vec2u, vec3i, vec3u, vec4i, vec4u, vecTypeToConstructor } from "../data/vector.js";
|
|
7
|
+
import { dualImpl } from "../core/function/dualImpl.js";
|
|
8
|
+
import { VectorOps } from "../data/vectorOps.js";
|
|
9
|
+
//#region src/std/operators.ts
|
|
10
|
+
const getPrimitive = (t) => "primitive" in t ? t.primitive : t;
|
|
11
|
+
const makeBinarySignature = (opts) => (lhs, rhs) => {
|
|
12
|
+
const { restrict } = opts ?? {};
|
|
13
|
+
const fail = (msg) => {
|
|
14
|
+
if (restrict) throw new SignatureNotSupportedError([lhs, rhs], restrict);
|
|
15
|
+
throw new Error(`Cannot apply operator to ${lhs.type} and ${rhs.type}: ${msg}`);
|
|
16
|
+
};
|
|
17
|
+
if (opts?.noMat && (isMat(lhs) || isMat(rhs))) return fail("matrices not supported");
|
|
18
|
+
const lhsC = isVec(lhs) || isMat(lhs);
|
|
19
|
+
const rhsC = isVec(rhs) || isMat(rhs);
|
|
20
|
+
if (!lhsC && !rhsC) {
|
|
21
|
+
const unified = unify([lhs, rhs], restrict);
|
|
22
|
+
if (!unified) return fail("incompatible scalar types");
|
|
23
|
+
return {
|
|
24
|
+
argTypes: unified,
|
|
25
|
+
returnType: unified[0]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (lhsC && rhsC) {
|
|
29
|
+
if (opts?.matVecProduct && isVec(lhs) !== isVec(rhs)) return {
|
|
30
|
+
argTypes: [lhs, rhs],
|
|
31
|
+
returnType: isVec(lhs) ? lhs : rhs
|
|
32
|
+
};
|
|
33
|
+
if (lhs.type !== rhs.type) return fail("operands must have the same type");
|
|
34
|
+
return {
|
|
35
|
+
argTypes: [lhs, rhs],
|
|
36
|
+
returnType: lhs
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const [scalar, composite] = lhsC ? [rhs, lhs] : [lhs, rhs];
|
|
40
|
+
const unified = unify([scalar], [getPrimitive(composite)]);
|
|
41
|
+
if (!unified) return fail(`scalar not convertible to ${getPrimitive(composite).type}`);
|
|
42
|
+
return {
|
|
43
|
+
argTypes: lhsC ? [lhs, unified[0]] : [unified[0], rhs],
|
|
44
|
+
returnType: composite
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const binaryArithmeticSignature = makeBinarySignature();
|
|
48
|
+
const binaryMulSignature = makeBinarySignature({ matVecProduct: true });
|
|
49
|
+
const binaryDivSignature = makeBinarySignature({
|
|
50
|
+
noMat: true,
|
|
51
|
+
restrict: [
|
|
52
|
+
f32,
|
|
53
|
+
f16,
|
|
54
|
+
abstractFloat
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
function cpuAdd(lhs, rhs) {
|
|
58
|
+
if (typeof lhs === "number" && typeof rhs === "number") return lhs + rhs;
|
|
59
|
+
if (typeof lhs === "number" && isVecInstance(rhs)) return VectorOps.addMixed[rhs.kind](rhs, lhs);
|
|
60
|
+
if (isVecInstance(lhs) && typeof rhs === "number") return VectorOps.addMixed[lhs.kind](lhs, rhs);
|
|
61
|
+
if (isVecInstance(lhs) && isVecInstance(rhs) || isMatInstance(lhs) && isMatInstance(rhs)) return VectorOps.add[lhs.kind](lhs, rhs);
|
|
62
|
+
throw new Error("Add/Sub called with invalid arguments.");
|
|
63
|
+
}
|
|
64
|
+
const add = dualImpl({
|
|
65
|
+
name: "add",
|
|
66
|
+
signature: binaryArithmeticSignature,
|
|
67
|
+
normalImpl: cpuAdd,
|
|
68
|
+
codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} + ${rhs})`
|
|
69
|
+
});
|
|
70
|
+
function cpuSub(lhs, rhs) {
|
|
71
|
+
return cpuAdd(lhs, cpuMul(-1, rhs));
|
|
72
|
+
}
|
|
73
|
+
const sub = dualImpl({
|
|
74
|
+
name: "sub",
|
|
75
|
+
signature: binaryArithmeticSignature,
|
|
76
|
+
normalImpl: cpuSub,
|
|
77
|
+
codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} - ${rhs})`
|
|
78
|
+
});
|
|
79
|
+
function cpuMul(lhs, rhs) {
|
|
80
|
+
if (typeof lhs === "number" && typeof rhs === "number") return lhs * rhs;
|
|
81
|
+
if (typeof lhs === "number" && (isVecInstance(rhs) || isMatInstance(rhs))) return VectorOps.mulSxV[rhs.kind](lhs, rhs);
|
|
82
|
+
if ((isVecInstance(lhs) || isMatInstance(lhs)) && typeof rhs === "number") return VectorOps.mulSxV[lhs.kind](rhs, lhs);
|
|
83
|
+
if (isVecInstance(lhs) && isVecInstance(rhs)) return VectorOps.mulVxV[lhs.kind](lhs, rhs);
|
|
84
|
+
if (isFloat32VecInstance(lhs) && isMatInstance(rhs)) return VectorOps.mulVxM[rhs.kind](lhs, rhs);
|
|
85
|
+
if (isMatInstance(lhs) && isFloat32VecInstance(rhs)) return VectorOps.mulMxV[lhs.kind](lhs, rhs);
|
|
86
|
+
if (isMatInstance(lhs) && isMatInstance(rhs)) return VectorOps.mulVxV[lhs.kind](lhs, rhs);
|
|
87
|
+
throw new Error("Mul called with invalid arguments.");
|
|
88
|
+
}
|
|
89
|
+
const mul = dualImpl({
|
|
90
|
+
name: "mul",
|
|
91
|
+
signature: binaryMulSignature,
|
|
92
|
+
normalImpl: cpuMul,
|
|
93
|
+
codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} * ${rhs})`
|
|
94
|
+
});
|
|
95
|
+
function cpuDiv(lhs, rhs) {
|
|
96
|
+
if (typeof lhs === "number" && typeof rhs === "number") return lhs / rhs;
|
|
97
|
+
if (typeof lhs === "number" && isVecInstance(rhs)) {
|
|
98
|
+
const schema = vecTypeToConstructor[rhs.kind];
|
|
99
|
+
return VectorOps.div[rhs.kind](schema(lhs), rhs);
|
|
100
|
+
}
|
|
101
|
+
if (isVecInstance(lhs) && typeof rhs === "number") {
|
|
102
|
+
const schema = vecTypeToConstructor[lhs.kind];
|
|
103
|
+
return VectorOps.div[lhs.kind](lhs, schema(rhs));
|
|
104
|
+
}
|
|
105
|
+
if (isVecInstance(lhs) && isVecInstance(rhs)) return VectorOps.div[lhs.kind](lhs, rhs);
|
|
106
|
+
throw new Error("Div called with invalid arguments.");
|
|
107
|
+
}
|
|
108
|
+
const div = dualImpl({
|
|
109
|
+
name: "div",
|
|
110
|
+
signature: binaryDivSignature,
|
|
111
|
+
normalImpl: cpuDiv,
|
|
112
|
+
codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} / ${rhs})`,
|
|
113
|
+
ignoreImplicitCastWarning: true
|
|
114
|
+
});
|
|
115
|
+
/**
|
|
116
|
+
* @privateRemarks
|
|
117
|
+
* Both JS and WGSL implementations use truncated definition of modulo
|
|
118
|
+
*/
|
|
119
|
+
const mod = dualImpl({
|
|
120
|
+
name: "mod",
|
|
121
|
+
signature: binaryDivSignature,
|
|
122
|
+
normalImpl: ((a, b) => {
|
|
123
|
+
if (typeof a === "number" && typeof b === "number") return a % b;
|
|
124
|
+
if (typeof a === "number" && isVecInstance(b)) {
|
|
125
|
+
const schema = vecTypeToConstructor[b.kind];
|
|
126
|
+
return VectorOps.mod[b.kind](schema(a), b);
|
|
127
|
+
}
|
|
128
|
+
if (isVecInstance(a) && typeof b === "number") {
|
|
129
|
+
const schema = vecTypeToConstructor[a.kind];
|
|
130
|
+
return VectorOps.mod[a.kind](a, schema(b));
|
|
131
|
+
}
|
|
132
|
+
if (isVecInstance(a) && isVecInstance(b)) return VectorOps.mod[a.kind](a, b);
|
|
133
|
+
throw new Error("Mod called with invalid arguments, expected types: number or vector.");
|
|
134
|
+
}),
|
|
135
|
+
codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} % ${rhs})`
|
|
136
|
+
});
|
|
137
|
+
function cpuNeg(value) {
|
|
138
|
+
if (typeof value === "number") return -value;
|
|
139
|
+
return VectorOps.neg[value.kind](value);
|
|
140
|
+
}
|
|
141
|
+
const neg = dualImpl({
|
|
142
|
+
name: "neg",
|
|
143
|
+
signature: (arg) => ({
|
|
144
|
+
argTypes: [arg],
|
|
145
|
+
returnType: arg
|
|
146
|
+
}),
|
|
147
|
+
normalImpl: cpuNeg,
|
|
148
|
+
codegenImpl: (_ctx, [arg]) => stitch`-(${arg})`
|
|
149
|
+
});
|
|
150
|
+
const anyConcreteInteger = [
|
|
151
|
+
i32,
|
|
152
|
+
u32,
|
|
153
|
+
vec2i,
|
|
154
|
+
vec3i,
|
|
155
|
+
vec4i,
|
|
156
|
+
vec2u,
|
|
157
|
+
vec3u,
|
|
158
|
+
vec4u
|
|
159
|
+
];
|
|
160
|
+
const intVecToUnsignedVec = {
|
|
161
|
+
vec2i: vec2u,
|
|
162
|
+
vec2u,
|
|
163
|
+
vec3i: vec3u,
|
|
164
|
+
vec3u,
|
|
165
|
+
vec4i: vec4u,
|
|
166
|
+
vec4u
|
|
167
|
+
};
|
|
168
|
+
const bitShiftSignature = (lhs, rhs) => {
|
|
169
|
+
const lhsUnified = unify([lhs], anyConcreteInteger)?.[0];
|
|
170
|
+
if (!lhsUnified) throw new SignatureNotSupportedError([lhs], anyConcreteInteger);
|
|
171
|
+
let rhsType;
|
|
172
|
+
if (isVec(lhsUnified)) {
|
|
173
|
+
const cc = lhsUnified.componentCount;
|
|
174
|
+
const vecU = cc === 2 ? vec2u : cc === 3 ? vec3u : vec4u;
|
|
175
|
+
const rhsUnified = unify([rhs], [u32, vecU])?.[0];
|
|
176
|
+
if (!rhsUnified) throw new SignatureNotSupportedError([rhs], [u32, vecU]);
|
|
177
|
+
rhsType = rhsUnified;
|
|
178
|
+
} else rhsType = u32;
|
|
179
|
+
return {
|
|
180
|
+
argTypes: [lhsUnified, rhsType],
|
|
181
|
+
returnType: lhsUnified
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
function cpuBitShiftLeft(lhs, rhs) {
|
|
185
|
+
if (typeof lhs === "number" && typeof rhs === "number") return lhs << rhs;
|
|
186
|
+
if (isInteger32VecInstance(lhs) && isUint32VecInstance(rhs) && lhs.length == rhs.length) return VectorOps.bitShiftLeft[lhs.kind](lhs, rhs);
|
|
187
|
+
if (isInteger32VecInstance(lhs) && typeof rhs === "number") {
|
|
188
|
+
const rhsVec = intVecToUnsignedVec[lhs.kind](rhs);
|
|
189
|
+
return VectorOps.bitShiftLeft[lhs.kind](lhs, rhsVec);
|
|
190
|
+
}
|
|
191
|
+
throw new Error("bitShiftLeft called with invalid arguments, expected types: number or integer vector (rhs must be the same arity as lhs).");
|
|
192
|
+
}
|
|
193
|
+
const bitShiftLeft = dualImpl({
|
|
194
|
+
name: "bitShiftLeft",
|
|
195
|
+
signature: bitShiftSignature,
|
|
196
|
+
normalImpl: cpuBitShiftLeft,
|
|
197
|
+
codegenImpl: (_ctx, [lhs, rhs]) => {
|
|
198
|
+
if (isVec(lhs.dataType) && !isVec(rhs.dataType)) {
|
|
199
|
+
const cc = lhs.dataType.componentCount;
|
|
200
|
+
return stitch`(${lhs} << ${cc === 2 ? "vec2u" : cc === 3 ? "vec3u" : "vec4u"}(${rhs}))`;
|
|
201
|
+
}
|
|
202
|
+
return stitch`(${lhs} << ${rhs})`;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
function cpuBitShiftRight(lhs, rhs) {
|
|
206
|
+
if (typeof lhs === "number" && typeof rhs === "number") return lhs >> rhs;
|
|
207
|
+
if (isInteger32VecInstance(lhs) && isUint32VecInstance(rhs) && lhs.length == rhs.length) return VectorOps.bitShiftRight[lhs.kind](lhs, rhs);
|
|
208
|
+
if (isInteger32VecInstance(lhs) && typeof rhs === "number") {
|
|
209
|
+
const rhsVec = intVecToUnsignedVec[lhs.kind](rhs);
|
|
210
|
+
return VectorOps.bitShiftRight[lhs.kind](lhs, rhsVec);
|
|
211
|
+
}
|
|
212
|
+
throw new Error("bitShiftRight called with invalid arguments, expected types: number or integer vector (rhs must be the same arity as lhs).");
|
|
213
|
+
}
|
|
214
|
+
const bitShiftRight = dualImpl({
|
|
215
|
+
name: "bitShiftRight",
|
|
216
|
+
signature: bitShiftSignature,
|
|
217
|
+
normalImpl: cpuBitShiftRight,
|
|
218
|
+
codegenImpl: (_ctx, [lhs, rhs]) => {
|
|
219
|
+
if (isVec(lhs.dataType) && !isVec(rhs.dataType)) {
|
|
220
|
+
const cc = lhs.dataType.componentCount;
|
|
221
|
+
return stitch`(${lhs} >> ${cc === 2 ? "vec2u" : cc === 3 ? "vec3u" : "vec4u"}(${rhs}))`;
|
|
222
|
+
}
|
|
223
|
+
return stitch`(${lhs} >> ${rhs})`;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
//#endregion
|
|
227
|
+
export { add, bitShiftLeft, bitShiftRight, div, mod, mul, neg, sub };
|
package/std/packing.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DualFn } from "../types.js";
|
|
2
|
+
import { v2f, v4f } from "../data/wgslTypes.js";
|
|
3
|
+
|
|
4
|
+
//#region src/std/packing.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* @privateRemarks
|
|
7
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#unpack2x16float-builtin
|
|
8
|
+
*/
|
|
9
|
+
declare const unpack2x16float: DualFn;
|
|
10
|
+
/**
|
|
11
|
+
* @privateRemarks
|
|
12
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#pack2x16float-builtin
|
|
13
|
+
*/
|
|
14
|
+
declare const pack2x16float: DualFn;
|
|
15
|
+
/**
|
|
16
|
+
* @privateRemarks
|
|
17
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#unpack4x8unorm-builtin
|
|
18
|
+
*/
|
|
19
|
+
declare const unpack4x8unorm: DualFn;
|
|
20
|
+
/**
|
|
21
|
+
* @privateRemarks
|
|
22
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#pack4x8unorm-builtin
|
|
23
|
+
*/
|
|
24
|
+
declare const pack4x8unorm: DualFn;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { pack2x16float, pack4x8unorm, unpack2x16float, unpack4x8unorm };
|
package/std/packing.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { stitch } from "../core/resolve/stitch.js";
|
|
2
|
+
import { u32 } from "../data/numeric.js";
|
|
3
|
+
import { vec2f, vec4f } from "../data/vector.js";
|
|
4
|
+
import { dualImpl } from "../core/function/dualImpl.js";
|
|
5
|
+
import * as TB from "typed-binary";
|
|
6
|
+
//#region src/std/packing.ts
|
|
7
|
+
/**
|
|
8
|
+
* @privateRemarks
|
|
9
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#unpack2x16float-builtin
|
|
10
|
+
*/
|
|
11
|
+
const unpack2x16float = dualImpl({
|
|
12
|
+
name: "unpack2x16float",
|
|
13
|
+
normalImpl: (e) => {
|
|
14
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(4);
|
|
15
|
+
new TB.BufferWriter(buffer).writeUint32(e);
|
|
16
|
+
const reader = new TB.BufferReader(buffer);
|
|
17
|
+
return vec2f(reader.readFloat16(), reader.readFloat16());
|
|
18
|
+
},
|
|
19
|
+
signature: {
|
|
20
|
+
argTypes: [u32],
|
|
21
|
+
returnType: vec2f
|
|
22
|
+
},
|
|
23
|
+
codegenImpl: (_ctx, [e]) => stitch`unpack2x16float(${e})`
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* @privateRemarks
|
|
27
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#pack2x16float-builtin
|
|
28
|
+
*/
|
|
29
|
+
const pack2x16float = dualImpl({
|
|
30
|
+
name: "pack2x16float",
|
|
31
|
+
normalImpl: (e) => {
|
|
32
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(4);
|
|
33
|
+
const writer = new TB.BufferWriter(buffer);
|
|
34
|
+
writer.writeFloat16(e.x);
|
|
35
|
+
writer.writeFloat16(e.y);
|
|
36
|
+
return u32(new TB.BufferReader(buffer).readUint32());
|
|
37
|
+
},
|
|
38
|
+
signature: {
|
|
39
|
+
argTypes: [vec2f],
|
|
40
|
+
returnType: u32
|
|
41
|
+
},
|
|
42
|
+
codegenImpl: (_ctx, [e]) => stitch`pack2x16float(${e})`
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* @privateRemarks
|
|
46
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#unpack4x8unorm-builtin
|
|
47
|
+
*/
|
|
48
|
+
const unpack4x8unorm = dualImpl({
|
|
49
|
+
name: "unpack4x8unorm",
|
|
50
|
+
normalImpl: (e) => {
|
|
51
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(4);
|
|
52
|
+
new TB.BufferWriter(buffer).writeUint32(e);
|
|
53
|
+
const reader = new TB.BufferReader(buffer);
|
|
54
|
+
return vec4f(reader.readUint8() / 255, reader.readUint8() / 255, reader.readUint8() / 255, reader.readUint8() / 255);
|
|
55
|
+
},
|
|
56
|
+
signature: {
|
|
57
|
+
argTypes: [u32],
|
|
58
|
+
returnType: vec4f
|
|
59
|
+
},
|
|
60
|
+
codegenImpl: (_ctx, [e]) => stitch`unpack4x8unorm(${e})`
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* @privateRemarks
|
|
64
|
+
* https://gpuweb.github.io/gpuweb/wgsl/#pack4x8unorm-builtin
|
|
65
|
+
*/
|
|
66
|
+
const pack4x8unorm = dualImpl({
|
|
67
|
+
name: "pack4x8unorm",
|
|
68
|
+
normalImpl: (e) => {
|
|
69
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(4);
|
|
70
|
+
const writer = new TB.BufferWriter(buffer);
|
|
71
|
+
writer.writeUint8(e.x * 255);
|
|
72
|
+
writer.writeUint8(e.y * 255);
|
|
73
|
+
writer.writeUint8(e.z * 255);
|
|
74
|
+
writer.writeUint8(e.w * 255);
|
|
75
|
+
return u32(new TB.BufferReader(buffer).readUint32());
|
|
76
|
+
},
|
|
77
|
+
signature: {
|
|
78
|
+
argTypes: [vec4f],
|
|
79
|
+
returnType: u32
|
|
80
|
+
},
|
|
81
|
+
codegenImpl: (_ctx, [e]) => stitch`pack4x8unorm(${e})`
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
export { pack2x16float, pack4x8unorm, unpack2x16float, unpack4x8unorm };
|
package/std/range.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TgpuComptime } from "../core/function/comptime.js";
|
|
2
|
+
//#region src/std/range.d.ts
|
|
3
|
+
interface TgpuRange extends Array<number> {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
step: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns an array of values between `start` (inclusive) and `end` (exclusive) with the given `step`.
|
|
10
|
+
*
|
|
11
|
+
* If only one argument is provided, it is interpreted as `end`, with `start=0` and `step=1`.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* let result = d.f32(1);
|
|
15
|
+
* for (const i of std.range(5)) {
|
|
16
|
+
* result *= i + 1;
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Can also be combined with `tgpu.unroll` to unroll a specific number of iterations.
|
|
21
|
+
*/
|
|
22
|
+
declare const range: TgpuComptime;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { range };
|
package/std/range.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { comptime } from "../core/function/comptime.js";
|
|
2
|
+
//#region src/std/range.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns an array of values between `start` (inclusive) and `end` (exclusive) with the given `step`.
|
|
5
|
+
*
|
|
6
|
+
* If only one argument is provided, it is interpreted as `end`, with `start=0` and `step=1`.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* let result = d.f32(1);
|
|
10
|
+
* for (const i of std.range(5)) {
|
|
11
|
+
* result *= i + 1;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Can also be combined with `tgpu.unroll` to unroll a specific number of iterations.
|
|
16
|
+
*/
|
|
17
|
+
const range = comptime((start, end, step = 1) => {
|
|
18
|
+
if (end === void 0) {
|
|
19
|
+
end = start;
|
|
20
|
+
start = 0;
|
|
21
|
+
}
|
|
22
|
+
if (!Number.isInteger(start)) throw new Error(`'start' must be an integer, got ${start}`);
|
|
23
|
+
if (!Number.isInteger(end)) throw new Error(`'end' must be an integer, got ${end}`);
|
|
24
|
+
if (!Number.isInteger(step) || step === 0) throw new Error(`'step' must be a non-zero integer, got ${step}`);
|
|
25
|
+
const result = [];
|
|
26
|
+
result.start = start;
|
|
27
|
+
result.end = end;
|
|
28
|
+
result.step = step;
|
|
29
|
+
if (Math.sign(step) !== Math.sign(end - start)) return result;
|
|
30
|
+
if (step > 0) for (let i = start; i < end; i += step) result.push(i);
|
|
31
|
+
if (step < 0) for (let i = start; i > end; i += step) result.push(i);
|
|
32
|
+
return result;
|
|
33
|
+
});
|
|
34
|
+
function isTgpuRange(value) {
|
|
35
|
+
return Array.isArray(value) && "start" in value && "end" in value && "step" in value;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { isTgpuRange, range };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DualFn } from "../types.js";
|
|
2
|
+
import { AnyIntegerVecInstance, AnyNumericVecInstance, v4u } from "../data/wgslTypes.js";
|
|
3
|
+
|
|
4
|
+
//#region src/std/subgroup.d.ts
|
|
5
|
+
interface IdentityNumOrVec {
|
|
6
|
+
(e: number): number;
|
|
7
|
+
<T extends AnyNumericVecInstance>(e: T): T;
|
|
8
|
+
}
|
|
9
|
+
interface IdentityIntNumOrVec {
|
|
10
|
+
(e: number): number;
|
|
11
|
+
<T extends AnyIntegerVecInstance>(e: T): T;
|
|
12
|
+
}
|
|
13
|
+
interface IdentityNumOrVecWithIdx {
|
|
14
|
+
(e: number, index: number): number;
|
|
15
|
+
<T extends AnyNumericVecInstance>(e: T, index: number): T;
|
|
16
|
+
}
|
|
17
|
+
interface IdentityNumOrVecWithDelta {
|
|
18
|
+
(e: number, delta: number): number;
|
|
19
|
+
<T extends AnyNumericVecInstance>(e: T, delta: number): T;
|
|
20
|
+
}
|
|
21
|
+
interface IdentityNumOrVecWithMask {
|
|
22
|
+
(e: number, mask: number): number;
|
|
23
|
+
<T extends AnyNumericVecInstance>(e: T, mask: number): T;
|
|
24
|
+
}
|
|
25
|
+
declare const subgroupAdd: DualFn;
|
|
26
|
+
declare const subgroupExclusiveAdd: DualFn;
|
|
27
|
+
declare const subgroupInclusiveAdd: DualFn;
|
|
28
|
+
declare const subgroupAll: DualFn;
|
|
29
|
+
declare const subgroupAnd: DualFn;
|
|
30
|
+
declare const subgroupAny: DualFn;
|
|
31
|
+
declare const subgroupBallot: DualFn;
|
|
32
|
+
declare const subgroupBroadcast: DualFn;
|
|
33
|
+
declare const subgroupBroadcastFirst: DualFn;
|
|
34
|
+
declare const subgroupElect: DualFn;
|
|
35
|
+
declare const subgroupMax: DualFn;
|
|
36
|
+
declare const subgroupMin: DualFn;
|
|
37
|
+
declare const subgroupMul: DualFn;
|
|
38
|
+
declare const subgroupExclusiveMul: DualFn;
|
|
39
|
+
declare const subgroupInclusiveMul: DualFn;
|
|
40
|
+
declare const subgroupOr: DualFn;
|
|
41
|
+
declare const subgroupShuffle: DualFn;
|
|
42
|
+
declare const subgroupShuffleDown: DualFn;
|
|
43
|
+
declare const subgroupShuffleUp: DualFn;
|
|
44
|
+
declare const subgroupShuffleXor: DualFn;
|
|
45
|
+
declare const subgroupXor: DualFn;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor };
|