1 // 2 // Copyright (c) 2002-2014 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 // IndexDataManager.h: Defines the IndexDataManager, a class that 8 // runs the Buffer translation process for index buffers. 9 10 #ifndef LIBGLESV2_INDEXDATAMANAGER_H_ 11 #define LIBGLESV2_INDEXDATAMANAGER_H_ 12 13 #include "common/angleutils.h" 14 #include "common/mathutil.h" 15 #include "libGLESv2/Error.h" 16 17 #include <GLES2/gl2.h> 18 19 namespace 20 { 21 enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) }; 22 } 23 24 namespace gl 25 { 26 class Buffer; 27 } 28 29 namespace rx 30 { 31 class IndexBufferInterface; 32 class StaticIndexBufferInterface; 33 class StreamingIndexBufferInterface; 34 class IndexBuffer; 35 class BufferD3D; 36 class Renderer; 37 38 struct TranslatedIndexData 39 { 40 RangeUI indexRange; 41 unsigned int startIndex; 42 unsigned int startOffset; // In bytes 43 44 IndexBuffer *indexBuffer; 45 BufferD3D *storage; 46 GLenum indexType; 47 unsigned int serial; 48 }; 49 50 class IndexDataManager 51 { 52 public: 53 explicit IndexDataManager(Renderer *renderer); 54 virtual ~IndexDataManager(); 55 56 gl::Error prepareIndexData(GLenum type, GLsizei count, gl::Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated); 57 58 private: 59 gl::Error getStreamingIndexBuffer(GLenum destinationIndexType, IndexBufferInterface **outBuffer); 60 61 DISALLOW_COPY_AND_ASSIGN(IndexDataManager); 62 63 Renderer *const mRenderer; 64 65 StreamingIndexBufferInterface *mStreamingBufferShort; 66 StreamingIndexBufferInterface *mStreamingBufferInt; 67 }; 68 69 } 70 71 #endif // LIBGLESV2_INDEXDATAMANAGER_H_ 72