metal: Add some missing debug labels and groups

This commit is contained in:
Tor Arne Vestbø 2019-09-02 18:46:13 +02:00
parent bc52b952d7
commit 91caf28bfc
3 changed files with 18 additions and 7 deletions

View File

@ -493,8 +493,10 @@
- (id<MTLCommandBuffer>)blitCommandBuffer - (id<MTLCommandBuffer>)blitCommandBuffer
{ {
if (!_blitCommandBuffer) if (!_blitCommandBuffer) {
_blitCommandBuffer = [_commandQueue commandBuffer]; _blitCommandBuffer = [_commandQueue commandBuffer];
_blitCommandBuffer.label = @"Blit command buffer";
}
return _blitCommandBuffer; return _blitCommandBuffer;
} }
@ -562,6 +564,7 @@
assert(_commandBuffer == nil); assert(_commandBuffer == nil);
dispatch_semaphore_wait(_inflightSemaphore, DISPATCH_TIME_FOREVER); dispatch_semaphore_wait(_inflightSemaphore, DISPATCH_TIME_FOREVER);
_commandBuffer = [_commandQueue commandBuffer]; _commandBuffer = [_commandQueue commandBuffer];
_commandBuffer.label = @"Frame command buffer";
_backBuffer = nil; _backBuffer = nil;
} }
@ -579,6 +582,7 @@
_backBuffer = self.nextDrawable.texture; _backBuffer = self.nextDrawable.texture;
} }
_rce = [_commandBuffer renderCommandEncoderWithDescriptor:rpd]; _rce = [_commandBuffer renderCommandEncoderWithDescriptor:rpd];
_rce.label = @"Frame command encoder";
} }
return _rce; return _rce;
} }

View File

@ -52,7 +52,6 @@
{ {
id<MTLComputeCommandEncoder> ce = [cb computeCommandEncoder]; id<MTLComputeCommandEncoder> ce = [cb computeCommandEncoder];
ce.label = @"filter kernel"; ce.label = @"filter kernel";
[ce pushDebugGroup:@"filter kernel"];
[ce setComputePipelineState:_kernel]; [ce setComputePipelineState:_kernel];
@ -67,7 +66,6 @@
[ce dispatchThreadgroups:count threadsPerThreadgroup:size]; [ce dispatchThreadgroups:count threadsPerThreadgroup:size];
[ce popDebugGroup];
[ce endEncoding]; [ce endEncoding];
} }
@ -75,8 +73,7 @@
{ {
id<MTLComputeCommandEncoder> ce = [cb computeCommandEncoder]; id<MTLComputeCommandEncoder> ce = [cb computeCommandEncoder];
ce.label = @"filter kernel"; ce.label = @"filter kernel";
[ce pushDebugGroup:@"filter kernel"];
[ce setComputePipelineState:_kernel]; [ce setComputePipelineState:_kernel];
[ce setBuffer:tin offset:0 atIndex:0]; [ce setBuffer:tin offset:0 atIndex:0];
@ -89,7 +86,6 @@
[ce dispatchThreadgroups:count threadsPerThreadgroup:size]; [ce dispatchThreadgroups:count threadsPerThreadgroup:size];
[ce popDebugGroup];
[ce endEncoding]; [ce endEncoding];
} }

View File

@ -299,10 +299,11 @@
[self _drawCore:video_info]; [self _drawCore:video_info];
[self _drawMenu:video_info]; [self _drawMenu:video_info];
id<MTLRenderCommandEncoder> rce = _context.rce;
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (_overlay.enabled) if (_overlay.enabled)
{ {
id<MTLRenderCommandEncoder> rce = _context.rce;
[rce pushDebugGroup:@"overlay"]; [rce pushDebugGroup:@"overlay"];
[_context resetRenderViewport:_overlay.fullscreen ? kFullscreenViewport : kVideoViewport]; [_context resetRenderViewport:_overlay.fullscreen ? kFullscreenViewport : kVideoViewport];
[rce setRenderPipelineState:[_context getStockShader:VIDEO_SHADER_STOCK_BLEND blend:YES]]; [rce setRenderPipelineState:[_context getStockShader:VIDEO_SHADER_STOCK_BLEND blend:YES]];
@ -319,19 +320,29 @@
if (osd_params) if (osd_params)
{ {
[rce pushDebugGroup:@"video stats"];
font_driver_render_msg(video_info, NULL, video_info->stat_text, osd_params); font_driver_render_msg(video_info, NULL, video_info->stat_text, osd_params);
[rce popDebugGroup];
} }
} }
#ifdef HAVE_MENU #ifdef HAVE_MENU
#ifdef HAVE_MENU_WIDGETS #ifdef HAVE_MENU_WIDGETS
if (video_info->widgets_inited) if (video_info->widgets_inited)
{
[rce pushDebugGroup:@"menu widgets"];
menu_widgets_frame(video_info); menu_widgets_frame(video_info);
[rce popDebugGroup];
}
#endif #endif
#endif #endif
if (msg && *msg) if (msg && *msg)
{
[rce pushDebugGroup:@"message"];
[self _renderMessage:msg info:video_info]; [self _renderMessage:msg info:video_info];
[rce popDebugGroup];
}
[self _endFrame]; [self _endFrame];
} }