diff --git a/plugins/GSdx/GSDevice11.h b/plugins/GSdx/GSDevice11.h index edf27ec367..02e3629c92 100644 --- a/plugins/GSdx/GSDevice11.h +++ b/plugins/GSdx/GSDevice11.h @@ -145,17 +145,17 @@ public: // TODO // Shaders... - hash_map m_vs; + std::unordered_map m_vs; CComPtr m_vs_cb; - hash_map > m_gs; + std::unordered_map> m_gs; CComPtr m_gs_cb; - hash_map > m_ps; + std::unordered_map> m_ps; CComPtr m_ps_cb; - hash_map > m_ps_ss; + std::unordered_map> m_ps_ss; CComPtr m_palette_ss; CComPtr m_rt_ss; - hash_map > m_om_dss; - hash_map > m_om_bs; + std::unordered_map> m_om_dss; + std::unordered_map> m_om_bs; VSConstantBuffer m_vs_cb_cache; GSConstantBuffer m_gs_cb_cache; diff --git a/plugins/GSdx/GSDevice9.h b/plugins/GSdx/GSDevice9.h index 20863806d7..560b030dd2 100644 --- a/plugins/GSdx/GSDevice9.h +++ b/plugins/GSdx/GSDevice9.h @@ -172,12 +172,12 @@ public: // TODO // Shaders... - hash_map m_vs; - hash_map > m_ps; - hash_map m_ps_ss; - hash_map m_om_dss; - hash_map m_om_bs; - hash_map m_mskfix; + std::unordered_map m_vs; + std::unordered_map> m_ps; + std::unordered_map m_ps_ss; + std::unordered_map m_om_dss; + std::unordered_map m_om_bs; + std::unordered_map m_mskfix; GSTexture* CreateMskFix(uint32 size, uint32 msk, uint32 fix); diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 0e584513ce..8e1fccc883 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -478,7 +478,7 @@ public: GLuint m_gs[1<<3]; GLuint m_ps_ss[1<<7]; GSDepthStencilOGL* m_om_dss[1<<5]; - hash_map m_ps; + std::unordered_map m_ps; GLuint m_apitrace; GLuint m_palette_ss; diff --git a/plugins/GSdx/GSFunctionMap.h b/plugins/GSdx/GSFunctionMap.h index a1b1d3d210..b47d97bb81 100644 --- a/plugins/GSdx/GSFunctionMap.h +++ b/plugins/GSdx/GSFunctionMap.h @@ -38,8 +38,8 @@ protected: VALUE f; }; - hash_map m_map; - hash_map m_map_active; + std::unordered_map m_map; + std::unordered_map m_map_active; ActivePtr* m_active; @@ -60,15 +60,15 @@ public: { m_active = NULL; - typename hash_map::iterator i = m_map_active.find(key); + auto it = m_map_active.find(key); - if(i != m_map_active.end()) + if(it != m_map_active.end()) { - m_active = i->second; + m_active = it->second; } else { - typename hash_map::iterator i = m_map.find(key); + auto i = m_map.find(key); ActivePtr* p = new ActivePtr(); @@ -108,11 +108,9 @@ public: { uint64 ttpf = 0; - typename hash_map::iterator i; - - for(i = m_map_active.begin(); i != m_map_active.end(); ++i) + for(const auto &i : m_map_active) { - ActivePtr* p = i->second; + ActivePtr* p = i.second; if(p->frames) { @@ -122,10 +120,10 @@ public: printf("GS stats\n"); - for(i = m_map_active.begin(); i != m_map_active.end(); ++i) + for (const auto &i : m_map_active) { - KEY key = i->first; - ActivePtr* p = i->second; + KEY key = i.first; + ActivePtr* p = i.second; if(p->frames && ttpf) { @@ -161,7 +159,7 @@ class GSCodeGeneratorFunctionMap : public GSFunctionMap { std::string m_name; void* m_param; - hash_map m_cgmap; + std::unordered_map m_cgmap; GSCodeBuffer m_cb; size_t m_total_code_size; @@ -186,7 +184,7 @@ public: { VALUE ret = NULL; - typename hash_map::iterator i = m_cgmap.find(key); + auto i = m_cgmap.find(key); if(i != m_cgmap.end()) { diff --git a/plugins/GSdx/GSLocalMemory.cpp b/plugins/GSdx/GSLocalMemory.cpp index 7384712a19..55fba4bed6 100644 --- a/plugins/GSdx/GSLocalMemory.cpp +++ b/plugins/GSdx/GSLocalMemory.cpp @@ -498,9 +498,9 @@ GSLocalMemory::~GSLocalMemory() for(auto &i : m_pomap) _aligned_free(i.second); for(auto &i : m_po4map) _aligned_free(i.second); - for(hash_map*>::iterator i = m_p2tmap.begin(); i != m_p2tmap.end(); ++i) + for(auto &i : m_p2tmap) { - delete [] i->second; + delete [] i.second; } } @@ -508,7 +508,7 @@ GSOffset* GSLocalMemory::GetOffset(uint32 bp, uint32 bw, uint32 psm) { uint32 hash = bp | (bw << 14) | (psm << 20); - hash_map::iterator i = m_omap.find(hash); + auto i = m_omap.find(hash); if(i != m_omap.end()) { @@ -539,11 +539,11 @@ GSPixelOffset* GSLocalMemory::GetPixelOffset(const GIFRegFRAME& FRAME, const GIF uint32 hash = (FRAME.FBP << 0) | (ZBUF.ZBP << 9) | (bw << 18) | (fpsm_hash << 24) | (zpsm_hash << 28); - hash_map::iterator i = m_pomap.find(hash); + auto it = m_pomap.find(hash); - if(i != m_pomap.end()) + if(it != m_pomap.end()) { - return i->second; + return it->second; } GSPixelOffset* off = (GSPixelOffset*)_aligned_malloc(sizeof(GSPixelOffset), 32); @@ -595,11 +595,11 @@ GSPixelOffset4* GSLocalMemory::GetPixelOffset4(const GIFRegFRAME& FRAME, const G uint32 hash = (FRAME.FBP << 0) | (ZBUF.ZBP << 9) | (bw << 18) | (fpsm_hash << 24) | (zpsm_hash << 28); - hash_map::iterator i = m_po4map.find(hash); + auto it = m_po4map.find(hash); - if(i != m_po4map.end()) + if(it != m_po4map.end()) { - return i->second; + return it->second; } GSPixelOffset4* off = (GSPixelOffset4*)_aligned_malloc(sizeof(GSPixelOffset4), 32); @@ -640,11 +640,11 @@ vector* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0) { uint64 hash = TEX0.u64 & 0x3ffffffffull; // TBP0 TBW PSM TW TH - hash_map*>::iterator i = m_p2tmap.find(hash); + auto it = m_p2tmap.find(hash); - if(i != m_p2tmap.end()) + if(it != m_p2tmap.end()) { - return i->second; + return it->second; } GSVector2i bs = m_psm[TEX0.PSM].bs; @@ -654,7 +654,7 @@ vector* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0) const GSOffset* off = GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM); - hash_map > tmp; // key = page, value = y:x, 7 bits each, max 128x128 tiles for the worst case (1024x1024 32bpp 8x8 blocks) + std::unordered_map> tmp; // key = page, value = y:x, 7 bits each, max 128x128 tiles for the worst case (1024x1024 32bpp 8x8 blocks) for(int y = 0; y < th; y += bs.y) { @@ -672,22 +672,20 @@ vector* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0) vector* p2t = new vector[MAX_PAGES]; - for(hash_map >::iterator i = tmp.begin(); i != tmp.end(); ++i) + for(const auto &i : tmp) { - uint32 page = i->first; + uint32 page = i.first; - hash_set& tiles = i->second; + auto& tiles = i.second; - hash_map m; + std::unordered_map m; - for(hash_set::iterator j = tiles.begin(); j != tiles.end(); ++j) + for(const auto addr : tiles) { - uint32 addr = *j; - uint32 row = addr >> 5; uint32 col = 1 << (addr & 31); - hash_map::iterator k = m.find(row); + auto k = m.find(row); if(k != m.end()) { @@ -704,9 +702,9 @@ vector* GSLocalMemory::GetPage2TileMap(const GIFRegTEX0& TEX0) // sort by x and flip the mask (it will be used to erase a lot of bits in a loop, [x] &= ~y) - for(hash_map::iterator j = m.begin(); j != m.end(); ++j) + for(const auto &j : m) { - p2t[page].push_back(GSVector2i(j->first, ~j->second)); + p2t[page].push_back(GSVector2i(j.first, ~j.second)); } std::sort(p2t[page].begin(), p2t[page].end(), cmp_vec2x); diff --git a/plugins/GSdx/GSLocalMemory.h b/plugins/GSdx/GSLocalMemory.h index 4e2ddd0d5c..e40daa9361 100644 --- a/plugins/GSdx/GSLocalMemory.h +++ b/plugins/GSdx/GSLocalMemory.h @@ -173,10 +173,10 @@ protected: // - hash_map m_omap; - hash_map m_pomap; - hash_map m_po4map; - hash_map*> m_p2tmap; + std::unordered_map m_omap; + std::unordered_map m_pomap; + std::unordered_map m_po4map; + std::unordered_map*> m_p2tmap; public: GSLocalMemory(); diff --git a/plugins/GSdx/GSRendererCS.cpp b/plugins/GSdx/GSRendererCS.cpp index d5ebb5cb7d..916845eed9 100644 --- a/plugins/GSdx/GSRendererCS.cpp +++ b/plugins/GSdx/GSRendererCS.cpp @@ -501,7 +501,7 @@ void GSRendererCS::Draw() { GSVertexShader11 vs; - hash_map::const_iterator i = m_vs.find(vs_sel); + auto i = std::as_const(m_vs).find(vs_sel); if(i != m_vs.end()) { @@ -558,7 +558,7 @@ void GSRendererCS::Draw() { gs_sel.prim = j == 0 ? m_vt.m_primclass : GS_SPRITE_CLASS; - hash_map >::const_iterator i = m_gs.find(gs_sel); + auto i = std::as_const(m_gs).find(gs_sel); if(i != m_gs.end()) { @@ -597,7 +597,7 @@ void GSRendererCS::Draw() CComPtr ps[2] = {m_ps0, NULL}; - hash_map >::const_iterator i = m_ps1.find(ps_sel); + auto i = std::as_const(m_ps1).find(ps_sel); if(i != m_ps1.end()) { @@ -825,7 +825,7 @@ bool GSRendererCS::GetOffsetBuffer(OffsetBuffer** fzbo) D3D11_SHADER_RESOURCE_VIEW_DESC srvd; D3D11_SUBRESOURCE_DATA data; - hash_map::iterator i = m_offset.find(m_context->offset.fzb->hash); + auto i = m_offset.find(m_context->offset.fzb->hash); if(i == m_offset.end()) { diff --git a/plugins/GSdx/GSRendererCS.h b/plugins/GSdx/GSRendererCS.h index 39108b5f48..250a6f2cc2 100644 --- a/plugins/GSdx/GSRendererCS.h +++ b/plugins/GSdx/GSRendererCS.h @@ -107,11 +107,11 @@ class GSRendererCS : public GSRenderer uint32 m_vm_valid[16]; CComPtr m_pb; //CComPtr m_pb; - hash_map m_vs; + std::unordered_map m_vs; CComPtr m_vs_cb; - hash_map > m_gs; + std::unordered_map> m_gs; CComPtr m_ps0; - hash_map > m_ps1; + std::unordered_map> m_ps1; CComPtr m_ps_cb; void Write(GSOffset* off, const GSVector4i& r); @@ -123,7 +123,7 @@ class GSRendererCS : public GSRenderer CComPtr row_srv, col_srv; }; - hash_map m_offset; + std::unordered_map m_offset; bool GetOffsetBuffer(OffsetBuffer** fzbo); diff --git a/plugins/GSdx/GSShaderOGL.h b/plugins/GSdx/GSShaderOGL.h index b4191edbdd..8051f6503c 100644 --- a/plugins/GSdx/GSShaderOGL.h +++ b/plugins/GSdx/GSShaderOGL.h @@ -23,7 +23,7 @@ class GSShaderOGL { GLuint m_pipeline; - hash_map m_program; + std::unordered_map m_program; const bool m_debug_shader; std::vector m_shad_to_delete; diff --git a/plugins/GSdx/GSTextureCache.h b/plugins/GSdx/GSTextureCache.h index cb8a56de4f..c24674927a 100644 --- a/plugins/GSdx/GSTextureCache.h +++ b/plugins/GSdx/GSTextureCache.h @@ -108,7 +108,7 @@ public: class SourceMap { public: - hash_set m_surfaces; + std::unordered_set m_surfaces; std::array, MAX_PAGES> m_map; uint32 m_pages[16]; // bitmap of all pages bool m_used; diff --git a/plugins/GSdx/GSTextureCacheSW.h b/plugins/GSdx/GSTextureCacheSW.h index 3212819e6c..a288051cfb 100644 --- a/plugins/GSdx/GSTextureCacheSW.h +++ b/plugins/GSdx/GSTextureCacheSW.h @@ -58,7 +58,7 @@ public: protected: GSState* m_state; - hash_set m_textures; + std::unordered_set m_textures; std::array, MAX_PAGES> m_map; public: diff --git a/plugins/GSdx/GSTextureFX11.cpp b/plugins/GSdx/GSTextureFX11.cpp index 0cb1524d8b..6f549621b1 100644 --- a/plugins/GSdx/GSTextureFX11.cpp +++ b/plugins/GSdx/GSTextureFX11.cpp @@ -99,7 +99,7 @@ bool GSDevice11::CreateTextureFX() void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb) { - hash_map::const_iterator i = m_vs.find(sel); + auto i = std::as_const(m_vs).find(sel); if(i == m_vs.end()) { @@ -160,7 +160,7 @@ void GSDevice11::SetupGS(GSSelector sel, const GSConstantBuffer* cb) bool Unscale_GSShader = (sel.point == 1 || sel.line == 1) && UserHacks_unscale_pt_ln; if((sel.prim > 0 && (sel.iip == 0 || sel.prim == 3)) || Unscale_GSShader) // geometry shader works in every case, but not needed { - hash_map >::const_iterator i = m_gs.find(sel); + auto i = std::as_const(m_gs).find(sel); if(i != m_gs.end()) { @@ -205,7 +205,7 @@ void GSDevice11::SetupGS(GSSelector sel, const GSConstantBuffer* cb) void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel) { - hash_map >::const_iterator i = m_ps.find(sel); + auto i = std::as_const(m_ps).find(sel); if(i == m_ps.end()) { @@ -286,7 +286,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe ssel.ltf = 0; } - hash_map >::const_iterator i = m_ps_ss.find(ssel); + auto i = std::as_const(m_ps_ss).find(ssel); if(i != m_ps_ss.end()) { @@ -327,7 +327,7 @@ void GSDevice11::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSe void GSDevice11::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix) { - hash_map >::const_iterator i = m_om_dss.find(dssel); + auto i = std::as_const(m_om_dss).find(dssel); if(i == m_om_dss.end()) { @@ -376,7 +376,7 @@ void GSDevice11::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uin OMSetDepthStencilState(i->second, 1); - hash_map >::const_iterator j = m_om_bs.find(bsel); + auto j = std::as_const(m_om_bs).find(bsel); if(j == m_om_bs.end()) { diff --git a/plugins/GSdx/GSTextureFX9.cpp b/plugins/GSdx/GSTextureFX9.cpp index 1637d33ff7..586286bf2a 100644 --- a/plugins/GSdx/GSTextureFX9.cpp +++ b/plugins/GSdx/GSTextureFX9.cpp @@ -30,7 +30,7 @@ GSTexture* GSDevice9::CreateMskFix(uint32 size, uint32 msk, uint32 fix) uint32 hash = (size << 20) | (msk << 10) | fix; - hash_map::iterator i = m_mskfix.find(hash); + auto i = m_mskfix.find(hash); if(i != m_mskfix.end()) { @@ -63,7 +63,7 @@ GSTexture* GSDevice9::CreateMskFix(uint32 size, uint32 msk, uint32 fix) void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb) { - hash_map::const_iterator i = m_vs.find(sel); + auto i = std::as_const(m_vs).find(sel); if(i == m_vs.end()) { @@ -133,7 +133,7 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel } } - hash_map >::const_iterator i = m_ps.find(sel); + auto i = std::as_const(m_ps).find(sel); if(i == m_ps.end()) { @@ -203,7 +203,7 @@ void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSel ssel.ltf = 0; } - hash_map::const_iterator i = m_ps_ss.find(ssel); + auto i = std::as_const(m_ps_ss).find(ssel); if(i != m_ps_ss.end()) { @@ -240,7 +240,7 @@ void GSDevice9::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint { Direct3DDepthStencilState9* dss = NULL; - hash_map::const_iterator i = m_om_dss.find(dssel); + auto i = std::as_const(m_om_dss).find(dssel); if(i == m_om_dss.end()) { @@ -282,7 +282,7 @@ void GSDevice9::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint OMSetDepthStencilState(i->second); - hash_map::const_iterator j = m_om_bs.find(bsel); + auto j = std::as_const(m_om_bs).find(bsel); if(j == m_om_bs.end()) { diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index 8f2d30597f..d3c904efbc 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -127,8 +127,6 @@ using namespace std; #include #include -#define hash_map unordered_map -#define hash_set unordered_set #ifdef _WIN32