Commit Graph

186 Commits

Author SHA1 Message Date
Gregory Hainaut 295f867118 gsdx: invalid alpha after an EE write
Typical wrong draw:
1/ draw in 32 bits
2/ draw in 24 bits
3/ Use alpha as a texure. (Must reuse the GPU data)
4/ Write alpha from EE
5/ Use alpha as a texure. (Must upload new data)

This commit fixes the step 5.

Fix #917 (Conflict - Desert Storm)
2015-10-24 16:23:50 +02:00
Gregory Hainaut 5fb8c7e65c gsdx: initialize members in constructor of objects
A couple of useless members were removed too.

Also fix wnd initialization

Coverity:
CID 146955 (#1 of 1): Uninitialized pointer read (UNINIT)
18. uninit_use: Using uninitialized value wnd[i].
2015-09-23 09:46:53 +02:00
Jonathan Li 69d27dfb4b Merge pull request #829 from ssakash/rework_internalres
gsdx changes:
Remove native resolution checkbox from GUI and rework associated code
Small changes to Windows and Linux GUI
Support 8x native resolution
Fix custom resolution width less than native width use case
2015-09-21 20:12:47 +01:00
Akash a9b0cfc519 GSDX: Add 8X native to Internal resolution. 2015-09-20 07:49:32 +05:30
Gregory Hainaut cee0fde940 gsdx-tc: improve support of TEXA register
* Greatly reduce the number of clut read (factor 10x)
* Avoid to get wrong TEXA texture in the cache.
* Fix "jump depends on uninitialized variable" Valgrind warning.

Fix #748

I try my best to avoid any breakage of DX but please test it too.
2015-09-11 14:16:11 +02:00
Gregory Hainaut ddc03cbccf gsdx: add a nice enum to replace the hardcoded convert shader 2015-09-08 16:51:24 +02:00
Gregory Hainaut 1ae0fed83b gsdx: fix a regression due to the shader renaming 2015-09-08 16:06:15 +02:00
Gregory Hainaut ca9b5ce11d gsdx-ogl: move depth conversion shader
Add 2 new shaders:
* ps_main12: cast a 16 bit depth to a RGB5A1 color
* ps_main16: cast a a RGB5A1 color to a 16 bit depth

Shader might be used in future commit as it seems Silent Hill uses this
kind of format.

Fix tab/indentation too
2015-09-08 12:41:05 +02:00
Gregory Hainaut d822b6bd1a gsdx-ogl: add some comments for the future 2015-08-08 09:17:06 +02:00
Gregory Hainaut 4a3c145c72 gsdx-ogl: depth support: better support of 16 bits z buffer
Fix issue in socom2
2015-08-01 01:28:41 +02:00
Gregory Hainaut f2c77ffa08 gsdx:tc: detect texture shuffle in previous frame
GoW2 uses the effect at the start of a new frame and therefore need the
state of the previous frame. (Note 1 issue remains)

Ricky need to be tested.
2015-07-26 10:14:07 +02:00
Gregory Hainaut 8be32e4661 gsdx-tc: fix a memory leak when depth isn't fully supported
Fix issue #642
2015-07-12 17:57:42 +02:00
Gregory Hainaut 5f8d3b9e4b gsdx-tc: remains in the memory
avoid a crash with kungfu panda
2015-07-11 14:35:35 +02:00
Gregory Hainaut 5ed45b6806 Merge pull request #644 from PCSX2/improve-texshuffle-detection
Improve texshuffle detection
2015-07-11 09:34:33 +02:00
Gregory Hainaut ec61ad3667 gsdx-tc: Add some code for the future
Partially invalidate RT when there is a write in the middle of it (actually 2 pages below)

Code is not yet enabled because
1/ I want to stabilize latest update
2/ not sure of the impact of the code
3/ maybe it need a more generic version
2015-07-10 22:35:26 +02:00
Gregory Hainaut 6f9a89dcf2 gsdx-debug: print memory usage of all textures pools
It is a bit crude but it allow to see the impact of code and options.
2015-07-10 22:35:26 +02:00
Gregory Hainaut ad86bb5faa gsdx-tc: clear 32 bits state after vsync
Avoid issue on game that uses only 16 bits RT
2015-07-09 23:03:55 +02:00
Gregory Hainaut 95e1cd9ea8 gsdx-tc: don't considerer frame as a 32 bits RT
Frame is always 32 bits but game can reuse it later as a 16 bits RT.

Fix half screen issue with Ricky Ponting Cricket

Unfortunately it triggers texture shuffle wrongly. I hope there is no
regression.
2015-07-04 11:00:32 +02:00
Gregory Hainaut 0a07762f6b gsdx-tc: only track 32 bits fmt if the texture is not a palette fmt
Fix a regression on ricky ponting cricket (texture shuffle was triggered without any valid reason)
2015-07-03 23:04:48 +02:00
Gregory Hainaut c6f026ee68 gsdx-tc: keep 32 bits status when converting from/to depth
Partially fix conan effect
2015-07-03 19:02:44 +02:00
Gregory Hainaut 28815db7cc gsdx: fix depth option 2015-07-02 19:13:38 +02:00
Gregory Hainaut 831c24de51 gsdx-dx: only enable new code when CRC is below FULL level
Code is not ready. It allow to test the new code without a massive
regression
2015-07-01 09:36:54 +02:00
Gregory Hainaut 074881228d gsdx:comment: small explanation of the half offset hack 2015-07-01 09:36:54 +02:00
Gregory Hainaut 6121677aa1 gsdx-tc: use a single shader pass to convert texture in 8 bits format
It might save a couple of fps

Add a define to test the perf if we keep only the blue channel. It brokes
the code in Prince Of Persia that use the Red/Green channel... Maybe the
speed hack :( Or find a way to replace all if with a lookup table

Note: it is only supported on OpenGL currently
2015-07-01 09:36:54 +02:00
Gregory Hainaut 2ecca529d1 gsdx-tc: log dirty target 2015-07-01 09:36:54 +02:00
Gregory Hainaut 2af7dcbda2 gsdx-tc: GPU accelerate 8 bits texture when upscaling is enabled
Code unscale the texture to ease the conversion. Quality is awful (same as before)
but I'm not sure we can support an upscaled texture

Maybe the quality loss is due to the reduction without mipmap

Maybe the best solution will be to add an hack to extract the blue channel
(with texture swizzle), and uses a "full page/screen" spirte instead.
(it would be faster too)

Note: won't be compatible with MSAA (but gl doesn't support it anyway)
2015-07-01 09:36:54 +02:00
Gregory Hainaut 6ca7a802bf gsdx-tc: add a big comment to explain the scaling of src in TC 2015-07-01 09:36:54 +02:00
Gregory Hainaut d29e375f72 gsdx-tc: GPU accelerate 8 bits texture conversion
Only native is supported currently
2015-07-01 09:36:54 +02:00
Gregory Hainaut a8bcc760b4 gsdx-tc: only clean RT in openGL
It is a debug feature for myself
2015-07-01 09:36:54 +02:00
Gregory Hainaut 61a717db14 gsdx-tc: clean the RT in debug build
// In theory new textures contain invalidated data. Still in theory a new target
// must contains the content of the GS memory.
// In practice, TC will wrongly invalidate some RT. For example due to write on the alpha
// channel but colors is still valid. Unfortunately TC doesn't support the upload of data
// in target.
//
// Cleaning the code here will likely break several games. However it might reduce
// the noise in draw call debugging. It is the main reason to enable it on debug build.
//
// From a performance point of view, it might cost a little on big upscaling
// but normally few RT are miss so it must remain reasonable.
2015-07-01 09:36:53 +02:00
Gregory Hainaut 99b03b4632 gsdx-debug: log all write (texture) from the EE
It is verbose but it might help to understand the invalidation of texture
2015-07-01 09:36:53 +02:00
Gregory Hainaut e66aac8ab7 gsdx-hw: add an hidden option to preload the final frame with GS mem data
Game can directly uploads a background or the full image in
"CTRC" buffer. Previous code was a full black screen.

It will also avoid various black screen issue in gs dump.

hidden option: preload_frame_with_gs_data

Note: impact on upscaling was not tested and it's likely broken
2015-07-01 09:36:53 +02:00
Gregory Hainaut 85543db094 gsdx-tc: trace the alpha channel update in TC
Improve the rendering in MGS3 (even if the game is still broken
due to others TC issues)

// Typical bug (MGS3 blue cloud):
// 1/ RT used as 32 bits => alpha channel written
// 2/ RT used as 24 bits => no update of alpha channel
// 3/ Lookup of texture that used alpha channel as index, HasSharedBits will return false
//    because of the previous draw call format
//
// Solution: consider the RT as 32 bits if the alpha was used in the past
2015-07-01 09:36:53 +02:00
Gregory Hainaut 9802ba6621 gsdx-tc: add support of pseudo 8 bits RT conversion
Code is obviously slow but at least it works.

It fixes the blur effect of VP2
2015-07-01 09:36:53 +02:00
Gregory Hainaut 77e718c61f gsdx: disable linear interpolation when converting texture in texture cache
It avoid various upscaling glitches on GS post-processing effect

// 1/ Palette is used to interpret the alpha channel of the RT as an index.
// Star Ocean 3 uses it to emulate a stencil buffer.
// 2/ Z formats are a bad idea to interpolate (discontinuties).
// 3/ 16 bits buffer is used to move data from a channel to another.
//
// I keep linear filtering for standard color even if I'm not sure that it is
// working correctly.
// Indeed, texture is reduced so you need to read all covered pixels (9 in 3x)
// to correctly interpolate the value. Linear interpolation is likely acceptable
// only in 2x scaling
//
// Src texture will still be bilinear interpolated so I'm really not sure
// that we need to do it here too.
//
// Future note: instead to do
// RT 2048x2048 -> T 1024x1024 -> RT 2048x2048
// We can maybe sample directly a bigger texture
// RT 2048x2048 -> T 2048x2048 -> RT 2048x2048
// Pro: better quality. Copy instead of StretchRect (must be faster)
// Cons: consume more memory
//
// In distant future: investigate to reuse the RT directly without any
// copy. Likely a speed boost and memory usage reduction.
2015-07-01 09:36:53 +02:00
Gregory Hainaut 87f54ae0ff gsdx: report error on unsupported case in texture cache
It seems to impacts lots of games that still have issue (VP2, MTG3, PoP)

The PSMT32 format is read a PSMT8. I think we need to convert it as PSMT8H (i.e.
unpack it to have only an alpha channel)
2015-07-01 09:36:53 +02:00
Gregory Hainaut 3b127f663b gsdx-tc: trace the texture format to detect texture shuffling
It fixes games that uses 16 bits RT (like snow engine games)
2015-07-01 09:36:53 +02:00
Gregory Hainaut 42e911c78f gsdx-ogl: mask alpha channel in depth conversion
Might not work if depth is recasted as a rt (we lost the alpha channel)
2015-07-01 09:30:20 +02:00
Gregory Hainaut 6b5a3dedd9 gsdx-debug: add the format in texture cache logging 2015-07-01 09:30:20 +02:00
Gregory Hainaut 7ee3dbd615 gsdx-tc: use the virtual function to check the state
This ways it will be disabled for dx
2015-07-01 09:30:20 +02:00
refractionpcsx2 de189b67a2 GSdx: Add option to toggle Texture Cache Depth support.
- Forced off for DX currently to save fallover.
2015-07-01 09:30:20 +02:00
Gregory Hainaut c925b1d135 gsdx-tc: support GS mem to depth buffer transfer
Please test SMT games

(issue #572)
2015-07-01 09:30:20 +02:00
Gregory Hainaut 58ce7d4bb8 gsdx-ogl: emulate texture shuffle
GS doesn't supports texture shuffle/swizzle so it is emulated in a
complex way.

The idea is to read/write the 32 bits color format as a 16 bit format.
This way, RG (16 lsb bits) or BA (16 msb bits) can be read or written with
square texture that targets pixels 1-8 or pixels 8-16.
However shuffle is limited. For example you can copy the green channel
to either the alpha channel or another green channel.

Note: Partial masking of channel is not yet implemented

V2: improve logging
V3: better support of green channel in shader
V4: improve detection of destination (issue due to rounding)
2015-07-01 09:30:20 +02:00
Gregory Hainaut 2d812deb84 gsdx-tc: Depth and Target are interchangeable on the GS !!!
Extend the texture cache to search Color target in Depth target
2015-07-01 09:30:20 +02:00
Gregory Hainaut 76160505f7 gsdx-tc: add an option to avoid blow up dx :p
texture_cache_depth = 1 (default for openGL)
2015-07-01 09:30:20 +02:00
Gregory Hainaut 74d84aafb5 gsdx-tc: allow to search the depth in the old target list
Yes it is possible on PS2 world
2015-07-01 09:30:20 +02:00
Gregory Hainaut b59a347ad7 gsdx-tc: allow to use depth buffer as input texture 2015-07-01 09:30:20 +02:00
Gregory Hainaut 49516cbbca gsdx-tc: allow to invalidate the depth/target if it is used as target/depth
It is requires when game will uses sometimes an address as a RT sometimes as a depth
2015-07-01 09:30:20 +02:00
Gregory Hainaut 8393ba56d6 gsdx-ogl: rework palette texture handling
Redirect the red channel to alpha channel for 8 bits texture.

It avoid special management in the shader
2015-06-24 19:50:09 +02:00
Gregory Hainaut b44bccec6a gsdx: fix previous commit with a scaling factor 2015-06-18 23:02:40 +02:00