From 60cbbdec07ab7a5636eac5b3c024ae44e937f4d4 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 13 Dec 2021 00:07:19 +0800 Subject: +init --- Client/Source/Graphics/ShaderCompiler.h | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Client/Source/Graphics/ShaderCompiler.h (limited to 'Client/Source/Graphics/ShaderCompiler.h') 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 +#include +#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); + +}; -- cgit v1.1-26-g67d0