mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Merge pull request #4999 from stenzek/renderer-statics
VideoCommon: Eliminate static state in Renderer
This commit is contained in:
@ -98,18 +98,10 @@ D3DTexture2D*& FramebufferManager::GetResolvedEFBDepthTexture()
|
||||
}
|
||||
}
|
||||
|
||||
FramebufferManager::FramebufferManager()
|
||||
FramebufferManager::FramebufferManager(int target_width, int target_height)
|
||||
{
|
||||
m_target_width = Renderer::GetTargetWidth();
|
||||
m_target_height = Renderer::GetTargetHeight();
|
||||
if (m_target_height < 1)
|
||||
{
|
||||
m_target_height = 1;
|
||||
}
|
||||
if (m_target_width < 1)
|
||||
{
|
||||
m_target_width = 1;
|
||||
}
|
||||
m_target_width = static_cast<unsigned int>(std::max(target_width, 1));
|
||||
m_target_height = static_cast<unsigned int>(std::max(target_height, 1));
|
||||
DXGI_SAMPLE_DESC sample_desc;
|
||||
sample_desc.Count = g_ActiveConfig.iMultisamples;
|
||||
sample_desc.Quality = 0;
|
||||
@ -318,8 +310,8 @@ void XFBSource::CopyEFB(float Gamma)
|
||||
D3D::SetPointCopySampler();
|
||||
|
||||
D3D::drawShadedTexQuad(
|
||||
FramebufferManager::GetEFBColorTexture()->GetSRV(), &rect, Renderer::GetTargetWidth(),
|
||||
Renderer::GetTargetHeight(), PixelShaderCache::GetColorCopyProgram(true),
|
||||
FramebufferManager::GetEFBColorTexture()->GetSRV(), &rect, g_renderer->GetTargetWidth(),
|
||||
g_renderer->GetTargetHeight(), PixelShaderCache::GetColorCopyProgram(true),
|
||||
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(),
|
||||
GeometryShaderCache::GetCopyGeometryShader(), Gamma);
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct XFBSource : public XFBSourceBase
|
||||
class FramebufferManager : public FramebufferManagerBase
|
||||
{
|
||||
public:
|
||||
FramebufferManager();
|
||||
FramebufferManager(int target_width, int target_height);
|
||||
~FramebufferManager();
|
||||
|
||||
static D3DTexture2D*& GetEFBColorTexture();
|
||||
|
@ -137,7 +137,7 @@ void PSTextureEncoder::Encode(u8* dst, u32 format, u32 native_width, u32 bytes_p
|
||||
D3D::SetPointCopySampler();
|
||||
|
||||
D3D::drawShadedTexQuad(
|
||||
pEFB, targetRect.AsRECT(), Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
|
||||
pEFB, targetRect.AsRECT(), g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(),
|
||||
SetStaticShader(format, is_depth_copy, isIntensity, scaleByHalf),
|
||||
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout());
|
||||
|
||||
|
@ -84,8 +84,6 @@ static void SetupDeviceObjects()
|
||||
{
|
||||
s_television.Init();
|
||||
|
||||
g_framebuffer_manager = std::make_unique<FramebufferManager>();
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
D3D11_DEPTH_STENCIL_DESC ddesc;
|
||||
@ -235,25 +233,13 @@ static void Create3DVisionTexture(int width, int height)
|
||||
delete[] sysData.pSysMem;
|
||||
}
|
||||
|
||||
Renderer::Renderer(void*& window_handle)
|
||||
Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferHeight())
|
||||
{
|
||||
D3D::Create((HWND)window_handle);
|
||||
|
||||
s_backbuffer_width = D3D::GetBackBufferWidth();
|
||||
s_backbuffer_height = D3D::GetBackBufferHeight();
|
||||
|
||||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_multisamples = g_ActiveConfig.iMultisamples;
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
CalculateTargetSize();
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
g_framebuffer_manager = std::make_unique<FramebufferManager>(m_target_width, m_target_height);
|
||||
SetupDeviceObjects();
|
||||
|
||||
// Setup GX pipeline state
|
||||
@ -282,7 +268,7 @@ Renderer::Renderer(void*& window_handle)
|
||||
D3D::context->ClearDepthStencilView(FramebufferManager::GetEFBDepthTexture()->GetDSV(),
|
||||
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->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(),
|
||||
FramebufferManager::GetEFBDepthTexture()->GetDSV());
|
||||
@ -324,8 +310,7 @@ bool Renderer::CheckForResize()
|
||||
int client_height = rcWindow.bottom - rcWindow.top;
|
||||
|
||||
// Sanity check
|
||||
if ((client_width != Renderer::GetBackbufferWidth() ||
|
||||
client_height != Renderer::GetBackbufferHeight()) &&
|
||||
if ((client_width != GetBackbufferWidth() || client_height != GetBackbufferHeight()) &&
|
||||
client_width >= 4 && client_height >= 4)
|
||||
{
|
||||
return true;
|
||||
@ -726,7 +711,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
||||
void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
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);
|
||||
return;
|
||||
@ -880,7 +865,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
|
||||
// Resize the back buffers NOW to avoid flickering
|
||||
if (CalculateTargetSize() || xfbchanged || windowResized ||
|
||||
s_last_efb_scale != g_ActiveConfig.iEFBScale ||
|
||||
s_last_multisamples != g_ActiveConfig.iMultisamples ||
|
||||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
|
||||
{
|
||||
@ -894,21 +878,18 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
D3D::Reset();
|
||||
SAFE_RELEASE(s_screenshot_texture);
|
||||
SAFE_RELEASE(s_3d_vision_texture);
|
||||
s_backbuffer_width = D3D::GetBackBufferWidth();
|
||||
s_backbuffer_height = D3D::GetBackBufferHeight();
|
||||
m_backbuffer_width = D3D::GetBackBufferWidth();
|
||||
m_backbuffer_height = D3D::GetBackBufferHeight();
|
||||
}
|
||||
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), nullptr);
|
||||
|
||||
g_framebuffer_manager.reset();
|
||||
g_framebuffer_manager = std::make_unique<FramebufferManager>();
|
||||
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};
|
||||
D3D::context->ClearRenderTargetView(FramebufferManager::GetEFBColorTexture()->GetRTV(),
|
||||
clear_col);
|
||||
@ -1162,12 +1143,12 @@ u16 Renderer::BBoxRead(int index)
|
||||
if (index < 2)
|
||||
{
|
||||
// left/right
|
||||
value = value * EFB_WIDTH / s_target_width;
|
||||
value = value * EFB_WIDTH / m_target_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
// up/down
|
||||
value = value * EFB_HEIGHT / s_target_height;
|
||||
value = value * EFB_HEIGHT / m_target_height;
|
||||
}
|
||||
if (index & 1)
|
||||
value++; // fix max values to describe the outer border
|
||||
@ -1182,11 +1163,11 @@ void Renderer::BBoxWrite(int index, u16 _value)
|
||||
value--;
|
||||
if (index < 2)
|
||||
{
|
||||
value = value * s_target_width / EFB_WIDTH;
|
||||
value = value * m_target_width / EFB_WIDTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = value * s_target_height / EFB_HEIGHT;
|
||||
value = value * m_target_height / EFB_HEIGHT;
|
||||
}
|
||||
|
||||
BBox::Set(index, value);
|
||||
@ -1220,11 +1201,11 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
|
||||
else if (g_ActiveConfig.iStereoMode == STEREO_3DVISION)
|
||||
{
|
||||
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(),
|
||||
(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());
|
||||
|
||||
// Render to staging texture which is double the width of the backbuffer
|
||||
@ -1244,7 +1225,7 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
|
||||
|
||||
// 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.
|
||||
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,
|
||||
s_3d_vision_texture->GetTex(), 0, &box);
|
||||
|
||||
|
@ -16,8 +16,8 @@ class D3DTexture2D;
|
||||
class Renderer : public ::Renderer
|
||||
{
|
||||
public:
|
||||
Renderer(void*& window_handle);
|
||||
~Renderer();
|
||||
Renderer();
|
||||
~Renderer() override;
|
||||
|
||||
void SetColorMask() override;
|
||||
void SetBlendMode(bool forceUpdate) override;
|
||||
@ -60,7 +60,7 @@ public:
|
||||
|
||||
void ReinterpretPixelData(unsigned int convtype) override;
|
||||
|
||||
static bool CheckForResize();
|
||||
bool CheckForResize();
|
||||
|
||||
u32 GetMaxTextureSize() override;
|
||||
|
||||
|
@ -230,7 +230,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(bool is_depth_copy, const EFBRe
|
||||
|
||||
// Create texture copy
|
||||
D3D::drawShadedTexQuad(
|
||||
efbTexSRV, &sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
|
||||
efbTexSRV, &sourcerect, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(),
|
||||
is_depth_copy ? PixelShaderCache::GetDepthMatrixProgram(multisampled) :
|
||||
PixelShaderCache::GetColorMatrixProgram(multisampled),
|
||||
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout(),
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "VideoBackends/D3D/BoundingBox.h"
|
||||
@ -144,8 +145,11 @@ bool VideoBackend::Initialize(void* window_handle)
|
||||
|
||||
void VideoBackend::Video_Prepare()
|
||||
{
|
||||
if (FAILED(D3D::Create(reinterpret_cast<HWND>(m_window_handle))))
|
||||
PanicAlert("Failed to create D3D device.");
|
||||
|
||||
// internal interfaces
|
||||
g_renderer = std::make_unique<Renderer>(m_window_handle);
|
||||
g_renderer = std::make_unique<Renderer>();
|
||||
g_texture_cache = std::make_unique<TextureCache>();
|
||||
g_vertex_manager = std::make_unique<VertexManager>();
|
||||
g_perf_query = std::make_unique<PerfQuery>();
|
||||
|
@ -84,10 +84,10 @@ D3DTexture2D*& FramebufferManager::GetResolvedEFBDepthTexture()
|
||||
}
|
||||
}
|
||||
|
||||
FramebufferManager::FramebufferManager()
|
||||
FramebufferManager::FramebufferManager(int target_width, int target_height)
|
||||
{
|
||||
m_target_width = std::max(Renderer::GetTargetWidth(), 1);
|
||||
m_target_height = std::max(Renderer::GetTargetHeight(), 1);
|
||||
m_target_width = static_cast<unsigned int>(std::max(target_width, 1));
|
||||
m_target_height = static_cast<unsigned int>(std::max(target_height, 1));
|
||||
|
||||
DXGI_SAMPLE_DESC sample_desc;
|
||||
sample_desc.Count = g_ActiveConfig.iMultisamples;
|
||||
@ -525,7 +525,7 @@ void XFBSource::CopyEFB(float gamma)
|
||||
D3D::SetPointCopySampler();
|
||||
|
||||
D3D::DrawShadedTexQuad(FramebufferManager::GetEFBColorTexture(), &rect,
|
||||
Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
|
||||
g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(),
|
||||
StaticShaderCache::GetColorCopyPixelShader(true),
|
||||
StaticShaderCache::GetSimpleVertexShader(),
|
||||
StaticShaderCache::GetSimpleVertexShaderInputLayout(),
|
||||
|
@ -58,7 +58,7 @@ struct XFBSource final : public XFBSourceBase
|
||||
class FramebufferManager final : public FramebufferManagerBase
|
||||
{
|
||||
public:
|
||||
FramebufferManager();
|
||||
FramebufferManager(int target_width, int target_height);
|
||||
~FramebufferManager();
|
||||
|
||||
static D3DTexture2D*& GetEFBColorTexture();
|
||||
|
@ -166,7 +166,7 @@ void PSTextureEncoder::Encode(u8* dst, u32 format, u32 native_width, u32 bytes_p
|
||||
D3D::SetPointCopySampler();
|
||||
|
||||
D3D::DrawShadedTexQuad(
|
||||
efb_source, target_rect.AsRECT(), Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
|
||||
efb_source, target_rect.AsRECT(), g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(),
|
||||
SetStaticShader(format, is_depth_copy, is_intensity, scale_by_half),
|
||||
StaticShaderCache::GetSimpleVertexShader(),
|
||||
StaticShaderCache::GetSimpleVertexShaderInputLayout(), D3D12_SHADER_BYTECODE(), 1.0f, 0,
|
||||
|
@ -101,8 +101,6 @@ StateCache gx_state_cache;
|
||||
|
||||
static void SetupDeviceObjects()
|
||||
{
|
||||
g_framebuffer_manager = std::make_unique<FramebufferManager>();
|
||||
|
||||
D3D12_DEPTH_STENCIL_DESC depth_desc;
|
||||
depth_desc.DepthEnable = FALSE;
|
||||
depth_desc.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ZERO;
|
||||
@ -211,7 +209,7 @@ static void Create3DVisionTexture(int width, int height)
|
||||
// D3D12TODO: 3D Vision not implemented on D3D12 backend.
|
||||
}
|
||||
|
||||
Renderer::Renderer(void*& window_handle)
|
||||
Renderer::Renderer() : ::Renderer(D3D::GetBackBufferWidth(), D3D::GetBackBufferHeight())
|
||||
{
|
||||
if (g_ActiveConfig.iStereoMode == STEREO_3DVISION)
|
||||
{
|
||||
@ -219,21 +217,11 @@ Renderer::Renderer(void*& window_handle)
|
||||
return;
|
||||
}
|
||||
|
||||
s_backbuffer_width = D3D::GetBackBufferWidth();
|
||||
s_backbuffer_height = D3D::GetBackBufferHeight();
|
||||
|
||||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_multisamples = g_ActiveConfig.iMultisamples;
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
CalculateTargetSize();
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
g_framebuffer_manager = std::make_unique<FramebufferManager>(m_target_width, m_target_height);
|
||||
SetupDeviceObjects();
|
||||
|
||||
// Setup GX pipeline state
|
||||
@ -269,8 +257,8 @@ Renderer::Renderer(void*& window_handle)
|
||||
|
||||
D3D12_VIEWPORT vp = {0.f,
|
||||
0.f,
|
||||
static_cast<float>(s_target_width),
|
||||
static_cast<float>(s_target_height),
|
||||
static_cast<float>(m_target_width),
|
||||
static_cast<float>(m_target_height),
|
||||
D3D12_MIN_DEPTH,
|
||||
D3D12_MAX_DEPTH};
|
||||
D3D::current_command_list->RSSetViewports(1, &vp);
|
||||
@ -308,7 +296,7 @@ TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc)
|
||||
|
||||
// With D3D, we have to resize the backbuffer if the window changed
|
||||
// size.
|
||||
__declspec(noinline) bool Renderer::CheckForResize()
|
||||
bool Renderer::CheckForResize()
|
||||
{
|
||||
RECT rc_window;
|
||||
GetClientRect(D3D::hWnd, &rc_window);
|
||||
@ -646,7 +634,7 @@ void Renderer::SetBlendMode(bool force_update)
|
||||
void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height,
|
||||
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);
|
||||
return;
|
||||
@ -833,7 +821,6 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
||||
|
||||
// Resize the back buffers NOW to avoid flickering
|
||||
if (CalculateTargetSize() || xfb_changed || window_resized ||
|
||||
s_last_efb_scale != g_ActiveConfig.iEFBScale ||
|
||||
s_last_multisamples != g_ActiveConfig.iMultisamples ||
|
||||
s_last_stereo_mode != (g_ActiveConfig.iStereoMode > 0))
|
||||
{
|
||||
@ -860,24 +847,21 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
||||
s_screenshot_texture = nullptr;
|
||||
}
|
||||
|
||||
s_backbuffer_width = D3D::GetBackBufferWidth();
|
||||
s_backbuffer_height = D3D::GetBackBufferHeight();
|
||||
m_backbuffer_width = D3D::GetBackBufferWidth();
|
||||
m_backbuffer_height = D3D::GetBackBufferHeight();
|
||||
}
|
||||
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
D3D::GetBackBuffer()->TransitionToResourceState(D3D::current_command_list,
|
||||
D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||
D3D::current_command_list->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV12(), FALSE,
|
||||
nullptr);
|
||||
|
||||
g_framebuffer_manager.reset();
|
||||
g_framebuffer_manager = std::make_unique<FramebufferManager>();
|
||||
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};
|
||||
|
||||
FramebufferManager::GetEFBColorTexture()->TransitionToResourceState(
|
||||
@ -1189,12 +1173,12 @@ u16 Renderer::BBoxRead(int index)
|
||||
if (index < 2)
|
||||
{
|
||||
// left/right
|
||||
value = value * EFB_WIDTH / s_target_width;
|
||||
value = value * EFB_WIDTH / m_target_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
// up/down
|
||||
value = value * EFB_HEIGHT / s_target_height;
|
||||
value = value * EFB_HEIGHT / m_target_height;
|
||||
}
|
||||
if (index & 1)
|
||||
value++; // fix max values to describe the outer border
|
||||
@ -1209,11 +1193,11 @@ void Renderer::BBoxWrite(int index, u16 value)
|
||||
local_value--;
|
||||
if (index < 2)
|
||||
{
|
||||
local_value = local_value * s_target_width / EFB_WIDTH;
|
||||
local_value = local_value * m_target_width / EFB_WIDTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_value = local_value * s_target_height / EFB_HEIGHT;
|
||||
local_value = local_value * m_target_height / EFB_HEIGHT;
|
||||
}
|
||||
|
||||
BBox::Set(index, local_value);
|
||||
|
@ -17,8 +17,8 @@ class D3DTexture2D;
|
||||
class Renderer final : public ::Renderer
|
||||
{
|
||||
public:
|
||||
Renderer(void*& window_handle);
|
||||
~Renderer();
|
||||
Renderer();
|
||||
~Renderer() override;
|
||||
|
||||
void SetColorMask() override;
|
||||
void SetBlendMode(bool force_update) override;
|
||||
@ -59,7 +59,7 @@ public:
|
||||
|
||||
void ReinterpretPixelData(unsigned int conv_type) override;
|
||||
|
||||
static bool CheckForResize();
|
||||
bool CheckForResize();
|
||||
|
||||
u32 GetMaxTextureSize() override;
|
||||
|
||||
|
@ -288,7 +288,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(bool is_depth_copy, const EFBRe
|
||||
|
||||
// Create texture copy
|
||||
D3D::DrawShadedTexQuad(
|
||||
efb_tex, &sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
|
||||
efb_tex, &sourcerect, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight(),
|
||||
is_depth_copy ? StaticShaderCache::GetDepthMatrixPixelShader(multisampled) :
|
||||
StaticShaderCache::GetColorMatrixPixelShader(multisampled),
|
||||
StaticShaderCache::GetSimpleVertexShader(),
|
||||
|
@ -163,7 +163,7 @@ bool VideoBackend::Initialize(void* window_handle)
|
||||
void VideoBackend::Video_Prepare()
|
||||
{
|
||||
// internal interfaces
|
||||
g_renderer = std::make_unique<Renderer>(m_window_handle);
|
||||
g_renderer = std::make_unique<Renderer>();
|
||||
g_texture_cache = std::make_unique<TextureCache>();
|
||||
g_vertex_manager = std::make_unique<VertexManager>();
|
||||
g_perf_query = std::make_unique<PerfQuery>();
|
||||
|
@ -11,7 +11,7 @@
|
||||
namespace Null
|
||||
{
|
||||
// Init functions
|
||||
Renderer::Renderer()
|
||||
Renderer::Renderer() : ::Renderer(1, 1)
|
||||
{
|
||||
g_Config.bRunning = true;
|
||||
UpdateActiveConfig();
|
||||
|
@ -12,7 +12,7 @@ class Renderer : public ::Renderer
|
||||
{
|
||||
public:
|
||||
Renderer();
|
||||
~Renderer();
|
||||
~Renderer() override;
|
||||
|
||||
void RenderText(const std::string& pstr, int left, int top, u32 color) override;
|
||||
u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override { return 0; }
|
||||
|
@ -329,6 +329,8 @@ static void InitDriverInfo()
|
||||
|
||||
// Init functions
|
||||
Renderer::Renderer()
|
||||
: ::Renderer(static_cast<int>(std::max(GLInterface->GetBackBufferWidth(), 1u)),
|
||||
static_cast<int>(std::max(GLInterface->GetBackBufferHeight(), 1u)))
|
||||
{
|
||||
bool bSuccess = true;
|
||||
|
||||
@ -687,26 +689,11 @@ Renderer::Renderer()
|
||||
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
|
||||
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
|
||||
|
||||
// Decide framebuffer size
|
||||
s_backbuffer_width = static_cast<int>(std::max(GLInterface->GetBackBufferWidth(), 1u));
|
||||
s_backbuffer_height = static_cast<int>(std::max(GLInterface->GetBackBufferHeight(), 1u));
|
||||
|
||||
// Handle VSync on/off
|
||||
s_vsync = g_ActiveConfig.IsVSync();
|
||||
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_VSYNC))
|
||||
GLInterface->SwapInterval(s_vsync);
|
||||
|
||||
// TODO: Move these somewhere else?
|
||||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
|
||||
UpdateDrawRectangle();
|
||||
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
CalculateTargetSize();
|
||||
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
|
||||
// Because of the fixed framebuffer size we need to disable the resolution
|
||||
// options while running
|
||||
g_Config.bRunning = true;
|
||||
@ -788,7 +775,7 @@ void Renderer::Init()
|
||||
{
|
||||
// Initialize the FramebufferManager
|
||||
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>();
|
||||
s_raster_font = std::make_unique<RasterFont>();
|
||||
@ -1056,12 +1043,12 @@ u16 Renderer::BBoxRead(int index)
|
||||
if (index < 2)
|
||||
{
|
||||
// left/right
|
||||
value = value * EFB_WIDTH / s_target_width;
|
||||
value = value * EFB_WIDTH / m_target_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
if (index & 1)
|
||||
@ -1077,13 +1064,13 @@ void Renderer::BBoxWrite(int index, u16 _value)
|
||||
value--;
|
||||
if (index < 2)
|
||||
{
|
||||
value = value * s_target_width / EFB_WIDTH;
|
||||
value = value * m_target_width / EFB_WIDTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
index ^= 1; // swap 2 and 3 for top/bottom
|
||||
value = EFB_HEIGHT - value - 1;
|
||||
value = value * s_target_height / EFB_HEIGHT;
|
||||
value = value * m_target_height / EFB_HEIGHT;
|
||||
}
|
||||
|
||||
BoundingBox::Set(index, value);
|
||||
@ -1294,7 +1281,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
glDisable(GL_DEBUG_OUTPUT);
|
||||
}
|
||||
|
||||
if ((!XFBWrited && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
|
||||
if ((!m_xfb_written && !g_ActiveConfig.RealXFBEnabled()) || !fbWidth || !fbHeight)
|
||||
{
|
||||
Core::Callback_VideoCopiedToXFB(false);
|
||||
return;
|
||||
@ -1364,13 +1351,11 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
bool window_resized = false;
|
||||
int window_width = static_cast<int>(std::max(GLInterface->GetBackBufferWidth(), 1u));
|
||||
int window_height = static_cast<int>(std::max(GLInterface->GetBackBufferHeight(), 1u));
|
||||
if (window_width != s_backbuffer_width || window_height != s_backbuffer_height ||
|
||||
s_last_efb_scale != g_ActiveConfig.iEFBScale)
|
||||
if (window_width != m_backbuffer_width || window_height != m_backbuffer_height)
|
||||
{
|
||||
window_resized = true;
|
||||
s_backbuffer_width = window_width;
|
||||
s_backbuffer_height = window_height;
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
m_backbuffer_width = window_width;
|
||||
m_backbuffer_height = window_height;
|
||||
}
|
||||
|
||||
bool target_size_changed = CalculateTargetSize();
|
||||
@ -1400,9 +1385,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
|
||||
g_framebuffer_manager.reset();
|
||||
g_framebuffer_manager =
|
||||
std::make_unique<FramebufferManager>(s_target_width, s_target_height, s_MSAASamples);
|
||||
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
std::make_unique<FramebufferManager>(m_target_width, m_target_height, s_MSAASamples);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1420,13 +1403,13 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
OSD::DrawMessages();
|
||||
|
||||
#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();
|
||||
s_new_surface_handle = nullptr;
|
||||
s_surface_needs_change.Clear();
|
||||
s_surface_changed.Set();
|
||||
m_new_surface_handle = nullptr;
|
||||
m_surface_needs_change.Clear();
|
||||
m_surface_changed.Set();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1493,7 +1476,7 @@ void Renderer::DrawEFB(GLuint framebuffer, const TargetRectangle& target_rc,
|
||||
// for msaa mode, we must resolve the efb content to non-msaa
|
||||
GLuint tex = FramebufferManager::ResolveAndGetRenderTarget(source_rc);
|
||||
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,
|
||||
@ -1815,9 +1798,9 @@ void Renderer::ChangeSurface(void* new_surface_handle)
|
||||
// This is only necessary for Android at this point, although handling resizes here
|
||||
// would be more efficient than polling.
|
||||
#ifdef ANDROID
|
||||
s_new_surface_handle = new_surface_handle;
|
||||
s_surface_needs_change.Set();
|
||||
s_surface_changed.Wait();
|
||||
m_new_surface_handle = new_surface_handle;
|
||||
m_surface_needs_change.Set();
|
||||
m_surface_changed.Wait();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ class Renderer : public ::Renderer
|
||||
{
|
||||
public:
|
||||
Renderer();
|
||||
~Renderer();
|
||||
~Renderer() override;
|
||||
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
void SetBlendMode(bool forceUpdate) override;
|
||||
void SetScissorRect(const EFBRectangle& rc) override;
|
||||
|
@ -149,7 +149,7 @@ void VideoBackend::Video_Prepare()
|
||||
ProgramShaderCache::Init();
|
||||
g_texture_cache = std::make_unique<TextureCache>();
|
||||
g_sampler_cache = std::make_unique<SamplerCache>();
|
||||
Renderer::Init();
|
||||
static_cast<Renderer*>(g_renderer.get())->Init();
|
||||
TextureConverter::Init();
|
||||
BoundingBox::Init();
|
||||
}
|
||||
@ -166,7 +166,7 @@ void VideoBackend::Video_Cleanup()
|
||||
// The following calls are NOT Thread Safe
|
||||
// And need to be called from the video thread
|
||||
CleanupShared();
|
||||
Renderer::Shutdown();
|
||||
static_cast<Renderer*>(g_renderer.get())->Shutdown();
|
||||
BoundingBox::Shutdown();
|
||||
TextureConverter::Shutdown();
|
||||
g_sampler_cache.reset();
|
||||
|
@ -25,6 +25,11 @@
|
||||
static u8* s_xfbColorTexture[2];
|
||||
static int s_currentColorTexture = 0;
|
||||
|
||||
SWRenderer::SWRenderer()
|
||||
: ::Renderer(static_cast<int>(MAX_XFB_WIDTH), static_cast<int>(MAX_XFB_HEIGHT))
|
||||
{
|
||||
}
|
||||
|
||||
SWRenderer::~SWRenderer()
|
||||
{
|
||||
delete[] s_xfbColorTexture[0];
|
||||
|
@ -13,6 +13,7 @@
|
||||
class SWRenderer : public Renderer
|
||||
{
|
||||
public:
|
||||
SWRenderer();
|
||||
~SWRenderer() override;
|
||||
|
||||
static void Init();
|
||||
|
@ -226,8 +226,8 @@ void FramebufferManager::DestroyEFBRenderPass()
|
||||
|
||||
bool FramebufferManager::CreateEFBFramebuffer()
|
||||
{
|
||||
m_efb_width = static_cast<u32>(std::max(Renderer::GetTargetWidth(), 1));
|
||||
m_efb_height = static_cast<u32>(std::max(Renderer::GetTargetHeight(), 1));
|
||||
m_efb_width = static_cast<u32>(std::max(g_renderer->GetTargetWidth(), 1));
|
||||
m_efb_height = static_cast<u32>(std::max(g_renderer->GetTargetHeight(), 1));
|
||||
m_efb_layers = (g_ActiveConfig.iStereoMode != STEREO_OFF) ? 2 : 1;
|
||||
INFO_LOG(VIDEO, "EFB size: %ux%ux%u", m_efb_width, m_efb_height, m_efb_layers);
|
||||
|
||||
|
@ -42,7 +42,10 @@
|
||||
|
||||
namespace Vulkan
|
||||
{
|
||||
Renderer::Renderer(std::unique_ptr<SwapChain> swap_chain) : m_swap_chain(std::move(swap_chain))
|
||||
Renderer::Renderer(std::unique_ptr<SwapChain> swap_chain)
|
||||
: ::Renderer(swap_chain ? static_cast<int>(swap_chain->GetWidth()) : 1,
|
||||
swap_chain ? static_cast<int>(swap_chain->GetHeight()) : 0),
|
||||
m_swap_chain(std::move(swap_chain))
|
||||
{
|
||||
g_Config.bRunning = true;
|
||||
UpdateActiveConfig();
|
||||
@ -50,17 +53,6 @@ Renderer::Renderer(std::unique_ptr<SwapChain> swap_chain) : m_swap_chain(std::mo
|
||||
// Set to something invalid, forcing all states to be re-initialized.
|
||||
for (size_t i = 0; i < m_sampler_states.size(); i++)
|
||||
m_sampler_states[i].bits = std::numeric_limits<decltype(m_sampler_states[i].bits)>::max();
|
||||
|
||||
// These have to be initialized before FramebufferManager is created.
|
||||
// If running surfaceless, assume a window size of MAX_XFB_{WIDTH,HEIGHT}.
|
||||
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||
s_backbuffer_width = m_swap_chain ? m_swap_chain->GetWidth() : MAX_XFB_WIDTH;
|
||||
s_backbuffer_height = m_swap_chain ? m_swap_chain->GetHeight() : MAX_XFB_HEIGHT;
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
UpdateDrawRectangle();
|
||||
CalculateTargetSize();
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
}
|
||||
|
||||
Renderer::~Renderer()
|
||||
@ -274,12 +266,12 @@ u16 Renderer::BBoxRead(int index)
|
||||
if (index < 2)
|
||||
{
|
||||
// left/right
|
||||
value = value * EFB_WIDTH / s_target_width;
|
||||
value = value * EFB_WIDTH / m_target_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
// up/down
|
||||
value = value * EFB_HEIGHT / s_target_height;
|
||||
value = value * EFB_HEIGHT / m_target_height;
|
||||
}
|
||||
|
||||
// fix max values to describe the outer border
|
||||
@ -301,12 +293,12 @@ void Renderer::BBoxWrite(int index, u16 value)
|
||||
if (index < 2)
|
||||
{
|
||||
// left/right
|
||||
scaled_value = scaled_value * s_target_width / EFB_WIDTH;
|
||||
scaled_value = scaled_value * m_target_width / EFB_WIDTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
@ -485,7 +477,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
||||
FramebufferManager::GetInstance()->FlushEFBPokes();
|
||||
|
||||
// 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);
|
||||
return;
|
||||
@ -1020,30 +1012,27 @@ void Renderer::CheckForTargetResize(u32 fb_width, u32 fb_stride, u32 fb_height)
|
||||
|
||||
// Changing the XFB source area may alter the target size.
|
||||
if (CalculateTargetSize())
|
||||
{
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
ResizeEFBTextures();
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::CheckForSurfaceChange()
|
||||
{
|
||||
if (!s_surface_needs_change.IsSet())
|
||||
if (!m_surface_needs_change.IsSet())
|
||||
return;
|
||||
|
||||
u32 old_width = m_swap_chain ? m_swap_chain->GetWidth() : 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.
|
||||
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.");
|
||||
ResizeSwapChain();
|
||||
|
||||
// Notify the main thread we are done.
|
||||
s_surface_needs_change.Clear();
|
||||
s_new_surface_handle = nullptr;
|
||||
s_surface_changed.Set();
|
||||
m_surface_needs_change.Clear();
|
||||
m_new_surface_handle = nullptr;
|
||||
m_surface_changed.Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1053,7 +1042,7 @@ void Renderer::CheckForSurfaceChange()
|
||||
// Did we previously have a 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.
|
||||
m_swap_chain.reset();
|
||||
@ -1061,7 +1050,7 @@ void Renderer::CheckForSurfaceChange()
|
||||
else
|
||||
{
|
||||
// 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.");
|
||||
}
|
||||
}
|
||||
@ -1069,10 +1058,10 @@ void Renderer::CheckForSurfaceChange()
|
||||
{
|
||||
// Previously had no swap chain. So create one.
|
||||
VkSurfaceKHR surface = SwapChain::CreateVulkanSurface(g_vulkan_context->GetVulkanInstance(),
|
||||
s_new_surface_handle);
|
||||
m_new_surface_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)
|
||||
PanicAlert("Failed to create swap chain.");
|
||||
}
|
||||
@ -1083,9 +1072,9 @@ void Renderer::CheckForSurfaceChange()
|
||||
}
|
||||
|
||||
// Notify calling thread.
|
||||
s_surface_needs_change.Clear();
|
||||
s_new_surface_handle = nullptr;
|
||||
s_surface_changed.Set();
|
||||
m_surface_needs_change.Clear();
|
||||
m_new_surface_handle = nullptr;
|
||||
m_surface_changed.Set();
|
||||
}
|
||||
|
||||
if (m_swap_chain)
|
||||
@ -1103,6 +1092,7 @@ void Renderer::CheckForConfigChanges()
|
||||
int old_anisotropy = g_ActiveConfig.iMaxAnisotropy;
|
||||
int old_stereo_mode = g_ActiveConfig.iStereoMode;
|
||||
int old_aspect_ratio = g_ActiveConfig.iAspectRatio;
|
||||
int old_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
bool old_force_filtering = g_ActiveConfig.bForceFiltering;
|
||||
bool old_ssaa = g_ActiveConfig.bSSAA;
|
||||
bool old_use_xfb = g_ActiveConfig.bUseXFB;
|
||||
@ -1119,7 +1109,7 @@ void Renderer::CheckForConfigChanges()
|
||||
bool anisotropy_changed = old_anisotropy != g_ActiveConfig.iMaxAnisotropy;
|
||||
bool force_texture_filtering_changed = old_force_filtering != g_ActiveConfig.bForceFiltering;
|
||||
bool stereo_changed = old_stereo_mode != g_ActiveConfig.iStereoMode;
|
||||
bool efb_scale_changed = s_last_efb_scale != g_ActiveConfig.iEFBScale;
|
||||
bool efb_scale_changed = old_efb_scale != g_ActiveConfig.iEFBScale;
|
||||
bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio;
|
||||
bool use_xfb_changed = old_use_xfb != g_ActiveConfig.bUseXFB;
|
||||
bool use_realxfb_changed = old_use_realxfb != g_ActiveConfig.bUseRealXFB;
|
||||
@ -1130,7 +1120,6 @@ void Renderer::CheckForConfigChanges()
|
||||
// Handle settings that can cause the target rectangle to change.
|
||||
if (efb_scale_changed || aspect_changed || use_xfb_changed || use_realxfb_changed)
|
||||
{
|
||||
s_last_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
if (CalculateTargetSize())
|
||||
ResizeEFBTextures();
|
||||
}
|
||||
@ -1170,14 +1159,11 @@ void Renderer::CheckForConfigChanges()
|
||||
|
||||
void Renderer::OnSwapChainResized()
|
||||
{
|
||||
s_backbuffer_width = m_swap_chain->GetWidth();
|
||||
s_backbuffer_height = m_swap_chain->GetHeight();
|
||||
m_backbuffer_width = m_swap_chain->GetWidth();
|
||||
m_backbuffer_height = m_swap_chain->GetHeight();
|
||||
UpdateDrawRectangle();
|
||||
if (CalculateTargetSize())
|
||||
{
|
||||
PixelShaderManager::SetEfbScaleChanged();
|
||||
ResizeEFBTextures();
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::BindEFBToStateTracker()
|
||||
@ -1676,9 +1662,9 @@ void Renderer::SetViewport()
|
||||
void Renderer::ChangeSurface(void* new_surface_handle)
|
||||
{
|
||||
// Called by the main thread when the window is resized.
|
||||
s_new_surface_handle = new_surface_handle;
|
||||
s_surface_needs_change.Set();
|
||||
s_surface_changed.Set();
|
||||
m_new_surface_handle = new_surface_handle;
|
||||
m_surface_needs_change.Set();
|
||||
m_surface_changed.Set();
|
||||
}
|
||||
|
||||
void Renderer::RecompileShaders()
|
||||
|
@ -28,7 +28,7 @@ class Renderer : public ::Renderer
|
||||
{
|
||||
public:
|
||||
Renderer(std::unique_ptr<SwapChain> swap_chain);
|
||||
~Renderer();
|
||||
~Renderer() override;
|
||||
|
||||
static Renderer* GetInstance();
|
||||
|
||||
|
Reference in New Issue
Block a user