Fix getViewPort returning incorrect results

This commit is contained in:
Vincent Robinson 2021-06-21 14:16:38 -07:00 committed by GitHub
parent b43f9b96e0
commit 78d1a3f73e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 8 deletions

@ -2099,6 +2099,13 @@ COGLES2Driver::~COGLES2Driver()
}
void COGLES2Driver::setViewPortRaw(u32 width, u32 height)
{
CacheHandler->setViewport(0, 0, width, height);
ViewPort = core::recti(0, 0, width, height);
}
//! Draws a shadow volume into the stencil buffer.
void COGLES2Driver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)
{
@ -2460,7 +2467,7 @@ COGLES2Driver::~COGLES2Driver()
destRenderTargetSize = renderTarget->getSize();
CacheHandler->setViewport(0, 0, destRenderTargetSize.Width, destRenderTargetSize.Height);
setViewPortRaw(destRenderTargetSize.Width, destRenderTargetSize.Height);
}
else
{
@ -2468,7 +2475,7 @@ COGLES2Driver::~COGLES2Driver()
destRenderTargetSize = core::dimension2d<u32>(0, 0);
CacheHandler->setViewport(0, 0, ScreenSize.Width, ScreenSize.Height);
setViewPortRaw(ScreenSize.Width, ScreenSize.Height);
}
if (CurrentRenderTargetSize != destRenderTargetSize)

@ -379,6 +379,9 @@ namespace video
bool setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture);
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
virtual void setViewPortRaw(u32 width, u32 height);
COGLES2CacheHandler* CacheHandler;
core::stringw Name;
core::stringc VendorName;

@ -2330,6 +2330,13 @@ void COGLES1Driver::setViewPort(const core::rect<s32>& area)
}
void COGLES1Driver::setViewPortRaw(u32 width, u32 height)
{
CacheHandler->setViewport(0, 0, width, height);
ViewPort = core::recti(0, 0, width, height);
}
//! Draws a shadow volume into the stencil buffer.
void COGLES1Driver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)
{
@ -2779,7 +2786,7 @@ bool COGLES1Driver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = renderTarget->getSize();
CacheHandler->setViewport(0, 0, destRenderTargetSize.Width, destRenderTargetSize.Height);
setViewPortRaw(destRenderTargetSize.Width, destRenderTargetSize.Height);
}
else
{
@ -2805,7 +2812,7 @@ bool COGLES1Driver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = core::dimension2d<u32>(0, 0);
CacheHandler->setViewport(0, 0, ScreenSize.Width, ScreenSize.Height);
setViewPortRaw(ScreenSize.Width, ScreenSize.Height);
}
if (CurrentRenderTargetSize != destRenderTargetSize)

@ -342,6 +342,9 @@ namespace video
//! \param[in] lightIndex: the index of the requesting light
void assignHardwareLight(u32 lightIndex);
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
virtual void setViewPortRaw(u32 width, u32 height);
COGLES1CacheHandler* CacheHandler;
core::stringw Name;

@ -3240,6 +3240,13 @@ void COpenGLDriver::setViewPort(const core::rect<s32>& area)
}
void COpenGLDriver::setViewPortRaw(u32 width, u32 height)
{
CacheHandler->setViewport(0, 0, width, height);
ViewPort = core::recti(0, 0, width, height);
}
//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do
//! this: First, draw all geometry. Then use this method, to draw the shadow
//! volume. Next use IVideoDriver::drawStencilShadow() to visualize the shadow.
@ -3872,7 +3879,7 @@ bool COpenGLDriver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = renderTarget->getSize();
CacheHandler->setViewport(0, 0, destRenderTargetSize.Width, destRenderTargetSize.Height);
setViewPortRaw(destRenderTargetSize.Width, destRenderTargetSize.Height);
}
else
{
@ -3898,7 +3905,7 @@ bool COpenGLDriver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = core::dimension2d<u32>(0, 0);
CacheHandler->setViewport(0, 0, ScreenSize.Width, ScreenSize.Height);
setViewPortRaw(ScreenSize.Width, ScreenSize.Height);
}
if (CurrentRenderTargetSize != destRenderTargetSize)

@ -456,6 +456,9 @@ namespace video
void renderArray(const void* indexList, u32 primitiveCount,
scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
virtual void setViewPortRaw(u32 width, u32 height);
COpenGLCacheHandler* CacheHandler;
core::stringw Name;