From ff6dcfea82974df6db5a557e31aaddb6bdb7a71f Mon Sep 17 00:00:00 2001 From: x2048 Date: Tue, 6 Sep 2022 08:25:18 +0200 Subject: Implement rendering pipeline and post-processing (#12465) Co-authored-by: Lars Mueller Co-authored-by: sfan5 Co-authored-by: lhofhansl --- src/client/shader.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/client/shader.h') diff --git a/src/client/shader.h b/src/client/shader.h index 49a563115..8f1ba1e41 100644 --- a/src/client/shader.h +++ b/src/client/shader.h @@ -80,7 +80,7 @@ public: }; -template +template class CachedShaderSetting { const char *m_name; T m_sent[count]; @@ -93,30 +93,32 @@ protected: public: void set(const T value[count], video::IMaterialRendererServices *services) { - if (has_been_set && std::equal(m_sent, m_sent + count, value)) + if (cache && has_been_set && std::equal(m_sent, m_sent + count, value)) return; if (is_pixel) services->setPixelShaderConstant(services->getPixelShaderConstantID(m_name), value, count); else services->setVertexShaderConstant(services->getVertexShaderConstantID(m_name), value, count); - std::copy(value, value + count, m_sent); - has_been_set = true; + if (cache) { + std::copy(value, value + count, m_sent); + has_been_set = true; + } } }; -template -class CachedPixelShaderSetting : public CachedShaderSetting { +template +class CachedPixelShaderSetting : public CachedShaderSetting { public: CachedPixelShaderSetting(const char *name) : - CachedShaderSetting(name, true){} + CachedShaderSetting(name, true){} }; -template -class CachedVertexShaderSetting : public CachedShaderSetting { +template +class CachedVertexShaderSetting : public CachedShaderSetting { public: CachedVertexShaderSetting(const char *name) : - CachedShaderSetting(name, false){} + CachedShaderSetting(name, false){} }; -- cgit v1.2.3