mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Fix slightly expensive GetSystemShaderDefines()
Only recompute when any relevant parameters have changed, then return the cached value. This was SVN commit r13903.
This commit is contained in:
@@ -534,7 +534,7 @@ void CRenderer::EnumCaps()
|
||||
#endif
|
||||
}
|
||||
|
||||
CShaderDefines CRenderer::GetSystemShaderDefines()
|
||||
CShaderDefines CRenderer::ComputeSystemShaderDefines()
|
||||
{
|
||||
CShaderDefines defines;
|
||||
|
||||
@@ -554,7 +554,9 @@ void CRenderer::ReloadShaders()
|
||||
{
|
||||
ENSURE(m->IsOpen);
|
||||
|
||||
m->globalContext = GetSystemShaderDefines();
|
||||
m_SystemShaderDefines = ComputeSystemShaderDefines();
|
||||
|
||||
m->globalContext = m_SystemShaderDefines;
|
||||
|
||||
if (m_Caps.m_Shadows && m_Options.m_Shadows)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "lib/res/handle.h"
|
||||
#include "ps/Singleton.h"
|
||||
|
||||
#include "graphics/ShaderDefines.h"
|
||||
#include "renderer/PostprocManager.h"
|
||||
#include "renderer/Scene.h"
|
||||
#include "renderer/TimeManager.h"
|
||||
@@ -41,7 +42,6 @@ class CMaterialManager;
|
||||
class CModel;
|
||||
class CParticleManager;
|
||||
class CPatch;
|
||||
class CShaderDefines;
|
||||
class CShaderManager;
|
||||
class CSimulation2;
|
||||
class CTextureManager;
|
||||
@@ -304,7 +304,7 @@ public:
|
||||
|
||||
CMaterialManager& GetMaterialManager();
|
||||
|
||||
CShaderDefines GetSystemShaderDefines();
|
||||
CShaderDefines GetSystemShaderDefines() { return m_SystemShaderDefines; }
|
||||
|
||||
CTimeManager& GetTimeManager();
|
||||
|
||||
@@ -374,6 +374,7 @@ protected:
|
||||
void SetObliqueFrustumClipping(const CVector4D& clipPlane);
|
||||
|
||||
void ReloadShaders();
|
||||
CShaderDefines ComputeSystemShaderDefines();
|
||||
|
||||
// hotloading
|
||||
static Status ReloadChangedFileCB(void* param, const VfsPath& path);
|
||||
@@ -390,6 +391,8 @@ protected:
|
||||
// current model rendering mode
|
||||
ERenderMode m_ModelRenderMode;
|
||||
|
||||
CShaderDefines m_SystemShaderDefines;
|
||||
|
||||
/**
|
||||
* m_ViewCamera: determines the eye position for rendering
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user