Im-dex / xray-162

XRay engine 1.6.2 (S.T.A.L.K.E.R: Call of Pripyat) evolution
Apache License 2.0
47 stars 12 forks source link

Screen flickering #11

Closed revolucas closed 7 years ago

revolucas commented 7 years ago

Hello, great repo you have here, very clean and clear direction. But I appear to have strange screen flickering for a short time while in-game (not in main menu). It seems to go away after about a minute or so but reappears when applying vid_restart (ie. changing graphics settings) Have you had a similar issue?

Im-dex commented 7 years ago

Hello! Thanks for your interest. Could you provide a short video with that effect? It can help me better understand the issue. I also will be appreciated if you provide a "save" for that video.

ghost commented 7 years ago

Hi, I also have to say that this is a great repo. Very refreshing after coming from Open Xray :) I'm waiting for my download to finish and will then upload a video I took of it. It's very reproducable. It happens every time when you first start the game and then gradually goes away. I do know that on Open Xray anyway there was a dxguid.lib replacement for whatever reason, maybe it was to fix this issue?

ghost commented 7 years ago

https://youtu.be/Y9lstMNW-Qg Ignore the music :P

revolucas commented 7 years ago

Part 1: https://www.youtube.com/watch?v=hea5IVHCZPo Part 2: https://www.youtube.com/watch?v=2Oyjtl8yL8I

It's two parts because bandicam starts new video when I type 'vid_restart' in dev console. Part 2 shows that it is not screen tearing because it doesn't happen in over UI.

If this isn't happening for you, Im-dex, I wonder then we made a mistake in setting up the repo? I have Windows SDK 8.1 installed and DX9 June 2010. Anything special need done?

ShokerStlk commented 7 years ago

Try r2_tonemap off (for test only) + delete shader_cache (just in case)

revolucas commented 7 years ago

Sadly, does not fix the issue. Happens on all renderers on every preset setting. But other then this everything appears to work correctly. I also have a CoC merge with this repo that works great except this issue.

It looks like screen tearing but it isn't. It doesn't affect UI and Vsync and RefreshRate60hz have no effect.

Im-dex commented 7 years ago

@revolucas @Swartz27 Thanks for the video, guys! Got it.

I confirm that the issue is reproduced on my build, I just didnt pay attention on it. So I think it is not directx or winsdk problem, most likely it is going to be my mistake.

Im-dex commented 7 years ago

FYI I have found that the issue has appeared since the following commit c6e1d073a45396d1bf30aaecfda0d85eab77ec12. If anyone sees the problem place, please, let me know.

revolucas commented 7 years ago

Possible lead on this. In other engine build I have I see this in log:

  • NVidia MGPU: Logical(1), Physical(1)
  • Starting rendering as 2-GPU.

But in im-dex repo I see this:

  • NVidia MGPU: Logical(1), Physical(1)
  • Starting rendering as 8-GPU.

Which doesn't seem right.

EDIT:

I manually put return 2; inside GetGpuNum() of HWCaps.cpp and lo and behold it fixed it!

I cannot see what you did wrong though, do you have any idea what is wrong with the min and max calculations?

EDIT2:

        u32 res = GetNVGpuNum();
    Msg("debug1 std::max(%d, %d)  = %d", res, GetATIGpuNum(), std::max(res, GetATIGpuNum()));
    res = std::max( res, GetATIGpuNum() );
    Msg("debug2 %d", res);
    res = std::max( res, (u32)2 );
    Msg("debug3 %d", res);
    res = std::min( res, (u32)CHWCaps::MAX_GPUS );
    Msg("debug4 %d", res);

Output:

* NVidia MGPU: Logical(1), Physical(1)
debug1 std::max(1, -1)  = -1
debug2 -1
debug3 -1
debug4 8
* Starting rendering as 8-GPU.

std::max(1,-1) is returning -1? std:max(-1,2) is returning -1? std:min(-1,8) is returning 8?

I don't understand?

Im-dex commented 7 years ago

@revolucas Hi, good catch! Sorry for delay. std::max returns -1 due to res is unsigned integer and so -1 also interprets as unsigned (max u32 value).

revolucas commented 7 years ago

I get that much but why is the return value signed? Wouldn't it be 4294967295? Which would have made this error more obvious.

Im-dex commented 7 years ago

My previous message a little bit incorrect. In the main code GetNVGpuNum and GetATIGpuNum returns -1 value, but they return type is u32. So std::max takes two u32 values: one res and one U32_MAX. Your code outputs -1 because you use %d, which means: print value as signed integer. If you replace %d by %u then you can see 4294967295.