mirror of https://github.com/PCSX2/pcsx2.git
gsdx-thread: add a CAPACITY parameter to GSJobQueue
This commit is contained in:
parent
e7665ee7dd
commit
a4d6722b26
|
@ -53,7 +53,7 @@ namespace GSPng {
|
|||
|
||||
void Save(GSPng::Format fmt, const string& file, char* image, int w, int h, int pitch);
|
||||
|
||||
class Worker : public GSJobQueue<shared_ptr<Transaction> >
|
||||
class Worker : public GSJobQueue<shared_ptr<Transaction>, 16 >
|
||||
{
|
||||
public:
|
||||
Worker() {};
|
||||
|
|
|
@ -1211,7 +1211,7 @@ int GSRasterizerList::GetPixels(bool reset)
|
|||
// GSRasterizerList::GSWorker
|
||||
|
||||
GSRasterizerList::GSWorker::GSWorker(GSRasterizer* r)
|
||||
: GSJobQueue<shared_ptr<GSRasterizerData> >()
|
||||
: GSJobQueue<shared_ptr<GSRasterizerData>, 256>()
|
||||
, m_r(r)
|
||||
{
|
||||
}
|
||||
|
@ -1236,7 +1236,7 @@ void GSRasterizerList::GSWorker::Process(shared_ptr<GSRasterizerData>& item)
|
|||
// GSRasterizerList::GSWorkerSpin
|
||||
#ifdef ENABLE_BOOST
|
||||
GSRasterizerList::GSWorkerSpin::GSWorkerSpin(GSRasterizer* r)
|
||||
: GSJobQueueSpin<shared_ptr<GSRasterizerData> >()
|
||||
: GSJobQueueSpin<shared_ptr<GSRasterizerData>, 256>()
|
||||
, m_r(r)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
class GSRasterizerList : public IRasterizer
|
||||
{
|
||||
protected:
|
||||
class GSWorker : public GSJobQueue<shared_ptr<GSRasterizerData> >
|
||||
class GSWorker : public GSJobQueue<shared_ptr<GSRasterizerData>, 256 >
|
||||
{
|
||||
GSRasterizer* m_r;
|
||||
|
||||
|
@ -200,7 +200,7 @@ protected:
|
|||
};
|
||||
|
||||
#ifdef ENABLE_BOOST
|
||||
class GSWorkerSpin : public GSJobQueueSpin<shared_ptr<GSRasterizerData> >
|
||||
class GSWorkerSpin : public GSJobQueueSpin<shared_ptr<GSRasterizerData>, 256>
|
||||
{
|
||||
GSRasterizer* m_r;
|
||||
|
||||
|
|
|
@ -100,12 +100,12 @@ public:
|
|||
// This queue doesn't reserve any thread. It would be nicer for 2c/4c CPU.
|
||||
// pros: no hard limit on thread numbers
|
||||
// cons: less performance by thread
|
||||
template<class T> class GSJobQueue : public IGSJobQueue<T>
|
||||
template<class T, int CAPACITY> class GSJobQueue : public IGSJobQueue<T>
|
||||
{
|
||||
protected:
|
||||
std::atomic<int16_t> m_count;
|
||||
std::atomic<bool> m_exit;
|
||||
ringbuffer_base<T, 256> m_queue;
|
||||
ringbuffer_base<T, CAPACITY> m_queue;
|
||||
|
||||
std::mutex m_lock;
|
||||
std::condition_variable m_empty;
|
||||
|
@ -197,12 +197,12 @@ public:
|
|||
// 2/ But I highly suspect that waking up thread is rather slow. My guess
|
||||
// is that low power feature (like C state) increases latency. In this case
|
||||
// gain will be smaller if PCSX2 is running or in limited core CPU (<=4)
|
||||
template<class T> class GSJobQueueSpin : public IGSJobQueue<T>
|
||||
template<class T, int CAPACITY> class GSJobQueueSpin : public IGSJobQueue<T>
|
||||
{
|
||||
protected:
|
||||
std::atomic<int16_t> m_count;
|
||||
std::atomic<bool> m_exit;
|
||||
ringbuffer_base<T, 256> m_queue;
|
||||
ringbuffer_base<T, CAPACITY> m_queue;
|
||||
|
||||
std::mutex m_lock;
|
||||
std::condition_variable m_empty;
|
||||
|
|
Loading…
Reference in New Issue