mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-27 19:54:38 +00:00
Prepare nested Metal layers before compositing
Traverse the layer tree before compositing so nested Metal layers consume queued drawables and recycle their pool. Add a nested presentation probe covering pool reuse and Vulkan-to-OpenGL pixel readback.
This commit is contained in:
1 parent
3d03548b54
commit
937e632bcf
4 files changed
+40
-15
No files matched your search
@@ -40,7 +40,18 @@ int main() {
|
||||
layer.frame = CGRectMake(0,0,160,96);
|
||||
NSView* view = [[NSView alloc] initWithFrame:NSMakeRect(0,0,160,96)];
|
||||
view.wantsLayer = YES;
|
||||
view.layer = layer;
|
||||
const bool nested = getenv("RIOT_PRESENTATION_NESTED") != nullptr;
|
||||
if (nested) {
|
||||
CALayer* root = [CALayer layer];
|
||||
root.frame = layer.frame;
|
||||
CALayer* container = [CALayer layer];
|
||||
container.frame = layer.frame;
|
||||
[container addSublayer:layer];
|
||||
[root addSublayer:container];
|
||||
view.layer = root;
|
||||
} else {
|
||||
view.layer = layer;
|
||||
}
|
||||
NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(50,50,160,96)
|
||||
styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO];
|
||||
window.title = @"Metal presentation check";
|
||||
@@ -92,7 +103,8 @@ int main() {
|
||||
fprintf(stderr, "PASS: bounded presentation capture rearmed without restarting\n");
|
||||
}
|
||||
fprintf(stderr, "PASS: Vulkan-to-OpenGL presentation pixels\n");
|
||||
fprintf(stderr, "PASS: late context attachment and %u Metal drawable presentations\n", frameCount);
|
||||
fprintf(stderr, "PASS: %s layer, late context attachment and %u Metal drawable presentations\n",
|
||||
nested ? "nested" : "root", frameCount);
|
||||
[window orderOut:nil];
|
||||
[queue release]; [view release]; [window release]; [device release];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user