mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-27 13:41:06 +00:00
- moved locking logic from DCanvas to DFrameBuffer.
The software canvases used for rendering camera textures and save pictures in the software renderer do not need this.
This commit is contained in:
parent
dd491d6558
commit
ba799aebbd
11 changed files with 6 additions and 65 deletions
|
@ -516,31 +516,6 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE)
|
||||||
setmsgcolor (PRINTLEVELS+1, self);
|
setmsgcolor (PRINTLEVELS+1, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void maybedrawnow (bool tick, bool force)
|
|
||||||
{
|
|
||||||
// FIXME: Does not work right with hw2d
|
|
||||||
if (ConsoleDrawing || screen == NULL || screen->IsLocked () || screen->Accel2D || ConFont == NULL)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vidactive &&
|
|
||||||
(((tick || gameaction != ga_nothing) && ConsoleState == c_down)
|
|
||||||
|| gamestate == GS_STARTUP))
|
|
||||||
{
|
|
||||||
static size_t lastprinttime = 0;
|
|
||||||
size_t nowtime = I_GetTime();
|
|
||||||
|
|
||||||
if (nowtime - lastprinttime > 1 || force)
|
|
||||||
{
|
|
||||||
screen->Lock (false);
|
|
||||||
C_DrawConsole (false);
|
|
||||||
screen->Update ();
|
|
||||||
lastprinttime = nowtime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct TextQueue
|
struct TextQueue
|
||||||
{
|
{
|
||||||
TextQueue (bool notify, int printlevel, const char *text)
|
TextQueue (bool notify, int printlevel, const char *text)
|
||||||
|
@ -857,7 +832,6 @@ int PrintString (int printlevel, const char *outline)
|
||||||
if (vidactive && screen && SmallFont)
|
if (vidactive && screen && SmallFont)
|
||||||
{
|
{
|
||||||
NotifyStrings.AddString(printlevel, outline);
|
NotifyStrings.AddString(printlevel, outline);
|
||||||
maybedrawnow (false, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Logfile != NULL)
|
else if (Logfile != NULL)
|
||||||
|
@ -1088,13 +1062,11 @@ void C_InitTicker (const char *label, unsigned int max, bool showpercent)
|
||||||
TickerMax = max;
|
TickerMax = max;
|
||||||
TickerLabel = label;
|
TickerLabel = label;
|
||||||
TickerAt = 0;
|
TickerAt = 0;
|
||||||
maybedrawnow (true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_SetTicker (unsigned int at, bool forceUpdate)
|
void C_SetTicker (unsigned int at, bool forceUpdate)
|
||||||
{
|
{
|
||||||
TickerAt = at > TickerMax ? TickerMax : at;
|
TickerAt = at > TickerMax ? TickerMax : at;
|
||||||
maybedrawnow (true, TickerVisible ? forceUpdate : false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_DrawConsole (bool hw2d)
|
void C_DrawConsole (bool hw2d)
|
||||||
|
|
|
@ -93,14 +93,10 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
||||||
viewwindowy = y;
|
viewwindowy = y;
|
||||||
viewactive = true;
|
viewactive = true;
|
||||||
|
|
||||||
canvas->Lock(true);
|
|
||||||
|
|
||||||
RenderActorView(actor, dontmaplines);
|
RenderActorView(actor, dontmaplines);
|
||||||
Threads.MainThread()->FlushDrawQueue();
|
Threads.MainThread()->FlushDrawQueue();
|
||||||
DrawerThreads::WaitForWorkers();
|
DrawerThreads::WaitForWorkers();
|
||||||
|
|
||||||
canvas->Unlock();
|
|
||||||
|
|
||||||
RenderTarget = screen;
|
RenderTarget = screen;
|
||||||
R_ExecuteSetViewSize(Viewpoint, Viewwindow);
|
R_ExecuteSetViewSize(Viewpoint, Viewwindow);
|
||||||
float trueratio;
|
float trueratio;
|
||||||
|
|
|
@ -1171,12 +1171,6 @@ void SDLGLFB::Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDLGLFB::IsLocked()
|
|
||||||
{
|
|
||||||
return m_Lock > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SDLGLFB::IsFullscreen()
|
bool SDLGLFB::IsFullscreen()
|
||||||
{
|
{
|
||||||
return CocoaVideo::IsFullscreen();
|
return CocoaVideo::IsFullscreen();
|
||||||
|
|
|
@ -57,7 +57,6 @@ public:
|
||||||
|
|
||||||
virtual bool Lock(bool buffered = true);
|
virtual bool Lock(bool buffered = true);
|
||||||
virtual void Unlock();
|
virtual void Unlock();
|
||||||
virtual bool IsLocked();
|
|
||||||
|
|
||||||
virtual bool IsFullscreen();
|
virtual bool IsFullscreen();
|
||||||
virtual void SetVSync(bool vsync);
|
virtual void SetVSync(bool vsync);
|
||||||
|
|
|
@ -524,11 +524,6 @@ void SDLGLFB::Unlock ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDLGLFB::IsLocked ()
|
|
||||||
{
|
|
||||||
return m_Lock>0;// true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SDLGLFB::IsFullscreen ()
|
bool SDLGLFB::IsFullscreen ()
|
||||||
{
|
{
|
||||||
return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
|
return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
|
||||||
|
|
|
@ -56,7 +56,6 @@ public:
|
||||||
bool Lock(bool buffered);
|
bool Lock(bool buffered);
|
||||||
bool Lock ();
|
bool Lock ();
|
||||||
void Unlock();
|
void Unlock();
|
||||||
bool IsLocked ();
|
|
||||||
|
|
||||||
bool IsValid ();
|
bool IsValid ();
|
||||||
bool IsFullscreen ();
|
bool IsFullscreen ();
|
||||||
|
|
|
@ -208,7 +208,6 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
||||||
PalEntry palette[256];
|
PalEntry palette[256];
|
||||||
|
|
||||||
// Take a snapshot of the player's view
|
// Take a snapshot of the player's view
|
||||||
pic->Lock ();
|
|
||||||
if (r_polyrenderer)
|
if (r_polyrenderer)
|
||||||
{
|
{
|
||||||
PolyRenderer::Instance()->Viewpoint = r_viewpoint;
|
PolyRenderer::Instance()->Viewpoint = r_viewpoint;
|
||||||
|
@ -227,7 +226,6 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
||||||
}
|
}
|
||||||
screen->GetFlashedPalette (palette);
|
screen->GetFlashedPalette (palette);
|
||||||
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch(), Gamma);
|
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch(), Gamma);
|
||||||
pic->Unlock ();
|
|
||||||
delete pic;
|
delete pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,11 +95,7 @@ FRenderer *Renderer;
|
||||||
EXTERN_CVAR (Bool, swtruecolor)
|
EXTERN_CVAR (Bool, swtruecolor)
|
||||||
EXTERN_CVAR (Bool, fullscreen)
|
EXTERN_CVAR (Bool, fullscreen)
|
||||||
|
|
||||||
#if defined(_DEBUG) && defined(_M_IX86) && !defined(__MINGW32__)
|
#define DBGBREAK assert(0)
|
||||||
#define DBGBREAK { __asm int 3 }
|
|
||||||
#else
|
|
||||||
#define DBGBREAK
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class DDummyFrameBuffer : public DFrameBuffer
|
class DDummyFrameBuffer : public DFrameBuffer
|
||||||
{
|
{
|
||||||
|
@ -111,7 +107,9 @@ public:
|
||||||
Width = width;
|
Width = width;
|
||||||
Height = height;
|
Height = height;
|
||||||
}
|
}
|
||||||
|
// These methods should never be called.
|
||||||
bool Lock(bool buffered) { DBGBREAK; return false; }
|
bool Lock(bool buffered) { DBGBREAK; return false; }
|
||||||
|
void Unlock() { DBGBREAK; }
|
||||||
void Update() { DBGBREAK; }
|
void Update() { DBGBREAK; }
|
||||||
PalEntry *GetPalette() { DBGBREAK; return NULL; }
|
PalEntry *GetPalette() { DBGBREAK; return NULL; }
|
||||||
void GetFlashedPalette(PalEntry palette[256]) { DBGBREAK; }
|
void GetFlashedPalette(PalEntry palette[256]) { DBGBREAK; }
|
||||||
|
|
|
@ -214,11 +214,6 @@ public:
|
||||||
|
|
||||||
virtual bool IsValid ();
|
virtual bool IsValid ();
|
||||||
|
|
||||||
// Access control
|
|
||||||
virtual bool Lock (bool buffered=true) = 0; // Returns true if the surface was lost since last time
|
|
||||||
virtual void Unlock () = 0;
|
|
||||||
virtual bool IsLocked () { return Buffer != NULL; } // Returns true if the surface is locked
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t *Buffer;
|
uint8_t *Buffer;
|
||||||
int Width;
|
int Width;
|
||||||
|
@ -298,8 +293,9 @@ protected:
|
||||||
public:
|
public:
|
||||||
DFrameBuffer (int width, int height, bool bgra);
|
DFrameBuffer (int width, int height, bool bgra);
|
||||||
|
|
||||||
// Force the surface to use buffered output if true is passed.
|
// Access control
|
||||||
virtual bool Lock (bool buffered) = 0;
|
virtual bool Lock(bool buffered = true) = 0; // Returns true if the surface was lost since last time
|
||||||
|
virtual void Unlock() = 0;
|
||||||
|
|
||||||
// Make the surface visible. Also implies Unlock().
|
// Make the surface visible. Also implies Unlock().
|
||||||
virtual void Update () = 0;
|
virtual void Update () = 0;
|
||||||
|
|
|
@ -1183,11 +1183,6 @@ void Win32GLFrameBuffer::Unlock ()
|
||||||
m_Lock--;
|
m_Lock--;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Win32GLFrameBuffer::IsLocked ()
|
|
||||||
{
|
|
||||||
return m_Lock > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -57,7 +57,6 @@ public:
|
||||||
bool Lock(bool buffered);
|
bool Lock(bool buffered);
|
||||||
bool Lock ();
|
bool Lock ();
|
||||||
void Unlock();
|
void Unlock();
|
||||||
bool IsLocked ();
|
|
||||||
|
|
||||||
|
|
||||||
bool IsFullscreen();
|
bool IsFullscreen();
|
||||||
|
|
Loading…
Reference in a new issue