diff options
author | Jason Macnak <natsu@google.com> | 2023-04-19 23:03:21 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-04-19 23:03:21 +0000 |
commit | b10048abbe2c819358dd9937fdce6feab86a1b68 (patch) | |
tree | db0045eaa070657671a8bf3cda9d06ded022772f | |
parent | f931778bbd6ff9c98d37cbeb3926ce3f83f92007 (diff) | |
parent | 7842c60f13b4c4b55aaa7a2195688c2e7b174390 (diff) | |
download | vulkan-cereal-b10048abbe2c819358dd9937fdce6feab86a1b68.tar.gz |
Merge "Add vk debug annotations to guest command buffers"
-rw-r--r-- | stream-servers/vulkan/VkDecoderGlobalState.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/stream-servers/vulkan/VkDecoderGlobalState.cpp b/stream-servers/vulkan/VkDecoderGlobalState.cpp index 7ad1b1ca..1922dbef 100644 --- a/stream-servers/vulkan/VkDecoderGlobalState.cpp +++ b/stream-servers/vulkan/VkDecoderGlobalState.cpp @@ -3756,9 +3756,14 @@ class VkDecoderGlobalState::Impl { } std::lock_guard<std::recursive_mutex> lock(mLock); + + auto* deviceInfo = android::base::find(mDeviceInfo, device); + if (!deviceInfo) return VK_ERROR_UNKNOWN; + for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) { mCmdBufferInfo[pCommandBuffers[i]] = CommandBufferInfo(); mCmdBufferInfo[pCommandBuffers[i]].device = device; + mCmdBufferInfo[pCommandBuffers[i]].debugUtilsHelper = deviceInfo->debugUtilsHelper; mCmdBufferInfo[pCommandBuffers[i]].cmdPool = pAllocateInfo->commandPool; auto boxed = new_boxed_VkCommandBuffer(pCommandBuffers[i], vk, false /* does not own dispatch */); @@ -4199,8 +4204,16 @@ class VkDecoderGlobalState::Impl { } std::lock_guard<std::recursive_mutex> lock(mLock); - auto& bufferInfo = mCmdBufferInfo[commandBuffer]; - bufferInfo.reset(); + + auto* commandBufferInfo = android::base::find(mCmdBufferInfo, commandBuffer); + if (!commandBufferInfo) return VK_ERROR_UNKNOWN; + commandBufferInfo->reset(); + + if (context.processName) { + commandBufferInfo->debugUtilsHelper.cmdBeginDebugLabel(commandBuffer, "Process %s", + context.processName); + } + return VK_SUCCESS; } @@ -4217,6 +4230,15 @@ class VkDecoderGlobalState::Impl { auto commandBuffer = unbox_VkCommandBuffer(boxed_commandBuffer); auto vk = dispatch_VkCommandBuffer(boxed_commandBuffer); + std::lock_guard<std::recursive_mutex> lock(mLock); + + auto* commandBufferInfo = android::base::find(mCmdBufferInfo, commandBuffer); + if (!commandBufferInfo) return VK_ERROR_UNKNOWN; + + if (context.processName) { + commandBufferInfo->debugUtilsHelper.cmdEndDebugLabel(commandBuffer); + } + return vk->vkEndCommandBuffer(commandBuffer); } @@ -5696,6 +5718,7 @@ class VkDecoderGlobalState::Impl { VkDevice device = VK_NULL_HANDLE; VkCommandPool cmdPool = VK_NULL_HANDLE; VkCommandBuffer boxed = VK_NULL_HANDLE; + DebugUtilsHelper debugUtilsHelper = DebugUtilsHelper::withUtilsDisabled(); // Most recently bound compute pipeline and descriptor sets. We save it here so that we can // restore it after doing emulated texture decompression. |