Support translating indices.

TRAC #11393

Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch
Author:    Andrew Lewycky

git-svn-id: https://angleproject.googlecode.com/svn/trunk@72 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/geometry/IndexDataManager.h b/src/libGLESv2/geometry/IndexDataManager.h
new file mode 100644
index 0000000..d590a9b
--- /dev/null
+++ b/src/libGLESv2/geometry/IndexDataManager.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// geometry/IndexDataManager.h: Defines the IndexDataManager, a class that
+// runs the Buffer translation process for index buffers.
+
+#ifndef LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_
+#define LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_
+
+#include <bitset>
+#include <cstddef>
+
+#define GL_APICALL
+#include <GLES2/gl2.h>
+
+#include "Context.h"
+
+namespace gl
+{
+
+class Buffer;
+class BufferBackEnd;
+class TranslatedIndexBuffer;
+struct FormatConverter;
+
+struct TranslatedIndexData
+{
+    GLuint minIndex;
+    GLuint maxIndex;
+    GLuint count;
+
+    const Index *indices;
+
+    TranslatedIndexBuffer *buffer;
+    GLsizei offset;
+};
+
+class IndexDataManager
+{
+  public:
+    IndexDataManager(Context *context, BufferBackEnd *backend);
+    ~IndexDataManager();
+
+    TranslatedIndexData preRenderValidate(GLenum mode, GLenum type, GLsizei count, Buffer *arrayElementBuffer, const void *indices);
+
+  private:
+    std::size_t spaceRequired(GLenum mode, GLenum type, GLsizei count);
+
+    Context *mContext;
+    BufferBackEnd *mBackend;
+
+    TranslatedIndexBuffer *mStreamBuffer;
+};
+
+}
+
+#endif   // LIBGLESV2_GEOMETRY_INDEXDATAMANAGER_H_