typegpu 0.4.1 → 0.4.2
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/{attributes-BQuRnaZ4.d.ts → attributes-CkPkK-h9.d.ts} +13 -5
- package/{attributes-Bt2NG-9a.d.cts → attributes-Di0A7-Fw.d.cts} +13 -5
- package/chunk-C5JKINT2.js +4 -0
- package/chunk-C5JKINT2.js.map +1 -0
- package/chunk-DEMK5MOR.cjs +4 -0
- package/chunk-DEMK5MOR.cjs.map +1 -0
- package/chunk-IHC2SDHN.js +2 -0
- package/chunk-IHC2SDHN.js.map +1 -0
- package/chunk-R4S4YVH4.cjs +2 -0
- package/chunk-R4S4YVH4.cjs.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.d.cts +173 -5
- package/data/index.d.ts +173 -5
- package/data/index.js +1 -1
- package/index.cjs +8 -8
- package/index.cjs.map +1 -1
- package/index.d.cts +195 -107
- package/index.d.ts +195 -107
- package/index.js +8 -8
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +3 -2
- package/std/index.d.ts +3 -2
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/{wgslTypes-BNsjCP--.d.cts → wgslTypes-D8LnuOPy.d.cts} +3 -1
- package/{wgslTypes-BNsjCP--.d.ts → wgslTypes-D8LnuOPy.d.ts} +3 -1
- package/chunk-LF344PKG.cjs +0 -4
- package/chunk-LF344PKG.cjs.map +0 -1
- package/chunk-SDSDWWKW.js +0 -2
- package/chunk-SDSDWWKW.js.map +0 -1
- package/chunk-Y2M5GYRO.cjs +0 -2
- package/chunk-Y2M5GYRO.cjs.map +0 -1
- package/chunk-YLI4IK35.js +0 -4
- package/chunk-YLI4IK35.js.map +0 -1
- package/vector-CeDeofzh.d.ts +0 -176
- package/vector-UFYwud47.d.cts +0 -176
package/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { A as AnyWgslData, T as TgpuNamable, I as Infer, D as Decorated, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, n as AnyWgslStruct,
|
2
|
-
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins,
|
1
|
+
import { A as AnyWgslData, T as TgpuNamable, I as Infer, D as Decorated, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, K as KindToAcceptedAttribMap, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, v as KindToDefaultFormatMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as InferPartial, y as MemIdentity, z as WgslTypeLiteral, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-D8LnuOPy.js';
|
2
|
+
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, b as AnyFragmentOutputBuiltin, c as AnyFragmentInputBuiltin } from './attributes-CkPkK-h9.js';
|
3
3
|
import * as smol from 'tinyest';
|
4
4
|
import { Block } from 'tinyest';
|
5
5
|
|
@@ -80,17 +80,13 @@ interface TgpuComputeFn<ComputeIn extends Record<string, AnyComputeBuiltin> = Re
|
|
80
80
|
readonly shell: TgpuComputeFnShell<ComputeIn>;
|
81
81
|
$uses(dependencyMap: Record<string, unknown>): this;
|
82
82
|
}
|
83
|
-
|
83
|
+
declare function computeFn(options: {
|
84
84
|
workgroupSize: number[];
|
85
|
-
}
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
* @param workgroupSize
|
91
|
-
* Size of blocks that the thread grid will be divided into (up to 3 dimensions).
|
92
|
-
*/
|
93
|
-
declare function computeFn<ComputeIn extends Record<string, AnyComputeBuiltin>>(argTypes: ComputeIn, options: ComputeFnOptions): TgpuComputeFnShell<ComputeIn>;
|
85
|
+
}): TgpuComputeFnShell<{}>;
|
86
|
+
declare function computeFn<ComputeIn extends Record<string, AnyComputeBuiltin>>(options: {
|
87
|
+
in: ComputeIn;
|
88
|
+
workgroupSize: number[];
|
89
|
+
}): TgpuComputeFnShell<ComputeIn>;
|
94
90
|
|
95
91
|
interface Storage {
|
96
92
|
usableAsStorage: true;
|
@@ -175,6 +171,78 @@ interface TgpuComputePipeline extends TgpuNamable {
|
|
175
171
|
dispatchWorkgroups(x: number, y?: number | undefined, z?: number | undefined): void;
|
176
172
|
}
|
177
173
|
|
174
|
+
type WithLocations<T extends IORecord> = {
|
175
|
+
[Key in keyof T]: IsBuiltin<T[Key]> extends true ? T[Key] : HasCustomLocation<T[Key]> extends true ? T[Key] : Decorate<T[Key], Location<number>>;
|
176
|
+
};
|
177
|
+
type IOLayoutToSchema<T extends IOLayout> = T extends BaseData ? Decorate<T, Location<0>> : T extends IORecord ? WgslStruct<WithLocations<T>> : never;
|
178
|
+
|
179
|
+
type FragmentOutConstrained = Vec4f | Decorated<Vec4f, [Location<number>]> | AnyFragmentOutputBuiltin | IORecord<Vec4f | Decorated<Vec4f, [Location<number>]> | AnyFragmentOutputBuiltin>;
|
180
|
+
type FragmentInConstrained = IORecord<BaseIOData | Decorated<BaseIOData, AnyAttribute<never>[]> | AnyFragmentInputBuiltin>;
|
181
|
+
/**
|
182
|
+
* Describes a fragment entry function signature (its arguments and return type)
|
183
|
+
*/
|
184
|
+
interface TgpuFragmentFnShell<FragmentIn extends FragmentInConstrained, FragmentOut extends FragmentOutConstrained> {
|
185
|
+
readonly argTypes: [AnyWgslStruct];
|
186
|
+
readonly targets: FragmentOut;
|
187
|
+
readonly returnType: FragmentOut;
|
188
|
+
/**
|
189
|
+
* Creates a type-safe implementation of this signature
|
190
|
+
*/
|
191
|
+
does(implementation: (input: InferIO<FragmentIn>) => InferIO<FragmentOut>): TgpuFragmentFn<OmitBuiltins<FragmentIn>, OmitBuiltins<FragmentOut>>;
|
192
|
+
/**
|
193
|
+
* @param implementation
|
194
|
+
* Raw WGSL function implementation with header and body
|
195
|
+
* without `fn` keyword and function name
|
196
|
+
* e.g. `"(x: f32) -> f32 { return x; }"`;
|
197
|
+
*/
|
198
|
+
does(implementation: string): TgpuFragmentFn<OmitBuiltins<FragmentIn>, OmitBuiltins<FragmentOut>>;
|
199
|
+
}
|
200
|
+
interface TgpuFragmentFn<Varying extends FragmentInConstrained = FragmentInConstrained, Output extends FragmentOutConstrained = FragmentOutConstrained> extends TgpuNamable {
|
201
|
+
readonly shell: TgpuFragmentFnShell<Varying, Output>;
|
202
|
+
readonly outputType: IOLayoutToSchema<Output>;
|
203
|
+
$uses(dependencyMap: Record<string, unknown>): this;
|
204
|
+
}
|
205
|
+
declare function fragmentFn<FragmentOut extends FragmentOutConstrained>(options: {
|
206
|
+
out: FragmentOut;
|
207
|
+
}): TgpuFragmentFnShell<{}, FragmentOut>;
|
208
|
+
declare function fragmentFn<FragmentIn extends FragmentInConstrained, FragmentOut extends FragmentOutConstrained>(options: {
|
209
|
+
in: FragmentIn;
|
210
|
+
out: FragmentOut;
|
211
|
+
}): TgpuFragmentFnShell<FragmentIn, FragmentOut>;
|
212
|
+
|
213
|
+
/**
|
214
|
+
* Describes a vertex entry function signature (its arguments and return type)
|
215
|
+
*/
|
216
|
+
interface TgpuVertexFnShell<VertexIn extends IOLayout, VertexOut extends IOLayout> {
|
217
|
+
readonly argTypes: [AnyWgslStruct];
|
218
|
+
readonly returnType: VertexOut;
|
219
|
+
readonly attributes: [VertexIn];
|
220
|
+
/**
|
221
|
+
* Creates a type-safe implementation of this signature
|
222
|
+
*/
|
223
|
+
does(implementation: (input: InferIO<VertexIn>) => InferIO<VertexOut>): TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>;
|
224
|
+
/**
|
225
|
+
* @param implementation
|
226
|
+
* Raw WGSL function implementation with header and body
|
227
|
+
* without `fn` keyword and function name
|
228
|
+
* e.g. `"(x: f32) -> f32 { return x; }"`;
|
229
|
+
*/
|
230
|
+
does(implementation: string): TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>;
|
231
|
+
}
|
232
|
+
interface TgpuVertexFn<VertexIn extends IOLayout = IOLayout, VertexOut extends IOLayout = IOLayout> extends TgpuNamable {
|
233
|
+
readonly shell: TgpuVertexFnShell<VertexIn, VertexOut>;
|
234
|
+
readonly outputType: IOLayoutToSchema<VertexOut>;
|
235
|
+
readonly inputType: IOLayoutToSchema<VertexIn>;
|
236
|
+
$uses(dependencyMap: Record<string, unknown>): this;
|
237
|
+
}
|
238
|
+
declare function vertexFn<VertexOut extends IORecord>(options: {
|
239
|
+
out: VertexOut;
|
240
|
+
}): TgpuVertexFnShell<{}, VertexOut>;
|
241
|
+
declare function vertexFn<VertexIn extends IORecord, VertexOut extends IORecord>(options: {
|
242
|
+
in: VertexIn;
|
243
|
+
out: VertexOut;
|
244
|
+
}): TgpuVertexFnShell<VertexIn, VertexOut>;
|
245
|
+
|
178
246
|
type TextureProps = {
|
179
247
|
size: readonly number[];
|
180
248
|
format: GPUTextureFormat;
|
@@ -473,99 +541,6 @@ interface TgpuVertexLayout<TData extends WgslArray | Disarray = WgslArray | Disa
|
|
473
541
|
}
|
474
542
|
declare function vertexLayout<TData extends WgslArray | Disarray>(schemaForCount: (count: number) => TData, stepMode?: 'vertex' | 'instance'): TgpuVertexLayout<TData>;
|
475
543
|
|
476
|
-
interface Unwrapper {
|
477
|
-
readonly device: GPUDevice;
|
478
|
-
unwrap(resource: TgpuComputePipeline): GPUComputePipeline;
|
479
|
-
unwrap(resource: TgpuBindGroupLayout): GPUBindGroupLayout;
|
480
|
-
unwrap(resource: TgpuBindGroup): GPUBindGroup;
|
481
|
-
unwrap(resource: TgpuBuffer<AnyData>): GPUBuffer;
|
482
|
-
unwrap(resource: TgpuTexture): GPUTexture;
|
483
|
-
unwrap(resource: TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture): GPUTextureView;
|
484
|
-
unwrap(resource: TgpuVertexLayout): GPUVertexBufferLayout;
|
485
|
-
}
|
486
|
-
|
487
|
-
type WithLocations<T extends IORecord> = {
|
488
|
-
[Key in keyof T]: IsBuiltin<T[Key]> extends true ? T[Key] : HasCustomLocation<T[Key]> extends true ? T[Key] : Decorate<T[Key], Location<number>>;
|
489
|
-
};
|
490
|
-
type IOLayoutToSchema<T extends IOLayout> = T extends BaseData ? Decorate<T, Location<0>> : T extends IORecord ? WgslStruct<WithLocations<T>> : never;
|
491
|
-
|
492
|
-
type FragmentOutConstrained = Vec4f | Decorated<Vec4f, [Location<number>]> | BuiltinSampleMask | BuiltinFragDepth | IORecord<Vec4f | Decorated<Vec4f, [Location<number>]> | BuiltinSampleMask | BuiltinFragDepth>;
|
493
|
-
/**
|
494
|
-
* Describes a fragment entry function signature (its arguments and return type)
|
495
|
-
*/
|
496
|
-
interface TgpuFragmentFnShell<FragmentIn extends IOLayout, FragmentOut extends FragmentOutConstrained> {
|
497
|
-
readonly argTypes: [AnyWgslStruct];
|
498
|
-
readonly targets: FragmentOut;
|
499
|
-
readonly returnType: FragmentOut;
|
500
|
-
/**
|
501
|
-
* Creates a type-safe implementation of this signature
|
502
|
-
*/
|
503
|
-
does(implementation: (input: InferIO<FragmentIn>) => InferIO<FragmentOut>): TgpuFragmentFn<OmitBuiltins<FragmentIn>, OmitBuiltins<FragmentOut>>;
|
504
|
-
/**
|
505
|
-
* @param implementation
|
506
|
-
* Raw WGSL function implementation with header and body
|
507
|
-
* without `fn` keyword and function name
|
508
|
-
* e.g. `"(x: f32) -> f32 { return x; }"`;
|
509
|
-
*/
|
510
|
-
does(implementation: string): TgpuFragmentFn<OmitBuiltins<FragmentIn>, OmitBuiltins<FragmentOut>>;
|
511
|
-
}
|
512
|
-
interface TgpuFragmentFn<Varying extends IOLayout = IOLayout, Output extends FragmentOutConstrained = FragmentOutConstrained> extends TgpuNamable {
|
513
|
-
readonly shell: TgpuFragmentFnShell<Varying, Output>;
|
514
|
-
readonly outputType: IOLayoutToSchema<Output>;
|
515
|
-
$uses(dependencyMap: Record<string, unknown>): this;
|
516
|
-
}
|
517
|
-
/**
|
518
|
-
* Creates a shell of a typed entry function for the fragment shader stage. Any function
|
519
|
-
* that implements this shell can run for each fragment (pixel), allowing the inner code
|
520
|
-
* to process information received from the vertex shader stage and builtins to determine
|
521
|
-
* the final color of the pixel (many pixels in case of multiple targets).
|
522
|
-
*
|
523
|
-
* @param inputType
|
524
|
-
* Values computed in the vertex stage and builtins to be made available to functions that implement this shell.
|
525
|
-
* @param outputType
|
526
|
-
* A `vec4f`, signaling this function outputs a color for one target, or a struct/array containing
|
527
|
-
* colors for multiple targets.
|
528
|
-
*/
|
529
|
-
declare function fragmentFn<FragmentIn extends IORecord, FragmentOut extends FragmentOutConstrained>(inputType: FragmentIn, outputType: FragmentOut): TgpuFragmentFnShell<FragmentIn, FragmentOut>;
|
530
|
-
|
531
|
-
/**
|
532
|
-
* Describes a vertex entry function signature (its arguments and return type)
|
533
|
-
*/
|
534
|
-
interface TgpuVertexFnShell<VertexIn extends IOLayout, VertexOut extends IOLayout> {
|
535
|
-
readonly argTypes: [AnyWgslStruct];
|
536
|
-
readonly returnType: VertexOut;
|
537
|
-
readonly attributes: [VertexIn];
|
538
|
-
/**
|
539
|
-
* Creates a type-safe implementation of this signature
|
540
|
-
*/
|
541
|
-
does(implementation: (input: InferIO<VertexIn>) => InferIO<VertexOut>): TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>;
|
542
|
-
/**
|
543
|
-
* @param implementation
|
544
|
-
* Raw WGSL function implementation with header and body
|
545
|
-
* without `fn` keyword and function name
|
546
|
-
* e.g. `"(x: f32) -> f32 { return x; }"`;
|
547
|
-
*/
|
548
|
-
does(implementation: string): TgpuVertexFn<OmitBuiltins<VertexIn>, OmitBuiltins<VertexOut>>;
|
549
|
-
}
|
550
|
-
interface TgpuVertexFn<VertexIn extends IOLayout = IOLayout, VertexOut extends IOLayout = IOLayout> extends TgpuNamable {
|
551
|
-
readonly shell: TgpuVertexFnShell<VertexIn, VertexOut>;
|
552
|
-
readonly outputType: IOLayoutToSchema<VertexOut>;
|
553
|
-
readonly inputType: IOLayoutToSchema<VertexIn>;
|
554
|
-
$uses(dependencyMap: Record<string, unknown>): this;
|
555
|
-
}
|
556
|
-
/**
|
557
|
-
* Creates a shell of a typed entry function for the vertex shader stage. Any function
|
558
|
-
* that implements this shell can run for each vertex, allowing the inner code to process
|
559
|
-
* attributes and determine the final position of the vertex.
|
560
|
-
*
|
561
|
-
* @param inputType
|
562
|
-
* Vertex attributes and builtins to be made available to functions that implement this shell.
|
563
|
-
* @param outputType
|
564
|
-
* A struct type containing the final position of the vertex, and any information
|
565
|
-
* passed onto the fragment shader stage.
|
566
|
-
*/
|
567
|
-
declare function vertexFn<VertexIn extends IORecord, VertexOut extends IORecord>(inputType: VertexIn, outputType: VertexOut): TgpuVertexFnShell<VertexIn, VertexOut>;
|
568
|
-
|
569
544
|
interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable {
|
570
545
|
readonly resourceType: 'render-pipeline';
|
571
546
|
readonly label: string | undefined;
|
@@ -673,10 +648,22 @@ interface DepthStencilAttachment {
|
|
673
648
|
stencilReadOnly?: boolean;
|
674
649
|
}
|
675
650
|
|
651
|
+
interface Unwrapper {
|
652
|
+
readonly device: GPUDevice;
|
653
|
+
unwrap(resource: TgpuComputePipeline): GPUComputePipeline;
|
654
|
+
unwrap(resource: TgpuRenderPipeline): GPURenderPipeline;
|
655
|
+
unwrap(resource: TgpuBindGroupLayout): GPUBindGroupLayout;
|
656
|
+
unwrap(resource: TgpuBindGroup): GPUBindGroup;
|
657
|
+
unwrap(resource: TgpuBuffer<AnyData>): GPUBuffer;
|
658
|
+
unwrap(resource: TgpuTexture): GPUTexture;
|
659
|
+
unwrap(resource: TgpuReadonlyTexture | TgpuWriteonlyTexture | TgpuMutableTexture | TgpuSampledTexture): GPUTextureView;
|
660
|
+
unwrap(resource: TgpuVertexLayout): GPUVertexBufferLayout;
|
661
|
+
}
|
662
|
+
|
676
663
|
interface WithCompute {
|
677
664
|
createPipeline(): TgpuComputePipeline;
|
678
665
|
}
|
679
|
-
type ValidateFragmentIn<VertexOut extends IORecord, FragmentIn extends
|
666
|
+
type ValidateFragmentIn<VertexOut extends IORecord, FragmentIn extends FragmentInConstrained, FragmentOut extends FragmentOutConstrained> = FragmentIn extends Partial<VertexOut> ? VertexOut extends FragmentIn ? [
|
680
667
|
entryFn: TgpuFragmentFn<FragmentIn, FragmentOut>,
|
681
668
|
targets: FragmentOutToTargets<FragmentOut>
|
682
669
|
] : [
|
@@ -693,7 +680,7 @@ type ValidateFragmentIn<VertexOut extends IORecord, FragmentIn extends IORecord,
|
|
693
680
|
}
|
694
681
|
];
|
695
682
|
interface WithVertex<VertexOut extends IORecord = IORecord> {
|
696
|
-
withFragment<FragmentIn extends
|
683
|
+
withFragment<FragmentIn extends FragmentInConstrained, FragmentOut extends FragmentOutConstrained>(...args: ValidateFragmentIn<VertexOut, FragmentIn, FragmentOut>): WithFragment<FragmentOut>;
|
697
684
|
}
|
698
685
|
interface WithFragment<Output extends FragmentOutConstrained = FragmentOutConstrained> {
|
699
686
|
withPrimitive(primitiveState: GPUPrimitiveState | undefined): WithFragment<Output>;
|
@@ -746,6 +733,103 @@ type CreateTextureResult<TSize extends readonly number[], TFormat extends GPUTex
|
|
746
733
|
sampleCount: number extends TSampleCount ? undefined : TSampleCount extends 1 ? undefined : TSampleCount;
|
747
734
|
viewFormats: GPUTextureFormat extends TViewFormat ? undefined : TViewFormat[] extends never[] ? undefined : TViewFormat[];
|
748
735
|
}, undefined>>;
|
736
|
+
interface RenderPass {
|
737
|
+
/**
|
738
|
+
* Sets the viewport used during the rasterization stage to linearly map from
|
739
|
+
* NDC (i.e., normalized device coordinates) to viewport coordinates.
|
740
|
+
* @param x - Minimum X value of the viewport in pixels.
|
741
|
+
* @param y - Minimum Y value of the viewport in pixels.
|
742
|
+
* @param width - Width of the viewport in pixels.
|
743
|
+
* @param height - Height of the viewport in pixels.
|
744
|
+
* @param minDepth - Minimum depth value of the viewport.
|
745
|
+
* @param maxDepth - Maximum depth value of the viewport.
|
746
|
+
*/
|
747
|
+
setViewport(x: number, y: number, width: number, height: number, minDepth: number, maxDepth: number): void;
|
748
|
+
/**
|
749
|
+
* Sets the scissor rectangle used during the rasterization stage.
|
750
|
+
* After transformation into viewport coordinates any fragments which fall outside the scissor
|
751
|
+
* rectangle will be discarded.
|
752
|
+
* @param x - Minimum X value of the scissor rectangle in pixels.
|
753
|
+
* @param y - Minimum Y value of the scissor rectangle in pixels.
|
754
|
+
* @param width - Width of the scissor rectangle in pixels.
|
755
|
+
* @param height - Height of the scissor rectangle in pixels.
|
756
|
+
*/
|
757
|
+
setScissorRect(x: number, y: number, width: number, height: number): void;
|
758
|
+
/**
|
759
|
+
* Sets the constant blend color and alpha values used with {@link GPUBlendFactor#constant}
|
760
|
+
* and {@link GPUBlendFactor#"one-minus-constant"} {@link GPUBlendFactor}s.
|
761
|
+
* @param color - The color to use when blending.
|
762
|
+
*/
|
763
|
+
setBlendConstant(color: GPUColor): void;
|
764
|
+
/**
|
765
|
+
* Sets the {@link RenderState#[[stencilReference]]} value used during stencil tests with
|
766
|
+
* the {@link GPUStencilOperation#"replace"} {@link GPUStencilOperation}.
|
767
|
+
* @param reference - The new stencil reference value.
|
768
|
+
*/
|
769
|
+
setStencilReference(reference: GPUStencilValue): undefined;
|
770
|
+
/**
|
771
|
+
* @param queryIndex - The index of the query in the query set.
|
772
|
+
*/
|
773
|
+
beginOcclusionQuery(queryIndex: GPUSize32): undefined;
|
774
|
+
endOcclusionQuery(): undefined;
|
775
|
+
/**
|
776
|
+
* Executes the commands previously recorded into the given {@link GPURenderBundle}s as part of
|
777
|
+
* this render pass.
|
778
|
+
* When a {@link GPURenderBundle} is executed, it does not inherit the render pass's pipeline, bind
|
779
|
+
* groups, or vertex and index buffers. After a {@link GPURenderBundle} has executed, the render
|
780
|
+
* pass's pipeline, bind group, and vertex/index buffer state is cleared
|
781
|
+
* (to the initial, empty values).
|
782
|
+
* Note: The state is cleared, not restored to the previous state.
|
783
|
+
* This occurs even if zero {@link GPURenderBundle|GPURenderBundles} are executed.
|
784
|
+
* @param bundles - List of render bundles to execute.
|
785
|
+
*/
|
786
|
+
executeBundles(bundles: Iterable<GPURenderBundle>): undefined;
|
787
|
+
setPipeline(pipeline: TgpuRenderPipeline): void;
|
788
|
+
/**
|
789
|
+
* Sets the current index buffer.
|
790
|
+
* @param buffer - Buffer containing index data to use for subsequent drawing commands.
|
791
|
+
* @param indexFormat - Format of the index data contained in `buffer`.
|
792
|
+
* @param offset - Offset in bytes into `buffer` where the index data begins. Defaults to `0`.
|
793
|
+
* @param size - Size in bytes of the index data in `buffer`.
|
794
|
+
* Defaults to the size of the buffer minus the offset.
|
795
|
+
*/
|
796
|
+
setIndexBuffer<TData extends WgslArray | Disarray>(buffer: TgpuBuffer<TData> | GPUBuffer, indexFormat: GPUIndexFormat, offset?: GPUSize64, size?: GPUSize64): void;
|
797
|
+
setVertexBuffer<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: (TgpuBuffer<TData> & Vertex) | GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
|
798
|
+
setBindGroup<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries> | GPUBindGroup): void;
|
799
|
+
/**
|
800
|
+
* Draws primitives.
|
801
|
+
* @param vertexCount - The number of vertices to draw.
|
802
|
+
* @param instanceCount - The number of instances to draw.
|
803
|
+
* @param firstVertex - Offset into the vertex buffers, in vertices, to begin drawing from.
|
804
|
+
* @param firstInstance - First instance to draw.
|
805
|
+
*/
|
806
|
+
draw(vertexCount: number, instanceCount?: number | undefined, firstVertex?: number | undefined, firstInstance?: number | undefined): void;
|
807
|
+
/**
|
808
|
+
* Draws indexed primitives.
|
809
|
+
* @param indexCount - The number of indices to draw.
|
810
|
+
* @param instanceCount - The number of instances to draw.
|
811
|
+
* @param firstIndex - Offset into the index buffer, in indices, begin drawing from.
|
812
|
+
* @param baseVertex - Added to each index value before indexing into the vertex buffers.
|
813
|
+
* @param firstInstance - First instance to draw.
|
814
|
+
*/
|
815
|
+
drawIndexed(indexCount: number, instanceCount?: number | undefined, firstIndex?: number | undefined, baseVertex?: number | undefined, firstInstance?: number | undefined): void;
|
816
|
+
/**
|
817
|
+
* Draws primitives using parameters read from a {@link GPUBuffer}.
|
818
|
+
* Packed block of **four 32-bit unsigned integer values (16 bytes total)**, given in the same
|
819
|
+
* order as the arguments for {@link GPURenderEncoderBase#draw}. For example:
|
820
|
+
* @param indirectBuffer - Buffer containing the indirect draw parameters.
|
821
|
+
* @param indirectOffset - Offset in bytes into `indirectBuffer` where the drawing data begins.
|
822
|
+
*/
|
823
|
+
drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): undefined;
|
824
|
+
/**
|
825
|
+
* Draws indexed primitives using parameters read from a {@link GPUBuffer}.
|
826
|
+
* Tightly packed block of **five 32-bit unsigned integer values (20 bytes total)**, given in
|
827
|
+
* the same order as the arguments for {@link GPURenderEncoderBase#drawIndexed}. For example:
|
828
|
+
* @param indirectBuffer - Buffer containing the indirect drawIndexed parameters.
|
829
|
+
* @param indirectOffset - Offset in bytes into `indirectBuffer` where the drawing data begins.
|
830
|
+
*/
|
831
|
+
drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: GPUSize64): undefined;
|
832
|
+
}
|
749
833
|
interface TgpuRoot extends Unwrapper {
|
750
834
|
/**
|
751
835
|
* The GPU device associated with this root.
|
@@ -818,6 +902,7 @@ interface ExperimentalTgpuRoot extends TgpuRoot, WithBinding {
|
|
818
902
|
createMutable<TData extends AnyWgslData>(typeSchema: TData, initialOrBuffer?: Infer<TData> | GPUBuffer): TgpuBufferMutable<TData> & TgpuFixedBufferUsage<TData>;
|
819
903
|
createReadonly<TData extends AnyWgslData>(typeSchema: TData, initialOrBuffer?: Infer<TData> | GPUBuffer): TgpuBufferReadonly<TData> & TgpuFixedBufferUsage<TData>;
|
820
904
|
createTexture<TWidth extends number, THeight extends number, TDepth extends number, TSize extends readonly [TWidth] | readonly [TWidth, THeight] | readonly [TWidth, THeight, TDepth], TFormat extends GPUTextureFormat, TMipLevelCount extends number, TSampleCount extends number, TViewFormat extends GPUTextureFormat, TDimension extends GPUTextureDimension>(props: CreateTextureOptions<TSize, TFormat, TMipLevelCount, TSampleCount, TViewFormat, TDimension>): TgpuTexture<CreateTextureResult<TSize, TFormat, TMipLevelCount, TSampleCount, TViewFormat, TDimension>>;
|
905
|
+
beginRenderPass(descriptor: GPURenderPassDescriptor, callback: (pass: RenderPass) => void): void;
|
821
906
|
/**
|
822
907
|
* Causes all commands enqueued by pipelines to be
|
823
908
|
* submitted to the GPU.
|
@@ -1399,6 +1484,9 @@ declare const tgpu: {
|
|
1399
1484
|
fragmentFn: typeof fragmentFn;
|
1400
1485
|
vertexFn: typeof vertexFn;
|
1401
1486
|
computeFn: typeof computeFn;
|
1487
|
+
/**
|
1488
|
+
* @deprecated This feature is now stable, use tgpu.vertexLayout.
|
1489
|
+
*/
|
1402
1490
|
vertexLayout: typeof vertexLayout;
|
1403
1491
|
derived: typeof derived;
|
1404
1492
|
slot: typeof slot;
|