mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 21:05:06 +01:00
Add inline fast-path for Buffer::FindOrCreate()
This can be inlined by the compiler much easier which helps perf a fair bit due to the number of times buffers are looked up, also avoids the need for small vector construction that was done in the previous fast-path.
This commit is contained in:
parent
49478e178a
commit
e72fe02c15
@ -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<void(std::shared_ptr<Buffer>, ContextLock<Buffer> &&)> &attachBuffer = {});
|
||||
BufferView FindOrCreateImpl(GuestBuffer guestMapping, ContextTag tag, const std::function<void(std::shared_ptr<Buffer>, ContextLock<Buffer> &&)> &attachBuffer);
|
||||
|
||||
BufferView FindOrCreate(GuestBuffer guestMapping, ContextTag tag = {}, const std::function<void(std::shared_ptr<Buffer>, ContextLock<Buffer> &&)> &attachBuffer = {}) {
|
||||
auto lookupBuffer{bufferTable[guestMapping.begin().base()]};
|
||||
if (lookupBuffer != nullptr)
|
||||
if (auto view{lookupBuffer->TryGetView(guestMapping)}; view)
|
||||
return view;
|
||||
|
||||
return FindOrCreateImpl(guestMapping, tag, attachBuffer);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user