diff options
author | Jason Macnak <natsu@google.com> | 2023-04-19 23:51:56 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-04-19 23:51:56 +0000 |
commit | 9346682989213a2df4365303cf5c42b96c03abbb (patch) | |
tree | db0045eaa070657671a8bf3cda9d06ded022772f | |
parent | 5befea5fc51d0ed25773155dfd5ae046e896fe12 (diff) | |
parent | b10048abbe2c819358dd9937fdce6feab86a1b68 (diff) | |
download | vulkan-cereal-9346682989213a2df4365303cf5c42b96c03abbb.tar.gz |
Merge "Add vk debug annotations to guest command buffers" am: b10048abbe
Original change: https://android-review.googlesource.com/c/device/generic/vulkan-cereal/+/2280657
Change-Id: I51bacf1b149dbb466d52d67e35c4303692adf936
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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. |