daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2002-2010 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 | // geometry/IndexDataManager.h: Defines the IndexDataManager, a class that |
| 8 | // runs the Buffer translation process for index buffers. |
| 9 | |
| 10 | #ifndef LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_ |
| 11 | #define LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_ |
| 12 | |
| 13 | #include <bitset> |
| 14 | #include <cstddef> |
| 15 | |
| 16 | #define GL_APICALL |
| 17 | #include <GLES2/gl2.h> |
| 18 | |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 19 | #include "libGLESv2/Context.h" |
daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 20 | |
| 21 | namespace gl |
| 22 | { |
| 23 | |
| 24 | class Buffer; |
| 25 | class BufferBackEnd; |
| 26 | class TranslatedIndexBuffer; |
| 27 | struct FormatConverter; |
| 28 | |
| 29 | struct TranslatedIndexData |
| 30 | { |
| 31 | GLuint minIndex; |
| 32 | GLuint maxIndex; |
| 33 | GLuint count; |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame^] | 34 | GLuint indexSize; |
daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 35 | |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame^] | 36 | const void *indices; |
daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 37 | |
| 38 | TranslatedIndexBuffer *buffer; |
| 39 | GLsizei offset; |
| 40 | }; |
| 41 | |
| 42 | class IndexDataManager |
| 43 | { |
| 44 | public: |
| 45 | IndexDataManager(Context *context, BufferBackEnd *backend); |
| 46 | ~IndexDataManager(); |
| 47 | |
| 48 | TranslatedIndexData preRenderValidate(GLenum mode, GLenum type, GLsizei count, Buffer *arrayElementBuffer, const void *indices); |
| 49 | |
| 50 | private: |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame^] | 51 | std::size_t IndexDataManager::indexSize(GLenum type) const; |
| 52 | std::size_t spaceRequired(GLenum type, GLsizei count) const; |
| 53 | TranslatedIndexBuffer *prepareIndexBuffer(GLenum type, std::size_t requiredSpace); |
daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 54 | |
| 55 | Context *mContext; |
| 56 | BufferBackEnd *mBackend; |
| 57 | |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame^] | 58 | bool mIntIndicesSupported; |
| 59 | |
| 60 | TranslatedIndexBuffer *mStreamBufferShort; |
| 61 | TranslatedIndexBuffer *mStreamBufferInt; |
daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | } |
| 65 | |
| 66 | #endif // LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_ |