Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plume_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,19 @@ namespace plume {

bool MetalSwapChain::resize() {
MetalAutoreleasePool releasePool;

// Drop any drawables still held from the previous swap chain generation.
// On iOS the layer's drawables are invalidated when the app is suspended,
// and holding or presenting them across a resume is undefined behavior.
// Callers idle the GPU before resizing, so the references are safe to release.
for (uint32_t i = 0; i < MAX_DRAWABLES; i++) {
MetalDrawable &drawable = drawables[i];
if (drawable.mtl != nullptr) {
drawable.mtl->release();
drawable.mtl = nullptr;
}
}

getWindowSize(width, height);

if (width == 0 || height == 0) {
Expand Down