mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-28 23:38:49 +00:00
FramebufferManagerBase: Return a std::pair from GetTargetSize
Keeps associated data together. It also eliminates the possibility of out parameters not being initialized properly. For example, consider the following example: -- some FramebufferManager implementation -- void FBMgrImpl::GetTargetSize(u32* width, u32* height) override { // Do nothing } -- somewhere else where the function is used -- u32 width, height; framebuffer_manager_instance->GetTargetSize(&width, &height); if (texture_width != width) <-- Uninitialized variable usage { ... } It makes it much more obvious to spot any initialization issues, because it requires something to be returned, as opposed to allowing an implementation to just not do anything.
This commit is contained in:
parent
28357f16e2
commit
c85e0a2586
13 changed files with 43 additions and 25 deletions
|
@ -3,9 +3,12 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "VideoCommon/FramebufferManagerBase.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
|
@ -158,8 +161,8 @@ void FramebufferManagerBase::CopyToVirtualXFB(u32 xfbAddr, u32 fbStride, u32 fbH
|
|||
if (m_virtualXFBList.begin() != vxfb)
|
||||
m_virtualXFBList.splice(m_virtualXFBList.begin(), m_virtualXFBList, vxfb);
|
||||
|
||||
unsigned int target_width, target_height;
|
||||
g_framebuffer_manager->GetTargetSize(&target_width, &target_height);
|
||||
u32 target_width, target_height;
|
||||
std::tie(target_width, target_height) = g_framebuffer_manager->GetTargetSize();
|
||||
|
||||
// recreate if needed
|
||||
if (vxfb->xfbSource &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue