Improved idle performance in the Cocoa port when using Metal
This commit is contained in:
parent
1b049b8f75
commit
9080a23913
@ -140,9 +140,6 @@
|
|||||||
GB_set_clock_multiplier(_gb, clockMultiplier);
|
GB_set_clock_multiplier(_gb, clockMultiplier);
|
||||||
}
|
}
|
||||||
current_buffer = (current_buffer + 1) % self.numberOfBuffers;
|
current_buffer = (current_buffer + 1) % self.numberOfBuffers;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
[self setNeedsDisplay:YES];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (uint32_t *) pixels
|
- (uint32_t *) pixels
|
||||||
|
@ -23,4 +23,12 @@
|
|||||||
((GBOpenGLView *)self.internalView).openGLContext = context;
|
((GBOpenGLView *)self.internalView).openGLContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)flip
|
||||||
|
{
|
||||||
|
[super flip];
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[self setNeedsDisplay:YES];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -42,6 +42,7 @@ static const vector_float2 rect[] =
|
|||||||
MTKView *view = [[MTKView alloc] initWithFrame:self.frame device:(device = MTLCreateSystemDefaultDevice())];
|
MTKView *view = [[MTKView alloc] initWithFrame:self.frame device:(device = MTLCreateSystemDefaultDevice())];
|
||||||
view.delegate = self;
|
view.delegate = self;
|
||||||
self.internalView = view;
|
self.internalView = view;
|
||||||
|
view.paused = YES;
|
||||||
|
|
||||||
MTLTextureDescriptor *texture_descriptor = [[MTLTextureDescriptor alloc] init];
|
MTLTextureDescriptor *texture_descriptor = [[MTLTextureDescriptor alloc] init];
|
||||||
|
|
||||||
@ -125,10 +126,14 @@ static const vector_float2 rect[] =
|
|||||||
- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size
|
- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size
|
||||||
{
|
{
|
||||||
output_resolution = (vector_float2){size.width, size.height};
|
output_resolution = (vector_float2){size.width, size.height};
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[(MTKView *)self.internalView draw];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawInMTKView:(nonnull MTKView *)view
|
- (void)drawInMTKView:(nonnull MTKView *)view
|
||||||
{
|
{
|
||||||
|
if (!(view.window.occlusionState & NSWindowOcclusionStateVisible)) return;
|
||||||
[texture replaceRegion:region
|
[texture replaceRegion:region
|
||||||
mipmapLevel:0
|
mipmapLevel:0
|
||||||
withBytes:[self currentBuffer]
|
withBytes:[self currentBuffer]
|
||||||
@ -188,4 +193,13 @@ static const vector_float2 rect[] =
|
|||||||
|
|
||||||
[command_buffer commit];
|
[command_buffer commit];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)flip
|
||||||
|
{
|
||||||
|
[super flip];
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[(MTKView *)self.internalView draw];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
Reference in New Issue
Block a user