Files
baldurk 65b567a944 Add macOS windowing system to public API
* For now it expects a CALayer since this works around a MoltenVK bug
2018-09-05 12:50:58 +01:00

19 lines
523 B
Plaintext

#import <Cocoa/Cocoa.h>
#include <QuartzCore/CAMetalLayer.h>
// taken from Arseny's comment explaining how to make Qt widgets metal compatible:
// https://github.com/KhronosGroup/MoltenVK/issues/78#issuecomment-369838674
extern "C" void *makeNSViewMetalCompatible(void *handle)
{
NSView *view = (NSView *)handle;
assert([view isKindOfClass:[NSView class]]);
if(![view.layer isKindOfClass:[CAMetalLayer class]])
{
[view setLayer:[CAMetalLayer layer]];
[view setWantsLayer:YES];
}
return view.layer;
}