mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Remove non-threaded graphics as they strongly decrease performance in many cases
This commit is contained in:
parent
ed30695b99
commit
79a99a994c
|
@ -1850,10 +1850,7 @@ void CClient::Run()
|
|||
|
||||
// init graphics
|
||||
{
|
||||
if(g_Config.m_GfxThreaded)
|
||||
m_pGraphics = CreateEngineGraphicsThreaded();
|
||||
else
|
||||
m_pGraphics = CreateEngineGraphics();
|
||||
m_pGraphics = CreateEngineGraphicsThreaded();
|
||||
|
||||
bool RegisterFail = false;
|
||||
RegisterFail = RegisterFail || !Kernel()->RegisterInterface(static_cast<IEngineGraphics*>(m_pGraphics)); // register graphics as both
|
||||
|
@ -2023,7 +2020,7 @@ void CClient::Run()
|
|||
|
||||
Update();
|
||||
|
||||
if(m_pGraphics->WindowOpen() && (!g_Config.m_GfxAsyncRender || m_pGraphics->IsIdle()))
|
||||
if(m_pGraphics->WindowOpen() && m_pGraphics->IsIdle())
|
||||
{
|
||||
m_RenderFrames++;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,157 +0,0 @@
|
|||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
#ifndef ENGINE_CLIENT_GRAPHICS_H
|
||||
#define ENGINE_CLIENT_GRAPHICS_H
|
||||
|
||||
class CGraphics_OpenGL : public IEngineGraphics
|
||||
{
|
||||
protected:
|
||||
class IStorage *m_pStorage;
|
||||
class IConsole *m_pConsole;
|
||||
|
||||
//
|
||||
typedef struct { float x, y, z; } CPoint;
|
||||
typedef struct { float u, v; } CTexCoord;
|
||||
typedef struct { float r, g, b, a; } CColor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CPoint m_Pos;
|
||||
CTexCoord m_Tex;
|
||||
CColor m_Color;
|
||||
} CVertex;
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_VERTICES = 32*1024,
|
||||
MAX_TEXTURES = 1024*4,
|
||||
|
||||
DRAWING_QUADS=1,
|
||||
DRAWING_LINES=2
|
||||
};
|
||||
|
||||
CVertex m_aVertices[MAX_VERTICES];
|
||||
int m_NumVertices;
|
||||
|
||||
CColor m_aColor[4];
|
||||
CTexCoord m_aTexture[4];
|
||||
|
||||
bool m_RenderEnable;
|
||||
|
||||
float m_Rotation;
|
||||
int m_Drawing;
|
||||
bool m_DoScreenshot;
|
||||
char m_aScreenshotName[128];
|
||||
|
||||
float m_ScreenX0;
|
||||
float m_ScreenY0;
|
||||
float m_ScreenX1;
|
||||
float m_ScreenY1;
|
||||
|
||||
int m_InvalidTexture;
|
||||
|
||||
struct CTexture
|
||||
{
|
||||
GLuint m_Tex;
|
||||
int m_MemSize;
|
||||
int m_Flags;
|
||||
int m_Next;
|
||||
};
|
||||
|
||||
CTexture m_aTextures[MAX_TEXTURES];
|
||||
int m_FirstFreeTexture;
|
||||
int m_TextureMemoryUsage;
|
||||
|
||||
void Flush();
|
||||
void AddVertices(int Count);
|
||||
void Rotate4(const CPoint &rCenter, CVertex *pPoints);
|
||||
|
||||
static unsigned char Sample(int w, int h, const unsigned char *pData, int u, int v, int Offset, int ScaleW, int ScaleH, int Bpp);
|
||||
static unsigned char *Rescale(int Width, int Height, int NewWidth, int NewHeight, int Format, const unsigned char *pData);
|
||||
public:
|
||||
CGraphics_OpenGL();
|
||||
|
||||
virtual void ClipEnable(int x, int y, int w, int h);
|
||||
virtual void ClipDisable();
|
||||
|
||||
virtual void BlendNone();
|
||||
virtual void BlendNormal();
|
||||
virtual void BlendAdditive();
|
||||
|
||||
virtual void WrapNormal();
|
||||
virtual void WrapClamp();
|
||||
|
||||
virtual int MemoryUsage() const;
|
||||
|
||||
virtual void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY);
|
||||
virtual void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY);
|
||||
|
||||
virtual void LinesBegin();
|
||||
virtual void LinesEnd();
|
||||
virtual void LinesDraw(const CLineItem *pArray, int Num);
|
||||
|
||||
virtual int UnloadTexture(int Index);
|
||||
virtual int LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags);
|
||||
virtual int LoadTextureRawSub(int TextureID, int x, int y, int Width, int Height, int Format, const void *pData);
|
||||
|
||||
// simple uncompressed RGBA loaders
|
||||
virtual int LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags);
|
||||
virtual int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType);
|
||||
|
||||
void ScreenshotDirect(const char *pFilename);
|
||||
|
||||
virtual void TextureSet(int TextureID);
|
||||
|
||||
virtual void Clear(float r, float g, float b);
|
||||
|
||||
virtual void QuadsBegin();
|
||||
virtual void QuadsEnd();
|
||||
virtual void QuadsSetRotation(float Angle);
|
||||
|
||||
virtual void SetColorVertex(const CColorVertex *pArray, int Num);
|
||||
virtual void SetColor(float r, float g, float b, float a);
|
||||
|
||||
virtual void QuadsSetSubset(float TlU, float TlV, float BrU, float BrV);
|
||||
virtual void QuadsSetSubsetFree(
|
||||
float x0, float y0, float x1, float y1,
|
||||
float x2, float y2, float x3, float y3);
|
||||
|
||||
virtual void QuadsDraw(CQuadItem *pArray, int Num);
|
||||
virtual void QuadsDrawTL(const CQuadItem *pArray, int Num);
|
||||
virtual void QuadsDrawFreeform(const CFreeformItem *pArray, int Num);
|
||||
virtual void QuadsText(float x, float y, float Size, const char *pText);
|
||||
|
||||
virtual int Init();
|
||||
};
|
||||
|
||||
class CGraphics_SDL : public CGraphics_OpenGL
|
||||
{
|
||||
SDL_Surface *m_pScreenSurface;
|
||||
|
||||
int TryInit();
|
||||
int InitWindow();
|
||||
public:
|
||||
CGraphics_SDL();
|
||||
|
||||
virtual int Init();
|
||||
virtual void Shutdown();
|
||||
|
||||
virtual void Minimize();
|
||||
virtual void Maximize();
|
||||
|
||||
virtual int WindowActive();
|
||||
virtual int WindowOpen();
|
||||
|
||||
virtual void TakeScreenshot(const char *pFilename);
|
||||
virtual void TakeCustomScreenshot(const char *pFilename);
|
||||
virtual void Swap();
|
||||
|
||||
virtual int GetVideoModes(CVideoMode *pModes, int MaxModes);
|
||||
|
||||
// syncronization
|
||||
virtual void InsertSignal(semaphore *pSemaphore);
|
||||
virtual bool IsIdle();
|
||||
virtual void WaitForIdle();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -74,9 +74,6 @@ MACRO_CONFIG_INT(GfxTextureQuality, gfx_texture_quality, 1, 0, 1, CFGFLAG_SAVE|C
|
|||
MACRO_CONFIG_INT(GfxFsaaSamples, gfx_fsaa_samples, 0, 0, 16, CFGFLAG_SAVE|CFGFLAG_CLIENT, "FSAA Samples")
|
||||
MACRO_CONFIG_INT(GfxRefreshRate, gfx_refresh_rate, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen refresh rate")
|
||||
MACRO_CONFIG_INT(GfxFinish, gfx_finish, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
|
||||
MACRO_CONFIG_INT(GfxAsyncRender, gfx_asyncrender, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Do rendering async from the the update")
|
||||
|
||||
MACRO_CONFIG_INT(GfxThreaded, gfx_threaded, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use the threaded graphics backend")
|
||||
|
||||
MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity")
|
||||
|
||||
|
|
|
@ -628,7 +628,6 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
static int s_GfxFsaaSamples = g_Config.m_GfxFsaaSamples;
|
||||
static int s_GfxTextureQuality = g_Config.m_GfxTextureQuality;
|
||||
static int s_GfxTextureCompression = g_Config.m_GfxTextureCompression;
|
||||
static int s_GfxThreaded = g_Config.m_GfxThreaded;
|
||||
|
||||
CUIRect ModeList;
|
||||
MainView.VSplitLeft(300.0f, &MainView, &ModeList);
|
||||
|
@ -710,24 +709,6 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
CheckSettings = true;
|
||||
}
|
||||
|
||||
MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
if(DoButton_CheckBox(&g_Config.m_GfxThreaded, Localize("Threaded rendering"), g_Config.m_GfxThreaded, &Button))
|
||||
{
|
||||
g_Config.m_GfxThreaded ^= 1;
|
||||
CheckSettings = true;
|
||||
}
|
||||
|
||||
MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
if(g_Config.m_GfxThreaded)
|
||||
{
|
||||
Button.VSplitLeft(20.0f, 0, &Button);
|
||||
if(DoButton_CheckBox(&g_Config.m_GfxAsyncRender, Localize("Handle rendering async from updates"), g_Config.m_GfxAsyncRender, &Button))
|
||||
{
|
||||
g_Config.m_GfxAsyncRender ^= 1;
|
||||
CheckSettings = true;
|
||||
}
|
||||
}
|
||||
|
||||
MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
if(DoButton_CheckBox(&g_Config.m_GfxTextureQuality, Localize("Quality Textures"), g_Config.m_GfxTextureQuality, &Button))
|
||||
{
|
||||
|
@ -757,8 +738,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
s_GfxVsync == g_Config.m_GfxVsync &&
|
||||
s_GfxFsaaSamples == g_Config.m_GfxFsaaSamples &&
|
||||
s_GfxTextureQuality == g_Config.m_GfxTextureQuality &&
|
||||
s_GfxTextureCompression == g_Config.m_GfxTextureCompression &&
|
||||
s_GfxThreaded == g_Config.m_GfxThreaded)
|
||||
s_GfxTextureCompression == g_Config.m_GfxTextureCompression)
|
||||
m_NeedRestartGraphics = false;
|
||||
else
|
||||
m_NeedRestartGraphics = true;
|
||||
|
|
Loading…
Reference in a new issue