#pragma once #include "../Buffer.h" #import CC_BACKEND_BEGIN class BufferMTL : public Buffer { public: BufferMTL(id mtlDevice, unsigned int size, BufferType type, BufferUsage usage); ~BufferMTL(); virtual void updateData(void* data, unsigned int size) override; virtual void updateSubData(void* data, unsigned int offset, unsigned int size) override; id getMTLBuffer() const; void beginFrame(); private: void updateIndex(); id _mtlBuffer = nil; NSMutableArray* _dynamicDataBuffers = nil; int _currentFrameIndex = 0; bool _indexUpdated = false; }; CC_BACKEND_END