VideoCommon: Rename Renderer s_ prefixes to m_

This commit is contained in:
Stenzek 2017-03-04 16:42:21 +10:00
parent 238a70b006
commit afc25fdca0
7 changed files with 163 additions and 169 deletions

View File

@ -485,7 +485,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulatio
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SaveScreenShot("thumb"); Core::SaveScreenShot("thumb");
Renderer::s_screenshotCompleted.WaitFor(std::chrono::seconds(2)); g_renderer->s_screenshot_completed.WaitFor(std::chrono::seconds(2));
Core::Stop(); Core::Stop();
updateMainFrameEvent.Set(); // Kick the waiting event updateMainFrameEvent.Set(); // Kick the waiting event
} }

View File

@ -239,7 +239,7 @@ Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferH
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB; s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
g_framebuffer_manager = std::make_unique<FramebufferManager>(s_target_width, s_target_height); g_framebuffer_manager = std::make_unique<FramebufferManager>(m_target_width, m_target_height);
SetupDeviceObjects(); SetupDeviceObjects();
// Setup GX pipeline state // Setup GX pipeline state
@ -268,7 +268,7 @@ Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferH
D3D::context->ClearDepthStencilView(FramebufferManager::GetEFBDepthTexture()->GetDSV(), D3D::context->ClearDepthStencilView(FramebufferManager::GetEFBDepthTexture()->GetDSV(),
D3D11_CLEAR_DEPTH, 0.f, 0); D3D11_CLEAR_DEPTH, 0.f, 0);
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)s_target_width, (float)s_target_height); D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)m_target_width, (float)m_target_height);
D3D::context->RSSetViewports(1, &vp); D3D::context->RSSetViewports(1, &vp);
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(),
FramebufferManager::GetEFBDepthTexture()->GetDSV()); FramebufferManager::GetEFBDepthTexture()->GetDSV());
@ -711,7 +711,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
const EFBRectangle& rc, u64 ticks, float Gamma) const EFBRectangle& rc, u64 ticks, float Gamma)
{ {
if ((!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) if ((!m_xfb_written && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
{ {
Core::Callback_VideoCopiedToXFB(false); Core::Callback_VideoCopiedToXFB(false);
return; return;
@ -865,7 +865,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
// Resize the back buffers NOW to avoid flickering // Resize the back buffers NOW to avoid flickering
if (CalculateTargetSize() || xfbchanged || windowResized || if (CalculateTargetSize() || xfbchanged || windowResized ||
s_last_efb_scale != g_ActiveConfig.iEFBScale || m_last_efb_scale != g_ActiveConfig.iEFBScale ||
s_last_multisamples != g_ActiveConfig.iMultisamples || s_last_multisamples != g_ActiveConfig.iMultisamples ||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0)) s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
{ {
@ -879,13 +879,13 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
D3D::Reset(); D3D::Reset();
SAFE_RELEASE(s_screenshot_texture); SAFE_RELEASE(s_screenshot_texture);
SAFE_RELEASE(s_3d_vision_texture); SAFE_RELEASE(s_3d_vision_texture);
s_backbuffer_width = D3D::GetBackBufferWidth(); m_backbuffer_width = D3D::GetBackBufferWidth();
s_backbuffer_height = D3D::GetBackBufferHeight(); m_backbuffer_height = D3D::GetBackBufferHeight();
} }
UpdateDrawRectangle(); UpdateDrawRectangle();
s_last_efb_scale = g_ActiveConfig.iEFBScale; m_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
@ -893,7 +893,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr); D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr);
g_framebuffer_manager.reset(); g_framebuffer_manager.reset();
g_framebuffer_manager = std::make_unique<FramebufferManager>(s_target_width, s_target_height); g_framebuffer_manager = std::make_unique<FramebufferManager>(m_target_width, m_target_height);
float clear_col[4] = {0.f, 0.f, 0.f, 1.f}; float clear_col[4] = {0.f, 0.f, 0.f, 1.f};
D3D::context->ClearRenderTargetView(FramebufferManager::GetEFBColorTexture()->GetRTV(), D3D::context->ClearRenderTargetView(FramebufferManager::GetEFBColorTexture()->GetRTV(),
clear_col); clear_col);
@ -1147,12 +1147,12 @@ u16 Renderer::BBoxRead(int index)
if (index < 2) if (index < 2)
{ {
// left/right // left/right
value = value * EFB_WIDTH / s_target_width; value = value * EFB_WIDTH / m_target_width;
} }
else else
{ {
// up/down // up/down
value = value * EFB_HEIGHT / s_target_height; value = value * EFB_HEIGHT / m_target_height;
} }
if (index & 1) if (index & 1)
value++; // fix max values to describe the outer border value++; // fix max values to describe the outer border
@ -1167,11 +1167,11 @@ void Renderer::BBoxWrite(int index, u16 _value)
value--; value--;
if (index < 2) if (index < 2)
{ {
value = value * s_target_width / EFB_WIDTH; value = value * m_target_width / EFB_WIDTH;
} }
else else
{ {
value = value * s_target_height / EFB_HEIGHT; value = value * m_target_height / EFB_HEIGHT;
} }
BBox::Set(index, value); BBox::Set(index, value);
@ -1205,11 +1205,11 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
else if (g_ActiveConfig.iStereoMode == STEREO_3DVISION) else if (g_ActiveConfig.iStereoMode == STEREO_3DVISION)
{ {
if (!s_3d_vision_texture) if (!s_3d_vision_texture)
Create3DVisionTexture(s_backbuffer_width, s_backbuffer_height); Create3DVisionTexture(m_backbuffer_width, m_backbuffer_height);
D3D11_VIEWPORT leftVp = CD3D11_VIEWPORT((float)dst.left, (float)dst.top, (float)dst.GetWidth(), D3D11_VIEWPORT leftVp = CD3D11_VIEWPORT((float)dst.left, (float)dst.top, (float)dst.GetWidth(),
(float)dst.GetHeight()); (float)dst.GetHeight());
D3D11_VIEWPORT rightVp = CD3D11_VIEWPORT((float)(dst.left + s_backbuffer_width), (float)dst.top, D3D11_VIEWPORT rightVp = CD3D11_VIEWPORT((float)(dst.left + m_backbuffer_width), (float)dst.top,
(float)dst.GetWidth(), (float)dst.GetHeight()); (float)dst.GetWidth(), (float)dst.GetHeight());
// Render to staging texture which is double the width of the backbuffer // Render to staging texture which is double the width of the backbuffer
@ -1229,7 +1229,7 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
// Copy the left eye to the backbuffer, if Nvidia 3D Vision is enabled it should // Copy the left eye to the backbuffer, if Nvidia 3D Vision is enabled it should
// recognize the signature and automatically include the right eye frame. // recognize the signature and automatically include the right eye frame.
D3D11_BOX box = CD3D11_BOX(0, 0, 0, s_backbuffer_width, s_backbuffer_height, 1); D3D11_BOX box = CD3D11_BOX(0, 0, 0, m_backbuffer_width, m_backbuffer_height, 1);
D3D::context->CopySubresourceRegion(D3D::GetBackBuffer()->GetTex(), 0, 0, 0, 0, D3D::context->CopySubresourceRegion(D3D::GetBackBuffer()->GetTex(), 0, 0, 0, 0,
s_3d_vision_texture->GetTex(), 0, &box); s_3d_vision_texture->GetTex(), 0, &box);

View File

@ -221,7 +221,7 @@ Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferH
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB; s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
g_framebuffer_manager = std::make_unique<FramebufferManager>(s_target_width, s_target_height); g_framebuffer_manager = std::make_unique<FramebufferManager>(m_target_width, m_target_height);
SetupDeviceObjects(); SetupDeviceObjects();
// Setup GX pipeline state // Setup GX pipeline state
@ -257,8 +257,8 @@ Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferH
D3D12_VIEWPORT vp = {0.f, D3D12_VIEWPORT vp = {0.f,
0.f, 0.f,
static_cast<float>(s_target_width), static_cast<float>(m_target_width),
static_cast<float>(s_target_height), static_cast<float>(m_target_height),
D3D12_MIN_DEPTH, D3D12_MIN_DEPTH,
D3D12_MAX_DEPTH}; D3D12_MAX_DEPTH};
D3D::current_command_list->RSSetViewports(1, &vp); D3D::current_command_list->RSSetViewports(1, &vp);
@ -634,7 +634,7 @@ void Renderer::SetBlendMode(bool force_update)
void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height,
const EFBRectangle& rc, u64 ticks, float gamma) const EFBRectangle& rc, u64 ticks, float gamma)
{ {
if ((!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fb_width || !fb_height) if ((!m_xfb_written && !g_ActiveConfig.RealXFBEnabled()) || !fb_width || !fb_height)
{ {
Core::Callback_VideoCopiedToXFB(false); Core::Callback_VideoCopiedToXFB(false);
return; return;
@ -821,7 +821,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
// Resize the back buffers NOW to avoid flickering // Resize the back buffers NOW to avoid flickering
if (CalculateTargetSize() || xfb_changed || window_resized || if (CalculateTargetSize() || xfb_changed || window_resized ||
s_last_efb_scale != g_ActiveConfig.iEFBScale || m_last_efb_scale != g_ActiveConfig.iEFBScale ||
s_last_multisamples != g_ActiveConfig.iMultisamples || s_last_multisamples != g_ActiveConfig.iMultisamples ||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0)) s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
{ {
@ -848,13 +848,13 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
s_screenshot_texture = nullptr; s_screenshot_texture = nullptr;
} }
s_backbuffer_width = D3D::GetBackBufferWidth(); m_backbuffer_width = D3D::GetBackBufferWidth();
s_backbuffer_height = D3D::GetBackBufferHeight(); m_backbuffer_height = D3D::GetBackBufferHeight();
} }
UpdateDrawRectangle(); UpdateDrawRectangle();
s_last_efb_scale = g_ActiveConfig.iEFBScale; m_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0; s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
@ -865,7 +865,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
nullptr); nullptr);
g_framebuffer_manager.reset(); g_framebuffer_manager.reset();
g_framebuffer_manager = std::make_unique<FramebufferManager>(s_target_width, s_target_height); g_framebuffer_manager = std::make_unique<FramebufferManager>(m_target_width, m_target_height);
const float clear_color[4] = {0.f, 0.f, 0.f, 1.f}; const float clear_color[4] = {0.f, 0.f, 0.f, 1.f};
FramebufferManager::GetEFBColorTexture()->TransitionToResourceState( FramebufferManager::GetEFBColorTexture()->TransitionToResourceState(
@ -1177,12 +1177,12 @@ u16 Renderer::BBoxRead(int index)
if (index < 2) if (index < 2)
{ {
// left/right // left/right
value = value * EFB_WIDTH / s_target_width; value = value * EFB_WIDTH / m_target_width;
} }
else else
{ {
// up/down // up/down
value = value * EFB_HEIGHT / s_target_height; value = value * EFB_HEIGHT / m_target_height;
} }
if (index & 1) if (index & 1)
value++; // fix max values to describe the outer border value++; // fix max values to describe the outer border
@ -1197,11 +1197,11 @@ void Renderer::BBoxWrite(int index, u16 value)
local_value--; local_value--;
if (index < 2) if (index < 2)
{ {
local_value = local_value * s_target_width / EFB_WIDTH; local_value = local_value * m_target_width / EFB_WIDTH;
} }
else else
{ {
local_value = local_value * s_target_height / EFB_HEIGHT; local_value = local_value * m_target_height / EFB_HEIGHT;
} }
BBox::Set(index, local_value); BBox::Set(index, local_value);

View File

@ -777,7 +777,7 @@ void Renderer::Init()
// Initialize the FramebufferManager // Initialize the FramebufferManager
g_framebuffer_manager = g_framebuffer_manager =
std::make_unique<FramebufferManager>(s_target_width, s_target_height, s_MSAASamples); std::make_unique<FramebufferManager>(m_target_width, m_target_height, s_MSAASamples);
m_post_processor = std::make_unique<OpenGLPostProcessing>(); m_post_processor = std::make_unique<OpenGLPostProcessing>();
s_raster_font = std::make_unique<RasterFont>(); s_raster_font = std::make_unique<RasterFont>();
@ -1045,12 +1045,12 @@ u16 Renderer::BBoxRead(int index)
if (index < 2) if (index < 2)
{ {
// left/right // left/right
value = value * EFB_WIDTH / s_target_width; value = value * EFB_WIDTH / m_target_width;
} }
else else
{ {
// up/down -- we have to swap up and down // up/down -- we have to swap up and down
value = value * EFB_HEIGHT / s_target_height; value = value * EFB_HEIGHT / m_target_height;
value = EFB_HEIGHT - value - 1; value = EFB_HEIGHT - value - 1;
} }
if (index & 1) if (index & 1)
@ -1066,13 +1066,13 @@ void Renderer::BBoxWrite(int index, u16 _value)
value--; value--;
if (index < 2) if (index < 2)
{ {
value = value * s_target_width / EFB_WIDTH; value = value * m_target_width / EFB_WIDTH;
} }
else else
{ {
index ^= 1; // swap 2 and 3 for top/bottom index ^= 1; // swap 2 and 3 for top/bottom
value = EFB_HEIGHT - value - 1; value = EFB_HEIGHT - value - 1;
value = value * s_target_height / EFB_HEIGHT; value = value * m_target_height / EFB_HEIGHT;
} }
BoundingBox::Set(index, value); BoundingBox::Set(index, value);
@ -1283,7 +1283,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
glDisable(GL_DEBUG_OUTPUT); glDisable(GL_DEBUG_OUTPUT);
} }
if ((!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight) if ((!m_xfb_written && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
{ {
Core::Callback_VideoCopiedToXFB(false); Core::Callback_VideoCopiedToXFB(false);
return; return;
@ -1353,13 +1353,13 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
bool window_resized = false; bool window_resized = false;
int window_width = static_cast<int>(std::max(GLInterface->GetBackBufferWidth(), 1u)); int window_width = static_cast<int>(std::max(GLInterface->GetBackBufferWidth(), 1u));
int window_height = static_cast<int>(std::max(GLInterface->GetBackBufferHeight(), 1u)); int window_height = static_cast<int>(std::max(GLInterface->GetBackBufferHeight(), 1u));
if (window_width != s_backbuffer_width || window_height != s_backbuffer_height || if (window_width != m_backbuffer_width || window_height != m_backbuffer_height ||
s_last_efb_scale != g_ActiveConfig.iEFBScale) m_last_efb_scale != g_ActiveConfig.iEFBScale)
{ {
window_resized = true; window_resized = true;
s_backbuffer_width = window_width; m_backbuffer_width = window_width;
s_backbuffer_height = window_height; m_backbuffer_height = window_height;
s_last_efb_scale = g_ActiveConfig.iEFBScale; m_last_efb_scale = g_ActiveConfig.iEFBScale;
} }
bool target_size_changed = CalculateTargetSize(); bool target_size_changed = CalculateTargetSize();
@ -1389,7 +1389,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
g_framebuffer_manager.reset(); g_framebuffer_manager.reset();
g_framebuffer_manager = g_framebuffer_manager =
std::make_unique<FramebufferManager>(s_target_width, s_target_height, s_MSAASamples); std::make_unique<FramebufferManager>(m_target_width, m_target_height, s_MSAASamples);
PixelShaderManager::SetEfbScaleChanged(); PixelShaderManager::SetEfbScaleChanged();
} }
@ -1409,13 +1409,13 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
OSD::DrawMessages(); OSD::DrawMessages();
#ifdef ANDROID #ifdef ANDROID
if (s_surface_needs_change.IsSet()) if (m_surface_needs_change.IsSet())
{ {
GLInterface->UpdateHandle(s_new_surface_handle); GLInterface->UpdateHandle(m_new_surface_handle);
GLInterface->UpdateSurface(); GLInterface->UpdateSurface();
s_new_surface_handle = nullptr; m_new_surface_handle = nullptr;
s_surface_needs_change.Clear(); m_surface_needs_change.Clear();
s_surface_changed.Set(); m_surface_changed.Set();
} }
#endif #endif
@ -1482,7 +1482,7 @@ void Renderer::DrawEFB(GLuint framebuffer, const TargetRectangle& target_rc,
// for msaa mode, we must resolve the efb content to non-msaa // for msaa mode, we must resolve the efb content to non-msaa
GLuint tex = FramebufferManager::ResolveAndGetRenderTarget(source_rc); GLuint tex = FramebufferManager::ResolveAndGetRenderTarget(source_rc);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
BlitScreen(scaled_source_rc, target_rc, tex, s_target_width, s_target_height); BlitScreen(scaled_source_rc, target_rc, tex, m_target_width, m_target_height);
} }
void Renderer::DrawVirtualXFB(GLuint framebuffer, const TargetRectangle& target_rc, u32 xfb_addr, void Renderer::DrawVirtualXFB(GLuint framebuffer, const TargetRectangle& target_rc, u32 xfb_addr,
@ -1804,9 +1804,9 @@ void Renderer::ChangeSurface(void* new_surface_handle)
// This is only necessary for Android at this point, although handling resizes here // This is only necessary for Android at this point, although handling resizes here
// would be more efficient than polling. // would be more efficient than polling.
#ifdef ANDROID #ifdef ANDROID
s_new_surface_handle = new_surface_handle; m_new_surface_handle = new_surface_handle;
s_surface_needs_change.Set(); m_surface_needs_change.Set();
s_surface_changed.Wait(); m_surface_changed.Wait();
#endif #endif
} }
} }

View File

@ -266,12 +266,12 @@ u16 Renderer::BBoxRead(int index)
if (index < 2) if (index < 2)
{ {
// left/right // left/right
value = value * EFB_WIDTH / s_target_width; value = value * EFB_WIDTH / m_target_width;
} }
else else
{ {
// up/down // up/down
value = value * EFB_HEIGHT / s_target_height; value = value * EFB_HEIGHT / m_target_height;
} }
// fix max values to describe the outer border // fix max values to describe the outer border
@ -293,12 +293,12 @@ void Renderer::BBoxWrite(int index, u16 value)
if (index < 2) if (index < 2)
{ {
// left/right // left/right
scaled_value = scaled_value * s_target_width / EFB_WIDTH; scaled_value = scaled_value * m_target_width / EFB_WIDTH;
} }
else else
{ {
// up/down // up/down
scaled_value = scaled_value * s_target_height / EFB_HEIGHT; scaled_value = scaled_value * m_target_height / EFB_HEIGHT;
} }
m_bounding_box->Set(static_cast<size_t>(index), scaled_value); m_bounding_box->Set(static_cast<size_t>(index), scaled_value);
@ -477,7 +477,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
FramebufferManager::GetInstance()->FlushEFBPokes(); FramebufferManager::GetInstance()->FlushEFBPokes();
// Check that we actually have an image to render in XFB-on modes. // Check that we actually have an image to render in XFB-on modes.
if ((!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fb_width || !fb_height) if ((!m_xfb_written && !g_ActiveConfig.RealXFBEnabled()) || !fb_width || !fb_height)
{ {
Core::Callback_VideoCopiedToXFB(false); Core::Callback_VideoCopiedToXFB(false);
return; return;
@ -1020,22 +1020,22 @@ void Renderer::CheckForTargetResize(u32 fb_width, u32 fb_stride, u32 fb_height)
void Renderer::CheckForSurfaceChange() void Renderer::CheckForSurfaceChange()
{ {
if (!s_surface_needs_change.IsSet()) if (!m_surface_needs_change.IsSet())
return; return;
u32 old_width = m_swap_chain ? m_swap_chain->GetWidth() : 0; u32 old_width = m_swap_chain ? m_swap_chain->GetWidth() : 0;
u32 old_height = m_swap_chain ? m_swap_chain->GetHeight() : 0; u32 old_height = m_swap_chain ? m_swap_chain->GetHeight() : 0;
// Fast path, if the surface handle is the same, the window has just been resized. // Fast path, if the surface handle is the same, the window has just been resized.
if (m_swap_chain && s_new_surface_handle == m_swap_chain->GetNativeHandle()) if (m_swap_chain && m_new_surface_handle == m_swap_chain->GetNativeHandle())
{ {
INFO_LOG(VIDEO, "Detected window resize."); INFO_LOG(VIDEO, "Detected window resize.");
ResizeSwapChain(); ResizeSwapChain();
// Notify the main thread we are done. // Notify the main thread we are done.
s_surface_needs_change.Clear(); m_surface_needs_change.Clear();
s_new_surface_handle = nullptr; m_new_surface_handle = nullptr;
s_surface_changed.Set(); m_surface_changed.Set();
} }
else else
{ {
@ -1045,7 +1045,7 @@ void Renderer::CheckForSurfaceChange()
// Did we previously have a swap chain? // Did we previously have a swap chain?
if (m_swap_chain) if (m_swap_chain)
{ {
if (!s_new_surface_handle) if (!m_new_surface_handle)
{ {
// If there is no surface now, destroy the swap chain. // If there is no surface now, destroy the swap chain.
m_swap_chain.reset(); m_swap_chain.reset();
@ -1053,7 +1053,7 @@ void Renderer::CheckForSurfaceChange()
else else
{ {
// Recreate the surface. If this fails we're in trouble. // Recreate the surface. If this fails we're in trouble.
if (!m_swap_chain->RecreateSurface(s_new_surface_handle)) if (!m_swap_chain->RecreateSurface(m_new_surface_handle))
PanicAlert("Failed to recreate Vulkan surface. Cannot continue."); PanicAlert("Failed to recreate Vulkan surface. Cannot continue.");
} }
} }
@ -1061,10 +1061,10 @@ void Renderer::CheckForSurfaceChange()
{ {
// Previously had no swap chain. So create one. // Previously had no swap chain. So create one.
VkSurfaceKHR surface = SwapChain::CreateVulkanSurface(g_vulkan_context->GetVulkanInstance(), VkSurfaceKHR surface = SwapChain::CreateVulkanSurface(g_vulkan_context->GetVulkanInstance(),
s_new_surface_handle); m_new_surface_handle);
if (surface != VK_NULL_HANDLE) if (surface != VK_NULL_HANDLE)
{ {
m_swap_chain = SwapChain::Create(s_new_surface_handle, surface, g_ActiveConfig.IsVSync()); m_swap_chain = SwapChain::Create(m_new_surface_handle, surface, g_ActiveConfig.IsVSync());
if (!m_swap_chain) if (!m_swap_chain)
PanicAlert("Failed to create swap chain."); PanicAlert("Failed to create swap chain.");
} }
@ -1075,9 +1075,9 @@ void Renderer::CheckForSurfaceChange()
} }
// Notify calling thread. // Notify calling thread.
s_surface_needs_change.Clear(); m_surface_needs_change.Clear();
s_new_surface_handle = nullptr; m_new_surface_handle = nullptr;
s_surface_changed.Set(); m_surface_changed.Set();
} }
if (m_swap_chain) if (m_swap_chain)
@ -1111,7 +1111,7 @@ void Renderer::CheckForConfigChanges()
bool anisotropy_changed = old_anisotropy != g_ActiveConfig.iMaxAnisotropy; bool anisotropy_changed = old_anisotropy != g_ActiveConfig.iMaxAnisotropy;
bool force_texture_filtering_changed = old_force_filtering != g_ActiveConfig.bForceFiltering; bool force_texture_filtering_changed = old_force_filtering != g_ActiveConfig.bForceFiltering;
bool stereo_changed = old_stereo_mode != g_ActiveConfig.iStereoMode; bool stereo_changed = old_stereo_mode != g_ActiveConfig.iStereoMode;
bool efb_scale_changed = s_last_efb_scale != g_ActiveConfig.iEFBScale; bool efb_scale_changed = m_last_efb_scale != g_ActiveConfig.iEFBScale;
bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio; bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio;
bool use_xfb_changed = old_use_xfb != g_ActiveConfig.bUseXFB; bool use_xfb_changed = old_use_xfb != g_ActiveConfig.bUseXFB;
bool use_realxfb_changed = old_use_realxfb != g_ActiveConfig.bUseRealXFB; bool use_realxfb_changed = old_use_realxfb != g_ActiveConfig.bUseRealXFB;
@ -1122,7 +1122,7 @@ void Renderer::CheckForConfigChanges()
// Handle settings that can cause the target rectangle to change. // Handle settings that can cause the target rectangle to change.
if (efb_scale_changed || aspect_changed || use_xfb_changed || use_realxfb_changed) if (efb_scale_changed || aspect_changed || use_xfb_changed || use_realxfb_changed)
{ {
s_last_efb_scale = g_ActiveConfig.iEFBScale; m_last_efb_scale = g_ActiveConfig.iEFBScale;
if (CalculateTargetSize()) if (CalculateTargetSize())
ResizeEFBTextures(); ResizeEFBTextures();
} }
@ -1162,8 +1162,8 @@ void Renderer::CheckForConfigChanges()
void Renderer::OnSwapChainResized() void Renderer::OnSwapChainResized()
{ {
s_backbuffer_width = m_swap_chain->GetWidth(); m_backbuffer_width = m_swap_chain->GetWidth();
s_backbuffer_height = m_swap_chain->GetHeight(); m_backbuffer_height = m_swap_chain->GetHeight();
UpdateDrawRectangle(); UpdateDrawRectangle();
if (CalculateTargetSize()) if (CalculateTargetSize())
{ {
@ -1668,9 +1668,9 @@ void Renderer::SetViewport()
void Renderer::ChangeSurface(void* new_surface_handle) void Renderer::ChangeSurface(void* new_surface_handle)
{ {
// Called by the main thread when the window is resized. // Called by the main thread when the window is resized.
s_new_surface_handle = new_surface_handle; m_new_surface_handle = new_surface_handle;
s_surface_needs_change.Set(); m_surface_needs_change.Set();
s_surface_changed.Set(); m_surface_changed.Set();
} }
void Renderer::RecompileShaders() void Renderer::RecompileShaders()

View File

@ -77,15 +77,13 @@ static float AspectToWidescreen(float aspect)
} }
Renderer::Renderer(int backbuffer_width, int backbuffer_height) Renderer::Renderer(int backbuffer_width, int backbuffer_height)
: m_backbuffer_width(backbuffer_width), m_backbuffer_height(backbuffer_height),
m_last_efb_scale(g_ActiveConfig.iEFBScale)
{ {
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH); FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT); FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
UpdateActiveConfig(); UpdateActiveConfig();
s_backbuffer_width = backbuffer_width;
s_backbuffer_height = backbuffer_height;
s_last_efb_scale = g_ActiveConfig.iEFBScale;
CalculateTargetSize(); CalculateTargetSize();
UpdateDrawRectangle(); UpdateDrawRectangle();
@ -108,7 +106,7 @@ void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbStri
if (!fbStride || !fbHeight) if (!fbStride || !fbHeight)
return; return;
XFBWrited = true; m_xfb_written = true;
if (g_ActiveConfig.bUseXFB) if (g_ActiveConfig.bUseXFB)
{ {
@ -132,7 +130,7 @@ int Renderer::EFBToScaledX(int x)
return FramebufferManagerBase::ScaleToVirtualXfbWidth(x); return FramebufferManagerBase::ScaleToVirtualXfbWidth(x);
default: default:
return x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX; return x * (int)m_efb_scale_numeratorX / (int)m_efb_scale_denominatorX;
}; };
} }
@ -144,7 +142,7 @@ int Renderer::EFBToScaledY(int y)
return FramebufferManagerBase::ScaleToVirtualXfbHeight(y); return FramebufferManagerBase::ScaleToVirtualXfbHeight(y);
default: default:
return y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY; return y * (int)m_efb_scale_numeratorY / (int)m_efb_scale_denominatorY;
}; };
} }
@ -157,8 +155,8 @@ void Renderer::CalculateTargetScale(int x, int y, int* scaledX, int* scaledY)
} }
else else
{ {
*scaledX = x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX; *scaledX = x * (int)m_efb_scale_numeratorX / (int)m_efb_scale_denominatorX;
*scaledY = y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY; *scaledY = y * (int)m_efb_scale_numeratorY / (int)m_efb_scale_denominatorY;
} }
} }
@ -169,70 +167,70 @@ bool Renderer::CalculateTargetSize()
newEFBWidth = newEFBHeight = 0; newEFBWidth = newEFBHeight = 0;
// TODO: Ugly. Clean up // TODO: Ugly. Clean up
switch (s_last_efb_scale) switch (m_last_efb_scale)
{ {
case SCALE_AUTO: case SCALE_AUTO:
case SCALE_AUTO_INTEGRAL: case SCALE_AUTO_INTEGRAL:
newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH); newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH);
newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT); newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT);
if (s_last_efb_scale == SCALE_AUTO_INTEGRAL) if (m_last_efb_scale == SCALE_AUTO_INTEGRAL)
{ {
efb_scale_numeratorX = efb_scale_numeratorY = m_efb_scale_numeratorX = m_efb_scale_numeratorY =
std::max((newEFBWidth - 1) / EFB_WIDTH + 1, (newEFBHeight - 1) / EFB_HEIGHT + 1); std::max((newEFBWidth - 1) / EFB_WIDTH + 1, (newEFBHeight - 1) / EFB_HEIGHT + 1);
efb_scale_denominatorX = efb_scale_denominatorY = 1; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
newEFBWidth = EFBToScaledX(EFB_WIDTH); newEFBWidth = EFBToScaledX(EFB_WIDTH);
newEFBHeight = EFBToScaledY(EFB_HEIGHT); newEFBHeight = EFBToScaledY(EFB_HEIGHT);
} }
else else
{ {
efb_scale_numeratorX = newEFBWidth; m_efb_scale_numeratorX = newEFBWidth;
efb_scale_denominatorX = EFB_WIDTH; m_efb_scale_denominatorX = EFB_WIDTH;
efb_scale_numeratorY = newEFBHeight; m_efb_scale_numeratorY = newEFBHeight;
efb_scale_denominatorY = EFB_HEIGHT; m_efb_scale_denominatorY = EFB_HEIGHT;
} }
break; break;
case SCALE_1X: case SCALE_1X:
efb_scale_numeratorX = efb_scale_numeratorY = 1; m_efb_scale_numeratorX = m_efb_scale_numeratorY = 1;
efb_scale_denominatorX = efb_scale_denominatorY = 1; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
break; break;
case SCALE_1_5X: case SCALE_1_5X:
efb_scale_numeratorX = efb_scale_numeratorY = 3; m_efb_scale_numeratorX = m_efb_scale_numeratorY = 3;
efb_scale_denominatorX = efb_scale_denominatorY = 2; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 2;
break; break;
case SCALE_2X: case SCALE_2X:
efb_scale_numeratorX = efb_scale_numeratorY = 2; m_efb_scale_numeratorX = m_efb_scale_numeratorY = 2;
efb_scale_denominatorX = efb_scale_denominatorY = 1; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
break; break;
case SCALE_2_5X: case SCALE_2_5X:
efb_scale_numeratorX = efb_scale_numeratorY = 5; m_efb_scale_numeratorX = m_efb_scale_numeratorY = 5;
efb_scale_denominatorX = efb_scale_denominatorY = 2; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 2;
break; break;
default: default:
efb_scale_numeratorX = efb_scale_numeratorY = s_last_efb_scale - 3; m_efb_scale_numeratorX = m_efb_scale_numeratorY = m_last_efb_scale - 3;
efb_scale_denominatorX = efb_scale_denominatorY = 1; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
const u32 max_size = GetMaxTextureSize(); const u32 max_size = GetMaxTextureSize();
if (max_size < EFB_WIDTH * efb_scale_numeratorX / efb_scale_denominatorX) if (max_size < EFB_WIDTH * m_efb_scale_numeratorX / m_efb_scale_denominatorX)
{ {
efb_scale_numeratorX = efb_scale_numeratorY = (max_size / EFB_WIDTH); m_efb_scale_numeratorX = m_efb_scale_numeratorY = (max_size / EFB_WIDTH);
efb_scale_denominatorX = efb_scale_denominatorY = 1; m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
} }
break; break;
} }
if (s_last_efb_scale > SCALE_AUTO_INTEGRAL) if (m_last_efb_scale > SCALE_AUTO_INTEGRAL)
CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, &newEFBWidth, &newEFBHeight); CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, &newEFBWidth, &newEFBHeight);
if (newEFBWidth != s_target_width || newEFBHeight != s_target_height) if (newEFBWidth != m_target_width || newEFBHeight != m_target_height)
{ {
s_target_width = newEFBWidth; m_target_width = newEFBWidth;
s_target_height = newEFBHeight; m_target_height = newEFBHeight;
return true; return true;
} }
return false; return false;
@ -261,25 +259,25 @@ void Renderer::ConvertStereoRectangle(const TargetRectangle& rc, TargetRectangle
leftRc = drawRc, rightRc = drawRc; leftRc = drawRc, rightRc = drawRc;
if (g_ActiveConfig.iStereoMode == STEREO_TAB) if (g_ActiveConfig.iStereoMode == STEREO_TAB)
{ {
leftRc.top -= s_backbuffer_height / 4; leftRc.top -= m_backbuffer_height / 4;
leftRc.bottom -= s_backbuffer_height / 4; leftRc.bottom -= m_backbuffer_height / 4;
rightRc.top += s_backbuffer_height / 4; rightRc.top += m_backbuffer_height / 4;
rightRc.bottom += s_backbuffer_height / 4; rightRc.bottom += m_backbuffer_height / 4;
} }
else else
{ {
leftRc.left -= s_backbuffer_width / 4; leftRc.left -= m_backbuffer_width / 4;
leftRc.right -= s_backbuffer_width / 4; leftRc.right -= m_backbuffer_width / 4;
rightRc.left += s_backbuffer_width / 4; rightRc.left += m_backbuffer_width / 4;
rightRc.right += s_backbuffer_width / 4; rightRc.right += m_backbuffer_width / 4;
} }
} }
void Renderer::SetScreenshot(const std::string& filename) void Renderer::SetScreenshot(const std::string& filename)
{ {
std::lock_guard<std::mutex> lk(s_criticalScreenshot); std::lock_guard<std::mutex> lk(m_screenshot_lock);
s_sScreenshotName = filename; m_screenshot_name = filename;
s_screenshot.Set(); m_screenshot_request.Set();
} }
// Create On-Screen-Messages // Create On-Screen-Messages
@ -432,7 +430,7 @@ float Renderer::CalculateDrawAspectRatio(int target_width, int target_height)
{ {
// If stretch is enabled, we prefer the aspect ratio of the window. // If stretch is enabled, we prefer the aspect ratio of the window.
return (static_cast<float>(target_width) / static_cast<float>(target_height)) / return (static_cast<float>(target_width) / static_cast<float>(target_height)) /
(static_cast<float>(s_backbuffer_width) / static_cast<float>(s_backbuffer_height)); (static_cast<float>(m_backbuffer_width) / static_cast<float>(m_backbuffer_height));
} }
// The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
@ -477,8 +475,8 @@ TargetRectangle Renderer::CalculateFrameDumpDrawRectangle()
if (!g_ActiveConfig.bInternalResolutionFrameDumps || g_ActiveConfig.RealXFBEnabled()) if (!g_ActiveConfig.bInternalResolutionFrameDumps || g_ActiveConfig.RealXFBEnabled())
{ {
// But still remove the borders, since the caller expects this. // But still remove the borders, since the caller expects this.
rc.right = target_rc.GetWidth(); rc.right = m_target_rectangle.GetWidth();
rc.bottom = target_rc.GetHeight(); rc.bottom = m_target_rectangle.GetHeight();
return rc; return rc;
} }
@ -496,8 +494,8 @@ TargetRectangle Renderer::CalculateFrameDumpDrawRectangle()
void Renderer::UpdateDrawRectangle() void Renderer::UpdateDrawRectangle()
{ {
float FloatGLWidth = static_cast<float>(s_backbuffer_width); float FloatGLWidth = static_cast<float>(m_backbuffer_width);
float FloatGLHeight = static_cast<float>(s_backbuffer_height); float FloatGLHeight = static_cast<float>(m_backbuffer_height);
float FloatXOffset = 0; float FloatXOffset = 0;
float FloatYOffset = 0; float FloatYOffset = 0;
@ -556,7 +554,7 @@ void Renderer::UpdateDrawRectangle()
// Check for force-settings and override. // Check for force-settings and override.
// The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
float Ratio = CalculateDrawAspectRatio(s_backbuffer_width, s_backbuffer_height); float Ratio = CalculateDrawAspectRatio(m_backbuffer_width, m_backbuffer_height);
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH)
{ {
if (Ratio >= 0.995f && Ratio <= 1.005f) if (Ratio >= 0.995f && Ratio <= 1.005f)
@ -610,10 +608,10 @@ void Renderer::UpdateDrawRectangle()
iWhidth % 4; // ensure divisibility by 4 to make it compatible with all the video encoders iWhidth % 4; // ensure divisibility by 4 to make it compatible with all the video encoders
iHeight -= iHeight % 4; iHeight -= iHeight % 4;
target_rc.left = XOffset; m_target_rectangle.left = XOffset;
target_rc.top = YOffset; m_target_rectangle.top = YOffset;
target_rc.right = XOffset + iWhidth; m_target_rectangle.right = XOffset + iWhidth;
target_rc.bottom = YOffset + iHeight; m_target_rectangle.bottom = YOffset + iHeight;
} }
void Renderer::InitializeCommon() void Renderer::InitializeCommon()
@ -705,7 +703,7 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const
// TODO: merge more generic parts into VideoCommon // TODO: merge more generic parts into VideoCommon
g_renderer->SwapImpl(xfbAddr, fbWidth, fbStride, fbHeight, rc, ticks, Gamma); g_renderer->SwapImpl(xfbAddr, fbWidth, fbStride, fbHeight, rc, ticks, Gamma);
if (XFBWrited) if (m_xfb_written)
g_renderer->m_fps_counter.Update(); g_renderer->m_fps_counter.Update();
frameCount++; frameCount++;
@ -716,14 +714,14 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const
// New frame // New frame
stats.ResetFrame(); stats.ResetFrame();
Core::Callback_VideoCopiedToXFB(XFBWrited || Core::Callback_VideoCopiedToXFB(m_xfb_written ||
(g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)); (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
XFBWrited = false; m_xfb_written = false;
} }
bool Renderer::IsFrameDumping() bool Renderer::IsFrameDumping()
{ {
if (s_screenshot.IsSet()) if (m_screenshot_request.IsSet())
return true; return true;
#if defined(HAVE_LIBAV) || defined(_WIN32) #if defined(HAVE_LIBAV) || defined(_WIN32)
@ -804,17 +802,17 @@ void Renderer::RunFrameDumps()
} }
// Save screenshot // Save screenshot
if (s_screenshot.TestAndClear()) if (m_screenshot_request.TestAndClear())
{ {
std::lock_guard<std::mutex> lk(s_criticalScreenshot); std::lock_guard<std::mutex> lk(m_screenshot_lock);
if (TextureToPng(config.data, config.stride, s_sScreenshotName, config.width, config.height, if (TextureToPng(config.data, config.stride, m_screenshot_name, config.width, config.height,
false)) false))
OSD::AddMessage("Screenshot saved to " + s_sScreenshotName); OSD::AddMessage("Screenshot saved to " + m_screenshot_name);
// Reset settings // Reset settings
s_sScreenshotName.clear(); m_screenshot_name.clear();
s_screenshotCompleted.Set(); s_screenshot_completed.Set();
} }
if (SConfig::GetInstance().m_DumpFrames) if (SConfig::GetInstance().m_DumpFrames)

View File

@ -85,11 +85,11 @@ public:
// Ideal internal resolution - determined by display resolution (automatic scaling) and/or a // Ideal internal resolution - determined by display resolution (automatic scaling) and/or a
// multiple of the native EFB resolution // multiple of the native EFB resolution
int GetTargetWidth() { return s_target_width; } int GetTargetWidth() { return m_target_width; }
int GetTargetHeight() { return s_target_height; } int GetTargetHeight() { return m_target_height; }
// Display resolution // Display resolution
int GetBackbufferWidth() { return s_backbuffer_width; } int GetBackbufferWidth() { return m_backbuffer_width; }
int GetBackbufferHeight() { return s_backbuffer_height; } int GetBackbufferHeight() { return m_backbuffer_height; }
void SetWindowSize(int width, int height); void SetWindowSize(int width, int height);
// EFB coordinate conversion functions // EFB coordinate conversion functions
@ -97,7 +97,7 @@ public:
// Use this to convert a whole native EFB rect to backbuffer coordinates // Use this to convert a whole native EFB rect to backbuffer coordinates
virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0; virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;
const TargetRectangle& GetTargetRectangle() { return target_rc; } const TargetRectangle& GetTargetRectangle() { return m_target_rectangle; }
float CalculateDrawAspectRatio(int target_width, int target_height); float CalculateDrawAspectRatio(int target_width, int target_height);
std::tuple<float, float> ScaleToDisplayAspectRatio(int width, int height); std::tuple<float, float> ScaleToDisplayAspectRatio(int width, int height);
TargetRectangle CalculateFrameDumpDrawRectangle(); TargetRectangle CalculateFrameDumpDrawRectangle();
@ -138,13 +138,13 @@ public:
virtual void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, virtual void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
const EFBRectangle& rc, u64 ticks, float Gamma = 1.0f) = 0; const EFBRectangle& rc, u64 ticks, float Gamma = 1.0f) = 0;
PEControl::PixelFormat GetPrevPixelFormat() { return prev_efb_format; } PEControl::PixelFormat GetPrevPixelFormat() { return m_prev_efb_format; }
void StorePixelFormat(PEControl::PixelFormat new_format) { prev_efb_format = new_format; } void StorePixelFormat(PEControl::PixelFormat new_format) { m_prev_efb_format = new_format; }
PostProcessingShaderImplementation* GetPostProcessor() { return m_post_processor.get(); } PostProcessingShaderImplementation* GetPostProcessor() { return m_post_processor.get(); }
// Max height/width // Max height/width
virtual u32 GetMaxTextureSize() = 0; virtual u32 GetMaxTextureSize() = 0;
Common::Event s_screenshotCompleted; Common::Event s_screenshot_completed;
// Final surface changing // Final surface changing
// This is called when the surface is resized (WX) or the window changes (Android). // This is called when the surface is resized (WX) or the window changes (Android).
@ -161,24 +161,20 @@ protected:
bool swap_upside_down = false); bool swap_upside_down = false);
void FinishFrameData(); void FinishFrameData();
Common::Flag s_screenshot; Common::Flag m_screenshot_request;
std::mutex s_criticalScreenshot; std::mutex m_screenshot_lock;
std::string s_sScreenshotName; std::string m_screenshot_name;
// The framebuffer size // The framebuffer size
int s_target_width = 0; int m_target_width = 0;
int s_target_height = 0; int m_target_height = 0;
// TODO: Add functionality to reinit all the render targets when the window is resized. // TODO: Add functionality to reinit all the render targets when the window is resized.
int s_backbuffer_width = 0; int m_backbuffer_width = 0;
int s_backbuffer_height = 0; int m_backbuffer_height = 0;
int m_last_efb_scale = 0;
TargetRectangle target_rc; TargetRectangle m_target_rectangle;
bool m_xfb_written = false;
// TODO: Can probably eliminate this static var.
int s_last_efb_scale = 0;
bool XFBWrited = false;
FPSCounter m_fps_counter; FPSCounter m_fps_counter;
@ -186,19 +182,19 @@ protected:
static const float GX_MAX_DEPTH; static const float GX_MAX_DEPTH;
Common::Flag s_surface_needs_change; Common::Flag m_surface_needs_change;
Common::Event s_surface_changed; Common::Event m_surface_changed;
void* s_new_surface_handle = nullptr; void* m_new_surface_handle = nullptr;
private: private:
void RunFrameDumps(); void RunFrameDumps();
void ShutdownFrameDumping(); void ShutdownFrameDumping();
PEControl::PixelFormat prev_efb_format = PEControl::INVALID_FMT; PEControl::PixelFormat m_prev_efb_format = PEControl::INVALID_FMT;
unsigned int efb_scale_numeratorX = 1; unsigned int m_efb_scale_numeratorX = 1;
unsigned int efb_scale_numeratorY = 1; unsigned int m_efb_scale_numeratorY = 1;
unsigned int efb_scale_denominatorX = 1; unsigned int m_efb_scale_denominatorX = 1;
unsigned int efb_scale_denominatorY = 1; unsigned int m_efb_scale_denominatorY = 1;
// frame dumping // frame dumping
std::thread m_frame_dump_thread; std::thread m_frame_dump_thread;