From d162d7711177c414e5ea9a3876dc6fa3414c937e Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 28 Oct 2021 09:50:44 +0800 Subject: *misc --- Data/Resources/Shaders/Editor_UI.glsl | 27 +++++++++++++++++++++++++++ Data/Resources/Shaders/UI.glsl | 11 ----------- "Documents/\346\236\266\346\236\204.xlsx" | Bin 6625 -> 117504 bytes Runtime/Graphics/SharedVertexBuffer.h | 8 ++++---- Runtime/Graphics/VertexBuffer.h | 7 ++++--- 5 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 Data/Resources/Shaders/Editor_UI.glsl delete mode 100644 Data/Resources/Shaders/UI.glsl diff --git a/Data/Resources/Shaders/Editor_UI.glsl b/Data/Resources/Shaders/Editor_UI.glsl new file mode 100644 index 0000000..e4b6790 --- /dev/null +++ b/Data/Resources/Shaders/Editor_UI.glsl @@ -0,0 +1,27 @@ + +uniform float2 screenSize; + + +VERTEX_SHADER_BEGIN + +in vec2 position; +int vec2 uv; + +out vec4 clipPos; + +void main() +{ + +} + +VERTEX_SHADER_END + +FRAGMENT_SHADER_BEGIN +out vec4 outColor; + +void main() +{ + outColor = vec4(1,1,1,1); +} + +FRAGMENT_SHADER_END diff --git a/Data/Resources/Shaders/UI.glsl b/Data/Resources/Shaders/UI.glsl deleted file mode 100644 index c4b1f92..0000000 --- a/Data/Resources/Shaders/UI.glsl +++ /dev/null @@ -1,11 +0,0 @@ -VERTEX_SHADER_BEGIN - - -VERTEX_SHADER_END - - -FRAGMENT_SHADER_BEGIN - - - -FRAGMENT_SHADER_END \ No newline at end of file diff --git "a/Documents/\346\236\266\346\236\204.xlsx" "b/Documents/\346\236\266\346\236\204.xlsx" index 15e2235..eea1ffa 100644 Binary files "a/Documents/\346\236\266\346\236\204.xlsx" and "b/Documents/\346\236\266\346\236\204.xlsx" differ diff --git a/Runtime/Graphics/SharedVertexBuffer.h b/Runtime/Graphics/SharedVertexBuffer.h index 001eb2c..cc89752 100644 --- a/Runtime/Graphics/SharedVertexBuffer.h +++ b/Runtime/Graphics/SharedVertexBuffer.h @@ -18,13 +18,15 @@ public: // default layout void GetChunk(uint attrs, int maxVerts, int maxIndices, EPrimitive primitive, void **out_vb, void **out_ib); - void ReleaseChunk(int actualVerts, int actualIndices); void DrawChunk(); // custom layout void GetChunk(uint sizePerVert, uint sizePerIndex, int maxVerts, int maxIndices, EPrimitive primitive, void **out_vb, void **out_ib); void DrawChunk(CustomVertexLayout& layout); + // common + void ReleaseChunk(int actualVerts, int actualIndices); + private: void FillCustomVertexLayout(CustomVertexLayout& dst); @@ -32,14 +34,12 @@ private: void Clean(); - // if vertex databuffer size beyond this value, use pinned memory mapping, instead of glBufferData. + // 如果数据大小超过这个限制,用内存数据,而不是glBufferData enum { DataBufferThreshold = 1024 }; - // shared vbo and ibo GPU::DataBuffer *m_CurVB; GPU::DataBuffer *m_CurIB; - // restore vbo and ibo data if not using pinned memory mapping std::vector m_CurVBData; std::vector m_CurIBData; diff --git a/Runtime/Graphics/VertexBuffer.h b/Runtime/Graphics/VertexBuffer.h index 382ca39..5e4fdf2 100644 --- a/Runtime/Graphics/VertexBuffer.h +++ b/Runtime/Graphics/VertexBuffer.h @@ -12,6 +12,8 @@ #include "CustomVertexLayout.h" #include "Primitive.h" +// 实际使用过程中,通常是一个VBO和一个IBO一起,submesh对应的是IBO中的不同的段,而不是不同的IBO + class VertexBuffer { public: @@ -29,9 +31,8 @@ public: private: VertexBufferType m_Type; - GPU::DataBuffer *m_VB; - GPU::DataBuffer *m_IB;// vertex buffer and index buffer - + GPU::DataBuffer* m_VB; + GPU::DataBuffer* m_IB; }; #endif \ No newline at end of file -- cgit v1.1-26-g67d0