Jonathan Li
ac78688a32
gsdx: Make GSJobQueue non-inheritable
...
In the previous code, the threads were created and destroyed in the base
class constructor and destructor, so the threads could potentially be
active while the object is in a partially constructed or destroyed state.
The thread however, relies on a virtual function to process the queue
items, and the vtable might not be in the desired state when the object
is partially constructed or destroyed.
This probably only matters during object destruction - no items are in
the queue during object construction so the virtual function won't be
called, but items may still be queued up when the destructor is called,
so the virtual function can be called. It wasn't an issue because all
uses of the thread explicitly waited for the queues to be empty before
invoking the destructor.
Adjust the constructor to take a std::function parameter, which the
thread will use instead to process queue items, and avoid inheriting
from the GSJobQueue class. This will also eliminate the need to
explicitly wait for all jobs to finish (unless there are other external
factors, of course), which would probably make future code safer.
2016-12-08 01:18:17 +00:00
Gregory Hainaut
e642bbc426
gsdx sw: add extrathreads_height to control the quantity of pixels processed by a thread
...
Value could range from 1 to 9. Default is 4 and it is potentially the
best option. Feel free to test some values on your system, behavior
might depends on the core number and thread number
Value is exponential so 4 is 2 times more pixels than 3.
Small value increased thread overhead, big value increase wait/sync latency
2016-07-10 17:48:10 +02:00
Gregory Hainaut
91eccb7bab
gsdx sw: increase the size of the ring buffer 256 => 65536
...
memory overhead by thead is only 256KB
However it will reduce the probability to block the push thread to nearly 0
I tested a couple of dumps and only manage 4000 element with 1 extrathread.
2016-07-10 10:49:06 +02:00
Jonathan Li
da2046e90e
gsdx: Use alignas instead of __aligned
...
__aligned is defined in FreeBSD headers and will cause compile errors.
2016-05-21 13:23:11 +01:00
Gregory Hainaut
19c9a0b441
gsdx: remove aggressive threading
...
http://wiki.pcsx2.net/index.php/PCSX2_Documentation/Threading_Basics
2015-11-20 17:36:03 +01:00
Gregory Hainaut
81e056e79a
gsdx: always enable the boost queue
...
ifdef was for VS2010
GSThread.h is useless. I keep it for the transactional queue implementation
2015-09-08 14:43:09 +02:00
Gregory Hainaut
a4d6722b26
gsdx-thread: add a CAPACITY parameter to GSJobQueue
2015-05-18 17:08:18 +02:00
Gregory Hainaut
d91e989abb
gsdx-queue: pass shared_ptr by reference
...
It avoids atomic +1/-1 of the reference counter
The counter is still incremented when the ptr is copyed into the queue
2015-04-17 19:12:36 +02:00
Gregory Hainaut
0aac47ca59
gsdx-queue: add a new option "spin_thread" to select the queue behavior at runtime
...
If someone has a more elegant solution, feel free to share it
spin_thread = 0
spin_thread = 1 // the faster but GS thread will never stop, very bad for laptop
2015-04-17 19:03:21 +02:00
Gregory Hainaut
9682061472
gsdx-queue:add a new job dispatcher queue based on boost and C++11
...
It is faster on linux, it requires less code, and it is "portable"
It requires boost (only hpp files) + MSVC 2013 (for atomic) (seem doable by 2012 too)
Actually there are several queues that either use spinlock or full sleep
2015-04-17 19:03:21 +02:00
gabest11
ddaa892726
Removed ATL/MFC dependencies from every project, the free version of visual studio does not have those. It compiles with vs2012 express now, will fix others later, in case they are broken.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5692 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-07-01 21:28:58 +00:00
gabest11@gmail.com
20d99ae9fc
GSdx: vs2010 fix and minor changes
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5678 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-06-23 10:46:24 +00:00
gabest11@gmail.com
8b9f5b5bc2
GSdx: More avx2 code to read/write different block formats, the GSBenchmark function shows nice improvements, but no games run faster. I just upload the changes before messing with the drawing part.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5675 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-06-17 04:11:10 +00:00
gregory.hainaut
e06484adb8
gsdx: update the copyrigh address thank to sed
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5412 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-09-09 18:16:11 +00:00
gabest11
19be605150
GSdx: this should fix xp/wine crashing when extrathreads > 0, and added a sprite drawing shortcut, hopefully won't break anything.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5089 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-02-08 16:57:14 +00:00
gabest11
9b8c753ead
GSdx: broken frame skipping should be fixed, and a few random sw renderer optimizations.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5077 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-01-21 04:44:04 +00:00
gabest11
9aabcc1701
GSdx: added a shortcut in GSState::Transfer for the most frequent vertex format I found (helps quite a lot), less thread-syncing for the sw renderer, and the bios boot logo was fixed (just had to clear the memory on reset).
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5072 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-01-18 11:47:31 +00:00
gabest11
da4ea83134
GSdx: nothing really new, just testing the compute shader, if you are an expert take a look and tell me your opinion :P
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5068 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-01-13 18:10:05 +00:00
gabest11
481f1fdda2
GSdx: it's hard to keep track of the leftover vertices properly, a bit of sps was still possible, psx sprites were fixed too
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5065 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-01-09 08:41:33 +00:00
gabest11
2eec75c2ae
GSdx: sps fixed, some code clean up and optimization, ps2 logo still broken in hw mode, I'll check it later
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5062 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-01-08 17:10:00 +00:00
gabest11
f68f007f00
GSdx: the promised index buffer update, needed a lot of changes, expect bugs in the next dozen revisions.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5045 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-01-05 02:40:24 +00:00
gabest11
5325f9b490
GSdx: Small optimizations here and there, just saving changes before trying to add an index buffer, that might help reducing load on the main gs thread a bit. That's where I think the bottleneck currently is in games with high polygon count.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5036 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-31 15:41:07 +00:00
gabest11
25072b99c7
GSdx: a few minor changes, please check if I wrapped the new pthread things correctly
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5019 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-27 09:15:35 +00:00
gabest11
2628d5bb7d
GSdx: a little refinement to the fix for the issue that come up with Bully.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5016 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-25 07:26:42 +00:00
gabest11
963a6a653a
GSdx: changes of r5007 did not help as much as I thought, disabled it for the time being, plus other minor optimizations
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5010 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-23 15:53:53 +00:00
gabest11
d5dbe7e7e9
GSdx: Moved filling up rendering threads on a new thread, to not block the main, it looks like now I can replace one of the spin loops with an event. Using events results in about -5% fps, but still pretty fast.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5007 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-22 14:36:54 +00:00
gabest11
2421c68bee
GSdx: Saving the conditional var update (vista or better) before I try a new idea again. That Sync() call is wasting too much time, if there was only one queue then the main thread could also grab and process elements instead of just waiting for the workers.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5005 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-22 01:48:16 +00:00
gabest11
0b62c17d9c
GSdx: Renamed the sw thread setting to "extra threads".
...
- 0: no multi-threading
- 1: gif packet processing and texture uploads run parallel with rendering, the slowest decides the fps, dual-cores can still suffer by the spin loops, I'll check that when I compile pcsx2 on my notebook
- 2: two rendering threads, on a decent cpu packet processing is going to be slower now, this is probably going to increase fps the most on quads
- 3: small fps increase
- 4+: even smaller.
If you have a quad cpu with HT, 6 is the max, 1 + 1 is needed for pcsx2 and gsdx's basic tasks.
Also hacked palette writes to not force a read-back in hw mode (added in previous rev), it hit render targets in a surprising large number of games.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4998 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-20 14:33:28 +00:00
gabest11
b7a70c9541
GSdx: Little bug slipped through.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4994 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-18 22:04:05 +00:00
gabest11
b86e3ebd19
GSdx: Polished the recent changes a bit. Single threaded mode should be back to normal, 2-4 threads might be faster or slower. All in all, it has a lot more potential now. Rendering is almost as separated as with d3d, everything needed is packed and copied for the worker threads, synchronization between local memory and the temporary buffers is properly done. This model could also be back-ported to d3d. Or the software rasterizers could be hardware assisted somehow, there are a lot less sync points where those buffers should match with the contents of the local memory.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4993 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-18 21:57:48 +00:00
gabest11
f318e84aca
GSdx: Better multi-threading for the sw renderer. Threads must be synchronized lot less, 1/10th in average, can run parallel longer and uses more cpu (bit more empty spinning, too). There could be some new bugs, as usual.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4992 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-18 08:13:20 +00:00
gabest11
4b77052d21
GSdx: just saving minor changes.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4991 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-16 19:13:58 +00:00
gabest11
0d7c58065a
GSdx: this fixes some of the flickering in THPS, objects in the far distance still have some z-fighting problem, z values used are too large and too close to each other.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4976 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-12-03 21:04:46 +00:00
gabest11
9d54677055
GSdx: re-implemented the drawing pipeline in c++, just for reference and easier debugging.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4972 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-11-25 23:48:59 +00:00
gabest11
d20da5f268
GSdx: 5-10% speedup in multi-threaded mode, replaced that modulo operator with a lookup table.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4505 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-03-29 14:07:48 +00:00
gabest11
47713eee81
GSdx: Replaced a few divs with something more obscure in DrawTriangle, it shares necessary calculations with the triangle setup for tile based rasterization ( http://drdobbs.com/article/print?articleId=217200602 ). AVX already has half the floating point capacity of larrabee, but I'm still thinking how to do this efficiently. We could take advantage of the block organized GS memory at last.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4498 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-03-27 15:46:32 +00:00
gabest11
8ca01f4b77
GSdx: only minor changes
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4494 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-03-27 03:12:12 +00:00
gabest11
b31634df8f
GSdx: using mipmap levels (only per batch, no tri-linear) and a couple of small changes, including the stdcall fix for linux.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4419 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-03-12 22:10:58 +00:00
gabest11
9586e38dd4
GSdx: still working on the rasterizer, would be nice to add some avx code there, but it's just so unfitting for anything.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4407 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-03-09 11:52:53 +00:00
gabest11
fe88ee4102
GSdx: optimized the triangle setup of the rasterizer a bit, while it isn't the bottle-neck of drawing, it can still add a few percent to the fps.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4404 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-03-08 01:48:15 +00:00
gabest11
3030166596
The core of GSdx is now compatible with intel's compiler on linux.
...
- GSWnd is not implemented, no config dialogs either
- no output, just the null device
- threading classes were not tested (my first experience with pthread)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4315 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-02-19 03:36:30 +00:00
gabest11
d44def8c0b
Fixed many gcc errors, there are still plenty. Intel's compiler might be a better alternative.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4311 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-02-18 01:56:05 +00:00
gabest11
257d57ba52
Tweaked the rasterizer to be about 10% faster in multi-threaded mode (2 or 3 threads), still far from optimal.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4308 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-02-17 18:22:47 +00:00
gabest11
6f18c0dabe
Trying to isolate the rasterizer step-by-step, for better multi-threading in the future.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4305 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-02-17 03:24:37 +00:00
gabest11
65fc196688
Local static initializers are evil, avoid them like plague.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4304 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-02-16 03:19:36 +00:00
gabest11
1e6f280021
- more project cleanups and small code changes, also added the psx emu interface again
...
- someone should check __xgetbv under linux (avx/fma detection)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4295 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-02-12 21:45:16 +00:00
gabest11
ca7abd983a
Mostly code cleanups, XBYAK 2.99, VEX conversion for the sw renderer (3-5% faster), GSState::Move fix for dark cloud 2 invention crash.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4287 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-02-07 01:59:05 +00:00
sudonim1
4457fe40fc
Removed all trailing whitespace in *.c *.cpp *.h because it irritates me.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2897 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-04-25 00:31:27 +00:00
arcum42
01aff16aac
GSdx: A few minor cleanups to nudge GSdx a little closer to being cross-platform compatible,
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2405 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-01-01 05:18:32 +00:00
Jake.Stine
97041701ae
GSdx: SW rasterizer converted to use pthreads semaphores in the place of spinwaits. Performance mileage will vary on this; probably favors dual core machines over quads or i7's. Some tinkering might ink some more fps out of it and get it to be a speedup in all cases though.
...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2296 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-03 23:08:52 +00:00