1 // SwiftShader Software Renderer
\r
3 // Copyright(c) 2005-2012 TransGaming Inc.
\r
5 // All rights reserved. No part of this software may be copied, distributed, transmitted,
\r
6 // transcribed, stored in a retrieval system, translated into any human or computer
\r
7 // language by any means, or disclosed to third parties without the explicit written
\r
8 // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
\r
9 // or implied, including but not limited to any patent rights, are granted to you.
\r
12 // IndexDataManager.h: Defines the IndexDataManager, a class that
\r
13 // runs the Buffer translation process for index buffers.
\r
15 #ifndef LIBGLESV2_INDEXDATAMANAGER_H_
\r
16 #define LIBGLESV2_INDEXDATAMANAGER_H_
\r
18 #include "Context.h"
\r
21 #include <GLES2/gl2.h>
\r
26 struct TranslatedIndexData
\r
28 unsigned int minIndex;
\r
29 unsigned int maxIndex;
\r
30 unsigned int indexOffset;
\r
32 sw::Resource *indexBuffer;
\r
35 class StreamingIndexBuffer
\r
38 StreamingIndexBuffer(unsigned int initialSize);
\r
39 virtual ~StreamingIndexBuffer();
\r
41 void *map(unsigned int requiredSpace, unsigned int *offset);
\r
43 void reserveSpace(unsigned int requiredSpace, GLenum type);
\r
45 sw::Resource *getResource() const;
\r
48 sw::Resource *mIndexBuffer;
\r
49 unsigned int mBufferSize;
\r
50 unsigned int mWritePosition;
\r
53 class IndexDataManager
\r
57 virtual ~IndexDataManager();
\r
59 GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const void *indices, TranslatedIndexData *translated);
\r
61 static std::size_t typeSize(GLenum type);
\r
64 StreamingIndexBuffer *mStreamingBuffer;
\r
69 #endif // LIBGLESV2_INDEXDATAMANAGER_H_
\r