[SOLVED] The King of Fighters XIV CBT black screen issue
- Silent
- Topic Author
steamcommunity.com/app/571260/discussion...1291816569119818972/
injecting any ReShade shader results in black screen and broken GUI. Upon closer inspection, using a Debug build of ReShade with KOF results in KOF being unable to create an OpenGL 4.3 context and throws a tantrum. The faulty call seems to be included in the log file:
2017-05-20T13:51:39:016 [51536] | INFO | Redirecting 'wglCreateContextAttribsARB(FFFFFFFFB50126F1, 0000000000000000, 0000006E9AEFEFA0)' ...
2017-05-20T13:51:39:016 [51536] | INFO | > Requesting compatibility OpenGL context for version 4.3 ...
2017-05-20T13:51:39:016 [51536] | WARN | > 'wglCreateContextAttribsARB' failed with error code 87!
Since the game is in closed beta stage, it's highly likely the game itself, not ReShade, is at fault. However, it would be good to know for sure since the game breaking on generic ReShade hooks implies it's doing something highly nonstandard.
Cheers!
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
Probably a good idea to include a full log - you can see that this context indeed appears earlier and thus seems valid:
pastebin.com/ixcjzDqm
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
crosire wrote: AH. Then that's two separate issues. The debug builds adds an additional flag to context creation. Appears like your graphics driver doesn't like it.
I'm testing this on MSI GTX 1070 with 381.65 drivers, so I would consider this fairly unlikely to be a faulty driver. Though maybe it's a good excuse to update to 382.xx...
Is there any way to gather more info about what's failing here?
EDIT:
Updated my drivers to 382.05 - context creation still fails.
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
Either way, probably easiest to check what params ReShade receives and forwards from the game and then build upon that... will handle it later. And then there is an issue with UI being completely broken (even with no reshade shaders) and black screen upon injecting any shaders, but let me handle the context issue first.
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
In wglCreateContextAttribsARB the attribs array is 7 entries long - ReShade checks for 5 attribs passed from the application (in the case of KOF, from SDL2), adds the 6th by itself and 7th in debug compilations. There seem to be two problems surfacing from it:
1) KOF passes 5 parameters, so in debug builds all 7 entries get filled. Doesn't this list need to be null terminated? An 8th null entry might have to be added.
2) KOF already passes WGL_CONTEXT_FLAGS_ARB and debug code adds yet another one - I don't know what requirements wglCreateContextAttribsARB has, but it feels fishy to pass the same parameter twice. ReShade should instead post this parameter only if the app doesn't do it - and if it does, add it in the first entry earlier.
I'm not familiar with OGL like at all - is there any place with docs for wgl* functions?
EDIT:
Yep, debug builds launch fine with these two changes now - black screen issue still persists, but this is indeed a different issue. A main one, actually.
EDIT2:
That's how the game looks with no shaders injected - notice broken HUD:
When any shader gets injected, screen goes black (except the HUD). Ctrl+F'ing the log file for "error" gives no results. Any ideas?
Please Log in or Create an account to join the conversation.
- crosire
The problem was 1) most likely. The list indeed has to be null-terminated.Silent wrote: 1) KOF passes 5 parameters, so in debug builds all 7 entries get filled. Doesn't this list need to be null terminated? An 8th null entry might have to be added.
2) KOF already passes WGL_CONTEXT_FLAGS_ARB and debug code adds yet another one - I don't know what requirements wglCreateContextAttribsARB has, but it feels fishy to pass the same parameter twice. ReShade should instead post this parameter only if the app doesn't do it - and if it does, add it in the first entry earlier.
I'm not familiar with OGL like at all - is there any place with docs for wgl* functions?
See my comment on github.com/crosire/reshade/pull/12 . You can pass attributes multiple times and only the last one should be used.
Might be useful to get some debug output from OpenGL via www.khronos.org/registry/OpenGL/extensio...ARB_debug_output.txt . Maybe that gives a hint. But a black screen usually means ReShade does not draw its fullscreen pass correctly. This is because before drawing, ReShade clears the backbuffer to zero (black). You can verify that by changing the clear color at github.com/crosire/reshade/blob/master/s...ngl_runtime.cpp#L773 to something like red.Silent wrote: When any shader gets injected, screen goes black (except the HUD). Ctrl+F'ing the log file for "error" gives no results. Any ideas?
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
About debug outputs, I presume ReShade doesn't hook those up already?
Actually, some shaders do seem to work but they have to be activated after the game's already started.
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
github.com/bacondither/reshade/commit/81...2f494b62de0e9a9d9463
Apparently it fixes GUI issues and movies not showing in KoF! It might be a more common issue after all, since the commit is dated Apr 26 and KoF CBT debuted on May 15.
What do you think? What's the reason behind these extra checks on your end? Is it working around some game issues and KoF is using those improperly?
EDIT:
Well damn, it fixes the other issue too!!!
There is one issue left and it may concern a depth buffer - when some shaders are enabled (Adaptive Fog, DOF...) I can see an artifact which looks like one of the shadows from the scene. DisplayDepth shader shows it best:
Please Log in or Create an account to join the conversation.
- crosire
ReShade calls "glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE)" a few lines above that for internal usage, so theoretically there should be no need to call it with the same arguments again later, which is why those extra checks are there (prevent driver overhead). No idea why removing those fixes things.Silent wrote: What do you think? What's the reason behind these extra checks on your end? Is it working around some game issues and KoF is using those improperly?
Just the wrong buffer chosen here. Probably some shadow depth buffer, that was picked up instead of the one containing the scene from main camera perspective.Silent wrote: There is one issue left and it may concern a depth buffer - when some shaders are enabled (Adaptive Fog, DOF...) I can see an artifact which looks like one of the shadows from the scene.
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
There's quite a lot going on between these calls though - maybe state blocks modify those?crosire wrote: ReShade calls "glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE)" a few lines above that for internal usage, so theoretically there should be no need to call it with the same arguments again later, which is why those extra checks are there (prevent driver overhead). No idea why removing those fixes things.
Sounds game specific... I reckon there is no obvious way to fix it then?crosire wrote: Just the wrong buffer chosen here. Probably some shadow depth buffer, that was picked up instead of the one containing the scene from main camera perspective.
EDIT:
Erm... this
(clip_origin != GL_LOWER_LEFT && clip_depthmode != GL_ZERO_TO_ONE)
probably needs to be this
(clip_origin != GL_LOWER_LEFT || clip_depthmode != GL_ZERO_TO_ONE)
EDIT:
Yep! Works fine now, heh. That only leaves depth buffer, any idea if anything can be done with it? Either from reshade or the game.
EDIT2:
github.com/crosire/reshade/pull/13
Please Log in or Create an account to join the conversation.
- crosire
Ouch. Good catch.Silent wrote: Erm... this
probably needs to be this
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
Please Log in or Create an account to join the conversation.
- crosire
EDIT: What I usually do is attach a debugger and check each entry in the "_depth_source_table" list manually, then check out its properties and see what numbers I have to tweak for the branch to pick it up.
Please Log in or Create an account to join the conversation.
- docer
Please Log in or Create an account to join the conversation.
- Silent
- Topic Author
steamcommunity.com/app/571260/discussion...c1291817208502486360
Please Log in or Create an account to join the conversation.