diff --git a/engine/src/flutter/impeller/host/BUILD.gn b/engine/src/flutter/impeller/host/BUILD.gn index 483d1f391d..4161a8f818 100644 --- a/engine/src/flutter/impeller/host/BUILD.gn +++ b/engine/src/flutter/impeller/host/BUILD.gn @@ -14,6 +14,8 @@ executable("host") { cflags_objc = flutter_cflags_objc_arc cflags_objcc = flutter_cflags_objcc_arc + cflags_objcc += [ "-Wno-auto-var-id" ] + output_name = "impeller" sources = [ @@ -31,6 +33,7 @@ executable("host") { "AppKit.framework", "Metal.framework", "MetalKit.framework", + "QuartzCore.framework", "ModelIO.framework", ] @@ -38,6 +41,5 @@ executable("host") { ":impeller_host_shaders", "//flutter/fml", "//flutter/impeller/impeller", - "//third_party/glfw", ] } diff --git a/engine/src/flutter/impeller/host/impeller_host_view_controller.mm b/engine/src/flutter/impeller/host/impeller_host_view_controller.mm index 06a7b3b959..188030b29e 100644 --- a/engine/src/flutter/impeller/host/impeller_host_view_controller.mm +++ b/engine/src/flutter/impeller/host/impeller_host_view_controller.mm @@ -12,9 +12,9 @@ } - (void)loadView { - view_ = [[MTKView alloc] init]; + view_ = [[MTKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]; view_.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - [self setView:view_]; + self.view = view_; } - (void)viewDidLoad { diff --git a/engine/src/flutter/impeller/host/impeller_renderer.mm b/engine/src/flutter/impeller/host/impeller_renderer.mm index c113879ddc..0111eaa8f0 100644 --- a/engine/src/flutter/impeller/host/impeller_renderer.mm +++ b/engine/src/flutter/impeller/host/impeller_renderer.mm @@ -218,7 +218,6 @@ static const size_t kAlignedUniformsSize = (sizeof(Uniforms) & ~0xFF) + 0x100; - (void)drawInMTKView:(nonnull MTKView*)view { /// Per frame updates here - dispatch_semaphore_wait(_inFlightSemaphore, DISPATCH_TIME_FOREVER); id commandBuffer = [_commandQueue commandBuffer]; @@ -234,9 +233,8 @@ static const size_t kAlignedUniformsSize = (sizeof(Uniforms) & ~0xFF) + 0x100; [self _updateGameState]; /// Delay getting the currentRenderPassDescriptor until we absolutely need it - /// to avoid - /// holding onto the drawable and blocking the display pipeline any longer - /// than necessary + /// to avoid holding onto the drawable and blocking the display pipeline any + /// longer than necessary MTLRenderPassDescriptor* renderPassDescriptor = view.currentRenderPassDescriptor; @@ -293,6 +291,7 @@ static const size_t kAlignedUniformsSize = (sizeof(Uniforms) & ~0xFF) + 0x100; } - (void)mtkView:(nonnull MTKView*)view drawableSizeWillChange:(CGSize)size { + NSLog(@"Drawable sized did change: %@", NSStringFromSize(size)); float aspect = size.width / (float)size.height; _projectionMatrix = matrix_perspective_right_hand(65.0f * (M_PI / 180.0f), aspect, 0.1f, 100.0f); diff --git a/engine/src/flutter/impeller/host/main.mm b/engine/src/flutter/impeller/host/main.mm index 12aaa3c93c..c16c53b72a 100644 --- a/engine/src/flutter/impeller/host/main.mm +++ b/engine/src/flutter/impeller/host/main.mm @@ -19,16 +19,18 @@ if (self = [super init]) { view_controller_ = [[ImpellerHostViewController alloc] init]; window_ = [[NSWindow alloc] - initWithContentRect:NSMakeRect(0, 0, 800, 600) + initWithContentRect:NSMakeRect(200, 200, 800, 600) styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable backing:NSBackingStoreBuffered defer:NO]; + window_.styleMask |= NSWindowStyleMaskResizable; [window_ setContentViewController:view_controller_]; } return self; } - (void)applicationWillFinishLaunching:(NSNotification*)notification { + [window_ makeMainWindow]; [window_ setTitle:@"Impeller Host"]; [window_ makeKeyAndOrderFront:self]; } @@ -43,7 +45,7 @@ int main(int argc, const char* argv[]) { NSApplication* app = [NSApplication sharedApplication]; [app setActivationPolicy:NSApplicationActivationPolicyRegular]; NSMenuItem* item = [[NSMenuItem alloc] init]; - NSApp.mainMenu = [[NSMenu alloc] init]; + app.mainMenu = [[NSMenu alloc] init]; item.submenu = [[NSMenu alloc] init]; [app.mainMenu addItem:item]; [item.submenu