diff options
author | chai <chaifix@163.com> | 2021-12-13 00:07:19 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-12-13 00:07:19 +0800 |
commit | 60cbbdec07ab7a5636eac5b3c024ae44e937f4d4 (patch) | |
tree | b2c7b0a868f18159dbc43d8954e1bd7668549a88 /Client/Source/Graphics/ShaderCompiler.h |
+init
Diffstat (limited to 'Client/Source/Graphics/ShaderCompiler.h')
-rw-r--r-- | Client/Source/Graphics/ShaderCompiler.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Client/Source/Graphics/ShaderCompiler.h b/Client/Source/Graphics/ShaderCompiler.h new file mode 100644 index 0000000..f374567 --- /dev/null +++ b/Client/Source/Graphics/ShaderCompiler.h @@ -0,0 +1,55 @@ +#pragma once + +#include <exception> +#include <string> +#include "../Threading/Mutex.h" +#include "../Threading/Job.h" +#include "../Graphics/RenderCommands.h" + +// ±ąŅėGLSL(GameLab Shader) + +// in: .glsl path +// out: vsh & fsh +class CompileGLSLJob : public Job +{ + +}; + +// in: glsl shader +// out: vsh & fsh +class CompileGLSLShaderJob : public Job +{ + +}; + +class GLSLCompileException : public std::exception +{ +public: + GLSLCompileException(const char* what) + : std::exception(what) + { + } + +}; + +class GLSLCompiler +{ +public: + static void Compile(std::string& src, std::string& vsh, std::string& fsh, RenderCommandGroup& cmd)/*throw GLSLCompileException*/; + +private: + static std::string GetContent(std::string& src, const char* from, const char* to); + static std::string TrimContent(std::string& src, const char* from, const char* to); + static bool IsLabelActive(std::string& src, const char* label); + + static void ParseCmd(std::string& cmd, RenderCommandGroup& group); + static bool IsCommandActive(std::string& src, const char* label); + static bool FindCmdPos(std::string& line, int* start, int* end); + static bool IsLineCommentd(std::string& line); + static void CommandCull(std::string& params, RenderCommandGroup& group); + static void CommandBlend(std::string& params, RenderCommandGroup& group); + static void CommandDepthTest(std::string& params, RenderCommandGroup& group); + static void CommandDepthWrite(std::string& params, RenderCommandGroup& group); + static void GetParams(const char* cmdName, std::string& params, std::string* out, int n); + +}; |