Support building with objc-arc, enable by default.#3226
Support building with objc-arc, enable by default.#3226furby-tm wants to merge 2 commits intoPixarAnimationStudios:devfrom
Conversation
Signed-off-by: furby™ <devs@wabi.foundation>
|
Filed as internal issue #USD-9971 |
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Thanks for putting this up, this is a great change. I think we had a couple notes:
I think the two notes would simplify a lot of things going forward. |
|
I'm not aware of any objections to turning on ARC all the time on Apple, or on non-Apple deployments of Swift or ObjC. |
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@dgovil thanks for looking into this, if ARC is to be enabled by default is this something that should be added to the clang defaults here? Under the existing If so, then I can additionally cleanup (remove) any of my revisions to the existing cmake code. AFAIK this revision covers any of the few minor breaking changes that enabling ARC will have on the codebase, but will test this theory once changing the clang defaults to always enable ARC on apple platforms. |
|
Yeah, I think putting it in the clang defaults makes the most sense to me. That would mean any future targets just automatically get it as a result, so nobody needs to remember to enable it. |
Signed-off-by: furby™ <devs@wabi.foundation>
|
Everything checks out on my end, now with ARC enabled in the clang defaults. |
|
Awesome! I look forward to this landing. Thanks again for catching that and doing the work for it. |
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* Note blitCmds.mm is still using the wrong MTLResource type on L.361, which should be MTLBuffer, but that issue is addressed in the following PR: PixarAnimationStudios#3226 Signed-off-by: furby™ <devs@wabi.foundation>
* Note blitCmds.mm is still using the wrong MTLResource type on L.361, which should be MTLBuffer, but that issue is addressed in the following PR: PixarAnimationStudios#3226 Signed-off-by: furby™ <devs@wabi.foundation>
-fobjc-arc.Description of Change(s)
Modified the CMake build to set target compile options on the
hgiMetalandgarchtargets, to enable-fobjc-arcby default on Apple platforms, when the compiler matches any of the Clang derivatives.HgiMetal was originally not compiling without this revision, it appears the usage of
MTLResourcehere was not what was intended as far as I'm aware -- at least from the following call made todidModifyRange, which does not exist onMTLResourcebut it does exist onMTLBuffer, so I have changed it toMTLBufferinstead. I believe this means we can get rid of these Arch pragmas as well.Guarded all
retainandreleasecalls with!__has_feature(objc_arc)which are otherwise a compiler error, forbidden when ARC is enabled.HgiMetal: Modified the implicit casting from
GetRawResource() -> uint64_tto theid<MTLTexture>variables (colorTextureanddepthTexture) withinHgiInteropMetal.CompositeToInterop()to first cast them tovoid *, and then toid<MTLTexture>bridging casts.Edit 8.12.24 10:05AM (PDT): Minor revision, to use a
reinterpret_castinstead of the C-style cast.Garch: Modified the return statement of
GarchSelectCoreProfileMacVisual()to do avoid *bridging cast.