mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
13ec384dbe
This adds it to all files that use it. Not all our builds include the file.
38 lines
985 B
Plaintext
38 lines
985 B
Plaintext
#include "ppsspp_config.h"
|
|
#if PPSSPP_PLATFORM(MAC)
|
|
#import <Cocoa/Cocoa.h>
|
|
#else
|
|
#import <UIKit/UIKit.h>
|
|
#endif
|
|
#import <QuartzCore/CAMetalLayer.h>
|
|
|
|
#include "SDLCocoaMetalLayer.h"
|
|
|
|
void *makeWindowMetalCompatible(void *window) {
|
|
// https://github.com/KhronosGroup/MoltenVK/issues/78#issuecomment-371118536
|
|
#if PPSSPP_PLATFORM(MAC)
|
|
NSView *view = ((NSWindow *)window).contentView;
|
|
assert([view isKindOfClass:[NSView class]]);
|
|
|
|
if (![view.layer isKindOfClass:[CAMetalLayer class]])
|
|
{
|
|
[view setLayer:[CAMetalLayer layer]];
|
|
}
|
|
return view.layer;
|
|
#else
|
|
UIView *view = (UIView *)window;
|
|
assert([view isKindOfClass:[UIView class]]);
|
|
|
|
CAMetalLayer *metalLayer = [CAMetalLayer new];
|
|
|
|
CGSize viewSize = view.frame.size;
|
|
metalLayer.frame = view.frame;
|
|
metalLayer.opaque = true;
|
|
metalLayer.framebufferOnly = true;
|
|
metalLayer.drawableSize = viewSize;
|
|
metalLayer.pixelFormat = (MTLPixelFormat)80;//BGRA8Unorm==80
|
|
[view.layer addSublayer:metalLayer];
|
|
return metalLayer;
|
|
#endif
|
|
}
|