Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | // Buffer.h: Defines the gl::Buffer class, representing storage of vertex and/or |
michael@0 | 8 | // index data. Implements GL buffer objects and related functionality. |
michael@0 | 9 | // [OpenGL ES 2.0.24] section 2.9 page 21. |
michael@0 | 10 | |
michael@0 | 11 | #ifndef LIBGLESV2_BUFFER_H_ |
michael@0 | 12 | #define LIBGLESV2_BUFFER_H_ |
michael@0 | 13 | |
michael@0 | 14 | #include "common/angleutils.h" |
michael@0 | 15 | #include "common/RefCountObject.h" |
michael@0 | 16 | #include "libGLESv2/renderer/IndexRangeCache.h" |
michael@0 | 17 | |
michael@0 | 18 | namespace rx |
michael@0 | 19 | { |
michael@0 | 20 | class Renderer; |
michael@0 | 21 | class BufferStorage; |
michael@0 | 22 | class StaticIndexBufferInterface; |
michael@0 | 23 | class StaticVertexBufferInterface; |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | namespace gl |
michael@0 | 27 | { |
michael@0 | 28 | |
michael@0 | 29 | class Buffer : public RefCountObject |
michael@0 | 30 | { |
michael@0 | 31 | public: |
michael@0 | 32 | Buffer(rx::Renderer *renderer, GLuint id); |
michael@0 | 33 | |
michael@0 | 34 | virtual ~Buffer(); |
michael@0 | 35 | |
michael@0 | 36 | void bufferData(const void *data, GLsizeiptr size, GLenum usage); |
michael@0 | 37 | void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset); |
michael@0 | 38 | |
michael@0 | 39 | GLenum usage() const; |
michael@0 | 40 | |
michael@0 | 41 | rx::BufferStorage *getStorage() const; |
michael@0 | 42 | unsigned int size(); |
michael@0 | 43 | |
michael@0 | 44 | rx::StaticVertexBufferInterface *getStaticVertexBuffer(); |
michael@0 | 45 | rx::StaticIndexBufferInterface *getStaticIndexBuffer(); |
michael@0 | 46 | void invalidateStaticData(); |
michael@0 | 47 | void promoteStaticUsage(int dataSize); |
michael@0 | 48 | |
michael@0 | 49 | rx::IndexRangeCache *getIndexRangeCache(); |
michael@0 | 50 | |
michael@0 | 51 | private: |
michael@0 | 52 | DISALLOW_COPY_AND_ASSIGN(Buffer); |
michael@0 | 53 | |
michael@0 | 54 | rx::Renderer *mRenderer; |
michael@0 | 55 | GLenum mUsage; |
michael@0 | 56 | |
michael@0 | 57 | rx::BufferStorage *mBufferStorage; |
michael@0 | 58 | |
michael@0 | 59 | rx::IndexRangeCache mIndexRangeCache; |
michael@0 | 60 | |
michael@0 | 61 | rx::StaticVertexBufferInterface *mStaticVertexBuffer; |
michael@0 | 62 | rx::StaticIndexBufferInterface *mStaticIndexBuffer; |
michael@0 | 63 | unsigned int mUnmodifiedDataUse; |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | #endif // LIBGLESV2_BUFFER_H_ |