Skip to content

impr: Radiance Cascades v2#2617

Draft
reczkok wants to merge 47 commits into
mainfrom
impr/better-rc
Draft

impr: Radiance Cascades v2#2617
reczkok wants to merge 47 commits into
mainfrom
impr/better-rc

Conversation

@reczkok

@reczkok reczkok commented Jun 16, 2026

Copy link
Copy Markdown
Contributor
  • Better cascade sizing with per-layer info
  • Handles non-square render targets better
  • Adds configurable ray density
  • Uses Morton ray order for nicer sampling
  • Adds fast and higher-quality merge modes
  • Makes ray tracing aspect-correct
  • Lets users plug in custom ray march / trace logic (properly)
  • Adds tuning knobs for ray marching quality/perf
  • Supports custom output textures/views
  • Lets RC run inside an existing command encoder
  • Uses (much) less memory by default with 2D ping-pong textures
  • Exposes more useful helpers/types from the package
reczkok added 8 commits April 25, 2026 02:17
# Conflicts:
#	apps/typegpu-docs/package.json
#	apps/typegpu-docs/src/examples/rendering/radiance-cascades-drawing/drawInteraction.ts
#	apps/typegpu-docs/src/examples/rendering/radiance-cascades-drawing/index.ts
#	apps/typegpu-docs/src/examples/rendering/radiance-cascades/drag-controller.ts
#	apps/typegpu-docs/src/examples/rendering/radiance-cascades/index.ts
#	apps/typegpu-docs/tests/individual-example-tests/jump-flood-distance.test.ts
#	packages/typegpu-radiance-cascades/README.md
#	packages/typegpu-radiance-cascades/package.json
#	packages/typegpu-radiance-cascades/src/cascades.ts
#	packages/typegpu-radiance-cascades/src/index.ts
#	packages/typegpu-radiance-cascades/src/runner.ts
#	packages/typegpu-sdf/src/jumpFlood.ts
#	packages/typegpu/src/tgsl/accessProp.ts
#	pnpm-lock.yaml
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@3dc89d7b90c082ab486029514b2507dbebffcd69
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@3dc89d7b90c082ab486029514b2507dbebffcd69
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@3dc89d7b90c082ab486029514b2507dbebffcd69
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@3dc89d7b90c082ab486029514b2507dbebffcd69
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@3dc89d7b90c082ab486029514b2507dbebffcd69

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

📊 Bundle Size Comparison

🟢 Decreased ➖ Unchanged 🔴 Increased ❔ Unknown
0 356 0 1

👀 Notable results

Static test results:

No major changes.

Dynamic test results:

Test tsdown
isTextureView from typegpu.ts 62.94 kB

📋 All results

Click to reveal the results table (356 entries).
Test tsdown
dataImportEverything.ts 89.49 kB (➖)
dataImportOneDirect.ts 24.62 kB (➖)
dataImportOneStar.ts 24.62 kB (➖)
functionWithUseGpu.ts 282 B (➖)
functionWithoutUseGpu.ts 24 B (➖)
importEntireLibrary.ts 289.26 kB (➖)
stdImportEverything.ts 105.73 kB (➖)
stdImportOneDirect.ts 48.37 kB (➖)
stdImportOneStar.ts 48.37 kB (➖)
tgpuImportEverything.ts 261.40 kB (➖)
tgpuImportOne.ts 261.41 kB (➖)
MissingBindGroupsError from typegpu.ts 1.35 kB (➖)
MissingSlotValueError from typegpu.ts 151 B (➖)
MissingVertexBuffersError from typegpu.ts 1.36 kB (➖)
NotUniformError from typegpu.ts 1.31 kB (➖)
ResolutionError from typegpu.ts 2.33 kB (➖)
ShaderGenerator from typegpu.ts 1.66 kB (➖)
Void from typegpudata.ts 734 B (➖)
WgslGenerator from typegpu.ts 114.87 kB (➖)
abs from typegpustd.ts 65.82 kB (➖)
acos from typegpustd.ts 65.82 kB (➖)
acosh from typegpustd.ts 65.82 kB (➖)
add from typegpustd.ts 48.37 kB (➖)
align from typegpudata.ts 26.31 kB (➖)
alignmentOf from typegpudata.ts 21.85 kB (➖)
allEq from typegpustd.ts 51.74 kB (➖)
all from typegpustd.ts 51.74 kB (➖)
and from typegpustd.ts 51.74 kB (➖)
any from typegpustd.ts 51.75 kB (➖)
arrayLength from typegpustd.ts 14.43 kB (➖)
arrayOf from typegpudata.ts 26.17 kB (➖)
asin from typegpustd.ts 65.82 kB (➖)
asinh from typegpustd.ts 65.82 kB (➖)
atan2 from typegpustd.ts 65.82 kB (➖)
atan from typegpustd.ts 65.82 kB (➖)
atanh from typegpustd.ts 65.82 kB (➖)
atomicAdd from typegpustd.ts 15.80 kB (➖)
atomicAnd from typegpustd.ts 15.80 kB (➖)
atomicLoad from typegpustd.ts 15.79 kB (➖)
atomicMax from typegpustd.ts 15.80 kB (➖)
atomicMin from typegpustd.ts 15.80 kB (➖)
atomicOr from typegpustd.ts 15.80 kB (➖)
atomicStore from typegpustd.ts 15.79 kB (➖)
atomicSub from typegpustd.ts 15.80 kB (➖)
atomicXor from typegpustd.ts 15.80 kB (➖)
atomic from typegpudata.ts 779 B (➖)
bitShiftLeft from typegpustd.ts 48.37 kB (➖)
bitShiftRight from typegpustd.ts 48.37 kB (➖)
bitcastU32toF32 from typegpustd.ts 44.19 kB (➖)
bitcastU32toI32 from typegpustd.ts 44.20 kB (➖)
bool from typegpudata.ts 12.97 kB (➖)
builtin from typegpudata.ts 28.63 kB (➖)
ceil from typegpustd.ts 65.82 kB (➖)
clamp from typegpustd.ts 65.82 kB (➖)
common from typegpu.ts 58.44 kB (➖)
comparisonSampler from typegpudata.ts 753 B (➖)
copy from typegpustd.ts 14.43 kB (➖)
cos from typegpustd.ts 65.82 kB (➖)
cosh from typegpustd.ts 65.82 kB (➖)
countLeadingZeros from typegpustd.ts 65.82 kB (➖)
countOneBits from typegpustd.ts 65.82 kB (➖)
countTrailingZeros from typegpustd.ts 65.82 kB (➖)
cross from typegpustd.ts 65.82 kB (➖)
d from typegpu.ts 87.17 kB (➖)
deepEqual from typegpudata.ts 2.19 kB (➖)
degrees from typegpustd.ts 65.82 kB (➖)
determinant from typegpustd.ts 65.82 kB (➖)
disarrayOf from typegpudata.ts 15.02 kB (➖)
discard from typegpustd.ts 14.19 kB (➖)
distance from typegpustd.ts 65.82 kB (➖)
div from typegpustd.ts 48.37 kB (➖)
dot4I8Packed from typegpustd.ts 65.82 kB (➖)
dot4U8Packed from typegpustd.ts 65.82 kB (➖)
dot from typegpustd.ts 65.81 kB (➖)
dpdxCoarse from typegpustd.ts 15.04 kB (➖)
dpdxFine from typegpustd.ts 15.04 kB (➖)
dpdx from typegpustd.ts 15.03 kB (➖)
dpdyCoarse from typegpustd.ts 15.04 kB (➖)
dpdyFine from typegpustd.ts 15.04 kB (➖)
dpdy from typegpustd.ts 15.04 kB (➖)
eq from typegpustd.ts 51.74 kB (➖)
exp2 from typegpustd.ts 65.82 kB (➖)
exp from typegpustd.ts 65.82 kB (➖)
extensionEnabled from typegpustd.ts 14.58 kB (➖)
extractBits from typegpustd.ts 65.82 kB (➖)
f16 from typegpudata.ts 12.97 kB (➖)
f32 from typegpudata.ts 12.97 kB (➖)
faceForward from typegpustd.ts 65.82 kB (➖)
firstLeadingBit from typegpustd.ts 65.82 kB (➖)
firstTrailingBit from typegpustd.ts 65.82 kB (➖)
float16 from typegpudata.ts 20.91 kB (➖)
float16x2 from typegpudata.ts 20.91 kB (➖)
float16x4 from typegpudata.ts 20.91 kB (➖)
float32 from typegpudata.ts 20.91 kB (➖)
float32x2 from typegpudata.ts 20.91 kB (➖)
float32x3 from typegpudata.ts 20.91 kB (➖)
float32x4 from typegpudata.ts 20.91 kB (➖)
floor from typegpustd.ts 65.82 kB (➖)
fma from typegpustd.ts 65.82 kB (➖)
formatToWGSLType from typegpudata.ts 20.90 kB (➖)
fract from typegpustd.ts 65.82 kB (➖)
frexp from typegpustd.ts 65.82 kB (➖)
fwidthCoarse from typegpustd.ts 15.04 kB (➖)
fwidthFine from typegpustd.ts 15.04 kB (➖)
fwidth from typegpustd.ts 15.04 kB (➖)
ge from typegpustd.ts 51.75 kB (➖)
getLongestContiguousPrefix from typegpudata.ts 24.64 kB (➖)
getTargetShaderLanguage from typegpustd.ts 14.53 kB (➖)
gt from typegpustd.ts 51.75 kB (➖)
i32 from typegpudata.ts 12.97 kB (➖)
identity2 from typegpustd.ts 26.99 kB (➖)
identity3 from typegpustd.ts 26.99 kB (➖)
identity4 from typegpustd.ts 26.99 kB (➖)
insertBits from typegpustd.ts 65.82 kB (➖)
interpolate from typegpudata.ts 26.32 kB (➖)
invariant from typegpudata.ts 26.69 kB (➖)
inverseSqrt from typegpustd.ts 65.82 kB (➖)
isAccessor from typegpu.ts 65 B (➖)
isAlignAttrib from typegpudata.ts 755 B (➖)
isAtomic from typegpudata.ts 755 B (➖)
isBeingTranspiled from typegpustd.ts 14.47 kB (➖)
isBufferShorthand from typegpu.ts 1.71 kB (➖)
isBuffer from typegpu.ts 88.51 kB (➖)
isBuiltinAttrib from typegpudata.ts 757 B (➖)
isBuiltin from typegpudata.ts 24.57 kB (➖)
isCloseTo from typegpustd.ts 51.75 kB (➖)
isComparisonSampler from typegpu.ts 62.96 kB (➖)
isContiguous from typegpudata.ts 24.63 kB (➖)
isData from typegpudata.ts 1.81 kB (➖)
isDecorated from typegpudata.ts 758 B (➖)
isDisarray from typegpudata.ts 1.11 kB (➖)
isInterpolateAttrib from typegpudata.ts 761 B (➖)
isLazy from typegpu.ts 61 B (➖)
isLocationAttrib from typegpudata.ts 758 B (➖)
isLooseData from typegpudata.ts 1.16 kB (➖)
isLooseDecorated from typegpudata.ts 1.12 kB (➖)
isMutableAccessor from typegpu.ts 73 B (➖)
isPackedData from typegpudata.ts 20.97 kB (➖)
isPtr from typegpudata.ts 752 B (➖)
isSampler from typegpu.ts 62.95 kB (➖)
isSizeAttrib from typegpudata.ts 754 B (➖)
isSlot from typegpu.ts 61 B (➖)
isTextureView from typegpu.ts 62.94 kB
isTexture from typegpu.ts 62.94 kB (➖)
isTgpuComputeFn from typegpu.ts 69 B (➖)
isTgpuFn from typegpu.ts 765 B (➖)
isTgpuFragmentFn from typegpu.ts 70 B (➖)
isTgpuVertexFn from typegpu.ts 68 B (➖)
isUnstruct from typegpudata.ts 1.11 kB (➖)
isUsableAsRender from typegpu.ts 55 B (➖)
isUsableAsSampled from typegpu.ts 56 B (➖)
isUsableAsStorage from typegpu.ts 56 B (➖)
isUsableAsUniform from typegpu.ts 62.93 kB (➖)
isUsableAsVertex from typegpu.ts 88.50 kB (➖)
isVariable from typegpu.ts 64.65 kB (➖)
isWgslArray from typegpudata.ts 754 B (➖)
isWgslData from typegpudata.ts 1.31 kB (➖)
isWgslStruct from typegpudata.ts 755 B (➖)
ldexp from typegpustd.ts 65.82 kB (➖)
le from typegpustd.ts 51.75 kB (➖)
length from typegpustd.ts 65.81 kB (➖)
location from typegpudata.ts 26.31 kB (➖)
log2 from typegpustd.ts 65.82 kB (➖)
log from typegpustd.ts 65.82 kB (➖)
lt from typegpustd.ts 51.74 kB (➖)
mat2x2f from typegpudata.ts 26.99 kB (➖)
mat3x3f from typegpudata.ts 26.99 kB (➖)
mat4x4f from typegpudata.ts 26.99 kB (➖)
matToArray from typegpudata.ts 27.12 kB (➖)
max from typegpustd.ts 65.82 kB (➖)
memoryLayoutOf from typegpudata.ts 41.95 kB (➖)
min from typegpustd.ts 65.82 kB (➖)
mix from typegpustd.ts 65.82 kB (➖)
mod from typegpustd.ts 48.37 kB (➖)
modf from typegpustd.ts 65.82 kB (➖)
mul from typegpustd.ts 48.37 kB (➖)
ne from typegpustd.ts 51.74 kB (➖)
neg from typegpustd.ts 48.36 kB (➖)
normalize from typegpustd.ts 65.82 kB (➖)
not from typegpustd.ts 51.74 kB (➖)
or from typegpustd.ts 51.74 kB (➖)
pack2x16float from typegpustd.ts 35.94 kB (➖)
pack4x8unorm from typegpustd.ts 35.94 kB (➖)
packedFormats from typegpudata.ts 20.92 kB (➖)
patchArrayBuffer from typegpu.ts 51.09 kB (➖)
pow from typegpustd.ts 65.82 kB (➖)
ptrFn from typegpudata.ts 859 B (➖)
ptrHandle from typegpudata.ts 851 B (➖)
ptrPrivate from typegpudata.ts 858 B (➖)
ptrStorage from typegpudata.ts 856 B (➖)
ptrUniform from typegpudata.ts 852 B (➖)
ptrWorkgroup from typegpudata.ts 860 B (➖)
quantizeToF16 from typegpustd.ts 65.82 kB (➖)
radians from typegpustd.ts 65.82 kB (➖)
range from typegpustd.ts 14.85 kB (➖)
readFromArrayBuffer from typegpu.ts 51.69 kB (➖)
ref from typegpudata.ts 4.79 kB (➖)
reflect from typegpustd.ts 65.82 kB (➖)
refract from typegpustd.ts 65.82 kB (➖)
reverseBits from typegpustd.ts 65.82 kB (➖)
rotateX4 from typegpustd.ts 49.13 kB (➖)
rotateY4 from typegpustd.ts 49.13 kB (➖)
rotateZ4 from typegpustd.ts 49.13 kB (➖)
rotationX4 from typegpustd.ts 26.99 kB (➖)
rotationY4 from typegpustd.ts 26.99 kB (➖)
rotationZ4 from typegpustd.ts 26.99 kB (➖)
round from typegpustd.ts 65.82 kB (➖)
sampler from typegpudata.ts 742 B (➖)
saturate from typegpustd.ts 65.82 kB (➖)
scale4 from typegpustd.ts 49.13 kB (➖)
scaling4 from typegpustd.ts 26.99 kB (➖)
select from typegpustd.ts 51.74 kB (➖)
sign from typegpustd.ts 65.82 kB (➖)
sin from typegpustd.ts 65.82 kB (➖)
sinh from typegpustd.ts 65.82 kB (➖)
sint16 from typegpudata.ts 20.91 kB (➖)
sint16x2 from typegpudata.ts 20.91 kB (➖)
sint16x4 from typegpudata.ts 20.91 kB (➖)
sint32 from typegpudata.ts 20.91 kB (➖)
sint32x2 from typegpudata.ts 20.91 kB (➖)
sint32x3 from typegpudata.ts 20.91 kB (➖)
sint32x4 from typegpudata.ts 20.91 kB (➖)
sint8 from typegpudata.ts 20.91 kB (➖)
sint8x2 from typegpudata.ts 20.91 kB (➖)
sint8x4 from typegpudata.ts 20.91 kB (➖)
sizeOf from typegpudata.ts 24.62 kB (➖)
size from typegpudata.ts 26.31 kB (➖)
smoothstep from typegpustd.ts 65.82 kB (➖)
snorm16 from typegpudata.ts 20.91 kB (➖)
snorm16x2 from typegpudata.ts 20.91 kB (➖)
snorm16x4 from typegpudata.ts 20.91 kB (➖)
snorm8 from typegpudata.ts 20.91 kB (➖)
snorm8x2 from typegpudata.ts 20.91 kB (➖)
snorm8x4 from typegpudata.ts 20.91 kB (➖)
sqrt from typegpustd.ts 65.82 kB (➖)
std from typegpu.ts 102.89 kB (➖)
step from typegpustd.ts 65.82 kB (➖)
storageBarrier from typegpustd.ts 15.80 kB (➖)
struct from typegpudata.ts 3.42 kB (➖)
sub from typegpustd.ts 48.37 kB (➖)
subgroupAdd from typegpustd.ts 23.98 kB (➖)
subgroupAll from typegpustd.ts 23.99 kB (➖)
subgroupAnd from typegpustd.ts 23.99 kB (➖)
subgroupAny from typegpustd.ts 23.99 kB (➖)
subgroupBallot from typegpustd.ts 23.99 kB (➖)
subgroupBroadcastFirst from typegpustd.ts 23.99 kB (➖)
subgroupBroadcast from typegpustd.ts 23.99 kB (➖)
subgroupElect from typegpustd.ts 23.99 kB (➖)
subgroupExclusiveAdd from typegpustd.ts 23.99 kB (➖)
subgroupExclusiveMul from typegpustd.ts 23.99 kB (➖)
subgroupInclusiveAdd from typegpustd.ts 23.99 kB (➖)
subgroupInclusiveMul from typegpustd.ts 23.99 kB (➖)
subgroupMax from typegpustd.ts 23.99 kB (➖)
subgroupMin from typegpustd.ts 23.99 kB (➖)
subgroupMul from typegpustd.ts 23.99 kB (➖)
subgroupOr from typegpustd.ts 23.99 kB (➖)
subgroupShuffleDown from typegpustd.ts 23.99 kB (➖)
subgroupShuffleUp from typegpustd.ts 23.99 kB (➖)
subgroupShuffleXor from typegpustd.ts 23.99 kB (➖)
subgroupShuffle from typegpustd.ts 23.99 kB (➖)
subgroupXor from typegpustd.ts 23.99 kB (➖)
tan from typegpustd.ts 65.82 kB (➖)
tanh from typegpustd.ts 65.82 kB (➖)
texture1d from typegpudata.ts 13.43 kB (➖)
texture2dArray from typegpudata.ts 13.45 kB (➖)
texture2d from typegpudata.ts 13.43 kB (➖)
texture3d from typegpudata.ts 13.43 kB (➖)
textureBarrier from typegpustd.ts 15.79 kB (➖)
textureCubeArray from typegpudata.ts 13.45 kB (➖)
textureCube from typegpudata.ts 13.43 kB (➖)
textureDepth2dArray from typegpudata.ts 13.44 kB (➖)
textureDepth2d from typegpudata.ts 13.42 kB (➖)
textureDepthCubeArray from typegpudata.ts 13.44 kB (➖)
textureDepthCube from typegpudata.ts 13.42 kB (➖)
textureDepthMultisampled2d from typegpudata.ts 13.44 kB (➖)
textureDimensions from typegpustd.ts 25.74 kB (➖)
textureExternal from typegpudata.ts 873 B (➖)
textureGather from typegpustd.ts 25.74 kB (➖)
textureLoad from typegpustd.ts 25.75 kB (➖)
textureMultisampled2d from typegpudata.ts 13.45 kB (➖)
textureSampleBaseClampToEdge from typegpustd.ts 25.75 kB (➖)
textureSampleBias from typegpustd.ts 25.75 kB (➖)
textureSampleCompareLevel from typegpustd.ts 25.75 kB (➖)
textureSampleCompare from typegpustd.ts 25.75 kB (➖)
textureSampleGrad from typegpustd.ts 25.75 kB (➖)
textureSampleLevel from typegpustd.ts 25.75 kB (➖)
textureSample from typegpustd.ts 25.75 kB (➖)
textureStorage1d from typegpudata.ts 1.01 kB (➖)
textureStorage2dArray from typegpudata.ts 1.03 kB (➖)
textureStorage2d from typegpudata.ts 1.01 kB (➖)
textureStorage3d from typegpudata.ts 1.01 kB (➖)
textureStore from typegpustd.ts 25.75 kB (➖)
tgpu.accessor from typegpu.ts 261.41 kB (➖)
tgpu.bindGroupLayout from typegpu.ts 261.42 kB (➖)
tgpu.comptime from typegpu.ts 261.41 kB (➖)
tgpu.computeFn from typegpu.ts 261.41 kB (➖)
tgpu.const from typegpu.ts 261.41 kB (➖)
tgpu.fn from typegpu.ts 261.41 kB (➖)
tgpu.fragmentFn from typegpu.ts 261.41 kB (➖)
tgpu.initFromDevice from typegpu.ts 261.42 kB (➖)
tgpu.init from typegpu.ts 261.41 kB (➖)
tgpu.lazy from typegpu.ts 261.41 kB (➖)
tgpu.mutableAccessor from typegpu.ts 261.42 kB (➖)
tgpu.privateVar from typegpu.ts 261.41 kB (➖)
tgpu.resolveWithContext from typegpu.ts 261.42 kB (➖)
tgpu.resolve from typegpu.ts 261.41 kB (➖)
tgpu.slot from typegpu.ts 261.41 kB (➖)
tgpu.unroll from typegpu.ts 261.41 kB (➖)
tgpu.vertexFn from typegpu.ts 261.41 kB (➖)
tgpu.vertexLayout from typegpu.ts 261.42 kB (➖)
tgpu.workgroupVar from typegpu.ts 261.42 kB (➖)
tgpu from typegpu.ts 261.40 kB (➖)
translate4 from typegpustd.ts 49.13 kB (➖)
translation4 from typegpustd.ts 26.99 kB (➖)
transpose from typegpustd.ts 65.82 kB (➖)
trunc from typegpustd.ts 65.82 kB (➖)
u16 from typegpudata.ts 13.00 kB (➖)
u32 from typegpudata.ts 12.97 kB (➖)
uint16 from typegpudata.ts 20.91 kB (➖)
uint16x2 from typegpudata.ts 20.91 kB (➖)
uint16x4 from typegpudata.ts 20.91 kB (➖)
uint32 from typegpudata.ts 20.91 kB (➖)
uint32x2 from typegpudata.ts 20.91 kB (➖)
uint32x3 from typegpudata.ts 20.91 kB (➖)
uint32x4 from typegpudata.ts 20.91 kB (➖)
uint8 from typegpudata.ts 20.90 kB (➖)
uint8x2 from typegpudata.ts 20.91 kB (➖)
uint8x4 from typegpudata.ts 20.91 kB (➖)
unorm10 10 10 2 from typegpudata.ts 20.91 kB (➖)
unorm16 from typegpudata.ts 20.91 kB (➖)
unorm16x2 from typegpudata.ts 20.91 kB (➖)
unorm16x4 from typegpudata.ts 20.91 kB (➖)
unorm8 from typegpudata.ts 20.91 kB (➖)
unorm8x2 from typegpudata.ts 20.91 kB (➖)
unorm8x4 bgra from typegpudata.ts 20.91 kB (➖)
unorm8x4 from typegpudata.ts 20.91 kB (➖)
unpack2x16float from typegpustd.ts 35.94 kB (➖)
unpack4x8unorm from typegpustd.ts 35.94 kB (➖)
unstruct from typegpudata.ts 1.55 kB (➖)
vec2b from typegpudata.ts 19.41 kB (➖)
vec2f from typegpudata.ts 19.41 kB (➖)
vec2h from typegpudata.ts 19.41 kB (➖)
vec2i from typegpudata.ts 19.41 kB (➖)
vec2u from typegpudata.ts 19.41 kB (➖)
vec3b from typegpudata.ts 19.41 kB (➖)
vec3f from typegpudata.ts 19.41 kB (➖)
vec3h from typegpudata.ts 19.41 kB (➖)
vec3i from typegpudata.ts 19.41 kB (➖)
vec3u from typegpudata.ts 19.41 kB (➖)
vec4b from typegpudata.ts 19.41 kB (➖)
vec4f from typegpudata.ts 19.41 kB (➖)
vec4h from typegpudata.ts 19.41 kB (➖)
vec4i from typegpudata.ts 19.41 kB (➖)
vec4u from typegpudata.ts 19.41 kB (➖)
workgroupBarrier from typegpustd.ts 15.80 kB (➖)
writeToArrayBuffer from typegpu.ts 50.89 kB (➖)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Resolution Time Benchmark

---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.91, 1.92, 4.31, 6.53, 8.03, 10.58, 21.46, 27.08]
  line [0.92, 1.90, 4.09, 6.81, 7.13, 11.89, 20.95, 23.34]
  line [0.95, 1.91, 4.20, 6.23, 7.46, 11.69, 22.26, 25.27]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.30, 0.52, 0.67, 0.85, 1.13, 1.21, 1.46, 1.55]
  line [0.29, 0.55, 0.65, 0.81, 1.19, 1.23, 1.43, 1.57]
  line [0.30, 0.75, 0.73, 0.91, 1.18, 1.27, 1.55, 1.63]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.84, 2.06, 3.70, 6.34, 12.26, 25.85, 55.90, 113.41]
  line [0.83, 1.96, 3.93, 6.10, 12.11, 25.61, 57.11, 112.70]
  line [0.90, 2.06, 3.67, 6.17, 12.56, 25.76, 56.70, 113.83]
Loading
@reczkok

reczkok commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@pullfrog pls review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — v2 rewrite of the radiance cascades package with better cascade sizing, Morton ray ordering, configurable merge modes, encoder support, and memory optimization.

  • Add getCascadeInfo with per-layer metadata — replaces the flat getCascadeDim with a rich CascadeInfo structure carrying per-layer probe counts, UV ranges, and valid dimensions. The old getCascadeDim is kept as a convenience wrapper.
  • Morton Z-order ray ordering — replaces linear ray indexing with Morton encoding for more uniform angular sampling. part1By1 and morton2D are defined in cascades.ts and used in makeCascadePassCompute.
  • Aspect-correct ray directionsrayDirection and segmentMetricLength use renderAspectSlot to produce correct ray distributions on non-square render targets. rayBoxExitUv clips rays to the unit box.
  • Configurable cascade layers — support for baseStoredRayDim (1/2/4), mergeMode (hardware or bilinear-fix), per-layer uniform buffers (CascadeLayerParams), and exposure of common slots (maxRayStepsSlot, rayMarchStepSafetySlot, traceSegmentSlot).
  • Encoder supportrun() accepts an optional GPUCommandEncoder so cascade and jump-flood passes can be batched with surrounding work. When omitted, run() creates and submits its own encoder.
  • 2D ping-pong cascade textures by default — reduces memory usage significantly. 3D array textures are used only when keepCascadeLayers: true.
  • Prebuilt JFA pipelinescreateJumpFlood now prebuilds one pipeline per JFA step instead of writing offsetUniform at runtime. Fixes destroy() to clean up offset buffers and uniforms.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@reczkok

reczkok commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@pullfrog could you estimate how much less gpu memory we allocate for a couple given resolutions?

@pullfrog

pullfrog Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The biggest memory win comes from the cascade ping-pong textures switching from 3D arrays to 2D (the default keepCascadeLayers: false). The output texture format in jumpFlood also goes from rgba16float (8 B/texel) to r32float (4 B/texel) — a separate 50% saving on the SDF output.

Cascade texture memory: old vs new (default baseStoredRayDim=2)

The old path allocates 2 × 3D textures at rgba16float (8 B/texel): [cascadeDimX × cascadeDimY × cascadeCount].
The new default allocates 2 × 2D ping-pong textures: [cascadeDimX × cascadeDimY] — same rgba16float but no layer dimension, so savings factor ≈ cascadeCount : 1.

Resolution Cascade Dim Old Layers Old Memory (2×3D) New Memory (2×2D) Savings
4K (2160p) 8192×4608 8 4.50 GB 576 MB 3.94 GB
1440p 4096×2304 7 1008 MB 144 MB 864 MB
1080p 4096×2304 7 1008 MB 144 MB 864 MB
720p 2048×1152 7→6 252 MB 36 MB 216 MB
1024×768 2048×1536 7→6 336 MB 48 MB 288 MB
800×600 1024×768 6 72 MB 12 MB 60 MB

(1080p and 1440p share the same cascade dim because the closest-power-of-two diagonal rounds to the same value.)

Tuning baseStoredRayDim (new path, 2×2D only)

Lower values reduce cascade dimensions further at the cost of ray angular resolution:

Resolution baseStoredRayDim=1 baseStoredRayDim=2 (default) baseStoredRayDim=4
4K 144 MB 576 MB 2.25 GB
1080p / 1440p 36 MB 144 MB 576 MB
720p 9 MB 36 MB 144 MB

Uniform buffers

A negligible per-layer uniform buffer (CascadeLayerParams, ~48 B each) replaces the old single CascadeStaticParams + layerBuffer — about the same total, just split per-layer so no layerBuffer.write() is needed during dispatch.

Task list (4/4 completed)
  • Explore codebase to understand GPU memory allocation patterns
  • Find resolution-dependent buffer/texture allocations
  • Calculate and estimate memory savings for given resolutions
  • Report findings via pullfrog_report_progress

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant