projectGenerator icon indicating copy to clipboard operation
projectGenerator copied to clipboard

Fix .Metal shader import type

Open danoli3 opened this issue 1 year ago • 2 comments

As reported in Live repo @sortofsleepy https://github.com/sortofsleepy/ofxARKit

Screenshot 2024-03-06 at 5 12 33 pm

This addon involves use of Apple's Metal framework to handle camera imaging and processing as the raw feed from your phone/tablet's camera comes in unprocessed. In the src files there is a Shader.metal file included which handles turning that unprocessed image into something more recognizeable. There is also Metal code that takes care of translating the resulting Metal textures to OpenGL compatible ones. At the time of this writing, for some reason, projectGenerator does not treat .metal files correctly and labels it as a Data file instead of a Metal file. You will likely have to change it to it's correct designation by using the file inspector in Xcode. projectGenerator also does not automatically add it to the list of compiled sources for a project so you will have to do that as well.

danoli3 avatar Mar 06 '24 06:03 danoli3

Nice, I think this one should not be hard to address in the up to date PG

dimitre avatar Mar 06 '24 17:03 dimitre

Kinda a blast from the past. I actually opened an issue many many years ago about this #183

Cool to hear it sounds like it'll be easy to fix.

sortofsleepy avatar Mar 06 '24 17:03 sortofsleepy

I think this one can be closed I've recently generated the basic example in ofxARKit and it seems the Metal shader is OK. Can you please verify it @sortofsleepy ? Thanks! Screenshot 2024-05-20 at 20 40 20

dimitre avatar May 20 '24 23:05 dimitre

I think this one can be closed I've recently generated the basic example in ofxARKit and it seems the Metal shader is OK. Can you please verify it @sortofsleepy ? Thanks! ..

🎉 @dimitre

Unfortunately I have no Mac or iPhone at the moment so I can't check myself but I'll take your word for it. If the project generator copies and defines things properly then great! Feel free to close.

note that even though the file is now properly defined, you might still have issues actually running the examples, see the pinned comment under issues inside the ofxARKit repo if you want to verify everything. I'd say as long as the file is properly recognized, that it's enough to just close this issue regardless.

sortofsleepy avatar May 21 '24 00:05 sortofsleepy

Great I'll left it open for now. I have an ancient iPhone here from 2016, let's see if I can use it to test later 📱

dimitre avatar May 21 '24 00:05 dimitre

I've tested here, I'm not sure if it fixes because the addon fails somewhere else

/Volumes/tool/ofw/addons/ofxARKit/src/lib/ARSessionSetup.h:72:50 No known class method for selector 'supportsFrameSemantics'

dimitre avatar May 21 '24 16:05 dimitre

hmmm that's a new one for me considering the function "should" exist according to this. I'm assuming you attempted to re-integrate the addon? Did you remember to add the ARKit framework?

In any case, I would say that that is a separate issue I'll have to somehow try and address at some point(though who can say when that'll be in this job market 😞).

As long as Metal shaders are

  • recognized as Metal shaders and
  • are added to the list of compiled sources

then I think it's fine to close this issue.

sortofsleepy avatar May 21 '24 19:05 sortofsleepy

Glad you pointed me to adding ARKit. I've added and the error persists in fact I'm updating the projectGenerator so ADDON_FRAMEWORKS get added automatically to the folder and build phases

dimitre avatar May 21 '24 20:05 dimitre

@danoli3 can you please test this one to see if it is working?

dimitre avatar May 24 '24 13:05 dimitre

@dimitre yep this is working

danoli3 avatar Jun 05 '24 02:06 danoli3