typegpu 0.12.5 → 0.12.6
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/common/index.d.ts +1 -0
- package/common/index.js +1 -0
- package/common/writeChannels.d.ts +31 -0
- package/common/writeChannels.js +32 -0
- package/core/commandEncoder/computePass.d.ts +13 -0
- package/core/commandEncoder/computePass.js +5 -2
- package/core/commandEncoder/renderPass.d.ts +18 -4
- package/core/commandEncoder/renderPass.js +6 -2
- package/core/declare/tgpuDeclare.d.ts +11 -0
- package/core/declare/tgpuDeclare.js +1 -1
- package/core/immediate/immediateVar.d.ts +52 -0
- package/core/immediate/immediateVar.js +149 -0
- package/core/pipeline/computePipeline.d.ts +17 -0
- package/core/pipeline/computePipeline.js +23 -9
- package/core/pipeline/drawState.d.ts +8 -4
- package/core/pipeline/drawState.js +41 -51
- package/core/pipeline/priors.js +1 -0
- package/core/pipeline/renderPipeline.d.ts +18 -1
- package/core/pipeline/renderPipeline.js +15 -1
- package/core/root/init.js +3 -0
- package/core/root/rootTypes.d.ts +11 -0
- package/core/slot/slotTypes.d.ts +2 -1
- package/core/texture/texture.d.ts +20 -14
- package/core/texture/texture.js +70 -65
- package/core/texture/textureUtils.d.ts +3 -6
- package/core/texture/textureUtils.js +142 -165
- package/core/texture/textureWrite.d.ts +61 -0
- package/core/texture/textureWrite.js +59 -0
- package/data/dataIO.d.ts +2 -2
- package/data/snippet.d.ts +5 -1
- package/data/snippet.js +1 -0
- package/data/wgslTypes.d.ts +1 -1
- package/errors.d.ts +7 -0
- package/errors.js +15 -0
- package/indexNamedExports.d.ts +5 -2
- package/indexNamedExports.js +2 -1
- package/internal.d.ts +1 -1
- package/internal.js +1 -1
- package/package.json +2 -2
- package/resolutionCtx.d.ts +5 -0
- package/resolutionCtx.js +11 -0
- package/serial/restore.d.ts +3 -1
- package/serial/restore.js +2 -0
- package/shared/meta.js +1 -1
- package/shared/symbols.js +1 -1
- package/shared/tseynit.d.ts +1 -0
- package/shared/tseynit.js +39 -7
- package/std/atomic.d.ts +13 -0
- package/std/atomic.js +63 -29
- package/std/derivative.js +14 -9
- package/std/index.d.ts +4 -4
- package/std/index.js +5 -5
- package/std/numeric.d.ts +5 -1
- package/std/numeric.js +3 -3
- package/std/packing.d.ts +61 -1
- package/std/packing.js +214 -25
- package/std/subgroup.d.ts +4 -0
- package/std/subgroup.js +34 -0
- package/std/texture.d.ts +13 -0
- package/std/texture.js +48 -0
- package/tgpuUnstable.d.ts +1 -0
- package/tgpuUnstable.js +1 -0
- package/tgsl/conversion.d.ts +2 -0
- package/tgsl/conversion.js +3 -0
- package/tgsl/shaderGenerator.d.ts +1 -1
- package/tgsl/wgslGenerator.d.ts +5 -0
- package/tgsl/wgslGenerator.js +218 -50
- package/types.d.ts +9 -1
- package/types.js +5 -0
package/std/atomic.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { dualImpl } from "../core/function/dualImpl.js";
|
|
2
2
|
import { stitch } from "../core/resolve/stitch.js";
|
|
3
|
-
import {
|
|
3
|
+
import { unptr } from "../data/dataTypes.js";
|
|
4
|
+
import { bool, i32, u32 } from "../data/numeric.js";
|
|
5
|
+
import { derefSnippet } from "../data/ref.js";
|
|
6
|
+
import { abstruct } from "../data/struct.js";
|
|
4
7
|
import { isAtomic, Void, } from "../data/wgslTypes.js";
|
|
5
8
|
import { safeStringify } from "../shared/stringify.js";
|
|
6
9
|
export const workgroupBarrier = dualImpl({
|
|
@@ -24,33 +27,40 @@ export const textureBarrier = dualImpl({
|
|
|
24
27
|
codegenImpl: () => 'textureBarrier()',
|
|
25
28
|
sideEffects: true,
|
|
26
29
|
});
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
export const workgroupUniformLoad = dualImpl({
|
|
31
|
+
name: 'workgroupUniformLoad',
|
|
32
|
+
normalImpl: 'workgroupUniformLoad is not supported outside of CODEGEN mode.',
|
|
33
|
+
signature: (value) => {
|
|
34
|
+
const inner = unptr(value);
|
|
35
|
+
return {
|
|
36
|
+
argTypes: [value],
|
|
37
|
+
returnType: isAtomic(inner) ? inner.inner : inner,
|
|
38
|
+
};
|
|
36
39
|
},
|
|
37
|
-
codegenImpl: (_ctx, [
|
|
40
|
+
codegenImpl: (_ctx, [value]) => stitch `workgroupUniformLoad(&${derefSnippet(value)})`,
|
|
38
41
|
sideEffects: true,
|
|
39
42
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
43
|
+
const atomicNormalError = 'Atomic operations are not supported outside of CODEGEN mode.';
|
|
44
|
+
const unwrapAtomic = (a) => {
|
|
45
|
+
const inner = unptr(a);
|
|
46
|
+
if (!isAtomic(inner)) {
|
|
42
47
|
throw new Error(`Invalid atomic type: ${safeStringify(a)}`);
|
|
43
48
|
}
|
|
44
|
-
return
|
|
45
|
-
argTypes: [a, a.inner.type === 'u32' ? u32 : i32],
|
|
46
|
-
returnType: Void,
|
|
47
|
-
};
|
|
49
|
+
return inner;
|
|
48
50
|
};
|
|
51
|
+
export const atomicLoad = dualImpl({
|
|
52
|
+
name: 'atomicLoad',
|
|
53
|
+
normalImpl: atomicNormalError,
|
|
54
|
+
signature: (a) => ({ argTypes: [a], returnType: unwrapAtomic(a).inner }),
|
|
55
|
+
codegenImpl: (_ctx, [a]) => stitch `atomicLoad(&${derefSnippet(a)})`,
|
|
56
|
+
sideEffects: true,
|
|
57
|
+
});
|
|
58
|
+
const atomicActionSignature = (a) => ({
|
|
59
|
+
argTypes: [a, unwrapAtomic(a).inner.type === 'u32' ? u32 : i32],
|
|
60
|
+
returnType: Void,
|
|
61
|
+
});
|
|
49
62
|
const atomicOpSignature = (a) => {
|
|
50
|
-
|
|
51
|
-
throw new Error(`Invalid atomic type: ${safeStringify(a)}`);
|
|
52
|
-
}
|
|
53
|
-
const paramType = a.inner.type === 'u32' ? u32 : i32;
|
|
63
|
+
const paramType = unwrapAtomic(a).inner.type === 'u32' ? u32 : i32;
|
|
54
64
|
return {
|
|
55
65
|
argTypes: [a, paramType],
|
|
56
66
|
returnType: paramType,
|
|
@@ -60,55 +70,79 @@ export const atomicStore = dualImpl({
|
|
|
60
70
|
name: 'atomicStore',
|
|
61
71
|
normalImpl: atomicNormalError,
|
|
62
72
|
signature: atomicActionSignature,
|
|
63
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicStore(&${a}, ${value})`,
|
|
73
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicStore(&${derefSnippet(a)}, ${value})`,
|
|
64
74
|
sideEffects: true,
|
|
65
75
|
});
|
|
66
76
|
export const atomicAdd = dualImpl({
|
|
67
77
|
name: 'atomicAdd',
|
|
68
78
|
normalImpl: atomicNormalError,
|
|
69
79
|
signature: atomicOpSignature,
|
|
70
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicAdd(&${a}, ${value})`,
|
|
80
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicAdd(&${derefSnippet(a)}, ${value})`,
|
|
71
81
|
sideEffects: true,
|
|
72
82
|
});
|
|
73
83
|
export const atomicSub = dualImpl({
|
|
74
84
|
name: 'atomicSub',
|
|
75
85
|
normalImpl: atomicNormalError,
|
|
76
86
|
signature: atomicOpSignature,
|
|
77
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicSub(&${a}, ${value})`,
|
|
87
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicSub(&${derefSnippet(a)}, ${value})`,
|
|
78
88
|
sideEffects: true,
|
|
79
89
|
});
|
|
80
90
|
export const atomicMax = dualImpl({
|
|
81
91
|
name: 'atomicMax',
|
|
82
92
|
normalImpl: atomicNormalError,
|
|
83
93
|
signature: atomicOpSignature,
|
|
84
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicMax(&${a}, ${value})`,
|
|
94
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicMax(&${derefSnippet(a)}, ${value})`,
|
|
85
95
|
sideEffects: true,
|
|
86
96
|
});
|
|
87
97
|
export const atomicMin = dualImpl({
|
|
88
98
|
name: 'atomicMin',
|
|
89
99
|
normalImpl: atomicNormalError,
|
|
90
100
|
signature: atomicOpSignature,
|
|
91
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicMin(&${a}, ${value})`,
|
|
101
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicMin(&${derefSnippet(a)}, ${value})`,
|
|
92
102
|
sideEffects: true,
|
|
93
103
|
});
|
|
94
104
|
export const atomicAnd = dualImpl({
|
|
95
105
|
name: 'atomicAnd',
|
|
96
106
|
normalImpl: atomicNormalError,
|
|
97
107
|
signature: atomicOpSignature,
|
|
98
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicAnd(&${a}, ${value})`,
|
|
108
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicAnd(&${derefSnippet(a)}, ${value})`,
|
|
99
109
|
sideEffects: true,
|
|
100
110
|
});
|
|
101
111
|
export const atomicOr = dualImpl({
|
|
102
112
|
name: 'atomicOr',
|
|
103
113
|
normalImpl: atomicNormalError,
|
|
104
114
|
signature: atomicOpSignature,
|
|
105
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicOr(&${a}, ${value})`,
|
|
115
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicOr(&${derefSnippet(a)}, ${value})`,
|
|
106
116
|
sideEffects: true,
|
|
107
117
|
});
|
|
108
118
|
export const atomicXor = dualImpl({
|
|
109
119
|
name: 'atomicXor',
|
|
110
120
|
normalImpl: atomicNormalError,
|
|
111
121
|
signature: atomicOpSignature,
|
|
112
|
-
codegenImpl: (_ctx, [a, value]) => stitch `atomicXor(&${a}, ${value})`,
|
|
122
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicXor(&${derefSnippet(a)}, ${value})`,
|
|
123
|
+
sideEffects: true,
|
|
124
|
+
});
|
|
125
|
+
export const atomicExchange = dualImpl({
|
|
126
|
+
name: 'atomicExchange',
|
|
127
|
+
normalImpl: atomicNormalError,
|
|
128
|
+
signature: atomicOpSignature,
|
|
129
|
+
codegenImpl: (_ctx, [a, value]) => stitch `atomicExchange(&${derefSnippet(a)}, ${value})`,
|
|
130
|
+
sideEffects: true,
|
|
131
|
+
});
|
|
132
|
+
const AtomicCompareExchangeResults = {
|
|
133
|
+
i32: abstruct({ old_value: i32, exchanged: bool }),
|
|
134
|
+
u32: abstruct({ old_value: u32, exchanged: bool }),
|
|
135
|
+
};
|
|
136
|
+
export const atomicCompareExchangeWeak = dualImpl({
|
|
137
|
+
name: 'atomicCompareExchangeWeak',
|
|
138
|
+
normalImpl: atomicNormalError,
|
|
139
|
+
signature: (a) => {
|
|
140
|
+
const inner = unwrapAtomic(a).inner.type === 'u32' ? u32 : i32;
|
|
141
|
+
return {
|
|
142
|
+
argTypes: [a, inner, inner],
|
|
143
|
+
returnType: AtomicCompareExchangeResults[inner.type],
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
codegenImpl: (_ctx, [a, compare, value]) => stitch `atomicCompareExchangeWeak(&${derefSnippet(a)}, ${compare}, ${value})`,
|
|
113
147
|
sideEffects: true,
|
|
114
148
|
});
|
package/std/derivative.js
CHANGED
|
@@ -1,66 +1,71 @@
|
|
|
1
1
|
import { dualImpl } from "../core/function/dualImpl.js";
|
|
2
2
|
import { stitch } from "../core/resolve/stitch.js";
|
|
3
|
+
import { f32 } from "../data/numeric.js";
|
|
4
|
+
import { vec2f, vec3f, vec4f } from "../data/vector.js";
|
|
5
|
+
import { unifyRestrictedSignature } from "./numeric.js";
|
|
3
6
|
const derivativeNormalError = 'Derivative builtins are not allowed on the CPU';
|
|
7
|
+
// WGSL derivative builtins only accept f32 and vecN<f32>
|
|
8
|
+
const derivativeSignature = unifyRestrictedSignature([f32, vec2f, vec3f, vec4f]);
|
|
4
9
|
export const dpdx = dualImpl({
|
|
5
10
|
name: 'dpdx',
|
|
6
11
|
normalImpl: derivativeNormalError,
|
|
7
|
-
signature:
|
|
12
|
+
signature: derivativeSignature,
|
|
8
13
|
codegenImpl: (ctx, [value]) => ctx.gen.emitCall('dpdx', [], [value]),
|
|
9
14
|
sideEffects: false,
|
|
10
15
|
});
|
|
11
16
|
export const dpdxCoarse = dualImpl({
|
|
12
17
|
name: 'dpdxCoarse',
|
|
13
18
|
normalImpl: derivativeNormalError,
|
|
14
|
-
signature:
|
|
19
|
+
signature: derivativeSignature,
|
|
15
20
|
codegenImpl: (_ctx, [value]) => stitch `dpdxCoarse(${value})`,
|
|
16
21
|
sideEffects: false,
|
|
17
22
|
});
|
|
18
23
|
export const dpdxFine = dualImpl({
|
|
19
24
|
name: 'dpdxFine',
|
|
20
25
|
normalImpl: derivativeNormalError,
|
|
21
|
-
signature:
|
|
26
|
+
signature: derivativeSignature,
|
|
22
27
|
codegenImpl: (_ctx, [value]) => stitch `dpdxFine(${value})`,
|
|
23
28
|
sideEffects: false,
|
|
24
29
|
});
|
|
25
30
|
export const dpdy = dualImpl({
|
|
26
31
|
name: 'dpdy',
|
|
27
32
|
normalImpl: derivativeNormalError,
|
|
28
|
-
signature:
|
|
33
|
+
signature: derivativeSignature,
|
|
29
34
|
codegenImpl: (ctx, [value]) => ctx.gen.emitCall('dpdy', [], [value]),
|
|
30
35
|
sideEffects: false,
|
|
31
36
|
});
|
|
32
37
|
export const dpdyCoarse = dualImpl({
|
|
33
38
|
name: 'dpdyCoarse',
|
|
34
39
|
normalImpl: derivativeNormalError,
|
|
35
|
-
signature:
|
|
40
|
+
signature: derivativeSignature,
|
|
36
41
|
codegenImpl: (_ctx, [value]) => stitch `dpdyCoarse(${value})`,
|
|
37
42
|
sideEffects: false,
|
|
38
43
|
});
|
|
39
44
|
export const dpdyFine = dualImpl({
|
|
40
45
|
name: 'dpdyFine',
|
|
41
46
|
normalImpl: derivativeNormalError,
|
|
42
|
-
signature:
|
|
47
|
+
signature: derivativeSignature,
|
|
43
48
|
codegenImpl: (_ctx, [value]) => stitch `dpdyFine(${value})`,
|
|
44
49
|
sideEffects: false,
|
|
45
50
|
});
|
|
46
51
|
export const fwidth = dualImpl({
|
|
47
52
|
name: 'fwidth',
|
|
48
53
|
normalImpl: derivativeNormalError,
|
|
49
|
-
signature:
|
|
54
|
+
signature: derivativeSignature,
|
|
50
55
|
codegenImpl: (ctx, [value]) => ctx.gen.emitCall('fwidth', [], [value]),
|
|
51
56
|
sideEffects: false,
|
|
52
57
|
});
|
|
53
58
|
export const fwidthCoarse = dualImpl({
|
|
54
59
|
name: 'fwidthCoarse',
|
|
55
60
|
normalImpl: derivativeNormalError,
|
|
56
|
-
signature:
|
|
61
|
+
signature: derivativeSignature,
|
|
57
62
|
codegenImpl: (_ctx, [value]) => stitch `fwidthCoarse(${value})`,
|
|
58
63
|
sideEffects: false,
|
|
59
64
|
});
|
|
60
65
|
export const fwidthFine = dualImpl({
|
|
61
66
|
name: 'fwidthFine',
|
|
62
67
|
normalImpl: derivativeNormalError,
|
|
63
|
-
signature:
|
|
68
|
+
signature: derivativeSignature,
|
|
64
69
|
codegenImpl: (_ctx, [value]) => stitch `fwidthFine(${value})`,
|
|
65
70
|
sideEffects: false,
|
|
66
71
|
});
|
package/std/index.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ export { add, bitShiftLeft, bitShiftRight, div, mod, mul, neg, sub } from './ope
|
|
|
8
8
|
export { rotateX4, rotateY4, rotateZ4, scale4, translate4 } from './matrix.ts';
|
|
9
9
|
export { identity2, identity3, identity4, rotationX4, rotationY4, rotationZ4, scaling4, translation4, } from '../data/matrix.ts';
|
|
10
10
|
export { allEq, eq, ne, lt, le, gt, ge, not, or, and, all, any, isCloseTo, select, } from './boolean.ts';
|
|
11
|
-
export { atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, workgroupBarrier, storageBarrier, textureBarrier, } from './atomic.ts';
|
|
11
|
+
export { atomicAdd, atomicAnd, atomicCompareExchangeWeak, atomicExchange, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, workgroupBarrier, storageBarrier, textureBarrier, workgroupUniformLoad, } from './atomic.ts';
|
|
12
12
|
export { dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, fwidth, fwidthCoarse, fwidthFine, } from './derivative.ts';
|
|
13
13
|
export { arrayLength } from './array.ts';
|
|
14
|
-
export { pack4x8unorm,
|
|
15
|
-
export { textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleGrad, textureSampleLevel, textureStore, } from './texture.ts';
|
|
16
|
-
export { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, } from './subgroup.ts';
|
|
14
|
+
export { pack2x16float, pack2x16snorm, pack2x16unorm, pack4x8snorm, pack4x8unorm, pack4xI8, pack4xI8Clamp, pack4xU8, pack4xU8Clamp, unpack2x16float, unpack2x16snorm, unpack2x16unorm, unpack4x8snorm, unpack4x8unorm, unpack4xI8, unpack4xU8, } from './packing.ts';
|
|
15
|
+
export { textureDimensions, textureGather, textureGatherCompare, textureLoad, textureNumLayers, textureNumLevels, textureNumSamples, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleGrad, textureSampleLevel, textureStore, } from './texture.ts';
|
|
16
|
+
export { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, quadBroadcast, quadSwapDiagonal, quadSwapX, quadSwapY, } from './subgroup.ts';
|
|
17
17
|
export { extensionEnabled } from './extensions.ts';
|
|
18
18
|
export { bitcastU32toF32, bitcastU32toI32, bitcastF32toU32, bitcast } from './bitcast.ts';
|
|
19
19
|
export { range } from './range.ts';
|
package/std/index.js
CHANGED
|
@@ -17,15 +17,15 @@ not, or, and,
|
|
|
17
17
|
all, any,
|
|
18
18
|
// other
|
|
19
19
|
isCloseTo, select, } from "./boolean.js";
|
|
20
|
-
export { atomicAdd, atomicAnd, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor,
|
|
20
|
+
export { atomicAdd, atomicAnd, atomicCompareExchangeWeak, atomicExchange, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor,
|
|
21
21
|
// synchronization
|
|
22
|
-
workgroupBarrier, storageBarrier, textureBarrier, } from "./atomic.js";
|
|
22
|
+
workgroupBarrier, storageBarrier, textureBarrier, workgroupUniformLoad, } from "./atomic.js";
|
|
23
23
|
export { dpdx, dpdxCoarse, dpdxFine, dpdy, dpdyCoarse, dpdyFine, fwidth, fwidthCoarse, fwidthFine, } from "./derivative.js";
|
|
24
24
|
export { arrayLength } from "./array.js";
|
|
25
25
|
// oxfmt-ignore
|
|
26
|
-
export { pack4x8unorm,
|
|
27
|
-
export { textureDimensions, textureGather, textureLoad, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleGrad, textureSampleLevel, textureStore, } from "./texture.js";
|
|
28
|
-
export { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, } from "./subgroup.js";
|
|
26
|
+
export { pack2x16float, pack2x16snorm, pack2x16unorm, pack4x8snorm, pack4x8unorm, pack4xI8, pack4xI8Clamp, pack4xU8, pack4xU8Clamp, unpack2x16float, unpack2x16snorm, unpack2x16unorm, unpack4x8snorm, unpack4x8unorm, unpack4xI8, unpack4xU8, } from "./packing.js";
|
|
27
|
+
export { textureDimensions, textureGather, textureGatherCompare, textureLoad, textureNumLayers, textureNumLevels, textureNumSamples, textureSample, textureSampleBaseClampToEdge, textureSampleBias, textureSampleCompare, textureSampleCompareLevel, textureSampleGrad, textureSampleLevel, textureStore, } from "./texture.js";
|
|
28
|
+
export { subgroupAdd, subgroupAll, subgroupAnd, subgroupAny, subgroupBallot, subgroupBroadcast, subgroupBroadcastFirst, subgroupElect, subgroupExclusiveAdd, subgroupExclusiveMul, subgroupInclusiveAdd, subgroupInclusiveMul, subgroupMax, subgroupMin, subgroupMul, subgroupOr, subgroupShuffle, subgroupShuffleDown, subgroupShuffleUp, subgroupShuffleXor, subgroupXor, quadBroadcast, quadSwapDiagonal, quadSwapX, quadSwapY, } from "./subgroup.js";
|
|
29
29
|
export { extensionEnabled } from "./extensions.js";
|
|
30
30
|
export { bitcastU32toF32, bitcastU32toI32, bitcastF32toU32, bitcast } from "./bitcast.js";
|
|
31
31
|
export { range } from "./range.js";
|
package/std/numeric.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { type AnyFloat32VecInstance, type AnyFloatVecInstance, type AnyIntegerVecInstance, type AnyMatInstance, type AnyNumericVecInstance, type AnySignedVecInstance, type v2f, type v2h, type v2i, type v3f, type v3h, type v3i, type v4f, type v4h, type v4i, type Vec2f } from '../data/wgslTypes.ts';
|
|
1
|
+
import { type AnyFloat32VecInstance, type AnyFloatVecInstance, type AnyIntegerVecInstance, type AnyMatInstance, type AnyNumericVecInstance, type AnySignedVecInstance, type BaseData, type v2f, type v2h, type v2i, type v3f, type v3h, type v3i, type v4f, type v4h, type v4i, type Vec2f } from '../data/wgslTypes.ts';
|
|
2
2
|
import type { Infer } from '../shared/repr.ts';
|
|
3
3
|
type NumVec = AnyNumericVecInstance;
|
|
4
|
+
export declare const unifyRestrictedSignature: (restrict: BaseData[]) => (...args: BaseData[]) => {
|
|
5
|
+
argTypes: BaseData[];
|
|
6
|
+
returnType: BaseData;
|
|
7
|
+
};
|
|
4
8
|
declare function cpuAbs(value: number): number;
|
|
5
9
|
declare function cpuAbs<T extends NumVec | number>(value: T): T;
|
|
6
10
|
export declare const abs: import("../types.ts").DualFn<typeof cpuAbs>;
|
package/std/numeric.js
CHANGED
|
@@ -26,7 +26,7 @@ const variadicUnifySignature = (...args) => {
|
|
|
26
26
|
returnType: uargs[0],
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
const unifyRestrictedSignature = (restrict) => (...args) => {
|
|
29
|
+
export const unifyRestrictedSignature = (restrict) => (...args) => {
|
|
30
30
|
const uargs = unify(args, restrict);
|
|
31
31
|
if (!uargs) {
|
|
32
32
|
throw new SignatureNotSupportedError(args, restrict);
|
|
@@ -946,9 +946,9 @@ function cpuIntdiv(lhs, rhs) {
|
|
|
946
946
|
export const intdiv = dualImpl({
|
|
947
947
|
name: 'intdiv',
|
|
948
948
|
signature: (lhs, rhs) => {
|
|
949
|
-
const unified = unify([lhs, rhs], [
|
|
949
|
+
const unified = unify([lhs, rhs], [i32, u32]);
|
|
950
950
|
if (!unified) {
|
|
951
|
-
throw new SignatureNotSupportedError([lhs, rhs], [
|
|
951
|
+
throw new SignatureNotSupportedError([lhs, rhs], [i32, u32, abstractInt]);
|
|
952
952
|
}
|
|
953
953
|
return { argTypes: unified, returnType: unified[0] };
|
|
954
954
|
},
|
package/std/packing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { v2f, v4f } from '../data/wgslTypes.ts';
|
|
1
|
+
import type { v2f, v4f, v4i, v4u } from '../data/wgslTypes.ts';
|
|
2
2
|
/**
|
|
3
3
|
* @privateRemarks
|
|
4
4
|
* https://gpuweb.github.io/gpuweb/wgsl/#unpack2x16float-builtin
|
|
@@ -9,13 +9,73 @@ export declare const unpack2x16float: import("../types.ts").DualFn<(e: number) =
|
|
|
9
9
|
* https://gpuweb.github.io/gpuweb/wgsl/#pack2x16float-builtin
|
|
10
10
|
*/
|
|
11
11
|
export declare const pack2x16float: import("../types.ts").DualFn<(e: v2f) => number>;
|
|
12
|
+
/**
|
|
13
|
+
* @privateRemarks
|
|
14
|
+
* https://www.w3.org/TR/WGSL/#pack2x16snorm-builtin
|
|
15
|
+
*/
|
|
16
|
+
export declare const pack2x16snorm: import("../types.ts").DualFn<(e: v2f) => number>;
|
|
17
|
+
/**
|
|
18
|
+
* @privateRemarks
|
|
19
|
+
* https://www.w3.org/TR/WGSL/#pack2x16unorm-builtin
|
|
20
|
+
*/
|
|
21
|
+
export declare const pack2x16unorm: import("../types.ts").DualFn<(e: v2f) => number>;
|
|
12
22
|
/**
|
|
13
23
|
* @privateRemarks
|
|
14
24
|
* https://gpuweb.github.io/gpuweb/wgsl/#unpack4x8unorm-builtin
|
|
15
25
|
*/
|
|
16
26
|
export declare const unpack4x8unorm: import("../types.ts").DualFn<(e: number) => v4f>;
|
|
27
|
+
/**
|
|
28
|
+
* @privateRemarks
|
|
29
|
+
* https://www.w3.org/TR/WGSL/#unpack4x8snorm-builtin
|
|
30
|
+
*/
|
|
31
|
+
export declare const unpack4x8snorm: import("../types.ts").DualFn<(e: number) => v4f>;
|
|
32
|
+
/**
|
|
33
|
+
* @privateRemarks
|
|
34
|
+
* https://www.w3.org/TR/WGSL/#unpack4xi8-builtin
|
|
35
|
+
*/
|
|
36
|
+
export declare const unpack4xI8: import("../types.ts").DualFn<(e: number) => v4i>;
|
|
37
|
+
/**
|
|
38
|
+
* @privateRemarks
|
|
39
|
+
* https://www.w3.org/TR/WGSL/#unpack4xu8-builtin
|
|
40
|
+
*/
|
|
41
|
+
export declare const unpack4xU8: import("../types.ts").DualFn<(e: number) => v4u>;
|
|
42
|
+
/**
|
|
43
|
+
* @privateRemarks
|
|
44
|
+
* https://www.w3.org/TR/WGSL/#unpack2x16snorm-builtin
|
|
45
|
+
*/
|
|
46
|
+
export declare const unpack2x16snorm: import("../types.ts").DualFn<(e: number) => v2f>;
|
|
47
|
+
/**
|
|
48
|
+
* @privateRemarks
|
|
49
|
+
* https://www.w3.org/TR/WGSL/#unpack2x16unorm-builtin
|
|
50
|
+
*/
|
|
51
|
+
export declare const unpack2x16unorm: import("../types.ts").DualFn<(e: number) => v2f>;
|
|
17
52
|
/**
|
|
18
53
|
* @privateRemarks
|
|
19
54
|
* https://gpuweb.github.io/gpuweb/wgsl/#pack4x8unorm-builtin
|
|
20
55
|
*/
|
|
21
56
|
export declare const pack4x8unorm: import("../types.ts").DualFn<(e: v4f) => number>;
|
|
57
|
+
/**
|
|
58
|
+
* @privateRemarks
|
|
59
|
+
* https://www.w3.org/TR/WGSL/#pack4x8snorm-builtin
|
|
60
|
+
*/
|
|
61
|
+
export declare const pack4x8snorm: import("../types.ts").DualFn<(e: v4f) => number>;
|
|
62
|
+
/**
|
|
63
|
+
* @privateRemarks
|
|
64
|
+
* https://www.w3.org/TR/WGSL/#pack4xi8-builtin
|
|
65
|
+
*/
|
|
66
|
+
export declare const pack4xI8: import("../types.ts").DualFn<(e: v4i) => number>;
|
|
67
|
+
/**
|
|
68
|
+
* @privateRemarks
|
|
69
|
+
* https://www.w3.org/TR/WGSL/#pack4xu8-builtin
|
|
70
|
+
*/
|
|
71
|
+
export declare const pack4xU8: import("../types.ts").DualFn<(e: v4u) => number>;
|
|
72
|
+
/**
|
|
73
|
+
* @privateRemarks
|
|
74
|
+
* https://www.w3.org/TR/WGSL/#pack4xi8clamp-builtin
|
|
75
|
+
*/
|
|
76
|
+
export declare const pack4xI8Clamp: import("../types.ts").DualFn<(e: v4i) => number>;
|
|
77
|
+
/**
|
|
78
|
+
* @privateRemarks
|
|
79
|
+
* https://www.w3.org/TR/WGSL/#pack4xu8clamp-builtin
|
|
80
|
+
*/
|
|
81
|
+
export declare const pack4xU8Clamp: import("../types.ts").DualFn<(e: v4u) => number>;
|