GSdx: fixed shared_ptr for GCC, but it does not seem to be thread-safe in 4.4.5.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4995 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2011-12-19 01:20:55 +00:00
parent b7a70c9541
commit 2f401da58c
7 changed files with 82 additions and 65 deletions

View File

@ -69,28 +69,6 @@ GSTexture* GPURendererSW::GetOutput()
void GPURendererSW::Draw()
{
class GPURasterizerData : public GSRasterizerData
{
public:
GPURasterizerData()
{
GPUScanlineGlobalData* gd = (GPUScanlineGlobalData*)_aligned_malloc(sizeof(GPUScanlineGlobalData), 32);
gd->clut = NULL;
param = gd;
}
virtual ~GPURasterizerData()
{
GPUScanlineGlobalData* gd = (GPUScanlineGlobalData*)param;
if(gd->clut) _aligned_free(gd->clut);
_aligned_free(gd);
}
};
shared_ptr<GSRasterizerData> data(new GPURasterizerData());
GPUScanlineGlobalData& gd = *(GPUScanlineGlobalData*)data->param;

View File

@ -26,6 +26,28 @@
class GPURendererSW : public GPURendererT<GSVertexSW>
{
class GPURasterizerData : public GSRasterizerData
{
public:
GPURasterizerData()
{
GPUScanlineGlobalData* gd = (GPUScanlineGlobalData*)_aligned_malloc(sizeof(GPUScanlineGlobalData), 32);
gd->clut = NULL;
param = gd;
}
virtual ~GPURasterizerData()
{
GPUScanlineGlobalData* gd = (GPUScanlineGlobalData*)param;
if(gd->clut) _aligned_free(gd->clut);
_aligned_free(gd);
}
};
protected:
GSRasterizerList* m_rl;
GSTexture* m_texture;

View File

@ -820,7 +820,14 @@ void GSRasterizerMT::ThreadProc()
{
GSAutoLock l(&m_lock);
queue.swap(m_queue);
// TODO: queue.swap(m_queue); // GCC
while(!m_queue.empty())
{
queue.push(m_queue.front());
m_queue.pop();
}
}
while(!queue.empty())

View File

@ -147,7 +147,7 @@ void GSRendererSW::Draw()
Sync();
}
shared_ptr<GSRasterizerData> data(new GSRasterizerData2(this));
shared_ptr<GSRasterizerData> data(new GSRasterizerData2());
GSScanlineGlobalData* gd = (GSScanlineGlobalData*)data->param;

View File

@ -30,7 +30,7 @@ class GSRendererSW : public GSRendererT<GSVertexSW>
class GSRasterizerData2 : public GSRasterizerData
{
public:
GSRasterizerData2(GSRenderer* r)
GSRasterizerData2()
{
GSScanlineGlobalData* gd = (GSScanlineGlobalData*)_aligned_malloc(sizeof(GSScanlineGlobalData), 32);

View File

@ -118,6 +118,8 @@
<Unit filename="GSRasterizer.h" />
<Unit filename="GSRenderer.cpp" />
<Unit filename="GSRenderer.h" />
<Unit filename="GSRendererHW.cpp" />
<Unit filename="GSRendererHW.h" />
<Unit filename="GSRendererNull.cpp" />
<Unit filename="GSRendererNull.h" />
<Unit filename="GSRendererSW.cpp" />

View File

@ -92,6 +92,14 @@
using namespace std;
#ifdef __GNUC__
#include <tr1/memory>
using namespace std::tr1;
#endif
#ifdef _WINDOWS
#include <hash_map>