diff options
author | chai <chaifix@163.com> | 2021-10-31 19:47:57 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-31 19:47:57 +0800 |
commit | e5ffcfb43231c55c1cdd71566e622de7583160a9 (patch) | |
tree | c8cf84cf3eb6ca805054bd6f6466fd772eb44515 | |
parent | b972cec461f6c587edd8febbc6dad45bad65046d (diff) |
* glsl compiler
-rw-r--r-- | Data/Resources/Shaders/Editor-Text.glsl | 2 | ||||
-rw-r--r-- | Projects/VisualStudio/Editor/Editor.vcxproj | 1 | ||||
-rw-r--r-- | Projects/VisualStudio/Editor/Editor.vcxproj.filters | 3 | ||||
-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 |
7 files changed, 18 insertions, 3 deletions
diff --git a/Data/Resources/Shaders/Editor-Text.glsl b/Data/Resources/Shaders/Editor-Text.glsl index 1624c0e..f589e07 100644 --- a/Data/Resources/Shaders/Editor-Text.glsl +++ b/Data/Resources/Shaders/Editor-Text.glsl @@ -2,8 +2,8 @@ CMD_BEGIN +Cull Both Blend SrcAlpha OneMinusSrcAlpha -Cull Both DepthTest Off CMD_END diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj b/Projects/VisualStudio/Editor/Editor.vcxproj index e6c8aee..3dda150 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj +++ b/Projects/VisualStudio/Editor/Editor.vcxproj @@ -191,6 +191,7 @@ <ClCompile Include="..\..\..\Runtime\Graphics\OpenGL.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\Point.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\PolyLine.cpp" />
+ <ClCompile Include="..\..\..\Runtime\Graphics\RenderCommands.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\RenderTexture.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\Shader.cpp" />
<ClCompile Include="..\..\..\Runtime\Graphics\ShaderCompiler.cpp" />
diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj.filters b/Projects/VisualStudio/Editor/Editor.vcxproj.filters index 78f759a..32f64ac 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj.filters +++ b/Projects/VisualStudio/Editor/Editor.vcxproj.filters @@ -390,6 +390,9 @@ <ClCompile Include="..\..\..\Runtime\Rendering\UIQuad.cpp">
<Filter>Runtime\Rendering</Filter>
</ClCompile>
+ <ClCompile Include="..\..\..\Runtime\Graphics\RenderCommands.cpp">
+ <Filter>Runtime\Graphics</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\Editor\GUI\Dock.h">
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 +}
|