diff options
Diffstat (limited to 'Runtime/Graphics')
-rw-r--r-- | Runtime/Graphics/SharedVertexBuffer.h | 8 | ||||
-rw-r--r-- | Runtime/Graphics/VertexBuffer.h | 7 |
2 files changed, 8 insertions, 7 deletions
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<byte> m_CurVBData; std::vector<uint16> 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 |