Changed D3DConstant table, IndexDataManager,VertexDataManager and vertexconversion namespaces.

TRAC #22198

Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1548 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Buffer.cpp b/src/libGLESv2/Buffer.cpp
index 90f5eb8..cc7398e 100644
--- a/src/libGLESv2/Buffer.cpp
+++ b/src/libGLESv2/Buffer.cpp
@@ -61,8 +61,8 @@
 
     if (usage == GL_STATIC_DRAW)
     {
-        mStaticVertexBuffer = new StaticVertexBuffer(mRenderer);
-        mStaticIndexBuffer = new StaticIndexBuffer(mRenderer);
+        mStaticVertexBuffer = new rx::StaticVertexBuffer(mRenderer);
+        mStaticIndexBuffer = new rx::StaticIndexBuffer(mRenderer);
     }
 }
 
@@ -78,12 +78,12 @@
     mUnmodifiedDataUse = 0;
 }
 
-StaticVertexBuffer *Buffer::getStaticVertexBuffer()
+rx::StaticVertexBuffer *Buffer::getStaticVertexBuffer()
 {
     return mStaticVertexBuffer;
 }
 
-StaticIndexBuffer *Buffer::getStaticIndexBuffer()
+rx::StaticIndexBuffer *Buffer::getStaticIndexBuffer()
 {
     return mStaticIndexBuffer;
 }
@@ -108,8 +108,8 @@
 
         if (mUnmodifiedDataUse > 3 * mSize)
         {
-            mStaticVertexBuffer = new StaticVertexBuffer(mRenderer);
-            mStaticIndexBuffer = new StaticIndexBuffer(mRenderer);
+            mStaticVertexBuffer = new rx::StaticVertexBuffer(mRenderer);
+            mStaticIndexBuffer = new rx::StaticIndexBuffer(mRenderer);
         }
     }
 }
diff --git a/src/libGLESv2/Buffer.h b/src/libGLESv2/Buffer.h
index 75d6779..5357ce4 100644
--- a/src/libGLESv2/Buffer.h
+++ b/src/libGLESv2/Buffer.h
@@ -21,10 +21,14 @@
 #include "common/RefCountObject.h"
 #include "libGLESv2/renderer/Renderer9.h"
 
-namespace gl
+namespace rx
 {
 class StaticVertexBuffer;
 class StaticIndexBuffer;
+}
+
+namespace gl
+{
 
 class Buffer : public RefCountObject
 {
@@ -40,8 +44,8 @@
     size_t size() const { return mSize; }
     GLenum usage() const { return mUsage; }
 
-    StaticVertexBuffer *getStaticVertexBuffer();
-    StaticIndexBuffer *getStaticIndexBuffer();
+    rx::StaticVertexBuffer *getStaticVertexBuffer();
+    rx::StaticIndexBuffer *getStaticIndexBuffer();
     void invalidateStaticData();
     void promoteStaticUsage(int dataSize);
 
@@ -53,8 +57,8 @@
     GLsizeiptr mSize;
     GLenum mUsage;
 
-    StaticVertexBuffer *mStaticVertexBuffer;
-    StaticIndexBuffer *mStaticIndexBuffer;
+    rx::StaticVertexBuffer *mStaticVertexBuffer;
+    rx::StaticIndexBuffer *mStaticIndexBuffer;
     GLsizeiptr mUnmodifiedDataUse;
 };
 
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 97481ad..2250b80 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -2040,7 +2040,7 @@
 
     applyState(mode);
 
-    TranslatedIndexData indexInfo;
+    rx::TranslatedIndexData indexInfo;
     GLenum err = mRenderer->applyIndexBuffer(indices, mState.elementArrayBuffer.get(), count, mode, type, &indexInfo);
     if (err != GL_NO_ERROR)
     {
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index a3b3b00..d940b2e 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -1817,8 +1817,8 @@
     }
 
     bool success = true;
-    D3DConstantTable *constantTableVS = NULL;
-    D3DConstantTable *constantTablePS = NULL;
+    rx::D3DConstantTable *constantTableVS = NULL;
+    rx::D3DConstantTable *constantTablePS = NULL;
     mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), GL_VERTEX_SHADER);
     mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), GL_FRAGMENT_SHADER);
 
@@ -1937,11 +1937,11 @@
     return true;
 }
 
-bool ProgramBinary::linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable)
+bool ProgramBinary::linkUniforms(InfoLog &infoLog, rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable)
 {
     for (unsigned int constantIndex = 0; constantIndex < psConstantTable->constants(); constantIndex++)
     {
-        const D3DConstant *constant = psConstantTable->getConstant(constantIndex);
+        const rx::D3DConstant *constant = psConstantTable->getConstant(constantIndex);
 
         if (!defineUniform(infoLog, GL_FRAGMENT_SHADER, constant, "", vsConstantTable, psConstantTable))
         {
@@ -1951,7 +1951,7 @@
 
     for (unsigned int constantIndex = 0; constantIndex < vsConstantTable->constants(); constantIndex++)
     {
-        const D3DConstant *constant = vsConstantTable->getConstant(constantIndex);
+        const rx::D3DConstant *constant = vsConstantTable->getConstant(constantIndex);
 
         if (!defineUniform(infoLog, GL_VERTEX_SHADER, constant, "", vsConstantTable, psConstantTable))
         {
@@ -1963,15 +1963,15 @@
 
 // Adds the description of a constant found in the binary shader to the list of uniforms
 // Returns true if succesful (uniform not already defined)
-bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DConstant *constant, const std::string &name,
-                                  D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable)
+bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const rx::D3DConstant *constant, const std::string &name,
+                                  rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable)
 {
-    if (constant->registerSet == D3DConstant::RS_SAMPLER)
+    if (constant->registerSet == rx::D3DConstant::RS_SAMPLER)
     {
         for (unsigned int i = 0; i < constant->registerCount; i++)
         {
-            const D3DConstant *psConstant = psConstantTable->getConstantByName(constant->name.c_str());
-            const D3DConstant *vsConstant = vsConstantTable->getConstantByName(constant->name.c_str());
+            const rx::D3DConstant *psConstant = psConstantTable->getConstantByName(constant->name.c_str());
+            const rx::D3DConstant *vsConstant = vsConstantTable->getConstantByName(constant->name.c_str());
 
             if (psConstant)
             {
@@ -1980,7 +1980,7 @@
                 if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
                 {
                     mSamplersPS[samplerIndex].active = true;
-                    mSamplersPS[samplerIndex].textureType = (constant->type == D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
+                    mSamplersPS[samplerIndex].textureType = (constant->type == rx::D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
                     mSamplersPS[samplerIndex].logicalTextureUnit = 0;
                     mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange);
                 }
@@ -1998,7 +1998,7 @@
                 if (samplerIndex < getContext()->getMaximumVertexTextureImageUnits())
                 {
                     mSamplersVS[samplerIndex].active = true;
-                    mSamplersVS[samplerIndex].textureType = (constant->type == D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
+                    mSamplersVS[samplerIndex].textureType = (constant->type == rx::D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
                     mSamplersVS[samplerIndex].logicalTextureUnit = 0;
                     mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange);
                 }
@@ -2013,13 +2013,13 @@
 
     switch(constant->typeClass)
     {
-      case D3DConstant::CLASS_STRUCT:
+      case rx::D3DConstant::CLASS_STRUCT:
         {
             for (unsigned int arrayIndex = 0; arrayIndex < constant->elements; arrayIndex++)
             {
                 for (unsigned int field = 0; field < constant->structMembers[arrayIndex].size(); field++)
                 {
-                    const D3DConstant *fieldConstant = constant->structMembers[arrayIndex][field];
+                    const rx::D3DConstant *fieldConstant = constant->structMembers[arrayIndex][field];
 
                     std::string structIndex = (constant->elements > 1) ? ("[" + str(arrayIndex) + "]") : "";
 
@@ -2032,10 +2032,10 @@
 
             return true;
         }
-      case D3DConstant::CLASS_SCALAR:
-      case D3DConstant::CLASS_VECTOR:
-      case D3DConstant::CLASS_MATRIX_COLUMNS:
-      case D3DConstant::CLASS_OBJECT:
+      case rx::D3DConstant::CLASS_SCALAR:
+      case rx::D3DConstant::CLASS_VECTOR:
+      case rx::D3DConstant::CLASS_MATRIX_COLUMNS:
+      case rx::D3DConstant::CLASS_OBJECT:
         return defineUniform(shader, constant, name + constant->name);
       default:
         UNREACHABLE();
@@ -2043,7 +2043,7 @@
     }
 }
 
-bool ProgramBinary::defineUniform(GLenum shader, const D3DConstant *constant, const std::string &_name)
+bool ProgramBinary::defineUniform(GLenum shader, const rx::D3DConstant *constant, const std::string &_name)
 {
     Uniform *uniform = createUniform(constant, _name);
 
@@ -2081,27 +2081,27 @@
     return true;
 }
 
-Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::string &_name)
+Uniform *ProgramBinary::createUniform(const rx::D3DConstant *constant, const std::string &_name)
 {
     if (constant->rows == 1)   // Vectors and scalars
     {
         switch (constant->type)
         {
-          case D3DConstant::PT_SAMPLER2D:
+          case rx::D3DConstant::PT_SAMPLER2D:
             switch (constant->columns)
             {
               case 1: return new Uniform(GL_SAMPLER_2D, _name, constant->elements);
               default: UNREACHABLE();
             }
             break;
-          case D3DConstant::PT_SAMPLERCUBE:
+          case rx::D3DConstant::PT_SAMPLERCUBE:
             switch (constant->columns)
             {
               case 1: return new Uniform(GL_SAMPLER_CUBE, _name, constant->elements);
               default: UNREACHABLE();
             }
             break;
-          case D3DConstant::PT_BOOL:
+          case rx::D3DConstant::PT_BOOL:
             switch (constant->columns)
             {
               case 1: return new Uniform(GL_BOOL, _name, constant->elements);
@@ -2111,7 +2111,7 @@
               default: UNREACHABLE();
             }
             break;
-          case D3DConstant::PT_INT:
+          case rx::D3DConstant::PT_INT:
             switch (constant->columns)
             {
               case 1: return new Uniform(GL_INT, _name, constant->elements);
@@ -2121,7 +2121,7 @@
               default: UNREACHABLE();
             }
             break;
-          case D3DConstant::PT_FLOAT:
+          case rx::D3DConstant::PT_FLOAT:
             switch (constant->columns)
             {
               case 1: return new Uniform(GL_FLOAT, _name, constant->elements);
@@ -2139,7 +2139,7 @@
     {
         switch (constant->type)
         {
-          case D3DConstant::PT_FLOAT:
+          case rx::D3DConstant::PT_FLOAT:
             switch (constant->rows)
             {
               case 2: return new Uniform(GL_FLOAT_MAT2, _name, constant->elements);
diff --git a/src/libGLESv2/ProgramBinary.h b/src/libGLESv2/ProgramBinary.h
index 4a21a6f..2bb5617 100644
--- a/src/libGLESv2/ProgramBinary.h
+++ b/src/libGLESv2/ProgramBinary.h
@@ -56,13 +56,13 @@
             registerCount = 0;
         }
 
-        void set(const D3DConstant *constant)
+        void set(const rx::D3DConstant *constant)
         {
             switch(constant->registerSet)
             {
-              case D3DConstant::RS_BOOL:    boolIndex = constant->registerIndex;    break;
-              case D3DConstant::RS_FLOAT4:  float4Index = constant->registerIndex;  break;
-              case D3DConstant::RS_SAMPLER: samplerIndex = constant->registerIndex; break;
+              case rx::D3DConstant::RS_BOOL:    boolIndex = constant->registerIndex;    break;
+              case rx::D3DConstant::RS_FLOAT4:  float4Index = constant->registerIndex;  break;
+              case rx::D3DConstant::RS_SAMPLER: samplerIndex = constant->registerIndex; break;
               default: UNREACHABLE();
             }
             
@@ -171,11 +171,11 @@
 
     bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
 
-    bool linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable);
-    bool defineUniform(InfoLog &infoLog, GLenum shader, const D3DConstant *constant, const std::string &name,
-                       D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable);
-    bool defineUniform(GLenum shader, const D3DConstant *constant, const std::string &name);
-    Uniform *createUniform( const D3DConstant *constant, const std::string &name);
+    bool linkUniforms(InfoLog &infoLog, rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable);
+    bool defineUniform(InfoLog &infoLog, GLenum shader, const rx::D3DConstant *constant, const std::string &name,
+                       rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable);
+    bool defineUniform(GLenum shader, const rx::D3DConstant *constant, const std::string &name);
+    Uniform *createUniform(const rx::D3DConstant *constant, const std::string &name);
     bool applyUniformnfv(IDirect3DDevice9 *device, Uniform *targetUniform, const GLfloat *v);   // D3D9_REPLACE
     bool applyUniform1iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
     bool applyUniform2iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
diff --git a/src/libGLESv2/renderer/D3DConstantTable.cpp b/src/libGLESv2/renderer/D3DConstantTable.cpp
index 10a0f9d..8524f34 100644
--- a/src/libGLESv2/renderer/D3DConstantTable.cpp
+++ b/src/libGLESv2/renderer/D3DConstantTable.cpp
@@ -21,7 +21,7 @@
 const static int SHADER_VERSION_MASK = D3DVS_VERSION(0, 0);
 const static int FOURCC_CTAB = MAKEFOURCC('C','T','A','B');
 
-namespace gl
+namespace rx
 {
 // These structs and constants correspond to the format of the constant table in a shader binary.
 // They match the corresponding structures in d3dx9shader.h.
@@ -147,7 +147,7 @@
 
 D3DConstantTable::D3DConstantTable(void *blob, size_t size) : mError(false)
 {
-    BinaryInputStream stream(blob, size);
+    gl::BinaryInputStream stream(blob, size);
 
     int version;
     stream.read(&version);
diff --git a/src/libGLESv2/renderer/D3DConstantTable.h b/src/libGLESv2/renderer/D3DConstantTable.h
index c2c8e9f..e044c58 100644
--- a/src/libGLESv2/renderer/D3DConstantTable.h
+++ b/src/libGLESv2/renderer/D3DConstantTable.h
@@ -17,7 +17,7 @@
 
 #include "common/angleutils.h"
 
-namespace gl
+namespace rx
 {
 
 namespace ctab
diff --git a/src/libGLESv2/renderer/IndexDataManager.cpp b/src/libGLESv2/renderer/IndexDataManager.cpp
index 272478f..3464770 100644
--- a/src/libGLESv2/renderer/IndexDataManager.cpp
+++ b/src/libGLESv2/renderer/IndexDataManager.cpp
@@ -15,7 +15,7 @@
 #include "libGLESv2/mathutil.h"
 #include "libGLESv2/main.h"
 
-namespace gl
+namespace rx
 {
 unsigned int IndexBuffer::mCurrentSerial = 1;
 
@@ -107,7 +107,7 @@
     else UNREACHABLE();
 }
 
-GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *buffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **d3dIndexBuffer, unsigned int *serial)
+GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer *buffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **d3dIndexBuffer, unsigned int *serial)
 {
     if (!mStreamingBufferShort)
     {
diff --git a/src/libGLESv2/renderer/IndexDataManager.h b/src/libGLESv2/renderer/IndexDataManager.h
index 6e4a6e4..53c67d1 100644
--- a/src/libGLESv2/renderer/IndexDataManager.h
+++ b/src/libGLESv2/renderer/IndexDataManager.h
@@ -23,7 +23,7 @@
     enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
 }
 
-namespace gl
+namespace rx
 {
 
 struct TranslatedIndexData
@@ -125,7 +125,7 @@
     IndexDataManager(rx::Renderer9 *renderer);
     virtual ~IndexDataManager();
 
-    GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **indexBuffer, unsigned int *serial);
+    GLenum prepareIndexData(GLenum type, GLsizei count, gl::Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **indexBuffer, unsigned int *serial);
     StaticIndexBuffer *getCountingIndices(GLsizei count);
 
   private:
diff --git a/src/libGLESv2/renderer/Renderer.h b/src/libGLESv2/renderer/Renderer.h
index 12c8ee0..08254f2 100644
--- a/src/libGLESv2/renderer/Renderer.h
+++ b/src/libGLESv2/renderer/Renderer.h
@@ -47,7 +47,6 @@
 class ProgramBinary;
 class VertexAttribute;
 class Buffer;
-struct TranslatedIndexData;
 }
 
 namespace rx
@@ -55,6 +54,7 @@
 class TextureStorage2D;
 class TextureStorageCubeMap;
 class Blit;
+struct TranslatedIndexData;
 
 struct ConfigDesc
 {
@@ -97,10 +97,10 @@
     virtual void applyShaders(gl::ProgramBinary *programBinary) = 0;
     virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0;
     virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) = 0;
-    virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo) = 0;
+    virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0;
 
     virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances) = 0;
-    virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo) = 0;
+    virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo) = 0;
 
     virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) = 0;
 
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index 8045b98..d1845b2 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -664,7 +664,7 @@
     return GL_NO_ERROR;
 }
 
-GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo)
+GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
 {
     // TODO
     UNIMPLEMENTED();
@@ -677,7 +677,7 @@
     mDeviceContext->Draw(count, 0);
 }
 
-void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo)
+void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo)
 {
     // TODO
     UNIMPLEMENTED();
diff --git a/src/libGLESv2/renderer/Renderer11.h b/src/libGLESv2/renderer/Renderer11.h
index c7029f9..357bef2 100644
--- a/src/libGLESv2/renderer/Renderer11.h
+++ b/src/libGLESv2/renderer/Renderer11.h
@@ -63,10 +63,10 @@
     virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
     virtual void applyShaders(gl::ProgramBinary *programBinary);
     virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
-    virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo);
+    virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
 
     virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
-    virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo);
+    virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo);
 
     virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
 
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index 41ab0ab..f4b9d4c 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -379,8 +379,8 @@
 
     ASSERT(!mBlit && !mVertexDataManager && !mIndexDataManager);
     mBlit = new Blit(this);
-    mVertexDataManager = new gl::VertexDataManager(this);
-    mIndexDataManager = new gl::IndexDataManager(this);
+    mVertexDataManager = new rx::VertexDataManager(this);
+    mIndexDataManager = new rx::IndexDataManager(this);
 }
 
 D3DPRESENT_PARAMETERS Renderer9::getDefaultPresentParameters()
@@ -1124,7 +1124,7 @@
 
 GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances)
 {
-    gl::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
+    TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
     GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
     if (err != GL_NO_ERROR)
     {
@@ -1135,7 +1135,7 @@
 }
 
 // Applies the indices and element array bindings to the Direct3D 9 device
-GLenum Renderer9::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo)
+GLenum Renderer9::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
 {
     IDirect3DIndexBuffer9 *indexBuffer;
     unsigned int serial;
@@ -1163,7 +1163,7 @@
     }
     else if (instances > 0)
     {
-        gl::StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count);
+        StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count);
         if (countingIB)
         {
             if (mAppliedIBSerial != countingIB->getSerial())
@@ -1189,7 +1189,7 @@
     }
 }
 
-void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo)
+void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo)
 {
     startScene();
 
@@ -1226,7 +1226,7 @@
 
         if (!mLineLoopIB)
         {
-            mLineLoopIB = new gl::StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
+            mLineLoopIB = new StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
         }
 
         if (mLineLoopIB)
@@ -1283,7 +1283,7 @@
 
         if (!mLineLoopIB)
         {
-            mLineLoopIB = new gl::StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
+            mLineLoopIB = new StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
         }
 
         if (mLineLoopIB)
@@ -2618,7 +2618,7 @@
 ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length, GLenum type, void *data)
 {
     ShaderExecutable9 *executable = NULL;
-    gl::D3DConstantTable *table = reinterpret_cast<gl::D3DConstantTable *>(data);
+    D3DConstantTable *table = reinterpret_cast<D3DConstantTable *>(data);
 
     switch (type)
     {
@@ -2669,7 +2669,7 @@
     if (!binary)
         return NULL;
 
-    gl::D3DConstantTable *constantTable = new gl::D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize());
+    D3DConstantTable *constantTable = new D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize());
     if (constantTable->error())
     {
         delete constantTable;
diff --git a/src/libGLESv2/renderer/Renderer9.h b/src/libGLESv2/renderer/Renderer9.h
index 15f3623..eb79252 100644
--- a/src/libGLESv2/renderer/Renderer9.h
+++ b/src/libGLESv2/renderer/Renderer9.h
@@ -28,16 +28,12 @@
 #include "libGLESv2/renderer/Renderer.h"
 #include "libGLESv2/renderer/IndexDataManager.h"
 
-namespace gl
+namespace rx
 {
 class D3DConstantTable;
 class VertexDataManager;
 class StreamingIndexBuffer;
 struct TranslatedAttribute;
-}
-
-namespace rx
-{
 
 class Renderer9 : public Renderer
 {
@@ -96,10 +92,10 @@
     virtual void applyShaders(gl::ProgramBinary *programBinary);
     virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
     virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
-    virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo);
+    virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
 
     virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
-    virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo);
+    virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo);
 
     virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
 
@@ -265,11 +261,11 @@
     VertexShaderCache mVertexShaderCache;
     PixelShaderCache mPixelShaderCache;
 
-    gl::VertexDataManager *mVertexDataManager;
+    VertexDataManager *mVertexDataManager;
     VertexDeclarationCache mVertexDeclarationCache;
 
-    gl::IndexDataManager *mIndexDataManager;
-    gl::StreamingIndexBuffer *mLineLoopIB;
+    IndexDataManager *mIndexDataManager;
+    StreamingIndexBuffer *mLineLoopIB;
 };
 
 }
diff --git a/src/libGLESv2/renderer/ShaderExecutable.h b/src/libGLESv2/renderer/ShaderExecutable.h
index cbb30ee..fc47267 100644
--- a/src/libGLESv2/renderer/ShaderExecutable.h
+++ b/src/libGLESv2/renderer/ShaderExecutable.h
@@ -40,7 +40,7 @@
         return mLength;
     }
 
-    virtual gl::D3DConstantTable *getConstantTable() = 0; // D3D9_REMOVE
+    virtual D3DConstantTable *getConstantTable() = 0; // D3D9_REMOVE
 
   private:
     DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
diff --git a/src/libGLESv2/renderer/ShaderExecutable11.cpp b/src/libGLESv2/renderer/ShaderExecutable11.cpp
index b1aeb9c..0605b76 100644
--- a/src/libGLESv2/renderer/ShaderExecutable11.cpp
+++ b/src/libGLESv2/renderer/ShaderExecutable11.cpp
@@ -56,7 +56,7 @@
     return mPixelExecutable;
 }
 
-gl::D3DConstantTable *ShaderExecutable11::getConstantTable()
+D3DConstantTable *ShaderExecutable11::getConstantTable()
 {
     return NULL;
 }
diff --git a/src/libGLESv2/renderer/ShaderExecutable11.h b/src/libGLESv2/renderer/ShaderExecutable11.h
index 0d817bc..b20f41a 100644
--- a/src/libGLESv2/renderer/ShaderExecutable11.h
+++ b/src/libGLESv2/renderer/ShaderExecutable11.h
@@ -29,7 +29,7 @@
 
     ID3D11PixelShader *getPixelShader();
     ID3D11VertexShader *getVertexShader();
-    virtual gl::D3DConstantTable *getConstantTable();
+    virtual D3DConstantTable *getConstantTable();
 
   private:
     DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11);
diff --git a/src/libGLESv2/renderer/ShaderExecutable9.cpp b/src/libGLESv2/renderer/ShaderExecutable9.cpp
index ad50e54..c00184b 100644
--- a/src/libGLESv2/renderer/ShaderExecutable9.cpp
+++ b/src/libGLESv2/renderer/ShaderExecutable9.cpp
@@ -14,7 +14,7 @@
 namespace rx
 {
 
-ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, gl::D3DConstantTable *constantTable)
+ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, D3DConstantTable *constantTable)
     : ShaderExecutable(function, length)
 {
     mPixelExecutable = executable;
@@ -22,7 +22,7 @@
     mConstantTable = constantTable;
 }
 
-ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable)
+ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, D3DConstantTable *constantTable)
     : ShaderExecutable(function, length)
 {
     mVertexExecutable = executable;
@@ -60,7 +60,7 @@
     return mPixelExecutable;
 }
 
-gl::D3DConstantTable *ShaderExecutable9::getConstantTable()
+D3DConstantTable *ShaderExecutable9::getConstantTable()
 {
     return mConstantTable;
 }
diff --git a/src/libGLESv2/renderer/ShaderExecutable9.h b/src/libGLESv2/renderer/ShaderExecutable9.h
index d5d3f93..52b3df8 100644
--- a/src/libGLESv2/renderer/ShaderExecutable9.h
+++ b/src/libGLESv2/renderer/ShaderExecutable9.h
@@ -21,15 +21,15 @@
 class ShaderExecutable9 : public ShaderExecutable
 {
   public:
-    ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, gl::D3DConstantTable *constantTable);
-    ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable);
+    ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, D3DConstantTable *constantTable);
+    ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, D3DConstantTable *constantTable);
     virtual ~ShaderExecutable9();
 
     static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable);
 
     IDirect3DPixelShader9 *getPixelShader();
     IDirect3DVertexShader9 *getVertexShader();
-    virtual gl::D3DConstantTable *getConstantTable();
+    virtual D3DConstantTable *getConstantTable();
 
   private:
     DISALLOW_COPY_AND_ASSIGN(ShaderExecutable9);
@@ -37,7 +37,7 @@
     IDirect3DPixelShader9 *mPixelExecutable;
     IDirect3DVertexShader9 *mVertexExecutable;
 
-    gl::D3DConstantTable *mConstantTable;
+    D3DConstantTable *mConstantTable;
 };
 
 }
diff --git a/src/libGLESv2/renderer/VertexDataManager.cpp b/src/libGLESv2/renderer/VertexDataManager.cpp
index da43a67..bb9246e 100644
--- a/src/libGLESv2/renderer/VertexDataManager.cpp
+++ b/src/libGLESv2/renderer/VertexDataManager.cpp
@@ -28,19 +28,19 @@
     enum { CONSTANT_VERTEX_BUFFER_SIZE = 4096 };
 }
 
-namespace gl
+namespace rx
 {
 unsigned int VertexBuffer::mCurrentSerial = 1;
 
-int elementsInBuffer(const VertexAttribute &attribute, int size)
+int elementsInBuffer(const gl::VertexAttribute &attribute, int size)
 {
     int stride = attribute.stride();
     return (size - attribute.mOffset % stride + (stride - attribute.typeSize())) / stride;
 }
 
-VertexDataManager::VertexDataManager(rx::Renderer9 *renderer) : mRenderer(renderer)
+VertexDataManager::VertexDataManager(Renderer9 *renderer) : mRenderer(renderer)
 {
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+    for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
     {
         mCurrentValue[i][0] = std::numeric_limits<float>::quiet_NaN();
         mCurrentValue[i][1] = std::numeric_limits<float>::quiet_NaN();
@@ -65,15 +65,15 @@
 {
     delete mStreamingBuffer;
 
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+    for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
     {
         delete mCurrentValueBuffer[i];
     }
 }
 
-std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute, GLsizei instances)
+std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const gl::VertexAttribute &attribute, GLsizei instances)
 {
-    Buffer *buffer = attribute.mBoundBuffer.get();
+    gl::Buffer *buffer = attribute.mBoundBuffer.get();
 
     int inputStride = attribute.stride();
     int elementSize = attribute.typeSize();
@@ -125,24 +125,24 @@
     return streamOffset;
 }
 
-GLenum VertexDataManager::prepareVertexData(const VertexAttribute attribs[], ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
+GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
 {
     if (!mStreamingBuffer)
     {
         return GL_OUT_OF_MEMORY;
     }
 
-    for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+    for (int attributeIndex = 0; attributeIndex < gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
     {
         translated[attributeIndex].active = (programBinary->getSemanticIndex(attributeIndex) != -1);
     }
 
     // Determine the required storage size per used buffer, and invalidate static buffers that don't contain matching attributes
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+    for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
     {
         if (translated[i].active && attribs[i].mArrayEnabled)
         {
-            Buffer *buffer = attribs[i].mBoundBuffer.get();
+            gl::Buffer *buffer = attribs[i].mBoundBuffer.get();
             StaticVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
 
             if (staticBuffer)
@@ -160,7 +160,7 @@
                     {
                         if (translated[previous].active && attribs[previous].mArrayEnabled)
                         {
-                            Buffer *previousBuffer = attribs[previous].mBoundBuffer.get();
+                            gl::Buffer *previousBuffer = attribs[previous].mBoundBuffer.get();
                             StaticVertexBuffer *previousStaticBuffer = previousBuffer ? previousBuffer->getStaticVertexBuffer() : NULL;
 
                             if (staticBuffer == previousStaticBuffer)
@@ -183,11 +183,11 @@
     }
 
     // Reserve the required space per used buffer
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+    for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
     {
         if (translated[i].active && attribs[i].mArrayEnabled)
         {
-            Buffer *buffer = attribs[i].mBoundBuffer.get();
+            gl::Buffer *buffer = attribs[i].mBoundBuffer.get();
             ArrayVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
             ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : mStreamingBuffer;
 
@@ -199,13 +199,13 @@
     }
 
     // Perform the vertex data translations
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+    for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
     {
         if (translated[i].active)
         {
             if (attribs[i].mArrayEnabled)
             {
-                Buffer *buffer = attribs[i].mBoundBuffer.get();
+                gl::Buffer *buffer = attribs[i].mBoundBuffer.get();
 
                 if (!buffer && attribs[i].mPointer == NULL)
                 {
@@ -279,7 +279,7 @@
                     const int requiredSpace = 4 * sizeof(float);
                     buffer->addRequiredSpace(requiredSpace);
                     buffer->reserveRequiredSpace();
-                    float *data = static_cast<float*>(buffer->map(VertexAttribute(), requiredSpace, &mCurrentValueOffsets[i]));
+                    float *data = static_cast<float*>(buffer->map(gl::VertexAttribute(), requiredSpace, &mCurrentValueOffsets[i]));
                     if (data)
                     {
                         data[0] = attribs[i].mCurrentValue[0];
@@ -306,11 +306,11 @@
         }
     }
 
-    for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+    for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
     {
         if (translated[i].active && attribs[i].mArrayEnabled)
         {
-            Buffer *buffer = attribs[i].mBoundBuffer.get();
+            gl::Buffer *buffer = attribs[i].mBoundBuffer.get();
 
             if (buffer)
             {
@@ -322,7 +322,7 @@
     return GL_NO_ERROR;
 }
 
-std::size_t VertexDataManager::spaceRequired(const VertexAttribute &attrib, std::size_t count, GLsizei instances) const
+std::size_t VertexDataManager::spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances) const
 {
     size_t elementSize = formatConverter(attrib).outputElementSize;
 
@@ -386,12 +386,12 @@
 {
 };
 
-template <int size> struct WidenRule<D3DVT_FLOAT, size>          : gl::NoWiden<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT, size>          : gl::WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_SHORT_NORM, size>     : gl::WidenToEven<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE, size>          : gl::WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_UBYTE_NORM, size>     : gl::WidenToFour<size> { };
-template <int size> struct WidenRule<D3DVT_USHORT_NORM, size>    : gl::WidenToEven<size> { };
+template <int size> struct WidenRule<D3DVT_FLOAT, size>          : NoWiden<size> { };
+template <int size> struct WidenRule<D3DVT_SHORT, size>          : WidenToEven<size> { };
+template <int size> struct WidenRule<D3DVT_SHORT_NORM, size>     : WidenToEven<size> { };
+template <int size> struct WidenRule<D3DVT_UBYTE, size>          : WidenToFour<size> { };
+template <int size> struct WidenRule<D3DVT_UBYTE_NORM, size>     : WidenToFour<size> { };
+template <int size> struct WidenRule<D3DVT_USHORT_NORM, size>    : WidenToEven<size> { };
 
 // VertexTypeFlags encodes the D3DCAPS9::DeclType flag and vertex declaration flag for each D3D vertex type & size combination.
 template <unsigned int d3dtype, int size>
@@ -450,16 +450,16 @@
 
 // Almost all cases are covered by Cast (including those that are actually Identity since Cast<T,T> knows it's an identity mapping).
 template <GLenum fromType, bool normalized, unsigned int toType>
-struct ConversionRule : gl::Cast<typename GLToCType<fromType>::type, typename D3DToCType<toType>::type>
+struct ConversionRule : Cast<typename GLToCType<fromType>::type, typename D3DToCType<toType>::type>
 {
 };
 
 // All conversions from normalized types to float use the Normalize operator.
-template <GLenum fromType> struct ConversionRule<fromType, true, D3DVT_FLOAT> : gl::Normalize<typename GLToCType<fromType>::type> { };
+template <GLenum fromType> struct ConversionRule<fromType, true, D3DVT_FLOAT> : Normalize<typename GLToCType<fromType>::type> { };
 
 // Use a full specialisation for this so that it preferentially matches ahead of the generic normalize-to-float rules.
-template <> struct ConversionRule<GL_FIXED, true, D3DVT_FLOAT> : gl::FixedToFloat<GLint, 16> { };
-template <> struct ConversionRule<GL_FIXED, false, D3DVT_FLOAT> : gl::FixedToFloat<GLint, 16> { };
+template <> struct ConversionRule<GL_FIXED, true, D3DVT_FLOAT>  : FixedToFloat<GLint, 16> { };
+template <> struct ConversionRule<GL_FIXED, false, D3DVT_FLOAT> : FixedToFloat<GLint, 16> { };
 
 // A 2-stage construction is used for DefaultVertexValues because float must use SimpleDefaultValues (i.e. 0/1)
 // whether it is normalized or not.
@@ -468,8 +468,8 @@
 {
 };
 
-template <class T> struct DefaultVertexValuesStage2<T, true>  : gl::NormalizedDefaultValues<T> { };
-template <class T> struct DefaultVertexValuesStage2<T, false> : gl::SimpleDefaultValues<T> { };
+template <class T> struct DefaultVertexValuesStage2<T, true>  : NormalizedDefaultValues<T> { };
+template <class T> struct DefaultVertexValuesStage2<T, false> : SimpleDefaultValues<T> { };
 
 // Work out the default value rule for a D3D type (expressed as the C type) and
 template <class T, bool normalized>
@@ -477,7 +477,7 @@
 {
 };
 
-template <bool normalized> struct DefaultVertexValues<float, normalized> : gl::SimpleDefaultValues<float> { };
+template <bool normalized> struct DefaultVertexValues<float, normalized> : SimpleDefaultValues<float> { };
 
 // Policy rules for use with Converter, to choose whether to use the preferred or fallback conversion.
 // The fallback conversion produces an output that all D3D9 devices must support.
@@ -489,12 +489,12 @@
 // and the D3DDECLTYPE member needed for the vertex declaration in declflag.
 template <GLenum fromType, bool normalized, int size, template <class T> class PreferenceRule>
 struct Converter
-    : gl::VertexDataConverter<typename GLToCType<fromType>::type,
-                              WidenRule<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type, size>,
-                              ConversionRule<fromType,
-                                             normalized,
-                                             PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>,
-                              DefaultVertexValues<typename D3DToCType<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>::type, normalized > >
+    : VertexDataConverter<typename GLToCType<fromType>::type,
+                          WidenRule<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type, size>,
+                          ConversionRule<fromType,
+                                         normalized,
+                                         PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>,
+                          DefaultVertexValues<typename D3DToCType<PreferenceRule< VertexTypeMapping<fromType, normalized> >::type>::type, normalized > >
 {
 private:
     enum { d3dtype = PreferenceRule< VertexTypeMapping<fromType, normalized> >::type };
@@ -650,7 +650,7 @@
 {
 }
 
-void *StreamingVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *offset)
+void *StreamingVertexBuffer::map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *offset)
 {
     void *mapPtr = NULL;
 
@@ -717,7 +717,7 @@
 {
 }
 
-void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset)
+void *StaticVertexBuffer::map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset)
 {
     void *mapPtr = NULL;
 
@@ -766,7 +766,7 @@
     mRequiredSpace = 0;
 }
 
-std::size_t StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
+std::size_t StaticVertexBuffer::lookupAttribute(const gl::VertexAttribute &attribute)
 {
     for (unsigned int element = 0; element < mCache.size(); element++)
     {
@@ -785,7 +785,7 @@
     return -1;
 }
 
-const VertexDataManager::FormatConverter &VertexDataManager::formatConverter(const VertexAttribute &attribute) const
+const VertexDataManager::FormatConverter &VertexDataManager::formatConverter(const gl::VertexAttribute &attribute) const
 {
     return mAttributeTypes[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1];
 }
diff --git a/src/libGLESv2/renderer/VertexDataManager.h b/src/libGLESv2/renderer/VertexDataManager.h
index 971aeca..2cd4da1 100644
--- a/src/libGLESv2/renderer/VertexDataManager.h
+++ b/src/libGLESv2/renderer/VertexDataManager.h
@@ -18,7 +18,7 @@
 
 #include "libGLESv2/Context.h"
 
-namespace gl
+namespace rx
 {
 
 struct TranslatedAttribute
@@ -64,7 +64,7 @@
     ~ArrayVertexBuffer();
 
     std::size_t size() const { return mBufferSize; }
-    virtual void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
+    virtual void *map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
     virtual void reserveRequiredSpace() = 0;
     void addRequiredSpace(UINT requiredSpace);
 
@@ -80,7 +80,7 @@
     StreamingVertexBuffer(rx::Renderer9 *renderer, std::size_t initialSize);
     ~StreamingVertexBuffer();
 
-    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
+    void *map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
     void reserveRequiredSpace();
 };
 
@@ -90,10 +90,10 @@
     explicit StaticVertexBuffer(rx::Renderer9 *renderer);
     ~StaticVertexBuffer();
 
-    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
+    void *map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
     void reserveRequiredSpace();
 
-    std::size_t lookupAttribute(const VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
+    std::size_t lookupAttribute(const gl::VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
 
   private:
     struct VertexElement
@@ -116,21 +116,21 @@
     VertexDataManager(rx::Renderer9 *renderer);
     virtual ~VertexDataManager();
 
-    GLenum prepareVertexData(const VertexAttribute attribs[], ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
+    GLenum prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
 
   private:
     DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
 
-    std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count, GLsizei instances) const;
-    std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute, GLsizei instances);
+    std::size_t spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances) const;
+    std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const gl::VertexAttribute &attribute, GLsizei instances);
 
     rx::Renderer9 *const mRenderer;   // D3D9_REPLACE
 
     StreamingVertexBuffer *mStreamingBuffer;
 
-    float mCurrentValue[MAX_VERTEX_ATTRIBS][4];
-    StreamingVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];
-    std::size_t mCurrentValueOffsets[MAX_VERTEX_ATTRIBS];
+    float mCurrentValue[gl::MAX_VERTEX_ATTRIBS][4];
+    StreamingVertexBuffer *mCurrentValueBuffer[gl::MAX_VERTEX_ATTRIBS];
+    std::size_t mCurrentValueOffsets[gl::MAX_VERTEX_ATTRIBS];
 
     // Attribute format conversion
     struct FormatConverter
@@ -158,7 +158,7 @@
     void checkVertexCaps(DWORD declTypes);
 
     unsigned int typeIndex(GLenum type) const;
-    const FormatConverter &formatConverter(const VertexAttribute &attribute) const;
+    const FormatConverter &formatConverter(const gl::VertexAttribute &attribute) const;
 };
 
 }
diff --git a/src/libGLESv2/renderer/VertexDeclarationCache.cpp b/src/libGLESv2/renderer/VertexDeclarationCache.cpp
index b69ad5d..2106c0b 100644
--- a/src/libGLESv2/renderer/VertexDeclarationCache.cpp
+++ b/src/libGLESv2/renderer/VertexDeclarationCache.cpp
@@ -41,7 +41,7 @@
     }
 }
 
-GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, gl::TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw)
+GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw)
 {
     *repeatDraw = 1;
 
diff --git a/src/libGLESv2/renderer/VertexDeclarationCache.h b/src/libGLESv2/renderer/VertexDeclarationCache.h
index f977eb6..4bfd0c6 100644
--- a/src/libGLESv2/renderer/VertexDeclarationCache.h
+++ b/src/libGLESv2/renderer/VertexDeclarationCache.h
@@ -26,7 +26,7 @@
     VertexDeclarationCache();
     ~VertexDeclarationCache();
 
-    GLenum applyDeclaration(IDirect3DDevice9 *device, gl::TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw);
+    GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw);
 
     void markStateDirty();
 
diff --git a/src/libGLESv2/renderer/vertexconversion.h b/src/libGLESv2/renderer/vertexconversion.h
index 5bb8b89..d3d373b 100644
--- a/src/libGLESv2/renderer/vertexconversion.h
+++ b/src/libGLESv2/renderer/vertexconversion.h
@@ -15,7 +15,7 @@
 
 #include "libGLESv2/Context.h" // Defines Index
 
-namespace gl
+namespace rx
 {
 
 // Conversion types: