typegpu 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunk-2VTISQYP.cjs +10 -0
- package/chunk-2VTISQYP.cjs.map +1 -0
- package/chunk-CYZBRBPD.cjs +6 -0
- package/chunk-CYZBRBPD.cjs.map +1 -0
- package/chunk-SAMYKEUN.js +6 -0
- package/chunk-SAMYKEUN.js.map +1 -0
- package/chunk-WP6W72RY.js +10 -0
- package/chunk-WP6W72RY.js.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +17 -5
- package/data/index.d.ts +17 -5
- package/data/index.js +1 -1
- package/index.cjs +18 -29
- package/index.cjs.map +1 -1
- package/index.d.cts +38 -3
- package/index.d.ts +38 -3
- package/index.js +18 -29
- package/index.js.map +1 -1
- package/{matrix-S8W4dk8I.d.ts → matrix-4h_aOtIE.d.cts} +9 -9
- package/{matrix-BN6ObiMv.d.cts → matrix-Domrg-ap.d.ts} +9 -9
- package/package.json +1 -1
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +274 -112
- package/std/index.d.ts +274 -112
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/{tgpuComputeFn-DOUjhQua.d.ts → tgpuConstant-BSgcF4zi.d.cts} +3058 -2938
- package/{tgpuComputeFn-DOUjhQua.d.cts → tgpuConstant-BSgcF4zi.d.ts} +3058 -2938
- package/chunk-APTRHY5Y.js +0 -41
- package/chunk-APTRHY5Y.js.map +0 -1
- package/chunk-RC26P3MP.cjs +0 -2
- package/chunk-RC26P3MP.cjs.map +0 -1
- package/chunk-RK6TMFVW.js +0 -2
- package/chunk-RK6TMFVW.js.map +0 -1
- package/chunk-S62QJDM6.js +0 -2
- package/chunk-S62QJDM6.js.map +0 -1
- package/chunk-TG4A6AM3.cjs +0 -2
- package/chunk-TG4A6AM3.cjs.map +0 -1
- package/chunk-UMHCZDPA.cjs +0 -41
- package/chunk-UMHCZDPA.cjs.map +0 -1
package/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { T as TgpuBindGroupLayout, a as TgpuBindGroup, W as Wgsl,
|
2
|
-
export {
|
1
|
+
import { T as TgpuBindGroupLayout, a as TgpuBindGroup, W as Wgsl, C as Configurable, b as TgpuBuffer, A as AnyData, c as TgpuVar, d as TgpuRoot, e as AnyWgslData, f as TgpuFn, g as TgpuBufferUsage, I as Infer, h as TgpuAccessor, i as TgpuDerived, j as TgpuSlot, k as TgpuVertexLayout, l as WgslArray, D as Disarray, m as fn, n as bindGroupLayout, v as vertexLayout, o as fragmentFn, p as vertexFn, q as computeFn, r as privateVar, w as workgroupVar, s as constant, t as declare, u as sampler, x as comparisonSampler } from './tgpuConstant-BSgcF4zi.js';
|
2
|
+
export { aq as BindLayoutEntry, ac as Eventual, ar as ExtractBindGroupInputFromLayout, aJ as INTERNAL_GlobalExt, a0 as IndexFlag, as as LayoutEntryToInput, ak as Render, al as Sampled, Y as Storage, Z as StorageFlag, aj as TextureProps, ad as TgpuAnyTextureView, a6 as TgpuBufferMutable, a7 as TgpuBufferReadonly, a8 as TgpuBufferUniform, aG as TgpuComputeFn, aH as TgpuComputeFnShell, $ as TgpuComputePipeline, am as TgpuConst, aI as TgpuDeclare, aB as TgpuFnShell, aE as TgpuFragmentFn, aF as TgpuFragmentFnShell, at as TgpuLayoutComparisonSampler, au as TgpuLayoutEntry, av as TgpuLayoutExternalTexture, aw as TgpuLayoutSampler, ax as TgpuLayoutStorage, ay as TgpuLayoutStorageTexture, az as TgpuLayoutTexture, aA as TgpuLayoutUniform, a9 as TgpuMutable, ae as TgpuMutableTexture, ap as TgpuQuerySet, aa as TgpuReadonly, af as TgpuReadonlyTexture, _ as TgpuRenderPipeline, ag as TgpuSampledTexture, ao as TgpuSampler, ah as TgpuTexture, ab as TgpuUniform, aC as TgpuVertexFn, aD as TgpuVertexFnShell, ai as TgpuWriteonlyTexture, a1 as Uniform, a2 as UniformFlag, a3 as ValidUsagesFor, V as ValidateBufferSchema, an as VariableScope, a4 as Vertex, a5 as VertexFlag, R as WithBinding, S as WithCompute, U as WithFragment, X as WithVertex, y as isBuffer, P as isBufferShorthand, F as isComparisonSampler, B as isDerived, H as isSampledTextureView, G as isSampler, E as isSlot, J as isStorageTextureView, K as isTexture, Q as isTgpuFn, L as isUsableAsRender, M as isUsableAsSampled, N as isUsableAsStorage, O as isUsableAsUniform, z as isUsableAsVertex } from './tgpuConstant-BSgcF4zi.js';
|
3
3
|
import 'tinyest';
|
4
4
|
|
5
5
|
/**
|
@@ -30,6 +30,10 @@ interface TgpuResolveOptions {
|
|
30
30
|
* @default 'random'
|
31
31
|
*/
|
32
32
|
names?: 'strict' | 'random' | undefined;
|
33
|
+
/**
|
34
|
+
* A function to configure the resolution context.
|
35
|
+
*/
|
36
|
+
config?: ((cfg: Configurable) => Configurable) | undefined;
|
33
37
|
}
|
34
38
|
/**
|
35
39
|
* Resolves a template with external values. Each external will get resolved to a code string and replaced in the template.
|
@@ -104,6 +108,36 @@ declare function resolveWithContext(options: TgpuResolveOptions): ResolutionResu
|
|
104
108
|
*/
|
105
109
|
declare function resolve(options: TgpuResolveOptions): string;
|
106
110
|
|
111
|
+
interface SimulationResult<T> {
|
112
|
+
value: T;
|
113
|
+
buffers: Map<TgpuBuffer<AnyData>, unknown>;
|
114
|
+
privateVars: Map<TgpuVar<'private', AnyData>, unknown>[][][];
|
115
|
+
workgroupVars: Map<TgpuVar<'workgroup', AnyData>, unknown>[][][];
|
116
|
+
}
|
117
|
+
/**
|
118
|
+
* Runs the provided callback in a simulated environment, giving
|
119
|
+
* it access to buffers and variables as if it were running on the GPU.
|
120
|
+
*
|
121
|
+
* The result of the simulation is returned, and does not affect the actual GPU state,
|
122
|
+
* nor does it carry over to other simulations.
|
123
|
+
*
|
124
|
+
* @param callback The callback to run in the simulated environment.
|
125
|
+
* @returns An object containing the result of the simulation, and
|
126
|
+
* the final state of the environment.
|
127
|
+
*
|
128
|
+
* @example
|
129
|
+
* const counter = tgpu.privateVar(d.u32);
|
130
|
+
*
|
131
|
+
* const result = tgpu.simulate(() => {
|
132
|
+
* counter.$ += 1;
|
133
|
+
* counter.$ += 2;
|
134
|
+
* return counter.$;
|
135
|
+
* });
|
136
|
+
*
|
137
|
+
* console.log(result.value); // 3
|
138
|
+
*/
|
139
|
+
declare function simulate<T>(callback: () => T): SimulationResult<T>;
|
140
|
+
|
107
141
|
/**
|
108
142
|
* Options passed into {@link init}.
|
109
143
|
*/
|
@@ -232,7 +266,8 @@ declare const tgpu: {
|
|
232
266
|
declare: typeof declare;
|
233
267
|
sampler: typeof sampler;
|
234
268
|
comparisonSampler: typeof comparisonSampler;
|
269
|
+
simulate: typeof simulate;
|
235
270
|
};
|
236
271
|
};
|
237
272
|
|
238
|
-
export { type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, TgpuAccessor, TgpuBindGroup, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, TgpuRoot, TgpuSlot, TgpuVertexLayout, tgpu as default, tgpu };
|
273
|
+
export { Configurable, type InitFromDeviceOptions, type InitOptions, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, ResolutionError, TgpuAccessor, TgpuBindGroup, TgpuBindGroupLayout, TgpuBuffer, TgpuDerived, TgpuFn, TgpuRoot, TgpuSlot, TgpuVar, TgpuVertexLayout, tgpu as default, tgpu };
|