-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GSdx: Add CPU Frame buffer Conversion Hack #2086
GSdx: Add CPU Frame buffer Conversion Hack #2086
Conversation
301e841
to
7dffd51
Compare
plugins/GSdx/GSSetting.cpp
Outdated
@@ -122,6 +122,13 @@ const char* dialog_message(int ID, bool* updateText) { | |||
case IDC_TC_DEPTH: | |||
return "Disable the support of Depth buffer in the texture cache.\n" | |||
"It can help to increase speed but it will likely create various glitches."; | |||
case IDC_8BITCPUFBHACK: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSSetting.h
Outdated
@@ -63,6 +63,7 @@ enum { | |||
IDC_ACCURATE_BLEND_UNIT, | |||
IDC_ACCURATE_DATE, | |||
IDC_TC_DEPTH, | |||
IDC_8BITCPUFBHACK, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSSettingsDlg.cpp
Outdated
@@ -698,6 +698,7 @@ void GSHacksDlg::OnInit() | |||
CheckDlgButton(m_hWnd, IDC_PRELOAD_GS, theApp.GetConfigB("preload_frame_with_gs_data")); | |||
CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfigB("UserHacks_align_sprite_X")); | |||
CheckDlgButton(m_hWnd, IDC_TC_DEPTH, theApp.GetConfigB("UserHacks_DisableDepthSupport")); | |||
CheckDlgButton(m_hWnd, IDC_8BITCPUFBHACK, theApp.GetConfigB("UserHack_cpu_8bis_fb_conversion")); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSdx.rc
Outdated
@@ -142,6 +142,7 @@ BEGIN | |||
CONTROL "Alpha",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,34,8 | |||
CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,71,57,8 | |||
CONTROL "Disable Depth Emulation",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,84,92,8 | |||
CONTROL "CPU FB Conversion", IDC_8BITCPUFBHACK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 84, 91, 8 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
e1deb2f
to
66faf74
Compare
b6444b1
to
a02a091
Compare
b970e55
to
7d13e95
Compare
plugins/GSdx/GSTextureCache.cpp
Outdated
// 2/ even with upscaling | ||
// 3/ for both DX and OpenGL | ||
if (m_cpu_8bit_fb_coversion && psm == PSM_PSMT8) | ||
// Hack can fix broken textures on games such as: Harry Potter games (Direct3D and OpenGL), Fifa Street games (Direct3D only), MGS3 (Direct3D only). |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Copy/past GLSL code, replace the above. Update header/return based on other HLSL equivalent (ps_main0). Oh I just saw that you need also the ScalingFactor constant buffer parameter. My code is awful without comment... |
8f69412
to
9b25560
Compare
plugins/GSdx/GSSetting.cpp
Outdated
@@ -122,6 +122,13 @@ const char* dialog_message(int ID, bool* updateText) { | |||
case IDC_TC_DEPTH: | |||
return "Disable the support of Depth buffer in the texture cache.\n" | |||
"It can help to increase speed but it will likely create various glitches."; | |||
case IDC_8BIT_CPU_FBHACK: | |||
return "Forces 8-bit shader conversion to be done on the CPU instead of the GPU but performance will be slower.\n" | |||
"Direct3D doesn't support shader conversion , OpenGL does support shader conversion but it doesn't render some corners properly.\n" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSSetting.cpp
Outdated
"Direct3D doesn't support shader conversion , OpenGL does support shader conversion but it doesn't render some corners properly.\n" | ||
"The hack can fix glitches or broken graphics in some games.\n" | ||
"Harry Potter games (Direct3D and OpenGL).\n" | ||
"Fifa Street games (Direct3D).\n" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSdx.rc
Outdated
@@ -142,6 +142,7 @@ BEGIN | |||
CONTROL "Alpha",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,34,8 | |||
CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,71,57,8 | |||
CONTROL "Disable Depth Emulation",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,84,92,8 | |||
CONTROL "CPU 8-bit FB Conversion", IDC_8BIT_CPU_FBHACK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 84, 92, 8 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSTextureCache.cpp
Outdated
// 3/ for both DX and OpenGL | ||
if (m_cpu_8bit_fb_coversion && psm == PSM_PSMT8) | ||
// Direct3D doesn't have a shader conversion so it needs to be done on the CPU side which causes slowdowns (Fifa Street). | ||
// OpenGL has a shader but it doesn't handle some corners properly (Harry Potter, COD ?, Kung fu Panda ?). |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSTextureCache.cpp
Outdated
// 1/ it just works :) | ||
// 2/ even with upscaling | ||
// 3/ for both DX and OpenGL | ||
if (m_cpu_8bit_fb_coversion && psm == PSM_PSMT8) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
plugins/GSdx/GSTextureCache.h
Outdated
@@ -130,6 +130,7 @@ class GSTextureCache | |||
bool m_preload_frame; | |||
uint8* m_temp; | |||
bool m_can_convert_depth; | |||
bool m_cpu_8bit_fb_coversion; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
9b25560
to
f8ce3af
Compare
Updated. p.s. the shader port will be in a separate pr. Don't wanna delay this a month (maybe) or so. |
6caec8d
to
7e83c54
Compare
plugins/GSdx/GSdx.rc
Outdated
@@ -142,6 +142,7 @@ BEGIN | |||
CONTROL "Alpha",IDC_ALPHAHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,34,8 | |||
CONTROL "Alpha Stencil",IDC_ALPHASTENCIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,71,57,8 | |||
CONTROL "Disable Depth Emulation",IDC_TC_DEPTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,84,92,8 | |||
CONTROL "CPU 8-bit FB Conversion",IDC_8BIT_CPU_FBHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 14, 84, 92, 8 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
7e83c54
to
f9c648f
Compare
You can merge it if the code is ok @turtleli. |
plugins/GSdx/GSSetting.cpp
Outdated
@@ -122,6 +122,13 @@ const char* dialog_message(int ID, bool* updateText) { | |||
case IDC_TC_DEPTH: | |||
return "Disable the support of Depth buffer in the texture cache.\n" | |||
"It can help to increase speed but it will likely create various glitches."; | |||
case IDC_8BIT_CPU_FBHACK: | |||
return "Forces 8-bit shader conversion to be done on the CPU instead of the GPU but performance will be slower.\n" | |||
"Direct3D doesn't support shader conversion, OpenGL does support shader conversion but it doesn't render some corner cases properly.\n" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
effa6b2
to
fa9fe49
Compare
plugins/GSdx/GSSetting.cpp
Outdated
@@ -122,6 +122,13 @@ const char* dialog_message(int ID, bool* updateText) { | |||
case IDC_TC_DEPTH: | |||
return "Disable the support of Depth buffer in the texture cache.\n" | |||
"It can help to increase speed but it will likely create various glitches."; | |||
case IDC_CPU_FB_CONVERSION: | |||
return "Enables 4-bit and 8-bit frame buffer conversion to be done on the CPU instead of the GPU.\n\n" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Add HW Hack that enables Framebuffer Conversion on the CPU instead of the GPU. Can fix broken textures on games but at the cost of slower performance. List of games: Harry Potter games, FIFA Street games. Games like Call of Duty, Kung fu Panda might also be affected as well as others especially on Direct3D. Add HW Hack GUI option on Windows/Linux for 4-bit and 8-bit Framebuffer conversion hack named "Frame Buffer Conversion".
fa9fe49
to
5184d36
Compare
Updated. |
This hack cause massive slowdown and a driver crash (nvidia) in Mercenaries 2.It also cause graphics glitch and slowdown in MGS3 under OpenGL (DX is better with it). |
It's a hack. It should be enabled only if a game needs it. Otherwise no. |
I guess it shouldn't produce crashes, or? Slowdowns and glitches are obviously a different story. |
Why is this actually described as a hack? It's more accurate than the shader alternative, right? |
@atomic83GitHub Did you get the crash on OpenGL or Dx ? Maybe it consume too much memory. Speed wise, this hack will range from slow to very slow. Because you need @ssakash |
#gregory38 I use DX mode and I can confirm that the driver crash is a out of memory issue. |
@atomic83GitHub thanks for the info.Potentially we could reduce the memory usage. So far we do
All calls are synchronous (hence the slowness). So even if we have multiple offscreen texture, only one data buffer will be used. So instead to duplicate all data buffers, we could use a big common one. Anyway, my feeling is that this hack isn't a good solution most of the time. I.e. better port the glsl shader that can handle 90% of conversion at fast speed. |
Agreed. So far it seems only Harry Potter and TCoS will need it even with the ported shader. And I guess games that use 4-bit as well. |
@gregory38 Which shader is it? I don't get different results on OGL compared to DX with this hack. |
pcsx2/plugins/GSdx/res/glsl/convert.glsl Line 199 in 51c64fc
FIFA-Street-8bits and Blending.zip |
@lightningterror Thanks for the info. I tried a quick port to DX for easier testing, but speed was terrible. I hope I did something wrong. :p Will look more into it later to hopefully improve/expand the shader. |
This might help 😛 |
You don't need to add those. If anything, that would make things slower. EDIT: Turns out I did make a mistake unrelated to the shader that made things slower. :) |
I sense a PR Soon™. Btw the shader on ogl isn't perfect either. |
That was the point of my interest. I noticed your hack helps Stuntman, but I suspect the current shader doesn't work on that game because the game uses 4-bits. Have you found any more games that need the hack/improved shader? |
The shader is only for 8-bits. A new shader probably needs to be written for 4-bit. MGS3 maybe ? I'm not sure. I get no results on D3D with the FBC hack. The only result I get is enabling texture shuffle on D3D so it could be related to why I don't get any result in the first place. On top of that MGS3 also uses channel shuffle I think. Not sure tho. |
The shader have 2 limitations
In my opinion we should build a lookup table (texture) with the pixel position based on the various format offset. 8 bits texture is often uses with depth effect / channel shuffling / texture shuffling. It doesn't help to reduce the complexity... For the story I create the version of this shader for the blue fog of MGS3. However I don't remember if it was related to depth. I vaguely remember a (box?) fighting game (with night in the name) that also use 8 bits format (but it could be blending issue too). I really should upload all my gsdump somewhere... |
Yeah, I found it. It's Fight Night Round 2. Another EA title(like FIFA Street). And like FIFA Street it also needs blending to properly fix the issue. |
I'll just add this info here, it may be important. The FBC hack breaks channel shuffle effect on MGS3, dunno about other games. |
How is progress going ? |
There's hardly been any progress. I've been busy with other PCSX2 projects. I'll have to add some basic blending too for this work properly in Direct3D, so it'll take longer than just a simple shader port plus improvements. |
Add HwW Hack that enables 4-bit and 8-bit Frame buffer Conversion on the CPU.
Can fix broken textures on games but at the cost of slower performance.
List of games: Harry Potter games, Fifa Street games, MGS3 games.
Games like Call of Duty, Kung fu Panda might also be affected as well as others especially on Direct3D.
Add HW Hack GUI option on Windows/Linux for Framebuffer Convertion hack named "CPU FB Conversion."
Should fix
https://forums.pcsx2.net/Thread-Harry-Potter-and-The-Chamber-of-Secrets-SLES-51192-E-artifacting
Should Improve
#569