Home | History | Annotate | Download | only in renderer
      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 
     15 namespace
     16 {
     17     enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
     18 }
     19 
     20 namespace gl
     21 {
     22 class Buffer;
     23 }
     24 
     25 namespace rx
     26 {
     27 class StaticIndexBufferInterface;
     28 class StreamingIndexBufferInterface;
     29 class IndexBuffer;
     30 class BufferStorage;
     31 class Renderer;
     32 
     33 struct TranslatedIndexData
     34 {
     35     unsigned int minIndex;
     36     unsigned int maxIndex;
     37     unsigned int startIndex;
     38     unsigned int startOffset;   // In bytes
     39 
     40     IndexBuffer *indexBuffer;
     41     BufferStorage *storage;
     42     GLenum indexType;
     43     unsigned int serial;
     44 };
     45 
     46 class IndexDataManager
     47 {
     48   public:
     49     explicit IndexDataManager(Renderer *renderer);
     50     virtual ~IndexDataManager();
     51 
     52     GLenum prepareIndexData(GLenum type, GLsizei count, gl::Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated);
     53     StaticIndexBufferInterface *getCountingIndices(GLsizei count);
     54 
     55   private:
     56     DISALLOW_COPY_AND_ASSIGN(IndexDataManager);
     57 
     58     Renderer *const mRenderer;
     59 
     60     StreamingIndexBufferInterface *mStreamingBufferShort;
     61     StreamingIndexBufferInterface *mStreamingBufferInt;
     62     StaticIndexBufferInterface *mCountingBuffer;
     63 };
     64 
     65 }
     66 
     67 #endif   // LIBGLESV2_INDEXDATAMANAGER_H_
     68