From 83c2023bbb17506d983fa0a032514a1208a934e5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 2 Aug 2020 02:57:00 -0400 Subject: [PATCH] CElementGenShaders: Make use of static inline variables Same behavior, less code --- .../Graphics/Shaders/CElementGenShaders.cpp | 28 ----------- .../Graphics/Shaders/CElementGenShaders.hpp | 48 +++++++++---------- 2 files changed, 24 insertions(+), 52 deletions(-) diff --git a/Runtime/Graphics/Shaders/CElementGenShaders.cpp b/Runtime/Graphics/Shaders/CElementGenShaders.cpp index 155b6fc10..56b86e3a1 100644 --- a/Runtime/Graphics/Shaders/CElementGenShaders.cpp +++ b/Runtime/Graphics/Shaders/CElementGenShaders.cpp @@ -8,34 +8,6 @@ namespace urde { -std::array, 2> CElementGenShaders::m_texZTestZWrite; -std::array, 2> CElementGenShaders::m_texNoZTestZWrite; -std::array, 2> CElementGenShaders::m_texZTestNoZWrite; -std::array, 2> CElementGenShaders::m_texNoZTestNoZWrite; -std::array, 2> CElementGenShaders::m_texAdditiveZTest; -std::array, 2> CElementGenShaders::m_texAdditiveNoZTest; -std::array, 2> CElementGenShaders::m_texRedToAlphaZTest; -std::array, 2> CElementGenShaders::m_texRedToAlphaNoZTest; -std::array, 2> CElementGenShaders::m_texZTestNoZWriteSub; -std::array, 2> CElementGenShaders::m_texNoZTestNoZWriteSub; -std::array, 2> CElementGenShaders::m_texRedToAlphaZTestSub; -std::array, 2> CElementGenShaders::m_texRedToAlphaNoZTestSub; - -std::array, 2> CElementGenShaders::m_indTexZWrite; -std::array, 2> CElementGenShaders::m_indTexNoZWrite; -std::array, 2> CElementGenShaders::m_indTexAdditive; - -std::array, 2> CElementGenShaders::m_cindTexZWrite; -std::array, 2> CElementGenShaders::m_cindTexNoZWrite; -std::array, 2> CElementGenShaders::m_cindTexAdditive; - -std::array, 2> CElementGenShaders::m_noTexZTestZWrite; -std::array, 2> CElementGenShaders::m_noTexNoZTestZWrite; -std::array, 2> CElementGenShaders::m_noTexZTestNoZWrite; -std::array, 2> CElementGenShaders::m_noTexNoZTestNoZWrite; -std::array, 2> CElementGenShaders::m_noTexAdditiveZTest; -std::array, 2> CElementGenShaders::m_noTexAdditiveNoZTest; - void CElementGenShaders::Initialize() { m_texZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{}), hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{})}; diff --git a/Runtime/Graphics/Shaders/CElementGenShaders.hpp b/Runtime/Graphics/Shaders/CElementGenShaders.hpp index 2de77b26c..de08120b0 100644 --- a/Runtime/Graphics/Shaders/CElementGenShaders.hpp +++ b/Runtime/Graphics/Shaders/CElementGenShaders.hpp @@ -12,33 +12,33 @@ public: enum class EShaderClass { Tex, IndTex, NoTex }; private: - static std::array, 2> m_texZTestZWrite; - static std::array, 2> m_texNoZTestZWrite; - static std::array, 2> m_texZTestNoZWrite; - static std::array, 2> m_texNoZTestNoZWrite; - static std::array, 2> m_texAdditiveZTest; - static std::array, 2> m_texAdditiveNoZTest; - static std::array, 2> m_texRedToAlphaZTest; - static std::array, 2> m_texRedToAlphaNoZTest; - static std::array, 2> m_texZTestNoZWriteSub; - static std::array, 2> m_texNoZTestNoZWriteSub; - static std::array, 2> m_texRedToAlphaZTestSub; - static std::array, 2> m_texRedToAlphaNoZTestSub; + static inline std::array, 2> m_texZTestZWrite; + static inline std::array, 2> m_texNoZTestZWrite; + static inline std::array, 2> m_texZTestNoZWrite; + static inline std::array, 2> m_texNoZTestNoZWrite; + static inline std::array, 2> m_texAdditiveZTest; + static inline std::array, 2> m_texAdditiveNoZTest; + static inline std::array, 2> m_texRedToAlphaZTest; + static inline std::array, 2> m_texRedToAlphaNoZTest; + static inline std::array, 2> m_texZTestNoZWriteSub; + static inline std::array, 2> m_texNoZTestNoZWriteSub; + static inline std::array, 2> m_texRedToAlphaZTestSub; + static inline std::array, 2> m_texRedToAlphaNoZTestSub; - static std::array, 2> m_indTexZWrite; - static std::array, 2> m_indTexNoZWrite; - static std::array, 2> m_indTexAdditive; + static inline std::array, 2> m_indTexZWrite; + static inline std::array, 2> m_indTexNoZWrite; + static inline std::array, 2> m_indTexAdditive; - static std::array, 2> m_cindTexZWrite; - static std::array, 2> m_cindTexNoZWrite; - static std::array, 2> m_cindTexAdditive; + static inline std::array, 2> m_cindTexZWrite; + static inline std::array, 2> m_cindTexNoZWrite; + static inline std::array, 2> m_cindTexAdditive; - static std::array, 2> m_noTexZTestZWrite; - static std::array, 2> m_noTexNoZTestZWrite; - static std::array, 2> m_noTexZTestNoZWrite; - static std::array, 2> m_noTexNoZTestNoZWrite; - static std::array, 2> m_noTexAdditiveZTest; - static std::array, 2> m_noTexAdditiveNoZTest; + static inline std::array, 2> m_noTexZTestZWrite; + static inline std::array, 2> m_noTexNoZTestZWrite; + static inline std::array, 2> m_noTexZTestNoZWrite; + static inline std::array, 2> m_noTexNoZTestNoZWrite; + static inline std::array, 2> m_noTexAdditiveZTest; + static inline std::array, 2> m_noTexAdditiveNoZTest; public: static void Initialize();