From c16e52f9c29e5c020dfdb5be69f15f7af2728266 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Sun, 10 Sep 2023 22:31:04 -0700 Subject: [PATCH] Vulkan: Conditionally enable `CommandBufferLabelScope` with `GraphicsDebugLevel.All` --- src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 2 +- src/Ryujinx.Graphics.Vulkan/TextureView.cs | 2 +- src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 3f5003d05..2f1583728 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -1687,7 +1687,7 @@ namespace Ryujinx.Graphics.Vulkan { PauseTransformFeedbackInternal(); Gd.Api.CmdEndRenderPass(CommandBuffer); - _renderPassLabelScope.Dispose(); + _renderPassLabelScope?.Dispose(); _renderPassLabelScope = null; SignalRenderPassEnd(); RenderPassActive = false; diff --git a/src/Ryujinx.Graphics.Vulkan/TextureView.cs b/src/Ryujinx.Graphics.Vulkan/TextureView.cs index 60a55662f..c9a48e623 100644 --- a/src/Ryujinx.Graphics.Vulkan/TextureView.cs +++ b/src/Ryujinx.Graphics.Vulkan/TextureView.cs @@ -786,7 +786,7 @@ namespace Ryujinx.Graphics.Vulkan for (int level = 0; level < levels; level++) { - debugScope.InsertLabel($"level: {level}", new ColorF(1, 1, 0, 1)); + debugScope?.InsertLabel($"level: {level}", new ColorF(1, 1, 0, 1)); int mipSize = GetBufferDataLength(Info.GetMipSize2D(dstLevel + level) * dstLayers); diff --git a/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs b/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs index 8d117714a..d13ffb427 100644 --- a/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs +++ b/src/Ryujinx.Graphics.Vulkan/VulkanDebugMessenger.cs @@ -36,7 +36,11 @@ namespace Ryujinx.Graphics.Vulkan public ILabelScope CreateLabelScope(CommandBuffer commandBuffer, string scopeName, ColorF scopeColor) { - return new CommandBufferLabelScope(_debugUtils, commandBuffer, scopeName, scopeColor); + if (_logLevel == GraphicsDebugLevel.All) + { + return new CommandBufferLabelScope(_debugUtils, commandBuffer, scopeName, scopeColor); + } + return null; } private Result TryInitialize(out DebugUtilsMessengerEXT? debugUtilsMessengerHandle)