GithubHelp home page GithubHelp logo

Comments (3)

BradLarson avatar BradLarson commented on August 20, 2024

Yes, it is. Make sure you are targeting an actual device or the Generic iOS Device build target. Metal is not supported in the iOS Simulator, and you have to use the camera for most of our current examples, so this needs to be run on a device.

Alternatively, you can try out the Mac FilterShowcase and other sample applications, which will run natively on your Mac, to get an idea of how this works. Almost all code is shared between iOS and Mac targets for the framework.

from gpuimage3.

hggz avatar hggz commented on August 20, 2024

Im getting an exception when I attempt to launch the Mac filter show case app:

[MTLRenderPipelineDescriptorInternal setRasterSampleCount:]: unrecognized selector sent to instance 0x600000199d90

Seems to be happening line 56 of the MTLCommandBuffer file of the linked gpuimage framework because it can't recognize this property. Any thoughts off the top of your head why? (I'm just returning to your repos after a few years and am combing through your work in Swift. Very nice)

Temporarily removing the line from the packaged framework seems to work fine at first glance.

func generateRenderPipelineState(device:MetalRenderingDevice, vertexFunctionName:String, fragmentFunctionName:String, operationName:String) -> MTLRenderPipelineState {
    guard let vertexFunction = device.shaderLibrary.makeFunction(name: vertexFunctionName) else {
        fatalError("\(operationName): could not compile vertex function \(vertexFunctionName)")
    }
    
    guard let fragmentFunction = device.shaderLibrary.makeFunction(name: fragmentFunctionName) else {
        fatalError("\(operationName): could not compile fragment function \(fragmentFunctionName)")
    }
    
    let descriptor = MTLRenderPipelineDescriptor()
    descriptor.colorAttachments[0].pixelFormat = MTLPixelFormat.bgra8Unorm
    **descriptor.rasterSampleCount = 1**
    descriptor.vertexFunction = vertexFunction
    descriptor.fragmentFunction = fragmentFunction
    
    do {
        return try device.device.makeRenderPipelineState(descriptor: descriptor)
    } catch {
        fatalError("Could not create render pipeline state for vertex:\(vertexFunctionName), fragment:\(fragmentFunctionName), error:\(error)")
    }
}

from gpuimage3.

BradLarson avatar BradLarson commented on August 20, 2024

@hggz - That's weird. What OS and Xcode version are you seeing this with?

We originally had sampleCount there instead of rasterSampleCount, but the header noted that the former had been deprecated in favor of the latter. However, it didn't have a hard deprecation notice on it yet, and that might not exist prior to High Sierra. I should be getting a warning about that, due to the older deployment target, but I don't think it was denoted with the proper availability markings.

Try switching rasterSampleCount to sampleCount and see if this works. If so, I'll swap it back in the code.

from gpuimage3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.