diff options
author | chai <chaifix@163.com> | 2021-11-01 09:50:03 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-01 09:50:03 +0800 |
commit | 8078aeed4e62c6b3aa48102554044768b402570c (patch) | |
tree | 45928c5b35df5dd3f952ccb789c84b7986743b26 /Runtime | |
parent | 20577019253d0b2938fbf0057eed0bda72556e82 (diff) |
*misc
Diffstat (limited to 'Runtime')
-rw-r--r-- | Runtime/Graphics/CustomVertexLayout.h | 5 | ||||
-rw-r--r-- | Runtime/Graphics/Shader.cpp | 2 | ||||
-rw-r--r-- | Runtime/Graphics/ShaderCompiler.cpp | 3 | ||||
-rw-r--r-- | Runtime/Rendering/UIQuad.cpp | 2 | ||||
-rw-r--r-- | Runtime/Utilities/StaticInitiator.h | 5 |
5 files changed, 12 insertions, 5 deletions
diff --git a/Runtime/Graphics/CustomVertexLayout.h b/Runtime/Graphics/CustomVertexLayout.h index cd68a27..8f9dda8 100644 --- a/Runtime/Graphics/CustomVertexLayout.h +++ b/Runtime/Graphics/CustomVertexLayout.h @@ -12,6 +12,11 @@ struct CustomVertexLayout GLuint buffer; // 创建时留空 std::vector<VertexAttributeDescriptor> attributes; + CustomVertexLayout() + { + int n = buffer; + } + // 重置pointer(startOffset)为0 void RestorePointer() { diff --git a/Runtime/Graphics/Shader.cpp b/Runtime/Graphics/Shader.cpp index 4b4c9e0..60e165f 100644 --- a/Runtime/Graphics/Shader.cpp +++ b/Runtime/Graphics/Shader.cpp @@ -75,7 +75,7 @@ void Shader::CompileProgram(const char* vert, const char* frag, bool keepSrc) const char* fragCode = frag; // vertex shader m_VertID = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(m_VertID, 1, &vertCode, NULL); + glShaderSource(m_VertID, 1, &vertCode, NULL);//为了支持中文注释,长度传NULL glCompileShader(m_VertID); checkCompileshaderErrorors(m_VertID, "VERTEX"); // fragment Shader diff --git a/Runtime/Graphics/ShaderCompiler.cpp b/Runtime/Graphics/ShaderCompiler.cpp index a3dcf50..20b19f5 100644 --- a/Runtime/Graphics/ShaderCompiler.cpp +++ b/Runtime/Graphics/ShaderCompiler.cpp @@ -31,8 +31,7 @@ if(pos == string::npos || !IsLabelActive(src, label)) {\ CheckLabel(VSH_END);
CheckLabel(FSH_BEGIN);
CheckLabel(FSH_END);
-
-
+
vsh = GetContent(src, VSH_BEGIN, VSH_END);
fsh = GetContent(src, FSH_BEGIN, FSH_END);
diff --git a/Runtime/Rendering/UIQuad.cpp b/Runtime/Rendering/UIQuad.cpp index 35dcf7e..089d0e1 100644 --- a/Runtime/Rendering/UIQuad.cpp +++ b/Runtime/Rendering/UIQuad.cpp @@ -10,7 +10,7 @@ struct UIQuadLayout static CustomVertexLayout layout; -InitializeStaticVariables([](){ +InitializeStaticVariables([]() { VertexAttributeDescriptor POSITION = VertexAttributeDescriptor(0, 2, VertexAttrFormat_Float, sizeof(UIQuadLayout)); VertexAttributeDescriptor UV = VertexAttributeDescriptor(sizeof(Internal::Vector2), 2, VertexAttrFormat_Float, sizeof(UIQuadLayout)); diff --git a/Runtime/Utilities/StaticInitiator.h b/Runtime/Utilities/StaticInitiator.h index bbcdbee..b7b41aa 100644 --- a/Runtime/Utilities/StaticInitiator.h +++ b/Runtime/Utilities/StaticInitiator.h @@ -1,5 +1,8 @@ #pragma once +//https://stackoverflow.com/questions/1005685/c-static-initialization-order +//https://stackoverflow.com/questions/211237/static-variables-initialisation-order + // 静态构造函数 #include "ThirdParty/StaticConstructor/include/StaticConstructor.h" @@ -21,7 +24,7 @@ public: #define InvokeStaticFunc(func)\ static StaticFuncInvoker staticInvokerOf_##func(func); -// 用来初始化当前cpp里的静态变量 +// 用来初始化当前cpp里的静态变量,需要注意static变量初始化顺序(Static Initialization Order) #define InitializeStaticVariables(lambda)\ static StaticFuncInvoker staticInvoker(lambda); |