Welcome, Guest.
Username: Password: Remember me

TOPIC: [SOLVED] The King of Fighters XIV CBT black screen issue

The King of Fighters XIV CBT black screen issue 9 months 2 days ago #1

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
According to this topic on Steam boards:
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!
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 9 months 2 days ago #2

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
Code 87 is ERROR_INVALID_PARAMETER. But I don't see anything wrong with the call per se. Provided that the device context handle FFFFFFFFB50126F1 is a valid device context with OpenGL support (it should probably appear earlier in the log at some point). Must be something wrong with the attribute list (third parameter). The only thing that comes to mind is that ReShade does not currently pass on the value of WGL_CONTEXT_FLAGS_ARB unless you build a debug build, which could be a problem. Then again, you mentioned this occurs in a debug build as well.
Cheers, crosire =)
Last Edit: 9 months 2 days ago by crosire.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 9 months 2 days ago #3

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
Exactly - moreover, the game boots fine in Release (since players have been able to try it out and then find out using any shaders results in black screen) while my attempt to run a debug ReShade results in context not being created correctly.

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
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 9 months 1 day ago #4

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
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.
Cheers, crosire =)
The administrator has disabled public write access.

The King of Fighters XIV CBT issues 9 months 1 day ago #5

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
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.
Last Edit: 9 months 1 day ago by Silent. Reason: Driver update did not help at all
The administrator has disabled public write access.

The King of Fighters XIV CBT issues 9 months 1 day ago #6

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
I'm not saying it's a bug in the driver, I'm saying the driver doesn't accept the combination of flags, which can have various reasons.
Cheers, crosire =)
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 9 months 1 day ago #7

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
Yeah, but unless the combination of flags is forbidden by OGL specifications (in which case ReShade would be at fault), it could be consideted an issue with proper OGL implementation?

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.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 9 months 1 day ago #8

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
Alright, I think I found the issue!

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?
Last Edit: 9 months 1 day ago by Silent.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 9 months 1 day ago #9

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
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?
The problem was 1) most likely. The list indeed has to be null-terminated.
See my comment on github.com/crosire/reshade/pull/12. You can pass attributes multiple times and only the last one should be used.

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?
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.
Cheers, crosire =)
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 9 months 23 hours ago #10

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
Looks like there is no clearing going on at all (this is even after I changed glClearBufferfv colour).



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.
Last Edit: 9 months 23 hours ago by Silent.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #11

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
That's intriguing... I cheched different ReShade forks and stumbled upon this change which never made it to master:
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:
Last Edit: 8 months 3 weeks ago by Silent.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #12

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
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?
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:
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.
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.
Cheers, crosire =)
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #13

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
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.
There's quite a lot going on between these calls though - maybe state blocks modify those?

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.
Sounds game specific... I reckon there is no obvious way to fix it then?

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
Last Edit: 8 months 3 weeks ago by Silent.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #14

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
Silent wrote:
Erm... this

probably needs to be this
Ouch. Good catch.
Cheers, crosire =)
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #15

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
So with the major issue out of the way, can anything be done with wrong depth buffer being picked?
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #16

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2910
  • Thank you received: 1683
The heuristic that does the detection can be modified: github.com/crosire/reshade/blob/master/s...ngl_runtime.cpp#L888 (warning, ugly code ahead, never got around cleaning that up).

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.
Cheers, crosire =)
Last Edit: 8 months 3 weeks ago by crosire.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #17

How do I make it work?
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 8 months 3 weeks ago #18

  • Silent
  • Silent's Avatar
  • Offline
  • CookiePLMonster
  • Posts: 10
For now you should either compile the newest ReShade from source or grab this binary:

steamcommunity.com/app/571260/discussion...c1291817208502486360
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 6 months 2 weeks ago #19

The game creates a log file of the events happening as you play. You can find the file called "debug.log" within your THE KING OF FIGHTERS XIV CBT installation folder. Note that this file is overwritten every time you start the title, so if you already restarted after the issue, it will not hold information from your last playthrough.
King of Fighters 1.85
Last Edit: 6 months 2 weeks ago by WendyLong.
The administrator has disabled public write access.

The King of Fighters XIV CBT black screen issue 4 months 2 weeks ago #20

The debug.log file I did not find it.
clicker heroes, geometry dash
The administrator has disabled public write access.