frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Writing shaders in TypeScript, the solution to a major WebGPU limitation?

https://bsky.app/profile/iwoplaza.bsky.social/post/3lrsuzeq5zk2x
1•iwoplaza•4h ago

Comments

iwoplaza•4h ago
WebGPU is an amazing piece of technology, allowing for truly cross-platform graphics and GPGPU programming. It is being used by frameworks like Three.js and TensorFlow to accelerate their internals. However, when we try to connect libraries together, we soon hit a limit...

Let's say we wanted to pull a texture out of Three.js, and use it as a tensor in Tensorflow.js. If their internal data structure matches, they can just share a VRAM pointer to avoid copying to RAM and back unnecessarily (could be ~100x slower than the actual work we want to do). Unfortunately, it is rare for APIs to be seamlessly compatible with one another, so we need "glue code" for interop. We have two options: 1. Copy data, and transform it in JS/TS. 2. Write a compute shader to operate on VRAM directly, and glue the APIs there.

Well... what if we could write the glue code in TypeScript, and compile it to WebGPU Shading Language instead? We would get hints from the language server about both the output of Three.js, and the input of Tensorflow.js. My team and I have been building a solution just for this, a TypeScript library called TypeGPU!

I like to use the analogy of server & client, as writing both CPU and GPU logic in TypeScript gives you the same benefits here. Write a single code-base, and using modern tooling like Vite, tell the bundler which functions should be executable on the GPU. We hook into the build process with our custom plugin to allow for this. The GPU can be thought of as just an endpoint with an API, and instead of binary blobs and strings, that API can be made type-safe!

And it's not just the "glue code" that becomes better, library APIs can become more customizable! A library can defer shader logic to the user by accepting marked TypeScript functions. Dependency Inversion, without compromising efficiency! We're building libraries on top of TypeGPU as we speak, and we would love to work with everyone building their own GPU-enhanced libraries. You can keep full flexibility of your internals, and still use plain WebGPU & WGSL. We handle the API, so you can focus on your library's core value.

I would love to hear everyone's thoughts on the problem, and the proposed solution

New Crypto is OUT (fresh on pancakeswap)

https://www.geckoterminal.com/bsc/pools/0x8a40d610d1d38329cc6c9b4cb10083b90c2ac5d9
1•redbasecap•1m ago•0 comments

Your Smartwatch Might Help Stop Pandemics

https://stories.tamu.edu/news/2025/06/23/your-smartwatch-might-know-youre-sick-before-you-do-and-it-might-help-stop-pandemics/
1•geox•2m ago•0 comments

The Challenges of Tackling Too Much Screen Time

https://undark.org/2025/06/23/too-much-screen-time/
1•EA-3167•5m ago•0 comments

Radio pulses detected coming from ice in Antarctica

https://www.psu.edu/news/research/story/strange-radio-pulses-detected-coming-ice-antarctica
1•cratermoon•7m ago•0 comments

Skip the exit interview when you leave your job

https://blog.petdance.com/2017/03/31/skip-the-exit-interview-when-you-leave-your-job/
4•ohjeez•8m ago•0 comments

Giant asteroid could crash into moon in 2032, firing debris towards Earth

https://www.theguardian.com/science/2025/jun/23/giant-asteroid-could-crash-moon-2032-firing-debris-earth
1•pseudolus•13m ago•0 comments

Sam Altman allegedly stole Google X spin out IYO's idea of smart ear buds

https://twitter.com/deedydas/status/1937173385920106888
3•donsupreme•19m ago•0 comments

Founder

https://sovereigncognition.com/
1•VortexBlackAI•25m ago•0 comments

Advanced steelmaking technologies to mitigate global climate change

https://www.sciencedirect.com/science/article/pii/S0959652625010765
1•PaulHoule•25m ago•0 comments

Getting by on the Generosity of Strangers in Japan

https://theworld.org/stories/2025/06/20/out-of-eden-walk-getting-by-on-the-generosity-of-strangers
2•ilamont•28m ago•0 comments

Restricted data once again leaked on War Thunder forums

https://ukdefencejournal.org.uk/classified-data-once-again-leaked-on-war-thunder-forums/
2•ortusdux•28m ago•0 comments

NYT: Discussion of Sick Day Usage

https://www.nytimes.com/2025/06/21/magazine/sick-leave-days-ethics.html
2•cranky908canuck•29m ago•2 comments

A live comparison of 12 classless CSS frameworks on the same semantic HTML

https://hugo-classless.netlify.app/
1•mozanunal•29m ago•1 comments

Collections: Nitpicking Gladiator's Iconic Opening Battle, Part I

https://acoup.blog/2025/06/06/collections-nitpicking-gladiators-iconic-opening-battle-part-i/
1•diodorus•30m ago•0 comments

How to Read Bug Reports (2016)

https://www.massicotte.org/reading-bug-reports
1•Austin_Conlon•30m ago•0 comments

Philips – Fixables [video]

https://www.youtube.com/watch?v=De8qkIY5vJY
1•seretogis•32m ago•0 comments

First quantum-mechanical model of quasicrystals reveals why they exist

https://phys.org/news/2025-06-quantum-mechanical-quasicrystals-reveals.html
1•bookofjoe•32m ago•0 comments

Selling or hiring internationally? You're probably breaking the law

https://useportcall.com/blog/cross-border-growth-creates-invisible-compliance-risks
1•beecee•34m ago•0 comments

The Ford EBike Lineup

https://ford-bikes.com/
1•nateb2022•35m ago•0 comments

The cost of quick wins (with examples)

https://ottic.ai/blog/marketing-quick-wins-with-examples/
1•rafaepta•36m ago•0 comments

JVM Rainbow – Mixing Java, Scala, Kotlin and Groovy

https://github.com/Hakky54/java-tutorials/tree/main/jvm-rainbow
1•hakky54•37m ago•0 comments

Bogong moths use a stellar compass for long-distance navigation at night

https://www.nature.com/articles/s41586-025-09135-3
2•Anon84•38m ago•0 comments

Energy Challenges for Martian Colonists

https://www.youtube.com/watch?v=-_wY30rH3Xc
2•d_silin•47m ago•0 comments

Visualizing Homotopy Groups [video]

https://www.youtube.com/watch?v=CxGtAuJdjYI
1•lying4fun•57m ago•0 comments

Oil prices sink after Iranian strike on US airbase reduces fears of disruption

https://www.theguardian.com/business/2025/jun/23/oil-prices-iranian-strike-us-airbase
4•spzx•59m ago•1 comments

The end of Stop Killing Games [video]

https://www.youtube.com/watch?v=HIfRLujXtUo
1•zavertnik•1h ago•1 comments

Application compatibility for Windows 95 crashed a cash register

https://devblogs.microsoft.com/oldnewthing/20250610-00/?p=111260
2•OptionOfT•1h ago•0 comments

Show HN: Rewizo, a platform for casual online earning

https://www.rewizo.com/
1•Rafay2006•1h ago•1 comments

Show HN: I built an AI Powered Word Docs Editor

https://breezeai.live/
1•yashrajvrmaa•1h ago•1 comments

Driving the Rust Compiler to Compile Single Files as Shellcode

https://kirchware.com/Driving-the-Rust-Compiler-to-Compile-Single-Files-as-Shellcode
1•brson•1h ago•0 comments