summaryrefslogtreecommitdiff
path: root/Runtime
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-03 19:14:51 +0800
committerchai <chaifix@163.com>2021-11-03 19:14:51 +0800
commitcc68bba3a4e1a78bc8b62a5902230a4ae5043ccb (patch)
tree7fdfac53e0a79699393537e671ccde6e7b482c0d /Runtime
parent08ddd44b634d4da78edd0964f539a310544c7883 (diff)
* rename .GLSL(gamelab shading language) to .GLS(gamelab shader)
Diffstat (limited to 'Runtime')
-rw-r--r--Runtime/Graphics/Shader.cpp4
-rw-r--r--Runtime/Graphics/ShaderCompiler.cpp46
-rw-r--r--Runtime/Graphics/ShaderCompiler.h14
3 files changed, 32 insertions, 32 deletions
diff --git a/Runtime/Graphics/Shader.cpp b/Runtime/Graphics/Shader.cpp
index 013b1ba..8df3624 100644
--- a/Runtime/Graphics/Shader.cpp
+++ b/Runtime/Graphics/Shader.cpp
@@ -53,9 +53,9 @@ Shader::Shader(LuaBind::VM*vm, std::string& glslShader)
std::string fsh ;
try
{
- GLSLCompiler::Compile(glslShader, vsh, fsh, m_Commands);
+ GLSCompiler::Compile(glslShader, vsh, fsh, m_Commands);
}
- catch (GLSLCompileException& e)
+ catch (GLSCompileException& e)
{
ReleaseRenderCommandGroup(m_Commands);
throw ShaderCompileExecption(e.what());
diff --git a/Runtime/Graphics/ShaderCompiler.cpp b/Runtime/Graphics/ShaderCompiler.cpp
index 20b19f5..ddd21a6 100644
--- a/Runtime/Graphics/ShaderCompiler.cpp
+++ b/Runtime/Graphics/ShaderCompiler.cpp
@@ -13,18 +13,18 @@ static const char* CMD_END = "CMD_END";
std::string s_CompileError = "";
-// GLSL分为四部分
+// GLS分为四部分
// * CMD_BEGIN 和 CMD_END 之间的命令
// * VERTEX_SHADER_BEGIN 和 VERTEX_SHADER_END之间的顶点着色器
// * FRAGMENT_SHADER_BEGIN 和 FRAGMENT_SHADER_END之间的片段着色器
// * 三者之外的公共部分
-void GLSLCompiler::Compile(std::string& src, std::string& vsh, std::string& fsh, RenderCommandGroup& group)/*throw GLSLCompileException*/
+void GLSCompiler::Compile(std::string& src, std::string& vsh, std::string& fsh, RenderCommandGroup& group)/*throw GLSCompileException*/
{
#define CheckLabel(label) {\
int pos = src.find(label);\
if(pos == string::npos || !IsLabelActive(src, label)) {\
s_CompileError = std::string("Compile Shader Error: No ") + #label + " label";\
- throw GLSLCompileException(s_CompileError.c_str());\
+ throw GLSCompileException(s_CompileError.c_str());\
}}
CheckLabel(VSH_BEGIN);
@@ -59,7 +59,7 @@ if(pos == string::npos || !IsLabelActive(src, label)) {\
fsh = common + fsh;
}
-std::string GLSLCompiler::GetContent(std::string& src, const char* from, const char* to)
+std::string GLSCompiler::GetContent(std::string& src, const char* from, const char* to)
{
int begin = src.find(from);
int end = src.find(to);
@@ -71,7 +71,7 @@ std::string GLSLCompiler::GetContent(std::string& src, const char* from, const c
return content;
}
-std::string GLSLCompiler::TrimContent(std::string& src, const char* from, const char* to)
+std::string GLSCompiler::TrimContent(std::string& src, const char* from, const char* to)
{
int begin = src.find(from);
int end = src.find(to);
@@ -79,7 +79,7 @@ std::string GLSLCompiler::TrimContent(std::string& src, const char* from, const
return result;
}
-bool GLSLCompiler::IsLabelActive(std::string& src, const char* label)
+bool GLSCompiler::IsLabelActive(std::string& src, const char* label)
{
int pos = src.find(label);
if (pos == string::npos)
@@ -98,7 +98,7 @@ bool GLSLCompiler::IsLabelActive(std::string& src, const char* label)
return true;
}
-bool GLSLCompiler::IsCommandActive(std::string& src, const char* label)
+bool GLSCompiler::IsCommandActive(std::string& src, const char* label)
{
int pos = src.find(label);
if (pos == string::npos)
@@ -117,7 +117,7 @@ bool GLSLCompiler::IsCommandActive(std::string& src, const char* label)
return true;
}
-void GLSLCompiler::ParseCmd(std::string& cmds, RenderCommandGroup& group)
+void GLSCompiler::ParseCmd(std::string& cmds, RenderCommandGroup& group)
{
istringstream ss = istringstream(cmds);
string line;
@@ -139,7 +139,7 @@ void GLSLCompiler::ParseCmd(std::string& cmds, RenderCommandGroup& group)
else
{
s_CompileError = string("Unknown command " + cmdName);
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
}
}
@@ -147,7 +147,7 @@ void GLSLCompiler::ParseCmd(std::string& cmds, RenderCommandGroup& group)
#define IsSeperator(c) (c == ' ' || c == '\r' || c == '\n' || c == /*tab*/9)
// 找到行内的第一个单词,作为命令名
-bool GLSLCompiler::FindCmdPos(std::string& line, int* start, int* end)
+bool GLSCompiler::FindCmdPos(std::string& line, int* start, int* end)
{
for (int i = 0; i < line.size(); ++i)
{
@@ -166,7 +166,7 @@ bool GLSLCompiler::FindCmdPos(std::string& line, int* start, int* end)
return false;
}
-bool GLSLCompiler::IsLineCommentd(std::string& line)
+bool GLSCompiler::IsLineCommentd(std::string& line)
{
for (int i = 0; i < line.size(); ++i)
{
@@ -185,7 +185,7 @@ bool GLSLCompiler::IsLineCommentd(std::string& line)
#define MAX_PARAM 2
-void GLSLCompiler::CommandCull(std::string& p, RenderCommandGroup& group)
+void GLSCompiler::CommandCull(std::string& p, RenderCommandGroup& group)
{
std::string params[1];
GetParams("Cull", p, params, 1);
@@ -200,12 +200,12 @@ void GLSLCompiler::CommandCull(std::string& p, RenderCommandGroup& group)
{
delete pCull;
s_CompileError = string("Compile Shader Error: Invalid parameter of Cull: " + params[0]);
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
group.push_back(pCull);
}
-void GLSLCompiler::CommandBlend(std::string& p, RenderCommandGroup& group)
+void GLSCompiler::CommandBlend(std::string& p, RenderCommandGroup& group)
{
std::string params[2];
GetParams("Blend", p, params, 2);
@@ -239,7 +239,7 @@ void GLSLCompiler::CommandBlend(std::string& p, RenderCommandGroup& group)
{
delete pblend;
s_CompileError = string("Compile Shader Error: Invalid parameter of Blend: " + params[0]);
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
if (params[1] == "Zero") blend.dstFac = Cmd_Blend::Blend_Zero;
@@ -260,13 +260,13 @@ void GLSLCompiler::CommandBlend(std::string& p, RenderCommandGroup& group)
{
delete pblend;
s_CompileError = string("Compile Shader Error: Invalid parameter of Blend: " + params[1]);
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
group.push_back(pblend);
}
-void GLSLCompiler::CommandDepthTest(std::string& p, RenderCommandGroup& group)
+void GLSCompiler::CommandDepthTest(std::string& p, RenderCommandGroup& group)
{
std::string params[1];
GetParams("DepthTest", p, params, 1);
@@ -286,12 +286,12 @@ void GLSLCompiler::CommandDepthTest(std::string& p, RenderCommandGroup& group)
{
delete pTest;
s_CompileError = string("Compile Shader Error: Invalid parameter of DepthTest: " + params[0]);
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
group.push_back(pTest);
}
-void GLSLCompiler::CommandDepthWrite(std::string& p, RenderCommandGroup& group)
+void GLSCompiler::CommandDepthWrite(std::string& p, RenderCommandGroup& group)
{
std::string params[1];
GetParams("DepthWrite", p, params, 1);
@@ -304,12 +304,12 @@ void GLSLCompiler::CommandDepthWrite(std::string& p, RenderCommandGroup& group)
{
delete pwrite;
s_CompileError = string("Compile Shader Error: Invalid parameter of DepthWrite: " + params[0]);
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
group.push_back(pwrite);
}
-void GLSLCompiler::GetParams(const char* cmdName, std::string& params, std::string* out, int n)
+void GLSCompiler::GetParams(const char* cmdName, std::string& params, std::string* out, int n)
{
int index = 0;
for (int i = 0; i < params.size(); ++i)
@@ -324,7 +324,7 @@ void GLSLCompiler::GetParams(const char* cmdName, std::string& params, std::stri
if (index >= n)
{
s_CompileError = string("Compile Shader Error: Invalid parameter count of ") + cmdName +" : " + params;
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
if(!IsSeperator(params[j]))
out[index++] = params.substr(i, j - i + 1);
@@ -337,7 +337,7 @@ void GLSLCompiler::GetParams(const char* cmdName, std::string& params, std::stri
if (index >= n)
{
s_CompileError = string("Compile Shader Error: Invalid parameter count of ") + cmdName + " : " + params;
- throw GLSLCompileException(s_CompileError.c_str());
+ throw GLSCompileException(s_CompileError.c_str());
}
out[index++] = params.substr(i, j - i);
break;
diff --git a/Runtime/Graphics/ShaderCompiler.h b/Runtime/Graphics/ShaderCompiler.h
index 891efb7..2d48bb0 100644
--- a/Runtime/Graphics/ShaderCompiler.h
+++ b/Runtime/Graphics/ShaderCompiler.h
@@ -6,36 +6,36 @@
#include "Runtime/Threading/Job.h"
#include "Runtime/Graphics/RenderCommands.h"
-// 编译GLSL(GameLab Shading Language)
+// 编译GLS(GameLab Shader)
// in: .glsl path
// out: vsh & fsh
-class CompileGLSLJob : public Job
+class CompileGLSJob : public Job
{
};
// in: glsl shader
// out: vsh & fsh
-class CompileGLSLShaderJob : public Job
+class CompileGLSShaderJob : public Job
{
};
-class GLSLCompileException : public std::exception
+class GLSCompileException : public std::exception
{
public:
- GLSLCompileException(const char* what)
+ GLSCompileException(const char* what)
: std::exception(what)
{
}
};
-class GLSLCompiler
+class GLSCompiler
{
public:
- static void Compile(std::string& src, std::string& vsh, std::string& fsh, RenderCommandGroup& cmd)/*throw GLSLCompileException*/;
+ static void Compile(std::string& src, std::string& vsh, std::string& fsh, RenderCommandGroup& cmd)/*throw GLSCompileException*/;
private:
static std::string GetContent(std::string& src, const char* from, const char* to);