CElementGenShaders: Make use of static inline variables

Same behavior, less code
This commit is contained in:
Lioncash 2020-08-02 02:57:00 -04:00
parent 4e1ff26f56
commit 83c2023bbb
2 changed files with 24 additions and 52 deletions

View File

@ -8,34 +8,6 @@
namespace urde {
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestNoZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestNoZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texAdditiveZTest;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texAdditiveNoZTest;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaZTest;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaNoZTest;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texZTestNoZWriteSub;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texNoZTestNoZWriteSub;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaZTestSub;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_texRedToAlphaNoZTestSub;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexNoZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_indTexAdditive;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexNoZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_cindTexAdditive;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexZTestZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexNoZTestZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexZTestNoZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexNoZTestNoZWrite;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexAdditiveZTest;
std::array<boo::ObjToken<boo::IShaderPipeline>, 2> CElementGenShaders::m_noTexAdditiveNoZTest;
void CElementGenShaders::Initialize() {
m_texZTestZWrite = {hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{}),
hecl::conv->convert(Shader_CElementGenShaderTexZTestZWrite{})};

View File

@ -12,33 +12,33 @@ public:
enum class EShaderClass { Tex, IndTex, NoTex };
private:
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZTest;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveNoZTest;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTest;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTest;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWriteSub;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWriteSub;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTestSub;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTestSub;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveZTest;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texAdditiveNoZTest;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTest;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTest;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texZTestNoZWriteSub;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texNoZTestNoZWriteSub;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaZTestSub;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_texRedToAlphaNoZTestSub;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexNoZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexAdditive;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexNoZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_indTexAdditive;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexNoZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexAdditive;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexNoZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_cindTexAdditive;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestNoZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestNoZWrite;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveZTest;
static std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveNoZTest;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexZTestNoZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexNoZTestNoZWrite;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveZTest;
static inline std::array<boo::ObjToken<boo::IShaderPipeline>, 2> m_noTexAdditiveNoZTest;
public:
static void Initialize();