summaryrefslogtreecommitdiff
path: root/Runtime/Graphics/Shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Graphics/Shader.cpp')
-rw-r--r--Runtime/Graphics/Shader.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Runtime/Graphics/Shader.cpp b/Runtime/Graphics/Shader.cpp
index ca5a572..4b4c9e0 100644
--- a/Runtime/Graphics/Shader.cpp
+++ b/Runtime/Graphics/Shader.cpp
@@ -51,14 +51,13 @@ Shader::Shader(LuaBind::VM*vm, std::string& glslShader)
// stl的string会在大小超过阈值的情况下在栈里分配,并用RAII保证释放
std::string vsh ;
std::string fsh ;
- RenderCommandGroup cmd;
try
{
- GLSLCompiler::Compile(glslShader, vsh, fsh, cmd);
+ GLSLCompiler::Compile(glslShader, vsh, fsh, m_Commands);
}
catch (GLSLCompileException& e)
{
- ReleaseRenderCommandGroup(cmd);
+ ReleaseRenderCommandGroup(m_Commands);
throw ShaderCompileExecption(e.what());
}
CompileProgram(vsh.c_str(), fsh.c_str());
@@ -151,4 +150,12 @@ void Shader::ReCompileFrag(std::string frag)
bool Shader::IsValid()
{
return m_ProgramID != 0;
+}
+
+void Shader::ExecuteCommand()
+{
+ for (int i = 0; i < m_Commands.size(); ++i)
+ {
+ m_Commands[i]->Execute();
+ }
} \ No newline at end of file