Commit Graph

2080 Commits

Author SHA1 Message Date
Gregory Hainaut 12b8704502 gsdx dx: disable channel shuffle 2016-04-30 14:52:43 +02:00
Gregory Hainaut b4c7d32741 gsdx ogl: avoid to wrongly detect a channel shuffle 2016-04-30 14:52:43 +02:00
Gregory Hainaut 1011a757a8 gsdx hw: factorize redundant code 2016-04-30 14:52:43 +02:00
Gregory Hainaut b78c772a14 gsdx: improve detection of channel shuffle
Improve rendering on Prince Of Persia (requires preload data hack)

Worth to re-test: MTGS2/3

Urban Chaos is a bit better but there still a bad overlay
2016-04-30 14:52:43 +02:00
Gregory Hainaut 02dff2653a gsdx hack: sort the file
* separate Dx only/aggresive hack
* add GSC_CrashNburn and GSC_BullyCC to Dx only section
2016-04-30 12:45:06 +02:00
Gregory Hainaut 60267790a1 gsdx: move (most) of the hw hack into a separate file
GSState.cpp was really too big
2016-04-30 12:24:08 +02:00
Gregory Hainaut 7a5e1d4154 gsdx ogl: allow to use a separate texture for the channel effect 2016-04-29 17:34:17 +02:00
Gregory Hainaut a9d25efcde gsdx ogl: extend state to support up to 8 textures 2016-04-29 17:34:17 +02:00
Gregory Hainaut e45f90fac3 gsdx: fix a gcc warning 2016-04-29 17:34:17 +02:00
Gregory Hainaut e195e67a48 gsdx: move Metal Gear Solid CRC to DX level
OpenGL is near perfect :)
2016-04-29 17:34:17 +02:00
Gregory Hainaut 5e5069423b Merge pull request #1321 from PCSX2/gsdx-preloadcrash
GSDX: Avoid crash when TBW == 0 - Preload data frame
2016-04-28 23:06:29 +02:00
Gregory Hainaut cb19451418 gsdx ogl: implement RT channel fetch
Fix blending of Metal Gear Solid/KillZone (and potentially other games)

Potentially impact issue #905, #594, #914, #896
2016-04-28 22:56:38 +02:00
Gregory Hainaut c445a14c46 gsdx ogl: extend shader to lookup a single channel 2016-04-28 22:56:38 +02:00
Gregory Hainaut eaa4fd41e2 gsdx ogl: improve logging of special effect 2016-04-28 22:56:38 +02:00
refractionpcsx2 0aa8fe0f20 GSDX: Avoid crash when TBW == 0 2016-04-28 21:36:21 +01:00
Gregory Hainaut f946f38f26 gsdx hw: keep the debug counter in sync
Otherwise I'm screwed :p
2016-04-28 20:03:53 +02:00
Gregory Hainaut 04a578495f gsdx hw: disable channel shuffle effect
Greatly reduce memory requirement for target
MGS3 at 4x: from 2680MB to 160MB

Remove a couple of (slow) draw calls
2016-04-28 19:46:26 +02:00
Gregory Hainaut f63e38a59e gsdx ogl: as always some games do bad stuff
Let's keep a comment for the moment. I don't know if we need to fix it, neither how.
2016-04-28 19:42:00 +02:00
Gregory Hainaut 45bfe2ad58 gsdx hw: trace some special post processing effect
* Double downscale is done in GTA
* Channel Shuffle is the top-left corner issue

So far nothing is emulated
2016-04-28 19:39:57 +02:00
Gregory Hainaut 5b04f4dab9 gsdx: add optimization note for the future 2016-04-28 18:01:21 +02:00
Gregory Hainaut 4808d89449 gsdx ogl: use enum pretty name 2016-04-28 18:01:20 +02:00
Gregory Hainaut ab31915ce9 gsdx: glsl: fix silly typo
And regression on various games
2016-04-27 09:52:35 +02:00
Gregory Hainaut aeb92592e7 gsdx ogl: use GSUtil::GetClassVertexCount 2016-04-26 19:29:04 +02:00
Gregory Hainaut df70b8bb0e gsdx: fix Q NaN value
Avoid potential undefined results
2016-04-26 19:09:32 +02:00
Gregory Hainaut 726b901dc5 Merge pull request #1304 from PCSX2/gsdx-faster-texture-cache
gsdx tc: reduce texture cache overhead
2016-04-26 16:46:44 +02:00
Gregory Hainaut 49d175b677 gsdx tc: allow to create a dummy Source without tons of memory allocation
It makes shared texture virtually free from the CPU PoV.
2016-04-24 22:30:56 +02:00
Gregory Hainaut ad08701cb1 gsdx tc: trick the texture cache to use a depth format for depth texture
This way we avoid the rescaling of the depth buffer and texture allocation.
2016-04-24 22:18:26 +02:00
Gregory Hainaut 1960d51e60 gsdx tc: properly support 16 bits depth conversion 2016-04-24 22:18:26 +02:00
Gregory Hainaut de38963904 gsdx ogl: plug the new depth sampling in the renderer
Note:
When source format is depth, integral texture coordinate must be used => depth_fmt 1/2/3
2016-04-24 22:18:26 +02:00
Gregory Hainaut fda511a949 gsdx glsl: extend hw shader to sample depth texture
Will use integral coordinate to avoid any rescaling.

Bilinear interpolation isn't supported. I don't think it is allowed to
filter a depth texture anyway.
2016-04-24 22:18:26 +02:00
Gregory Hainaut 583de1bf0b gsdx tc: add a dedicated function to lookup a depth source
The hypothesis is that game will use a depth (aka Z32/Z24/Z16/Z16S)
format when sampling depth texture as color.  Technically one could use
a standard color format but block/pixel order won't be the same.
(otherwise I'm screwed)

=> Hypothesis invalid on GoW. They just do a scrambled rendering...

Lookup info:
* The first searched list is the depth pool as we search a depth
  texture.
* 2nd one is the render target pool (if a depth was converted to a
  render target already)

To avoid any CPU overhead, the source will be a pointer to the real texture
* Conversion (if float texture) will be done on the fly by the shader (GPU).
* Relative rescaling won't be supported. Texture must be fetched with
  integral coordinate
2016-04-24 22:18:26 +02:00
Gregory Hainaut 9ee090a36e gsdx tc: add a shareable texture flag
Plan is to bypass shader conversion/rescaling/copy for depth texture
2016-04-24 22:18:26 +02:00
Gregory Hainaut 8ec1461842 gsdx: increase the number of texture in the pool
It could slightly increase the VRAM requirement but it will reduce texture
allocation/unallocation at start/end of frame.
2016-04-24 22:14:51 +02:00
Gregory Hainaut b4b878ac24 gsdx-ogl: add a note for a future small optimization 2016-04-24 22:14:51 +02:00
Gregory Hainaut 4281b8630b gsdx ogl: remove the useless shadeboost Constant Buffer 2016-04-24 11:08:14 +02:00
Gregory Hainaut d610a6aac4 gsdx glsl: ofc forget to do the shader in bin 2016-04-24 11:07:46 +02:00
Gregory Hainaut d027ed2092 gsdx ogl: merge GSTextureFXOGL to GSDeviceOGL
First file is rather small in openGL. And it is linked to the latter.
2016-04-24 10:55:22 +02:00
Gregory Hainaut 1558220f74 gsdx glsl: create a common header definition
* avoid duplication between all the files for UBO
* remove various interface define
2016-04-24 10:54:39 +02:00
Gregory Hainaut 8ee0783bd3 GSdx: remove useless variable 2016-04-24 10:42:03 +02:00
Gregory Hainaut fa1377a8ee gsdx tc: reduce texture cache overhead
Cache page coverage of texture into a hash map

Test done on Champion of Norrath (paltex + DisablePartialInvalidation)

Profiler:
Self of GSTextureCache::SourceMap::Add 5.39% => 0.23%
Self of GSTextureCache::LookupSource 15.27% => 10.82%

Hard to measure on CoN as it depends on memory transfer. Seem to be 5-10 fps faster.
2016-04-23 19:22:58 +02:00
Gregory Hainaut 67e955919f gsdx: keep dump code enabled in dev release too 2016-04-23 18:29:56 +02:00
Gregory Hainaut a149d6b26f gsdx: use psm.bpp flag to improve code reading 2016-04-23 18:29:39 +02:00
Gregory Hainaut dd98a0b913 gsdx: add a depth format flag 2016-04-23 18:28:50 +02:00
Gregory Hainaut 87867beb0e gsdx-ogl: remove the invalidation of texture
It doesn't help the perf and only create overhead (test done on snow engine game)
2016-04-21 21:07:17 +02:00
Gregory Hainaut 3709b5aecc gsdx: add a small comment to ease code reading 2016-04-21 09:28:44 +02:00
Gregory Hainaut b5ec683318 gsdx-linux: remove custom resolution from the GUI
It would be replaced by a float resolution factor
2016-04-21 09:28:44 +02:00
Gregory Hainaut 821e3ff294 gsdx-ogl: reduce length of debug message 2016-04-21 09:28:44 +02:00
Gregory Hainaut 8217c717f6 gsdx-ogl: require GL_KHR_debug
Will reduce the slowdown on debug build
2016-04-21 09:28:44 +02:00
Gregory Hainaut 9598417f42 gsdx-ogl: GL_ARB_copy_image is now mandatory 2016-04-21 09:28:44 +02:00
Gregory Hainaut 99bccc6dff gsdx-ogl: remove the geometry shader blacklist for Gallium Mesa drivers 2016-04-21 09:28:44 +02:00
Gregory Hainaut cb8088216b Merge pull request #1281 from PCSX2-Alpha/NTSC_saturation
GSDX: Remove some unnecessary/dubious hacks
2016-04-21 09:28:30 +02:00
Gregory Hainaut 59ef668fd2 Merge pull request #1222 from PCSX2/gsdx-black-fmv
Gsdx black fmv
2016-04-21 09:25:36 +02:00
Lauri Kasanen 994c9147f5 textureSW: fix Map with offset 2016-04-19 21:22:53 +03:00
refractionpcsx2 dcb676765e GSdx: Clean up some warning under windows (#1289) 2016-04-14 11:00:58 +01:00
Gregory Hainaut 2e567d6d55 gsdx ogl: update comment
something to test in the future
2016-04-14 10:19:18 +02:00
Gregory Hainaut d129aedfe8 GSdx:vector: add sllv32 and srlv32 for 128 bits op
(variable shift)
2016-04-14 10:18:43 +02:00
Gregory Hainaut 8a7184be3f gsdx: fix hack logic 2016-04-12 11:36:24 +02:00
Gregory Hainaut 6a09fa56fb gsdx: disable nocturne CRC hack
Yeah one less !
2016-04-11 22:41:19 +02:00
Gregory Hainaut 4611264ce3 gsdx: add CRC hack for Nocturne PAL
Reduce depth transfer to the real size of the game. Otherwise
we need to handle a mix of color/depth transfer.
2016-04-11 16:04:04 +02:00
Gregory Hainaut 22a40b65ae gsdx-ogl: always use 1 for GL_UNPACK_ALIGNMENT
Avoid a gl function call for each texture uploads
2016-04-11 12:45:11 +02:00
Jonathan Li d158d4de51 windows: Move baseclasses to a separate project
It saves the buildbots from needlessly recompiling the files for each GSdx
configuration.
2016-04-11 00:22:31 +01:00
Gregory Hainaut 847b57907e Revert "gsdx-ogl: add a new hack to force anisotropic filtering"
This reverts commit 53690cf9d0.

Quoting user:

 For aliasing, the option allow of reduce a little but always very
 visible compared with DX11 even with anisotropic OFF, , furthermore
 many textures bug added with option activated (predictable but not see
 on DX11 with anisotropic ON).

TL;DR doesn't worth it.

Note: it seem to work on DX because DX uses HW texturing in clamp region
mode (and others invalid case). OpenGL uses SW texturing to ensure accuracy
2016-04-10 17:30:49 +02:00
Gregory Hainaut 2941adf364 gsdx ogl: use the new pipeline API
Pre build all SW shader into pipeline.

Directly bind the pipeline instead of all pipeline stages. (less work for the driver)
2016-04-10 17:28:05 +02:00
Gregory Hainaut 95e3dcb448 gsdx-ogl: improve the shader program management
* keep a reference of program/pipeline created to ease the deletion
* extend a bit the API to support multiple pipeline

Final goal will be to use a pre link pipeline for SW shaders. And uses
the default pipeline for HW shaders.
2016-04-10 17:05:33 +02:00
Gregory Hainaut 395e2f31d0 gsdx-ogl: remove dead code (due to legacy removal) 2016-04-10 14:23:58 +02:00
Gregory Hainaut 3f404c8edb gsdx-ogl: update shader pipeline intertace to use vs/gs/ps triplet
Better to have 1 function calls with 3 parameters rather 3 functions call with 1 parameter.
2016-04-10 14:14:30 +02:00
Gregory Hainaut 53690cf9d0 gsdx-ogl: add a new hack to force anisotropic filtering
By default, anisotropic filtering was disabled when textures aren't countinuous.
This hack allows to force it. It can help to reduce aliasing but it would create
unexpected effect on texture boundaries.

Again, someone ought to add the option on Windows too
2016-04-10 13:53:17 +02:00
Gregory Hainaut 9e6cb79f4e gsdx linux: move depth option as a speed hack
Someone ought to add the Windows option too (and DisablePartialInvalidation too)

It might break a couple of games but most of them run better with depth enabled.
2016-04-10 13:22:55 +02:00
Gregory Hainaut 12443da00c GSdx ogl: ouch the typo exp != exp2
Fix some rounding issue on depth effect (shadow in Dot hack games)
2016-04-10 11:31:40 +02:00
Gregory Hainaut 7aaf36d24d gsdx ogl: add function pointer for framebuffer no attachment extension
Could be useful in the future
2016-04-10 11:31:40 +02:00
Gregory Hainaut 7cc13ce99c gsdx-ogl: only bind the FB to the draw FB 2016-04-10 11:31:40 +02:00
Gregory Hainaut d533c393b2 gsdx ogl: rely on DSA API 2016-04-10 11:31:40 +02:00
Jonathan Li fb97de7f79 gsdx:windows: Fix crash on psx side of plugin
I forgot it had a psx emu interface.
2016-04-09 19:56:23 +01:00
Gregory Hainaut b9e8384c11 gsdx-ogl: move the mandatory extension into mandatory section 2016-04-07 22:29:35 +02:00
Gregory Hainaut 121e92a829 gsdx ogl: remove a now useless warning message 2016-04-07 22:28:11 +02:00
Gregory Hainaut 4475c4fe7c gsdx linux: remove the old extension options 2016-04-07 22:27:33 +02:00
Gregory Hainaut cef76de547 gsdx ogl: GL_ARB_direct_state_access is now mandatory 2016-04-07 22:27:28 +02:00
Gregory Hainaut a62019a3fd gsdx-ogl: found_GL_ARB_buffer_storage is now mandatory 2016-04-07 22:17:22 +02:00
Gregory Hainaut 52e3c3516d gsdx-ogl: GL_ARB_separate_shader_objects is now mandatory 2016-04-07 22:11:35 +02:00
Gregory Hainaut f751f70b1e gsdx ogl: GL_ARB_clip_control is now mandatory 2016-04-07 21:57:54 +02:00
Gregory Hainaut dfb4b5a339 gsdx-ogl: GL_ARB_texture_barrier is now mandatory
(GL4.5 extension)
2016-04-07 21:51:37 +02:00
Gregory Hainaut 1208dbe8c7 cmake: add an option to build the new legacy GSdx plugin
+ bump the new one to 1.1.0 (to ease reporting)
2016-04-07 21:46:42 +02:00
Gregory Hainaut 8ccdc05c08 Merge pull request #1217 from PCSX2-Alpha/CRTC_option
GSDX : Add an option for CRTC size and some other video mode stuffs
2016-04-07 21:24:46 +02:00
Gregory Hainaut 17886a9808 gsdx-ogl: allow some accurate date when GL_ARB_shader_image_load_store isn't supported
Close #1282
2016-04-07 19:29:46 +02:00
Jonathan Li 69a84a2782 gsdx:windows: Don't call GSshutdown in GSconfigure
Fixes an issue with the D3D backends crashing if the configure dialog
is accessed and ok is pressed. The D3Dcompiler dll is freed and a null
pointer is dereferenced.

It might break gsdxgui but GSshutdown really should not be called unless
GSdx is shutting down. GSDumpGUI on Windows provides the same (or
better) functionality.
2016-04-07 18:18:36 +01:00
Akash a1b0ae467e GSDX: Remove dubious/unnecessary hacks
* Silent Hill 2 doesn't need the CRC hack
* GSRenderer: no need to explicitly set bottom value for r.
* Texture Cache: Removed a check which couldn't possibly enter true
branch.
2016-04-07 15:15:39 +05:30
Akash 69c9a3d793 GSDX: Add an option to disable NTSC saturation
v2: convert it into a member variable.
2016-04-07 15:15:17 +05:30
Jonathan Li e16b367e6e windows: Workaround weird LoadLibraryEx failures
For some reason some Windows 7 systems (most are unaffected) cannot cope
with LoadLibraryEx and return error code 87 - "The parameter is
incorrect".

Switch to using LoadLibrary instead for any case where Windows 7 is
expected to successfully load the requested dll. Potentially Windows
Vista is also affected.
2016-04-06 19:52:59 +01:00
Gregory Hainaut da9577076c Merge pull request #1278 from PCSX2/gsdx-EE-read-depth-support
gsdx ogl: allow to read the depth buffer
2016-04-06 12:20:16 +02:00
Gregory Hainaut b8a023d158 gsdx ogl: mark OGL object as final
Give the compiler more devirtualization hint
2016-04-05 00:01:43 +02:00
Gregory Hainaut decac5fd12 gsdx ogl: implement an empty BeginScene
Compile will devirtualize it and then remove it during the inline.
2016-04-04 23:32:11 +02:00
Gregory Hainaut cb279ef321 gsdx ogl: help compiler to devirtualize 2016-04-04 23:12:31 +02:00
Gregory Hainaut e3787b6b3c gsdx-ogl: use final qualifier to help compiler
Improve Devirtualization optimization
2016-04-04 22:52:59 +02:00
Gregory Hainaut 771583c559 gsdx-ogl: help the compiler to propagate stride constant
Optimize various multiplication

Note: potentially we can do it with constexpr but I'm not sure of compiler support
2016-04-04 22:46:31 +02:00
Gregory Hainaut 8943a9db4a gsdx hw: GS can draw 2 frames in a single framebuffer
So let's increase the height. It will increase the memory requirement on some games

v2: try to do it automatically
(not sure it will useful as most game will requires it)
v3: let's back to an hardcoded 1280 size. It generates too much issue
2016-04-04 21:30:40 +02:00
Gregory Hainaut 063d2e568a gsdx tc: re-implement frame lookup
Try to avoid random black screen frame

v2: don't force the preload hack on the frame
It creates a ghost image over FMV

v3: support offset within a frame
2016-04-04 21:30:37 +02:00
Gregory Hainaut eec74fd963 gsdx hw: Add an alternate draw call for FMV rendering
The long story:
Game blits FMV far aways of the RT which is actually the input of the RO texture...
Currently GSdx suffers of 2 bugs.
1/ RT is too small
2/ texture isn't properly updated with the rendered value. Texture is invalidated
but it reads back the pixels from the GS memory whereas the correct
value is located on the GPU.

This commit will replace the standard draw by a manual blit. Therefore it avoid
size issue and bad upscaling issue.

v2:
* Use various copy to be more compatible with dx api
* Move all part of the hack info the BlitFMV function

v3: add log message
2016-04-04 21:29:32 +02:00
Gregory Hainaut 72d43b2e56 gsdx tc: add an invalidation procedure to drop sub rt
It will be used in next commit. However, it might not be the best solution
2016-04-04 21:29:32 +02:00
Gregory Hainaut 2ca624c8c6 gsdx tc: implement a read function of Source texture
It will be used in the following commit
2016-04-04 21:29:31 +02:00
Gregory Hainaut d922225e69 gsdx tc:invalidate RT when a texture is written inside it
It often happens the game try to upload the FMV directly which typically
gave a black screen.

Commit fix rules of roses and I hope various black screen FMV

Performance impact must be tested, and I'm afraid of strange texture cache behavior.

V2: check the size of the transfer too
V3: add support of 16 bits format
V4: avoid division by 0
2016-04-04 21:29:31 +02:00