30 #if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) 34 @implementation SDL_cocoametalview
37 @synthesize tag = _tag;
42 return NSClassFromString(
@"CAMetalLayer");
46 - (BOOL)wantsUpdateLayer
54 - (CALayer*)makeBackingLayer
56 return [
self.class.layerClass layer];
59 - (instancetype)initWithFrame:(NSRect)frame
62 if ((
self = [super initWithFrame:
frame])) {
64 self.wantsLayer = YES;
67 self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
72 self.layer.contentsScale =
scale;
79 - (
void)resizeWithOldSuperviewSize:(NSSize)oldSize
81 [
super resizeWithOldSuperviewSize:oldSize];
90 NSView *view = data->
nswindow.contentView;
102 NSWindow* nswindow = data->
nswindow;
103 if ([nswindow.screen respondsToSelector:
@selector(backingScaleFactor)])
107 SDL_cocoametalview *metalview
108 = [[SDL_cocoametalview alloc] initWithFrame:view.frame scale:scale];
109 [view addSubview:metalview];
114 Cocoa_Mtl_GetDrawableSize(
SDL_Window * window,
int *
w,
int *
h)
117 NSView *view = data->
nswindow.contentView;
118 SDL_cocoametalview* metalview = [view viewWithTag:METALVIEW_TAG];
120 CAMetalLayer *
layer = (CAMetalLayer*)metalview.layer;
123 *w = layer.drawableSize.width;
126 *h = layer.drawableSize.height;
GLenum GLenum GLenum GLenum GLenum scale
GLfloat GLfloat GLfloat GLfloat h
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLint GLint layer
#define SDL_GetWindowSize
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.