Commit Graph

2345 Commits

Author SHA1 Message Date
Gregory Hainaut 6323268f40 gsdx tc: reset dirty alpha flag when we lookup a frame
Fix black skin regression for haunting ground (at least on my gs dump)
2016-09-02 21:31:13 +02:00
Gregory Hainaut c9a1558c60 gsdx: save the blit buffer register when a transfer is started
Fix motocross mania missing texture. Close #1319

As far as I understand, transfer is initialized in DIR. But the real
write only occured later so the blit buffer could have been overwritten
by a new value.

BLIT 0 13700
TREG 40 40
DIR 0 0
BLIT 0 13f00 <=== the bad guy
Write! ...  => 0x3f00 W:1 F:C_32 (DIR 00), dPos(0 0) size(64 64)

v2: set a value in m_tr.m_blit for load state
2016-09-01 09:59:38 +02:00
Gregory Hainaut b546d096bd Finally AMD delivered the fix to support separate shader object !!!
v2: blacklist AMD driver from the start of 2016
Please note that it is highly recommended to upgrade to a stable&working driver
2016-09-01 09:47:57 +02:00
Gregory Hainaut 448fee76c1 gsdx ogl: move GS setup in SetupIA
Fix regression when geometry shader is disabled
2016-09-01 09:47:46 +02:00
Gregory Hainaut 165bcf5662 Merge pull request #1539 from FlatOutPS2/DX
GSdx DX: extend ATE to better support additional corner case DX port
2016-08-29 11:39:22 +02:00
Gregory Hainaut 19a9d639b1 Merge pull request #1538 from PCSX2/gsdx-improved-ate
gsdx ogl: extend ATE to better support additional corner case (issue …
2016-08-29 11:38:57 +02:00
Gregory Hainaut da688114f4 Merge pull request #1522 from PCSX2/gsdx-issue-1438
gsdx tc: don't partially invalidate small target
2016-08-28 16:51:25 +02:00
Gregory Hainaut e4337b6631 glsl2h: add input files in the header
Close #1404
2016-08-28 16:31:35 +02:00
Gregory Hainaut a1cdf7189a gsdx tc: don't partially invalidate small target
It creates a regression on game that uses a small temporary target to
upload textures of various sizes. Inital code was done to handle direct
frame write (background, FMV) so big target
2016-08-28 16:24:02 +02:00
FlatOutPS2 e5c6b2e952 GSdx DX: extend ATE to better support additional corner case DX port
Port for Direct3D renderers of PR #1538.
2016-08-28 15:13:15 +02:00
Gregory Hainaut 7103707aeb gsdx: new linux option linear_present
Purpose is to control the filtering when final image is displayed on the screen

Could improve the sharpness of the output in some games (ofc, it will be pixelated)
2016-08-27 19:23:12 +02:00
Gregory Hainaut 2b925e0103 gsdx ogl: extend ATE to better support additional corner case (issue #1499)
When depth primitive is constant and depth test is greater or equal, we can
execute the depth write after color (depth status will only depends on the initial
value)

New case for RGB_ONLY ate:
If the blending equation uses a fixed alpha or a source alpha. We can postpone the alpha write
in a 2nd pass.
If depth can also be postponed, we can guarantee the order of correctness of the value.
1st pass => do RGB
2nd pass => do Alpha & Depth

It fixed Stuntman letter rendering :) Remaining of the game is still broken :(
2016-08-27 14:46:10 +02:00
Gregory Hainaut b6693c4345 gsdx dx/gl: fix depth optimization
4th bit is the fog value, not the depth
2016-08-27 13:57:39 +02:00
Gregory Hainaut 411a25b610 Merge pull request #1531 from PCSX2/clang-tidy-empty-instead-of-size
pcsx2|common|gsdx: use empty() instead of .size() ==/!= 0 check
2016-08-26 10:05:01 +02:00
Gregory Hainaut 5a1cb00a07 Merge pull request #1517 from FlatOutPS2/DX
Gsdx alpha test improvement DX
2016-08-25 09:25:19 +02:00
Gregory Hainaut 1fb2c66a21 gsdx ogl: Unscale line
Line thickness will be increased to N pixels (N is the upscaling factor).

Code will also be enabled by UserHacks_unscale_point_line = 1
2016-08-22 18:18:12 +02:00
Gregory Hainaut 018895067b gsdx ogl: restore code to unscale point
enabled by UserHacks_unscale_point_line = 1

Point will be transformed into a NxN square sprite. (N is the upscaling factor)
2016-08-22 18:18:12 +02:00
Gregory Hainaut 1a8825b374 pcsx2|common|gsdx: use empty() instead of .size() ==/!= 0 check
Enhance readability reported by clang tidy
2016-08-21 17:20:13 +02:00
Gregory Hainaut 8ee2d3d367 gsdx: use static assert when possible
reported by clang tidy
2016-08-21 15:22:09 +02:00
Jonathan Li 2b2042e1c2 gsdx: Allow screenshot compression level to be changed
At higher resolutions it takes too much time to save a screenshot at the
maximum compression level. So let's allow the user to set the
compression level.

This re-uses the png_compression_level setting. The default compression
level is 1 for speed, but if the user wishes to increase the compression
level (without using an external tool) and doesn't mind if the
screenshot takes more time to save then they can increase the
compression level up to a maximum of 9 (which can take quite a while).

Fixes #1527.
2016-08-20 14:01:24 +01:00
Gregory Hainaut d6b834e8af gsdx hw: don't execute blit fmv with target
Avoid invalid operation due to depth buffer
2016-08-20 12:56:30 +02:00
Gregory Hainaut fa826b3167 gsdx tc: check compatible bit when wrote in middle of target
All maths are wrong otherwise. Fix half screen issue in WRC
2016-08-20 11:57:15 +02:00
Gregory Hainaut a49b3c9bf6 gsdx tc: log more stuff on texture cache dirty & frame format 2016-08-20 11:52:22 +02:00
FlatOutPS2 87eed3965e GSDx GSRendererDX code improvement
Replace local copies context and env with m_ prefix originals.
2016-08-19 16:02:49 +02:00
FlatOutPS2 c5cd716c20 Gsdx alpha test improvement DX
Port for the DX renderers of the alpha test improvement for OGL created by gregory38.
2016-08-19 15:59:54 +02:00
Gregory Hainaut 765b68458a gsdx: improve logging
Don't enable UpdateValidity print by default (+20~25% on log size)
Only useful in rare cases
2016-08-17 21:23:06 +02:00
Gregory Hainaut 19ceea4f1e Merge branch 'strict-aliasing' 2016-08-17 18:53:08 +02:00
Jonathan Li d36002a02a gsdx:cmake: Use PNG_LIBRARIES instead of PNG_LIBRARY
PNG_LIBRARIES adds both libpng and zlib to the command line.
PNG_LIBRARY only adds libpng to the linker command line, and the cmake
documentation also suggests not to use it.
2016-08-16 20:35:21 +01:00
Gregory Hainaut fa249a3f78 gsdx ogl: don't rely on the Z value in m_vt
Value seems wrongly rounded and you can't distinguish 0xFFFF from 0xFFFE

Instead check that depth is constant for the draw call and the value from the vertex buffer

Fix recent regression on GTA (and likely various games)
2016-08-16 07:30:52 +02:00
Gregory Hainaut 5c7e2432bd gsdx-ogl: improve alpha test for GTA vice city (letters)
I don't understand why but it seems depth is rounded down even in 16 bits.
So uses 0xFFFE to enable ate_all_color_then_depth in 16 bits format too :)
2016-08-15 11:38:07 +02:00
Gregory Hainaut 5fbf702500 gsdx ogl: new optimization to bypass the alpha test
In FB_ONLY mode the alpha test impacts (discard) only the depth value.
If there is no depth buffer, we don't care about depth write. So alpha
test is useless and we can do the draw with a single draw call and no program
switch
2016-08-15 11:35:24 +02:00
Gregory Hainaut b62859ffa2 gsdx ogl: only enable the alternate alpha test in FB_ONLY
RGB_ONLY requires to handle the alpha channel in the alpha test
2016-08-15 11:25:19 +02:00
Gregory Hainaut 0417a10483 gsdx: allow strict aliasing optimization 2016-08-14 21:01:40 +02:00
Gregory Hainaut 2e7fab7813 gsdx sw: avoid aliasing issue, clear function was wrong anyway
Value must be un-normalized. Function is only used with 0.0 so
API was updated to only use the 0 case.
2016-08-14 21:01:09 +02:00
Gregory Hainaut 90707f8d4e gsdx: avoid aliasing issue
Extend GSVector to support float move

Initial code likely used integer move for performance reason. However due to
the nan correction, register is now in float domain.
2016-08-14 20:48:34 +02:00
Gregory Hainaut 447e0d0336 Merge pull request #1514 from PCSX2/gsdx-nouveau-driver
Gsdx alpha test improvement
2016-08-14 20:29:09 +02:00
Gregory Hainaut 15db7eeb81 gsdx: use correct format in printf
u => unsigned
d => signed

zu => size_t
2016-08-13 12:48:35 +02:00
Gregory Hainaut 0a1454ff6c gsdx: use prefix increment operator for non-primitive type
I think compiler is clever enough to optimize the code but it won't hurt
and it reduces the number of cpp check warning.
2016-08-12 23:11:26 +02:00
Gregory Hainaut dc2864ad7a gsdx hw: avoid a null deferenced false-positive in coverity
It is a false positive because it supposes that PRIM->TME is both true and false.

It is the first Schrodinger's variable ;)
2016-08-12 23:02:06 +02:00
Gregory Hainaut 1a09712f89 gsdx: init m_custom_width/height to a default value
Avoid useless warning on coverity
2016-08-12 22:48:20 +02:00
Gregory Hainaut c41cf6c444 gsdx: init variable in constructor
CID 168626 (#1 of 1): Uninitialized scalar field
uninit_member: Non-static class member m_end_block is not initialized in this constructor nor in any functions that it calls.
2016-08-12 22:45:17 +02:00
Gregory Hainaut 41afd85a5d gsdx sw: fix GCC warning enumeral and non-enumeral type in conditional expression 2016-08-12 19:30:14 +02:00
Gregory Hainaut 88b7470c07 gsdx: use const qualifier to avoid gcc (false positive) warning
variable  might be clobbered by ‘longjmp’ or ‘vfork’

Only remains warning for 2 variables: success & image
2016-08-12 19:30:14 +02:00
Gregory Hainaut 19e992869a Merge pull request #1512 from PCSX2/gsdx-dynamic-thread-height
gsdx sw: add extrathreads_height to control the quantity of pixels pr…
2016-08-12 15:52:13 +02:00
Gregory Hainaut 332ef5892b gsdx: replace hardcoded constant with nice enum 2016-08-11 22:30:34 +02:00
Gregory Hainaut 8b94320524 gsdx ogl: implement another algo to handle alpha test
Fix rendering issue on letters on Kengo/burnout 3/...

Default algo will execute the alpha test in 2 passes. However due to blending
you can't handle accurately the color.

Fortunately for us, the rendering uses an always pass depth test so you
can execute first all the color rendering (which doesn't depends on the alpha test)
And then the depth part which depends on the alpha test.
2016-08-11 21:15:17 +02:00
Gregory Hainaut 866173a481 gsdx ogl: move zbuffer emulation code into a dedicated function
* Code was factorized a bit with the help of max_z
* Add an extra optimization if test is ZTST_GEQUAL and min z value is
the biggest value. Z test will always be pass.
Note: due to float rounding (23 bits mantissa vs 24 bits depth) the test
is done against 0xFF_FFFE and not 0xFF_FFFF. It is wrong but GPU will
also use float so impact will be null.
2016-08-11 21:14:58 +02:00
Gregory Hainaut 1fa9e3fc93 gsdx ogl: align shader self test to atst previous change 2016-08-10 11:30:13 +02:00
Gregory Hainaut 74822d6ba3 gsdx ogl: rework atst handling
* Move the rounding operation in the constant buffer
* Merge less with less equal. And merge greater with greater equal

Need test
2016-08-10 11:30:11 +02:00
Gregory Hainaut 9a188a87c2 gsdx ogl: move ATST emulation in a dedicated function
Future commit will try to reduce the number of Alpha Test possibilities
2016-08-09 20:53:44 +02:00
Gregory Hainaut fb2182dd9b gsdx small nitpick 2016-08-09 15:15:30 +02:00
Gregory Hainaut 0dcce91a6e Merge pull request #1504 from ssakash/RemoveFunction
GSDX: Remove GetDeviceSize()
2016-08-08 16:15:07 +02:00
Akash bc24e90070 GSDX: Remove GetDeviceSize()
It's not used anywhere and it doesn't seem needed.
2016-08-07 12:43:03 +05:30
Jonathan Li af60501fb6 windows: Remove unused solution files and property sheets
The solution files are unused and for ancient Visual Studio versions -
GSDumpGUI has its own solution file, and bin2cpp is included in the main
solution file.

The property sheets have either fallen out of use or were never used in
the first place.
2016-08-04 23:09:08 +01:00
Jonathan Li 869f4d1898 gsdx: Only set ini path in GSdxApp::Init() if it's empty
Fixes a regression introduced by 46ba9aa117,
where the Linux GS replayer would always use the options in inis/GSdx.ini
(or use the default options if that doesn't exist) to replay the dump,
instead of using the GSdx.ini from the specified ini folder.
2016-08-04 00:53:50 +01:00
Gregory Hainaut e9e1b33884 gsdx: log a nice string instead of the hex format of PSM 2016-08-03 18:07:54 +02:00
Gregory Hainaut 41bede60eb gsdx replayer: fix broken init in replayer
"regression" from previous defered init
2016-08-03 11:57:56 +02:00
Gregory Hainaut 27f313ee16 gsdx hw: limit OI_GsMemClear to large clear
Help to reduce the speed impact
2016-08-03 11:23:23 +02:00
Jonathan Li f978f9a07d Merge pull request #1477 from turtleli/gsdx-defer-init
gsdx: Avoid illegal instruction crash on older CPUs
2016-08-02 23:00:19 +01:00
Gregory Hainaut 16affc9ef4 gsdx tc: potentially fix a regression
Update done on f712c5c6d0

Previous code use the size of the draw to compute latest block. I
don't know why I use .x/.y which are the origin offset so the start of the block.
2016-08-02 15:35:28 +02:00
Jonathan Li 44f90efb93 gsdx:psx: Fix illegal instruction crash on old CPUs
Check the instruction set first in GPUinit, GPUconfigure and GPUtext
to prevent unsupported vector instructions from being executed.

Move the vector initialisation in GPUinit to a separate function - it
avoids a vzeroupper instruction.
2016-08-01 19:38:23 +01:00
Gregory Hainaut 92ae8a5be7 gsdx sw: print current draw call of GetSizeFixedTEX0
To easily detect compare with hardware renderer
2016-07-31 13:19:38 +02:00
Gregory Hainaut 1ea83ba3a7 gsdx debug: log current area of the draw
This way it is easier to see which part of the texture is read, and which part
of the framebuffer is updated
2016-07-31 13:19:38 +02:00
Adam Diffin 6376e8d6e7 Just a simple grammar fix. (#1489) 2016-07-31 01:23:35 +01:00
Gregory Hainaut 140fe74ca2 gsdx ogl: fix bad blending regression
(when accurate blending is disabled)

Regression was introduced in 29c97a9bf2 (11th June)
2016-07-30 09:59:53 +02:00
Gregory Hainaut 242ac26299 Merge pull request #1485 from ssakash/HPO_Custom
GSDX-TextureCache: Port Half pixel offset hack for custom resolutions
2016-07-29 15:07:02 +02:00
FlatOutPS2 02b0451d3c GSdx: Star Ocean 3 depth issue fix
Fixes issue #1475
2016-07-29 12:13:26 +02:00
FlatOutPS2 91e07727e3 GSdx Add missing CRC hacks 2016-07-29 12:12:52 +02:00
Akash dbad57b8e8 GSDX: Silence an implicit conversion warning
OMSetBlendState() doesn't accept passing a float value as it's argument
(AKA actual parameter).
2016-07-28 18:58:06 +05:30
Akash 47f69f694a GSDX-TextureCache: Port Half pixel offset hack for custom resolutions 2016-07-28 18:45:23 +05:30
Gregory Hainaut 620876e0e7 gsdx: fix compilation error with ICC
just require the -restrict compilation flag
2016-07-28 11:01:28 +02:00
Jonathan Li a9f9c1406c Merge pull request #1474 from turtleli/windows-64-bit-fixes
Windows 64-bit compile fixes
2016-07-28 00:19:04 +01:00
Jonathan Li 7e30d16797 gsdx: Use char array instead of string for name
"static string str;" causes a SIGILL signal on a "Nehalem" (SSE4.2)
QEMU VM when compiled with GCC 6.1.1.
2016-07-27 23:34:16 +01:00
Jonathan Li 46ba9aa117 gsdx: Defer GSdxApp initialisation on Linux only
vector push_back causes a SIGILL signal on a Nehalem (SSE4.2) QEMU VM
when compiled with GCC 6.1.1.

However, an empty constructor causes illegal instruction exceptions to be
generated on a Windows VM.

So here's an inbetween that looks stupid but works on what I've tested.
2016-07-27 23:34:15 +01:00
Jonathan Li 9f53987e3b gsdx: Use map for GSCRC::m_map
Visual Studio 2015 initialises unordered_map using vector instructions,
which can cause PCSX2 to crash if the instructions aren't supported.
2016-07-27 23:34:14 +01:00
Jonathan Li e5ea4cc5d4 gsdx: Defer vector initialisation to GS/GPUinit
It can cause PCSX2 to crash if the instructions aren't supported.
2016-07-27 23:34:14 +01:00
Jonathan Li d726d4d4aa gsdx: Add AVX2 to instruction set test
Also add a newline to the error message and report AVX/AVX2 instead of
SSE5.00 and SSE5.01.
2016-07-27 23:34:12 +01:00
Gregory Hainaut 7fa55c39f1 Merge pull request #1479 from ssakash/custom_fixes
GSDX-TextureCache: Add proper rounding when unscaling texture size
2016-07-27 22:31:21 +02:00
Gregory Hainaut d6383e6c21 Merge pull request #1472 from PCSX2/gsdx-gta-depth-issue-1457
Gsdx gta depth issue 1457
2016-07-26 18:40:53 +02:00
Akash d3ebd4b318 GSDX-TextureCache: Add proper rounding when unscaling texture size
Fixes flickering issues on Dragon Ball Z Budokai Tenkaichi FMV's on custom resolution, might also help prevent some crashes on custom resolution.
2016-07-26 18:28:07 +05:30
ramapcsx2 c592ccb3e5 Merge pull request #1435 from ssakash/Custom_TextureCache
GSDX: Improve scaling of custom resolution
2016-07-26 14:07:19 +02:00
Jonathan Li 5719bddbb5 gsdx:windows: Change m_colorspace to INT_PTR
Fixes a 64-bit compile error.
2016-07-23 02:19:28 +01:00
Gregory Hainaut aea75f51bd gsdx tc: partial support of pseudo depth for Dx
Fix #1457 (GTA)

The game uses a depth format for a pure color buffer (cokes do ravage
in gaming industry)

However I'm really afraid that it migth break another effect in other games.
2016-07-22 20:38:46 +02:00
Gregory Hainaut 7d35e15fea Merge pull request #1444 from PCSX2/atomic-relax
Atomic relax
2016-07-22 18:36:02 +02:00
Gregory Hainaut 9182a287e2 Merge pull request #1469 from PCSX2/valgrind-memleak
Valgrind memleak
2016-07-22 18:17:37 +02:00
Gregory Hainaut 1e3c46a6bb gsdx ogl: purge debug message in destructor
Allow to see latest error and avoid noise in Valgrind log
2016-07-21 09:51:16 +02:00
Gregory Hainaut b6a55f50ab gsdx ogl: fully initialise PSConstantBuffer structure 2016-07-21 09:51:16 +02:00
Jonathan Li e25e8bc580 plugins: Tidy/standardise VS projects
Combine all the different configurations together so the project files
are more generic and maintainable.

Also standardise the layout so all the project files will be similar and
all have the same standard elements (even if empty).

Add 64-bit configurations.

Additional specifics:
spu2-x: FLOAT_SAMPLES preprocessor definition removed since it's unused.
2016-07-19 23:25:12 +01:00
Gregory Hainaut 25bc2dff07 gsdx: dump and log EE texture read
It gives a visual opportunity to detect a bad read of the texture cache
2016-07-14 19:45:06 +02:00
Gregory Hainaut f76bf9dddc gsdx: dump and log EE texture read
It gives a visual opportunity to detect a bad read of the texture cache
2016-07-14 19:41:21 +02:00
Gregory Hainaut 086dfc8a14 gsdx sw: use acquire/release semantics for atomic operation
* Avoid the generation of memory barrier (mfence)
2016-07-14 18:29:41 +02:00
Gregory Hainaut d855bc5ca8 gsdx sw: improve exit condition of SW extra thread
Use a relaxed atomic to read the exit variable in the hot path

Wait that exit is deasserted in the destructor, so we are sure the
thread will "soon" return
2016-07-14 18:29:22 +02:00
Gregory Hainaut abc9f7d096 gsdx tc: log unsupported LookupDepthSource 2016-07-14 18:29:22 +02: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
Gregory Hainaut 85fb55a0e1 gsdx ogl: memory management take 3
Add a factor 2 on the VRAM to get the quantity of available memory for the textures.
The driver is allowed to put some textures in RAM. Of course it is bad for performance
but it won't crash.

Due to the 4GB by process limit, I keep a (reasonable) maximum of 3.8GB.

In order to avoid a crash when memory is too low an exception will be risen
with no guarantee on rendering and big performance impact. In this situation
you ought to reduce upscaling/disable large framebuffer.
2016-07-10 10:23:23 +02:00
Gregory Hainaut a37cd40ce3 gsdx ogl: only print an error when VRAM is low
Until a better solution is found or people buy better GPU :)
2016-07-09 11:43:28 +02:00
Gregory Hainaut a2086ed458 gsdx profiler: drop latest frame time
Value is out of the chart. I'm not even sure it is a real frame so let's just remove it.
2016-07-09 10:03:21 +02:00
Gregory Hainaut 82d83ca579 gsdx: dull driver
Hopefully futur low-end GPU will get 4GB of VRAM
2016-07-08 21:53:42 +02:00
Gregory Hainaut 3f03f7333c gsdx: improve builtin profiler
* Does the first vsync (start counter) after the sleep
* Dump data after the rendering, avoid to count extra destructor,sleep time
* Dump data into a basic csv file (if people want nice graph)
2016-07-08 21:47:53 +02:00