Comments (3)
So metalFileName
is not used anymore,
metalBaseCode
replaces this property.
Sorry this change was made in a patch update.
The update "hardcodes metal" (PixelKit 1.0.2 & RenderKit 0.4.0) is an update to eliminate bundle resources, as SwiftPM dose not support this yet. The MetalPIXs should conform to the updated NodeMetal protocol.
What versions of PixelKit and RenderKit are you using?
Are you using Pods or SwiftPM?
from pixelkit.
I was just trying the iOS example in the project.
Here are the steps:
- Downloaded the zip from Github
- Ran
git submodule init
to get the shaders - Ran
pod install
to get the dependencies - Build failed with errors
To fix the errors I made MetalPix
, MetalEffectPix
, MetalMergerEffectPIX
, MetalMultiEffectPIX
conform to NODEMetal
by adding the following:
public var metalFileName: String = ""
I also added a convenience method to Render
to be able to either load Metal code as string or from a file:
public func embedMetalCode(uniforms: [MetalUniform], code: String, fileName: String) throws -> String {
guard let bundle: Bundle = bundle else {
throw MetalError.fileNotFound("No bundle provided. Can't look for file \"\(fileName).txt\"")
}
guard let metalFile = bundle.url(forResource: fileName, withExtension: "txt") else {
throw MetalError.fileNotFound(fileName + ".txt")
}
do {
let metalCode = try String(contentsOf: metalFile)
return try embedMetalCode(uniforms: uniforms, code: code, metalBaseCode: metalCode)
} catch {
throw error
}
}
public func embedMetalCode(uniforms: [MetalUniform], code: String, metalBaseCode: String) throws -> String {
do {
var metalCode = metalBaseCode
let uniformsCode = try dynamicUniforms(uniforms: uniforms)
metalCode = try insert(uniformsCode, in: metalCode, at: "uniforms")
let comment = "/// PixelKit Dynamic Shader Code"
metalCode = try insert("\(comment)\n\n\n\(code)\n", in: metalCode, at: "code")
#if DEBUG
if logger.dynamicShaderCode {
print("\nDYNAMIC SHADER CODE\n\n>>>>>>>>>>>>>>>>>\n\n\(metalCode)\n<<<<<<<<<<<<<<<<<\n")
}
#endif
return metalCode
} catch {
throw error
}
}
With all of these the example did compile and I was able to test the different nodes, great project. If you experience the same with the example please consider fixing it, many thanks.
from pixelkit.
Nice fix,
I'm glad you got it working.
So I was able to reproduce the issue. It was caused by a missmatch of RenderKit and PixelKit versions.
I've switched over to swiftpm from pods for development and forgot to push the RenderKit pod.
New versions of RenderKit 0.4.2 and PixelKit 1.0.4 contains the fix.
Thanks,
/Anton
from pixelkit.
Related Issues (20)
- Export Green Screen in Swift HOT 27
- Video audio not included after export HOT 2
- Memory Leak (iPhone XS Max crash) HOT 1
- ScenePIX setup HOT 2
- SPM error HOT 5
- Question: Is it possible to get an IOSurface backed CVPixelBuffer from a PIX? HOT 1
- Question: Support for CoreML / Vision? HOT 1
- Low frame rate HOT 1
- Metal View res not set HOT 1
- The demo 'PixelKitLegacy' miss Podfile and can not be runned. HOT 1
- How to install? HOT 4
- Compatibility with Catalina ? HOT 5
- Wrong PI constant used in Metal Shaders
- Using RecordPIX ? HOT 1
- .gitmodules probably wrong URL HOT 1
- UIViewRepresentables must be value types: EdgePIX
- Invalid Metal draw Size
- I want to save the processed photos to the album HOT 2
- Unresolved identifier 'ImagePIXUI' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixelkit.