mirror of https://github.com/PCSX2/pcsx2.git
gsdx: add atomic for texture upload
V2: fix init of atomic flag object
This commit is contained in:
parent
1db5e0c0bf
commit
9bbb0fe1f6
|
@ -24,8 +24,8 @@
|
||||||
#include "GSPng.h"
|
#include "GSPng.h"
|
||||||
|
|
||||||
GSTextureSW::GSTextureSW(int type, int width, int height)
|
GSTextureSW::GSTextureSW(int type, int width, int height)
|
||||||
: m_mapped(0)
|
|
||||||
{
|
{
|
||||||
|
m_mapped.clear();
|
||||||
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(!_interlockedbittestandset(&m_mapped, 0))
|
while(m_mapped.test_and_set()) {}
|
||||||
{
|
{
|
||||||
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 = 0;
|
m_mapped.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
|
@ -29,7 +29,7 @@ class GSTextureSW : public GSTexture
|
||||||
|
|
||||||
int m_pitch;
|
int m_pitch;
|
||||||
void* m_data;
|
void* m_data;
|
||||||
long m_mapped;
|
std::atomic_flag m_mapped;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSTextureSW(int type, int width, int height);
|
GSTextureSW(int type, int width, int height);
|
||||||
|
|
Loading…
Reference in New Issue