Skip to content

Commit 48e0d7d

Browse files
Mee-guminggo
authored andcommitted
resize metal drawable (#20074)
1 parent 73ad115 commit 48e0d7d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cocos/platform/mac/CCGLViewImpl-mac.mm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ of this software and associated documentation files (the "Software"), to deal
319319
return false;
320320
}
321321

322-
323322
int fbWidth, fbHeight;
324323
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);
325324

@@ -879,6 +878,14 @@ of this software and associated documentation files (the "Software"), to deal
879878
setDesignResolutionSize(baseDesignSize.width, baseDesignSize.height, baseResolutionPolicy);
880879
Director::getInstance()->setViewport();
881880
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(GLViewImpl::EVENT_WINDOW_RESIZED, nullptr);
881+
882+
//update metal drawable size.
883+
int fbWidth, fbHeight;
884+
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);
885+
CGSize size;
886+
size.width = static_cast<CGFloat>(fbWidth);
887+
size.height = static_cast<CGFloat>(fbHeight);
888+
[backend::DeviceMTL::getCAMetalLayer() setDrawableSize:size];
882889
}
883890
}
884891

0 commit comments

Comments
 (0)