Move last XFB size from Render to FramebufferManager.
This commit is contained in:
parent
8f5223d0e6
commit
035840e7b5
|
@ -10,6 +10,9 @@ XFBSourceBase *FramebufferManagerBase::m_realXFBSource; // Only used in Real XFB
|
||||||
FramebufferManagerBase::VirtualXFBListType FramebufferManagerBase::m_virtualXFBList; // Only used in Virtual XFB mode
|
FramebufferManagerBase::VirtualXFBListType FramebufferManagerBase::m_virtualXFBList; // Only used in Virtual XFB mode
|
||||||
const XFBSourceBase* FramebufferManagerBase::m_overlappingXFBArray[MAX_VIRTUAL_XFB];
|
const XFBSourceBase* FramebufferManagerBase::m_overlappingXFBArray[MAX_VIRTUAL_XFB];
|
||||||
|
|
||||||
|
unsigned int FramebufferManagerBase::s_last_xfb_width;
|
||||||
|
unsigned int FramebufferManagerBase::s_last_xfb_height;
|
||||||
|
|
||||||
FramebufferManagerBase::FramebufferManagerBase()
|
FramebufferManagerBase::FramebufferManagerBase()
|
||||||
{
|
{
|
||||||
m_realXFBSource = NULL;
|
m_realXFBSource = NULL;
|
||||||
|
|
|
@ -50,6 +50,11 @@ public:
|
||||||
static void CopyToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma);
|
static void CopyToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma);
|
||||||
static const XFBSourceBase* const* GetXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount);
|
static const XFBSourceBase* const* GetXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount);
|
||||||
|
|
||||||
|
static void SetLastXfbWidth(unsigned int width) { s_last_xfb_width = width; }
|
||||||
|
static void SetLastXfbHeight(unsigned int height) { s_last_xfb_height = height; }
|
||||||
|
static unsigned int LastXfbWidth() { return s_last_xfb_width; }
|
||||||
|
static unsigned int LastXfbHeight() { return s_last_xfb_height; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct VirtualXFB
|
struct VirtualXFB
|
||||||
{
|
{
|
||||||
|
@ -85,6 +90,9 @@ private:
|
||||||
static VirtualXFBListType m_virtualXFBList; // Only used in Virtual XFB mode
|
static VirtualXFBListType m_virtualXFBList; // Only used in Virtual XFB mode
|
||||||
|
|
||||||
static const XFBSourceBase* m_overlappingXFBArray[MAX_VIRTUAL_XFB];
|
static const XFBSourceBase* m_overlappingXFBArray[MAX_VIRTUAL_XFB];
|
||||||
|
|
||||||
|
static unsigned int s_last_xfb_width;
|
||||||
|
static unsigned int s_last_xfb_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FramebufferManagerBase *g_framebuffer_manager;
|
extern FramebufferManagerBase *g_framebuffer_manager;
|
||||||
|
|
|
@ -71,9 +71,6 @@ int Renderer::s_backbuffer_height;
|
||||||
float Renderer::xScale;
|
float Renderer::xScale;
|
||||||
float Renderer::yScale;
|
float Renderer::yScale;
|
||||||
|
|
||||||
unsigned int Renderer::s_XFB_width;
|
|
||||||
unsigned int Renderer::s_XFB_height;
|
|
||||||
|
|
||||||
int Renderer::s_LastEFBScale;
|
int Renderer::s_LastEFBScale;
|
||||||
|
|
||||||
bool Renderer::s_skipSwap;
|
bool Renderer::s_skipSwap;
|
||||||
|
@ -121,14 +118,14 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
|
||||||
VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight);
|
VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight);
|
||||||
XFBWrited = true;
|
XFBWrited = true;
|
||||||
|
|
||||||
// XXX: Without the VI, how would we know what kind of field this is? So
|
|
||||||
// just use progressive.
|
|
||||||
if (g_ActiveConfig.bUseXFB)
|
if (g_ActiveConfig.bUseXFB)
|
||||||
{
|
{
|
||||||
FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc,Gamma);
|
FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc,Gamma);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// XXX: Without the VI, how would we know what kind of field this is? So
|
||||||
|
// just use progressive.
|
||||||
g_renderer->Swap(xfbAddr, FIELD_PROGRESSIVE, fbWidth, fbHeight,sourceRc,Gamma);
|
g_renderer->Swap(xfbAddr, FIELD_PROGRESSIVE, fbWidth, fbHeight,sourceRc,Gamma);
|
||||||
Common::AtomicStoreRelease(s_swapRequested, false);
|
Common::AtomicStoreRelease(s_swapRequested, false);
|
||||||
}
|
}
|
||||||
|
@ -323,13 +320,13 @@ void Renderer::CalculateXYScale(const TargetRectangle& dst_rect)
|
||||||
if (g_ActiveConfig.b3DVision)
|
if (g_ActiveConfig.b3DVision)
|
||||||
{
|
{
|
||||||
// This works, yet the version in the else doesn't. No idea why.
|
// This works, yet the version in the else doesn't. No idea why.
|
||||||
xScale = (float)(s_backbuffer_width-1) / (float)(s_XFB_width-1);
|
xScale = (float)(s_backbuffer_width-1) / (float)(FramebufferManagerBase::LastXfbWidth()-1);
|
||||||
yScale = (float)(s_backbuffer_height-1) / (float)(s_XFB_height-1);
|
yScale = (float)(s_backbuffer_height-1) / (float)(FramebufferManagerBase::LastXfbHeight()-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(s_XFB_width-1);
|
xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(FramebufferManagerBase::LastXfbWidth()-1);
|
||||||
yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(s_XFB_height-1);
|
yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(FramebufferManagerBase::LastXfbHeight()-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,9 +163,6 @@ protected:
|
||||||
static float xScale;
|
static float xScale;
|
||||||
static float yScale;
|
static float yScale;
|
||||||
|
|
||||||
static unsigned int s_XFB_width;
|
|
||||||
static unsigned int s_XFB_height;
|
|
||||||
|
|
||||||
// can probably eliminate this static var
|
// can probably eliminate this static var
|
||||||
static int s_LastEFBScale;
|
static int s_LastEFBScale;
|
||||||
|
|
||||||
|
|
|
@ -345,8 +345,8 @@ Renderer::Renderer()
|
||||||
s_backbuffer_width = D3D::GetBackBufferWidth();
|
s_backbuffer_width = D3D::GetBackBufferWidth();
|
||||||
s_backbuffer_height = D3D::GetBackBufferHeight();
|
s_backbuffer_height = D3D::GetBackBufferHeight();
|
||||||
|
|
||||||
s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||||
s_XFB_height = MAX_XFB_HEIGHT;
|
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||||
|
|
||||||
TargetRectangle dst_rect;
|
TargetRectangle dst_rect;
|
||||||
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
||||||
|
@ -1131,15 +1131,13 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||||
|
|
||||||
bool xfbchanged = false;
|
bool xfbchanged = false;
|
||||||
|
|
||||||
if (s_XFB_width != fbWidth || s_XFB_height != fbHeight)
|
if (FramebufferManagerBase::LastXfbWidth() != fbWidth || FramebufferManagerBase::LastXfbHeight() != fbHeight)
|
||||||
{
|
{
|
||||||
xfbchanged = true;
|
xfbchanged = true;
|
||||||
s_XFB_width = fbWidth;
|
unsigned int w = (fbWidth < 1 || fbWidth > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fbWidth;
|
||||||
s_XFB_height = fbHeight;
|
unsigned int h = (fbHeight < 1 || fbHeight > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fbHeight;
|
||||||
if (s_XFB_width < 1) s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbWidth(w);
|
||||||
if (s_XFB_width > MAX_XFB_WIDTH) s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbHeight(h);
|
||||||
if (s_XFB_height < 1) s_XFB_height = MAX_XFB_HEIGHT;
|
|
||||||
if (s_XFB_height > MAX_XFB_HEIGHT) s_XFB_height = MAX_XFB_HEIGHT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update FPS counter
|
// update FPS counter
|
||||||
|
|
|
@ -274,8 +274,8 @@ Renderer::Renderer()
|
||||||
s_backbuffer_width = D3D::GetBackBufferWidth();
|
s_backbuffer_width = D3D::GetBackBufferWidth();
|
||||||
s_backbuffer_height = D3D::GetBackBufferHeight();
|
s_backbuffer_height = D3D::GetBackBufferHeight();
|
||||||
|
|
||||||
s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||||
s_XFB_height = MAX_XFB_HEIGHT;
|
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||||
|
|
||||||
TargetRectangle dst_rect;
|
TargetRectangle dst_rect;
|
||||||
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
||||||
|
@ -1124,15 +1124,13 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||||
|
|
||||||
bool xfbchanged = false;
|
bool xfbchanged = false;
|
||||||
|
|
||||||
if (s_XFB_width != fbWidth || s_XFB_height != fbHeight)
|
if (FramebufferManagerBase::LastXfbWidth() != fbWidth || FramebufferManagerBase::LastXfbHeight() != fbHeight)
|
||||||
{
|
{
|
||||||
xfbchanged = true;
|
xfbchanged = true;
|
||||||
s_XFB_width = fbWidth;
|
unsigned int w = (fbWidth < 1 || fbWidth > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fbWidth;
|
||||||
s_XFB_height = fbHeight;
|
unsigned int h = (fbHeight < 1 || fbHeight > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fbHeight;
|
||||||
if (s_XFB_width < 1) s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbWidth(w);
|
||||||
if (s_XFB_width > MAX_XFB_WIDTH) s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbHeight(h);
|
||||||
if (s_XFB_height < 1) s_XFB_height = MAX_XFB_HEIGHT;
|
|
||||||
if (s_XFB_height > MAX_XFB_HEIGHT) s_XFB_height = MAX_XFB_HEIGHT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 newAA = g_ActiveConfig.iMultisampleMode;
|
u32 newAA = g_ActiveConfig.iMultisampleMode;
|
||||||
|
|
|
@ -359,8 +359,9 @@ Renderer::Renderer()
|
||||||
if (!GLEW_ARB_texture_non_power_of_two)
|
if (!GLEW_ARB_texture_non_power_of_two)
|
||||||
WARN_LOG(VIDEO, "ARB_texture_non_power_of_two not supported.");
|
WARN_LOG(VIDEO, "ARB_texture_non_power_of_two not supported.");
|
||||||
|
|
||||||
s_XFB_width = MAX_XFB_WIDTH;
|
// TODO: Move these somewhere else?
|
||||||
s_XFB_height = MAX_XFB_HEIGHT;
|
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
|
||||||
|
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
|
||||||
|
|
||||||
TargetRectangle dst_rect;
|
TargetRectangle dst_rect;
|
||||||
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
|
||||||
|
@ -1288,15 +1289,13 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||||
|
|
||||||
bool xfbchanged = false;
|
bool xfbchanged = false;
|
||||||
|
|
||||||
if (s_XFB_width != fbWidth || s_XFB_height != fbHeight)
|
if (FramebufferManagerBase::LastXfbWidth() != fbWidth || FramebufferManagerBase::LastXfbHeight() != fbHeight)
|
||||||
{
|
{
|
||||||
xfbchanged = true;
|
xfbchanged = true;
|
||||||
s_XFB_width = fbWidth;
|
unsigned int w = (fbWidth < 1 || fbWidth > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fbWidth;
|
||||||
s_XFB_height = fbHeight;
|
unsigned int h = (fbHeight < 1 || fbHeight > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fbHeight;
|
||||||
if (s_XFB_width < 1) s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbWidth(w);
|
||||||
if (s_XFB_width > MAX_XFB_WIDTH) s_XFB_width = MAX_XFB_WIDTH;
|
FramebufferManagerBase::SetLastXfbHeight(h);
|
||||||
if (s_XFB_height < 1) s_XFB_height = MAX_XFB_HEIGHT;
|
|
||||||
if (s_XFB_height > MAX_XFB_HEIGHT) s_XFB_height = MAX_XFB_HEIGHT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowResized = false;
|
bool WindowResized = false;
|
||||||
|
|
Loading…
Reference in New Issue