mirror of
https://github.com/libretro/Play-.git
synced 2025-03-02 16:38:03 +00:00
Made requirements to use a framebuffer for rendering a bit less strict and allowed buffer size to change. Makes DQ8 show something, but makes UT blinky.
This commit is contained in:
parent
9a74630465
commit
2a0a9a25fa
@ -209,7 +209,7 @@ void CGSH_OpenGL::FlipImpl()
|
||||
if(framebuffer)
|
||||
{
|
||||
float u0 = 0;
|
||||
float u1 = static_cast<float>(dispWidth) / static_cast<float>(framebuffer->m_width);
|
||||
float u1 = static_cast<float>(dispWidth) / static_cast<float>(framebuffer->m_textureWidth);
|
||||
|
||||
float v0 = 0;
|
||||
float v1 = static_cast<float>(dispHeight) / static_cast<float>(framebuffer->m_height);
|
||||
@ -885,7 +885,7 @@ void CGSH_OpenGL::SetupFramebuffer(const SHADERINFO& shaderInfo, uint64 frameReg
|
||||
}
|
||||
|
||||
//Look for a framebuffer that matches the specified information
|
||||
auto framebuffer = FindFramebuffer(frame);
|
||||
auto framebuffer = FindCompatibleFramebuffer(frame);
|
||||
if(!framebuffer)
|
||||
{
|
||||
framebuffer = FramebufferPtr(new CFramebuffer(frame.GetBasePtr(), frame.GetWidth(), 1024, frame.nPsm));
|
||||
@ -894,6 +894,7 @@ void CGSH_OpenGL::SetupFramebuffer(const SHADERINFO& shaderInfo, uint64 frameReg
|
||||
PopulateFramebuffer(framebuffer);
|
||||
#endif
|
||||
}
|
||||
framebuffer->SetBufferWidth(frame.GetWidth());
|
||||
|
||||
CommitFramebufferDirtyPages(framebuffer, scissor.scay0, scissor.scay1);
|
||||
|
||||
@ -1204,12 +1205,14 @@ void CGSH_OpenGL::SetupTexture(const SHADERINFO& shaderInfo, uint64 primReg, uin
|
||||
}
|
||||
}
|
||||
|
||||
CGSH_OpenGL::FramebufferPtr CGSH_OpenGL::FindFramebuffer(const FRAME& frame) const
|
||||
CGSH_OpenGL::FramebufferPtr CGSH_OpenGL::FindCompatibleFramebuffer(const FRAME& frame) const
|
||||
{
|
||||
auto framebufferIterator = std::find_if(std::begin(m_framebuffers), std::end(m_framebuffers),
|
||||
[&] (const FramebufferPtr& framebuffer)
|
||||
{
|
||||
return (framebuffer->m_basePtr == frame.GetBasePtr()) && (framebuffer->m_width == frame.GetWidth());
|
||||
return (framebuffer->m_basePtr == frame.GetBasePtr()) &&
|
||||
(framebuffer->m_psm == frame.nPsm) &&
|
||||
(framebuffer->m_width >= frame.GetWidth());
|
||||
}
|
||||
);
|
||||
|
||||
@ -1934,6 +1937,7 @@ CGSH_OpenGL::CFramebuffer::CFramebuffer(uint32 basePtr, uint32 width, uint32 hei
|
||||
, m_psm(psm)
|
||||
, m_framebuffer(0)
|
||||
, m_texture(0)
|
||||
, m_textureWidth(width)
|
||||
{
|
||||
m_cachedArea.SetArea(psm, basePtr, width, height);
|
||||
|
||||
@ -1965,6 +1969,13 @@ CGSH_OpenGL::CFramebuffer::~CFramebuffer()
|
||||
}
|
||||
}
|
||||
|
||||
void CGSH_OpenGL::CFramebuffer::SetBufferWidth(uint32 newWidth)
|
||||
{
|
||||
if(m_width == newWidth) return;
|
||||
m_width = newWidth;
|
||||
m_cachedArea.SetArea(m_psm, m_basePtr, m_width, m_height);
|
||||
}
|
||||
|
||||
void CGSH_OpenGL::PopulateFramebuffer(const FramebufferPtr& framebuffer)
|
||||
{
|
||||
if(framebuffer->m_psm != PSMCT32)
|
||||
|
@ -169,6 +169,8 @@ private:
|
||||
CFramebuffer(uint32, uint32, uint32, uint32);
|
||||
~CFramebuffer();
|
||||
|
||||
void SetBufferWidth(uint32);
|
||||
|
||||
uint32 m_basePtr;
|
||||
uint32 m_width;
|
||||
uint32 m_height;
|
||||
@ -176,6 +178,7 @@ private:
|
||||
|
||||
GLuint m_framebuffer;
|
||||
GLuint m_texture;
|
||||
uint32 m_textureWidth;
|
||||
|
||||
CGsCachedArea m_cachedArea;
|
||||
};
|
||||
@ -262,7 +265,7 @@ private:
|
||||
void SetupTexture(const SHADERINFO&, uint64, uint64, uint64, uint64, uint64);
|
||||
static bool IsCompatibleFramebufferPSM(unsigned int, unsigned int);
|
||||
|
||||
FramebufferPtr FindFramebuffer(const FRAME&) const;
|
||||
FramebufferPtr FindCompatibleFramebuffer(const FRAME&) const;
|
||||
DepthbufferPtr FindDepthbuffer(const ZBUF&, const FRAME&) const;
|
||||
|
||||
void DumpTexture(unsigned int, unsigned int, uint32);
|
||||
|
@ -101,7 +101,7 @@ CGSH_OpenGL::TEXTURE_INFO CGSH_OpenGL::PrepareTexture(const TEX0& tex0)
|
||||
//We have a winner
|
||||
glBindTexture(GL_TEXTURE_2D, candidateFramebuffer->m_texture);
|
||||
|
||||
float scaleRatioX = static_cast<float>(tex0.GetWidth()) / static_cast<float>(candidateFramebuffer->m_width);
|
||||
float scaleRatioX = static_cast<float>(tex0.GetWidth()) / static_cast<float>(candidateFramebuffer->m_textureWidth);
|
||||
float scaleRatioY = static_cast<float>(tex0.GetHeight()) / static_cast<float>(candidateFramebuffer->m_height);
|
||||
|
||||
//If we're currently in interlaced mode, framebuffer will have twice the height
|
||||
|
Loading…
x
Reference in New Issue
Block a user