Bug 1076743 - Fixed angle compilation with mingw. (upstream part)
authorJacek Caban <jacek@codeweavers.com>
Mon, 06 Oct 2014 18:02:43 +0200
changeset 233556 80bf7cee307ef83fd78583c4f1011b155311d3f6
parent 233555 88bb2a142e10a6ea86a04f04ddf381ae42bea905
child 233557 0d22e31621232f51226cf2ea108c662002fc5d1c
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1076743
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1076743 - Fixed angle compilation with mingw. (upstream part)
gfx/angle/src/common/debug.h
gfx/angle/src/libEGL/Display.cpp
gfx/angle/src/libGLESv2.gypi
gfx/angle/src/libGLESv2/Constants.h
gfx/angle/src/libGLESv2/Context.cpp
gfx/angle/src/libGLESv2/Framebuffer.h
gfx/angle/src/libGLESv2/Texture.h
gfx/angle/src/libGLESv2/VertexArray.h
gfx/angle/src/libGLESv2/angletypes.h
gfx/angle/src/libGLESv2/constants.h
gfx/angle/src/libGLESv2/renderer/copyimage.cpp
gfx/angle/src/libGLESv2/renderer/copyimage.inl
gfx/angle/src/libGLESv2/renderer/d3d/DynamicHLSL.h
gfx/angle/src/libGLESv2/renderer/d3d/TextureD3D.cpp
gfx/angle/src/libGLESv2/renderer/d3d/TextureD3D.h
gfx/angle/src/libGLESv2/validationES.cpp
gfx/angle/src/third_party/trace_event/trace_event.h
--- a/gfx/angle/src/common/debug.h
+++ b/gfx/angle/src/common/debug.h
@@ -119,17 +119,17 @@ namespace gl
 // A macro that determines whether an object has a given runtime type.
 #if !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI))
 #define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type >(obj) != NULL)
 #else
 #define HAS_DYNAMIC_TYPE(type, obj) true
 #endif
 
 // A macro functioning as a compile-time assert to validate constant conditions
-#if defined(_MSC_VER) && _MSC_VER >= 1600
+#if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3))
 #define META_ASSERT_MSG(condition, msg) static_assert(condition, msg)
 #else
 #define META_ASSERT_CONCAT(a, b) a ## b
 #define META_ASSERT_CONCAT2(a, b) META_ASSERT_CONCAT(a, b)
 #define META_ASSERT_MSG(condition, msg) typedef int META_ASSERT_CONCAT2(COMPILE_TIME_ASSERT_, __LINE__)[static_cast<bool>(condition)?1:-1]
 #endif
 #define META_ASSERT(condition) META_ASSERT_MSG(condition, "compile time assertion failed.")
 
--- a/gfx/angle/src/libEGL/Display.cpp
+++ b/gfx/angle/src/libEGL/Display.cpp
@@ -9,16 +9,17 @@
 // [EGL 1.4] section 2.1.2 page 3.
 
 #include "libEGL/Display.h"
 
 #include <algorithm>
 #include <map>
 #include <vector>
 #include <sstream>
+#include <iterator>
 
 #include "common/debug.h"
 #include "common/mathutil.h"
 #include "libGLESv2/main.h"
 #include "libGLESv2/Context.h"
 #include "libGLESv2/renderer/SwapChain.h"
 
 #include "libEGL/main.h"
--- a/gfx/angle/src/libGLESv2.gypi
+++ b/gfx/angle/src/libGLESv2.gypi
@@ -41,16 +41,17 @@
             'common/utilities.cpp',
             'common/utilities.h',
             'common/version.h',
             'libGLESv2/BinaryStream.h',
             'libGLESv2/Buffer.cpp',
             'libGLESv2/Buffer.h',
             'libGLESv2/Caps.cpp',
             'libGLESv2/Caps.h',
+            'libGLESv2/Constants.h',
             'libGLESv2/Context.cpp',
             'libGLESv2/Context.h',
             'libGLESv2/Error.cpp',
             'libGLESv2/Error.h',
             'libGLESv2/Fence.cpp',
             'libGLESv2/Fence.h',
             'libGLESv2/Float16ToFloat32.cpp',
             'libGLESv2/Framebuffer.cpp',
@@ -82,17 +83,16 @@
             'libGLESv2/Uniform.cpp',
             'libGLESv2/Uniform.h',
             'libGLESv2/VertexArray.cpp',
             'libGLESv2/VertexArray.h',
             'libGLESv2/VertexAttribute.cpp',
             'libGLESv2/VertexAttribute.h',
             'libGLESv2/angletypes.cpp',
             'libGLESv2/angletypes.h',
-            'libGLESv2/constants.h',
             'libGLESv2/formatutils.cpp',
             'libGLESv2/formatutils.h',
             'libGLESv2/libGLESv2.cpp',
             'libGLESv2/libGLESv2.def',
             'libGLESv2/libGLESv2.rc',
             'libGLESv2/main.cpp',
             'libGLESv2/main.h',
             'libGLESv2/queryconversions.cpp',
rename from gfx/angle/src/libGLESv2/constants.h
rename to gfx/angle/src/libGLESv2/Constants.h
--- a/gfx/angle/src/libGLESv2/Context.cpp
+++ b/gfx/angle/src/libGLESv2/Context.cpp
@@ -28,16 +28,17 @@
 #include "libGLESv2/VertexArray.h"
 #include "libGLESv2/Sampler.h"
 #include "libGLESv2/validationES.h"
 #include "libGLESv2/TransformFeedback.h"
 
 #include "libEGL/Surface.h"
 
 #include <sstream>
+#include <iterator>
 
 namespace gl
 {
 
 Context::Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
     : mRenderer(renderer)
 {
     ASSERT(robustAccess == false);   // Unimplemented
@@ -336,17 +337,17 @@ void Context::deleteRenderbuffer(GLuint 
 }
 
 void Context::deleteFenceSync(GLsync fenceSync)
 {
     // The spec specifies the underlying Fence object is not deleted until all current
     // wait commands finish. However, since the name becomes invalid, we cannot query the fence,
     // and since our API is currently designed for being called from a single thread, we can delete
     // the fence immediately.
-    mResourceManager->deleteFenceSync(reinterpret_cast<GLuint>(fenceSync));
+    mResourceManager->deleteFenceSync(reinterpret_cast<uintptr_t>(fenceSync));
 }
 
 void Context::deleteVertexArray(GLuint vertexArray)
 {
     auto vertexArrayObject = mVertexArrayMap.find(vertexArray);
 
     if (vertexArrayObject != mVertexArrayMap.end())
     {
@@ -442,17 +443,17 @@ Texture *Context::getTexture(GLuint hand
 
 Renderbuffer *Context::getRenderbuffer(GLuint handle)
 {
     return mResourceManager->getRenderbuffer(handle);
 }
 
 FenceSync *Context::getFenceSync(GLsync handle) const
 {
-    return mResourceManager->getFenceSync(reinterpret_cast<GLuint>(handle));
+    return mResourceManager->getFenceSync(reinterpret_cast<uintptr_t>(handle));
 }
 
 VertexArray *Context::getVertexArray(GLuint handle) const
 {
     auto vertexArray = mVertexArrayMap.find(handle);
 
     if (vertexArray == mVertexArrayMap.end())
     {
--- a/gfx/angle/src/libGLESv2/Framebuffer.h
+++ b/gfx/angle/src/libGLESv2/Framebuffer.h
@@ -7,17 +7,17 @@
 // Framebuffer.h: Defines the gl::Framebuffer class. Implements GL framebuffer
 // objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
 
 #ifndef LIBGLESV2_FRAMEBUFFER_H_
 #define LIBGLESV2_FRAMEBUFFER_H_
 
 #include "common/angleutils.h"
 #include "common/RefCountObject.h"
-#include "constants.h"
+#include "Constants.h"
 
 namespace rx
 {
 class Renderer;
 }
 
 namespace gl
 {
--- a/gfx/angle/src/libGLESv2/Texture.h
+++ b/gfx/angle/src/libGLESv2/Texture.h
@@ -9,17 +9,17 @@
 // related functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
 
 #ifndef LIBGLESV2_TEXTURE_H_
 #define LIBGLESV2_TEXTURE_H_
 
 #include "common/debug.h"
 #include "common/RefCountObject.h"
 #include "libGLESv2/angletypes.h"
-#include "libGLESv2/constants.h"
+#include "libGLESv2/Constants.h"
 #include "libGLESv2/renderer/TextureImpl.h"
 #include "libGLESv2/Caps.h"
 
 #include "angle_gl.h"
 
 #include <vector>
 
 namespace egl
--- a/gfx/angle/src/libGLESv2/VertexArray.h
+++ b/gfx/angle/src/libGLESv2/VertexArray.h
@@ -9,17 +9,17 @@
 //   together to form a vertex array object. All state related to the definition of data used
 //   by the vertex processor is encapsulated in a vertex array object.
 //
 
 #ifndef LIBGLESV2_VERTEXARRAY_H_
 #define LIBGLESV2_VERTEXARRAY_H_
 
 #include "common/RefCountObject.h"
-#include "libGLESv2/constants.h"
+#include "libGLESv2/Constants.h"
 #include "libGLESv2/VertexAttribute.h"
 
 #include <vector>
 
 namespace rx
 {
 class Renderer;
 class VertexArrayImpl;
--- a/gfx/angle/src/libGLESv2/angletypes.h
+++ b/gfx/angle/src/libGLESv2/angletypes.h
@@ -4,17 +4,17 @@
 // found in the LICENSE file.
 //
 
 // angletypes.h : Defines a variety of structures and enum types that are used throughout libGLESv2
 
 #ifndef LIBGLESV2_ANGLETYPES_H_
 #define LIBGLESV2_ANGLETYPES_H_
 
-#include "libGLESv2/constants.h"
+#include "libGLESv2/Constants.h"
 #include "common/RefCountObject.h"
 
 namespace gl
 {
 class Buffer;
 class ProgramBinary;
 struct VertexAttribute;
 struct VertexAttribCurrentValueData;
--- a/gfx/angle/src/libGLESv2/renderer/copyimage.cpp
+++ b/gfx/angle/src/libGLESv2/renderer/copyimage.cpp
@@ -1,17 +1,17 @@
 //
 // Copyright (c) 2013 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.
 //
 
 // copyimage.cpp: Defines image copying functions
 
-#include "libGLESv2/renderer/copyImage.h"
+#include "libGLESv2/renderer/copyimage.h"
 
 namespace rx
 {
 
 void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest)
 {
     uint32_t argb = *reinterpret_cast<const uint32_t*>(source);
     *reinterpret_cast<uint32_t*>(dest) = (argb & 0xFF00FF00) |       // Keep alpha and green
--- a/gfx/angle/src/libGLESv2/renderer/copyimage.inl
+++ b/gfx/angle/src/libGLESv2/renderer/copyimage.inl
@@ -19,14 +19,14 @@ template <typename destType, typename co
 inline void WriteColor(const uint8_t *source, uint8_t *dest)
 {
     destType::writeColor(reinterpret_cast<destType*>(dest), reinterpret_cast<const gl::Color<colorDataType>*>(source));
 }
 
 template <typename sourceType, typename destType, typename colorDataType>
 inline void CopyPixel(const uint8_t *source, uint8_t *dest)
 {
-    colorType temp;
+    colorDataType temp;
     ReadColor<sourceType, colorDataType>(source, &temp);
     WriteColor<destType, colorDataType>(&temp, dest);
 }
 
 }
--- a/gfx/angle/src/libGLESv2/renderer/d3d/DynamicHLSL.h
+++ b/gfx/angle/src/libGLESv2/renderer/d3d/DynamicHLSL.h
@@ -5,17 +5,17 @@
 //
 // DynamicHLSL.h: Interface for link and run-time HLSL generation
 //
 
 #ifndef LIBGLESV2_RENDERER_DYNAMIC_HLSL_H_
 #define LIBGLESV2_RENDERER_DYNAMIC_HLSL_H_
 
 #include "common/angleutils.h"
-#include "libGLESv2/constants.h"
+#include "libGLESv2/Constants.h"
 
 #include "angle_gl.h"
 
 #include <vector>
 #include <map>
 
 namespace rx
 {
--- a/gfx/angle/src/libGLESv2/renderer/d3d/TextureD3D.cpp
+++ b/gfx/angle/src/libGLESv2/renderer/d3d/TextureD3D.cpp
@@ -124,17 +124,17 @@ bool TextureD3D::subImage(GLint xoffset,
                        GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const void *pixels, Image *image)
 {
     const void *pixelData = pixels;
 
     // CPU readback & copy where direct GPU copy is not supported
     if (unpack.pixelBuffer.id() != 0)
     {
         gl::Buffer *pixelBuffer = unpack.pixelBuffer.get();
-        unsigned int offset = reinterpret_cast<unsigned int>(pixels);
+        uintptr_t offset = reinterpret_cast<uintptr_t>(pixels);
         // TODO: setImage/subImage is the only place outside of renderer that asks for a buffers raw data.
         // This functionality should be moved into renderer and the getData method of BufferImpl removed.
         const void *bufferData = pixelBuffer->getImplementation()->getData();
         pixelData = static_cast<const unsigned char *>(bufferData) + offset;
     }
 
     if (pixelData != NULL)
     {
@@ -178,17 +178,17 @@ bool TextureD3D::fastUnpackPixels(const 
     {
         return true;
     }
 
     // In order to perform the fast copy through the shader, we must have the right format, and be able
     // to create a render target.
     ASSERT(mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat));
 
-    unsigned int offset = reinterpret_cast<unsigned int>(pixels);
+    uintptr_t offset = reinterpret_cast<uintptr_t>(pixels);
 
     return mRenderer->fastCopyBufferToTexture(unpack, offset, destRenderTarget, sizedInternalFormat, type, destArea);
 }
 
 GLint TextureD3D::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
 {
     if ((gl::isPow2(width) && gl::isPow2(height) && gl::isPow2(depth)) || mRenderer->getRendererExtensions().textureNPOT)
     {
--- a/gfx/angle/src/libGLESv2/renderer/d3d/TextureD3D.h
+++ b/gfx/angle/src/libGLESv2/renderer/d3d/TextureD3D.h
@@ -6,17 +6,17 @@
 
 // TextureD3D.h: Implementations of the Texture interfaces shared betweeen the D3D backends.
 
 #ifndef LIBGLESV2_RENDERER_TEXTURED3D_H_
 #define LIBGLESV2_RENDERER_TEXTURED3D_H_
 
 #include "libGLESv2/renderer/TextureImpl.h"
 #include "libGLESv2/angletypes.h"
-#include "libGLESv2/constants.h"
+#include "libGLESv2/Constants.h"
 
 namespace gl
 {
 class Framebuffer;
 }
 
 namespace rx
 {
--- a/gfx/angle/src/libGLESv2/validationES.cpp
+++ b/gfx/angle/src/libGLESv2/validationES.cpp
@@ -1641,17 +1641,17 @@ bool ValidateDrawElements(Context *conte
         return false;
     }
 
     // Use max index to validate if our vertex buffers are large enough for the pull.
     // TODO: offer fast path, with disabled index validation.
     // TODO: also disable index checking on back-ends that are robust to out-of-range accesses.
     if (elementArrayBuffer)
     {
-        unsigned int offset = reinterpret_cast<unsigned int>(indices);
+        uintptr_t offset = reinterpret_cast<uintptr_t>(indices);
         if (!elementArrayBuffer->getIndexRangeCache()->findRange(type, offset, count, indexRangeOut, NULL))
         {
             const void *dataPointer = elementArrayBuffer->getImplementation()->getData();
             const uint8_t *offsetPointer = static_cast<const uint8_t *>(dataPointer) + offset;
             *indexRangeOut = rx::IndexRangeCache::ComputeRange(type, offsetPointer, count);
         }
     }
     else
--- a/gfx/angle/src/third_party/trace_event/trace_event.h
+++ b/gfx/angle/src/third_party/trace_event/trace_event.h
@@ -582,17 +582,17 @@ const int zeroNumArgs = 0;
 const unsigned long long noEventId = 0;
 
 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers
 // are mangled with the Process ID so that they are unlikely to collide when the
 // same pointer is used on different processes.
 class TraceID {
 public:
     explicit TraceID(const void* id, unsigned char* flags) :
-        m_data(static_cast<unsigned long long>(reinterpret_cast<unsigned long>(id)))
+        m_data(static_cast<unsigned long long>(reinterpret_cast<uintptr_t>(id)))
     {
         *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
     }
     explicit TraceID(unsigned long long id, unsigned char* flags) : m_data(id) { (void)flags; }
     explicit TraceID(unsigned long id, unsigned char* flags) : m_data(id) { (void)flags; }
     explicit TraceID(unsigned int id, unsigned char* flags) : m_data(id) { (void)flags; }
     explicit TraceID(unsigned short id, unsigned char* flags) : m_data(id) { (void)flags; }
     explicit TraceID(unsigned char id, unsigned char* flags) : m_data(id) { (void)flags; }
@@ -783,44 +783,13 @@ private:
     struct Data {
         const unsigned char* categoryEnabled;
         const char* name;
     };
     Data* m_pdata;
     Data m_data;
 };
 
-// TraceEventSamplingStateScope records the current sampling state
-// and sets a new sampling state. When the scope exists, it restores
-// the sampling state having recorded.
-template<size_t BucketNumber>
-class SamplingStateScope {
-public:
-    SamplingStateScope(const char* categoryAndName)
-    {
-        m_previousState = SamplingStateScope<BucketNumber>::current();
-        SamplingStateScope<BucketNumber>::set(categoryAndName);
-    }
-
-    ~SamplingStateScope()
-    {
-        SamplingStateScope<BucketNumber>::set(m_previousState);
-    }
-
-    // FIXME: Make load/store to traceSamplingState[] thread-safe and atomic.
-    static inline const char* current()
-    {
-        return reinterpret_cast<const char*>(*gl::traceSamplingState[BucketNumber]);
-    }
-    static inline void set(const char* categoryAndName)
-    {
-        *gl::traceSamplingState[BucketNumber] = reinterpret_cast<long>(const_cast<char*>(categoryAndName));
-    }
-
-private:
-    const char* m_previousState;
-};
-
 } // namespace TraceEvent
 
 } // namespace gl
 
 #endif