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 | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 36 | TranslatedIndexBuffer *buffer; |
| 37 | GLsizei offset; |
| 38 | }; |
| 39 | |
| 40 | class IndexDataManager |
| 41 | { |
| 42 | public: |
| 43 | IndexDataManager(Context *context, BufferBackEnd *backend); |
| 44 | ~IndexDataManager(); |
| 45 | |
daniel@transgaming.com | 41d8dd8 | 2010-05-12 03:45:03 +0000 | [diff] [blame] | 46 | GLenum preRenderValidate(GLenum mode, GLenum type, GLsizei count, Buffer *arrayElementBuffer, const void *indices, TranslatedIndexData *translated); |
daniel@transgaming.com | 81655a7 | 2010-05-20 19:18:17 +0000 | [diff] [blame] | 47 | GLenum preRenderValidateUnindexed(GLenum mode, GLsizei count, TranslatedIndexData *indexInfo); |
daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 48 | |
| 49 | private: |
daniel@transgaming.com | 41d8dd8 | 2010-05-12 03:45:03 +0000 | [diff] [blame] | 50 | std::size_t IndexDataManager::typeSize(GLenum type) const; |
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 | 81655a7 | 2010-05-20 19:18:17 +0000 | [diff] [blame] | 62 | |
| 63 | TranslatedIndexBuffer *mCountingBuffer; |
| 64 | GLsizei mCountingBufferSize; |
| 65 | |
| 66 | TranslatedIndexBuffer *mLineLoopBuffer; |
daniel@transgaming.com | f8b58a0 | 2010-03-26 04:08:45 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | } |
| 70 | |
| 71 | #endif // LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_ |