macos helpers
This commit is contained in:
@@ -12,9 +12,11 @@ typedef void CAMetalLayer;
|
|||||||
typedef void MTKView;
|
typedef void MTKView;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MTKView* gnCreateMTKView(NSWindow* window);
|
// MTKView* gnCreateMTKView(NSWindow* window);
|
||||||
void gnWindowSetMTKView(NSWindow* window, MTKView* view);
|
// void gnWindowSetMTKView(NSWindow* window, MTKView* view);
|
||||||
|
CAMetalLayer* gnCreateCAMetalLayer(NSWindow* window);
|
||||||
CAMetalLayer* gnGetCAMetalLayer(NSWindow* window);
|
CAMetalLayer* gnGetCAMetalLayer(NSWindow* window);
|
||||||
|
void gnAttachMetalLayer(NSWindow* window, CAMetalLayer* layer);
|
||||||
|
|
||||||
// CAMetalLayer* gnCreateMetalLayer(NSWindow* window);
|
// CAMetalLayer* gnCreateMetalLayer(NSWindow* window);
|
||||||
// void gnAttachMetalLayer(NSWindow* window, CAMetalLayer* layer);
|
// void gnAttachMetalLayer(NSWindow* window, CAMetalLayer* layer);
|
||||||
|
@@ -48,11 +48,32 @@ void gnWindowSetMTKView(NSWindow* window, MTKView* view) {
|
|||||||
[window setContentView:view];
|
[window setContentView:view];
|
||||||
}
|
}
|
||||||
|
|
||||||
CAMetalLayer* gnGetCAMetalLayer(NSWindow* window) {
|
CAMetalLayer* gnCreateCAMetalLayer(NSWindow* window) {
|
||||||
MTKView* view = window.contentView;
|
CAMetalLayer* layer = [CAMetalLayer layer];
|
||||||
return (CAMetalLayer*)view.layer;
|
layer.pixelFormat = MTLPixelFormatBGRA8Unorm;
|
||||||
|
layer.frame = window.contentView.layer.bounds;
|
||||||
|
window.contentView.wantsLayer = YES;
|
||||||
|
window.contentView.layer = layer;
|
||||||
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAMetalLayer* gnGetCAMetalLayer(NSWindow* window) {
|
||||||
|
return (CAMetalLayer*)window.contentView.layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gnAttachMetalLayer(NSWindow* window, CAMetalLayer* layer) {
|
||||||
|
// CGSize newSize = window.contentView.bounds.size;
|
||||||
|
// CGFloat scale = window.contentView.window.backingScaleFactor;
|
||||||
|
// layer.drawableSize = CGSizeMake(newSize.width * scale, newSize.height * scale);
|
||||||
|
// CAMetalLayer* layer = [CAMetalLayer layer];
|
||||||
|
// layer.pixelFormat = MTLPixelFormatBGRA8Unorm;
|
||||||
|
// layer.frame = window.contentView.layer.bounds;
|
||||||
|
// window.contentView.wantsLayer = YES;
|
||||||
|
// window.contentView.layer = layer;
|
||||||
|
layer.drawableSize = CGSizeMake(window.frame.size.width, window.frame.size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CAMetalLayer* gnCreateMetalLayer(NSWindow* window) {
|
CAMetalLayer* gnCreateMetalLayer(NSWindow* window) {
|
||||||
// CAMetalLayer* layer = [CAMetalLayer layer];
|
// CAMetalLayer* layer = [CAMetalLayer layer];
|
||||||
|
Reference in New Issue
Block a user