Use unordered_map instead of hash_map on GCC

stdext namespace is a non-standard extension. Use standard std::unordered_map on GCC. Issue=358 Signed-of-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/trunk@1260 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 1825d8e5
...@@ -11,7 +11,12 @@ ...@@ -11,7 +11,12 @@
#define LIBEGL_SHADER_CACHE_H_ #define LIBEGL_SHADER_CACHE_H_
#include <d3d9.h> #include <d3d9.h>
#ifdef _MSC_VER
#include <hash_map> #include <hash_map>
#else
#include <unordered_map>
#endif
namespace egl namespace egl
{ {
...@@ -89,7 +94,15 @@ class ShaderCache ...@@ -89,7 +94,15 @@ class ShaderCache
return mDevice->CreatePixelShader(function, shader); return mDevice->CreatePixelShader(function, shader);
} }
typedef stdext::hash_map<std::string, ShaderObject*> Map; #ifndef HASH_MAP
# ifdef _MSC_VER
# define HASH_MAP stdext::hash_map
# else
# define HASH_MAP std::unordered_map
# endif
#endif
typedef HASH_MAP<std::string, ShaderObject*> Map;
Map mMap; Map mMap;
IDirect3DDevice9 *mDevice; IDirect3DDevice9 *mDevice;
......
...@@ -17,8 +17,13 @@ ...@@ -17,8 +17,13 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include <d3d9.h> #include <d3d9.h>
#include <string>
#include <map> #include <map>
#ifdef _MSC_VER
#include <hash_map> #include <hash_map>
#else
#include <unordered_map>
#endif
#include "common/angleutils.h" #include "common/angleutils.h"
#include "common/RefCountObject.h" #include "common/RefCountObject.h"
...@@ -548,15 +553,23 @@ class Context ...@@ -548,15 +553,23 @@ class Context
BindingPointer<Texture2D> mTexture2DZero; BindingPointer<Texture2D> mTexture2DZero;
BindingPointer<TextureCubeMap> mTextureCubeMapZero; BindingPointer<TextureCubeMap> mTextureCubeMapZero;
typedef stdext::hash_map<GLuint, Framebuffer*> FramebufferMap; #ifndef HASH_MAP
# ifdef _MSC_VER
# define HASH_MAP stdext::hash_map
# else
# define HASH_MAP std::unordered_map
# endif
#endif
typedef HASH_MAP<GLuint, Framebuffer*> FramebufferMap;
FramebufferMap mFramebufferMap; FramebufferMap mFramebufferMap;
HandleAllocator mFramebufferHandleAllocator; HandleAllocator mFramebufferHandleAllocator;
typedef stdext::hash_map<GLuint, Fence*> FenceMap; typedef HASH_MAP<GLuint, Fence*> FenceMap;
FenceMap mFenceMap; FenceMap mFenceMap;
HandleAllocator mFenceHandleAllocator; HandleAllocator mFenceHandleAllocator;
typedef stdext::hash_map<GLuint, Query*> QueryMap; typedef HASH_MAP<GLuint, Query*> QueryMap;
QueryMap mQueryMap; QueryMap mQueryMap;
HandleAllocator mQueryHandleAllocator; HandleAllocator mQueryHandleAllocator;
......
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#ifdef _MSC_VER
#include <hash_map> #include <hash_map>
#else
#include <unordered_map>
#endif
#include "common/angleutils.h" #include "common/angleutils.h"
#include "libGLESv2/HandleAllocator.h" #include "libGLESv2/HandleAllocator.h"
...@@ -79,22 +83,30 @@ class ResourceManager ...@@ -79,22 +83,30 @@ class ResourceManager
std::size_t mRefCount; std::size_t mRefCount;
typedef stdext::hash_map<GLuint, Buffer*> BufferMap; #ifndef HASH_MAP
# ifdef _MSC_VER
# define HASH_MAP stdext::hash_map
# else
# define HASH_MAP std::unordered_map
# endif
#endif
typedef HASH_MAP<GLuint, Buffer*> BufferMap;
BufferMap mBufferMap; BufferMap mBufferMap;
HandleAllocator mBufferHandleAllocator; HandleAllocator mBufferHandleAllocator;
typedef stdext::hash_map<GLuint, Shader*> ShaderMap; typedef HASH_MAP<GLuint, Shader*> ShaderMap;
ShaderMap mShaderMap; ShaderMap mShaderMap;
typedef stdext::hash_map<GLuint, Program*> ProgramMap; typedef HASH_MAP<GLuint, Program*> ProgramMap;
ProgramMap mProgramMap; ProgramMap mProgramMap;
HandleAllocator mProgramShaderHandleAllocator; HandleAllocator mProgramShaderHandleAllocator;
typedef stdext::hash_map<GLuint, Texture*> TextureMap; typedef HASH_MAP<GLuint, Texture*> TextureMap;
TextureMap mTextureMap; TextureMap mTextureMap;
HandleAllocator mTextureHandleAllocator; HandleAllocator mTextureHandleAllocator;
typedef stdext::hash_map<GLuint, Renderbuffer*> RenderbufferMap; typedef HASH_MAP<GLuint, Renderbuffer*> RenderbufferMap;
RenderbufferMap mRenderbufferMap; RenderbufferMap mRenderbufferMap;
HandleAllocator mRenderbufferHandleAllocator; HandleAllocator mRenderbufferHandleAllocator;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment