gsdx sw: use acquire/release semantics for atomic operation

* Avoid the generation of memory barrier (mfence)
This commit is contained in:
Gregory Hainaut 2016-07-02 19:43:56 +02:00
parent 567976e822
commit 086dfc8a14
1 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@
GSTextureSW::GSTextureSW(int type, int width, int height) GSTextureSW::GSTextureSW(int type, int width, int height)
{ {
m_mapped.clear(); m_mapped.clear(std::memory_order_release);
m_size = GSVector2i(width, height); m_size = GSVector2i(width, height);
m_type = type; m_type = type;
m_format = 0; m_format = 0;
@ -68,7 +68,7 @@ bool GSTextureSW::Map(GSMap& m, const GSVector4i* r)
if(m_data != NULL && r2.left >= 0 && r2.right <= m_size.x && r2.top >= 0 && r2.bottom <= m_size.y) if(m_data != NULL && r2.left >= 0 && r2.right <= m_size.x && r2.top >= 0 && r2.bottom <= m_size.y)
{ {
if (!m_mapped.test_and_set()) if (!m_mapped.test_and_set(std::memory_order_acquire))
{ {
m.bits = (uint8*)m_data + m_pitch * r2.top + (r2.left << 2); m.bits = (uint8*)m_data + m_pitch * r2.top + (r2.left << 2);
m.pitch = m_pitch; m.pitch = m_pitch;
@ -82,7 +82,7 @@ bool GSTextureSW::Map(GSMap& m, const GSVector4i* r)
void GSTextureSW::Unmap() void GSTextureSW::Unmap()
{ {
m_mapped.clear(); m_mapped.clear(std::memory_order_release);
} }
bool GSTextureSW::Save(const string& fn, bool user_image, bool dds) bool GSTextureSW::Save(const string& fn, bool user_image, bool dds)