- changed the 2D draw abort check to use a dedicated variable, that gets set in Begin2D and unset at the end of D_Display.

This is really all the extent where 2D draw operations may be allowed. Trying to detect this from other variables is not reliable.
This commit is contained in:
Christoph Oelckers 2017-04-01 12:59:58 +02:00
parent 9dc8933109
commit 54764c136d
7 changed files with 8 additions and 6 deletions

View file

@ -937,7 +937,7 @@ void D_Display ()
I_FreezeTime(false);
GSnd->SetSfxPaused(false, 1);
}
screen->End2D();
cycles.Unclock();
FrameCycles = cycles;
}

View file

@ -359,8 +359,9 @@ FNativePalette *OpenGLFrameBuffer::CreatePalette(FRemapTable *remap)
//
//
//==========================================================================
bool OpenGLFrameBuffer::Begin2D(bool)
bool OpenGLFrameBuffer::Begin2D(bool copy3d)
{
Super::Begin2D(copy3d);
ClearClipRect();
gl_RenderState.mViewMatrix.loadIdentity();
gl_RenderState.mProjectionMatrix.ortho(0, GetWidth(), GetHeight(), 0, -1.0f, 1.0f);

View file

@ -33,7 +33,6 @@ public:
OpenGLSWFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra);
~OpenGLSWFrameBuffer();
bool HasBegun2D() override { return In2D || IsLocked(); }
bool IsValid() override;
bool Lock(bool buffered) override;
void Unlock() override;

View file

@ -1122,6 +1122,7 @@ void DFrameBuffer::SetBlendingRect (int x1, int y1, int x2, int y2)
bool DFrameBuffer::Begin2D (bool copy3d)
{
isIn2D = true;
ClearClipRect();
return false;
}

View file

@ -413,9 +413,10 @@ public:
// avoid copying the software buffer to the screen.
// Returns true if hardware-accelerated 2D has been entered, false if not.
virtual bool Begin2D(bool copy3d);
void End2D() { isIn2D = false; }
// Returns true if Begin2D has been called and 2D drawing is now active
virtual bool HasBegun2D() { return IsLocked(); }
bool HasBegun2D() { return isIn2D; }
// DrawTexture calls after Begin2D use native textures.
@ -463,6 +464,7 @@ protected:
private:
uint32_t LastMS, LastSec, FrameCount, LastCount, LastTic;
bool isIn2D = false;
};

View file

@ -2557,7 +2557,7 @@ bool D3DPal::Update()
bool D3DFB::Begin2D(bool copy3d)
{
ClearClipRect();
Super::Begin2D(copy3d);
if (!Accel2D)
{
return false;

View file

@ -105,7 +105,6 @@ public:
D3DFB (UINT adapter, int width, int height, bool bgra, bool fullscreen);
~D3DFB ();
bool HasBegun2D() override { return In2D || IsLocked(); }
bool IsValid ();
bool Lock (bool buffered);
void Unlock ();