typegpu 0.11.9 → 0.12.0
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/builtin.d.ts +51 -53
- package/builtin.js +30 -34
- package/common/fullScreenTriangle.d.ts +2 -10
- package/common/fullScreenTriangle.js +20 -28
- package/common/index.d.ts +2 -9
- package/common/index.js +3 -12
- package/common/writeSoA.d.ts +11 -12
- package/common/writeSoA.js +88 -76
- package/core/buffer/buffer.d.ts +79 -62
- package/core/buffer/buffer.js +279 -205
- package/core/buffer/bufferBinding.d.ts +71 -0
- package/core/buffer/bufferBinding.js +154 -0
- package/core/buffer/bufferUsage.d.ts +14 -45
- package/core/buffer/bufferUsage.js +1 -171
- package/core/buffer/laidOutBuffer.d.ts +25 -0
- package/core/buffer/laidOutBuffer.js +55 -0
- package/core/commandEncoder/attachments.d.ts +125 -0
- package/core/commandEncoder/attachments.js +29 -0
- package/core/commandEncoder/commandEncoder.d.ts +53 -0
- package/core/commandEncoder/commandEncoder.js +56 -0
- package/core/commandEncoder/computePass.d.ts +58 -0
- package/core/commandEncoder/computePass.js +63 -0
- package/core/commandEncoder/renderPass.d.ts +121 -0
- package/core/commandEncoder/renderPass.js +196 -0
- package/core/constant/tgpuConstant.d.ts +26 -26
- package/core/constant/tgpuConstant.js +76 -65
- package/core/declare/tgpuDeclare.d.ts +3 -6
- package/core/declare/tgpuDeclare.js +36 -36
- package/core/function/autoIO.d.ts +61 -33
- package/core/function/autoIO.js +68 -73
- package/core/function/comptime.d.ts +11 -13
- package/core/function/comptime.js +60 -52
- package/core/function/createCallableSchema.d.ts +16 -0
- package/core/function/createCallableSchema.js +50 -40
- package/core/function/dualImpl.d.ts +44 -0
- package/core/function/dualImpl.js +71 -50
- package/core/function/entryInputRouter.d.ts +26 -0
- package/core/function/entryInputRouter.js +31 -33
- package/core/function/extractArgs.d.ts +38 -0
- package/core/function/extractArgs.js +202 -200
- package/core/function/fnCore.d.ts +44 -5
- package/core/function/fnCore.js +148 -93
- package/core/function/fnTypes.d.ts +31 -29
- package/core/function/fnTypes.js +1 -0
- package/core/function/ioSchema.d.ts +12 -10
- package/core/function/ioSchema.js +65 -47
- package/core/function/shelllessImpl.d.ts +9 -12
- package/core/function/shelllessImpl.js +17 -22
- package/core/function/templateUtils.d.ts +2 -0
- package/core/function/templateUtils.js +9 -8
- package/core/function/tgpuComputeFn.d.ts +26 -28
- package/core/function/tgpuComputeFn.js +47 -48
- package/core/function/tgpuFn.d.ts +34 -37
- package/core/function/tgpuFn.js +179 -153
- package/core/function/tgpuFragmentFn.d.ts +52 -53
- package/core/function/tgpuFragmentFn.js +63 -56
- package/core/function/tgpuVertexFn.d.ts +36 -39
- package/core/function/tgpuVertexFn.js +56 -53
- package/core/pipeline/computePipeline.d.ts +141 -53
- package/core/pipeline/computePipeline.js +291 -225
- package/core/pipeline/connectAttachmentToShader.d.ts +4 -0
- package/core/pipeline/connectAttachmentToShader.js +25 -22
- package/core/pipeline/connectTargetsToShader.d.ts +3 -0
- package/core/pipeline/connectTargetsToShader.js +29 -27
- package/core/pipeline/drawState.d.ts +52 -0
- package/core/pipeline/drawState.js +225 -0
- package/core/pipeline/limitsOverflow.d.ts +2 -0
- package/core/pipeline/limitsOverflow.js +13 -10
- package/core/pipeline/performanceTracker.d.ts +14 -0
- package/core/pipeline/performanceTracker.js +34 -0
- package/core/pipeline/pipelineUtils.d.ts +18 -0
- package/core/pipeline/pipelineUtils.js +54 -25
- package/core/pipeline/priors.d.ts +1 -0
- package/core/pipeline/priors.js +12 -0
- package/core/pipeline/renderPipeline.d.ts +246 -261
- package/core/pipeline/renderPipeline.js +487 -480
- package/core/pipeline/timeable.d.ts +28 -18
- package/core/pipeline/timeable.js +90 -52
- package/core/pipeline/typeGuards.d.ts +17 -0
- package/core/pipeline/typeGuards.js +52 -22
- package/core/querySet/querySet.d.ts +26 -21
- package/core/querySet/querySet.js +127 -103
- package/core/rawCodeSnippet/tgpuRawCodeSnippet.d.ts +13 -18
- package/core/rawCodeSnippet/tgpuRawCodeSnippet.js +89 -90
- package/core/resolve/externals.d.ts +25 -8
- package/core/resolve/externals.js +78 -54
- package/core/resolve/namespace.d.ts +22 -25
- package/core/resolve/namespace.js +16 -21
- package/core/resolve/resolvableString.d.ts +7 -0
- package/core/resolve/resolvableString.js +13 -0
- package/core/resolve/resolveData.d.ts +10 -0
- package/core/resolve/resolveData.js +162 -121
- package/core/resolve/stitch.d.ts +8 -0
- package/core/resolve/stitch.js +23 -21
- package/core/resolve/tgpuResolve.d.ts +55 -53
- package/core/resolve/tgpuResolve.js +106 -53
- package/core/root/configurableImpl.d.ts +10 -0
- package/core/root/configurableImpl.js +17 -19
- package/core/root/init.d.ts +76 -38
- package/core/root/init.js +346 -455
- package/core/root/rootTypes.d.ts +461 -636
- package/core/root/rootTypes.js +1 -0
- package/core/sampler/sampler.d.ts +50 -31
- package/core/sampler/sampler.js +120 -113
- package/core/simulate/tgpuSimulate.d.ts +9 -12
- package/core/simulate/tgpuSimulate.js +68 -71
- package/core/slot/accessor.d.ts +36 -13
- package/core/slot/accessor.js +138 -91
- package/core/slot/internalSlots.d.ts +2 -0
- package/core/slot/internalSlots.js +1 -6
- package/core/slot/lazy.d.ts +2 -6
- package/core/slot/lazy.js +71 -39
- package/core/slot/slot.d.ts +2 -6
- package/core/slot/slot.js +45 -38
- package/core/slot/slotTypes.d.ts +78 -80
- package/core/slot/slotTypes.js +11 -16
- package/core/texture/externalTexture.d.ts +20 -11
- package/core/texture/externalTexture.js +46 -46
- package/core/texture/texture.d.ts +152 -97
- package/core/texture/texture.js +407 -314
- package/core/texture/textureFormats.d.ts +42 -23
- package/core/texture/textureFormats.js +104 -75
- package/core/texture/textureProps.d.ts +7 -10
- package/core/texture/textureProps.js +1 -0
- package/core/texture/textureUtils.d.ts +8 -0
- package/core/texture/textureUtils.js +185 -179
- package/core/texture/usageExtension.d.ts +21 -18
- package/core/texture/usageExtension.js +13 -17
- package/core/unroll/tgpuUnroll.d.ts +20 -19
- package/core/unroll/tgpuUnroll.js +82 -91
- package/core/valueProxyUtils.d.ts +3 -0
- package/core/valueProxyUtils.js +52 -41
- package/core/variable/tgpuVariable.d.ts +26 -27
- package/core/variable/tgpuVariable.js +93 -96
- package/core/vertexLayout/connectAttributesToShader.d.ts +9 -0
- package/core/vertexLayout/connectAttributesToShader.js +61 -56
- package/core/vertexLayout/vertexAttribute.d.ts +21 -17
- package/core/vertexLayout/vertexAttribute.js +1 -0
- package/core/vertexLayout/vertexLayout.d.ts +24 -18
- package/core/vertexLayout/vertexLayout.js +130 -99
- package/core/whitespaces.d.ts +2 -0
- package/core/whitespaces.js +16 -0
- package/data/alignIO.d.ts +7 -0
- package/data/alignIO.js +13 -13
- package/data/alignmentOf.d.ts +5 -8
- package/data/alignmentOf.js +90 -75
- package/data/array.d.ts +6 -9
- package/data/array.js +48 -40
- package/data/atomic.d.ts +2 -7
- package/data/atomic.js +26 -23
- package/data/attributes.d.ts +19 -21
- package/data/attributes.js +192 -132
- package/data/autoStruct.d.ts +36 -3
- package/data/autoStruct.js +84 -81
- package/data/compiledIO.d.ts +5 -0
- package/data/compiledIO.js +231 -215
- package/data/dataIO.d.ts +13 -11
- package/data/dataIO.js +643 -589
- package/data/dataTypes.d.ts +83 -65
- package/data/dataTypes.js +66 -68
- package/data/deepEqual.d.ts +2 -7
- package/data/deepEqual.js +80 -55
- package/data/disarray.d.ts +6 -10
- package/data/disarray.js +52 -46
- package/data/float16Conversion.d.ts +4 -0
- package/data/float16Conversion.js +7 -0
- package/data/getLongestContiguousPrefix.d.ts +4 -8
- package/data/getLongestContiguousPrefix.js +6 -11
- package/data/index.d.ts +30 -31
- package/data/index.js +39 -172
- package/data/instanceToSchema.d.ts +24 -27
- package/data/instanceToSchema.js +1 -0
- package/data/isContiguous.d.ts +4 -8
- package/data/isContiguous.js +6 -11
- package/data/matrix.d.ts +21 -21
- package/data/matrix.js +513 -505
- package/data/numberOps.d.ts +6 -0
- package/data/numberOps.js +26 -20
- package/data/numeric.d.ts +21 -12
- package/data/numeric.js +287 -197
- package/data/offsetUtils.d.ts +9 -13
- package/data/offsetUtils.js +204 -144
- package/data/offsets.d.ts +8 -0
- package/data/offsets.js +33 -33
- package/data/partialIO.d.ts +13 -8
- package/data/partialIO.js +124 -113
- package/data/ptr.d.ts +12 -12
- package/data/ptr.js +42 -44
- package/data/ref.d.ts +40 -27
- package/data/ref.js +125 -95
- package/data/sampler.d.ts +99 -101
- package/data/sampler.js +17 -21
- package/data/schemaCallWrapper.d.ts +19 -0
- package/data/schemaCallWrapper.js +31 -26
- package/data/schemaMemoryLayout.d.ts +8 -0
- package/data/schemaMemoryLayout.js +213 -185
- package/data/sizeOf.d.ts +4 -8
- package/data/sizeOf.js +6 -11
- package/data/snippet.d.ts +96 -20
- package/data/snippet.js +75 -86
- package/data/struct.d.ts +4 -7
- package/data/struct.js +51 -39
- package/data/texture.d.ts +253 -250
- package/data/texture.js +238 -200
- package/data/unstruct.d.ts +2 -7
- package/data/unstruct.js +43 -37
- package/data/vector.d.ts +33 -21
- package/data/vector.js +234 -221
- package/data/vectorImpl.d.ts +231 -0
- package/data/vectorImpl.js +563 -515
- package/data/vectorOps.d.ts +63 -0
- package/data/vectorOps.js +642 -630
- package/data/vertexFormatData.d.ts +181 -184
- package/data/vertexFormatData.js +104 -106
- package/data/wgslTypes.d.ts +665 -600
- package/data/wgslTypes.js +220 -198
- package/errors.d.ts +50 -24
- package/errors.js +146 -126
- package/execMode.d.ts +16 -0
- package/execMode.js +47 -40
- package/extension.d.ts +13 -8
- package/extension.js +10 -16
- package/getGPUValue.d.ts +1 -0
- package/getGPUValue.js +2 -7
- package/index.d.ts +28 -68
- package/index.js +8 -28
- package/indexNamedExports.d.ts +69 -42
- package/indexNamedExports.js +25 -0
- package/internal.d.ts +16 -0
- package/internal.js +12 -0
- package/mathUtils.d.ts +5 -0
- package/mathUtils.js +7 -11
- package/memo.d.ts +11 -0
- package/memo.js +20 -22
- package/minify.d.ts +5 -0
- package/minify.js +93 -0
- package/nameUtils.d.ts +29 -0
- package/nameUtils.js +427 -394
- package/package.json +5 -1
- package/resolutionCtx.d.ts +162 -22
- package/resolutionCtx.js +911 -629
- package/serial/registry.d.ts +15 -0
- package/serial/registry.js +106 -0
- package/serial/restore.d.ts +49 -0
- package/serial/restore.js +68 -0
- package/serial/schema.d.ts +58 -0
- package/serial/schema.js +209 -0
- package/serial/types.d.ts +5 -0
- package/serial/types.js +1 -0
- package/shared/env.d.ts +9 -0
- package/shared/env.js +9 -12
- package/shared/generators.d.ts +4 -0
- package/shared/generators.js +10 -12
- package/shared/meta.d.ts +29 -14
- package/shared/meta.js +71 -55
- package/shared/normalizeMetadata.d.ts +32 -27
- package/shared/normalizeMetadata.js +23 -36
- package/shared/repr.d.ts +73 -55
- package/shared/repr.js +1 -0
- package/shared/soul.d.ts +17 -0
- package/shared/soul.js +1 -0
- package/shared/stringify.d.ts +2 -0
- package/shared/stringify.js +29 -20
- package/shared/symbols.d.ts +26 -20
- package/shared/symbols.js +79 -79
- package/shared/tseynit.d.ts +2 -0
- package/shared/tseynit.js +160 -75
- package/shared/utilityTypes.d.ts +30 -14
- package/shared/utilityTypes.js +2 -6
- package/shared/vertexFormat.d.ts +41 -43
- package/shared/vertexFormat.js +59 -62
- package/std/array.d.ts +2 -7
- package/std/array.js +18 -23
- package/std/atomic.d.ts +14 -18
- package/std/atomic.js +96 -95
- package/std/bitcast.d.ts +193 -10
- package/std/bitcast.js +309 -39
- package/std/boolean.d.ts +19 -33
- package/std/boolean.js +296 -288
- package/std/copy.d.ts +2 -7
- package/std/copy.js +27 -24
- package/std/derivative.d.ts +11 -15
- package/std/derivative.js +56 -79
- package/std/discard.d.ts +1 -6
- package/std/discard.js +7 -14
- package/std/environment.d.ts +19 -14
- package/std/environment.js +71 -51
- package/std/extensions.d.ts +2 -8
- package/std/extensions.js +10 -11
- package/std/index.d.ts +20 -24
- package/std/index.js +32 -187
- package/std/matrix.d.ts +6 -12
- package/std/matrix.js +60 -69
- package/std/numeric.d.ts +143 -146
- package/std/numeric.js +858 -749
- package/std/operators.d.ts +19 -27
- package/std/operators.js +227 -193
- package/std/packing.d.ts +5 -11
- package/std/packing.js +67 -75
- package/std/range.d.ts +6 -11
- package/std/range.js +48 -36
- package/std/subgroup.d.ts +33 -37
- package/std/subgroup.js +180 -217
- package/std/texture.d.ts +70 -38
- package/std/texture.js +176 -172
- package/taskQueue.d.ts +6 -0
- package/taskQueue.js +30 -0
- package/tgpu.d.ts +16 -0
- package/tgpu.js +17 -44
- package/tgpuBindGroupLayout.d.ts +132 -152
- package/tgpuBindGroupLayout.js +346 -268
- package/tgpuLogger.d.ts +34 -0
- package/tgpuLogger.js +63 -0
- package/tgpuUnstable.d.ts +16 -22
- package/tgpuUnstable.js +13 -35
- package/tgsl/accessIndex.d.ts +2 -0
- package/tgsl/accessIndex.js +76 -33
- package/tgsl/accessProp.d.ts +2 -0
- package/tgsl/accessProp.js +142 -101
- package/tgsl/accessStructProp.d.ts +5 -0
- package/tgsl/accessStructProp.js +13 -15
- package/tgsl/consoleLog/deserializers.d.ts +13 -0
- package/tgsl/consoleLog/deserializers.js +119 -103
- package/tgsl/consoleLog/logGenerator.d.ts +21 -0
- package/tgsl/consoleLog/logGenerator.js +85 -80
- package/tgsl/consoleLog/serializers.d.ts +21 -0
- package/tgsl/consoleLog/serializers.js +119 -100
- package/tgsl/consoleLog/types.d.ts +40 -39
- package/tgsl/consoleLog/types.js +1 -0
- package/tgsl/conversion.d.ts +33 -0
- package/tgsl/conversion.js +271 -216
- package/tgsl/forOfUtils.d.ts +15 -0
- package/tgsl/forOfUtils.js +85 -70
- package/tgsl/generationHelpers.d.ts +22 -39
- package/tgsl/generationHelpers.js +85 -58
- package/tgsl/infixDispatch.d.ts +70 -0
- package/tgsl/infixDispatch.js +48 -46
- package/tgsl/jsPolyfills.d.ts +16 -19
- package/tgsl/jsPolyfills.js +44 -42
- package/tgsl/makeDereferenceable.d.ts +48 -0
- package/tgsl/makeDereferenceable.js +86 -0
- package/tgsl/makeResolvable.d.ts +22 -0
- package/tgsl/makeResolvable.js +33 -0
- package/tgsl/shaderGenerator.d.ts +77 -17
- package/tgsl/shaderGenerator.js +1 -0
- package/tgsl/shellless.d.ts +6 -9
- package/tgsl/shellless.js +73 -43
- package/tgsl/wgslGenerator.d.ts +66 -59
- package/tgsl/wgslGenerator.js +1344 -760
- package/types.d.ts +287 -222
- package/types.js +61 -44
- package/unwrapper.d.ts +31 -26
- package/unwrapper.js +1 -0
- package/wgslExtensions.d.ts +3 -5
- package/wgslExtensions.js +12 -16
- package/_virtual/rolldown_runtime.js +0 -13
- package/core/buffer/bufferShorthand.d.ts +0 -50
- package/core/buffer/bufferShorthand.js +0 -55
- package/core/pipeline/applyPipelineState.js +0 -37
- package/package.js +0 -5
- package/tgsl/shaderGenerator_members.d.ts +0 -33
- package/tgsl/shaderGenerator_members.js +0 -12
package/data/wgslTypes.d.ts
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { WgslExternalTexture, WgslStorageTexture, WgslTexture } from
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
//#region src/data/wgslTypes.d.ts
|
|
1
|
+
import 'tsover-runtime';
|
|
2
|
+
import type { TgpuNamable } from '../shared/meta.ts';
|
|
3
|
+
import type { ExtractInvalidSchemaError, Infer, InferGPU, InferGPURecord, InferInput, InferInputRecord, InferPatch, InferPatchRecord, InferPartial, InferPartialRecord, InferRecord, IsValidStorageSchema, IsValidUniformSchema, IsValidVertexSchema, MemIdentity, MemIdentityRecord } from '../shared/repr.ts';
|
|
4
|
+
import type { $gpuRepr, $inRepr, $invalidSchemaReason, $memIdent, $repr, $reprPartial, $reprPatch, $validStorageSchema, $validUniformSchema, $validVertexSchema } from '../shared/symbols.ts';
|
|
5
|
+
import { $internal } from '../shared/symbols.ts';
|
|
6
|
+
import type { Prettify, SwapNever } from '../shared/utilityTypes.ts';
|
|
7
|
+
import type { WgslExternalTexture, WgslStorageTexture, WgslTexture } from './texture.ts';
|
|
8
|
+
import type { WgslComparisonSampler, WgslSampler } from './sampler.ts';
|
|
9
|
+
import type { _ref as ref } from './ref.ts';
|
|
10
|
+
import type { DualFn } from '../types.ts';
|
|
12
11
|
type DecoratedLocation<T extends BaseData> = Decorated<T, Location[]>;
|
|
13
|
-
interface BaseData {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
export interface BaseData {
|
|
13
|
+
readonly [$internal]: Record<string, unknown>;
|
|
14
|
+
readonly type: string;
|
|
15
|
+
readonly [$repr]: unknown;
|
|
16
|
+
toString(): string;
|
|
18
17
|
}
|
|
19
|
-
interface NumberArrayView {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export interface NumberArrayView {
|
|
19
|
+
readonly length: number;
|
|
20
|
+
[n: number]: number;
|
|
21
|
+
[Symbol.iterator]: () => Iterator<number>;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* Maps a scalar, vector, or matrix element schema to the corresponding TypedArray type.
|
|
26
25
|
*/
|
|
27
|
-
type TypedArrayFor<T> = T extends F32 | Vec2f | Vec3f | Vec4f | Mat2x2f | Mat3x3f | Mat4x4f ? Float32Array : T extends F16 | Vec2h | Vec3h | Vec4h ? Float16Array : T extends I32 | Vec2i | Vec3i | Vec4i | Atomic<I32> ? Int32Array : T extends U32 | Vec2u | Vec3u | Vec4u | Atomic<U32> ? Uint32Array : T extends U16 ? Uint16Array : T extends Decorated<infer TBase> ? TypedArrayFor<TBase> : never;
|
|
26
|
+
export type TypedArrayFor<T> = T extends F32 | Vec2f | Vec3f | Vec4f | Mat2x2f | Mat3x3f | Mat4x4f ? Float32Array : T extends F16 | Vec2h | Vec3h | Vec4h ? Float16Array : T extends I32 | Vec2i | Vec3i | Vec4i | Atomic<I32> ? Int32Array : T extends U32 | Vec2u | Vec3u | Vec4u | Atomic<U32> ? Uint32Array : T extends U16 ? Uint16Array : T extends Decorated<infer TBase> ? TypedArrayFor<TBase> : never;
|
|
28
27
|
/**
|
|
29
28
|
* Vector infix notation.
|
|
30
29
|
*
|
|
@@ -32,22 +31,22 @@ type TypedArrayFor<T> = T extends F32 | Vec2f | Vec3f | Vec4f | Mat2x2f | Mat3x3
|
|
|
32
31
|
* These functions are not defined on vectors,
|
|
33
32
|
* but are instead assigned to `VecBase` after both `data` and `std` are initialized.
|
|
34
33
|
*/
|
|
35
|
-
interface vecInfixNotation<T extends vecBase> {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
export interface vecInfixNotation<T extends vecBase> {
|
|
35
|
+
add(other: T | number): T;
|
|
36
|
+
sub(other: T | number): T;
|
|
37
|
+
mul(other: mBaseForVec<T> | T | number): T;
|
|
38
|
+
div(other: T | number): T;
|
|
39
|
+
mod(other: T | number): T;
|
|
40
|
+
[Symbol.operatorPlus](lhs: T | number, rhs: T | number): T;
|
|
41
|
+
[Symbol.operatorMinus](lhs: T | number, rhs: T | number): T;
|
|
42
|
+
[Symbol.operatorStar](lhs: mBaseForVec<T> | T | number, rhs: mBaseForVec<T> | T | number): T;
|
|
43
|
+
[Symbol.operatorSlash](lhs: T | number, rhs: T | number): T;
|
|
44
|
+
[Symbol.operatorPercent](lhs: T | number, rhs: T | number): T;
|
|
46
45
|
}
|
|
47
|
-
type vecIToVecU<T extends AnyIntegerVecInstance> = T extends v2i | v2u ? v2u : T extends v3i | v3u ? v3u : v4u;
|
|
48
|
-
interface vecBitShiftNotation<T extends AnyIntegerVecInstance> {
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
export type vecIToVecU<T extends AnyIntegerVecInstance> = T extends v2i | v2u ? v2u : T extends v3i | v3u ? v3u : v4u;
|
|
47
|
+
export interface vecBitShiftNotation<T extends AnyIntegerVecInstance> {
|
|
48
|
+
bitShiftLeft(rhs: vecIToVecU<T> | number): T;
|
|
49
|
+
bitShiftRight(rhs: vecIToVecU<T> | number): T;
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
52
|
* Matrix infix notation.
|
|
@@ -56,50 +55,68 @@ interface vecBitShiftNotation<T extends AnyIntegerVecInstance> {
|
|
|
56
55
|
* These functions are not defined on matrices,
|
|
57
56
|
* but are instead assigned to `MatBase` after both `data` and `std` are initialized.
|
|
58
57
|
*/
|
|
59
|
-
interface matInfixNotation<T extends matBase> {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
export interface matInfixNotation<T extends matBase> {
|
|
59
|
+
add(other: T): T;
|
|
60
|
+
sub(other: T): T;
|
|
61
|
+
mul(other: T | number): T;
|
|
62
|
+
mul(other: vBaseForMat<T>): vBaseForMat<T>;
|
|
63
|
+
[Symbol.operatorPlus](lhs: T, rhs: T): T;
|
|
64
|
+
[Symbol.operatorMinus](lhs: T, rhs: T): T;
|
|
65
|
+
[Symbol.operatorStar](lhs: T | number, rhs: T | number): T;
|
|
66
|
+
[Symbol.operatorStar](lhs: T, rhs: vBaseForMat<T>): vBaseForMat<T>;
|
|
67
|
+
[Symbol.operatorStar](lhs: vBaseForMat<T>, rhs: T): vBaseForMat<T>;
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* Represents a 64-bit integer.
|
|
72
71
|
*/
|
|
73
|
-
interface AbstractInt extends BaseData {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
export interface AbstractInt extends BaseData {
|
|
73
|
+
readonly type: 'abstractInt';
|
|
74
|
+
readonly concretized: I32;
|
|
75
|
+
readonly [$repr]: number;
|
|
76
|
+
readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';
|
|
78
77
|
}
|
|
79
78
|
/**
|
|
80
79
|
* Represents a 64-bit IEEE 754 floating point number.
|
|
81
80
|
*/
|
|
82
|
-
interface AbstractFloat extends BaseData {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
export interface AbstractFloat extends BaseData {
|
|
82
|
+
readonly type: 'abstractFloat';
|
|
83
|
+
readonly concretized: F32;
|
|
84
|
+
readonly [$repr]: number;
|
|
85
|
+
readonly [$invalidSchemaReason]: 'Abstract numerics are not host-shareable';
|
|
87
86
|
}
|
|
88
|
-
interface Void extends BaseData {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
export interface Void extends BaseData {
|
|
88
|
+
readonly type: 'void';
|
|
89
|
+
readonly [$repr]: void;
|
|
90
|
+
readonly [$invalidSchemaReason]: 'Void is not host-shareable';
|
|
92
91
|
}
|
|
93
|
-
declare const Void: Void;
|
|
92
|
+
export declare const Void: Void;
|
|
94
93
|
type XY = 'x' | 'y';
|
|
95
94
|
type XYZ = 'x' | 'y' | 'z';
|
|
96
95
|
type XYZW = 'x' | 'y' | 'z' | 'w';
|
|
97
96
|
type RG = 'r' | 'g';
|
|
98
97
|
type RGB = 'r' | 'g' | 'b';
|
|
99
98
|
type RGBA = 'r' | 'g' | 'b' | 'a';
|
|
100
|
-
type Swizzle2<T2, T3, T4> = {
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
type Swizzle2<T2, T3, T4> = {
|
|
100
|
+
readonly [K in `${XY}${XY}` | `${RG}${RG}`]: T2;
|
|
101
|
+
} & {
|
|
102
|
+
readonly [K in `${XY}${XY}${XY}` | `${RG}${RG}${RG}`]: T3;
|
|
103
|
+
} & {
|
|
104
|
+
readonly [K in `${XY}${XY}${XY}${XY}` | `${RG}${RG}${RG}${RG}`]: T4;
|
|
105
|
+
};
|
|
106
|
+
type Swizzle3<T2, T3, T4> = {
|
|
107
|
+
readonly [K in `${XYZ}${XYZ}` | `${RGB}${RGB}`]: T2;
|
|
108
|
+
} & {
|
|
109
|
+
readonly [K in `${XYZ}${XYZ}${XYZ}` | `${RGB}${RGB}${RGB}`]: T3;
|
|
110
|
+
} & {
|
|
111
|
+
readonly [K in `${XYZ}${XYZ}${XYZ}${XYZ}` | `${RGB}${RGB}${RGB}${RGB}`]: T4;
|
|
112
|
+
};
|
|
113
|
+
type Swizzle4<T2, T3, T4> = {
|
|
114
|
+
readonly [K in `${XYZW}${XYZW}` | `${RGBA}${RGBA}`]: T2;
|
|
115
|
+
} & {
|
|
116
|
+
readonly [K in `${XYZW}${XYZW}${XYZW}` | `${RGBA}${RGBA}${RGBA}`]: T3;
|
|
117
|
+
} & {
|
|
118
|
+
readonly [K in `${XYZW}${XYZW}${XYZW}${XYZW}` | `${RGBA}${RGBA}${RGBA}${RGBA}`]: T4;
|
|
119
|
+
};
|
|
103
120
|
type Tuple2<S> = [S, S];
|
|
104
121
|
type Tuple3<S> = [S, S, S];
|
|
105
122
|
type Tuple4<S> = [S, S, S, S];
|
|
@@ -118,611 +135,617 @@ type Tuple4<S> = [S, S, S, S];
|
|
|
118
135
|
* }
|
|
119
136
|
* ```
|
|
120
137
|
*/
|
|
121
|
-
interface vecBase extends vecInfixNotation<vecBase> {
|
|
122
|
-
|
|
123
|
-
|
|
138
|
+
export interface vecBase extends vecInfixNotation<vecBase> {
|
|
139
|
+
readonly [$internal]: true;
|
|
140
|
+
readonly kind: 'vec2f' | 'vec3f' | 'vec4f' | 'vec2h' | 'vec3h' | 'vec4h' | 'vec2i' | 'vec3i' | 'vec4i' | 'vec2u' | 'vec3u' | 'vec4u';
|
|
124
141
|
}
|
|
125
142
|
/**
|
|
126
143
|
* Interface representing its WGSL vector type counterpart: vec2f or vec2<f32>.
|
|
127
144
|
* A vector with 2 elements of type f32
|
|
128
145
|
*/
|
|
129
|
-
interface v2f extends Tuple2<number>, Swizzle2<v2f, v3f, v4f>, vecInfixNotation<v2f> {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
146
|
+
export interface v2f extends Tuple2<number>, Swizzle2<v2f, v3f, v4f>, vecInfixNotation<v2f> {
|
|
147
|
+
readonly [$internal]: true;
|
|
148
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
149
|
+
readonly kind: 'vec2f';
|
|
150
|
+
x: number;
|
|
151
|
+
y: number;
|
|
152
|
+
r: number;
|
|
153
|
+
g: number;
|
|
137
154
|
}
|
|
138
155
|
/**
|
|
139
156
|
* Interface representing its WGSL vector type counterpart: vec2h or vec2<f16>.
|
|
140
157
|
* A vector with 2 elements of type f16
|
|
141
158
|
*/
|
|
142
|
-
interface v2h extends Tuple2<number>, Swizzle2<v2h, v3h, v4h>, vecInfixNotation<v2h> {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
export interface v2h extends Tuple2<number>, Swizzle2<v2h, v3h, v4h>, vecInfixNotation<v2h> {
|
|
160
|
+
readonly [$internal]: true;
|
|
161
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
162
|
+
readonly kind: 'vec2h';
|
|
163
|
+
x: number;
|
|
164
|
+
y: number;
|
|
165
|
+
r: number;
|
|
166
|
+
g: number;
|
|
150
167
|
}
|
|
151
168
|
/**
|
|
152
169
|
* Interface representing its WGSL vector type counterpart: vec2i or vec2<i32>.
|
|
153
170
|
* A vector with 2 elements of type i32
|
|
154
171
|
*/
|
|
155
|
-
interface v2i extends Tuple2<number>, Swizzle2<v2i, v3i, v4i>, vecInfixNotation<v2i>, vecBitShiftNotation<v2i> {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
172
|
+
export interface v2i extends Tuple2<number>, Swizzle2<v2i, v3i, v4i>, vecInfixNotation<v2i>, vecBitShiftNotation<v2i> {
|
|
173
|
+
readonly [$internal]: true;
|
|
174
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
175
|
+
readonly kind: 'vec2i';
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
r: number;
|
|
179
|
+
g: number;
|
|
163
180
|
}
|
|
164
181
|
/**
|
|
165
182
|
* Interface representing its WGSL vector type counterpart: vec2u or vec2<u32>.
|
|
166
183
|
* A vector with 2 elements of type u32
|
|
167
184
|
*/
|
|
168
|
-
interface v2u extends Tuple2<number>, Swizzle2<v2u, v3u, v4u>, vecInfixNotation<v2u>, vecBitShiftNotation<v2u> {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
185
|
+
export interface v2u extends Tuple2<number>, Swizzle2<v2u, v3u, v4u>, vecInfixNotation<v2u>, vecBitShiftNotation<v2u> {
|
|
186
|
+
readonly [$internal]: true;
|
|
187
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
188
|
+
readonly kind: 'vec2u';
|
|
189
|
+
x: number;
|
|
190
|
+
y: number;
|
|
191
|
+
r: number;
|
|
192
|
+
g: number;
|
|
176
193
|
}
|
|
177
194
|
/**
|
|
178
195
|
* Interface representing its WGSL vector type counterpart: `vec2<bool>`.
|
|
179
196
|
* A vector with 2 elements of type `bool`
|
|
180
197
|
*/
|
|
181
|
-
interface v2b extends Tuple2<boolean>, Swizzle2<v2b, v3b, v4b> {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
198
|
+
export interface v2b extends Tuple2<boolean>, Swizzle2<v2b, v3b, v4b> {
|
|
199
|
+
readonly [$internal]: true;
|
|
200
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
201
|
+
readonly kind: 'vec2<bool>';
|
|
202
|
+
x: boolean;
|
|
203
|
+
y: boolean;
|
|
204
|
+
r: boolean;
|
|
205
|
+
g: boolean;
|
|
189
206
|
}
|
|
190
207
|
/**
|
|
191
208
|
* Interface representing its WGSL vector type counterpart: vec3f or vec3<f32>.
|
|
192
209
|
* A vector with 3 elements of type f32
|
|
193
210
|
*/
|
|
194
|
-
interface v3f extends Tuple3<number>, Swizzle3<v2f, v3f, v4f>, vecInfixNotation<v3f> {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
211
|
+
export interface v3f extends Tuple3<number>, Swizzle3<v2f, v3f, v4f>, vecInfixNotation<v3f> {
|
|
212
|
+
readonly [$internal]: true;
|
|
213
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
214
|
+
readonly kind: 'vec3f';
|
|
215
|
+
x: number;
|
|
216
|
+
y: number;
|
|
217
|
+
z: number;
|
|
218
|
+
r: number;
|
|
219
|
+
g: number;
|
|
220
|
+
b: number;
|
|
204
221
|
}
|
|
205
222
|
/**
|
|
206
223
|
* Interface representing its WGSL vector type counterpart: vec3h or vec3<f16>.
|
|
207
224
|
* A vector with 3 elements of type f16
|
|
208
225
|
*/
|
|
209
|
-
interface v3h extends Tuple3<number>, Swizzle3<v2h, v3h, v4h>, vecInfixNotation<v3h> {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
226
|
+
export interface v3h extends Tuple3<number>, Swizzle3<v2h, v3h, v4h>, vecInfixNotation<v3h> {
|
|
227
|
+
readonly [$internal]: true;
|
|
228
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
229
|
+
readonly kind: 'vec3h';
|
|
230
|
+
x: number;
|
|
231
|
+
y: number;
|
|
232
|
+
z: number;
|
|
233
|
+
r: number;
|
|
234
|
+
g: number;
|
|
235
|
+
b: number;
|
|
219
236
|
}
|
|
220
237
|
/**
|
|
221
238
|
* Interface representing its WGSL vector type counterpart: vec3i or vec3<i32>.
|
|
222
239
|
* A vector with 3 elements of type i32
|
|
223
240
|
*/
|
|
224
|
-
interface v3i extends Tuple3<number>, Swizzle3<v2i, v3i, v4i>, vecInfixNotation<v3i>, vecBitShiftNotation<v3i> {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
241
|
+
export interface v3i extends Tuple3<number>, Swizzle3<v2i, v3i, v4i>, vecInfixNotation<v3i>, vecBitShiftNotation<v3i> {
|
|
242
|
+
readonly [$internal]: true;
|
|
243
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
244
|
+
readonly kind: 'vec3i';
|
|
245
|
+
x: number;
|
|
246
|
+
y: number;
|
|
247
|
+
z: number;
|
|
248
|
+
r: number;
|
|
249
|
+
g: number;
|
|
250
|
+
b: number;
|
|
234
251
|
}
|
|
235
252
|
/**
|
|
236
253
|
* Interface representing its WGSL vector type counterpart: vec3u or vec3<u32>.
|
|
237
254
|
* A vector with 3 elements of type u32
|
|
238
255
|
*/
|
|
239
|
-
interface v3u extends Tuple3<number>, Swizzle3<v2u, v3u, v4u>, vecInfixNotation<v3u>, vecBitShiftNotation<v3u> {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
256
|
+
export interface v3u extends Tuple3<number>, Swizzle3<v2u, v3u, v4u>, vecInfixNotation<v3u>, vecBitShiftNotation<v3u> {
|
|
257
|
+
readonly [$internal]: true;
|
|
258
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
259
|
+
readonly kind: 'vec3u';
|
|
260
|
+
x: number;
|
|
261
|
+
y: number;
|
|
262
|
+
z: number;
|
|
263
|
+
r: number;
|
|
264
|
+
g: number;
|
|
265
|
+
b: number;
|
|
249
266
|
}
|
|
250
267
|
/**
|
|
251
268
|
* Interface representing its WGSL vector type counterpart: `vec3<bool>`.
|
|
252
269
|
* A vector with 3 elements of type `bool`
|
|
253
270
|
*/
|
|
254
|
-
interface v3b extends Tuple3<boolean>, Swizzle3<v2b, v3b, v4b> {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
271
|
+
export interface v3b extends Tuple3<boolean>, Swizzle3<v2b, v3b, v4b> {
|
|
272
|
+
readonly [$internal]: true;
|
|
273
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
274
|
+
readonly kind: 'vec3<bool>';
|
|
275
|
+
x: boolean;
|
|
276
|
+
y: boolean;
|
|
277
|
+
z: boolean;
|
|
278
|
+
r: boolean;
|
|
279
|
+
g: boolean;
|
|
280
|
+
b: boolean;
|
|
264
281
|
}
|
|
265
282
|
/**
|
|
266
283
|
* Interface representing its WGSL vector type counterpart: vec4f or vec4<f32>.
|
|
267
284
|
* A vector with 4 elements of type f32
|
|
268
285
|
*/
|
|
269
|
-
interface v4f extends Tuple4<number>, Swizzle4<v2f, v3f, v4f>, vecInfixNotation<v4f> {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
286
|
+
export interface v4f extends Tuple4<number>, Swizzle4<v2f, v3f, v4f>, vecInfixNotation<v4f> {
|
|
287
|
+
readonly [$internal]: true;
|
|
288
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
289
|
+
readonly kind: 'vec4f';
|
|
290
|
+
x: number;
|
|
291
|
+
y: number;
|
|
292
|
+
z: number;
|
|
293
|
+
w: number;
|
|
294
|
+
r: number;
|
|
295
|
+
g: number;
|
|
296
|
+
b: number;
|
|
297
|
+
a: number;
|
|
281
298
|
}
|
|
282
299
|
/**
|
|
283
300
|
* Interface representing its WGSL vector type counterpart: vec4h or vec4<f16>.
|
|
284
301
|
* A vector with 4 elements of type f16
|
|
285
302
|
*/
|
|
286
|
-
interface v4h extends Tuple4<number>, Swizzle4<v2h, v3h, v4h>, vecInfixNotation<v4h> {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
303
|
+
export interface v4h extends Tuple4<number>, Swizzle4<v2h, v3h, v4h>, vecInfixNotation<v4h> {
|
|
304
|
+
readonly [$internal]: true;
|
|
305
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
306
|
+
readonly kind: 'vec4h';
|
|
307
|
+
x: number;
|
|
308
|
+
y: number;
|
|
309
|
+
z: number;
|
|
310
|
+
w: number;
|
|
311
|
+
r: number;
|
|
312
|
+
g: number;
|
|
313
|
+
b: number;
|
|
314
|
+
a: number;
|
|
298
315
|
}
|
|
299
316
|
/**
|
|
300
317
|
* Interface representing its WGSL vector type counterpart: vec4i or vec4<i32>.
|
|
301
318
|
* A vector with 4 elements of type i32
|
|
302
319
|
*/
|
|
303
|
-
interface v4i extends Tuple4<number>, Swizzle4<v2i, v3i, v4i>, vecInfixNotation<v4i>, vecBitShiftNotation<v4i> {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
320
|
+
export interface v4i extends Tuple4<number>, Swizzle4<v2i, v3i, v4i>, vecInfixNotation<v4i>, vecBitShiftNotation<v4i> {
|
|
321
|
+
readonly [$internal]: true;
|
|
322
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
323
|
+
readonly kind: 'vec4i';
|
|
324
|
+
x: number;
|
|
325
|
+
y: number;
|
|
326
|
+
z: number;
|
|
327
|
+
w: number;
|
|
328
|
+
r: number;
|
|
329
|
+
g: number;
|
|
330
|
+
b: number;
|
|
331
|
+
a: number;
|
|
315
332
|
}
|
|
316
333
|
/**
|
|
317
334
|
* Interface representing its WGSL vector type counterpart: vec4u or vec4<u32>.
|
|
318
335
|
* A vector with 4 elements of type u32
|
|
319
336
|
*/
|
|
320
|
-
interface v4u extends Tuple4<number>, Swizzle4<v2u, v3u, v4u>, vecInfixNotation<v4u>, vecBitShiftNotation<v4u> {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
337
|
+
export interface v4u extends Tuple4<number>, Swizzle4<v2u, v3u, v4u>, vecInfixNotation<v4u>, vecBitShiftNotation<v4u> {
|
|
338
|
+
readonly [$internal]: true;
|
|
339
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
340
|
+
readonly kind: 'vec4u';
|
|
341
|
+
x: number;
|
|
342
|
+
y: number;
|
|
343
|
+
z: number;
|
|
344
|
+
w: number;
|
|
345
|
+
r: number;
|
|
346
|
+
g: number;
|
|
347
|
+
b: number;
|
|
348
|
+
a: number;
|
|
332
349
|
}
|
|
333
350
|
/**
|
|
334
351
|
* Interface representing its WGSL vector type counterpart: `vec4<bool>`.
|
|
335
352
|
* A vector with 4 elements of type `bool`
|
|
336
353
|
*/
|
|
337
|
-
interface v4b extends Tuple4<boolean>, Swizzle4<v2b, v3b, v4b> {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
type AnyFloat32VecInstance = v2f | v3f | v4f;
|
|
351
|
-
type
|
|
352
|
-
type
|
|
353
|
-
type
|
|
354
|
-
type
|
|
355
|
-
type
|
|
356
|
-
type
|
|
357
|
-
type
|
|
358
|
-
type
|
|
359
|
-
type
|
|
360
|
-
type
|
|
361
|
-
type
|
|
362
|
-
type
|
|
354
|
+
export interface v4b extends Tuple4<boolean>, Swizzle4<v2b, v3b, v4b> {
|
|
355
|
+
readonly [$internal]: true;
|
|
356
|
+
/** use to distinguish between vectors of the same size on the type level */
|
|
357
|
+
readonly kind: 'vec4<bool>';
|
|
358
|
+
x: boolean;
|
|
359
|
+
y: boolean;
|
|
360
|
+
z: boolean;
|
|
361
|
+
w: boolean;
|
|
362
|
+
r: boolean;
|
|
363
|
+
g: boolean;
|
|
364
|
+
b: boolean;
|
|
365
|
+
a: boolean;
|
|
366
|
+
}
|
|
367
|
+
export type AnyFloat32VecInstance = v2f | v3f | v4f;
|
|
368
|
+
export type AnyFloat16VecInstance = v2h | v3h | v4h;
|
|
369
|
+
export type AnyFloatVecInstance = v2f | v2h | v3f | v3h | v4f | v4h;
|
|
370
|
+
export type AnyUnsignedVecInstance = v2u | v3u | v4u;
|
|
371
|
+
export type AnyIntegerVecInstance = v2i | v2u | v3i | v3u | v4i | v4u;
|
|
372
|
+
export type AnyBooleanVecInstance = v2b | v3b | v4b;
|
|
373
|
+
export type AnySignedVecInstance = v2i | v2f | v2h | v3i | v3f | v3h | v4i | v4f | v4h;
|
|
374
|
+
export type AnyNumericVec2Instance = v2f | v2h | v2i | v2u;
|
|
375
|
+
export type AnyNumericVec3Instance = v3f | v3h | v3i | v3u;
|
|
376
|
+
export type AnyNumericVec4Instance = v4f | v4h | v4i | v4u;
|
|
377
|
+
export type AnyNumericVecInstance = AnyNumericVec2Instance | AnyNumericVec3Instance | AnyNumericVec4Instance;
|
|
378
|
+
export type AnyVec2Instance = v2f | v2h | v2i | v2u | v2b;
|
|
379
|
+
export type AnyVec3Instance = v3f | v3h | v3i | v3u | v3b;
|
|
380
|
+
export type AnyVec4Instance = v4f | v4h | v4i | v4u | v4b;
|
|
381
|
+
export type AnyVecInstance = AnyVec2Instance | AnyVec3Instance | AnyVec4Instance;
|
|
382
|
+
export type VecKind = AnyVecInstance['kind'];
|
|
363
383
|
/**
|
|
364
384
|
* A type which every matrix is assignable to. In most cases the union m2x2f | m3x3f | m4x4f
|
|
365
385
|
* is preferred, but when an implementation uses overloaded operators and is generic on the type,
|
|
366
386
|
* this makes the type checking much more laid back.
|
|
367
387
|
*/
|
|
368
|
-
interface matBase extends matInfixNotation<matBase> {
|
|
369
|
-
|
|
370
|
-
|
|
388
|
+
export interface matBase extends matInfixNotation<matBase> {
|
|
389
|
+
readonly [$internal]: true;
|
|
390
|
+
readonly kind: 'mat2x2f' | 'mat3x3f' | 'mat4x4f';
|
|
371
391
|
}
|
|
372
392
|
/**
|
|
373
393
|
* Interface representing its WGSL matrix type counterpart: mat2x2
|
|
374
394
|
* A matrix with 2 rows and 2 columns, with elements of type `TColumn`
|
|
375
395
|
*/
|
|
376
|
-
interface mat2x2<TColumn> extends NumberArrayView {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
396
|
+
export interface mat2x2<TColumn> extends NumberArrayView {
|
|
397
|
+
readonly [$internal]: true;
|
|
398
|
+
readonly length: 4;
|
|
399
|
+
readonly kind: string;
|
|
400
|
+
readonly columns: readonly [TColumn, TColumn];
|
|
401
|
+
[n: number]: number;
|
|
402
|
+
toString(): string;
|
|
382
403
|
}
|
|
383
404
|
/**
|
|
384
405
|
* Interface representing its WGSL matrix type counterpart: mat2x2f or mat2x2<f32>
|
|
385
406
|
* A matrix with 2 rows and 2 columns, with elements of type d.f32
|
|
386
407
|
*/
|
|
387
|
-
interface m2x2f extends mat2x2<v2f>, matInfixNotation<m2x2f> {
|
|
388
|
-
|
|
408
|
+
export interface m2x2f extends mat2x2<v2f>, matInfixNotation<m2x2f> {
|
|
409
|
+
readonly kind: 'mat2x2f';
|
|
389
410
|
}
|
|
390
411
|
/**
|
|
391
412
|
* Interface representing its WGSL matrix type counterpart: mat3x3
|
|
392
413
|
* A matrix with 3 rows and 3 columns, with elements of type `TColumn`
|
|
393
414
|
*/
|
|
394
|
-
interface mat3x3<TColumn> extends NumberArrayView {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
415
|
+
export interface mat3x3<TColumn> extends NumberArrayView {
|
|
416
|
+
readonly [$internal]: true;
|
|
417
|
+
readonly length: 12;
|
|
418
|
+
readonly kind: string;
|
|
419
|
+
readonly columns: readonly [TColumn, TColumn, TColumn];
|
|
420
|
+
[n: number]: number;
|
|
421
|
+
toString(): string;
|
|
400
422
|
}
|
|
401
423
|
/**
|
|
402
424
|
* Interface representing its WGSL matrix type counterpart: mat3x3f or mat3x3<f32>
|
|
403
425
|
* A matrix with 3 rows and 3 columns, with elements of type d.f32
|
|
404
426
|
*/
|
|
405
|
-
interface m3x3f extends mat3x3<v3f>, matInfixNotation<m3x3f> {
|
|
406
|
-
|
|
427
|
+
export interface m3x3f extends mat3x3<v3f>, matInfixNotation<m3x3f> {
|
|
428
|
+
readonly kind: 'mat3x3f';
|
|
407
429
|
}
|
|
408
430
|
/**
|
|
409
431
|
* Interface representing its WGSL matrix type counterpart: mat4x4
|
|
410
432
|
* A matrix with 4 rows and 4 columns, with elements of type `TColumn`
|
|
411
433
|
*/
|
|
412
|
-
interface mat4x4<TColumn> extends NumberArrayView {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
434
|
+
export interface mat4x4<TColumn> extends NumberArrayView {
|
|
435
|
+
readonly [$internal]: true;
|
|
436
|
+
readonly length: 16;
|
|
437
|
+
readonly kind: string;
|
|
438
|
+
readonly columns: readonly [TColumn, TColumn, TColumn, TColumn];
|
|
439
|
+
[n: number]: number;
|
|
440
|
+
toString(): string;
|
|
418
441
|
}
|
|
419
442
|
/**
|
|
420
443
|
* Interface representing its WGSL matrix type counterpart: mat4x4f or mat4x4<f32>
|
|
421
444
|
* A matrix with 4 rows and 4 columns, with elements of type d.f32
|
|
422
445
|
*/
|
|
423
|
-
interface m4x4f extends mat4x4<v4f>, matInfixNotation<m4x4f> {
|
|
424
|
-
|
|
446
|
+
export interface m4x4f extends mat4x4<v4f>, matInfixNotation<m4x4f> {
|
|
447
|
+
readonly kind: 'mat4x4f';
|
|
425
448
|
}
|
|
426
|
-
type AnyMatInstance = m2x2f | m3x3f | m4x4f;
|
|
427
|
-
type vBaseForMat<T extends matBase> = T extends m2x2f ? v2f : T extends m3x3f ? v3f : T extends m4x4f ? v4f : vecBase;
|
|
428
|
-
type mBaseForVec<T extends vecBase> = T extends v2f ? m2x2f : T extends v3f ? m3x3f : T extends v4f ? m4x4f : matBase;
|
|
449
|
+
export type AnyMatInstance = m2x2f | m3x3f | m4x4f;
|
|
450
|
+
export type vBaseForMat<T extends matBase> = T extends m2x2f ? v2f : T extends m3x3f ? v3f : T extends m4x4f ? v4f : vecBase;
|
|
451
|
+
export type mBaseForVec<T extends vecBase> = T extends v2f ? m2x2f : T extends v3f ? m3x3f : T extends v4f ? m4x4f : matBase;
|
|
429
452
|
/**
|
|
430
453
|
* Boolean schema representing a single WGSL bool value.
|
|
431
454
|
* Cannot be used inside buffers as it is not host-shareable.
|
|
432
455
|
*/
|
|
433
|
-
interface Bool extends BaseData, DualFn<(v
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
456
|
+
export interface Bool extends BaseData, DualFn<((v: number | boolean) => boolean) & (() => boolean)> {
|
|
457
|
+
readonly type: 'bool';
|
|
458
|
+
readonly [$repr]: boolean;
|
|
459
|
+
readonly [$invalidSchemaReason]: 'Bool is not host-shareable, use U32 or I32 instead';
|
|
437
460
|
}
|
|
438
461
|
/**
|
|
439
462
|
* 32-bit float schema representing a single WGSL f32 value.
|
|
440
463
|
*/
|
|
441
|
-
interface F32 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
464
|
+
export interface F32 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
465
|
+
readonly type: 'f32';
|
|
466
|
+
readonly [$repr]: number;
|
|
467
|
+
readonly [$validStorageSchema]: true;
|
|
468
|
+
readonly [$validUniformSchema]: true;
|
|
469
|
+
readonly [$validVertexSchema]: true;
|
|
447
470
|
}
|
|
448
471
|
/**
|
|
449
472
|
* 16-bit float schema representing a single WGSL f16 value.
|
|
450
473
|
*/
|
|
451
|
-
interface F16 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
474
|
+
export interface F16 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
475
|
+
readonly type: 'f16';
|
|
476
|
+
readonly [$repr]: number;
|
|
477
|
+
readonly [$validStorageSchema]: true;
|
|
478
|
+
readonly [$validUniformSchema]: true;
|
|
479
|
+
readonly [$validVertexSchema]: true;
|
|
457
480
|
}
|
|
458
481
|
/**
|
|
459
482
|
* Signed 32-bit integer schema representing a single WGSL i32 value.
|
|
460
483
|
*/
|
|
461
|
-
interface I32 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
484
|
+
export interface I32 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
485
|
+
readonly type: 'i32';
|
|
486
|
+
readonly [$repr]: number;
|
|
487
|
+
readonly [$memIdent]: I32 | Atomic<I32> | DecoratedLocation<I32>;
|
|
488
|
+
readonly [$validStorageSchema]: true;
|
|
489
|
+
readonly [$validUniformSchema]: true;
|
|
490
|
+
readonly [$validVertexSchema]: true;
|
|
468
491
|
}
|
|
469
492
|
/**
|
|
470
493
|
* Unsigned 32-bit integer schema representing a single WGSL u32 value.
|
|
471
494
|
*/
|
|
472
|
-
interface U32 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
495
|
+
export interface U32 extends BaseData, DualFn<(v?: number | boolean) => number> {
|
|
496
|
+
readonly type: 'u32';
|
|
497
|
+
readonly [$repr]: number;
|
|
498
|
+
readonly [$memIdent]: U32 | Atomic<U32> | DecoratedLocation<U32>;
|
|
499
|
+
readonly [$validStorageSchema]: true;
|
|
500
|
+
readonly [$validUniformSchema]: true;
|
|
501
|
+
readonly [$validVertexSchema]: true;
|
|
479
502
|
}
|
|
480
503
|
/**
|
|
481
504
|
* Unsigned 16-bit integer schema used exclusively for index buffer schemas.
|
|
482
505
|
*/
|
|
483
|
-
interface U16 extends BaseData {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
506
|
+
export interface U16 extends BaseData {
|
|
507
|
+
readonly type: 'u16';
|
|
508
|
+
readonly [$repr]: number;
|
|
509
|
+
readonly [$invalidSchemaReason]: 'U16 is only usable inside arrays for index buffers, use U32 or I32 instead';
|
|
487
510
|
}
|
|
488
511
|
/**
|
|
489
512
|
* Type of the `d.vec2f` object/function: vector data type schema/constructor
|
|
490
513
|
*/
|
|
491
|
-
interface Vec2f extends BaseData, DualFn<((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f) & ((v: AnyNumericVec2Instance) => v2f)> {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
514
|
+
export interface Vec2f extends BaseData, DualFn<((x: number, y: number) => v2f) & ((xy: number) => v2f) & (() => v2f) & ((v: AnyNumericVec2Instance) => v2f)> {
|
|
515
|
+
readonly type: 'vec2f';
|
|
516
|
+
readonly primitive: F32;
|
|
517
|
+
readonly componentCount: 2;
|
|
518
|
+
readonly [$repr]: v2f;
|
|
519
|
+
readonly [$inRepr]: v2f | readonly [number, number] | Float32Array;
|
|
520
|
+
readonly [$validStorageSchema]: true;
|
|
521
|
+
readonly [$validUniformSchema]: true;
|
|
522
|
+
readonly [$validVertexSchema]: true;
|
|
500
523
|
}
|
|
501
524
|
/**
|
|
502
525
|
* Type of the `d.vec2h` object/function: vector data type schema/constructor
|
|
503
526
|
*/
|
|
504
|
-
interface Vec2h extends BaseData, DualFn<((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h) & ((v: AnyNumericVec2Instance) => v2h)> {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
527
|
+
export interface Vec2h extends BaseData, DualFn<((x: number, y: number) => v2h) & ((xy: number) => v2h) & (() => v2h) & ((v: AnyNumericVec2Instance) => v2h)> {
|
|
528
|
+
readonly type: 'vec2h';
|
|
529
|
+
readonly primitive: F16;
|
|
530
|
+
readonly componentCount: 2;
|
|
531
|
+
readonly [$repr]: v2h;
|
|
532
|
+
readonly [$inRepr]: v2h | readonly [number, number] | Float16Array;
|
|
533
|
+
readonly [$validStorageSchema]: true;
|
|
534
|
+
readonly [$validUniformSchema]: true;
|
|
535
|
+
readonly [$validVertexSchema]: true;
|
|
513
536
|
}
|
|
514
537
|
/**
|
|
515
538
|
* Type of the `d.vec2i` object/function: vector data type schema/constructor
|
|
516
539
|
*/
|
|
517
|
-
interface Vec2i extends BaseData, DualFn<((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i) & ((v: AnyNumericVec2Instance) => v2i)> {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
540
|
+
export interface Vec2i extends BaseData, DualFn<((x: number, y: number) => v2i) & ((xy: number) => v2i) & (() => v2i) & ((v: AnyNumericVec2Instance) => v2i)> {
|
|
541
|
+
readonly type: 'vec2i';
|
|
542
|
+
readonly primitive: I32;
|
|
543
|
+
readonly componentCount: 2;
|
|
544
|
+
readonly [$repr]: v2i;
|
|
545
|
+
readonly [$inRepr]: v2i | readonly [number, number] | Int32Array;
|
|
546
|
+
readonly [$validStorageSchema]: true;
|
|
547
|
+
readonly [$validUniformSchema]: true;
|
|
548
|
+
readonly [$validVertexSchema]: true;
|
|
526
549
|
}
|
|
527
550
|
/**
|
|
528
551
|
* Type of the `d.vec2u` object/function: vector data type schema/constructor
|
|
529
552
|
*/
|
|
530
|
-
interface Vec2u extends BaseData, DualFn<((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u) & ((v: AnyNumericVec2Instance) => v2u)> {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
553
|
+
export interface Vec2u extends BaseData, DualFn<((x: number, y: number) => v2u) & ((xy: number) => v2u) & (() => v2u) & ((v: AnyNumericVec2Instance) => v2u)> {
|
|
554
|
+
readonly type: 'vec2u';
|
|
555
|
+
readonly primitive: U32;
|
|
556
|
+
readonly componentCount: 2;
|
|
557
|
+
readonly [$repr]: v2u;
|
|
558
|
+
readonly [$inRepr]: v2u | readonly [number, number] | Uint32Array;
|
|
559
|
+
readonly [$validStorageSchema]: true;
|
|
560
|
+
readonly [$validUniformSchema]: true;
|
|
561
|
+
readonly [$validVertexSchema]: true;
|
|
539
562
|
}
|
|
540
563
|
/**
|
|
541
564
|
* Type of the `d.vec2b` object/function: vector data type schema/constructor
|
|
542
565
|
* Cannot be used inside buffers as it is not host-shareable.
|
|
543
566
|
*/
|
|
544
|
-
interface Vec2b extends BaseData, DualFn<((x: boolean, y: boolean) => v2b) & ((xy: boolean) => v2b) & (() => v2b) & ((v: v2b) => v2b)> {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
567
|
+
export interface Vec2b extends BaseData, DualFn<((x: boolean, y: boolean) => v2b) & ((xy: boolean) => v2b) & (() => v2b) & ((v: v2b) => v2b)> {
|
|
568
|
+
readonly type: 'vec2<bool>';
|
|
569
|
+
readonly primitive: Bool;
|
|
570
|
+
readonly componentCount: 2;
|
|
571
|
+
readonly [$repr]: v2b;
|
|
572
|
+
readonly [$invalidSchemaReason]: 'Boolean vectors is not host-shareable, use numeric vectors instead';
|
|
550
573
|
}
|
|
551
574
|
/**
|
|
552
575
|
* Type of the `d.vec3f` object/function: vector data type schema/constructor
|
|
553
576
|
*/
|
|
554
|
-
interface Vec3f extends BaseData, DualFn<((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f) & ((v: AnyNumericVec3Instance) => v3f) & ((v0: AnyNumericVec2Instance, z: number) => v3f) & ((x: number, v0: AnyNumericVec2Instance) => v3f)> {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
577
|
+
export interface Vec3f extends BaseData, DualFn<((x: number, y: number, z: number) => v3f) & ((xyz: number) => v3f) & (() => v3f) & ((v: AnyNumericVec3Instance) => v3f) & ((v0: AnyNumericVec2Instance, z: number) => v3f) & ((x: number, v0: AnyNumericVec2Instance) => v3f)> {
|
|
578
|
+
readonly type: 'vec3f';
|
|
579
|
+
readonly primitive: F32;
|
|
580
|
+
readonly componentCount: 3;
|
|
581
|
+
readonly [$repr]: v3f;
|
|
582
|
+
readonly [$inRepr]: v3f | readonly [number, number, number] | Float32Array;
|
|
583
|
+
readonly [$validStorageSchema]: true;
|
|
584
|
+
readonly [$validUniformSchema]: true;
|
|
585
|
+
readonly [$validVertexSchema]: true;
|
|
563
586
|
}
|
|
564
587
|
/**
|
|
565
588
|
* Type of the `d.vec3h` object/function: vector data type schema/constructor
|
|
566
589
|
*/
|
|
567
|
-
interface Vec3h extends BaseData, DualFn<((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h) & ((v: AnyNumericVec3Instance) => v3h) & ((v0: AnyNumericVec2Instance, z: number) => v3h) & ((x: number, v0: AnyNumericVec2Instance) => v3h)> {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
590
|
+
export interface Vec3h extends BaseData, DualFn<((x: number, y: number, z: number) => v3h) & ((xyz: number) => v3h) & (() => v3h) & ((v: AnyNumericVec3Instance) => v3h) & ((v0: AnyNumericVec2Instance, z: number) => v3h) & ((x: number, v0: AnyNumericVec2Instance) => v3h)> {
|
|
591
|
+
readonly type: 'vec3h';
|
|
592
|
+
readonly primitive: F16;
|
|
593
|
+
readonly componentCount: 3;
|
|
594
|
+
readonly [$repr]: v3h;
|
|
595
|
+
readonly [$inRepr]: v3h | readonly [number, number, number] | Float16Array;
|
|
596
|
+
readonly [$validStorageSchema]: true;
|
|
597
|
+
readonly [$validUniformSchema]: true;
|
|
598
|
+
readonly [$validVertexSchema]: true;
|
|
576
599
|
}
|
|
577
600
|
/**
|
|
578
601
|
* Type of the `d.vec3i` object/function: vector data type schema/constructor
|
|
579
602
|
*/
|
|
580
|
-
interface Vec3i extends BaseData, DualFn<((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i) & ((v: AnyNumericVec3Instance) => v3i) & ((v0: AnyNumericVec2Instance, z: number) => v3i) & ((x: number, v0: AnyNumericVec2Instance) => v3i)> {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
603
|
+
export interface Vec3i extends BaseData, DualFn<((x: number, y: number, z: number) => v3i) & ((xyz: number) => v3i) & (() => v3i) & ((v: AnyNumericVec3Instance) => v3i) & ((v0: AnyNumericVec2Instance, z: number) => v3i) & ((x: number, v0: AnyNumericVec2Instance) => v3i)> {
|
|
604
|
+
readonly type: 'vec3i';
|
|
605
|
+
readonly primitive: I32;
|
|
606
|
+
readonly componentCount: 3;
|
|
607
|
+
readonly [$repr]: v3i;
|
|
608
|
+
readonly [$inRepr]: v3i | readonly [number, number, number] | Int32Array;
|
|
609
|
+
readonly [$validStorageSchema]: true;
|
|
610
|
+
readonly [$validUniformSchema]: true;
|
|
611
|
+
readonly [$validVertexSchema]: true;
|
|
589
612
|
}
|
|
590
613
|
/**
|
|
591
614
|
* Type of the `d.vec3u` object/function: vector data type schema/constructor
|
|
592
615
|
*/
|
|
593
|
-
interface Vec3u extends BaseData, DualFn<((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u) & ((v: AnyNumericVec3Instance) => v3u) & ((v0: AnyNumericVec2Instance, z: number) => v3u) & ((x: number, v0: AnyNumericVec2Instance) => v3u)> {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
616
|
+
export interface Vec3u extends BaseData, DualFn<((x: number, y: number, z: number) => v3u) & ((xyz: number) => v3u) & (() => v3u) & ((v: AnyNumericVec3Instance) => v3u) & ((v0: AnyNumericVec2Instance, z: number) => v3u) & ((x: number, v0: AnyNumericVec2Instance) => v3u)> {
|
|
617
|
+
readonly type: 'vec3u';
|
|
618
|
+
readonly primitive: U32;
|
|
619
|
+
readonly componentCount: 3;
|
|
620
|
+
readonly [$repr]: v3u;
|
|
621
|
+
readonly [$inRepr]: v3u | readonly [number, number, number] | Uint32Array;
|
|
622
|
+
readonly [$validStorageSchema]: true;
|
|
623
|
+
readonly [$validUniformSchema]: true;
|
|
624
|
+
readonly [$validVertexSchema]: true;
|
|
602
625
|
}
|
|
603
626
|
/**
|
|
604
627
|
* Type of the `d.vec3b` object/function: vector data type schema/constructor
|
|
605
628
|
* Cannot be used inside buffers as it is not host-shareable.
|
|
606
629
|
*/
|
|
607
|
-
interface Vec3b extends BaseData, DualFn<((x: boolean, y: boolean, z: boolean) => v3b) & ((xyz: boolean) => v3b) & (() => v3b) & ((v: v3b) => v3b) & ((v0: v2b, z: boolean) => v3b) & ((x: boolean, v0: v2b) => v3b)> {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
630
|
+
export interface Vec3b extends BaseData, DualFn<((x: boolean, y: boolean, z: boolean) => v3b) & ((xyz: boolean) => v3b) & (() => v3b) & ((v: v3b) => v3b) & ((v0: v2b, z: boolean) => v3b) & ((x: boolean, v0: v2b) => v3b)> {
|
|
631
|
+
readonly type: 'vec3<bool>';
|
|
632
|
+
readonly primitive: Bool;
|
|
633
|
+
readonly componentCount: 3;
|
|
634
|
+
readonly [$repr]: v3b;
|
|
635
|
+
readonly [$invalidSchemaReason]: 'Boolean vectors is not host-shareable, use numeric vectors instead';
|
|
613
636
|
}
|
|
614
637
|
/**
|
|
615
638
|
* Type of the `d.vec4f` object/function: vector data type schema/constructor
|
|
616
639
|
*/
|
|
617
|
-
interface Vec4f extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f) & ((v: AnyNumericVec4Instance) => v4f) & ((v0: AnyNumericVec3Instance, w: number) => v4f) & ((x: number, v0: AnyNumericVec3Instance) => v4f) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4f) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4f) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4f) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4f)> {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
640
|
+
export interface Vec4f extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4f) & ((xyzw: number) => v4f) & (() => v4f) & ((v: AnyNumericVec4Instance) => v4f) & ((v0: AnyNumericVec3Instance, w: number) => v4f) & ((x: number, v0: AnyNumericVec3Instance) => v4f) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4f) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4f) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4f) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4f)> {
|
|
641
|
+
readonly type: 'vec4f';
|
|
642
|
+
readonly primitive: F32;
|
|
643
|
+
readonly componentCount: 4;
|
|
644
|
+
readonly [$repr]: v4f;
|
|
645
|
+
readonly [$inRepr]: v4f | readonly [number, number, number, number] | Float32Array;
|
|
646
|
+
readonly [$validStorageSchema]: true;
|
|
647
|
+
readonly [$validUniformSchema]: true;
|
|
648
|
+
readonly [$validVertexSchema]: true;
|
|
626
649
|
}
|
|
627
650
|
/**
|
|
628
651
|
* Type of the `d.vec4h` object/function: vector data type schema/constructor
|
|
629
652
|
*/
|
|
630
|
-
interface Vec4h extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h) & ((v: AnyNumericVec4Instance) => v4h) & ((v0: AnyNumericVec3Instance, w: number) => v4h) & ((x: number, v0: AnyNumericVec3Instance) => v4h) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4h) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4h) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4h) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4h)> {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
653
|
+
export interface Vec4h extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4h) & ((xyzw: number) => v4h) & (() => v4h) & ((v: AnyNumericVec4Instance) => v4h) & ((v0: AnyNumericVec3Instance, w: number) => v4h) & ((x: number, v0: AnyNumericVec3Instance) => v4h) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4h) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4h) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4h) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4h)> {
|
|
654
|
+
readonly type: 'vec4h';
|
|
655
|
+
readonly primitive: F16;
|
|
656
|
+
readonly componentCount: 4;
|
|
657
|
+
readonly [$repr]: v4h;
|
|
658
|
+
readonly [$inRepr]: v4h | readonly [number, number, number, number] | Float16Array;
|
|
659
|
+
readonly [$validStorageSchema]: true;
|
|
660
|
+
readonly [$validUniformSchema]: true;
|
|
661
|
+
readonly [$validVertexSchema]: true;
|
|
639
662
|
}
|
|
640
663
|
/**
|
|
641
664
|
* Type of the `d.vec4i` object/function: vector data type schema/constructor
|
|
642
665
|
*/
|
|
643
|
-
interface Vec4i extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i) & ((v: AnyNumericVec4Instance) => v4i) & ((v0: AnyNumericVec3Instance, w: number) => v4i) & ((x: number, v0: AnyNumericVec3Instance) => v4i) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4i) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4i) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4i) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4i)> {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
666
|
+
export interface Vec4i extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4i) & ((xyzw: number) => v4i) & (() => v4i) & ((v: AnyNumericVec4Instance) => v4i) & ((v0: AnyNumericVec3Instance, w: number) => v4i) & ((x: number, v0: AnyNumericVec3Instance) => v4i) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4i) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4i) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4i) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4i)> {
|
|
667
|
+
readonly type: 'vec4i';
|
|
668
|
+
readonly primitive: I32;
|
|
669
|
+
readonly componentCount: 4;
|
|
670
|
+
readonly [$repr]: v4i;
|
|
671
|
+
readonly [$inRepr]: v4i | readonly [number, number, number, number] | Int32Array;
|
|
672
|
+
readonly [$validStorageSchema]: true;
|
|
673
|
+
readonly [$validUniformSchema]: true;
|
|
674
|
+
readonly [$validVertexSchema]: true;
|
|
652
675
|
}
|
|
653
676
|
/**
|
|
654
677
|
* Type of the `d.vec4u` object/function: vector data type schema/constructor
|
|
655
678
|
*/
|
|
656
|
-
interface Vec4u extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u) & ((v: AnyNumericVec4Instance) => v4u) & ((v0: AnyNumericVec3Instance, w: number) => v4u) & ((x: number, v0: AnyNumericVec3Instance) => v4u) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4u) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4u) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4u) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4u)> {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
679
|
+
export interface Vec4u extends BaseData, DualFn<((x: number, y: number, z: number, w: number) => v4u) & ((xyzw: number) => v4u) & (() => v4u) & ((v: AnyNumericVec4Instance) => v4u) & ((v0: AnyNumericVec3Instance, w: number) => v4u) & ((x: number, v0: AnyNumericVec3Instance) => v4u) & ((v0: AnyNumericVec2Instance, v1: AnyNumericVec2Instance) => v4u) & ((v0: AnyNumericVec2Instance, z: number, w: number) => v4u) & ((x: number, v0: AnyNumericVec2Instance, z: number) => v4u) & ((x: number, y: number, v0: AnyNumericVec2Instance) => v4u)> {
|
|
680
|
+
readonly type: 'vec4u';
|
|
681
|
+
readonly primitive: U32;
|
|
682
|
+
readonly componentCount: 4;
|
|
683
|
+
readonly [$repr]: v4u;
|
|
684
|
+
readonly [$inRepr]: v4u | readonly [number, number, number, number] | Uint32Array;
|
|
685
|
+
readonly [$validStorageSchema]: true;
|
|
686
|
+
readonly [$validUniformSchema]: true;
|
|
687
|
+
readonly [$validVertexSchema]: true;
|
|
665
688
|
}
|
|
666
689
|
/**
|
|
667
690
|
* Type of the `d.vec4b` object/function: vector data type schema/constructor
|
|
668
691
|
* Cannot be used inside buffers as it is not host-shareable.
|
|
669
692
|
*/
|
|
670
|
-
interface Vec4b extends BaseData, DualFn<((x: boolean, y: boolean, z: boolean, w: boolean) => v4b) & ((xyzw: boolean) => v4b) & (() => v4b) & ((v: v4b) => v4b) & ((v0: v3b, w: boolean) => v4b) & ((x: boolean, v0: v3b) => v4b) & ((v0: v2b, v1: v2b) => v4b) & ((v0: v2b, z: boolean, w: boolean) => v4b) & ((x: boolean, v0: v2b, z: boolean) => v4b) & ((x: boolean, y: boolean, v0: v2b) => v4b)> {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
693
|
+
export interface Vec4b extends BaseData, DualFn<((x: boolean, y: boolean, z: boolean, w: boolean) => v4b) & ((xyzw: boolean) => v4b) & (() => v4b) & ((v: v4b) => v4b) & ((v0: v3b, w: boolean) => v4b) & ((x: boolean, v0: v3b) => v4b) & ((v0: v2b, v1: v2b) => v4b) & ((v0: v2b, z: boolean, w: boolean) => v4b) & ((x: boolean, v0: v2b, z: boolean) => v4b) & ((x: boolean, y: boolean, v0: v2b) => v4b)> {
|
|
694
|
+
readonly type: 'vec4<bool>';
|
|
695
|
+
readonly primitive: Bool;
|
|
696
|
+
readonly componentCount: 4;
|
|
697
|
+
readonly [$repr]: v4b;
|
|
698
|
+
readonly [$invalidSchemaReason]: 'Boolean vectors is not host-shareable, use numeric vectors instead';
|
|
676
699
|
}
|
|
677
700
|
/**
|
|
678
701
|
* Type of the `d.mat2x2f` object/function: matrix data type schema/constructor
|
|
679
702
|
*/
|
|
680
|
-
interface Mat2x2f extends BaseData {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
703
|
+
export interface Mat2x2f extends BaseData {
|
|
704
|
+
readonly type: 'mat2x2f';
|
|
705
|
+
readonly primitive: F32;
|
|
706
|
+
readonly [$repr]: m2x2f;
|
|
707
|
+
readonly [$inRepr]: m2x2f | readonly number[] | Float32Array;
|
|
708
|
+
readonly [$validStorageSchema]: true;
|
|
709
|
+
readonly [$validUniformSchema]: true;
|
|
710
|
+
(...elements: [number, number, number, number]): m2x2f;
|
|
711
|
+
(...columns: [v2f, v2f]): m2x2f;
|
|
712
|
+
(): m2x2f;
|
|
713
|
+
identity(): m2x2f;
|
|
691
714
|
}
|
|
692
715
|
/**
|
|
693
716
|
* Type of the `d.mat3x3f` object/function: matrix data type schema/constructor
|
|
694
717
|
*/
|
|
695
|
-
interface Mat3x3f extends BaseData {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
718
|
+
export interface Mat3x3f extends BaseData {
|
|
719
|
+
readonly type: 'mat3x3f';
|
|
720
|
+
readonly primitive: F32;
|
|
721
|
+
readonly [$repr]: m3x3f;
|
|
722
|
+
readonly [$inRepr]: m3x3f | readonly number[] | Float32Array;
|
|
723
|
+
readonly [$validStorageSchema]: true;
|
|
724
|
+
readonly [$validUniformSchema]: true;
|
|
725
|
+
(...elements: [number, number, number, number, number, number, number, number, number]): m3x3f;
|
|
726
|
+
(...columns: [v3f, v3f, v3f]): m3x3f;
|
|
727
|
+
(): m3x3f;
|
|
728
|
+
identity(): m3x3f;
|
|
706
729
|
}
|
|
707
730
|
/**
|
|
708
731
|
* Type of the `d.mat4x4f` object/function: matrix data type schema/constructor
|
|
709
732
|
*/
|
|
710
|
-
interface Mat4x4f extends BaseData {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
733
|
+
export interface Mat4x4f extends BaseData {
|
|
734
|
+
readonly type: 'mat4x4f';
|
|
735
|
+
readonly primitive: F32;
|
|
736
|
+
readonly [$repr]: m4x4f;
|
|
737
|
+
readonly [$inRepr]: m4x4f | readonly number[] | Float32Array;
|
|
738
|
+
readonly [$validStorageSchema]: true;
|
|
739
|
+
readonly [$validUniformSchema]: true;
|
|
740
|
+
(...elements: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]): m4x4f;
|
|
741
|
+
(...columns: [v4f, v4f, v4f, v4f]): m4x4f;
|
|
742
|
+
(): m4x4f;
|
|
743
|
+
identity(): m4x4f;
|
|
744
|
+
translation(vec: v3f): m4x4f;
|
|
745
|
+
scaling(vec: v3f): m4x4f;
|
|
746
|
+
rotationX(angle: number): m4x4f;
|
|
747
|
+
rotationY(angle: number): m4x4f;
|
|
748
|
+
rotationZ(angle: number): m4x4f;
|
|
726
749
|
}
|
|
727
750
|
/**
|
|
728
751
|
* Array schema constructed via `d.arrayOf` function.
|
|
@@ -731,25 +754,25 @@ interface Mat4x4f extends BaseData {
|
|
|
731
754
|
* between binary and JS representation. Takes into account
|
|
732
755
|
* the `byteAlignment` requirement of its elementType.
|
|
733
756
|
*/
|
|
734
|
-
interface WgslArray<out TElement extends BaseData = BaseData> extends BaseData {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
757
|
+
export interface WgslArray<out TElement extends BaseData = BaseData> extends BaseData {
|
|
758
|
+
<T extends TElement>(elements: Infer<T>[]): Infer<T>[];
|
|
759
|
+
(): Infer<TElement>[];
|
|
760
|
+
readonly type: 'array';
|
|
761
|
+
readonly elementCount: number;
|
|
762
|
+
readonly elementType: TElement;
|
|
763
|
+
readonly [$repr]: Infer<TElement>[];
|
|
764
|
+
readonly [$inRepr]: readonly InferInput<TElement>[] | TypedArrayFor<TElement>;
|
|
765
|
+
readonly [$gpuRepr]: InferGPU<TElement>[];
|
|
766
|
+
readonly [$reprPartial]: {
|
|
767
|
+
idx: number;
|
|
768
|
+
value: InferPartial<TElement>;
|
|
769
|
+
}[] | undefined;
|
|
770
|
+
readonly [$reprPatch]: Record<number, InferPatch<TElement>> | InferInput<TElement>[] | TypedArrayFor<TElement> | undefined;
|
|
771
|
+
readonly [$memIdent]: WgslArray<MemIdentity<TElement>>;
|
|
772
|
+
readonly [$validStorageSchema]: IsValidStorageSchema<TElement>;
|
|
773
|
+
readonly [$validUniformSchema]: IsValidUniformSchema<TElement>;
|
|
774
|
+
readonly [$validVertexSchema]: IsValidVertexSchema<TElement>;
|
|
775
|
+
readonly [$invalidSchemaReason]: `in array element — ${ExtractInvalidSchemaError<TElement>}`;
|
|
753
776
|
}
|
|
754
777
|
/**
|
|
755
778
|
* Struct schema constructed via `d.struct` function.
|
|
@@ -758,123 +781,150 @@ interface WgslArray<out TElement extends BaseData = BaseData> extends BaseData {
|
|
|
758
781
|
* between binary and JS representation. Takes into account
|
|
759
782
|
* the `byteAlignment` requirement of its members.
|
|
760
783
|
*/
|
|
761
|
-
interface WgslStruct<out TProps extends Record<string, BaseData> = Record<string, BaseData>> extends BaseData, TgpuNamable {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
784
|
+
export interface WgslStruct<out TProps extends Record<string, BaseData> = Record<string, BaseData>> extends BaseData, TgpuNamable {
|
|
785
|
+
readonly [$internal]: {
|
|
786
|
+
isAbstruct: boolean;
|
|
787
|
+
};
|
|
788
|
+
readonly type: 'struct';
|
|
789
|
+
readonly propTypes: TProps;
|
|
790
|
+
(props: Prettify<InferRecord<TProps>>): Prettify<InferRecord<TProps>>;
|
|
791
|
+
(): Prettify<InferRecord<TProps>>;
|
|
792
|
+
readonly [$repr]: Prettify<InferRecord<TProps>>;
|
|
793
|
+
readonly [$inRepr]: Prettify<InferInputRecord<TProps>>;
|
|
794
|
+
readonly [$gpuRepr]: Prettify<InferGPURecord<TProps>>;
|
|
795
|
+
readonly [$memIdent]: WgslStruct<Prettify<MemIdentityRecord<TProps>>>;
|
|
796
|
+
readonly [$reprPartial]: Prettify<Partial<InferPartialRecord<TProps>>> | undefined;
|
|
797
|
+
readonly [$reprPatch]: Prettify<Partial<InferPatchRecord<TProps>>> | undefined;
|
|
798
|
+
readonly [$invalidSchemaReason]: SwapNever<{
|
|
799
|
+
[K in keyof TProps]: ExtractInvalidSchemaError<TProps[K], `in struct property '${K & string}' — `>;
|
|
800
|
+
}[keyof TProps], undefined>;
|
|
801
|
+
readonly [$validStorageSchema]: {
|
|
802
|
+
[K in keyof TProps]: IsValidStorageSchema<TProps[K]>;
|
|
803
|
+
}[keyof TProps] extends true ? true : false;
|
|
804
|
+
readonly [$validUniformSchema]: {
|
|
805
|
+
[K in keyof TProps]: IsValidUniformSchema<TProps[K]>;
|
|
806
|
+
}[keyof TProps] extends true ? true : false;
|
|
807
|
+
readonly [$validVertexSchema]: {
|
|
808
|
+
[K in keyof TProps]: IsValidVertexSchema<TProps[K]>;
|
|
809
|
+
}[keyof TProps] extends true ? true : false;
|
|
779
810
|
}
|
|
780
811
|
/** @deprecated Just use `WgslStruct` without any type parameters */
|
|
781
|
-
type AnyWgslStruct = WgslStruct;
|
|
782
|
-
type AddressSpace = 'uniform' | 'storage' | 'workgroup' | 'private' | 'function' | 'handle';
|
|
783
|
-
type Access = 'read' | 'write' | 'read-write';
|
|
784
|
-
interface Ptr<TAddr extends AddressSpace = AddressSpace, TInner extends BaseData = BaseData, TAccess extends Access = Access> extends BaseData {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
812
|
+
export type AnyWgslStruct = WgslStruct;
|
|
813
|
+
export type AddressSpace = 'uniform' | 'storage' | 'workgroup' | 'private' | 'function' | 'handle';
|
|
814
|
+
export type Access = 'read' | 'write' | 'read-write';
|
|
815
|
+
export interface Ptr<TAddr extends AddressSpace = AddressSpace, TInner extends BaseData = BaseData, TAccess extends Access = Access> extends BaseData {
|
|
816
|
+
readonly type: 'ptr';
|
|
817
|
+
readonly inner: TInner;
|
|
818
|
+
readonly addressSpace: TAddr;
|
|
819
|
+
readonly access: TAccess;
|
|
820
|
+
readonly implicit: boolean;
|
|
821
|
+
readonly [$repr]: ref<Infer<TInner>>;
|
|
822
|
+
readonly [$invalidSchemaReason]: 'Pointers are not host-shareable';
|
|
792
823
|
}
|
|
793
824
|
/**
|
|
794
825
|
* Schema representing the `atomic<...>` WGSL data type.
|
|
795
826
|
*/
|
|
796
|
-
interface Atomic<TInner extends U32 | I32 = U32 | I32> extends BaseData {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}
|
|
806
|
-
interface atomicU32 {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
}
|
|
810
|
-
interface atomicI32 {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
814
|
-
interface Align<T extends number> {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}
|
|
819
|
-
interface Size<T extends number> {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
}
|
|
824
|
-
interface Location<T extends number = number> {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}
|
|
829
|
-
type PerspectiveOrLinearInterpolationType = `${'perspective' | 'linear'}${'' | ', center' | ', centroid' | ', sample'}`;
|
|
830
|
-
type FlatInterpolationType = `flat${'' | ', first' | ', either'}`;
|
|
831
|
-
type InterpolationType = PerspectiveOrLinearInterpolationType | FlatInterpolationType;
|
|
832
|
-
interface Interpolate<T extends InterpolationType = InterpolationType> {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
interface Builtin<T extends string> {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}
|
|
842
|
-
interface Invariant {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
}
|
|
847
|
-
interface Decorated<out TInner extends BaseData = BaseData, out TAttribs extends unknown[] = unknown[]> extends BaseData {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
}
|
|
862
|
-
declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "u16", "vec2f", "vec2h", "vec2i", "vec2u", "vec2<bool>", "vec3f", "vec3h", "vec3i", "vec3u", "vec3<bool>", "vec4f", "vec4h", "vec4i", "vec4u", "vec4<bool>", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "ptr", "atomic", "decorated", "abstractInt", "abstractFloat", "void", "texture_1d", "texture_storage_1d", "texture_2d", "texture_storage_2d", "texture_multisampled_2d", "texture_depth_2d", "texture_depth_multisampled_2d", "texture_2d_array", "texture_storage_2d_array", "texture_depth_2d_array", "texture_cube", "texture_depth_cube", "texture_cube_array", "texture_depth_cube_array", "texture_3d", "texture_storage_3d", "texture_external", "sampler", "sampler_comparison"];
|
|
863
|
-
type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
|
|
864
|
-
type IsWgslData<T> = T extends {
|
|
865
|
-
|
|
827
|
+
export interface Atomic<TInner extends U32 | I32 = U32 | I32> extends BaseData {
|
|
828
|
+
readonly type: 'atomic';
|
|
829
|
+
readonly inner: TInner;
|
|
830
|
+
readonly [$repr]: Infer<TInner>;
|
|
831
|
+
readonly [$gpuRepr]: TInner extends U32 ? atomicU32 : atomicI32;
|
|
832
|
+
readonly [$memIdent]: MemIdentity<TInner>;
|
|
833
|
+
readonly [$validStorageSchema]: true;
|
|
834
|
+
readonly [$validUniformSchema]: true;
|
|
835
|
+
readonly [$validVertexSchema]: true;
|
|
836
|
+
}
|
|
837
|
+
export interface atomicU32 {
|
|
838
|
+
readonly [$internal]: true;
|
|
839
|
+
readonly type: 'atomicU32';
|
|
840
|
+
}
|
|
841
|
+
export interface atomicI32 {
|
|
842
|
+
readonly [$internal]: true;
|
|
843
|
+
readonly type: 'atomicI32';
|
|
844
|
+
}
|
|
845
|
+
export interface Align<T extends number> {
|
|
846
|
+
readonly [$internal]: true;
|
|
847
|
+
readonly type: '@align';
|
|
848
|
+
readonly params: [T];
|
|
849
|
+
}
|
|
850
|
+
export interface Size<T extends number> {
|
|
851
|
+
readonly [$internal]: true;
|
|
852
|
+
readonly type: '@size';
|
|
853
|
+
readonly params: [T];
|
|
854
|
+
}
|
|
855
|
+
export interface Location<T extends number = number> {
|
|
856
|
+
readonly [$internal]: true;
|
|
857
|
+
readonly type: '@location';
|
|
858
|
+
readonly params: [T];
|
|
859
|
+
}
|
|
860
|
+
export type PerspectiveOrLinearInterpolationType = `${'perspective' | 'linear'}${'' | ', center' | ', centroid' | ', sample'}`;
|
|
861
|
+
export type FlatInterpolationType = `flat${'' | ', first' | ', either'}`;
|
|
862
|
+
export type InterpolationType = PerspectiveOrLinearInterpolationType | FlatInterpolationType;
|
|
863
|
+
export interface Interpolate<T extends InterpolationType = InterpolationType> {
|
|
864
|
+
readonly [$internal]: true;
|
|
865
|
+
readonly type: '@interpolate';
|
|
866
|
+
readonly params: [T];
|
|
867
|
+
}
|
|
868
|
+
export interface Builtin<T extends string> {
|
|
869
|
+
readonly [$internal]: true;
|
|
870
|
+
readonly type: '@builtin';
|
|
871
|
+
readonly params: [T];
|
|
872
|
+
}
|
|
873
|
+
export interface Invariant {
|
|
874
|
+
readonly [$internal]: true;
|
|
875
|
+
readonly type: '@invariant';
|
|
876
|
+
readonly params: [];
|
|
877
|
+
}
|
|
878
|
+
export interface Decorated<out TInner extends BaseData = BaseData, out TAttribs extends unknown[] = unknown[]> extends BaseData {
|
|
879
|
+
readonly type: 'decorated';
|
|
880
|
+
readonly inner: TInner;
|
|
881
|
+
readonly attribs: TAttribs;
|
|
882
|
+
readonly [$repr]: Infer<TInner>;
|
|
883
|
+
readonly [$inRepr]: InferInput<TInner>;
|
|
884
|
+
readonly [$gpuRepr]: InferGPU<TInner>;
|
|
885
|
+
readonly [$reprPartial]: InferPartial<TInner>;
|
|
886
|
+
readonly [$reprPatch]: InferPatch<TInner>;
|
|
887
|
+
readonly [$memIdent]: TAttribs extends Location[] ? MemIdentity<TInner> | Decorated<MemIdentity<TInner>, TAttribs> : Decorated<MemIdentity<TInner>, TAttribs>;
|
|
888
|
+
readonly [$validStorageSchema]: IsValidStorageSchema<TInner>;
|
|
889
|
+
readonly [$validUniformSchema]: IsValidUniformSchema<TInner>;
|
|
890
|
+
readonly [$validVertexSchema]: IsValidVertexSchema<TInner>;
|
|
891
|
+
readonly [$invalidSchemaReason]: ExtractInvalidSchemaError<TInner>;
|
|
892
|
+
}
|
|
893
|
+
export declare const wgslTypeLiterals: readonly ["bool", "f32", "f16", "i32", "u32", "u16", "vec2f", "vec2h", "vec2i", "vec2u", "vec2<bool>", "vec3f", "vec3h", "vec3i", "vec3u", "vec3<bool>", "vec4f", "vec4h", "vec4i", "vec4u", "vec4<bool>", "mat2x2f", "mat3x3f", "mat4x4f", "struct", "array", "ptr", "atomic", "decorated", "abstractInt", "abstractFloat", "void", "texture_1d", "texture_storage_1d", "texture_2d", "texture_storage_2d", "texture_multisampled_2d", "texture_depth_2d", "texture_depth_multisampled_2d", "texture_2d_array", "texture_storage_2d_array", "texture_depth_2d_array", "texture_cube", "texture_depth_cube", "texture_cube_array", "texture_depth_cube_array", "texture_3d", "texture_storage_3d", "texture_external", "sampler", "sampler_comparison"];
|
|
894
|
+
export type WgslTypeLiteral = (typeof wgslTypeLiterals)[number];
|
|
895
|
+
export type IsWgslData<T> = T extends {
|
|
896
|
+
readonly type: WgslTypeLiteral;
|
|
866
897
|
} ? true : false;
|
|
867
|
-
type PerspectiveOrLinearInterpolatableBaseType = F32 | F16 | Vec2f | Vec2h | Vec3f | Vec3h | Vec4f | Vec4h;
|
|
868
|
-
type PerspectiveOrLinearInterpolatableData = PerspectiveOrLinearInterpolatableBaseType | Decorated<PerspectiveOrLinearInterpolatableBaseType>;
|
|
869
|
-
type FlatInterpolatableAdditionalBaseType = I32 | U32 | Vec2i | Vec2u | Vec3i | Vec3u | Vec4i | Vec4u;
|
|
870
|
-
type FlatInterpolatableData = PerspectiveOrLinearInterpolatableData | FlatInterpolatableAdditionalBaseType | Decorated<FlatInterpolatableAdditionalBaseType>;
|
|
871
|
-
type TextureSampleTypes = F32 | I32 | U32;
|
|
872
|
-
type ScalarData = Bool | F32 | F16 | I32 | U32 | AbstractInt | AbstractFloat;
|
|
873
|
-
type VecData = Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b;
|
|
874
|
-
type MatData = Mat2x2f | Mat3x3f | Mat4x4f;
|
|
875
|
-
type StorableData = ScalarData | VecData | MatData | Atomic<I32> | Atomic<U32> | WgslArray | WgslStruct;
|
|
876
|
-
type
|
|
877
|
-
|
|
898
|
+
export type PerspectiveOrLinearInterpolatableBaseType = F32 | F16 | Vec2f | Vec2h | Vec3f | Vec3h | Vec4f | Vec4h;
|
|
899
|
+
export type PerspectiveOrLinearInterpolatableData = PerspectiveOrLinearInterpolatableBaseType | Decorated<PerspectiveOrLinearInterpolatableBaseType>;
|
|
900
|
+
export type FlatInterpolatableAdditionalBaseType = I32 | U32 | Vec2i | Vec2u | Vec3i | Vec3u | Vec4i | Vec4u;
|
|
901
|
+
export type FlatInterpolatableData = PerspectiveOrLinearInterpolatableData | FlatInterpolatableAdditionalBaseType | Decorated<FlatInterpolatableAdditionalBaseType>;
|
|
902
|
+
export type TextureSampleTypes = F32 | I32 | U32;
|
|
903
|
+
export type ScalarData = Bool | F32 | F16 | I32 | U32 | AbstractInt | AbstractFloat;
|
|
904
|
+
export type VecData = Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b;
|
|
905
|
+
export type MatData = Mat2x2f | Mat3x3f | Mat4x4f;
|
|
906
|
+
export type StorableData = ScalarData | VecData | MatData | Atomic<I32> | Atomic<U32> | WgslArray | WgslStruct;
|
|
907
|
+
export type AnyFloat32VecData = Vec2f | Vec3f | Vec4f;
|
|
908
|
+
export type AnyFloat16VecData = Vec2h | Vec3h | Vec4h;
|
|
909
|
+
export type AnyWgslData = Bool | F32 | F16 | I32 | U32 | U16 | Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b | Mat2x2f | Mat3x3f | Mat4x4f | WgslStruct | WgslArray | Ptr | Atomic<U32> | Atomic<I32> | Decorated | AbstractInt | AbstractFloat | Void | WgslTexture | WgslStorageTexture | WgslExternalTexture | WgslSampler | WgslComparisonSampler;
|
|
910
|
+
export declare function isVecInstance(value: unknown): value is AnyVecInstance;
|
|
911
|
+
export declare function isVecBoolInstance(value: unknown): value is v2b | v3b | v4b;
|
|
912
|
+
export declare function isVec2(value: unknown): value is Vec2f | Vec2h | Vec2i | Vec2u;
|
|
913
|
+
export declare function isVec3(value: unknown): value is Vec3f | Vec3h | Vec3i | Vec3u;
|
|
914
|
+
export declare function isVec4(value: unknown): value is Vec4f | Vec4h | Vec4i | Vec4u;
|
|
915
|
+
export declare function isVec(value: unknown): value is Vec2f | Vec2h | Vec2i | Vec2u | Vec2b | Vec3f | Vec3h | Vec3i | Vec3u | Vec3b | Vec4f | Vec4h | Vec4i | Vec4u | Vec4b;
|
|
916
|
+
export declare function isVecBool(value: unknown): value is Vec2b | Vec3b | Vec4b;
|
|
917
|
+
export declare function isMatInstance(value: unknown): value is AnyMatInstance;
|
|
918
|
+
export declare function isMat2x2f(value: unknown): value is Mat2x2f;
|
|
919
|
+
export declare function isMat3x3f(value: unknown): value is Mat3x3f;
|
|
920
|
+
export declare function isMat4x4f(value: unknown): value is Mat4x4f;
|
|
921
|
+
export declare function isMat(value: unknown): value is Mat2x2f | Mat3x3f | Mat4x4f;
|
|
922
|
+
export declare function isInteger(value: unknown): value is AbstractInt | I32 | U32;
|
|
923
|
+
export declare function isIntegerVec(value: unknown): value is Vec2i | Vec3i | Vec4i | Vec2u | Vec3u | Vec4u;
|
|
924
|
+
export declare function isFloat32VecInstance(element: unknown): element is AnyFloat32VecInstance;
|
|
925
|
+
export declare function isInteger32VecInstance(value: unknown): value is v2u | v2i | v3u | v3i | v4u | v4i;
|
|
926
|
+
export declare function isUint32VecInstance(value: unknown): value is v2u | v3u | v4u;
|
|
927
|
+
export declare function isWgslData(value: unknown): value is AnyWgslData;
|
|
878
928
|
/**
|
|
879
929
|
* Checks whether passed in value is an array schema,
|
|
880
930
|
* as opposed to, e.g., a disarray schema.
|
|
@@ -887,7 +937,7 @@ declare function isWgslData(value: unknown): value is AnyWgslData;
|
|
|
887
937
|
* isWgslArray(d.disarray(d.u32, 4)) // false
|
|
888
938
|
* isWgslArray(d.vec3f) // false
|
|
889
939
|
*/
|
|
890
|
-
declare function isWgslArray(schema: unknown): schema is WgslArray;
|
|
940
|
+
export declare function isWgslArray(schema: unknown): schema is WgslArray;
|
|
891
941
|
/**
|
|
892
942
|
* Checks whether passed in value is a struct schema,
|
|
893
943
|
* as opposed to, e.g., an unstruct schema.
|
|
@@ -900,7 +950,7 @@ declare function isWgslArray(schema: unknown): schema is WgslArray;
|
|
|
900
950
|
* isWgslStruct(d.unstruct({ a: d.u32 })) // false
|
|
901
951
|
* isWgslStruct(d.vec3f) // false
|
|
902
952
|
*/
|
|
903
|
-
declare function isWgslStruct(schema: unknown): schema is WgslStruct;
|
|
953
|
+
export declare function isWgslStruct(schema: unknown): schema is WgslStruct;
|
|
904
954
|
/**
|
|
905
955
|
* Checks whether passed in value is a pointer schema.
|
|
906
956
|
*
|
|
@@ -909,7 +959,7 @@ declare function isWgslStruct(schema: unknown): schema is WgslStruct;
|
|
|
909
959
|
* isPtr(d.ptrPrivate(d.f32)) // true
|
|
910
960
|
* isPtr(d.f32) // false
|
|
911
961
|
*/
|
|
912
|
-
declare function isPtr(schema: unknown): schema is Ptr;
|
|
962
|
+
export declare function isPtr(schema: unknown): schema is Ptr;
|
|
913
963
|
/**
|
|
914
964
|
* Checks whether the passed in value is an atomic schema.
|
|
915
965
|
*
|
|
@@ -917,12 +967,27 @@ declare function isPtr(schema: unknown): schema is Ptr;
|
|
|
917
967
|
* isAtomic(d.atomic(d.u32)) // true
|
|
918
968
|
* isAtomic(d.u32) // false
|
|
919
969
|
*/
|
|
920
|
-
declare function isAtomic(schema: unknown): schema is Atomic;
|
|
921
|
-
declare function isAlignAttrib<T extends number>(value: unknown): value is Align<T>;
|
|
922
|
-
declare function isSizeAttrib<T extends number>(value: unknown): value is Size<T>;
|
|
923
|
-
declare function isLocationAttrib<T extends number>(value: unknown): value is Location<T>;
|
|
924
|
-
declare function isInterpolateAttrib<T extends InterpolationType>(value: unknown): value is Interpolate<T>;
|
|
925
|
-
declare function isBuiltinAttrib(value: unknown): value is Builtin<string>;
|
|
926
|
-
declare function
|
|
927
|
-
|
|
928
|
-
export
|
|
970
|
+
export declare function isAtomic(schema: unknown): schema is Atomic;
|
|
971
|
+
export declare function isAlignAttrib<T extends number>(value: unknown): value is Align<T>;
|
|
972
|
+
export declare function isSizeAttrib<T extends number>(value: unknown): value is Size<T>;
|
|
973
|
+
export declare function isLocationAttrib<T extends number>(value: unknown): value is Location<T>;
|
|
974
|
+
export declare function isInterpolateAttrib<T extends InterpolationType>(value: unknown): value is Interpolate<T>;
|
|
975
|
+
export declare function isBuiltinAttrib(value: unknown): value is Builtin<string>;
|
|
976
|
+
export declare function isInvariantAttrib(value: unknown): value is Invariant;
|
|
977
|
+
export declare function isDecorated(value: unknown): value is Decorated;
|
|
978
|
+
export declare function isAbstractFloat(value: unknown): value is AbstractFloat;
|
|
979
|
+
export declare function isAbstractInt(value: unknown): value is AbstractInt;
|
|
980
|
+
export declare function isAbstract(value: unknown): value is AbstractFloat | AbstractInt;
|
|
981
|
+
export declare function isConcrete(value: unknown): boolean;
|
|
982
|
+
export declare function isVoid(value: unknown): value is Void;
|
|
983
|
+
export declare function isBool(value: unknown): value is Bool;
|
|
984
|
+
export declare function isNumericSchema(schema: unknown): schema is AbstractInt | AbstractFloat | F32 | F16 | I32 | U32;
|
|
985
|
+
export declare function isHalfPrecisionSchema(schema: unknown): schema is F16 | Vec2h | Vec3h | Vec4h;
|
|
986
|
+
/**
|
|
987
|
+
* Returns true for schemas that are not naturally referential in JS (primitives).
|
|
988
|
+
* @param schema
|
|
989
|
+
* @returns
|
|
990
|
+
*/
|
|
991
|
+
export declare function isNaturallyEphemeral(schema: unknown): boolean;
|
|
992
|
+
export declare function WORKAROUND_getSchema<T extends AnyVecInstance | AnyMatInstance>(vec: T): VecData | MatData;
|
|
993
|
+
export {};
|