diff options
Diffstat (limited to 'Runtime/Graphics')
-rw-r--r-- | Runtime/Graphics/RenderCommands.cpp | 9 | ||||
-rw-r--r-- | Runtime/Graphics/RenderCommands.h | 1 | ||||
-rw-r--r-- | Runtime/Graphics/Shader.cpp | 1 | ||||
-rw-r--r-- | Runtime/Graphics/ShaderCompiler.cpp | 4 |
4 files changed, 13 insertions, 2 deletions
diff --git a/Runtime/Graphics/RenderCommands.cpp b/Runtime/Graphics/RenderCommands.cpp new file mode 100644 index 0000000..336bf20 --- /dev/null +++ b/Runtime/Graphics/RenderCommands.cpp @@ -0,0 +1,9 @@ +#include "RenderCommands.h" + +void ReleaseRenderCommandGroup(RenderCommandGroup& group) +{ + for (int i = 0; i < group.size(); ++i) + { + delete group[i]; + } +} diff --git a/Runtime/Graphics/RenderCommands.h b/Runtime/Graphics/RenderCommands.h index cbffdd0..8dc2dbe 100644 --- a/Runtime/Graphics/RenderCommands.h +++ b/Runtime/Graphics/RenderCommands.h @@ -8,6 +8,7 @@ struct RenderCommand }; typedef std::vector<RenderCommand*> RenderCommandGroup; +void ReleaseRenderCommandGroup(RenderCommandGroup& group); // Cull Off|Front|Back|Both struct Cmd_Cull : RenderCommand diff --git a/Runtime/Graphics/Shader.cpp b/Runtime/Graphics/Shader.cpp index 67bbe01..ca5a572 100644 --- a/Runtime/Graphics/Shader.cpp +++ b/Runtime/Graphics/Shader.cpp @@ -58,6 +58,7 @@ Shader::Shader(LuaBind::VM*vm, std::string& glslShader) } catch (GLSLCompileException& e) { + ReleaseRenderCommandGroup(cmd); throw ShaderCompileExecption(e.what()); } CompileProgram(vsh.c_str(), fsh.c_str()); diff --git a/Runtime/Graphics/ShaderCompiler.cpp b/Runtime/Graphics/ShaderCompiler.cpp index 06ad7b0..637fd59 100644 --- a/Runtime/Graphics/ShaderCompiler.cpp +++ b/Runtime/Graphics/ShaderCompiler.cpp @@ -314,7 +314,7 @@ void GLSLCompiler::GetParams(const char* cmdName, std::string& params, std::stri s_CompileError = string("Compile Shader Error: Invalid parameter count of ") + cmdName +" : " + params;
throw GLSLCompileException(s_CompileError.c_str());
}
- if(!IsSeperator(params[i]))
+ if(!IsSeperator(params[j]))
out[index++] = params.substr(i, j - i + 1);
else
out[index++] = params.substr(i, j - i);
@@ -332,4 +332,4 @@ void GLSLCompiler::GetParams(const char* cmdName, std::string& params, std::stri }
i = j;
}
-}
\ No newline at end of file +}
|