1 // 2 // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // BufferGL.h: Defines the class interface for BufferGL. 8 9 #ifndef LIBANGLE_RENDERER_GL_BUFFERGL_H_ 10 #define LIBANGLE_RENDERER_GL_BUFFERGL_H_ 11 12 #include "common/MemoryBuffer.h" 13 #include "libANGLE/renderer/BufferImpl.h" 14 15 namespace rx 16 { 17 18 class FunctionsGL; 19 class StateManagerGL; 20 21 class BufferGL : public BufferImpl 22 { 23 public: 24 BufferGL(const gl::BufferState &state, GLuint buffer); 25 ~BufferGL() override; 26 27 void destroy(const gl::Context *context) override; 28 29 angle::Result setData(const gl::Context *context, 30 gl::BufferBinding target, 31 const void *data, 32 size_t size, 33 gl::BufferUsage usage) override; 34 angle::Result setSubData(const gl::Context *context, 35 gl::BufferBinding target, 36 const void *data, 37 size_t size, 38 size_t offset) override; 39 angle::Result copySubData(const gl::Context *context, 40 BufferImpl *source, 41 GLintptr sourceOffset, 42 GLintptr destOffset, 43 GLsizeiptr size) override; 44 angle::Result map(const gl::Context *context, GLenum access, void **mapPtr) override; 45 angle::Result mapRange(const gl::Context *context, 46 size_t offset, 47 size_t length, 48 GLbitfield access, 49 void **mapPtr) override; 50 angle::Result unmap(const gl::Context *context, GLboolean *result) override; 51 52 angle::Result getIndexRange(const gl::Context *context, 53 gl::DrawElementsType type, 54 size_t offset, 55 size_t count, 56 bool primitiveRestartEnabled, 57 gl::IndexRange *outRange) override; 58 59 size_t getBufferSize() const; 60 GLuint getBufferID() const; 61 62 private: 63 bool mIsMapped; 64 size_t mMapOffset; 65 size_t mMapSize; 66 67 angle::MemoryBuffer mShadowCopy; 68 69 size_t mBufferSize; 70 71 GLuint mBufferID; 72 }; 73 74 } // namespace rx 75 76 #endif // LIBANGLE_RENDERER_GL_BUFFERGL_H_ 77