Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
e6f2c8a
header
lursz Oct 7, 2025
c2edc37
hero init
lursz Oct 7, 2025
ddace29
footer init
lursz Oct 7, 2025
2cf09a2
gradient button
lursz Oct 8, 2025
75bb4c4
code editor init
lursz Oct 8, 2025
38d7824
created code switch buttons
lursz Oct 8, 2025
aadacca
code switch
lursz Oct 11, 2025
9404e7e
complete code editors
lursz Oct 12, 2025
7f4de6f
cleanup
lursz Oct 13, 2025
56ec9a1
pc styling
lursz Oct 13, 2025
a9b0882
example gallery init
lursz Oct 13, 2025
6be0637
gif
lursz Oct 13, 2025
60505c1
🦕
lursz Oct 13, 2025
909389d
buttons for code buttons
lursz Oct 13, 2025
b60342d
thumbnails
lursz Oct 13, 2025
958c1f8
backlog init
lursz Oct 13, 2025
fc4daec
canvas full width
lursz Oct 14, 2025
f1fcfd5
backlog complete
lursz Oct 14, 2025
d53a459
resize canvas
lursz Oct 14, 2025
434e551
videos section
lursz Oct 16, 2025
da15433
video title inset
lursz Oct 16, 2025
629a67f
mobile 🦕
lursz Oct 17, 2025
b4766f5
dark theme
lursz Oct 22, 2025
a4df24c
example labels
lursz Oct 22, 2025
df29ddb
complete content
lursz Oct 22, 2025
67267af
on hover on mobile
lursz Oct 23, 2025
ab1629c
hint box
lursz Oct 23, 2025
cc60d7b
better buttons
lursz Oct 24, 2025
0e69701
layout changes
lursz Oct 24, 2025
b89144f
🦕
lursz Nov 2, 2025
84b8401
Merge branch 'main' into feat/homepage
lursz Nov 4, 2025
c1933b1
jelly in, perlin out
lursz Nov 4, 2025
d382b96
🦕🦕
lursz Nov 4, 2025
7831a11
Merge branch 'main' into feat/homepage
lursz Nov 4, 2025
5d0c60b
theme switcher fix
lursz Nov 5, 2025
3f9378b
consistent bg-dark
lursz Nov 5, 2025
4b833dd
layout squeeze
lursz Nov 6, 2025
9040969
Merge branch 'main' into feat/homepage
lursz Nov 7, 2025
f4078b3
Merge branch 'main' into feat/homepage
lursz Nov 12, 2025
b51f98e
pixel perfect ligma
lursz Nov 19, 2025
9516260
whole example button is clickable
lursz Nov 20, 2025
b15b3a2
video reformat
lursz Nov 20, 2025
fd00a90
finished layout polishing
lursz Nov 21, 2025
029da25
Merge branch 'main' into feat/homepage
lursz Nov 21, 2025
06a0882
homepage mobile layout
lursz Nov 25, 2025
84a591f
all webp
lursz Nov 27, 2025
6799167
hscroll fix:
lursz Dec 2, 2025
ee767e8
solid baseline
lursz Dec 4, 2025
d47d819
done
lursz Dec 4, 2025
f083bc5
working
lursz Dec 4, 2025
4365677
using atom to hold active example
lursz Dec 4, 2025
30d2ae3
refactor
lursz Dec 4, 2025
840cd31
md fixes
lursz Dec 5, 2025
23c16e1
Merge branch 'main' into feat/homepage
lursz Dec 8, 2025
b7b7e8e
new code snippets
lursz Dec 8, 2025
2255a82
Merge branch 'main' into feat/homepage
lursz Dec 8, 2025
5e5fc09
🦕🦕🦕
lursz Dec 8, 2025
4272629
Merge remote-tracking branch 'refs/remotes/origin/feat/homepage' into…
lursz Dec 8, 2025
a9f75c9
🦕🦕
lursz Dec 8, 2025
a7eb6c2
maybe github dark pro is bundled bruh
lursz Dec 8, 2025
d8f4bc4
bundled theme
lursz Dec 8, 2025
d9d71ba
no transition gg
lursz Dec 8, 2025
56d32c6
width 🦕
lursz Dec 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
new code snippets
  • Loading branch information
lursz committed Dec 8, 2025
commit b7b7e8efbdeb21a9c3c9ae4b40edd27e04180122
200 changes: 92 additions & 108 deletions apps/typegpu-docs/src/components/CodeShowcase.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,133 +10,117 @@ const sectionId = "interactive-code-section";

<div class="flex flex-col" id={sectionId}>
<div
class=""
class="flex gap-4 sm:grid sm:grid-cols-3 -mx-6 px-6 pb-2 sm:overflow-visible overflow-x-auto horizontal-scroll"
>
<div
class="flex gap-4 sm:grid sm:grid-cols-3 -mx-6 px-6 pb-2 sm:overflow-visible overflow-x-auto horizontal-scroll"
class="flex-shrink-0 opacity-60 hover:opacity-100 w-72 sm:w-auto transition-opacity duration-200 ease-in-out cursor-pointer code-button-wrapper"
>
<div
class="flex-shrink-0 opacity-60 hover:opacity-100 w-72 sm:w-auto transition-opacity duration-200 ease-in-out cursor-pointer code-button-wrapper"
>
<CodeButton
title="As a foundation"
message="TypeGPU smooths out the tough parts of WebGPU without boxing you in."
icon={for_libraries}
/>
</div>
<div
class="flex-shrink-0 opacity-60 hover:opacity-100 w-72 sm:w-auto transition-opacity duration-200 ease-in-out cursor-pointer code-button-wrapper"
>
<CodeButton
title="As a puzzle piece"
message="Pick and choose the APIs, then plug them into your code however you want."
icon={as_a_puzzle_piece}
/>
</div>
<div
class="flex-shrink-0 opacity-60 hover:opacity-100 w-72 sm:w-auto transition-opacity duration-200 ease-in-out cursor-pointer code-button-wrapper"
>
<CodeButton
title="For libraries"
message="Simplify library internals, and make your user-facing API type-safe by default."
icon={as_a_foundation}
/>
</div>
<CodeButton
title="As a foundation"
message="TypeGPU smooths out the tough parts of WebGPU without boxing you in."
icon={for_libraries}
/>
</div>
<div
class="flex-shrink-0 opacity-60 hover:opacity-100 w-72 sm:w-auto transition-opacity duration-200 ease-in-out cursor-pointer code-button-wrapper"
>
<CodeButton
title="As a puzzle piece"
message="Pick and choose the APIs, then plug them into your code however you want."
icon={as_a_puzzle_piece}
/>
</div>
<div
class="flex-shrink-0 opacity-60 hover:opacity-100 w-72 sm:w-auto transition-opacity duration-200 ease-in-out cursor-pointer code-button-wrapper"
>
<CodeButton
title="For libraries"
message="Simplify library internals, and make your user-facing API type-safe by default."
icon={as_a_foundation}
/>
</div>
</div>

<div class="codepen-container">
<CodePen
code={`export interface TgpuComputePipeline
extends TgpuNamable, SelfResolvable, Timeable {
readonly [$internal]: ComputePipelineInternals;
readonly resourceType: 'compute-pipeline';

with(
bindGroupLayout: TgpuBindGroupLayout,
bindGroup: TgpuBindGroup,
): TgpuComputePipeline;

dispatchWorkgroups(
x: number,
y?: number | undefined,
z?: number | undefined,
): void;
}

export function INTERNAL_createComputePipeline(
branch: ExperimentalTgpuRoot,
slotBindings: [TgpuSlot<unknown>, unknown][],
entryFn: TgpuComputeFn,
) {
return new TgpuComputePipelineImpl(
new ComputePipelineCore(branch, slotBindings, entryFn),
{},
);
}`}
code={`const neighborhood = (a: number, r: number) => {
'use gpu';
return d.vec2f(a - r, a + r);
};

//
// #1) Can be called in JS
//
const range = neighborhood(1.1, 0.5);
// ^? d.v2f

//
// #2) Used to generate WGSL
//
const main = () => {
'use gpu';
return neighborhood(1.1, 0.5);
};

const wgsl = tgpu.resolve([main]);
// ^? string

//
// #3) Executed on the GPU (generates WGSL underneath)
//
root['~unstable']
.createGuardedComputePipeline(main)
.dispatchThreads();`}
language="typescript"
/>
<CodePen
code={`export function INTERNAL_createComputePipeline(
branch: ExperimentalTgpuRoot,
slotBindings: [TgpuSlot<unknown>, unknown][],
entryFn: TgpuComputeFn,
) {
return new TgpuComputePipelineImpl(
new ComputePipelineCore(branch, slotBindings, entryFn),
{},
);
export interface TgpuComputePipeline
extends TgpuNamable, SelfResolvable, Timeable {
readonly [$internal]: ComputePipelineInternals;
readonly resourceType: 'compute-pipeline';
code={`import type { StorageFlag, TgpuBuffer, TgpuRoot } from 'typegpu';
import * as d from 'typegpu/data';

// We can define schemas, or functions that return schemas...
const HeightMap = (width: number, height: number) =>
d.arrayOf(d.arrayOf(d.f32, height), width);

with(
bindGroupLayout: TgpuBindGroupLayout,
bindGroup: TgpuBindGroup,
): TgpuComputePipeline;
// ...then infer types from them
type HeightMap = ReturnType<typeof HeightMap>;

dispatchWorkgroups(
x: number,
y?: number | undefined,
z?: number | undefined,
): void;
}
export async function generateHeightMap(
root: TgpuRoot,
opts: { width: number; height: number },
): Promise<TgpuBuffer<HeightMap> & StorageFlag> {
const buffer = root
.createBuffer(HeightMap(opts.width, opts.height))
.$usage('storage');

const rawBuffer = root.unwrap(buffer); // => GPUBuffer

// Here we can do anything we would usually do with a
// WebGPU buffer, like populating it in a compute shader.
// 'rawBuffer' is the WebGPU resource that is backing the
// typed 'buffer' object, meaning any changes to it will
// be visible in both.

return buffer;
}`}
language="typescript"
/>
<CodePen
code={`// Create a buffer with a specific data type
export function INTERNAL_createComputePipeline(
branch: ExperimentalTgpuRoot,
slotBindings: [TgpuSlot<unknown>, unknown][],
entryFn: TgpuComputeFn,
) {
return new TgpuComputePipelineImpl(
new ComputePipelineCore(branch, slotBindings, entryFn),
{},
);
with(
bindGroupLayout: TgpuBindGroupLayout,
bindGroup: TgpuBindGroup,
): TgpuComputePipeline;

dispatchWorkgroups(
x: number,
y?: number | undefined,
z?: number | undefined,
): void;
export interface TgpuComputePipeline
extends TgpuNamable, SelfResolvable, Timeable {
readonly [$internal]: ComputePipelineInternals;
readonly resourceType: 'compute-pipeline';


}

}`}
code={`import tgpu from 'typegpu';
import gen from '@xyz/gen';
import plot from '@abc/plot';

// common root for allocating resources
const root = await tgpu.init();

const terrainBuffer = await gen.generateHeightMap(root, { ... });
// ^? TgpuBuffer<WgslArray<WgslArray<F32>>> & StorageFlag

// ERROR: Argument of type 'TgpuBuffer<WgslArray<WgslArray<F32>>>' is
// not assignable to parameter of type 'TgpuBuffer<WgslArray<F32>>>'
plot.array1d(root, terrainBuffer);

// SUCCESS!
plot.array2d(root, terrainBuffer);}`}
language="typescript"
/>
</div>
Expand Down
16 changes: 8 additions & 8 deletions apps/typegpu-docs/src/pages/new/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ import PageLayout from "../../layouts/PageLayout.astro";
<CodeShowcase />
<div class="flex md:flex-row flex-col md:justify-between gap-6 md:gap-0">
<h3
class="font-normal text-blue-950 dark:text-gray-100 text-xl md:text-4xl center"
class="font-medium text-blue-950 dark:text-gray-100 text-xl md:text-2xl center"
>
Read more about TypeGPU
</h3>
Expand All @@ -150,12 +150,12 @@ import PageLayout from "../../layouts/PageLayout.astro";
>
<div class="flex flex-col gap-6 pb-14">
<h2
class="font-normal text-blue-950 dark:text-gray-100 text-2xlmd:text-4xl center"
class="font-medium text-blue-950 dark:text-gray-100 text-2xl md:text-4xl center"
>
Explore TypeGPU examples
</h2>
<p
class="text-blue-950 dark:text-gray-300 text-lg md:text-2xl text-pretty"
class="text-blue-950 dark:text-gray-300 text-lg md:text-xl text-pretty"
>
From interactive 3D apps to custom shaders and type-safe libraries,
TypeGPU gives you the tools to build anything WebGPU can do.
Expand All @@ -170,12 +170,12 @@ import PageLayout from "../../layouts/PageLayout.astro";
>
<div class="flex flex-col gap-6 pb-20">
<h2
class="font-normal text-blue-950 dark:text-white text-2xlmd:text-4xl center"
class="font-medium text-blue-950 dark:text-white text-2xl md:text-4xl center"
>
Get to know TypeGPU
</h2>
<p
class="text-blue-950 dark:text-white text-lg md:text-2xl text-pretty"
class="text-blue-950 dark:text-white text-lg md:text-xl text-pretty"
>
Dive into guides, tutorials, and videos to see how TypeGPU can change
the way you work with GPU rendering and computing.
Expand All @@ -190,12 +190,12 @@ import PageLayout from "../../layouts/PageLayout.astro";
>
<div class="flex flex-col gap-6 pb-20">
<h2
class="font-normal text-blue-950 dark:text-gray-100 text-2xl md:text-4xl center"
class="font-medium text-blue-950 dark:text-gray-100 text-2xl md:text-4xl center"
>
What's around the corner?
</h2>
<p
class="text-blue-950 dark:text-gray-300 text-lg md:text-2xl text-pretty"
class="text-blue-950 dark:text-gray-300 text-lg md:text-xl text-pretty"
>
Our journey toward end-to-end type safety involves several
interoperating primitives – explore our live board to see what
Expand Down Expand Up @@ -228,7 +228,7 @@ import PageLayout from "../../layouts/PageLayout.astro";
We are <GradientTitle title="Software Mansion" />
</h2>
<div
class="mb-4 text-blue-900 dark:text-gray-300 text-2xl text-center text-pretty"
class="mb-4 text-blue-900 dark:text-gray-300 text-xl text-center text-pretty"
>
We’re a software company built around improving developer experience
and bringing to life the innovative ideas of our clients. Do you have
Expand Down
Loading