Bug 616918 - Turn on ANGLE on Win64. r=bjacob
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 11 Aug 2011 19:17:54 +0900
changeset 74260 8628c51e497c4d483cc359e3b91be753faa42976
parent 74245 ddf95830a967af2ba480da2cdc7926746fc05579
child 74261 73351129648ba23724ec373f010d5c5ccf8ea335
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersbjacob
bugs616918
milestone8.0a1
Bug 616918 - Turn on ANGLE on Win64. r=bjacob
configure.in
gfx/angle/Makefile.in
gfx/angle/README.mozilla
gfx/angle/angle-r707.patch
gfx/angle/angle-win64.patch
gfx/angle/src/libEGL/Makefile.in
gfx/angle/src/libEGL/Surface.cpp
gfx/angle/src/libGLESv2/Makefile.in
gfx/angle/src/libGLESv2/VertexDataManager.cpp
gfx/angle/src/libGLESv2/VertexDataManager.h
--- a/configure.in
+++ b/configure.in
@@ -6034,18 +6034,16 @@ esac
 
 # The DirectX SDK libraries are split into x86 and x64 sub-directories
 case "${target_cpu}" in
 i*86)
   MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
   ;;
 x86_64)
   MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
-  # currently we disable ANGLE in 64bit builds
-  MOZ_ANGLE=
   ;;
 esac
 
 if test -n "$MOZ_ANGLE"; then
 MOZ_ARG_DISABLE_BOOL(angle,
 [  --disable-angle     Disable building of ANGLE for WebGL->D3D translation],
     MOZ_ANGLE=,
     MOZ_ANGLE=1)
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -118,19 +118,16 @@ CSRCS   = \
         memory.c \
         scanner.c \
         symbols.c \
         tokens.c \
 	$(NULL)
 
 DEFINES += -DANGLE_USE_NSPR -DANGLE_BUILD
 
-# ANGLE only on Win32 for now, the solution isn't set up
-# for 64-bit yet. This is handled by MOZ_ANGLE which the configure script
-# leaves undefined in the 64-bit case.
 ifdef MOZ_ANGLE
 
 # libEGL depends on (links against!) libGLESv2!
 DIRS = src/libGLESv2 src/libEGL
 
 libs::
 	expand "$(MOZ_D3DX9_CAB)" -F:$(MOZ_D3DX9_DLL) "$(DIST)/bin"
 	expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -7,16 +7,18 @@ Current revision: r653
 In this order:
   angle-nspr-misc.patch - don't bother with ANGLE_OS detection with NSPR
   angle-renaming.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
   angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
   angle-amap-arev-fix.patch - plain bug fix, this is ANGLE r699
   angle-r702.patch - this is ANGLE r702
   angle-limit-identifiers-to-250-chars.patch - see bug 675625
   angle-r712.patch - this is ANGLE r712
+  angle-win64.patch - Win64 support. This is ANGLE r697
+  angle-r707.patch - this is ANGLE r707 for Win64 bug fix
 
 In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
 
 == How to update this ANGLE copy ==
 
 1. Unapply patches
 2. Apply diff with new ANGLE version
 3. Reapply patches.
new file mode 100644
--- /dev/null
+++ b/gfx/angle/angle-r707.patch
@@ -0,0 +1,45 @@
+diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.cpp b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
+--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
++++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
+@@ -714,17 +714,17 @@ void StaticVertexBuffer::reserveRequired
+     {
+         // Already allocated
+     }
+     else UNREACHABLE();   // Static vertex buffers can't be resized
+ 
+     mRequiredSpace = 0;
+ }
+ 
+-UINT StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
++std::size_t StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
+ {
+     for (unsigned int element = 0; element < mCache.size(); element++)
+     {
+         if (mCache[element].type == attribute.mType &&  mCache[element].size == attribute.mSize && mCache[element].normalized == attribute.mNormalized)
+         {
+             if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
+             {
+                 return mCache[element].streamOffset;
+diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.h b/gfx/angle/src/libGLESv2/VertexDataManager.h
+--- a/gfx/angle/src/libGLESv2/VertexDataManager.h
++++ b/gfx/angle/src/libGLESv2/VertexDataManager.h
+@@ -88,17 +88,17 @@ class StaticVertexBuffer : public ArrayV
+ {
+   public:
+     explicit StaticVertexBuffer(IDirect3DDevice9 *device);
+     ~StaticVertexBuffer();
+ 
+     void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
+     void reserveRequiredSpace();
+ 
+-    UINT lookupAttribute(const VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
++    std::size_t lookupAttribute(const VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
+ 
+   private:
+     struct VertexElement
+     {
+         GLenum type;
+         GLint size;
+         bool normalized;
+         int attributeOffset;
+ 
new file mode 100644
--- /dev/null
+++ b/gfx/angle/angle-win64.patch
@@ -0,0 +1,235 @@
+diff --git a/gfx/angle/src/libEGL/Surface.cpp b/gfx/angle/src/libEGL/Surface.cpp
+--- a/gfx/angle/src/libEGL/Surface.cpp
++++ b/gfx/angle/src/libEGL/Surface.cpp
+@@ -285,17 +285,17 @@ void Surface::subclassWindow()
+     DWORD processId;
+     DWORD threadId = GetWindowThreadProcessId(mWindow, &processId);
+     if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId())
+     {
+         return;
+     }
+ 
+     SetLastError(0);
+-    LONG oldWndProc = SetWindowLong(mWindow, GWL_WNDPROC, reinterpret_cast<LONG>(SurfaceWindowProc));
++    LONG_PTR oldWndProc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
+     if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS)
+     {
+         mWindowSubclassed = false;
+         return;
+     }
+ 
+     SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
+     SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
+@@ -305,27 +305,27 @@ void Surface::subclassWindow()
+ void Surface::unsubclassWindow()
+ {
+     if(!mWindowSubclassed)
+     {
+         return;
+     }
+ 
+     // un-subclass
+-    LONG parentWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
++    LONG_PTR parentWndFunc = reinterpret_cast<LONG_PTR>(GetProp(mWindow, kParentWndProc));
+ 
+     // Check the windowproc is still SurfaceWindowProc.
+     // If this assert fails, then it is likely the application has subclassed the
+     // hwnd as well and did not unsubclass before destroying its EGL context. The
+     // application should be modified to either subclass before initializing the
+     // EGL context, or to unsubclass before destroying the EGL context.
+     if(parentWndFunc)
+     {
+-        LONG prevWndFunc = SetWindowLong(mWindow, GWL_WNDPROC, parentWndFunc);
+-        ASSERT(prevWndFunc == reinterpret_cast<LONG>(SurfaceWindowProc));
++        LONG_PTR prevWndFunc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, parentWndFunc);
++        ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
+     }
+ 
+     RemoveProp(mWindow, kSurfaceProperty);
+     RemoveProp(mWindow, kParentWndProc);
+     mWindowSubclassed = false;
+ }
+ 
+ bool Surface::checkForOutOfDateSwapChain()
+diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.cpp b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
+--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
++++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
+@@ -50,24 +50,24 @@ VertexDataManager::~VertexDataManager()
+     delete mStreamingBuffer;
+ 
+     for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+     {
+         delete mCurrentValueBuffer[i];
+     }
+ }
+ 
+-UINT VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
++std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
+ {
+     Buffer *buffer = attribute.mBoundBuffer.get();
+ 
+     int inputStride = attribute.stride();
+     int elementSize = attribute.typeSize();
+     const FormatConverter &converter = formatConverter(attribute);
+-    UINT streamOffset = 0;
++    std::size_t streamOffset = 0;
+ 
+     void *output = NULL;
+     
+     if (vertexBuffer)
+     {
+         output = vertexBuffer->map(attribute, spaceRequired(attribute, count), &streamOffset);
+     }
+ 
+@@ -198,17 +198,17 @@ GLenum VertexDataManager::prepareVertexD
+                     return GL_INVALID_OPERATION;
+                 }
+ 
+                 const FormatConverter &converter = formatConverter(attribs[i]);
+ 
+                 StaticVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
+                 ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : static_cast<ArrayVertexBuffer*>(mStreamingBuffer);
+ 
+-                UINT streamOffset = -1;
++                std::size_t streamOffset = -1;
+ 
+                 if (staticBuffer)
+                 {
+                     streamOffset = staticBuffer->lookupAttribute(attribs[i]);
+ 
+                     if (streamOffset == -1)
+                     {
+                         // Convert the entire buffer
+@@ -666,17 +666,17 @@ void StreamingVertexBuffer::reserveRequi
+ StaticVertexBuffer::StaticVertexBuffer(IDirect3DDevice9 *device) : ArrayVertexBuffer(device, 0, D3DUSAGE_WRITEONLY)
+ {
+ }
+ 
+ StaticVertexBuffer::~StaticVertexBuffer()
+ {
+ }
+ 
+-void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, UINT *streamOffset)
++void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset)
+ {
+     void *mapPtr = NULL;
+ 
+     if (mVertexBuffer)
+     {
+         HRESULT result = mVertexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, 0);
+         
+         if (FAILED(result))
+diff --git a/gfx/angle/src/libGLESv2/VertexDataManager.h b/gfx/angle/src/libGLESv2/VertexDataManager.h
+--- a/gfx/angle/src/libGLESv2/VertexDataManager.h
++++ b/gfx/angle/src/libGLESv2/VertexDataManager.h
+@@ -30,17 +30,17 @@ struct TranslatedAttribute
+     UINT stride;   // 0 means not to advance the read pointer at all
+ 
+     IDirect3DVertexBuffer9 *vertexBuffer;
+ };
+ 
+ class VertexBuffer
+ {
+   public:
+-    VertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
++    VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
+     virtual ~VertexBuffer();
+ 
+     void unmap();
+ 
+     IDirect3DVertexBuffer9 *getBuffer() const;
+ 
+   protected:
+     IDirect3DDevice9 *const mDevice;
+@@ -55,60 +55,60 @@ class ConstantVertexBuffer : public Vert
+   public:
+     ConstantVertexBuffer(IDirect3DDevice9 *device, float x, float y, float z, float w);
+     ~ConstantVertexBuffer();
+ };
+ 
+ class ArrayVertexBuffer : public VertexBuffer
+ {
+   public:
+-    ArrayVertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
++    ArrayVertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
+     ~ArrayVertexBuffer();
+ 
+-    UINT size() const { return mBufferSize; }
+-    virtual void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset) = 0;
++    std::size_t size() const { return mBufferSize; }
++    virtual void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
+     virtual void reserveRequiredSpace() = 0;
+     void addRequiredSpace(UINT requiredSpace);
+ 
+   protected:
+-    UINT mBufferSize;
+-    UINT mWritePosition;
+-    UINT mRequiredSpace;
++    std::size_t mBufferSize;
++    std::size_t mWritePosition;
++    std::size_t mRequiredSpace;
+ };
+ 
+ class StreamingVertexBuffer : public ArrayVertexBuffer
+ {
+   public:
+-    StreamingVertexBuffer(IDirect3DDevice9 *device, UINT initialSize);
++    StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize);
+     ~StreamingVertexBuffer();
+ 
+-    void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
++    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
+     void reserveRequiredSpace();
+ };
+ 
+ class StaticVertexBuffer : public ArrayVertexBuffer
+ {
+   public:
+     explicit StaticVertexBuffer(IDirect3DDevice9 *device);
+     ~StaticVertexBuffer();
+ 
+-    void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
++    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
+     void reserveRequiredSpace();
+ 
+     UINT lookupAttribute(const VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
+ 
+   private:
+     struct VertexElement
+     {
+         GLenum type;
+         GLint size;
+         bool normalized;
+         int attributeOffset;
+ 
+-        UINT streamOffset;
++        std::size_t streamOffset;
+     };
+ 
+     std::vector<VertexElement> mCache;
+ };
+ 
+ class VertexDataManager
+ {
+   public:
+@@ -117,18 +117,18 @@ class VertexDataManager
+ 
+     void dirtyCurrentValue(int index) { mDirtyCurrentValue[index] = true; }
+ 
+     GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs);
+ 
+   private:
+     DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
+ 
+-    UINT spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
+-    UINT writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
++    std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
++    std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
+ 
+     Context *const mContext;
+     IDirect3DDevice9 *const mDevice;
+ 
+     StreamingVertexBuffer *mStreamingBuffer;
+ 
+     bool mDirtyCurrentValue[MAX_VERTEX_ATTRIBS];
+     ConstantVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];
--- a/gfx/angle/src/libEGL/Makefile.in
+++ b/gfx/angle/src/libEGL/Makefile.in
@@ -134,14 +134,14 @@ CPPSRCS += \
   main.cpp \
   Surface.cpp \
   $(NULL)
 
 DEFFILE = $(srcdir)/libEGL.def
 
 include $(topsrcdir)/config/rules.mk
 
-EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" \
-                   "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/dxguid.lib" \
+EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib" \
+                   "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib" \
 		   "$(DIST)/lib/libGLESv2.lib" \
 		   dwmapi.lib \
 		   delayimp.lib \
 		   /delayload:dwmapi.dll
--- a/gfx/angle/src/libEGL/Surface.cpp
+++ b/gfx/angle/src/libEGL/Surface.cpp
@@ -285,17 +285,17 @@ void Surface::subclassWindow()
     DWORD processId;
     DWORD threadId = GetWindowThreadProcessId(mWindow, &processId);
     if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId())
     {
         return;
     }
 
     SetLastError(0);
-    LONG oldWndProc = SetWindowLong(mWindow, GWL_WNDPROC, reinterpret_cast<LONG>(SurfaceWindowProc));
+    LONG_PTR oldWndProc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
     if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS)
     {
         mWindowSubclassed = false;
         return;
     }
 
     SetProp(mWindow, kSurfaceProperty, reinterpret_cast<HANDLE>(this));
     SetProp(mWindow, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc));
@@ -305,27 +305,27 @@ void Surface::subclassWindow()
 void Surface::unsubclassWindow()
 {
     if(!mWindowSubclassed)
     {
         return;
     }
 
     // un-subclass
-    LONG parentWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
+    LONG_PTR parentWndFunc = reinterpret_cast<LONG_PTR>(GetProp(mWindow, kParentWndProc));
 
     // Check the windowproc is still SurfaceWindowProc.
     // If this assert fails, then it is likely the application has subclassed the
     // hwnd as well and did not unsubclass before destroying its EGL context. The
     // application should be modified to either subclass before initializing the
     // EGL context, or to unsubclass before destroying the EGL context.
     if(parentWndFunc)
     {
-        LONG prevWndFunc = SetWindowLong(mWindow, GWL_WNDPROC, parentWndFunc);
-        ASSERT(prevWndFunc == reinterpret_cast<LONG>(SurfaceWindowProc));
+        LONG_PTR prevWndFunc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, parentWndFunc);
+        ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc));
     }
 
     RemoveProp(mWindow, kSurfaceProperty);
     RemoveProp(mWindow, kParentWndProc);
     mWindowSubclassed = false;
 }
 
 bool Surface::checkForOutOfDateSwapChain()
--- a/gfx/angle/src/libGLESv2/Makefile.in
+++ b/gfx/angle/src/libGLESv2/Makefile.in
@@ -146,11 +146,11 @@ CPPSRCS	+= \
 	VertexDataManager.cpp \
 	$(NULL)
 
 DEFFILE = $(srcdir)/libGLESv2.def
 
 
 include $(topsrcdir)/config/rules.mk
 
-EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" \
-                   "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3dx9.lib" \
-		   "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/D3DCompiler.lib"
+EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib" \
+                   "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3dx9.lib" \
+		   "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/D3DCompiler.lib"
--- a/gfx/angle/src/libGLESv2/VertexDataManager.cpp
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.cpp
@@ -50,24 +50,24 @@ VertexDataManager::~VertexDataManager()
     delete mStreamingBuffer;
 
     for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
     {
         delete mCurrentValueBuffer[i];
     }
 }
 
-UINT VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
+std::size_t VertexDataManager::writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
 {
     Buffer *buffer = attribute.mBoundBuffer.get();
 
     int inputStride = attribute.stride();
     int elementSize = attribute.typeSize();
     const FormatConverter &converter = formatConverter(attribute);
-    UINT streamOffset = 0;
+    std::size_t streamOffset = 0;
 
     void *output = NULL;
     
     if (vertexBuffer)
     {
         output = vertexBuffer->map(attribute, spaceRequired(attribute, count), &streamOffset);
     }
 
@@ -198,17 +198,17 @@ GLenum VertexDataManager::prepareVertexD
                     return GL_INVALID_OPERATION;
                 }
 
                 const FormatConverter &converter = formatConverter(attribs[i]);
 
                 StaticVertexBuffer *staticBuffer = buffer ? buffer->getStaticVertexBuffer() : NULL;
                 ArrayVertexBuffer *vertexBuffer = staticBuffer ? staticBuffer : static_cast<ArrayVertexBuffer*>(mStreamingBuffer);
 
-                UINT streamOffset = -1;
+                std::size_t streamOffset = -1;
 
                 if (staticBuffer)
                 {
                     streamOffset = staticBuffer->lookupAttribute(attribs[i]);
 
                     if (streamOffset == -1)
                     {
                         // Convert the entire buffer
@@ -666,17 +666,17 @@ void StreamingVertexBuffer::reserveRequi
 StaticVertexBuffer::StaticVertexBuffer(IDirect3DDevice9 *device) : ArrayVertexBuffer(device, 0, D3DUSAGE_WRITEONLY)
 {
 }
 
 StaticVertexBuffer::~StaticVertexBuffer()
 {
 }
 
-void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, UINT *streamOffset)
+void *StaticVertexBuffer::map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset)
 {
     void *mapPtr = NULL;
 
     if (mVertexBuffer)
     {
         HRESULT result = mVertexBuffer->Lock(mWritePosition, requiredSpace, &mapPtr, 0);
         
         if (FAILED(result))
@@ -714,17 +714,17 @@ void StaticVertexBuffer::reserveRequired
     {
         // Already allocated
     }
     else UNREACHABLE();   // Static vertex buffers can't be resized
 
     mRequiredSpace = 0;
 }
 
-UINT StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
+std::size_t StaticVertexBuffer::lookupAttribute(const VertexAttribute &attribute)
 {
     for (unsigned int element = 0; element < mCache.size(); element++)
     {
         if (mCache[element].type == attribute.mType &&  mCache[element].size == attribute.mSize && mCache[element].normalized == attribute.mNormalized)
         {
             if (mCache[element].attributeOffset == attribute.mOffset % attribute.stride())
             {
                 return mCache[element].streamOffset;
--- a/gfx/angle/src/libGLESv2/VertexDataManager.h
+++ b/gfx/angle/src/libGLESv2/VertexDataManager.h
@@ -30,17 +30,17 @@ struct TranslatedAttribute
     UINT stride;   // 0 means not to advance the read pointer at all
 
     IDirect3DVertexBuffer9 *vertexBuffer;
 };
 
 class VertexBuffer
 {
   public:
-    VertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
+    VertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
     virtual ~VertexBuffer();
 
     void unmap();
 
     IDirect3DVertexBuffer9 *getBuffer() const;
 
   protected:
     IDirect3DDevice9 *const mDevice;
@@ -55,60 +55,60 @@ class ConstantVertexBuffer : public Vert
   public:
     ConstantVertexBuffer(IDirect3DDevice9 *device, float x, float y, float z, float w);
     ~ConstantVertexBuffer();
 };
 
 class ArrayVertexBuffer : public VertexBuffer
 {
   public:
-    ArrayVertexBuffer(IDirect3DDevice9 *device, UINT size, DWORD usageFlags);
+    ArrayVertexBuffer(IDirect3DDevice9 *device, std::size_t size, DWORD usageFlags);
     ~ArrayVertexBuffer();
 
-    UINT size() const { return mBufferSize; }
-    virtual void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset) = 0;
+    std::size_t size() const { return mBufferSize; }
+    virtual void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
     virtual void reserveRequiredSpace() = 0;
     void addRequiredSpace(UINT requiredSpace);
 
   protected:
-    UINT mBufferSize;
-    UINT mWritePosition;
-    UINT mRequiredSpace;
+    std::size_t mBufferSize;
+    std::size_t mWritePosition;
+    std::size_t mRequiredSpace;
 };
 
 class StreamingVertexBuffer : public ArrayVertexBuffer
 {
   public:
-    StreamingVertexBuffer(IDirect3DDevice9 *device, UINT initialSize);
+    StreamingVertexBuffer(IDirect3DDevice9 *device, std::size_t initialSize);
     ~StreamingVertexBuffer();
 
-    void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
+    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
     void reserveRequiredSpace();
 };
 
 class StaticVertexBuffer : public ArrayVertexBuffer
 {
   public:
     explicit StaticVertexBuffer(IDirect3DDevice9 *device);
     ~StaticVertexBuffer();
 
-    void *map(const VertexAttribute &attribute, UINT requiredSpace, UINT *streamOffset);
+    void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
     void reserveRequiredSpace();
 
-    UINT lookupAttribute(const VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
+    std::size_t lookupAttribute(const VertexAttribute &attribute);   // Returns the offset into the vertex buffer, or -1 if not found
 
   private:
     struct VertexElement
     {
         GLenum type;
         GLint size;
         bool normalized;
         int attributeOffset;
 
-        UINT streamOffset;
+        std::size_t streamOffset;
     };
 
     std::vector<VertexElement> mCache;
 };
 
 class VertexDataManager
 {
   public:
@@ -117,18 +117,18 @@ class VertexDataManager
 
     void dirtyCurrentValue(int index) { mDirtyCurrentValue[index] = true; }
 
     GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs);
 
   private:
     DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
 
-    UINT spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
-    UINT writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
+    std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count) const;
+    std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
 
     Context *const mContext;
     IDirect3DDevice9 *const mDevice;
 
     StreamingVertexBuffer *mStreamingBuffer;
 
     bool mDirtyCurrentValue[MAX_VERTEX_ATTRIBS];
     ConstantVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];