Open-source project
twostraws/Inferno avatar
twostraws/Inferno

Inferno: An Open-Source Metal Shader Collection for SwiftUI

Metal shaders for SwiftUI.

2,923 stars145 forksMetalNOASSERTION

At a glance

What is it?
Inferno is an open-source collection of Metal fragment shaders for SwiftUI applications on iOS 17 and macOS 14, written by Paul Hudson. Each shader file is annotated line by line in plain English alongside the MSL code, making the collection useful both as a production source and as a learning resource for developers new to GPU programming.
Who is it for?
Inferno is the right choice for SwiftUI developers who need GPU-accelerated visual effects on iOS 17 or macOS 14 and want to start from readable, annotated source rather than writing Metal shaders from scratch. The copy-file installation approach means there is no package version to pin or update.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 136 days ago.
What is it written in?
Mainly Metal, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 25, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What Inferno Provides and Who It Is For

Inferno is a collection of Metal fragment shaders designed specifically for use with SwiftUI's shader API. The README describes it as intended for SwiftUI developers who want to add effects such as water ripples, spinning black holes, flashing lights, embossing, noise, and gradients to their apps, all executed on the GPU.

The collection targets two overlapping audiences. The first is developers who know SwiftUI and want visual effects without learning Metal from scratch: they copy a .metal file into their project and use it immediately. The second is developers who want to understand how GPU shaders work: every line of code in each shader file is annotated with a plain-English explanation, and each file begins with a summary of the algorithm it implements.

The repository requires iOS 17 and macOS 14 as minimum deployment targets, which limits it to projects that have already adopted those releases. It will not work on earlier versions of either platform.

How Fragment Shaders Work in SwiftUI

Fragment shaders in SwiftUI are tiny programs that run on the GPU for every pixel in a view. The README describes them as operating on individual elements of a SwiftUI layer: each pixel passes through the shader function, which can recolor or transform it in any way. Because this runs on hundreds of GPU cores in parallel, it is fast enough to execute at 60fps on all devices that support iOS 17, and at 120fps on ProMotion devices.

SwiftUI provides the shader with the current pixel's coordinate and its existing color. The shader can also receive additional parameters that the developer passes in from Swift code, such as a timestamp for animations or a float value for controlling the intensity of an effect.

Shaders in Inferno are written in the Metal Shading Language (MSL), which is based on C++ and is compiled at build time into a .metallib file. When SwiftUI activates a shader at runtime, it loads the corresponding Metal function from that precompiled library.

Installing Inferno and Using a Shader in a SwiftUI Project

The README gives a direct installation path: copy the appropriate .metal file from the repository into your Xcode project. There is no package manager step required for this approach. The repository also includes a Package.swift for Swift Package Manager integration, which allows adding the collection as a package dependency through Xcode's standard package management interface.

For transition shaders specifically, the README notes that you should also copy Transitions.swift into your project alongside the .metal file, as it provides SwiftUI-specific wrapper code that the transition shaders depend on.

The repository includes a cross-platform sample project in the Sandbox/ directory, which demonstrates all the included shaders running in a SwiftUI application. The README states that the sample project has extra helper code for demonstration purposes and that production use requires only the relevant .metal files, making the sample useful for understanding usage patterns before integrating individual shaders.

The Shaders, Transitions, and View Extensions in the Collection

The repository is organized into three categories. The first is shaders: fragment shader effects that modify pixels within a view, including examples like water ripples and embossing. The second is transitions: shaders that animate between two views in a SwiftUI transition, which require both a .metal file and Transitions.swift. The third is view extensions: Swift-side convenience wrappers that make applying a shader to a SwiftUI view require less boilerplate.

The README lists the shader names and their effects in a table, and the sample project in Sandbox/ demonstrates all included shaders, serving as the authoritative reference for what is included.

The README notes that the sample project runs on iOS 17 and macOS 14, consistent with the minimum OS requirements of the shaders themselves. The cross-platform nature means a SwiftUI developer building for both iOS and macOS can use the same shader files in both targets.

MSL Data Types, Number Literals, and Performance Guidance

The README provides a practical primer on MSL, covering the data types and functions used in Inferno. The types are numeric vectors: float for single floating-point numbers, float2 for two-component vectors (used for coordinates and sizes), half for half-precision floating-point, half3 for three-component vectors that hold RGB values, and half4 for four-component vectors holding RGBA values.

A key performance guidance point in the README is to prefer half-precision types over float whenever the required precision allows it. On iOS devices in particular, the GPU is optimized for half-precision operations, and using half types also saves register space, which increases the number of GPU cores that can run the shader simultaneously.

The README also warns about number literal types in MSL code. Writing `float y = (x - 1) / 2` is valid but forces integer-to-float conversions at runtime. The correct form is `float y = (x - 1.0) / 2.0`, where 1.0 and 2.0 are already float literals. Half-precision literals use the h suffix: 0.5h or 0.5H.

Where Inferno Falls Short: Platform Constraints and the License

Inferno is restricted to the platforms that support SwiftUI's shader API, which means iOS 17 and macOS 14 as hard minimums. Applications that must support older OS versions cannot use these shaders and must either maintain separate code paths or use a different effects approach.

The license field in the repository metadata reads NOASSERTION, meaning the automated tooling did not identify a standard license identifier. The LICENSE file is present in the repository and should be inspected directly before using Inferno in a commercial product.

The last push to this repository was on May 17, 2026. The repository is not archived. There are no formal GitHub releases; the README does not document a version number or a release history. This means there is no stable API version to pin. When a new shader is added or an existing one is modified, the main branch changes with no release tag to reference.

Inferno vs. Core Image Filters

Core Image is Apple's framework for image processing that ships as part of the OS and does not require any additional files. It provides a library of built-in filters and supports custom CIKernels written in a Metal-like syntax. The key difference from Inferno is integration depth.

Core Image filters operate on CIImage objects and require conversion to and from UIImage or CGImage when used in a SwiftUI view, adding steps compared to a fragment shader applied directly via SwiftUI's layer modifier. Core Image also has a larger built-in filter library and longer platform support, reaching back to iOS 5. The trade-off is that writing a custom Core Image kernel requires working with CIKernel types and the Metal Core Image shading dialect rather than straightforward MSL.

For SwiftUI-native projects targeting iOS 17 and above where real-time per-pixel effects are the goal, Inferno's direct SwiftUI integration avoids the conversion overhead. For projects that need to process still images or that must support iOS versions before iOS 17, Core Image is the more appropriate path.

Editorial conclusion

Inferno is the right choice for SwiftUI developers who need GPU-accelerated visual effects on iOS 17 or macOS 14 and want to start from readable, annotated source rather than writing Metal shaders from scratch. The copy-file installation approach means there is no package version to pin or update. The main constraints to verify before using it are the unidentified license, the iOS 17 and macOS 14 minimum targets, and whether the ProMotion 120fps cap on specific devices matters for your use case. Teams targeting older OS versions must write their own shaders or use Core Image.

Frequently asked questions

What is Inferno for SwiftUI?

Inferno is an open-source collection of Metal fragment shaders designed for SwiftUI apps on iOS 17 and macOS 14. Each shader adds a GPU-accelerated visual effect such as water ripples, embossing, or noise, and can be used by copying the relevant .metal file into an Xcode project.

Do Inferno shaders run at 60fps?

The README states that all fragment shaders in Inferno run at 60fps on all phones that support iOS 17, and at 120fps on ProMotion devices. They run on the GPU rather than the CPU.

Does Inferno require Swift Package Manager?

No. The README's primary installation method is copying the relevant .metal file directly into your Xcode project. The repository also includes a Package.swift for Swift Package Manager integration as an alternative.

Official sources

  1. Issues
  2. README
  3. twostraws/Inferno on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/twostraws-inferno.svg)](https://hysenlabs.com/projects/twostraws-inferno)