From bf8340fbd55f4bca4fd784a85815c491da155c4b Mon Sep 17 00:00:00 2001 From: Iwo Plaza Date: Wed, 5 Aug 2026 22:49:33 +0200 Subject: [PATCH] docs: Use `{ tgpu }` import in documentation and examples --- README.md | 2 +- apps/bun-example/index.ts | 2 +- .../components/Shader.tsx | 2 +- apps/resolution-time/procedural.ts | 2 +- .../src/components/CodeShowcase.astro | 2 +- .../components/ComputeShadersArrayExample.tsx | 2 +- .../ComputeShadersBindGroupsExample.tsx | 2 +- .../ComputeShadersBindGroupsRuntime.ts | 2 +- .../components/ComputeShadersGridExample.tsx | 2 +- .../src/components/FirstGpuProgramExample.tsx | 6 +-- .../src/components/hero-effect/fluid-sim.ts | 2 +- .../src/components/hero-effect/hero-effect.ts | 2 +- .../components/hero-effect/screen-textures.ts | 3 +- .../components/runnable/RunnableSnippet.tsx | 2 +- .../components/translator/lib/constants.ts | 2 +- .../components/translator/lib/tgslExecutor.ts | 2 +- .../src/content/docs/apis/accessors.mdx | 34 +++++++------- .../src/content/docs/apis/bind-groups.mdx | 2 +- .../src/content/docs/apis/buffers.mdx | 46 +++++++++---------- .../src/content/docs/apis/data-schemas.mdx | 10 ++-- .../src/content/docs/apis/functions/index.mdx | 26 +++++------ .../src/content/docs/apis/pipelines.mdx | 16 +++---- .../src/content/docs/apis/resolve.mdx | 12 ++--- .../src/content/docs/apis/roots.mdx | 8 ++-- .../src/content/docs/apis/textures.mdx | 32 ++++++------- .../src/content/docs/apis/variables.mdx | 6 +-- .../src/content/docs/apis/vertex-layouts.mdx | 2 +- .../content/docs/blog/typegpu-0.11/index.mdx | 2 +- .../content/docs/ecosystem/typegpu-noise.mdx | 16 +++---- .../ecosystem/typegpu-radiance-cascades.mdx | 4 +- .../content/docs/ecosystem/typegpu-sdf.mdx | 8 ++-- .../docs/ecosystem/typegpu-three/index.mdx | 6 +-- .../docs/fundamentals/compute-shaders.mdx | 16 +++---- .../fundamentals/vertices-and-fragments.mdx | 10 ++-- .../fundamentals/your-first-gpu-program.mdx | 22 ++++----- .../docs/integration/react-native/index.mdx | 2 +- .../integration/webgpu-interoperability.mdx | 2 +- .../integration/wesl-interoperability.mdx | 2 +- .../src/content/docs/tooling/tgpu-gen.mdx | 2 +- .../content/docs/tooling/unplugin-typegpu.mdx | 2 +- .../docs/tutorials/game-of-life/index.mdx | 2 +- .../triangle-to-boids/code/step1-typegpu.ts | 2 +- .../tutorials/triangle-to-boids/index.mdx | 2 +- .../examples/algorithms/bitonic-sort/index.ts | 2 +- .../algorithms/concurrent-chart/index.ts | 2 +- .../examples/algorithms/genetic-racing/ga.ts | 2 +- .../algorithms/genetic-racing/index.ts | 2 +- .../algorithms/jump-flood-distance/index.ts | 2 +- .../algorithms/jump-flood-distance/types.ts | 2 +- .../jump-flood-distance/visualization.ts | 2 +- .../algorithms/jump-flood-voronoi/index.ts | 2 +- .../algorithms/matrix-multiplication/index.ts | 2 +- .../algorithms/matrix-next/computeShared.ts | 2 +- .../algorithms/matrix-next/computeSimple.ts | 2 +- .../examples/algorithms/matrix-next/index.ts | 2 +- .../examples/algorithms/matrix-next/types.ts | 2 +- .../algorithms/mnist-inference/index.ts | 2 +- .../algorithms/probability/executor.ts | 2 +- .../algorithms/probability/helpers.ts | 2 +- .../examples/algorithms/probability/index.ts | 2 +- .../src/examples/geometry/circles/index.ts | 2 +- .../geometry/lines-combinations/index.ts | 2 +- .../geometry/lines-combinations/testCases.ts | 2 +- .../image-processing/ascii-filter/index.ts | 2 +- .../background-segmentation/index.ts | 2 +- .../background-segmentation/schemas.ts | 2 +- .../background-segmentation/shaders.ts | 2 +- .../examples/image-processing/blur/index.ts | 2 +- .../camera-thresholding/index.ts | 2 +- .../image-processing/chroma-keying/index.ts | 2 +- .../image-processing/image-tuning/index.ts | 2 +- .../selfie-segmentation/index.ts | 2 +- .../inference/kernels/compute.ts | 2 +- .../inference/kernels/helpers.ts | 2 +- .../inference/kernels/layouts.ts | 2 +- .../inference/video-preprocess.ts | 2 +- .../post-processing/kernels.ts | 2 +- .../src/examples/react/confetti/index.tsx | 2 +- .../react/spinning-triangle/index.tsx | 2 +- .../src/examples/rendering/3d-fish/compute.ts | 2 +- .../src/examples/rendering/3d-fish/index.ts | 2 +- .../src/examples/rendering/3d-fish/render.ts | 2 +- .../src/examples/rendering/3d-fish/schemas.ts | 2 +- .../rendering/box-raytracing/index.ts | 2 +- .../src/examples/rendering/caustics/index.ts | 2 +- .../src/examples/rendering/caustics/scene.ts | 2 +- .../src/examples/rendering/clouds/index.ts | 2 +- .../src/examples/rendering/clouds/types.ts | 2 +- .../src/examples/rendering/clouds/utils.ts | 2 +- .../rendering/cubemap-reflection/icosphere.ts | 2 +- .../rendering/cubemap-reflection/index.ts | 2 +- .../rendering/cubemap-reflection/scene.ts | 2 +- .../src/examples/rendering/disco/consts.ts | 2 +- .../src/examples/rendering/disco/index.ts | 3 +- .../rendering/disco/shaders/fragment.ts | 2 +- .../rendering/disco/shaders/vertex.ts | 2 +- .../rendering/function-visualizer/index.ts | 2 +- .../rendering/jelly-slider/dataTypes.ts | 2 +- .../examples/rendering/jelly-slider/taa.ts | 2 +- .../rendering/jelly-switch/dataTypes.ts | 2 +- .../examples/rendering/jelly-switch/index.ts | 2 +- .../examples/rendering/jelly-switch/taa.ts | 2 +- .../examples/rendering/os-awards/cubemap.ts | 2 +- .../src/examples/rendering/os-awards/index.ts | 2 +- .../examples/rendering/perlin-noise/index.ts | 2 +- .../rendering/phong-reflection/index.ts | 2 +- .../rendering/phong-reflection/schemas.ts | 2 +- .../rendering/point-light-shadow/index.ts | 2 +- .../rendering/point-light-shadow/types.ts | 2 +- .../src/examples/rendering/pom/index.ts | 2 +- .../src/examples/rendering/pom/types.ts | 2 +- .../radiance-cascades-drawing/index.ts | 2 +- .../rendering/radiance-cascades/index.ts | 2 +- .../rendering/radiance-cascades/scene.ts | 2 +- .../examples/rendering/ray-marching/index.ts | 2 +- .../examples/rendering/ray-marching/scene.ts | 2 +- .../rendering/render-bundles-with/index.ts | 2 +- .../rendering/render-bundles-with/schemas.ts | 2 +- .../rendering/render-bundles-with/shaders.ts | 2 +- .../rendering/render-bundles/index.ts | 2 +- .../rendering/render-bundles/schemas.ts | 2 +- .../rendering/render-bundles/shaders.ts | 2 +- .../examples/rendering/simple-shadow/index.ts | 2 +- .../rendering/simple-shadow/schema.ts | 2 +- .../rendering/smoky-triangle/index.ts | 2 +- .../src/examples/rendering/suika-sdf/index.ts | 2 +- .../examples/rendering/suika-sdf/sdfGen.ts | 2 +- .../src/examples/rendering/two-boxes/index.ts | 2 +- .../rendering/xor-dev-centrifuge-2/index.ts | 2 +- .../rendering/xor-dev-runner/index.ts | 2 +- .../examples/simple/gradient-tiles/index.ts | 2 +- .../src/examples/simple/increment/index.ts | 2 +- .../src/examples/simple/liquid-glass/index.ts | 2 +- .../examples/simple/mesh-skinning/index.ts | 2 +- .../src/examples/simple/oklab/index.ts | 2 +- .../examples/simple/ripple-cube/background.ts | 2 +- .../src/examples/simple/ripple-cube/index.ts | 2 +- .../src/examples/simple/ripple-cube/pbr.ts | 2 +- .../simple/ripple-cube/post-processing.ts | 2 +- .../examples/simple/ripple-cube/sdf-scene.ts | 2 +- .../src/examples/simple/square/index.ts | 2 +- .../src/examples/simple/stencil/index.ts | 2 +- .../src/examples/simple/triangle/index.ts | 2 +- .../src/examples/simple/vaporrave/floor.ts | 2 +- .../src/examples/simple/vaporrave/helpers.ts | 2 +- .../src/examples/simple/vaporrave/index.ts | 2 +- .../src/examples/simple/vaporrave/scene.ts | 2 +- .../src/examples/simple/vaporrave/sphere.ts | 2 +- .../src/examples/simulation/boids/index.ts | 2 +- .../src/examples/simulation/confetti/index.ts | 2 +- .../fluid-double-buffering/index.ts | 2 +- .../simulation/fluid-with-atomics/index.ts | 2 +- .../examples/simulation/game-of-life/index.ts | 2 +- .../game-of-life/shaders/bitpacked-compute.ts | 4 +- .../simulation/game-of-life/shaders/common.ts | 4 +- .../game-of-life/shaders/fragment.ts | 4 +- .../game-of-life/shaders/naive-compute.ts | 4 +- .../game-of-life/shaders/tiled-compute.ts | 4 +- .../simulation/game-of-life/shaders/vertex.ts | 4 +- .../examples/simulation/gravity/compute.ts | 2 +- .../src/examples/simulation/gravity/index.ts | 2 +- .../src/examples/simulation/gravity/render.ts | 2 +- .../examples/simulation/gravity/schemas.ts | 2 +- .../simulation/slime-mold-3d/index.ts | 2 +- .../examples/simulation/slime-mold/index.ts | 2 +- .../examples/simulation/stable-fluid/index.ts | 3 +- .../simulation/stable-fluid/render.ts | 2 +- .../simulation/stable-fluid/simulation.ts | 2 +- .../src/examples/simulation/wind-map/index.ts | 2 +- .../tests/buffer-write-benchmark/index.ts | 2 +- .../src/examples/tests/dispatch/index.ts | 2 +- .../src/examples/tests/log-test/index.ts | 2 +- .../examples/tests/prefix-scan/functions.ts | 2 +- .../src/examples/tests/prefix-scan/index.ts | 2 +- .../examples/tests/rc-docs-examples/index.ts | 2 +- .../examples/tests/sdf-docs-examples/index.ts | 2 +- .../src/examples/tests/texture-test/index.ts | 2 +- .../array-and-struct-constructors.ts | 2 +- .../examples/tests/tgsl-parsing-test/index.ts | 2 +- .../tgsl-parsing-test/infix-operators.ts | 2 +- .../tgsl-parsing-test/logical-expressions.ts | 2 +- .../tests/tgsl-parsing-test/matrix-ops.ts | 2 +- .../tests/tgsl-parsing-test/pointers.ts | 2 +- .../src/examples/tests/uniformity/index.ts | 2 +- .../src/examples/tests/uniformity/lcg.ts | 2 +- .../examples/tests/wgsl-resolution/index.ts | 2 +- .../threejs/compute-cloth/triNoise.ts | 2 +- .../test-reused-functions/functions.ts | 2 +- 188 files changed, 313 insertions(+), 322 deletions(-) diff --git a/README.md b/README.md index b82589990e..e93eb7e605 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ compute shaders, and `@abc/plot` is a library for plots and visualization using WebGPU. ```ts -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import gen from '@xyz/gen'; import plot from '@abc/plot'; diff --git a/apps/bun-example/index.ts b/apps/bun-example/index.ts index 9b46b38ce7..ac2b1cb46d 100644 --- a/apps/bun-example/index.ts +++ b/apps/bun-example/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { randf } from '@typegpu/noise'; const Boid = d.struct({ diff --git a/apps/react-prerendering-test/components/Shader.tsx b/apps/react-prerendering-test/components/Shader.tsx index 4e55d3cc48..f9a8da391f 100644 --- a/apps/react-prerendering-test/components/Shader.tsx +++ b/apps/react-prerendering-test/components/Shader.tsx @@ -2,7 +2,7 @@ import { useConfigureContext, useFrame, useRoot, useUniform } from '@typegpu/react'; import { useMemo } from 'react'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { perlin2d } from '@typegpu/noise'; import { hexToOklab, oklabToRgb } from '@typegpu/color'; diff --git a/apps/resolution-time/procedural.ts b/apps/resolution-time/procedural.ts index 2c8916a740..99c31f024e 100644 --- a/apps/resolution-time/procedural.ts +++ b/apps/resolution-time/procedural.ts @@ -1,6 +1,6 @@ import { writeFileSync } from 'node:fs'; import { resolve } from 'node:path'; -import tgpu, { d, std, type TgpuComptime } from 'typegpu'; +import { tgpu, d, std, type TgpuComptime } from 'typegpu'; interface ProcGenConfig { mainBranching: number; diff --git a/apps/typegpu-docs/src/components/CodeShowcase.astro b/apps/typegpu-docs/src/components/CodeShowcase.astro index 5af0f24fc8..0f7c6bce18 100644 --- a/apps/typegpu-docs/src/components/CodeShowcase.astro +++ b/apps/typegpu-docs/src/components/CodeShowcase.astro @@ -95,7 +95,7 @@ export async function generateHeightMap( language="typescript" /> @location(0) vec4 { return vec4(1.0, 0.0, 0.0, 1.0); }`; -export const DEFAULT_TGSL = `import tgpu, { d } from 'typegpu'; +export const DEFAULT_TGSL = `import { tgpu, d } from 'typegpu'; const Particle = d.struct({ position: d.vec3f, diff --git a/apps/typegpu-docs/src/components/translator/lib/tgslExecutor.ts b/apps/typegpu-docs/src/components/translator/lib/tgslExecutor.ts index 39d03b126a..715f4c9e56 100644 --- a/apps/typegpu-docs/src/components/translator/lib/tgslExecutor.ts +++ b/apps/typegpu-docs/src/components/translator/lib/tgslExecutor.ts @@ -23,7 +23,7 @@ async function executeTgslModule( '/shader.ts': { content: tgslCode }, '/index.ts': { content: ` - import tgpu from 'typegpu'; + import { tgpu } from 'typegpu'; import * as exports from './shader.ts'; const shaderCode = tgpu.resolve({ externals: exports }); diff --git a/apps/typegpu-docs/src/content/docs/apis/accessors.mdx b/apps/typegpu-docs/src/content/docs/apis/accessors.mdx index 8f4c14a4b1..d6fe6a3393 100644 --- a/apps/typegpu-docs/src/content/docs/apis/accessors.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/accessors.mdx @@ -6,7 +6,7 @@ description: Accessors are schema-aware typed placeholders for GPU resources, al When writing reusable GPU functions in TypeGPU, you often need to reference "some global value" without coupling to a specific buffer, texture or variable. [Slots](/TypeGPU/apis/slots) seem like the right tool for the job, but they encode the delivery mechanism into the slot type (e.g. a buffer or texture), making it inflexible for reusable functions. ```ts twoslash -import tgpu, { type TgpuUniform, d } from 'typegpu'; +import { tgpu, d, type TgpuUniform } from 'typegpu'; // ---cut--- // 👎 only works with JS literals const staticColorSlot = tgpu.slot(); @@ -28,7 +28,7 @@ const colorAccess = tgpu.accessor(d.vec3f); Create an accessor with `tgpu.accessor(schema)`. Optionally pass a default value as the second argument: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- // No default — must be bound before resolving. const colorAccess = tgpu.accessor(d.vec3f); @@ -40,7 +40,7 @@ const colorWithDefault = tgpu.accessor(d.vec3f, d.vec3f(1, 0, 0)); Inside a GPU function, read the accessor's value using `.$`: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const colorAccess = tgpu.accessor(d.vec3f, d.vec3f(1, 0, 0)); // ---cut--- @@ -58,7 +58,7 @@ Accessing it outside GPU context throws a runtime error. If no default is set and no binding is provided at resolution time, TypeGPU throws a descriptive error: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const colorAccess = tgpu.accessor(d.vec3f); @@ -79,7 +79,7 @@ tgpu.resolve([getColor]); Use `.with(accessor, value)` on a function or pipeline — the same pattern as [slots](/apis/slots): ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const RED = d.vec3f(1, 0, 0); const GREEN = d.vec3f(0, 1, 0); @@ -112,7 +112,7 @@ fn getColor_1() -> vec3f { You can also override on a pipeline: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -136,7 +136,7 @@ Accessors accept several types of GPU resources as values. The simplest binding — the value is resolved at compile time and inlined directly into the WGSL: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const colorAccess = tgpu.accessor(d.vec3f); const multiplierAccess = tgpu.accessor(d.f32); @@ -168,7 +168,7 @@ Notice how, because the values are known at compile time, the result is precompu Resolves to a function call in the generated WGSL: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const colorAccess = tgpu.accessor(d.vec3f, () => { 'use gpu'; @@ -196,7 +196,7 @@ fn getColor() -> vec3f { Resolves to the WGSL variable declaration for that buffer binding: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const RED = d.vec3f(1, 0, 0); @@ -225,7 +225,7 @@ fn getColor() -> vec3f { A common pattern for library-style code: use a bind group layout entry as the default, making it easy to swap the resource via `.with()`: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const ImageData = (count: number) => d.struct({ @@ -247,7 +247,7 @@ const imageAccess = tgpu.accessor(ImageData, () => layout.$.image); Bind a private or workgroup variable: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const colorAccess = tgpu.accessor(d.vec3f); @@ -280,7 +280,7 @@ fn getColor_1() -> vec3f { ### Constant ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const colorAccess = tgpu.accessor(d.vec3f); @@ -304,7 +304,7 @@ fn getColor() -> vec3f { ### Texture view ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -335,7 +335,7 @@ fn main() { Because accessors know the schema of their resource, you can access struct fields directly through `.$`: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const ImageData = (count: number) => d.struct({ @@ -379,7 +379,7 @@ fn getPixel(x: i32, y: i32) -> vec4f { You can also access deeply nested references — e.g., a specific element of a buffer's array field: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -415,7 +415,7 @@ fn main() { Use `tgpu.mutableAccessor` when you need to *write* to the resource: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -447,7 +447,7 @@ The split between `tgpu.accessor` and `tgpu.mutableAccessor` is useful, as the r You can also mutate fields of a non-primitive struct: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/apis/bind-groups.mdx b/apps/typegpu-docs/src/content/docs/apis/bind-groups.mdx index b8dea5f21d..cc8c8755aa 100644 --- a/apps/typegpu-docs/src/content/docs/apis/bind-groups.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/bind-groups.mdx @@ -12,7 +12,7 @@ A bind group is a collection of resources that are bound to a shader. These reso It's a way to define what resources are available to a shader and how they are accessed. ```ts -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // Defining the layout of resources we want the shader to // have access to. diff --git a/apps/typegpu-docs/src/content/docs/apis/buffers.mdx b/apps/typegpu-docs/src/content/docs/apis/buffers.mdx index 36a68e75ef..cca30f307a 100644 --- a/apps/typegpu-docs/src/content/docs/apis/buffers.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/buffers.mdx @@ -19,7 +19,7 @@ results of parallel computation back to JS. When creating a buffer, a schema for As an example, let's create a buffer for storing particles. ```ts twoslash {22-28} -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // Defining a struct type const Particle = d.struct({ @@ -66,7 +66,7 @@ To create a buffer, you will need to define its schema by composing data types i structs and arrays. They will be explored in more detail in [a following chapter](/TypeGPU/apis/data-schemas). ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const countBuffer = root.createBuffer(d.u32); @@ -85,7 +85,7 @@ To be able to use these buffers in WGSL shaders, we have to declare their usage ```ts twoslash // @noErrors -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const buffer = root.createBuffer(d.u32) @@ -98,7 +98,7 @@ You can also add all flags in a single `$usage()`. ```ts twoslash // @noErrors -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const buffer = root.createBuffer(d.u32) @@ -109,7 +109,7 @@ const buffer = root.createBuffer(d.u32) :::note Along with passing the appropriate flags to WebGPU, the methods will also embed type information into the buffer. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -126,7 +126,7 @@ or indirectly through the `.$usage` method. ```ts twoslash /// -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const buffer = root.createBuffer(d.f32); // ---cut--- @@ -147,7 +147,7 @@ You can also pass an initial value to the `root.createBuffer` function. When the buffer is created, it will be mapped at creation, and the initial value will be written to the buffer. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- // Will be initialized to `100` @@ -164,7 +164,7 @@ For cases where a plain typed value is not enough, you can also pass an initiali It receives the newly created typed buffer while it is still mapped, so you can populate it with multiple writes or helper utilities before the first upload. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -186,7 +186,7 @@ You can also create a buffer using an existing WebGPU buffer. This is useful whe ```ts twoslash {7} /// -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const device = root.device; // ---cut--- @@ -212,7 +212,7 @@ method's arguments. ```ts twoslash // @noErrors -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const Particle = d.struct({ @@ -255,7 +255,7 @@ The same API is used internally for buffer writes. When data already lives in tuples or typed arrays, skipping typed instance construction avoids allocating TypeGPU wrapper objects, which can reduce garbage-collector pressure in hot paths such as per-frame updates or simulation ticks. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const vecBuffer = root.createBuffer(d.vec3f); @@ -278,7 +278,7 @@ WGSL matrices are stored by columns, not rows. For `mat3x3f`, use packed `number[]` (9 floats) or padded `Float32Array` (12 floats, one padding float per column). ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const mat3Buffer = root.createBuffer(d.mat3x3f); @@ -303,7 +303,7 @@ mat3Buffer.write(new Float32Array([ Wherever a `TypedArray` or `ArrayBuffer` is passed, the bytes are copied directly without any interpretation. The data must already match the GPU memory layout, including any padding. For example, each element in `d.arrayOf(d.vec3f, N)` occupies **16 bytes** (12 bytes of data + 4 bytes of padding), so the input must include those padding bytes. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const arrBuffer = root.createBuffer(d.arrayOf(d.vec3f, 2)); @@ -329,7 +329,7 @@ Use `d.memoryLayoutOf` to obtain the correct byte offset for a given schema elem ::: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const schema = d.arrayOf(d.u32, 6); @@ -351,7 +351,7 @@ Both offsets are **byte-based**. Any component whose byte position falls at or b ::: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const schema = d.arrayOf(d.vec3u, 4); @@ -386,7 +386,7 @@ The format of the `data` value depends on your schema type: a plain array for full replacement, or a `TypedArray` for byte-level replacement. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const Planet = d.struct({ @@ -413,7 +413,7 @@ When the buffer schema is an `array>`, you can write the data in a s This is useful when your CPU-side data is already stored per-field, such as simulation attributes kept in separate typed arrays. ```ts twoslash -import tgpu, { d, common } from 'typegpu'; +import { tgpu, d, common } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -455,7 +455,7 @@ TypeGPU inserts the required WGSL padding while scattering the data into the tar You can also restrict the write to a slice of the destination buffer: ```ts twoslash -import tgpu, { d, common } from 'typegpu'; +import { tgpu, d, common } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -498,7 +498,7 @@ There's also an option to copy value from another typed buffer using the `.copyF as long as both buffers have a matching data schema. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const Particle = d.struct({ @@ -532,7 +532,7 @@ To read data from a buffer on the CPU, you can use the `.read()` method. It returns a promise that resolves to the data read from the buffer. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const buffer = root.createBuffer(d.arrayOf(d.u32, 10)); @@ -563,7 +563,7 @@ TypeGPU also allows for the use of index buffers. An index buffer is a buffer co You may refer to the [pipelines](/TypeGPU/apis/pipelines/#drawing-with-drawindexed) section for usage details. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -584,7 +584,7 @@ The default option is to create bind group layouts and bind your buffers via bin Read more in the chapter dedicated to [bind groups](/TypeGPU/apis/bind-groups). ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -622,7 +622,7 @@ Fixed buffers are created using dedicated root methods. | `var` | `root.createMutable()` | ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- diff --git a/apps/typegpu-docs/src/content/docs/apis/data-schemas.mdx b/apps/typegpu-docs/src/content/docs/apis/data-schemas.mdx index 21bd4a5875..ef950cd8b1 100644 --- a/apps/typegpu-docs/src/content/docs/apis/data-schemas.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/data-schemas.mdx @@ -363,7 +363,7 @@ Texture schemas serve two main purposes: - providing argument types for user defined functions ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); const texture = root.createTexture({ @@ -492,7 +492,7 @@ const AtomicI32 = d.atomic(d.i32); The `std` module provides functions for manipulating atomic data in 'use gpu' functions. ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; // ---cut--- const count = tgpu.workgroupVar(d.atomic(d.u32)); @@ -533,7 +533,7 @@ One of the biggest differences between JavaScript and WGSL is the existence of v Let's take a look at a simple TypeGPU function and the WGSL code it resolves to. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const MyStruct = d.struct({ n: d.u32 }); @@ -565,7 +565,7 @@ Even though modifying `s2` results in a change to `s1` in both cases, it happens To force an explicit copy in both cases, use a schema when the exact type is known: ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; // ---cut--- const MyStruct = d.struct({ n: d.u32 }); @@ -578,7 +578,7 @@ function myFn() { Or use `std.copy` when the schema may vary: ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; // ---cut--- function myFn(arg: d.v2u | d.v3u | d.v4u) { 'use gpu'; diff --git a/apps/typegpu-docs/src/content/docs/apis/functions/index.mdx b/apps/typegpu-docs/src/content/docs/apis/functions/index.mdx index 7f3b9edc57..223557705a 100644 --- a/apps/typegpu-docs/src/content/docs/apis/functions/index.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/functions/index.mdx @@ -25,7 +25,7 @@ though we recommend reading through anyway. The simplest and most powerful way to define TypeGPU functions is to just place `'use gpu'` at the beginning of the function body. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const neighborhood = (a: number, r: number) => { 'use gpu'; @@ -40,7 +40,7 @@ the same on the CPU and GPU. There are three main ways to use TypeGPU functions. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const neighborhood = (a: number, r: number) => { @@ -193,7 +193,7 @@ Since TypeScript types not taken into account when generating the shader code, t limitation on use of generic types. ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; // ---cut--- const double = (a: T): T => { 'use gpu'; @@ -247,7 +247,7 @@ After seeing this, you might be tempted to use this mechanism for sharing data b global variables used across functions, but values referenced by TypeGPU functions *are assumed to be constant*. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -331,7 +331,7 @@ It accepts two arguments: - (Optionally) a schema representing the return type. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const neighborhood = (a: number, r: number) => { 'use gpu'; return d.vec2f(a - r, a + r); @@ -346,7 +346,7 @@ const neighborhoodF32 = neighborhoodShell(neighborhood); Although you can define the function and shell separately, the most common way to use shells is immediately wrapping functions with them: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const neighborhood = tgpu.fn([d.f32, d.f32], d.vec2f)((a, r) => { 'use gpu'; @@ -365,7 +365,7 @@ We assume that you are familiar with the following concepts: Instead of passing JavaScript functions to shells, you can pass WGSL code directly: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const neighborhood = tgpu.fn([d.f32, d.f32], d.vec2f)`(a: f32, r: f32) -> vec2f { return vec2f(a - r, a + r); @@ -375,7 +375,7 @@ const neighborhood = tgpu.fn([d.f32, d.f32], d.vec2f)`(a: f32, r: f32) -> vec2f Since type information is already present in the shell, the WGSL header can be simplified to include only the argument names. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const neighborhood = tgpu.fn([d.f32, d.f32], d.vec2f)`(a, r) { @@ -388,7 +388,7 @@ const neighborhood = tgpu.fn([d.f32, d.f32], d.vec2f)`(a, r) { If you're using Visual Studio Code, you can use [this extension](https://marketplace.visualstudio.com/items?itemName=ggsimm.wgsl-literal) that brings syntax highlighting to code fragments marked with `/* wgsl */` comments. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const neighborhood = tgpu.fn([d.f32, d.f32], d.vec2f)/* wgsl */`(a, r) { return vec2f(a - r, a + r); @@ -402,7 +402,7 @@ Shelled WGSL functions can use external resources passed via the `$uses` method. *Externals* can include anything that can be resolved to WGSL by TypeGPU (numbers, vectors, matrices, constants, TypeGPU functions, buffer usages, textures, samplers, slots, accessors etc.). ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const getBlue = tgpu.fn([], d.vec4f)`() { @@ -502,7 +502,7 @@ Since TypeGPU wraps `IORecord`s into automatically generated structs, you can al - `workgroupSize` -- a JS array of 1-3 numbers that corresponds to the `@workgroup_size` attribute. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -561,7 +561,7 @@ struct mainCompute_Input { - `out` -- `d.vec4f`, or an `IORecord` describing the output of the function. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const getGradientColor = tgpu.fn([d.f32], d.vec4f)``; // ---cut--- @@ -638,7 +638,7 @@ struct mainFragment_Input { Typed functions are crucial for simplified [pipeline](/TypeGPU/apis/pipelines) creation offered by TypeGPU. You can define and run pipelines as follows: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const context = undefined as any; const presentationFormat = "rgba8unorm"; diff --git a/apps/typegpu-docs/src/content/docs/apis/pipelines.mdx b/apps/typegpu-docs/src/content/docs/apis/pipelines.mdx index 2aa3a1f334..ef18607bf9 100644 --- a/apps/typegpu-docs/src/content/docs/apis/pipelines.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/pipelines.mdx @@ -21,7 +21,7 @@ A pipeline can be defined with one of the following methods on the [root](/TypeG ```ts twoslash /// -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -73,7 +73,7 @@ The `createRenderPipeline` method creates a render pipeline by accepting an opti The vertex function's input parameters (non-builtin) are matched to vertex attributes specified in the pipeline's vertex layout when executing. Vertex attributes are validated at the type level for compatibility. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const presentationFormat = 'rgba8unorm'; @@ -123,7 +123,7 @@ When a custom location is provided by the user (via the `d.location` attribute f as long as there is no conflict between vertex and fragment location values. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const vertex = tgpu.vertexFn({ out: { pos: d.builtin.position }, @@ -152,7 +152,7 @@ The `createComputePipeline` method creates a compute pipeline by accepting an op - `compute`: The `TgpuComputeFn` to use as the compute shader. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -176,7 +176,7 @@ Instead of dispatching workgroups, the guarded pipeline allows calling an exact Under the hood, it creates a compute pipeline that calls the provided callback only if the current thread ID is within the requested range. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const data = root.createMutable(d.arrayOf(d.u32, 8), [0, 1, 2, 3, 4, 5, 6, 7]); @@ -210,7 +210,7 @@ Buffer initialization commonly uses random number generators. For that, you can use the [`@typegpu/noise`](/TypeGPU/ecosystem/typegpu-noise) library. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- import { randf } from '@typegpu/noise'; @@ -342,7 +342,7 @@ Compute pipelines are executed using the `dispatchWorkgroups` method, which acce The `drawIndexed` is analogous to draw, but takes advantage of [index buffer](/TypeGPU/apis/buffers/#index-buffers) to explicitly map vertex data onto primitives. When using an index buffer, you don't need to list every vertex for every primitive explicitly. Instead, you provide a list of unique vertices in a vertex buffer. Then, the index buffer defines how these vertices are connected to form primitives. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const presentationFormat = "rgba8unorm"; @@ -526,7 +526,7 @@ That way, they can be used with a regular WebGPU API, but unlike the `root['~uns resources. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/apis/resolve.mdx b/apps/typegpu-docs/src/content/docs/apis/resolve.mdx index f3986aeecf..0ec4d177e2 100644 --- a/apps/typegpu-docs/src/content/docs/apis/resolve.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/resolve.mdx @@ -15,7 +15,7 @@ The `tgpu.resolve` API takes in TypeGPU resources (and optionally a WGSL templat The first `tgpu.resolve` overload takes in an array of items to resolve, and an optional argument with options. Here's a simple example: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const Boid = d.struct({ size: d.f32, @@ -57,7 +57,7 @@ As you may note, the resolved WGSL code contains exactly the set of definitions You can also resolve other resources, like consts, buffers, textures, entry point functions or even entire pipelines. Here's an example with a pipeline: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const root = await tgpu.init(); @@ -116,7 +116,7 @@ Use it when you are already provided with existing WGSL code and want to extend Here's an example: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -156,7 +156,7 @@ As you may note, in this case `tgpu.resolve` uses the structure of the `external Here is another example. Assume, that the bind group index `0` is already taken by some existing code: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const LightSource = d.struct({ ambientColor: d.vec3f, @@ -266,7 +266,7 @@ For these cases, you can use `tgpu.resolveWithContext`, which has the same input An example, where the "catchall" bind group is created: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -290,7 +290,7 @@ console.log(catchall?.[1]); // the catchall bind group An example, where a bind group layout is automatically included via a TypeScript function: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- diff --git a/apps/typegpu-docs/src/content/docs/apis/roots.mdx b/apps/typegpu-docs/src/content/docs/apis/roots.mdx index bd8b364503..7d5717450b 100644 --- a/apps/typegpu-docs/src/content/docs/apis/roots.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/roots.mdx @@ -16,7 +16,7 @@ It requests a GPU device with default requirements. An optional parameter can be passed in with special requirements for the GPU device. ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); ``` @@ -24,7 +24,7 @@ const root = await tgpu.init(); If you already have a device that you want to use, you can pass it into `tgpu.initFromDevice` instead. ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const adapter = await navigator.gpu.requestAdapter(); const device = await adapter?.requestDevice() as GPUDevice; @@ -42,7 +42,7 @@ To retrieve the device that is associated with a root, you can use the `root.dev In order to draw on a canvas, you need to create and configure a context that will be later passed to a pipeline. ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); const canvas = {} as HTMLCanvasElement; // ---cut--- @@ -56,7 +56,7 @@ context.configure({ ``` TypeGPU streamlines this process with `root.configureContext` method. ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); const canvas = {} as HTMLCanvasElement; // ---cut--- diff --git a/apps/typegpu-docs/src/content/docs/apis/textures.mdx b/apps/typegpu-docs/src/content/docs/apis/textures.mdx index 8231e296a1..45091da2cb 100644 --- a/apps/typegpu-docs/src/content/docs/apis/textures.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/textures.mdx @@ -17,7 +17,7 @@ TypeGPU textures serve as a wrapper that provides type safety and higher level u Let's look at an example of creating and using a typed texture. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -54,7 +54,7 @@ type TextureProps = { ``` ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -71,7 +71,7 @@ const texture = root.createTexture({ Similar to buffers, textures need usage flags to specify how they will be used. You can add usage flags using the `.$usage(...)` method. ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -86,7 +86,7 @@ const texture = root.createTexture({ You can also add multiple flags at once: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -119,7 +119,7 @@ You can write various image sources to textures. `ExternalImageSource` includes: - `VideoFrame` ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -149,7 +149,7 @@ If image dimensions don't match the texture size, the image will be automaticall For 3D textures or texture arrays, you can write multiple images: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); declare const imageBitmap1: ImageBitmap; declare const imageBitmap2: ImageBitmap; @@ -170,7 +170,7 @@ texture3d.write([imageBitmap1, imageBitmap2, imageBitmap3]); You can write raw binary data directly to textures using `ArrayBuffer`, typed arrays, or `DataView`: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -195,7 +195,7 @@ texture.write(mipData, 1); // Write to mip level 1 You can also copy from another texture: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const sourceTexture = root.createTexture({ @@ -216,7 +216,7 @@ targetTexture.copyFrom(sourceTexture); TypeGPU provides automatic mipmap generation for textures: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); declare const imageBitmap: ImageBitmap; // ---cut--- @@ -254,7 +254,7 @@ This releases the underlying `GPUTexture`; subsequent operations on the TypeGPU To create a view - which will also serve as fixed texture usage - you can use one of the available [texture schemas](/TypeGPU/apis/data-schemas/#textures). You can pass it to the `.createView` method of the texture. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -272,7 +272,7 @@ const sampledView = texture.createView(d.texture2d(d.f32)); If type information is available the view schema will be staticly checked against the texture properties. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -285,7 +285,7 @@ const sampledView = texture.createView(d.texture2d(d.f32)); ``` ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -303,7 +303,7 @@ const sampledView = texture.createView(d.textureStorage2d('rgba8unorm')); // <-- To sample textures in shaders, you'll often need a sampler that defines how the texture should be filtered and addressed. The `createSampler` method accepts the same descriptor as the vanilla WebGPU `GPUSamplerDescriptor`: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const sampler = root.createSampler({ @@ -323,7 +323,7 @@ Depth comparisons use a distinct sampler type. Create one with `root.createComparisonSampler`, then pass it to `std.textureSampleCompare` with a depth texture: ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const shadowMap = root.createTexture({ @@ -362,7 +362,7 @@ Textures can be used in shaders through bind groups or as fixed resources, simil ### Manual binding ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ @@ -393,7 +393,7 @@ const bindGroup = root.createBindGroup(bindGroupLayout, { For textures that remain consistent across operations, you can create fixed texture views: ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); // ---cut--- const texture = root.createTexture({ diff --git a/apps/typegpu-docs/src/content/docs/apis/variables.mdx b/apps/typegpu-docs/src/content/docs/apis/variables.mdx index 835339e216..348cbc384e 100644 --- a/apps/typegpu-docs/src/content/docs/apis/variables.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/variables.mdx @@ -11,7 +11,7 @@ For example, in the code snippet below, the external `counter` is automatically In this case, the group and index match the automatically generated "catchall" bind group, used for fixed, "bindless" resources. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -53,7 +53,7 @@ struct increment_Input { For variables of `private` and `workgroup` address spaces, TypeGPU provides `tgpu.privateVar()` and `tgpu.workgroupVar()` constructor functions. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -82,7 +82,7 @@ In JS, a `const` is a reference that cannot be reassigned, while in WGSL, it mea Therefore, to use the WGSL `const`, TypeGPU provides `tgpu.const()`, an interface analogous to `tgpu.privateVar()` and `tgpu.workgroupVar()`, with the only difference being that the previously optional init value is now required. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- const Boid = d.struct({ pos: d.vec3f, diff --git a/apps/typegpu-docs/src/content/docs/apis/vertex-layouts.mdx b/apps/typegpu-docs/src/content/docs/apis/vertex-layouts.mdx index 581e73c904..35c862006b 100644 --- a/apps/typegpu-docs/src/content/docs/apis/vertex-layouts.mdx +++ b/apps/typegpu-docs/src/content/docs/apis/vertex-layouts.mdx @@ -18,7 +18,7 @@ Vertex layouts are much like bind group layouts, in that they define the relatio To create a vertex layout, use the `tgpu.vertexLayout` function. It takes an array schema constructor, i.e., partially applied `d.arrayOf` or `d.disarrayOf`. To determine what each element of the array corresponds to, you can pass an optional `stepMode` argument, which can be either `vertex` (default) or `instance`. ```ts -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const ParticleGeometry = d.struct({ tilt: d.f32, diff --git a/apps/typegpu-docs/src/content/docs/blog/typegpu-0.11/index.mdx b/apps/typegpu-docs/src/content/docs/blog/typegpu-0.11/index.mdx index c4e146e464..e3dd0a2581 100644 --- a/apps/typegpu-docs/src/content/docs/blog/typegpu-0.11/index.mdx +++ b/apps/typegpu-docs/src/content/docs/blog/typegpu-0.11/index.mdx @@ -255,7 +255,7 @@ There has been a lot of work outside of the `typegpu` package, both internally a Aleksander Katan ([@aleksanderkatan](https://github.com/aleksanderkatan)) has been working behind the scenes on an ESLint/Oxlint plugin, capable of catching user errors that types cannot. ```ts -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; function increment(n: number) { 'use gpu'; diff --git a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-noise.mdx b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-noise.mdx index 4e28e39aa6..240b73bc1d 100644 --- a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-noise.mdx +++ b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-noise.mdx @@ -24,7 +24,7 @@ Calling utility functions from [TypeGPU functions](/TypeGPU/apis/functions/) lin In the example below, resolving `randomVec2f` into a shader will include the code for `randf.sample` and all of its dependencies. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- import { randf } from '@typegpu/noise'; @@ -50,7 +50,7 @@ import { d } from 'typegpu'; // ---cut--- import { randf } from '@typegpu/noise'; // `typegpu` is necessary to inject library code into your custom shader -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const shader = tgpu.resolve({ template: ` @@ -81,7 +81,7 @@ Each call to `randf.sample` returns the next random float in the sequence, allow using a set of `randf.seedN` functions, where `N` is the number of components our seed has. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { randf } from '@typegpu/noise'; const main = tgpu.fragmentFn({ @@ -144,7 +144,7 @@ The package exports an implementation for both 2D and 3D Perlin noise, `perlin2d Using it is as simple as calling the `.sample` function with the desired coordinates, and it returns a value in the range `[-1, 1]`. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- import { perlin2d } from '@typegpu/noise'; @@ -165,7 +165,7 @@ To improve performance, you can precompute the gradients using either a *Static* A static cache presumes that the domain of the noise function is fixed, and cannot change between shader invocations. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); import { perlin3d } from '@typegpu/noise'; @@ -189,7 +189,7 @@ Or in WebGPU: import { d } from 'typegpu'; declare const device: GPUDevice; -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { perlin3d } from '@typegpu/noise'; // ---cut--- @@ -221,7 +221,7 @@ without having to recompile the shader, you have to use a dynamic cache. With it complex setup. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { perlin3d } from '@typegpu/noise'; const main = tgpu.computeFn({ workgroupSize: [1] })(() => { @@ -266,7 +266,7 @@ The package provides convenient way to change PRNG as needed. You can easily implement your own PRNG and plug it into the pipeline. ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { randf } from '@typegpu/noise'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-radiance-cascades.mdx b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-radiance-cascades.mdx index 3390c92bf3..9cd0ad8274 100644 --- a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-radiance-cascades.mdx +++ b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-radiance-cascades.mdx @@ -29,7 +29,7 @@ The package currently focuses on 2D radiance fields. It expects distances in UV- ```ts twoslash import * as rc from '@typegpu/radiance-cascades'; import * as sdf from '@typegpu/sdf'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); const previewSize = { width: 512, height: 512 }; @@ -87,7 +87,7 @@ A common setup is to generate an SDF texture with [`@typegpu/sdf`](/TypeGPU/ecos ```ts import * as rc from '@typegpu/radiance-cascades'; import * as sdf from '@typegpu/sdf'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); const floodSize = { width: 2048, height: 2048 }; diff --git a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-sdf.mdx b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-sdf.mdx index 7c346f478b..b48651bccf 100644 --- a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-sdf.mdx +++ b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-sdf.mdx @@ -37,7 +37,7 @@ Resolving the function includes the SDF code and its dependencies automatically. ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as sdf from '@typegpu/sdf'; const renderRoundedBox = tgpu.fn([d.vec2f], d.vec4f)((uv) => { @@ -65,7 +65,7 @@ The package includes a few common operators. They take distances as input, so yo ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as sdf from '@typegpu/sdf'; const sceneSdf = tgpu.fn([d.vec2f], d.f32)((p) => { @@ -102,7 +102,7 @@ The 3D primitives follow the same rules as the 2D ones. They are useful for ray ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as sdf from '@typegpu/sdf'; const sceneSdf = tgpu.fn([d.vec3f], d.f32)((p) => { @@ -185,7 +185,7 @@ Here the source shape is a triangle mask baked into a texture first, then jump f ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as sdf from '@typegpu/sdf'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-three/index.mdx b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-three/index.mdx index 26f3ad740e..9ae167a31b 100644 --- a/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-three/index.mdx +++ b/apps/typegpu-docs/src/content/docs/ecosystem/typegpu-three/index.mdx @@ -60,7 +60,7 @@ Calling `t3.toTSL` with a TypeGPU function will return a TSL node, which can the
```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- import * as THREE from 'three/webgpu'; import * as t3 from '@typegpu/three'; @@ -112,7 +112,7 @@ There are a handful of builtin TSL node accessors in the `t3` namespace:
```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // ---cut--- import * as THREE from 'three/webgpu'; import * as t3 from '@typegpu/three'; @@ -138,7 +138,7 @@ Other TypeGPU functions (user-defined or from libraries) can be called to achiev
```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; // ---cut--- import { perlin3d } from '@typegpu/noise'; import * as THREE from 'three/webgpu'; diff --git a/apps/typegpu-docs/src/content/docs/fundamentals/compute-shaders.mdx b/apps/typegpu-docs/src/content/docs/fundamentals/compute-shaders.mdx index 1165b781aa..a4a38d4309 100644 --- a/apps/typegpu-docs/src/content/docs/fundamentals/compute-shaders.mdx +++ b/apps/typegpu-docs/src/content/docs/fundamentals/compute-shaders.mdx @@ -11,7 +11,7 @@ In the previous section, we went over the basics of creating compute shaders and So far, most of our shaders have looked like this: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); @@ -45,7 +45,7 @@ We still have to be careful not to read or write outside the bounds of the array If the dispatch size might be larger than the buffer length, guard the array access inside the shader: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -81,7 +81,7 @@ This is a useful analogy for understanding how the thread index maps to data. Bu When one thread reads data that another thread may be writing, the loop analogy breaks down: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -149,7 +149,7 @@ Laid out resources split the setup into two pieces: The layout is created first, without providing any actual buffers. For buffers, each layout entry uses the same schema we would use to create the buffer. If the entry is a storage buffer, it can also include an access mode: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const bindGroupLayout = tgpu.bindGroupLayout({ counter: { storage: d.u32, access: 'mutable' }, @@ -170,7 +170,7 @@ Storage entries are readonly by default, so `{ storage: d.u32 }` and `{ storage: To provide the resources, create a bind group with `root.createBindGroup(layout, entries)`: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -192,7 +192,7 @@ const bindGroup = root.createBindGroup(bindGroupLayout, { Because bind group entries are typed, providing a resource with the wrong schema or usage is a TypeScript error. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -221,7 +221,7 @@ Now the same simulation step can be written in either style. The Fixed Resources ```ts twoslash {13-16, 18-21} - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -255,7 +255,7 @@ Now the same simulation step can be written in either style. The Fixed Resources ```ts twoslash {10-11} - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/fundamentals/vertices-and-fragments.mdx b/apps/typegpu-docs/src/content/docs/fundamentals/vertices-and-fragments.mdx index bf260cc12e..390a419f20 100644 --- a/apps/typegpu-docs/src/content/docs/fundamentals/vertices-and-fragments.mdx +++ b/apps/typegpu-docs/src/content/docs/fundamentals/vertices-and-fragments.mdx @@ -29,7 +29,7 @@ The code itself works on a canvas of any size. ::: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -70,7 +70,7 @@ Let us go through the code step by step. 1. **Initialize the `root`**, just like we did in a previous guide. ```ts - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); ``` @@ -148,7 +148,7 @@ We can actually return more values. In the example below, we pass in an additional color prop. ```ts twoslash {12-18, 20, 22} -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const canvas = document.querySelector('canvas') as HTMLCanvasElement; @@ -238,7 +238,7 @@ In all examples above, we draw once and stop. To animate, two things change: we call `pipeline.draw()` every frame, and we pass a value from JS into the shader that each frame can vary. ```ts twoslash {1, 13-15, 23-28} -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); const canvas = document.querySelector('canvas') as HTMLCanvasElement; @@ -291,7 +291,7 @@ To draw bigger points and lines, people usually use many triangles to approximat There is however a different approach, that skips the geometry altogether. ```ts twoslash -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { fullScreenTriangle } from 'typegpu/common'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/fundamentals/your-first-gpu-program.mdx b/apps/typegpu-docs/src/content/docs/fundamentals/your-first-gpu-program.mdx index 4603ace7af..d5f966907a 100644 --- a/apps/typegpu-docs/src/content/docs/fundamentals/your-first-gpu-program.mdx +++ b/apps/typegpu-docs/src/content/docs/fundamentals/your-first-gpu-program.mdx @@ -19,7 +19,7 @@ Most code snippets on this page are inspectable: hover over an identifier to see ::: ```ts twoslash -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; const root = await tgpu.init(); @@ -84,7 +84,7 @@ That gives us a few useful properties: Let's use that to create a simple GPU program that actually writes data to GPU memory. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -118,7 +118,7 @@ This is useful for fast debugging, but `console.log` only displays the value. It In the previous examples, we used `createMutable()` without paying much attention to what it creates. In short, it allocates GPU memory that can be accessed directly from a TypeGPU shader and modified from shader code. You might wonder why you could not just do something like: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -141,7 +141,7 @@ That is why we use buffers for state that the GPU can read or write. You can thi The `createMutable()` function is a shorthand for creating a storage buffer and viewing it as mutable: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -170,7 +170,7 @@ So far, we know how to allocate GPU buffers, update them from inside shaders, an With our current knowledge, we could just write a shader that writes some values to the buffer: ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -198,7 +198,7 @@ This will work correctly (as long as we always want to increment by 10), and som Because this version always increments by `10`, we could also drop the `incrementBy` field from our GPU state and capture a JavaScript constant instead. Captured constants are inlined into the generated shader, so this only works for values that do not need to change at runtime. ```ts twoslash -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ---cut--- @@ -228,7 +228,7 @@ As we can see, our program grew quite a bit. Let's examine what changed: 1. **Add a new value to our GPU state**, which we will use to control each increment step. We used `d.struct`, which works exactly like you would expect a struct to: it lets us group data together. ```ts twoslash - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -241,7 +241,7 @@ As we can see, our program grew quite a bit. Let's examine what changed: 2. **Add initial data.** Apart from the schema, buffer constructors also take a second argument, which lets you efficiently write data at buffer creation time. ```ts twoslash - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -257,7 +257,7 @@ As we can see, our program grew quite a bit. Let's examine what changed: This data will be typed according to the schema, so there is no byte counting involved. If you want to modify a buffer after it has been created, you can use the `.write()` method, which takes the same data shape. ```ts twoslash - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -276,7 +276,7 @@ As we can see, our program grew quite a bit. Let's examine what changed: 3. **Update the shader code** so that it uses the new field and increments `counter` by the current `incrementBy` value. ```ts twoslash - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); @@ -295,7 +295,7 @@ As we can see, our program grew quite a bit. Let's examine what changed: 4. **Use `.patch()` to update just one buffer field.** By default, `.write()` expects you to write the entire buffer at once. Since we do not have the current `counter` value available on the CPU side, we would need to read it each time (or track mirrored state on the CPU) - in short, not something we want to do. The `.patch()` API allows us to pass a subset of the buffer and write only the present values. ```ts twoslash - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/integration/react-native/index.mdx b/apps/typegpu-docs/src/content/docs/integration/react-native/index.mdx index 9ca9d18194..f98ab5049c 100644 --- a/apps/typegpu-docs/src/content/docs/integration/react-native/index.mdx +++ b/apps/typegpu-docs/src/content/docs/integration/react-native/index.mdx @@ -127,7 +127,7 @@ that you can use in your app: ```ts import { useMemo } from 'react'; import { Canvas } from 'react-native-webgpu'; -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { useRoot, useFrame, useConfigureContext } from '@typegpu/react'; const positions = tgpu.const(d.arrayOf(d.vec2f), [ diff --git a/apps/typegpu-docs/src/content/docs/integration/webgpu-interoperability.mdx b/apps/typegpu-docs/src/content/docs/integration/webgpu-interoperability.mdx index bfb8c4838e..fa1f3f0631 100644 --- a/apps/typegpu-docs/src/content/docs/integration/webgpu-interoperability.mdx +++ b/apps/typegpu-docs/src/content/docs/integration/webgpu-interoperability.mdx @@ -12,7 +12,7 @@ The **non-contagious** nature of TypeGPU means that ejecting out, in case raw We Some of the following code snippets assume that TypeGPU is already initialized. ```ts -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); // ...or pass in an existing WebGPU device diff --git a/apps/typegpu-docs/src/content/docs/integration/wesl-interoperability.mdx b/apps/typegpu-docs/src/content/docs/integration/wesl-interoperability.mdx index 0a5ba9bee6..173f39ae28 100644 --- a/apps/typegpu-docs/src/content/docs/integration/wesl-interoperability.mdx +++ b/apps/typegpu-docs/src/content/docs/integration/wesl-interoperability.mdx @@ -105,7 +105,7 @@ reified references to any struct definition. import { Fish } from './shaders/shared.wesl?typegpu'; // ---cut-start--- // @filename: ./main.ts -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const BoidState = d.struct({ position: d.vec3f, diff --git a/apps/typegpu-docs/src/content/docs/tooling/tgpu-gen.mdx b/apps/typegpu-docs/src/content/docs/tooling/tgpu-gen.mdx index e4ad431695..a1b29da281 100644 --- a/apps/typegpu-docs/src/content/docs/tooling/tgpu-gen.mdx +++ b/apps/typegpu-docs/src/content/docs/tooling/tgpu-gen.mdx @@ -209,7 +209,7 @@ The generated TypeScript definitions look like this: Click to see the content ```typescript /* generated via tgpu-gen by TypeGPU */ - import tgpu from 'typegpu'; + import { tgpu } from 'typegpu'; import * as d from 'typegpu/data'; /* structs */ diff --git a/apps/typegpu-docs/src/content/docs/tooling/unplugin-typegpu.mdx b/apps/typegpu-docs/src/content/docs/tooling/unplugin-typegpu.mdx index 4a1deaa622..f86a6d939b 100644 --- a/apps/typegpu-docs/src/content/docs/tooling/unplugin-typegpu.mdx +++ b/apps/typegpu-docs/src/content/docs/tooling/unplugin-typegpu.mdx @@ -13,7 +13,7 @@ The package includes the following functionalities: The parsing of JavaScript happens ahead of time, emitting a highly compact AST format, called [tinyest](https://www.npmjs.com/package/tinyest). ```ts - import tgpu, { d } from 'typegpu'; + import { tgpu, d } from 'typegpu'; // Found by the plugin and decorated with 'tinyest' metadata const add = (a: number, b: number) => { diff --git a/apps/typegpu-docs/src/content/docs/tutorials/game-of-life/index.mdx b/apps/typegpu-docs/src/content/docs/tutorials/game-of-life/index.mdx index d8b437f8be..c37bf68617 100644 --- a/apps/typegpu-docs/src/content/docs/tutorials/game-of-life/index.mdx +++ b/apps/typegpu-docs/src/content/docs/tutorials/game-of-life/index.mdx @@ -33,7 +33,7 @@ Canvas’ inner width and height need to be adjusted to its outer properties mul Then, start off with TypeGPU by creating its [`root`](/TypeGPU/apis/roots/) object: ```ts -import tgpu from "typegpu"; +import { tgpu } from "typegpu"; const root = await tgpu.init(); ``` diff --git a/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step1-typegpu.ts b/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step1-typegpu.ts index 9ee6e304bd..1a40164f17 100644 --- a/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step1-typegpu.ts +++ b/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/code/step1-typegpu.ts @@ -2,7 +2,7 @@ // TODO: ^ REMOVE WHEN CODE WORKS AGAIN import { addElement, onFrame } from '@typegpu/example-toolkit'; -import tgpu, { builtin } from 'typegpu/experimental'; +import { tgpu, builtin } from 'typegpu/experimental'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/index.mdx b/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/index.mdx index 71e4ceb4eb..17784f61a1 100644 --- a/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/index.mdx +++ b/apps/typegpu-docs/src/content/docs/tutorials/triangle-to-boids/index.mdx @@ -43,7 +43,7 @@ This setup will mostly look very similar in every project that draws something t ```ts - import tgpu from 'typegpu'; + import { tgpu } from 'typegpu'; // Create the root const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/algorithms/bitonic-sort/index.ts b/apps/typegpu-docs/src/examples/algorithms/bitonic-sort/index.ts index ad5bb150c0..459d3d296f 100644 --- a/apps/typegpu-docs/src/examples/algorithms/bitonic-sort/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/bitonic-sort/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { type BitonicSorter, type BitonicSorterOptions, diff --git a/apps/typegpu-docs/src/examples/algorithms/concurrent-chart/index.ts b/apps/typegpu-docs/src/examples/algorithms/concurrent-chart/index.ts index 6ea3771b9d..a85e1aa83f 100644 --- a/apps/typegpu-docs/src/examples/algorithms/concurrent-chart/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/concurrent-chart/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; import { performCalculationsWithTime } from './calculator.ts'; diff --git a/apps/typegpu-docs/src/examples/algorithms/genetic-racing/ga.ts b/apps/typegpu-docs/src/examples/algorithms/genetic-racing/ga.ts index 2bf055d1a6..68f12e74fc 100644 --- a/apps/typegpu-docs/src/examples/algorithms/genetic-racing/ga.ts +++ b/apps/typegpu-docs/src/examples/algorithms/genetic-racing/ga.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import type { TgpuRoot, TgpuUniform } from 'typegpu'; export const MAX_POP = 65536; diff --git a/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts b/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts index ee42d2f645..1c3052a73c 100644 --- a/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/genetic-racing/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; import { generateGridTrack, type TrackResult } from './track.ts'; import { diff --git a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts index ce3767e05b..ebba4d5f20 100644 --- a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { distanceFrag } from './visualization.ts'; import { BrushParams, diff --git a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/types.ts b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/types.ts index d733ef435f..a418e30b05 100644 --- a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/types.ts +++ b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/types.ts @@ -1,4 +1,4 @@ -import tgpu, { d, type SampledFlag, type StorageFlag, type TgpuTexture } from 'typegpu'; +import { tgpu, d, type SampledFlag, type StorageFlag, type TgpuTexture } from 'typegpu'; export const VisualizationParams = d.struct({ showInside: d.u32, diff --git a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/visualization.ts b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/visualization.ts index 2bb25d0e55..18b3ae48c0 100644 --- a/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/visualization.ts +++ b/apps/typegpu-docs/src/examples/algorithms/jump-flood-distance/visualization.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { distSampleLayout, paramsAccess } from './types.ts'; const outsideGradient = tgpu.const(d.arrayOf(d.vec3f, 5), [ diff --git a/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts b/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts index fa64ed38b4..b435b73a5d 100644 --- a/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/jump-flood-voronoi/index.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import type { SampledFlag, StorageFlag, TgpuTexture } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/algorithms/matrix-multiplication/index.ts b/apps/typegpu-docs/src/examples/algorithms/matrix-multiplication/index.ts index 5f745fc1da..af6a8daf89 100644 --- a/apps/typegpu-docs/src/examples/algorithms/matrix-multiplication/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/matrix-multiplication/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const WORKGROUP_SIZE = [8, 8] as [number, number]; diff --git a/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeShared.ts b/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeShared.ts index 80549ac007..1c6363faa9 100644 --- a/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeShared.ts +++ b/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeShared.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { TILE_SIZE, WORKGROUP_SIZE } from './params.ts'; import { computeLayout } from './types.ts'; diff --git a/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeSimple.ts b/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeSimple.ts index 6759dbe27f..7b6ee080d4 100644 --- a/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeSimple.ts +++ b/apps/typegpu-docs/src/examples/algorithms/matrix-next/computeSimple.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { getIndex } from './computeShared.ts'; import { WORKGROUP_SIZE } from './params.ts'; import { computeLayout } from './types.ts'; diff --git a/apps/typegpu-docs/src/examples/algorithms/matrix-next/index.ts b/apps/typegpu-docs/src/examples/algorithms/matrix-next/index.ts index afc3e10130..600db8e552 100644 --- a/apps/typegpu-docs/src/examples/algorithms/matrix-next/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/matrix-next/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { INITIAL_MAX_MATRIX_SIZE, TILE_SIZE } from './params.ts'; import { type CalculationStrategy, computeLayout, createMatrixData, MatrixInfo } from './types.ts'; import { computeSharedMemory } from './computeShared.ts'; diff --git a/apps/typegpu-docs/src/examples/algorithms/matrix-next/types.ts b/apps/typegpu-docs/src/examples/algorithms/matrix-next/types.ts index 2fcaf1c05a..95296326b7 100644 --- a/apps/typegpu-docs/src/examples/algorithms/matrix-next/types.ts +++ b/apps/typegpu-docs/src/examples/algorithms/matrix-next/types.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export type CalculationStrategy = 'gpu-optimized' | 'gpu-simple' | 'cpu'; diff --git a/apps/typegpu-docs/src/examples/algorithms/mnist-inference/index.ts b/apps/typegpu-docs/src/examples/algorithms/mnist-inference/index.ts index 256174a209..bf3b97eb59 100644 --- a/apps/typegpu-docs/src/examples/algorithms/mnist-inference/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/mnist-inference/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import type { LayerData, Network } from './data.ts'; import { downloadLayers } from './helpers.ts'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/algorithms/probability/executor.ts b/apps/typegpu-docs/src/examples/algorithms/probability/executor.ts index d436cf6d2b..ecd1062c51 100644 --- a/apps/typegpu-docs/src/examples/algorithms/probability/executor.ts +++ b/apps/typegpu-docs/src/examples/algorithms/probability/executor.ts @@ -10,7 +10,7 @@ import type { TgpuRoot, TgpuSlot, } from 'typegpu'; -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export class Executor { // don't exceed max workgroup grid X dimension size diff --git a/apps/typegpu-docs/src/examples/algorithms/probability/helpers.ts b/apps/typegpu-docs/src/examples/algorithms/probability/helpers.ts index f214cdb2f2..cac3b0c628 100644 --- a/apps/typegpu-docs/src/examples/algorithms/probability/helpers.ts +++ b/apps/typegpu-docs/src/examples/algorithms/probability/helpers.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import * as c from './constants.ts'; import { Distribution, PlotType, type PRNG } from './types.ts'; diff --git a/apps/typegpu-docs/src/examples/algorithms/probability/index.ts b/apps/typegpu-docs/src/examples/algorithms/probability/index.ts index 6c4c807686..9696685d66 100644 --- a/apps/typegpu-docs/src/examples/algorithms/probability/index.ts +++ b/apps/typegpu-docs/src/examples/algorithms/probability/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { Plotter } from './plotter.ts'; import { Executor } from './executor.ts'; diff --git a/apps/typegpu-docs/src/examples/geometry/circles/index.ts b/apps/typegpu-docs/src/examples/geometry/circles/index.ts index 549f4b0d4b..1428c861b5 100644 --- a/apps/typegpu-docs/src/examples/geometry/circles/index.ts +++ b/apps/typegpu-docs/src/examples/geometry/circles/index.ts @@ -1,5 +1,5 @@ import { circle, circleVertexCount } from '@typegpu/geometry'; -import tgpu, { d, std as s } from 'typegpu'; +import { tgpu, d, std as s } from 'typegpu'; const presentationFormat = navigator.gpu.getPreferredCanvasFormat(); const canvas = document.querySelector('canvas'); diff --git a/apps/typegpu-docs/src/examples/geometry/lines-combinations/index.ts b/apps/typegpu-docs/src/examples/geometry/lines-combinations/index.ts index 074dec69ee..944dab8986 100644 --- a/apps/typegpu-docs/src/examples/geometry/lines-combinations/index.ts +++ b/apps/typegpu-docs/src/examples/geometry/lines-combinations/index.ts @@ -10,7 +10,7 @@ import { startCapSlot, arrowCapParamsSlot, } from '@typegpu/geometry'; -import tgpu, { type ColorAttachment } from 'typegpu'; +import { tgpu, type ColorAttachment } from 'typegpu'; import { arrayOf, builtin, diff --git a/apps/typegpu-docs/src/examples/geometry/lines-combinations/testCases.ts b/apps/typegpu-docs/src/examples/geometry/lines-combinations/testCases.ts index 86ba518cdb..3cbfe09b07 100644 --- a/apps/typegpu-docs/src/examples/geometry/lines-combinations/testCases.ts +++ b/apps/typegpu-docs/src/examples/geometry/lines-combinations/testCases.ts @@ -1,6 +1,6 @@ import { LineControlPoint } from '@typegpu/geometry'; import { perlin2d, randf } from '@typegpu/noise'; -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { arrayOf, f32, i32, mat2x2f, u32, vec2f } from 'typegpu/data'; import { abs, clamp, cos, floor, max, pow, select, sin } from 'typegpu/std'; import { TEST_SEGMENT_COUNT } from './constants.ts'; diff --git a/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts b/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts index 0adc3b6b4f..b47993c246 100644 --- a/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/ascii-filter/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std, type TgpuBindGroup } from 'typegpu'; +import { tgpu, common, d, std, type TgpuBindGroup } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts index 0c08feb8f6..4c67334490 100644 --- a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/index.ts @@ -1,5 +1,5 @@ import type { RenderFlag, SampledFlag, StorageFlag, TgpuBindGroup, TgpuTexture } from 'typegpu'; -import tgpu, { common, d } from 'typegpu'; +import { tgpu, common, d } from 'typegpu'; import { MODEL_HEIGHT, MODEL_WIDTH, MODELS, prepareSession } from './model.ts'; import { diff --git a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/schemas.ts b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/schemas.ts index a40024d6f9..4eefeee961 100644 --- a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/schemas.ts +++ b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/schemas.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // constants diff --git a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/shaders.ts b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/shaders.ts index 19dc796639..a66bf17781 100644 --- a/apps/typegpu-docs/src/examples/image-processing/background-segmentation/shaders.ts +++ b/apps/typegpu-docs/src/examples/image-processing/background-segmentation/shaders.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std, type TgpuFragmentFn } from 'typegpu'; +import { tgpu, d, std, type TgpuFragmentFn } from 'typegpu'; import { MODEL_HEIGHT, MODEL_WIDTH } from './model.ts'; import { blockDim, diff --git a/apps/typegpu-docs/src/examples/image-processing/blur/index.ts b/apps/typegpu-docs/src/examples/image-processing/blur/index.ts index a6bd7bd0de..890d30e9cd 100644 --- a/apps/typegpu-docs/src/examples/image-processing/blur/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/blur/index.ts @@ -1,7 +1,7 @@ // Original implementation: // https://webgpu.github.io/webgpu-samples/?sample=imageBlur -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts b/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts index b72f79e1fb..b3e82e2720 100644 --- a/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/camera-thresholding/index.ts @@ -1,5 +1,5 @@ import { rgbToYcbcrMatrix } from '@typegpu/color'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const textureLayout = tgpu.bindGroupLayout({ diff --git a/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts b/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts index 498c3cf8b6..de68f71817 100644 --- a/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/chroma-keying/index.ts @@ -1,5 +1,5 @@ import { rgbToYcbcrMatrix } from '@typegpu/color'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts b/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts index 4720c0aeb9..edc6de826c 100644 --- a/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/image-tuning/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; type LUTData = { diff --git a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/index.ts b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/index.ts index 5a9d385632..e241bdbc08 100644 --- a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/index.ts +++ b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import type { TgpuBindGroup } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; import { diff --git a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/compute.ts b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/compute.ts index c18ddd7473..8a9e37be34 100644 --- a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/compute.ts +++ b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/compute.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { BroadcastFlag } from '../bundle.ts'; import { binaryLayout, diff --git a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/helpers.ts b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/helpers.ts index b799b9049a..090f1bd85b 100644 --- a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/helpers.ts +++ b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/helpers.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { headLayout, weightedLayout } from './layouts.ts'; export type Vec4Op = (value: d.v4f) => d.v4f; diff --git a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/layouts.ts b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/layouts.ts index 6e2cb51852..8b0891711c 100644 --- a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/layouts.ts +++ b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/kernels/layouts.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const WeightedOffsets = d.struct({ weightBase: d.u32, diff --git a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/video-preprocess.ts b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/video-preprocess.ts index 4b72fa1206..036671a302 100644 --- a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/video-preprocess.ts +++ b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/inference/video-preprocess.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import type { TgpuBindGroup, TgpuRoot } from 'typegpu'; import { FrameCropParams, initialFrameCropParams, type VideoFrameCrop } from '../frame.ts'; import { WORKGROUP_SIZE, type Vec4Buffer } from './kernels/types.ts'; diff --git a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/post-processing/kernels.ts b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/post-processing/kernels.ts index fcec57c114..5d57dc8de7 100644 --- a/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/post-processing/kernels.ts +++ b/apps/typegpu-docs/src/examples/image-processing/selfie-segmentation/post-processing/kernels.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { initialFrameCropParams } from '../frame.ts'; const MODEL_WIDTH = 256; diff --git a/apps/typegpu-docs/src/examples/react/confetti/index.tsx b/apps/typegpu-docs/src/examples/react/confetti/index.tsx index 87aeb7ed43..2a7fb460bf 100644 --- a/apps/typegpu-docs/src/examples/react/confetti/index.tsx +++ b/apps/typegpu-docs/src/examples/react/confetti/index.tsx @@ -1,4 +1,4 @@ -import tgpu, { d, std, type TgpuBuffer, type TgpuVertexFn } from 'typegpu'; +import { tgpu, d, std, type TgpuBuffer, type TgpuVertexFn } from 'typegpu'; import { useFrame, useRoot, diff --git a/apps/typegpu-docs/src/examples/react/spinning-triangle/index.tsx b/apps/typegpu-docs/src/examples/react/spinning-triangle/index.tsx index a1bcf3352e..cbdfa25e7b 100644 --- a/apps/typegpu-docs/src/examples/react/spinning-triangle/index.tsx +++ b/apps/typegpu-docs/src/examples/react/spinning-triangle/index.tsx @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { hexToOklab, oklabToRgb } from '@typegpu/color'; import { useConfigureContext, useFrame, useRoot, useUniform } from '@typegpu/react'; import React, { useMemo } from 'react'; diff --git a/apps/typegpu-docs/src/examples/rendering/3d-fish/compute.ts b/apps/typegpu-docs/src/examples/rendering/3d-fish/compute.ts index 1bc12594ec..ab7257d82f 100644 --- a/apps/typegpu-docs/src/examples/rendering/3d-fish/compute.ts +++ b/apps/typegpu-docs/src/examples/rendering/3d-fish/compute.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as p from './params.ts'; import { computeBindGroupLayout as layout } from './schemas.ts'; import { projectPointOnLine } from './tgsl-helpers.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts b/apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts index 1d0d578efd..f36d4b038f 100644 --- a/apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/3d-fish/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; import { setupScene } from './scene.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/3d-fish/render.ts b/apps/typegpu-docs/src/examples/rendering/3d-fish/render.ts index d5955e9e83..ffa93cffb6 100644 --- a/apps/typegpu-docs/src/examples/rendering/3d-fish/render.ts +++ b/apps/typegpu-docs/src/examples/rendering/3d-fish/render.ts @@ -1,5 +1,5 @@ import { hsvToRgb, rgbToHsv } from '@typegpu/color'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as p from './params.ts'; import { ModelVertexInput, ModelVertexOutput, renderBindGroupLayout as layout } from './schemas.ts'; import { applySinWave, PosAndNormal } from './tgsl-helpers.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/3d-fish/schemas.ts b/apps/typegpu-docs/src/examples/rendering/3d-fish/schemas.ts index ca9c55702b..8a43f179a3 100644 --- a/apps/typegpu-docs/src/examples/rendering/3d-fish/schemas.ts +++ b/apps/typegpu-docs/src/examples/rendering/3d-fish/schemas.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // schemas diff --git a/apps/typegpu-docs/src/examples/rendering/box-raytracing/index.ts b/apps/typegpu-docs/src/examples/rendering/box-raytracing/index.ts index b75bb209ef..463186b86c 100644 --- a/apps/typegpu-docs/src/examples/rendering/box-raytracing/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/box-raytracing/index.ts @@ -1,5 +1,5 @@ import { linearToSrgb, srgbToLinear } from '@typegpu/color'; -import tgpu, { d, type TgpuFragmentFn, type TgpuVertexFn } from 'typegpu'; +import { tgpu, d, type TgpuFragmentFn, type TgpuVertexFn } from 'typegpu'; import { discard, max, min, mul, normalize, pow, sub } from 'typegpu/std'; import { mat4 } from 'wgpu-matrix'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/caustics/index.ts b/apps/typegpu-docs/src/examples/rendering/caustics/index.ts index 3cbbc1df4e..4b15920d44 100644 --- a/apps/typegpu-docs/src/examples/rendering/caustics/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/caustics/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; import { setupScene } from './scene.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/caustics/scene.ts b/apps/typegpu-docs/src/examples/rendering/caustics/scene.ts index 33266135eb..c6b5b46aab 100644 --- a/apps/typegpu-docs/src/examples/rendering/caustics/scene.ts +++ b/apps/typegpu-docs/src/examples/rendering/caustics/scene.ts @@ -1,5 +1,5 @@ import { perlin3d } from '@typegpu/noise'; -import tgpu, { d, std, type TgpuRoot } from 'typegpu'; +import { tgpu, d, std, type TgpuRoot } from 'typegpu'; const mainVertex = tgpu.vertexFn({ in: { vertexIndex: d.builtin.vertexIndex }, diff --git a/apps/typegpu-docs/src/examples/rendering/clouds/index.ts b/apps/typegpu-docs/src/examples/rendering/clouds/index.ts index dd23f5f385..5f7290566f 100644 --- a/apps/typegpu-docs/src/examples/rendering/clouds/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/clouds/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { FOV_FACTOR, NOISE_TEXTURE_SIZE, diff --git a/apps/typegpu-docs/src/examples/rendering/clouds/types.ts b/apps/typegpu-docs/src/examples/rendering/clouds/types.ts index c4945fb27c..87de334d65 100644 --- a/apps/typegpu-docs/src/examples/rendering/clouds/types.ts +++ b/apps/typegpu-docs/src/examples/rendering/clouds/types.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const CloudsParams = d.struct({ time: d.f32, diff --git a/apps/typegpu-docs/src/examples/rendering/clouds/utils.ts b/apps/typegpu-docs/src/examples/rendering/clouds/utils.ts index 5f98475544..330f7c8818 100644 --- a/apps/typegpu-docs/src/examples/rendering/clouds/utils.ts +++ b/apps/typegpu-docs/src/examples/rendering/clouds/utils.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { CLOUD_AMPLITUDE, CLOUD_BRIGHT, diff --git a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/icosphere.ts b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/icosphere.ts index 7ce8f82f9e..19efd69904 100644 --- a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/icosphere.ts +++ b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/icosphere.ts @@ -1,5 +1,5 @@ import type { TgpuBuffer, TgpuComputePipeline, TgpuRoot, UniformFlag, VertexFlag } from 'typegpu'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { ComputeVertex, Vertex } from './dataTypes.ts'; import { calculateMidpoint, getAverageNormal, packVec2u, unpackVec2u } from './helpers.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts index cfe61bf002..26e9c18a97 100644 --- a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { type CubemapNames } from './cubemap.ts'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/scene.ts b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/scene.ts index c845d727c2..70a5e66876 100644 --- a/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/scene.ts +++ b/apps/typegpu-docs/src/examples/rendering/cubemap-reflection/scene.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std, type TgpuRoot } from 'typegpu'; +import { tgpu, d, std, type TgpuRoot } from 'typegpu'; import * as m from 'wgpu-matrix'; import { type CubemapNames, cubeVertices, loadCubemap } from './cubemap.ts'; import { Camera, CubeVertex, DirectionalLight, Material, Vertex } from './dataTypes.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/disco/consts.ts b/apps/typegpu-docs/src/examples/rendering/disco/consts.ts index c973c2d485..b2c5e6db00 100644 --- a/apps/typegpu-docs/src/examples/rendering/disco/consts.ts +++ b/apps/typegpu-docs/src/examples/rendering/disco/consts.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const timeAccess = tgpu.accessor(d.f32); export const resolutionAccess = tgpu.accessor(d.vec2f); // (width, height) diff --git a/apps/typegpu-docs/src/examples/rendering/disco/index.ts b/apps/typegpu-docs/src/examples/rendering/disco/index.ts index 85ecec9513..33ebe4b91e 100644 --- a/apps/typegpu-docs/src/examples/rendering/disco/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/disco/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { resolutionAccess, timeAccess } from './consts.ts'; import { mainFragment1, @@ -87,6 +87,7 @@ export const controls = defineControls({ }, 'Test Resolution': import.meta.env.DEV && { onButtonClick() { + // oxlint-disable-next-line import/namespace const namespace = tgpu['~unstable'].namespace(); Array.from({ length: 6 }).map((_, i) => root.device.createShaderModule({ diff --git a/apps/typegpu-docs/src/examples/rendering/disco/shaders/fragment.ts b/apps/typegpu-docs/src/examples/rendering/disco/shaders/fragment.ts index ad166f6b39..137559b989 100644 --- a/apps/typegpu-docs/src/examples/rendering/disco/shaders/fragment.ts +++ b/apps/typegpu-docs/src/examples/rendering/disco/shaders/fragment.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { resolutionAccess, timeAccess } from '../consts.ts'; import { palette } from '../utils.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/disco/shaders/vertex.ts b/apps/typegpu-docs/src/examples/rendering/disco/shaders/vertex.ts index 4648a86853..f0f4d301e4 100644 --- a/apps/typegpu-docs/src/examples/rendering/disco/shaders/vertex.ts +++ b/apps/typegpu-docs/src/examples/rendering/disco/shaders/vertex.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const mainVertex = tgpu.vertexFn({ in: { vertexIndex: d.builtin.vertexIndex }, diff --git a/apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts b/apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts index b426e67e53..a547923370 100644 --- a/apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/function-visualizer/index.ts @@ -1,5 +1,5 @@ import type { TgpuGuardedComputePipeline, TgpuRawCodeSnippet } from 'typegpu'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { mat4 } from 'wgpu-matrix'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-slider/dataTypes.ts b/apps/typegpu-docs/src/examples/rendering/jelly-slider/dataTypes.ts index 47cf5a4f2f..0f470b6ff7 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-slider/dataTypes.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-slider/dataTypes.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const DirectionalLight = d.struct({ direction: d.vec3f, diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts b/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts index 2e32a023b6..5e6a2b1f00 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-slider/taa.ts @@ -1,5 +1,5 @@ import type { TgpuComputePipeline, TgpuRoot, TgpuTextureView } from 'typegpu'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { taaResolveLayout } from './dataTypes.ts'; export const taaResolveFn = tgpu.computeFn({ diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-switch/dataTypes.ts b/apps/typegpu-docs/src/examples/rendering/jelly-switch/dataTypes.ts index 2830776156..4719a0cce3 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-switch/dataTypes.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-switch/dataTypes.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const DirectionalLight = d.struct({ direction: d.vec3f, diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts b/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts index a84d6f9e2f..69f7b99204 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-switch/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import * as sdf from '@typegpu/sdf'; import { randf } from '@typegpu/noise'; diff --git a/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts b/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts index 3ec98bf46b..a97d320e88 100644 --- a/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts +++ b/apps/typegpu-docs/src/examples/rendering/jelly-switch/taa.ts @@ -1,5 +1,5 @@ import type { TgpuComputePipeline, TgpuRoot, TgpuTextureView } from 'typegpu'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { taaResolveLayout } from './dataTypes.ts'; export const taaResolveFn = tgpu.computeFn({ diff --git a/apps/typegpu-docs/src/examples/rendering/os-awards/cubemap.ts b/apps/typegpu-docs/src/examples/rendering/os-awards/cubemap.ts index ff88ff4e94..52a4c8dfeb 100644 --- a/apps/typegpu-docs/src/examples/rendering/os-awards/cubemap.ts +++ b/apps/typegpu-docs/src/examples/rendering/os-awards/cubemap.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std, type TgpuRoot } from 'typegpu'; +import { tgpu, d, std, type TgpuRoot } from 'typegpu'; const convertLayout = tgpu.bindGroupLayout({ equirect: { texture: d.texture2d(d.f32) }, diff --git a/apps/typegpu-docs/src/examples/rendering/os-awards/index.ts b/apps/typegpu-docs/src/examples/rendering/os-awards/index.ts index fbaaf7f3f2..c2c67af3f0 100644 --- a/apps/typegpu-docs/src/examples/rendering/os-awards/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/os-awards/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import * as m from 'wgpu-matrix'; import { directionToEquirectUv, loadEnvironmentCubemap } from './cubemap.ts'; import { loadModel, ModelVertex } from './model.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/perlin-noise/index.ts b/apps/typegpu-docs/src/examples/rendering/perlin-noise/index.ts index 9d3de4ec8e..72f36af744 100644 --- a/apps/typegpu-docs/src/examples/rendering/perlin-noise/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/perlin-noise/index.ts @@ -1,5 +1,5 @@ import { perlin3d } from '@typegpu/noise'; -import tgpu, { common, d } from 'typegpu'; +import { tgpu, common, d } from 'typegpu'; import { abs, mix, mul, pow, sign, tanh } from 'typegpu/std'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/phong-reflection/index.ts b/apps/typegpu-docs/src/examples/rendering/phong-reflection/index.ts index 5005a7cdd6..e45e91208f 100644 --- a/apps/typegpu-docs/src/examples/rendering/phong-reflection/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/phong-reflection/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as p from './params.ts'; import { ExampleControls, diff --git a/apps/typegpu-docs/src/examples/rendering/phong-reflection/schemas.ts b/apps/typegpu-docs/src/examples/rendering/phong-reflection/schemas.ts index 6b294234b9..f8f13dddc2 100644 --- a/apps/typegpu-docs/src/examples/rendering/phong-reflection/schemas.ts +++ b/apps/typegpu-docs/src/examples/rendering/phong-reflection/schemas.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // schemas diff --git a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts index 6a047a4580..fbf700ce06 100644 --- a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { BoxGeometry } from './box-geometry.ts'; import { Camera } from './camera.ts'; import { PointLight } from './point-light.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/types.ts b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/types.ts index ebdcd0f5f6..ea35324b60 100644 --- a/apps/typegpu-docs/src/examples/rendering/point-light-shadow/types.ts +++ b/apps/typegpu-docs/src/examples/rendering/point-light-shadow/types.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const CameraData = d.struct({ viewProjectionMatrix: d.mat4x4f, diff --git a/apps/typegpu-docs/src/examples/rendering/pom/index.ts b/apps/typegpu-docs/src/examples/rendering/pom/index.ts index 7778bd2e79..4b5fc1f4ec 100644 --- a/apps/typegpu-docs/src/examples/rendering/pom/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/pom/index.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { d, std, type RenderFlag, type TgpuTexture } from 'typegpu'; +import { tgpu, d, std, type RenderFlag, type TgpuTexture } from 'typegpu'; import { Camera, setupOrbitCamera } from '../../common/setup-orbit-camera.ts'; import { defineControls } from '../../common/defineControls.ts'; import { diff --git a/apps/typegpu-docs/src/examples/rendering/pom/types.ts b/apps/typegpu-docs/src/examples/rendering/pom/types.ts index 644747af47..7dda70f828 100644 --- a/apps/typegpu-docs/src/examples/rendering/pom/types.ts +++ b/apps/typegpu-docs/src/examples/rendering/pom/types.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export const Vertex = d.struct({ position: d.vec3f, diff --git a/apps/typegpu-docs/src/examples/rendering/radiance-cascades-drawing/index.ts b/apps/typegpu-docs/src/examples/rendering/radiance-cascades-drawing/index.ts index 9d317a16a5..c82b0a917e 100644 --- a/apps/typegpu-docs/src/examples/rendering/radiance-cascades-drawing/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/radiance-cascades-drawing/index.ts @@ -1,6 +1,6 @@ import * as rc from '@typegpu/radiance-cascades'; import * as sdf from '@typegpu/sdf'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; import { createDrawInteraction } from './drawInteraction.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/radiance-cascades/index.ts b/apps/typegpu-docs/src/examples/rendering/radiance-cascades/index.ts index 2895fbc41e..15b96c6e1a 100644 --- a/apps/typegpu-docs/src/examples/rendering/radiance-cascades/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/radiance-cascades/index.ts @@ -4,7 +4,7 @@ // and the packaged example: // https://docs.swmansion.com/TypeGPU/examples#example=rendering--radiance-cascades-drawing import * as sdf from '@typegpu/sdf'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; import { DragController } from './drag-controller.ts'; import { SceneData, sceneData, sceneDataAccess, sceneSDF, updateElementPosition } from './scene.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/radiance-cascades/scene.ts b/apps/typegpu-docs/src/examples/rendering/radiance-cascades/scene.ts index a002a37f90..d1b306e499 100644 --- a/apps/typegpu-docs/src/examples/rendering/radiance-cascades/scene.ts +++ b/apps/typegpu-docs/src/examples/rendering/radiance-cascades/scene.ts @@ -1,5 +1,5 @@ import * as sdf from '@typegpu/sdf'; -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; export interface SceneElement { id: string; diff --git a/apps/typegpu-docs/src/examples/rendering/ray-marching/index.ts b/apps/typegpu-docs/src/examples/rendering/ray-marching/index.ts index 238a1a4ab3..2c33a63226 100644 --- a/apps/typegpu-docs/src/examples/rendering/ray-marching/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/ray-marching/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { setupScene } from './scene.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/ray-marching/scene.ts b/apps/typegpu-docs/src/examples/rendering/ray-marching/scene.ts index c7b144c11e..6c2b50b216 100644 --- a/apps/typegpu-docs/src/examples/rendering/ray-marching/scene.ts +++ b/apps/typegpu-docs/src/examples/rendering/ray-marching/scene.ts @@ -1,5 +1,5 @@ import { sdBoxFrame3d, sdPlane, sdSphere } from '@typegpu/sdf'; -import tgpu, { d, std, type TgpuRoot } from 'typegpu'; +import { tgpu, d, std, type TgpuRoot } from 'typegpu'; const MAX_STEPS = 1000; const MAX_DIST = 30; diff --git a/apps/typegpu-docs/src/examples/rendering/render-bundles-with/index.ts b/apps/typegpu-docs/src/examples/rendering/render-bundles-with/index.ts index ac7bf9f395..ebb184f6ef 100644 --- a/apps/typegpu-docs/src/examples/rendering/render-bundles-with/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/render-bundles-with/index.ts @@ -1,5 +1,5 @@ import { perlin2d } from '@typegpu/noise'; -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import * as m from 'wgpu-matrix'; import { defineControls } from '../../common/defineControls.ts'; import { setupOrbitCamera } from '../../common/setup-orbit-camera.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/render-bundles-with/schemas.ts b/apps/typegpu-docs/src/examples/rendering/render-bundles-with/schemas.ts index f1bef9b0ef..18046b88d8 100644 --- a/apps/typegpu-docs/src/examples/rendering/render-bundles-with/schemas.ts +++ b/apps/typegpu-docs/src/examples/rendering/render-bundles-with/schemas.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { Camera } from '../../common/setup-orbit-camera.ts'; export { Camera }; diff --git a/apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts b/apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts index 8d6702de51..3b0d6b6568 100644 --- a/apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts +++ b/apps/typegpu-docs/src/examples/rendering/render-bundles-with/shaders.ts @@ -1,5 +1,5 @@ import { perlin2d } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { cameraLayout, cubeLayout, terrainLayout, Vertex } from './schemas.ts'; const LOW_COLOR = d.vec3f(0.28, 0.52, 0.3); diff --git a/apps/typegpu-docs/src/examples/rendering/render-bundles/index.ts b/apps/typegpu-docs/src/examples/rendering/render-bundles/index.ts index dd0b073176..16dda08ae5 100644 --- a/apps/typegpu-docs/src/examples/rendering/render-bundles/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/render-bundles/index.ts @@ -1,5 +1,5 @@ import { perlin2d } from '@typegpu/noise'; -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import * as m from 'wgpu-matrix'; import { defineControls } from '../../common/defineControls.ts'; import { setupOrbitCamera } from '../../common/setup-orbit-camera.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/render-bundles/schemas.ts b/apps/typegpu-docs/src/examples/rendering/render-bundles/schemas.ts index f1bef9b0ef..18046b88d8 100644 --- a/apps/typegpu-docs/src/examples/rendering/render-bundles/schemas.ts +++ b/apps/typegpu-docs/src/examples/rendering/render-bundles/schemas.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { Camera } from '../../common/setup-orbit-camera.ts'; export { Camera }; diff --git a/apps/typegpu-docs/src/examples/rendering/render-bundles/shaders.ts b/apps/typegpu-docs/src/examples/rendering/render-bundles/shaders.ts index e1532d761a..e3a0f8f60f 100644 --- a/apps/typegpu-docs/src/examples/rendering/render-bundles/shaders.ts +++ b/apps/typegpu-docs/src/examples/rendering/render-bundles/shaders.ts @@ -1,5 +1,5 @@ import { perlin2d } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { cameraLayout, cubeLayout, terrainLayout, Vertex } from './schemas.ts'; const LOW_COLOR = d.vec3f(0.28, 0.52, 0.3); diff --git a/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts b/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts index 33fb648256..870fa136bc 100644 --- a/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/simple-shadow/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { mat4 } from 'wgpu-matrix'; import { createCuboid, createPlane } from './geometry.ts'; import { diff --git a/apps/typegpu-docs/src/examples/rendering/simple-shadow/schema.ts b/apps/typegpu-docs/src/examples/rendering/simple-shadow/schema.ts index f8fd4a6ddc..0d85943550 100644 --- a/apps/typegpu-docs/src/examples/rendering/simple-shadow/schema.ts +++ b/apps/typegpu-docs/src/examples/rendering/simple-shadow/schema.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; // Data structures export const Material = d.struct({ diff --git a/apps/typegpu-docs/src/examples/rendering/smoky-triangle/index.ts b/apps/typegpu-docs/src/examples/rendering/smoky-triangle/index.ts index bb750e7a7e..fd07d9fdc6 100644 --- a/apps/typegpu-docs/src/examples/rendering/smoky-triangle/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/smoky-triangle/index.ts @@ -1,5 +1,5 @@ import { perlin3d } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const Params = d.struct({ fromColor: d.vec3f, diff --git a/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts b/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts index c2c5b6450a..d1261b1e05 100644 --- a/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/suika-sdf/index.ts @@ -1,5 +1,5 @@ import * as sdf from '@typegpu/sdf'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { fullScreenTriangle } from 'typegpu/common'; import { DROP_Y, diff --git a/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts b/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts index 861674bf4e..833c6c12ce 100644 --- a/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts +++ b/apps/typegpu-docs/src/examples/rendering/suika-sdf/sdfGen.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import type { SampledFlag, TgpuRoot, TgpuSampler, TgpuTexture } from 'typegpu'; import { LEVEL_COUNT } from './constants.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts b/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts index feecac1b2a..170eefbe43 100644 --- a/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/two-boxes/index.ts @@ -1,5 +1,5 @@ import type { RenderFlag, TgpuBindGroup, TgpuBuffer, TgpuTexture, VertexFlag } from 'typegpu'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as m from 'wgpu-matrix'; // Initialization diff --git a/apps/typegpu-docs/src/examples/rendering/xor-dev-centrifuge-2/index.ts b/apps/typegpu-docs/src/examples/rendering/xor-dev-centrifuge-2/index.ts index 20dbe57d37..f6bdfc3924 100644 --- a/apps/typegpu-docs/src/examples/rendering/xor-dev-centrifuge-2/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/xor-dev-centrifuge-2/index.ts @@ -10,7 +10,7 @@ * ``` */ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { abs, atan2, cos, gt, length, normalize, select, sign, tanh } from 'typegpu/std'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/rendering/xor-dev-runner/index.ts b/apps/typegpu-docs/src/examples/rendering/xor-dev-runner/index.ts index 99225f1ed4..ee86a5a2c9 100644 --- a/apps/typegpu-docs/src/examples/rendering/xor-dev-runner/index.ts +++ b/apps/typegpu-docs/src/examples/rendering/xor-dev-runner/index.ts @@ -12,7 +12,7 @@ * ``` */ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { abs, add, cos, max, min, mul, select, sign, sin, sub, tanh } from 'typegpu/std'; import { defineControls } from '../../common/defineControls.ts'; import { Camera, setupFirstPersonCamera } from '../../common/setup-first-person-camera.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/gradient-tiles/index.ts b/apps/typegpu-docs/src/examples/simple/gradient-tiles/index.ts index f53a95ac67..dbda082b81 100644 --- a/apps/typegpu-docs/src/examples/simple/gradient-tiles/index.ts +++ b/apps/typegpu-docs/src/examples/simple/gradient-tiles/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/simple/increment/index.ts b/apps/typegpu-docs/src/examples/simple/increment/index.ts index f8db1a83a3..0485faab74 100644 --- a/apps/typegpu-docs/src/examples/simple/increment/index.ts +++ b/apps/typegpu-docs/src/examples/simple/increment/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts b/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts index fd572f9cef..7e7b5597bb 100644 --- a/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts +++ b/apps/typegpu-docs/src/examples/simple/liquid-glass/index.ts @@ -1,5 +1,5 @@ import { sdRoundedBox2d } from '@typegpu/sdf'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/simple/mesh-skinning/index.ts b/apps/typegpu-docs/src/examples/simple/mesh-skinning/index.ts index 56b4f8b62f..b915432827 100644 --- a/apps/typegpu-docs/src/examples/simple/mesh-skinning/index.ts +++ b/apps/typegpu-docs/src/examples/simple/mesh-skinning/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common } from 'typegpu'; +import { tgpu, common } from 'typegpu'; import * as d from 'typegpu/data'; import * as std from 'typegpu/std'; import { mat4, vec3 } from 'wgpu-matrix'; diff --git a/apps/typegpu-docs/src/examples/simple/oklab/index.ts b/apps/typegpu-docs/src/examples/simple/oklab/index.ts index 41dc549df1..9150cccb87 100644 --- a/apps/typegpu-docs/src/examples/simple/oklab/index.ts +++ b/apps/typegpu-docs/src/examples/simple/oklab/index.ts @@ -5,7 +5,7 @@ import { oklabToLinearRgb, oklabToRgb, } from '@typegpu/color'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const cssProbePosition = d.vec2f(0.5, 0.5); diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts index a7167823ff..f5eeef6853 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/background.ts @@ -1,6 +1,6 @@ import { perlin3d, randf } from '@typegpu/noise'; import type { TgpuRoot, TgpuTextureView } from 'typegpu'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { CUBEMAP_SIZE } from './constants.ts'; const spaceNebula = (rd: d.v3f): d.v3f => { diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts index 1ddb0d0a29..c9cf3e5bc4 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/index.ts @@ -1,6 +1,6 @@ import { perlin3d, randf } from '@typegpu/noise'; import * as sdf from '@typegpu/sdf'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { Camera, setupOrbitCamera } from '../../common/setup-orbit-camera.ts'; import { createBackgroundCubemap } from './background.ts'; import { GRID_SIZE, halton, LIGHT_COUNT, MAX_DIST, MAX_STEPS, SURF_DIST } from './constants.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/pbr.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/pbr.ts index e784da9f23..e0c2850bd7 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/pbr.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/pbr.ts @@ -1,5 +1,5 @@ import { perlin3d } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { LIGHT_COUNT, PI } from './constants.ts'; import { Light, Material } from './types.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts index 063c9af504..da14cf8b3a 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/post-processing.ts @@ -1,5 +1,5 @@ import type { ColorAttachment, TgpuRoot } from 'typegpu'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { fullScreenTriangle } from 'typegpu/common'; import { BLUR_RADIUS, TAA_BLEND } from './constants.ts'; import { BloomParams } from './types.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/ripple-cube/sdf-scene.ts b/apps/typegpu-docs/src/examples/simple/ripple-cube/sdf-scene.ts index 981b17fed9..35d70863b3 100644 --- a/apps/typegpu-docs/src/examples/simple/ripple-cube/sdf-scene.ts +++ b/apps/typegpu-docs/src/examples/simple/ripple-cube/sdf-scene.ts @@ -1,5 +1,5 @@ import * as sdf from '@typegpu/sdf'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; export const timeAccess = tgpu.accessor(d.f32); export const blendFactorAccess = tgpu.accessor(d.f32); diff --git a/apps/typegpu-docs/src/examples/simple/square/index.ts b/apps/typegpu-docs/src/examples/simple/square/index.ts index f4aa851d4d..4d94260076 100644 --- a/apps/typegpu-docs/src/examples/simple/square/index.ts +++ b/apps/typegpu-docs/src/examples/simple/square/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/simple/stencil/index.ts b/apps/typegpu-docs/src/examples/simple/stencil/index.ts index 2cfdb28016..7860359473 100644 --- a/apps/typegpu-docs/src/examples/simple/stencil/index.ts +++ b/apps/typegpu-docs/src/examples/simple/stencil/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; const root = await tgpu.init(); const canvas = document.querySelector('canvas') as HTMLCanvasElement; diff --git a/apps/typegpu-docs/src/examples/simple/triangle/index.ts b/apps/typegpu-docs/src/examples/simple/triangle/index.ts index 5794dfc374..f785d16d01 100644 --- a/apps/typegpu-docs/src/examples/simple/triangle/index.ts +++ b/apps/typegpu-docs/src/examples/simple/triangle/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; // Constants and helper functions diff --git a/apps/typegpu-docs/src/examples/simple/vaporrave/floor.ts b/apps/typegpu-docs/src/examples/simple/vaporrave/floor.ts index c9df8462c6..2c918d8cd4 100644 --- a/apps/typegpu-docs/src/examples/simple/vaporrave/floor.ts +++ b/apps/typegpu-docs/src/examples/simple/vaporrave/floor.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as c from './constants.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/vaporrave/helpers.ts b/apps/typegpu-docs/src/examples/simple/vaporrave/helpers.ts index f024898b6f..6d5cb2be1e 100644 --- a/apps/typegpu-docs/src/examples/simple/vaporrave/helpers.ts +++ b/apps/typegpu-docs/src/examples/simple/vaporrave/helpers.ts @@ -1,4 +1,4 @@ -import tgpu, { std } from 'typegpu'; +import { tgpu, std } from 'typegpu'; import { Ray } from './types.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/vaporrave/index.ts b/apps/typegpu-docs/src/examples/simple/vaporrave/index.ts index b6f51f281e..ecd73f235b 100644 --- a/apps/typegpu-docs/src/examples/simple/vaporrave/index.ts +++ b/apps/typegpu-docs/src/examples/simple/vaporrave/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import * as c from './constants.ts'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/vaporrave/scene.ts b/apps/typegpu-docs/src/examples/simple/vaporrave/scene.ts index 7de2e21007..0eab46071a 100644 --- a/apps/typegpu-docs/src/examples/simple/vaporrave/scene.ts +++ b/apps/typegpu-docs/src/examples/simple/vaporrave/scene.ts @@ -1,6 +1,6 @@ import { perlin3d } from '@typegpu/noise'; import { sdPlane } from '@typegpu/sdf'; -import tgpu, { d, std, type TgpuRoot } from 'typegpu'; +import { tgpu, d, std, type TgpuRoot } from 'typegpu'; import * as c from './constants.ts'; import { circles, grid } from './floor.ts'; diff --git a/apps/typegpu-docs/src/examples/simple/vaporrave/sphere.ts b/apps/typegpu-docs/src/examples/simple/vaporrave/sphere.ts index 41c5d10624..7b01f8fb50 100644 --- a/apps/typegpu-docs/src/examples/simple/vaporrave/sphere.ts +++ b/apps/typegpu-docs/src/examples/simple/vaporrave/sphere.ts @@ -1,6 +1,6 @@ import { perlin3d } from '@typegpu/noise'; import { sdSphere } from '@typegpu/sdf'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as c from './constants.ts'; import { Ray } from './types.ts'; diff --git a/apps/typegpu-docs/src/examples/simulation/boids/index.ts b/apps/typegpu-docs/src/examples/simulation/boids/index.ts index 0f484559cb..996198b0ce 100644 --- a/apps/typegpu-docs/src/examples/simulation/boids/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/boids/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const triangleAmount = 1000; diff --git a/apps/typegpu-docs/src/examples/simulation/confetti/index.ts b/apps/typegpu-docs/src/examples/simulation/confetti/index.ts index f92e441102..97a4d007ea 100644 --- a/apps/typegpu-docs/src/examples/simulation/confetti/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/confetti/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; // constants diff --git a/apps/typegpu-docs/src/examples/simulation/fluid-double-buffering/index.ts b/apps/typegpu-docs/src/examples/simulation/fluid-double-buffering/index.ts index 06b40b268a..13094f052d 100644 --- a/apps/typegpu-docs/src/examples/simulation/fluid-double-buffering/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/fluid-double-buffering/index.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { d, std, type TgpuBufferMutable, type TgpuBufferReadonly } from 'typegpu'; +import { tgpu, d, std, type TgpuBufferMutable, type TgpuBufferReadonly } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const MAX_GRID_SIZE = 1024; diff --git a/apps/typegpu-docs/src/examples/simulation/fluid-with-atomics/index.ts b/apps/typegpu-docs/src/examples/simulation/fluid-with-atomics/index.ts index 3e550a0eff..45add979d1 100644 --- a/apps/typegpu-docs/src/examples/simulation/fluid-with-atomics/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/fluid-with-atomics/index.ts @@ -1,5 +1,5 @@ import { sdLine } from '@typegpu/sdf'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts index f6276a9478..d7f57cad9e 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/index.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import type { SampledFlag, StorageFlag, TgpuBindGroup, TgpuComputeFn, TgpuTexture } from 'typegpu'; import { computeLayout, displayLayout, gameSizeAccessor, TILE_SIZE } from './shaders/common.ts'; import { tiledCompute } from './shaders/tiled-compute.ts'; diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/bitpacked-compute.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/bitpacked-compute.ts index 77ff35bb18..6b6276884a 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/bitpacked-compute.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/bitpacked-compute.ts @@ -1,6 +1,4 @@ -import * as d from 'typegpu/data'; -import * as std from 'typegpu/std'; -import tgpu from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { computeLayout, gameSizeAccessor, TILE_SIZE } from './common.ts'; // oxfmt-ignore diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/common.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/common.ts index 4f2ee34708..2997a87c0d 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/common.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/common.ts @@ -1,6 +1,4 @@ -import tgpu from 'typegpu'; -import * as d from 'typegpu/data'; -import * as std from 'typegpu/std'; +import { tgpu, d, std } from 'typegpu'; export const computeLayout = tgpu.bindGroupLayout({ current: { texture: d.texture2d(d.u32) }, diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/fragment.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/fragment.ts index 32ca811f54..3d570141a4 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/fragment.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/fragment.ts @@ -1,6 +1,4 @@ -import tgpu from 'typegpu'; -import * as d from 'typegpu/data'; -import * as std from 'typegpu/std'; +import { tgpu, d, std } from 'typegpu'; export const fragmentFn = tgpu.fragmentFn({ in: { diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/naive-compute.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/naive-compute.ts index 869636aef2..30359fbb74 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/naive-compute.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/naive-compute.ts @@ -1,6 +1,4 @@ -import tgpu from 'typegpu'; -import * as d from 'typegpu/data'; -import * as std from 'typegpu/std'; +import { tgpu, d, std } from 'typegpu'; import { computeLayout, gameSizeAccessor, loadTexAt, TILE_SIZE } from './common.ts'; export const naiveCompute = tgpu.computeFn({ diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/tiled-compute.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/tiled-compute.ts index e47a5db799..7e40275a49 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/tiled-compute.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/tiled-compute.ts @@ -1,6 +1,4 @@ -import * as d from 'typegpu/data'; -import * as std from 'typegpu/std'; -import tgpu from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { computeLayout, gameSizeAccessor, golNextState, TILE_SIZE } from './common.ts'; const HALO = 1; diff --git a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/vertex.ts b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/vertex.ts index 40cd615161..d8ca1aea8c 100644 --- a/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/vertex.ts +++ b/apps/typegpu-docs/src/examples/simulation/game-of-life/shaders/vertex.ts @@ -1,6 +1,4 @@ -import tgpu from 'typegpu'; -import * as d from 'typegpu/data'; -import * as std from 'typegpu/std'; +import { tgpu, d, std } from 'typegpu'; export const sizeSlot = tgpu.slot(d.vec2u(64, 64)); diff --git a/apps/typegpu-docs/src/examples/simulation/gravity/compute.ts b/apps/typegpu-docs/src/examples/simulation/gravity/compute.ts index 850937de7d..f1b653e5d3 100644 --- a/apps/typegpu-docs/src/examples/simulation/gravity/compute.ts +++ b/apps/typegpu-docs/src/examples/simulation/gravity/compute.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { collisionBehaviors } from './enums.ts'; import { radiusOf } from './helpers.ts'; import { CelestialBody, computeLayout, timeAccess } from './schemas.ts'; diff --git a/apps/typegpu-docs/src/examples/simulation/gravity/index.ts b/apps/typegpu-docs/src/examples/simulation/gravity/index.ts index 39601f5c9e..613cb24061 100644 --- a/apps/typegpu-docs/src/examples/simulation/gravity/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/gravity/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, type StorageFlag, type TgpuBindGroup, type TgpuBuffer } from 'typegpu'; +import { tgpu, d, type StorageFlag, type TgpuBindGroup, type TgpuBuffer } from 'typegpu'; import { computeCollisionsShader, computeGravityShader } from './compute.ts'; import { collisionBehaviors, diff --git a/apps/typegpu-docs/src/examples/simulation/gravity/render.ts b/apps/typegpu-docs/src/examples/simulation/gravity/render.ts index 3f968def2a..087baf0a37 100644 --- a/apps/typegpu-docs/src/examples/simulation/gravity/render.ts +++ b/apps/typegpu-docs/src/examples/simulation/gravity/render.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { radiusOf } from './helpers.ts'; import { cameraAccess, diff --git a/apps/typegpu-docs/src/examples/simulation/gravity/schemas.ts b/apps/typegpu-docs/src/examples/simulation/gravity/schemas.ts index 452c414231..4c53b4dc9e 100644 --- a/apps/typegpu-docs/src/examples/simulation/gravity/schemas.ts +++ b/apps/typegpu-docs/src/examples/simulation/gravity/schemas.ts @@ -1,4 +1,4 @@ -import tgpu, { d, type TgpuSampler } from 'typegpu'; +import { tgpu, d, type TgpuSampler } from 'typegpu'; import { Camera } from '../../common/setup-orbit-camera.ts'; export type CelestialBody = d.Infer; diff --git a/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts b/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts index dbe6d00016..7d821abc59 100644 --- a/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/slime-mold-3d/index.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import * as m from 'wgpu-matrix'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts b/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts index ecc3184d6f..46a53589d0 100644 --- a/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/slime-mold/index.ts @@ -1,5 +1,5 @@ import { randf } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts b/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts index 420c81d294..5bc17e56ab 100644 --- a/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/stable-fluid/index.ts @@ -1,4 +1,5 @@ -import tgpu, { +import { + tgpu, d, type TgpuBindGroup, type TgpuComputeFn, diff --git a/apps/typegpu-docs/src/examples/simulation/stable-fluid/render.ts b/apps/typegpu-docs/src/examples/simulation/stable-fluid/render.ts index 0e9aba9c4a..27fafe2073 100644 --- a/apps/typegpu-docs/src/examples/simulation/stable-fluid/render.ts +++ b/apps/typegpu-docs/src/examples/simulation/stable-fluid/render.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import { SIM_N } from './params.ts'; export const renderLayout = tgpu.bindGroupLayout({ diff --git a/apps/typegpu-docs/src/examples/simulation/stable-fluid/simulation.ts b/apps/typegpu-docs/src/examples/simulation/stable-fluid/simulation.ts index 492855b4e4..c888fb2aeb 100644 --- a/apps/typegpu-docs/src/examples/simulation/stable-fluid/simulation.ts +++ b/apps/typegpu-docs/src/examples/simulation/stable-fluid/simulation.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; import * as p from './params.ts'; const getNeighbors = (coords: d.v2i, bounds: d.v2i): d.v2i[] => { diff --git a/apps/typegpu-docs/src/examples/simulation/wind-map/index.ts b/apps/typegpu-docs/src/examples/simulation/wind-map/index.ts index 2ac9277b7c..8dc74d5f09 100644 --- a/apps/typegpu-docs/src/examples/simulation/wind-map/index.ts +++ b/apps/typegpu-docs/src/examples/simulation/wind-map/index.ts @@ -6,7 +6,7 @@ import { polylineVariableWidth, startCapSlot, } from '@typegpu/geometry'; -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import { arrayOf, builtin, f32, i32, struct, u16, u32, vec2f, vec4f } from 'typegpu/data'; import { clamp, mix, normalize, select } from 'typegpu/std'; import { defineControls } from '../../common/defineControls.ts'; diff --git a/apps/typegpu-docs/src/examples/tests/buffer-write-benchmark/index.ts b/apps/typegpu-docs/src/examples/tests/buffer-write-benchmark/index.ts index f58bfa02e9..f5d79614c4 100644 --- a/apps/typegpu-docs/src/examples/tests/buffer-write-benchmark/index.ts +++ b/apps/typegpu-docs/src/examples/tests/buffer-write-benchmark/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/tests/dispatch/index.ts b/apps/typegpu-docs/src/examples/tests/dispatch/index.ts index c3b0c2cbaa..f0e178a8c9 100644 --- a/apps/typegpu-docs/src/examples/tests/dispatch/index.ts +++ b/apps/typegpu-docs/src/examples/tests/dispatch/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/tests/log-test/index.ts b/apps/typegpu-docs/src/examples/tests/log-test/index.ts index 585a9bccbb..35f411688e 100644 --- a/apps/typegpu-docs/src/examples/tests/log-test/index.ts +++ b/apps/typegpu-docs/src/examples/tests/log-test/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std, type TgpuVertexFn } from 'typegpu'; +import { tgpu, d, std, type TgpuVertexFn } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init({ diff --git a/apps/typegpu-docs/src/examples/tests/prefix-scan/functions.ts b/apps/typegpu-docs/src/examples/tests/prefix-scan/functions.ts index 9f086f1cf9..c75068e8f9 100644 --- a/apps/typegpu-docs/src/examples/tests/prefix-scan/functions.ts +++ b/apps/typegpu-docs/src/examples/tests/prefix-scan/functions.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import * as d from 'typegpu/data'; import * as std from 'typegpu/std'; import type { BinaryOp } from '@typegpu/sort'; diff --git a/apps/typegpu-docs/src/examples/tests/prefix-scan/index.ts b/apps/typegpu-docs/src/examples/tests/prefix-scan/index.ts index 87c3d2b779..9049fd9982 100644 --- a/apps/typegpu-docs/src/examples/tests/prefix-scan/index.ts +++ b/apps/typegpu-docs/src/examples/tests/prefix-scan/index.ts @@ -1,4 +1,4 @@ -import tgpu from 'typegpu'; +import { tgpu } from 'typegpu'; import * as d from 'typegpu/data'; import { type BinaryOp, prefixScan, scan } from '@typegpu/sort'; import * as std from 'typegpu/std'; diff --git a/apps/typegpu-docs/src/examples/tests/rc-docs-examples/index.ts b/apps/typegpu-docs/src/examples/tests/rc-docs-examples/index.ts index cd1b337b22..b4652a5d46 100644 --- a/apps/typegpu-docs/src/examples/tests/rc-docs-examples/index.ts +++ b/apps/typegpu-docs/src/examples/tests/rc-docs-examples/index.ts @@ -1,6 +1,6 @@ import * as rc from '@typegpu/radiance-cascades'; import * as sdf from '@typegpu/sdf'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/tests/sdf-docs-examples/index.ts b/apps/typegpu-docs/src/examples/tests/sdf-docs-examples/index.ts index 8702000434..22b32eaf33 100644 --- a/apps/typegpu-docs/src/examples/tests/sdf-docs-examples/index.ts +++ b/apps/typegpu-docs/src/examples/tests/sdf-docs-examples/index.ts @@ -1,5 +1,5 @@ import * as sdf from '@typegpu/sdf'; -import tgpu, { common, d, std } from 'typegpu'; +import { tgpu, common, d, std } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/tests/texture-test/index.ts b/apps/typegpu-docs/src/examples/tests/texture-test/index.ts index 9b0f7efccf..9de885a762 100644 --- a/apps/typegpu-docs/src/examples/tests/texture-test/index.ts +++ b/apps/typegpu-docs/src/examples/tests/texture-test/index.ts @@ -1,4 +1,4 @@ -import tgpu, { common, d } from 'typegpu'; +import { tgpu, common, d } from 'typegpu'; import { defineControls } from '../../common/defineControls.ts'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/array-and-struct-constructors.ts b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/array-and-struct-constructors.ts index 9a77cf0f71..78b9ba51a4 100644 --- a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/array-and-struct-constructors.ts +++ b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/array-and-struct-constructors.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const SimpleStruct = d.struct({ vec: d.vec2f }); const SimpleArray = d.arrayOf(d.i32, 2); diff --git a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/index.ts b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/index.ts index 404fc1e25a..3cf1fcfbab 100644 --- a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/index.ts +++ b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d } from 'typegpu'; +import { tgpu, d } from 'typegpu'; import { arrayAndStructConstructorsTest } from './array-and-struct-constructors.ts'; import { infixOperatorsTests } from './infix-operators.ts'; import { logicalExpressionTests } from './logical-expressions.ts'; diff --git a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/infix-operators.ts b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/infix-operators.ts index c76799aa59..9de06a8ca0 100644 --- a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/infix-operators.ts +++ b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/infix-operators.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const getVec = tgpu.fn([], d.vec3f)(() => d.vec3f(1, 2, 3)); diff --git a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/logical-expressions.ts b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/logical-expressions.ts index b6807232ce..1e79f6a257 100644 --- a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/logical-expressions.ts +++ b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/logical-expressions.ts @@ -1,5 +1,5 @@ // oxlint-disable typescript/no-unnecessary-boolean-literal-compare -- this is a test -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const Schema = d.struct({ vec2b: d.vec2b, diff --git a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/matrix-ops.ts b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/matrix-ops.ts index 6e1f80f6df..46517fb9a7 100644 --- a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/matrix-ops.ts +++ b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/matrix-ops.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; // TODO: replace `s = s &&` with `s &&=` when implemented export const matrixOpsTests = tgpu.fn( diff --git a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/pointers.ts b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/pointers.ts index dcb1c86460..0119b0a3c8 100644 --- a/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/pointers.ts +++ b/apps/typegpu-docs/src/examples/tests/tgsl-parsing-test/pointers.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const SimpleStruct = d.struct({ vec: d.vec2f }); diff --git a/apps/typegpu-docs/src/examples/tests/uniformity/index.ts b/apps/typegpu-docs/src/examples/tests/uniformity/index.ts index 62267e1c4a..fb9194ee06 100644 --- a/apps/typegpu-docs/src/examples/tests/uniformity/index.ts +++ b/apps/typegpu-docs/src/examples/tests/uniformity/index.ts @@ -1,5 +1,5 @@ import { randf, randomGeneratorSlot } from '@typegpu/noise'; -import tgpu, { common, d, std, type TgpuRenderPipeline } from 'typegpu'; +import { tgpu, common, d, std, type TgpuRenderPipeline } from 'typegpu'; import * as c from './constants.ts'; import { getPRNG, type PRNG } from './prngs.ts'; diff --git a/apps/typegpu-docs/src/examples/tests/uniformity/lcg.ts b/apps/typegpu-docs/src/examples/tests/uniformity/lcg.ts index f6bffe867c..d9db09be43 100644 --- a/apps/typegpu-docs/src/examples/tests/uniformity/lcg.ts +++ b/apps/typegpu-docs/src/examples/tests/uniformity/lcg.ts @@ -1,5 +1,5 @@ import type { StatefulGenerator } from '@typegpu/noise'; -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; export const LCG: StatefulGenerator = (() => { const seed = tgpu.privateVar(d.u32); diff --git a/apps/typegpu-docs/src/examples/tests/wgsl-resolution/index.ts b/apps/typegpu-docs/src/examples/tests/wgsl-resolution/index.ts index 84f3261344..7bcc04609a 100644 --- a/apps/typegpu-docs/src/examples/tests/wgsl-resolution/index.ts +++ b/apps/typegpu-docs/src/examples/tests/wgsl-resolution/index.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const root = await tgpu.init(); diff --git a/apps/typegpu-docs/src/examples/threejs/compute-cloth/triNoise.ts b/apps/typegpu-docs/src/examples/threejs/compute-cloth/triNoise.ts index 33af55c481..c4227a539a 100644 --- a/apps/typegpu-docs/src/examples/threejs/compute-cloth/triNoise.ts +++ b/apps/typegpu-docs/src/examples/threejs/compute-cloth/triNoise.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; const tri = (x: number): number => { 'use gpu'; diff --git a/apps/typegpu-docs/src/examples/threejs/test-reused-functions/functions.ts b/apps/typegpu-docs/src/examples/threejs/test-reused-functions/functions.ts index 650cbda179..b73951ee8e 100644 --- a/apps/typegpu-docs/src/examples/threejs/test-reused-functions/functions.ts +++ b/apps/typegpu-docs/src/examples/threejs/test-reused-functions/functions.ts @@ -1,4 +1,4 @@ -import tgpu, { d, std } from 'typegpu'; +import { tgpu, d, std } from 'typegpu'; export const getColorA = () => { 'use gpu';