https://github.com/robb/shaderbugs
Some isssues I ran into with SwiftUI.Shader
https://github.com/robb/shaderbugs
Last synced: about 1 year ago
JSON representation
Some isssues I ran into with SwiftUI.Shader
- Host: GitHub
- URL: https://github.com/robb/shaderbugs
- Owner: robb
- Archived: true
- Created: 2023-06-13T10:33:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-06T21:18:13.000Z (almost 3 years ago)
- Last Synced: 2025-03-14T07:14:28.942Z (over 1 year ago)
- Language: Swift
- Size: 1.6 MB
- Stars: 36
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### ⚠️ Some if not all of these have been fixed in the latest beta, will update this repo when I have a moment.

Issues found so far (see [here](ShaderBugs/ContentView.swift)):
- Passing in an additional texture fails silently (distortion effect) or breaks the ability to sample the layer (layer effect).
- The documentation on [`Shader.Argument.image`](https://developer.apple.com/documentation/swiftui/shader/argument/image(_:)) states:
> Currently only one image parameter is supported per Shader instance.
However, it's unclear to me if that would include the `SwiftUI::Layer` in the layer effect case?
- After a certain number (or size?) of arguments, shaders fail silently.
API limitations:
- I found no way to turn a dynamically compiled `MTLLibrary` into a `ShaderLibrary`. There is `ShaderLibrary(data:)` but it's unclear to me where this data would come from, other than disk.
- Run-time errors or at least console logs for argument mismatch would be highly appreciated.
- I found no way to sample what's behind the view to build e.g. custom a `Material`-like effect. There's ways to work around the limitation by installing the effect on the nearst common ancestor but that seems inefficient?