• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2002-2012 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     unsigned int serial;
43 };
44 
45 class IndexDataManager
46 {
47   public:
48     explicit IndexDataManager(Renderer *renderer);
49     virtual ~IndexDataManager();
50 
51     GLenum prepareIndexData(GLenum type, GLsizei count, gl::Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated);
52     StaticIndexBufferInterface *getCountingIndices(GLsizei count);
53 
54   private:
55     DISALLOW_COPY_AND_ASSIGN(IndexDataManager);
56 
57     Renderer *const mRenderer;
58 
59     StreamingIndexBufferInterface *mStreamingBufferShort;
60     StreamingIndexBufferInterface *mStreamingBufferInt;
61     StaticIndexBufferInterface *mCountingBuffer;
62 };
63 
64 }
65 
66 #endif   // LIBGLESV2_INDEXDATAMANAGER_H_
67