aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYahan Zhou <yahan@google.com>2024-03-06 20:53:25 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-03-06 20:53:25 +0000
commit3b32088273b2c947185680d7888a097bcdf18149 (patch)
tree4534bb42fab7a013e76d0fcfe25ff13d27682cde
parent9d8fb629f8c6565d19d5c238e7724a2e310aee6f (diff)
parentaa954c7dcfbd3f8d32d66f0bad93de38852a850b (diff)
downloadgfxstream-emu-34-2-dev.tar.gz
Merge "Use update instead of addFixed when applicable" into mainemu-34-2-dev
-rw-r--r--host/vulkan/VkDecoderGlobalState.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp
index 2536720e..4c26a281 100644
--- a/host/vulkan/VkDecoderGlobalState.cpp
+++ b/host/vulkan/VkDecoderGlobalState.cpp
@@ -245,6 +245,17 @@ class BoxedHandleManager {
return res;
}
+ void update(uint64_t handle, const T& item, BoxedHandleTypeTag tag) {
+ auto storedItem = store.get(handle);
+ uint64_t oldHandle = (uint64_t)storedItem->underlying;
+ *storedItem = item;
+ AutoLock l(lock);
+ if (oldHandle) {
+ reverseMap.erase(oldHandle);
+ }
+ reverseMap[(uint64_t)(item.underlying)] = handle;
+ }
+
void remove(uint64_t h) {
auto item = get(h);
if (item) {
@@ -2286,7 +2297,6 @@ class VkDecoderGlobalState::Impl {
{
std::lock_guard<std::recursive_mutex> lock(mLock);
auto boxed_fence = unboxed_to_boxed_non_dispatchable_VkFence(fence);
- delete_VkFence(boxed_fence);
set_boxed_non_dispatchable_VkFence(boxed_fence, replacement);
auto& fenceInfo = mFenceInfo[replacement];
@@ -6000,7 +6010,7 @@ class VkDecoderGlobalState::Impl {
void set_boxed_non_dispatchable_##type(type boxed, type underlying) { \
DispatchableHandleInfo<uint64_t> item; \
item.underlying = (uint64_t)underlying; \
- sBoxedHandleManager.addFixed((uint64_t)boxed, item, Tag_##type); \
+ sBoxedHandleManager.update((uint64_t)boxed, item, Tag_##type); \
} \
type unboxed_to_boxed_non_dispatchable_##type(type unboxed) { \
AutoLock lock(sBoxedHandleManager.lock); \