Skip to content

Commit dfa9620

Browse files
committed
gfx/drivers/metal: fold metal_common.h into metal.m
metal_common.h was a 420-line header included from exactly three translation units: metal.m itself, ui/drivers/ui_cocoa.m, and ui/drivers/ui_cocoatouch.m. Of those, only metal.m used more than a single declaration -- both UI files only needed the empty @interface MetalView : MTKView @EnD forward declaration to type the result of [MetalView new] and a (MetalView *) cast on _renderView. The other ~415 lines (Context, FrameView, MetalDriver, MenuDisplay, HDR machinery, RPixelFormat enum, the slang_process.h transitive include, etc.) were dead weight on the two UI translation units. Move the header's content into metal.m where it was already used as a single TU via griffin_objc.m's umbrella, and replace the includes in the two UI files with the three-line MetalView forward decl plus <MetalKit/MetalKit.h>. No public Metal driver C/Obj-C symbols are referenced outside metal.m, so nothing else needs to change. Optimisations enabled by the fold: - The four file-scope C functions exposed only for "external" consumers that did not exist (RPixelFormatToBPP, matrix_proj_ortho, glslang_format_to_metal, SelectOptimalPixelFormat) become static. glslang_format_to_metal and SelectOptimalPixelFormat get matching static forward decls near the top of the file because their definitions sit below their first call sites. - Three properties that were declared in the public header surface for downstream consumers that never materialised are dead in the closed system and have been removed: Context.drawableFormat (getter returned _layer.pixelFormat) Context.hdrOffscreenFormat (getter returned _hdrOffscreenFormat) FrameView.shaderEmitsHDR10 FrameView.shaderEmitsHDR16 The backing ivars _hdrOffscreenFormat, _shaderEmitsHDR10, and _shaderEmitsHDR16 are kept -- they are still read inside the owning class. Only the public Obj-C accessors and their @Property declarations are gone. - RETRO_BEGIN_DECLS / RETRO_END_DECLS dropped along with the retro_common_api.h include they required (no public C API left). - Foundation/Metal/MetalKit/QuartzCore umbrella imports collapsed to the set already present at the top of metal.m. The two pkg/apple/RetroArch_Metal.xcodeproj entries for metal_common.h are removed. The header had two PBXFileReference IDs in the project (one declared, one dangling under the metal/ group); both group children entries and the lone declaration are dropped. Diff: +391 / -446 metal.m, -420 metal_common.h, -8/-9 ui_cocoa{,touch}.m, -3 project.pbxproj. Net -61 lines. griffin/griffin_objc.m only #imports metal.m and is unaffected. The Makefile.common metal.o rule and the per-file -fobjc-arc override in the top-level Makefile (metal.m only) are unchanged; MRC-compiled ui_cocoa{,touch}.m gain a tiny @interface MetalView : MTKView @EnD that has no methods or properties and so compiles identically under either memory model.
1 parent ca7a18f commit dfa9620

5 files changed

Lines changed: 385 additions & 446 deletions

File tree

0 commit comments

Comments
 (0)