31 #if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA
35 @implementation SDL_cocoametalview
38 @synthesize tag = _tag;
43 return NSClassFromString(
@"CAMetalLayer");
47 -(BOOL) wantsUpdateLayer
55 -(CALayer*) makeBackingLayer
57 return [
self.class.layerClass layer];
60 - (instancetype)initWithFrame:(NSRect)frame
61 useHighDPI:(
bool)useHighDPI
63 if ((
self = [super initWithFrame:
frame])) {
66 self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
69 _useHighDPI = useHighDPI;
70 [
self updateDrawableSize];
77 - (
void)resizeSubviewsWithOldSize:(NSSize)oldSize {
78 [
super resizeSubviewsWithOldSize:oldSize];
79 [
self updateDrawableSize];
82 - (
void)updateDrawableSize
84 NSRect bounds = [
self bounds];
86 bounds = [
self convertRectToBacking:bounds];
88 ((CAMetalLayer *)
self.
layer).drawableSize = NSSizeToCGSize(bounds.size);
97 NSView *view = data->
nswindow.contentView;
99 SDL_cocoametalview *metalview
100 = [[SDL_cocoametalview alloc] initWithFrame:view.frame
103 metalview.wantsLayer = YES;
104 [view addSubview:metalview];
112 NSView *view = data->
nswindow.contentView;
113 SDL_cocoametalview* metalview = [view viewWithTag:
METALVIEW_TAG];
115 CAMetalLayer *
layer = (CAMetalLayer*)metalview.layer;
118 *w = layer.drawableSize.width;
121 *h = layer.drawableSize.height;
GLfloat GLfloat GLfloat GLfloat h
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLint GLint layer
GLubyte GLubyte GLubyte GLubyte w
EGLSurface EGLNativeWindowType * window
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
The type used to identify a window.