Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working #1

Closed
miquellaboria opened this issue Jan 25, 2022 · 2 comments
Closed

Not working #1

miquellaboria opened this issue Jan 25, 2022 · 2 comments

Comments

@miquellaboria
Copy link

miquellaboria commented Jan 25, 2022

When I execute, I get an error:

Error Domain=MTLLibraryErrorDomain Code=5 "Function mtiSurfaceBlur was not found in the library" UserInfo={NSLocalizedDescription=Function mtiSurfaceBlur was not found in the library}

My code is:
`
guard let cgImage = image.cgImage else { return }

    let filter = MTISurfaceBlurFilter(radius: radius)
    filter.threshold = threshold
    filter.inputImage = MTIImage(__cgImage: cgImage, options: nil, isOpaque: true)

    let options = MTIContextOptions()

    guard let device = MTLCreateSystemDefaultDevice(), let context = try? MTIContext(device: device, options: options), let outputImage = filter.outputImage else {
        return
    }

    do {
        let filteredImage = try context.makeCGImage(from: outputImage)

        filteredImg = UIImage(cgImage: filteredImage)
        importImage.image = filteredImg
    } catch {
        print(error)
    }`

Any help is appreciated! Thanks!

@YuAo
Copy link
Member

YuAo commented Jan 26, 2022

Try change the function name here to "metalpetal::surfaceblur::mtiSurfaceBlur"

fragmentFunctionDescriptor:[[MTIFunctionDescriptor alloc] initWithName:@"mtiSurfaceBlur" constantValues:constants libraryURL:MTIDefaultLibraryURLForBundle([NSBundle bundleForClass:self.class])]

@YuAo
Copy link
Member

YuAo commented Jan 28, 2022

Fixed via 744f8cb

@YuAo YuAo closed this as completed Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants