diff --git a/app/src/main/cpp/skyline/gpu/buffer_manager.h b/app/src/main/cpp/skyline/gpu/buffer_manager.h index c377b48f..f32b89fc 100644 --- a/app/src/main/cpp/skyline/gpu/buffer_manager.h +++ b/app/src/main/cpp/skyline/gpu/buffer_manager.h @@ -94,6 +94,15 @@ namespace skyline::gpu { * @return A pre-existing or newly created Buffer object which covers the supplied mappings * @note The buffer manager **must** be locked prior to calling this */ - BufferView FindOrCreate(GuestBuffer guestMapping, ContextTag tag = {}, const std::function, ContextLock &&)> &attachBuffer = {}); + BufferView FindOrCreateImpl(GuestBuffer guestMapping, ContextTag tag, const std::function, ContextLock &&)> &attachBuffer); + + BufferView FindOrCreate(GuestBuffer guestMapping, ContextTag tag = {}, const std::function, ContextLock &&)> &attachBuffer = {}) { + auto lookupBuffer{bufferTable[guestMapping.begin().base()]}; + if (lookupBuffer != nullptr) + if (auto view{lookupBuffer->TryGetView(guestMapping)}; view) + return view; + + return FindOrCreateImpl(guestMapping, tag, attachBuffer); + } }; }